feat(support): continued migration to new field dof support system
mass normaliztion, gravity, displacement, and hydrostatic equilibrium are now migrated
This commit is contained in:
@@ -12,6 +12,8 @@ module mean_field;
|
||||
import :operators.prepared_hydrostatic_equilibrium;
|
||||
|
||||
namespace {
|
||||
using DomainSchema = mean_field::utils::domain::CoreEnvelopeVacuumDomainSchema;
|
||||
|
||||
void true_to_local(
|
||||
const mfem::ParFiniteElementSpace &finiteElementSpace,
|
||||
const mfem::Vector &trueVector,
|
||||
@@ -151,9 +153,18 @@ namespace mean_field::operators {
|
||||
"displacement finite-element space."
|
||||
);
|
||||
|
||||
m_enthalpySize = f.enthalpyFes->GetTrueVSize();
|
||||
m_gravityPotentialSize = f.gravityPotentialFes->GetTrueVSize();
|
||||
m_displacementSize = f.displacementFes->GetTrueVSize();
|
||||
const field::FieldDofMap enthalpyMap =
|
||||
field::make_field_dof_map<field::Enthalpy, DomainSchema>(*f.enthalpyFes);
|
||||
|
||||
const field::FieldDofMap gravityPotentialMap =
|
||||
field::make_field_dof_map<field::Gravity, DomainSchema>(*f.gravityPotentialFes);
|
||||
|
||||
const field::FieldDofMap displacementMap =
|
||||
field::make_field_dof_map<field::Displacement, DomainSchema>(*f.displacementFes);
|
||||
|
||||
m_enthalpySize = enthalpyMap.reduced_size();
|
||||
m_gravityPotentialSize = gravityPotentialMap.reduced_size();
|
||||
m_displacementSize = displacementMap.reduced_size();
|
||||
m_residualSize = m_enthalpySize;
|
||||
|
||||
m_totalSize = m_enthalpySize + m_gravityPotentialSize + 1 + m_displacementSize;
|
||||
@@ -265,6 +276,11 @@ namespace mean_field::operators {
|
||||
m_domainMapper.GetDimension() == m_fem.mesh->Dimension(), "The hydrostatic operator's stateless mapper "
|
||||
"dimension does not match the mesh dimension."
|
||||
);
|
||||
|
||||
m_enthalpyVariationTrue.SetSize(m_context.GetEnthalpyMap().full_size());
|
||||
m_gravityPotentialVariationTrue.SetSize(m_context.GetGravityPotentialMap().full_size());
|
||||
m_displacementVariationTrue.SetSize(m_context.GetDisplacementMap().full_size());
|
||||
m_fullEnthalpyAction.SetSize(m_context.GetEnthalpyMap().full_size());
|
||||
}
|
||||
|
||||
PreparedHydrostaticEquilibriumReport PreparedHydrostaticEquilibriumOperator::Prepare(
|
||||
@@ -320,8 +336,8 @@ namespace mean_field::operators {
|
||||
);
|
||||
|
||||
MFEM_VERIFY(
|
||||
m_cachedResidual.Size() == m_fem.enthalpyFes->GetTrueVSize(),
|
||||
"The prepared hydrostatic residual has the wrong size."
|
||||
m_cachedResidual.Size() == m_context.GetEnthalpyMap().reduced_size(),
|
||||
"The prepared hydrostatic residual has the wrong supported size."
|
||||
);
|
||||
|
||||
m_isPrepared = true;
|
||||
@@ -708,7 +724,10 @@ namespace mean_field::operators {
|
||||
localResidual.AddElementVector(data.enthalpyDofs, elementResidual);
|
||||
}
|
||||
|
||||
local_to_true(*m_fem.enthalpyFes, localResidual, m_cachedResidual);
|
||||
local_to_true(*m_fem.enthalpyFes, localResidual, m_fullEnthalpyAction);
|
||||
|
||||
m_cachedResidual.SetSize(m_context.GetEnthalpyMap().reduced_size());
|
||||
m_context.GetEnthalpyMap().gather(m_fullEnthalpyAction, m_cachedResidual);
|
||||
}
|
||||
|
||||
void PreparedHydrostaticEquilibriumOperator::BuildResidual(mfem::Vector &residual) const {
|
||||
@@ -723,9 +742,16 @@ namespace mean_field::operators {
|
||||
) const {
|
||||
VerifyPrepared();
|
||||
|
||||
MFEM_VERIFY(
|
||||
enthalpyVariation.Size() == m_context.GetEnthalpyMap().reduced_size(),
|
||||
"Prepared hydrostatic enthalpy variation has the wrong supported size."
|
||||
);
|
||||
|
||||
m_context.GetEnthalpyMap().scatter(enthalpyVariation, m_enthalpyVariationTrue);
|
||||
|
||||
mfem::Vector enthalpyVariationLocal;
|
||||
|
||||
true_to_local(*m_fem.enthalpyFes, enthalpyVariation, enthalpyVariationLocal);
|
||||
true_to_local(*m_fem.enthalpyFes, m_enthalpyVariationTrue, enthalpyVariationLocal);
|
||||
|
||||
mfem::Vector localAction(m_fem.enthalpyFes->GetVSize());
|
||||
|
||||
@@ -752,7 +778,10 @@ namespace mean_field::operators {
|
||||
localAction.AddElementVector(data.enthalpyDofs, elementAction);
|
||||
}
|
||||
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, action);
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, m_fullEnthalpyAction);
|
||||
|
||||
action.SetSize(m_context.GetEnthalpyMap().reduced_size());
|
||||
m_context.GetEnthalpyMap().gather(m_fullEnthalpyAction, action);
|
||||
|
||||
++m_algebraicJacobianStatistics.enthalpyApplications;
|
||||
}
|
||||
@@ -763,9 +792,18 @@ namespace mean_field::operators {
|
||||
) const {
|
||||
VerifyPrepared();
|
||||
|
||||
MFEM_VERIFY(
|
||||
gravityPotentialVariation.Size() == m_context.GetGravityPotentialMap().reduced_size(),
|
||||
"Prepared hydrostatic gravity-potential variation has the wrong supported size."
|
||||
);
|
||||
|
||||
m_context.GetGravityPotentialMap().scatter(gravityPotentialVariation, m_gravityPotentialVariationTrue);
|
||||
|
||||
mfem::Vector gravityPotentialVariationLocal;
|
||||
|
||||
true_to_local(*m_fem.gravityPotentialFes, gravityPotentialVariation, gravityPotentialVariationLocal);
|
||||
true_to_local(
|
||||
*m_fem.gravityPotentialFes, m_gravityPotentialVariationTrue, gravityPotentialVariationLocal
|
||||
);
|
||||
|
||||
mfem::Vector localAction(m_fem.enthalpyFes->GetVSize());
|
||||
|
||||
@@ -792,7 +830,10 @@ namespace mean_field::operators {
|
||||
localAction.AddElementVector(data.enthalpyDofs, elementAction);
|
||||
}
|
||||
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, action);
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, m_fullEnthalpyAction);
|
||||
|
||||
action.SetSize(m_context.GetEnthalpyMap().reduced_size());
|
||||
m_context.GetEnthalpyMap().gather(m_fullEnthalpyAction, action);
|
||||
|
||||
++m_algebraicJacobianStatistics.gravityPotentialApplications;
|
||||
}
|
||||
@@ -824,7 +865,10 @@ namespace mean_field::operators {
|
||||
localAction.AddElementVector(data.enthalpyDofs, elementAction);
|
||||
}
|
||||
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, action);
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, m_fullEnthalpyAction);
|
||||
|
||||
action.SetSize(m_context.GetEnthalpyMap().reduced_size());
|
||||
m_context.GetEnthalpyMap().gather(m_fullEnthalpyAction, action);
|
||||
|
||||
++m_algebraicJacobianStatistics.bernoulliConstantApplications;
|
||||
}
|
||||
@@ -842,12 +886,27 @@ namespace mean_field::operators {
|
||||
"a non-finite Bernoulli-constant variation."
|
||||
);
|
||||
|
||||
MFEM_VERIFY(
|
||||
enthalpyVariation.Size() == m_context.GetEnthalpyMap().reduced_size(),
|
||||
"Prepared hydrostatic algebraic enthalpy variation has the wrong supported size."
|
||||
);
|
||||
|
||||
MFEM_VERIFY(
|
||||
gravityPotentialVariation.Size() == m_context.GetGravityPotentialMap().reduced_size(),
|
||||
"Prepared hydrostatic algebraic gravity-potential variation has the wrong supported size."
|
||||
);
|
||||
|
||||
m_context.GetEnthalpyMap().scatter(enthalpyVariation, m_enthalpyVariationTrue);
|
||||
m_context.GetGravityPotentialMap().scatter(gravityPotentialVariation, m_gravityPotentialVariationTrue);
|
||||
|
||||
mfem::Vector enthalpyVariationLocal;
|
||||
mfem::Vector gravityPotentialVariationLocal;
|
||||
|
||||
true_to_local(*m_fem.enthalpyFes, enthalpyVariation, enthalpyVariationLocal);
|
||||
true_to_local(*m_fem.enthalpyFes, m_enthalpyVariationTrue, enthalpyVariationLocal);
|
||||
|
||||
true_to_local(*m_fem.gravityPotentialFes, gravityPotentialVariation, gravityPotentialVariationLocal);
|
||||
true_to_local(
|
||||
*m_fem.gravityPotentialFes, m_gravityPotentialVariationTrue, gravityPotentialVariationLocal
|
||||
);
|
||||
|
||||
mfem::Vector localAction(m_fem.enthalpyFes->GetVSize());
|
||||
|
||||
@@ -898,7 +957,10 @@ namespace mean_field::operators {
|
||||
localAction.AddElementVector(data.enthalpyDofs, elementAction);
|
||||
}
|
||||
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, action);
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, m_fullEnthalpyAction);
|
||||
|
||||
action.SetSize(m_context.GetEnthalpyMap().reduced_size());
|
||||
m_context.GetEnthalpyMap().gather(m_fullEnthalpyAction, action);
|
||||
|
||||
++m_algebraicJacobianStatistics.combinedApplications;
|
||||
}
|
||||
@@ -909,9 +971,16 @@ namespace mean_field::operators {
|
||||
) const {
|
||||
VerifyPrepared();
|
||||
|
||||
MFEM_VERIFY(
|
||||
displacementVariation.Size() == m_context.GetDisplacementMap().reduced_size(),
|
||||
"Prepared hydrostatic displacement variation has the wrong supported size."
|
||||
);
|
||||
|
||||
m_context.GetDisplacementMap().scatter(displacementVariation, m_displacementVariationTrue);
|
||||
|
||||
mfem::Vector displacementVariationLocal;
|
||||
|
||||
true_to_local(*m_fem.displacementFes, displacementVariation, displacementVariationLocal);
|
||||
true_to_local(*m_fem.displacementFes, m_displacementVariationTrue, displacementVariationLocal);
|
||||
|
||||
mfem::Vector localAction(m_fem.enthalpyFes->GetVSize());
|
||||
|
||||
@@ -1018,7 +1087,10 @@ namespace mean_field::operators {
|
||||
localAction.AddElementVector(data.enthalpyDofs, elementAction);
|
||||
}
|
||||
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, action);
|
||||
local_to_true(*m_fem.enthalpyFes, localAction, m_fullEnthalpyAction);
|
||||
|
||||
action.SetSize(m_context.GetEnthalpyMap().reduced_size());
|
||||
m_context.GetEnthalpyMap().gather(m_fullEnthalpyAction, action);
|
||||
|
||||
++m_displacementJacobianStatistics.applications;
|
||||
}
|
||||
@@ -1087,6 +1159,18 @@ namespace mean_field::operators {
|
||||
return m_fem;
|
||||
}
|
||||
|
||||
const field::FieldDofMap &PreparedHydrostaticEquilibriumOperator::GetEnthalpyMap() const noexcept {
|
||||
return m_context.GetEnthalpyMap();
|
||||
}
|
||||
|
||||
const field::FieldDofMap &PreparedHydrostaticEquilibriumOperator::GetGravityPotentialMap() const noexcept {
|
||||
return m_context.GetGravityPotentialMap();
|
||||
}
|
||||
|
||||
const field::FieldDofMap &PreparedHydrostaticEquilibriumOperator::GetDisplacementMap() const noexcept {
|
||||
return m_context.GetDisplacementMap();
|
||||
}
|
||||
|
||||
void PreparedHydrostaticEquilibriumOperator::VerifyPrepared() const {
|
||||
MFEM_VERIFY(
|
||||
m_isPrepared, "PreparedHydrostaticEquilibriumOperator must be "
|
||||
@@ -1099,7 +1183,7 @@ namespace mean_field::operators {
|
||||
const PreparedHydrostaticEquilibriumOperator &preparedOperator
|
||||
)
|
||||
: mfem::Operator(
|
||||
f.enthalpyFes != nullptr ? f.enthalpyFes->GetTrueVSize() : 0,
|
||||
HydrostaticJacobianBlockLayout(f).GetResidualSize(),
|
||||
HydrostaticJacobianBlockLayout(f).GetTotalSize()
|
||||
),
|
||||
m_layout(f),
|
||||
|
||||
Reference in New Issue
Block a user