feat(preconditioner): major work on preconditioner system

first preconditioner MVP
This commit is contained in:
2026-09-04 07:54:10 -04:00
parent 25510008dd
commit 71423d543f
61 changed files with 15920 additions and 422 deletions

View File

@@ -58,8 +58,8 @@ namespace mean_field::integrators {
}
mfem::Vector shape_v(dof_v), shape_rho(dof_rho);
mfem::Vector x_phys(dim);
mfem::Vector a(dim), b(dim);
mapping::VolumeMappingContext mapping_context;
MFEM_VERIFY(
m_ir, "CentrifugalForceIntegrator must be configured with an "
@@ -72,24 +72,29 @@ namespace mean_field::integrators {
const mfem::IntegrationPoint &ip = ir->IntPoint(q);
Tr.SetIntPoint(&ip);
auto [J_inv, detJ, weight] = m_mapping.GetQuadratureContext(Tr, ip);
const mapping::MappingStatus mapping_status = m_mapping.EvaluateVolume(Tr, ip, mapping_context);
MFEM_VERIFY(
mapping_status == mapping::MappingStatus::valid,
"Centrifugal-force assembly encountered an invalid volume mapping."
);
const double weight = mapping_context.quadrature.weight;
fe_v->CalcShape(ip, shape_v);
fe_rho->CalcShape(ip, shape_rho);
m_mapping.GetPhysicalPoint(Tr, ip, x_phys);
const mfem::Vector &x_phys = mapping_context.mapping.physical_position;
// ω x r
a(0) = m_omega(1) * x_phys(2) - m_omega(2) * x_phys(1);
a(1) = m_omega(2) * x_phys(0) - m_omega(0) * x_phys(2);
a(2) = m_omega(0) * x_phys(1) - m_omega(1) * x_phys(0);
a(0) = m_omega(1) * x_phys(2) - m_omega(2) * x_phys(1);
a(1) = m_omega(2) * x_phys(0) - m_omega(0) * x_phys(2);
a(2) = m_omega(0) * x_phys(1) - m_omega(1) * x_phys(0);
// ω x (ω x r) [centrifugal acceleration]
b(0) = m_omega(1) * a(2) - m_omega(2) * a(1);
b(1) = m_omega(2) * a(0) - m_omega(0) * a(2);
b(2) = m_omega(0) * a(1) - m_omega(1) * a(0);
b(0) = m_omega(1) * a(2) - m_omega(2) * a(1);
b(1) = m_omega(2) * a(0) - m_omega(0) * a(2);
b(2) = m_omega(0) * a(1) - m_omega(1) * a(0);
double rho_val = 0.0;
double rho_val = 0.0;
for (int i = 0; i < dof_rho; ++i) {
rho_val += rho_dofs(i) * shape_rho(i);
}
@@ -135,8 +140,8 @@ namespace mean_field::integrators {
return;
mfem::Vector shape_v(dof_v), shape_rho(dof_rho);
mfem::Vector x_phys(dim);
mfem::Vector a(dim), b(dim);
mapping::VolumeMappingContext mapping_context;
const mfem::IntegrationRule *ir = &mfem::IntRules.Get(fe_v->GetGeomType(), 2 * fe_v->GetOrder());
@@ -144,22 +149,27 @@ namespace mean_field::integrators {
const mfem::IntegrationPoint &ip = ir->IntPoint(q);
Tr.SetIntPoint(&ip);
auto [J_inv, detJ, weight] = m_mapping.GetQuadratureContext(Tr, ip);
const mapping::MappingStatus mapping_status = m_mapping.EvaluateVolume(Tr, ip, mapping_context);
MFEM_VERIFY(
mapping_status == mapping::MappingStatus::valid,
"Centrifugal-force Jacobian assembly encountered an invalid volume mapping."
);
const double weight = mapping_context.quadrature.weight;
fe_v->CalcShape(ip, shape_v);
fe_rho->CalcShape(ip, shape_rho);
m_mapping.GetPhysicalPoint(Tr, ip, x_phys);
const mfem::Vector &x_phys = mapping_context.mapping.physical_position;
// ω x r
a(0) = m_omega(1) * x_phys(2) - m_omega(2) * x_phys(1);
a(1) = m_omega(2) * x_phys(0) - m_omega(0) * x_phys(2);
a(2) = m_omega(0) * x_phys(1) - m_omega(1) * x_phys(0);
a(0) = m_omega(1) * x_phys(2) - m_omega(2) * x_phys(1);
a(1) = m_omega(2) * x_phys(0) - m_omega(0) * x_phys(2);
a(2) = m_omega(0) * x_phys(1) - m_omega(1) * x_phys(0);
// ω x (ω x r) [centrifugal acceleration]
b(0) = m_omega(1) * a(2) - m_omega(2) * a(1);
b(1) = m_omega(2) * a(0) - m_omega(0) * a(2);
b(2) = m_omega(0) * a(1) - m_omega(1) * a(0);
b(0) = m_omega(1) * a(2) - m_omega(2) * a(1);
b(1) = m_omega(2) * a(0) - m_omega(0) * a(2);
b(2) = m_omega(0) * a(1) - m_omega(1) * a(0);
// dR_dv_i_c / drho_j = φ_i * φ_j * b_c
for (int i = 0; i < dof_v; ++i) {