feat(field-support): added field support system, mid migration

currently the barotope and the pressure force operator are migrated to the new support system
This commit is contained in:
2026-08-23 10:13:53 -04:00
parent dc912fd15e
commit 0f3ca8050b
137 changed files with 29975 additions and 16389 deletions

View File

@@ -14,6 +14,7 @@ export namespace mean_field::quadrature {
gravity_hdiv_mass,
gravity_divergence,
gravity_source,
gravity_force,
gravity_boundary,
centrifugal,
density_projection,
@@ -32,12 +33,7 @@ export namespace mean_field::quadrature {
error_norm
};
enum class QuadratureRole {
discretization,
preconditioner,
diagnostic,
projection
};
enum class QuadratureRole { discretization, preconditioner, diagnostic, projection };
enum class MappingKind { none, affine, general, kelvin };
@@ -59,6 +55,7 @@ export namespace mean_field::quadrature {
RuleControl gravity_hdiv_mass;
RuleControl gravity_divergence;
RuleControl gravity_source;
RuleControl gravity_force;
RuleControl gravity_boundary;
RuleControl centrifugal;
RuleControl density_projection;
@@ -130,6 +127,7 @@ export namespace mean_field::quadrature {
QuadratureTermOptions gravity_hdiv_mass;
QuadratureTermOptions gravity_divergence;
QuadratureTermOptions gravity_source;
QuadratureTermOptions gravity_force;
QuadratureTermOptions gravity_boundary;
QuadratureTermOptions centrifugal;
QuadratureTermOptions density_projection;
@@ -211,35 +209,20 @@ export namespace mean_field::quadrature {
if (fixed_order.has_value()) {
if (*fixed_order < 0) {
throw std::invalid_argument(
"Quadrature fixed order cannot be negative."
);
throw std::invalid_argument("Quadrature fixed order cannot be negative.");
}
return {
.base_order = base_order,
.boost = 0,
.order = *fixed_order,
.used_fixed_order = true
};
return {.base_order = base_order, .boost = 0, .order = *fixed_order, .used_fixed_order = true};
}
const int boost =
rule_set.fallback.boost + role_control.boost + term_control.boost;
const int boost = rule_set.fallback.boost + role_control.boost + term_control.boost;
const int order = base_order + boost;
if (order < 0) {
throw std::invalid_argument(
"Resolved quadrature order cannot be negative."
);
throw std::invalid_argument("Resolved quadrature order cannot be negative.");
}
return {
.base_order = base_order,
.boost = boost,
.order = order,
.used_fixed_order = false
};
return {.base_order = base_order, .boost = boost, .order = order, .used_fixed_order = false};
}
const RuleControl &Policy::get_control(const Term term) const {
switch (term) {
@@ -249,6 +232,8 @@ export namespace mean_field::quadrature {
return rule_set.gravity_divergence;
case Term::gravity_source:
return rule_set.gravity_source;
case Term::gravity_force:
return rule_set.gravity_force;
case Term::gravity_boundary:
return rule_set.gravity_boundary;
case Term::centrifugal:
@@ -289,18 +274,14 @@ export namespace mean_field::quadrature {
int Policy::compute_base_order(const Query &query) {
if (query.base_order.has_value()) {
if (*query.base_order < 0) {
throw std::invalid_argument(
"Quadrature base order cannot be negative."
);
throw std::invalid_argument("Quadrature base order cannot be negative.");
}
return *query.base_order;
}
if (query.trial_order < 0 || query.test_order < 0 ||
query.coefficient_order < 0 || query.geometry_weight_order < 0) {
throw std::invalid_argument(
"Quadrature query orders cannot be negative."
);
if (query.trial_order < 0 || query.test_order < 0 || query.coefficient_order < 0 ||
query.geometry_weight_order < 0) {
throw std::invalid_argument("Quadrature query orders cannot be negative.");
}
int trial_order = query.trial_order;
@@ -308,12 +289,10 @@ export namespace mean_field::quadrature {
trial_order = std::max(0, trial_order - 1);
}
return trial_order + query.test_order + query.coefficient_order +
query.geometry_weight_order;
return trial_order + query.test_order + query.coefficient_order + query.geometry_weight_order;
}
const RuleControl &
Policy::get_role_control(const QuadratureRole role) const {
const RuleControl &Policy::get_role_control(const QuadratureRole role) const {
switch (role) {
case QuadratureRole::discretization:
return rule_set.roles.discretization;