feat(libmeanfield): variadic refactor
also added normaliztion operator
This commit is contained in:
@@ -356,8 +356,11 @@ namespace mean_field::operators {
|
||||
m_rootManifest(
|
||||
constructionData.valueSizes,
|
||||
constructionData.residualSizes,
|
||||
fixedMassConstraint.targetMass().value(),
|
||||
surfaceConstraint.descriptor().targetPressure,
|
||||
StellarEquilibriumSpecificationModel{
|
||||
equationOfState,
|
||||
surface::Isobaric{
|
||||
dimensions::PressureValue{surfaceConstraint.descriptor().targetPressure}},
|
||||
fixedMassConstraint.specification()},
|
||||
constructionData.pressureSurfaceRows.size()
|
||||
),
|
||||
m_gravityStateOffsets(constructionData.gravityStateOffsets),
|
||||
@@ -431,6 +434,7 @@ namespace mean_field::operators {
|
||||
m_fullMechanicalAction.SetSize(m_domainDeformation.volumeDisplacementSize());
|
||||
m_surfaceShapeAction.SetSize(m_domainDeformation.parameterCount());
|
||||
m_pullbackDerivativeAction.SetSize(m_domainDeformation.parameterCount());
|
||||
m_densityVolumeIntegralAction.SetSize(1);
|
||||
|
||||
m_gravityState = 0.0;
|
||||
m_gravityDirection = 0.0;
|
||||
@@ -441,6 +445,7 @@ namespace mean_field::operators {
|
||||
m_fullMechanicalAction = 0.0;
|
||||
m_surfaceShapeAction = 0.0;
|
||||
m_pullbackDerivativeAction = 0.0;
|
||||
m_densityVolumeIntegralAction = 0.0;
|
||||
}
|
||||
|
||||
PreparedStellarEquilibriumReport PreparedStellarEquilibriumOperator::Prepare(
|
||||
@@ -494,13 +499,13 @@ namespace mean_field::operators {
|
||||
|
||||
const auto rootState = m_rootManifest.stateView(state);
|
||||
|
||||
const mfem::Vector reducedDensity = rootState.block(utils::blocks::density_field.mass_term);
|
||||
const mfem::Vector surfaceDeformationParameters =
|
||||
const auto reducedDensity = rootState.block(utils::blocks::density_field.mass_term);
|
||||
const auto surfaceDeformationParameters =
|
||||
rootState.block(utils::blocks::surface_deformation_field.parameters_term);
|
||||
const mfem::Vector gravityGradient = rootState.block(utils::blocks::gravity_field.gradient_term);
|
||||
const mfem::Vector gravityPotential = rootState.block(utils::blocks::gravity_field.poisson_term);
|
||||
const mfem::Vector reducedEnthalpy = rootState.block(utils::blocks::enthalpy_field.specific_term);
|
||||
const mfem::Vector bernoulli =
|
||||
const auto gravityGradient = rootState.block(utils::blocks::gravity_field.gradient_term);
|
||||
const auto gravityPotential = rootState.block(utils::blocks::gravity_field.poisson_term);
|
||||
const auto reducedEnthalpy = rootState.block(utils::blocks::enthalpy_field.specific_term);
|
||||
const auto bernoulli =
|
||||
rootState.block(utils::blocks::fixed_total_mass_constraint.mass_normalization_term);
|
||||
|
||||
const bool generatedGeometryChanged =
|
||||
@@ -633,13 +638,13 @@ namespace mean_field::operators {
|
||||
|
||||
const auto rootDirection = m_rootManifest.directionView(direction);
|
||||
|
||||
const mfem::Vector reducedDensityDirection = rootDirection.block(utils::blocks::density_field.mass_term);
|
||||
const mfem::Vector surfaceDeformationDirection =
|
||||
const auto reducedDensityDirection = rootDirection.block(utils::blocks::density_field.mass_term);
|
||||
const auto surfaceDeformationDirection =
|
||||
rootDirection.block(utils::blocks::surface_deformation_field.parameters_term);
|
||||
const mfem::Vector gravityGradientDirection = rootDirection.block(utils::blocks::gravity_field.gradient_term);
|
||||
const mfem::Vector gravityPotentialDirection = rootDirection.block(utils::blocks::gravity_field.poisson_term);
|
||||
const mfem::Vector reducedEnthalpyDirection = rootDirection.block(utils::blocks::enthalpy_field.specific_term);
|
||||
const mfem::Vector bernoulliDirection =
|
||||
const auto gravityGradientDirection = rootDirection.block(utils::blocks::gravity_field.gradient_term);
|
||||
const auto gravityPotentialDirection = rootDirection.block(utils::blocks::gravity_field.poisson_term);
|
||||
const auto reducedEnthalpyDirection = rootDirection.block(utils::blocks::enthalpy_field.specific_term);
|
||||
const auto bernoulliDirection =
|
||||
rootDirection.block(utils::blocks::fixed_total_mass_constraint.mass_normalization_term);
|
||||
|
||||
m_domainDeformation.applyJacobian(
|
||||
@@ -794,6 +799,41 @@ namespace mean_field::operators {
|
||||
return m_massNormalizationOperator;
|
||||
}
|
||||
|
||||
double PreparedStellarEquilibriumOperator::ApplyDensityVolumeIntegralDensityAction(
|
||||
const mfem::Vector &densityDirection
|
||||
) const {
|
||||
VerifyPrepared();
|
||||
m_massNormalizationOperator.ApplyDensityJacobianAction(
|
||||
densityDirection,
|
||||
m_densityVolumeIntegralAction
|
||||
);
|
||||
MFEM_VERIFY(
|
||||
m_densityVolumeIntegralAction.Size() == 1,
|
||||
"The density-volume integral must produce one global scalar."
|
||||
);
|
||||
return m_densityVolumeIntegralAction(0);
|
||||
}
|
||||
|
||||
double PreparedStellarEquilibriumOperator::ApplyDensityVolumeIntegralSurfaceShapeAction(
|
||||
const mfem::Vector &surfaceShapeDirection
|
||||
) const {
|
||||
VerifyPrepared();
|
||||
m_domainDeformation.applyJacobian(
|
||||
m_surfaceDeformationParameters,
|
||||
surfaceShapeDirection,
|
||||
m_volumeDisplacementDirection
|
||||
);
|
||||
m_massNormalizationOperator.ApplyDisplacementJacobianAction(
|
||||
m_volumeDisplacementDirection,
|
||||
m_densityVolumeIntegralAction
|
||||
);
|
||||
MFEM_VERIFY(
|
||||
m_densityVolumeIntegralAction.Size() == 1,
|
||||
"The density-volume shape derivative must produce one global scalar."
|
||||
);
|
||||
return m_densityVolumeIntegralAction(0);
|
||||
}
|
||||
|
||||
const PreparedPressureSurfaceConstraint &
|
||||
PreparedStellarEquilibriumOperator::GetSurfaceConstraintOperator() const noexcept {
|
||||
return m_surfaceConstraintOperator;
|
||||
|
||||
Reference in New Issue
Block a user