perf(jacobian-action): major updates to jacobian action application by removing redudant quadrature work. ~5x increase in speed

This commit is contained in:
2026-09-02 17:01:50 -04:00
parent 85500fef3b
commit 25510008dd
74 changed files with 8967 additions and 814 deletions

View File

@@ -12,10 +12,11 @@ import :field.registry;
import :utils.domain;
namespace {
namespace eos = mean_field::eos;
namespace dimensions = mean_field::dimensions;
namespace eos = mean_field::eos;
using DomainSchema = mean_field::utils::domain::CoreEnvelopeVacuumDomainSchema;
using ClosureDomain = mean_field::field::FieldDomainT<mean_field::field::Density>;
using DomainSchema = mean_field::utils::domain::CoreEnvelopeVacuumDomainSchema;
using ClosureDomain = mean_field::field::FieldDomainT<mean_field::field::Density>;
enum class ClosureAction { residual, density, enthalpy };
@@ -339,7 +340,9 @@ namespace {
const double density = elementDensityInput * densityShape;
const double equationOfStateDensity =
eos::evaluate<eos::quantity::Density>(barotrope, eos::SpecificEnthalpyValue{baseEnthalpy})
eos::evaluate<dimensions::quantity::Density>(
barotrope, dimensions::SpecificEnthalpyValue{baseEnthalpy}
)
.value();
integrand = density - equationOfStateDensity;
@@ -348,7 +351,7 @@ namespace {
const double densityDerivative =
eos::partialDerivative<eos::quantity::Density, eos::quantity::SpecificEnthalpy>(
barotrope, eos::SpecificEnthalpyValue{baseEnthalpy}
barotrope, dimensions::SpecificEnthalpyValue{baseEnthalpy}
)
.value();
@@ -640,16 +643,18 @@ namespace mean_field::operators::kernels {
enthalpyElement.CalcShape(integrationPoint, enthalpyShape);
const double densityValue = elementBaseDensity * densityShape;
const double densityValue = elementBaseDensity * densityShape;
const double enthalpyValue = elementBaseEnthalpy * enthalpyShape;
const double enthalpyValue = elementBaseEnthalpy * enthalpyShape;
const double equationOfStateDensity =
eos::evaluate<eos::quantity::Density>(barotrope, eos::SpecificEnthalpyValue{enthalpyValue}).value();
const double equationOfStateDensity = eos::evaluate<dimensions::quantity::Density>(
barotrope, dimensions::SpecificEnthalpyValue{enthalpyValue}
)
.value();
const double closureValue = densityValue - equationOfStateDensity;
const double closureValue = densityValue - equationOfStateDensity;
const double geometryActionValue = closureValue * mappingVariation.weight_variation;
const double geometryActionValue = closureValue * mappingVariation.weight_variation;
MFEM_VERIFY(
std::isfinite(closureValue) && std::isfinite(geometryActionValue),