feat(mean_field): added initial implementation
note this implementation lacks many tests
This commit is contained in:
28
libmeanfield/interface/physics/context.cppm
Normal file
28
libmeanfield/interface/physics/context.cppm
Normal file
@@ -0,0 +1,28 @@
|
||||
module;
|
||||
#include <mfem.hpp>
|
||||
|
||||
export module mean_field:physics.contexts;
|
||||
export import :mapping.coefficients;
|
||||
|
||||
export namespace mean_field::physics {
|
||||
struct GravityContext {
|
||||
std::unique_ptr<mfem::ParBilinearForm> m_form;
|
||||
std::unique_ptr<mfem::ParMixedBilinearForm> b_form;
|
||||
|
||||
std::unique_ptr<mfem::BlockOperator> block_A;
|
||||
|
||||
std::unique_ptr<mfem::Solver> prec_M;
|
||||
std::unique_ptr<mfem::HypreBoomerAMG> prec_Phi;
|
||||
std::unique_ptr<mfem::BlockDiagonalPreconditioner> block_prec;
|
||||
|
||||
std::unique_ptr<mfem::MINRESSolver> minres;
|
||||
|
||||
mfem::Array<int> stellar_mask;
|
||||
|
||||
std::unique_ptr<mfem::TransposeOperator> BT;
|
||||
std::unique_ptr<mfem::HypreParMatrix> Schur;
|
||||
|
||||
std::unique_ptr<mfem::MatrixCoefficient> mapped_hdiv_mass_coeff;
|
||||
|
||||
};
|
||||
}
|
||||
45
libmeanfield/interface/physics/gravity.cppm
Normal file
45
libmeanfield/interface/physics/gravity.cppm
Normal file
@@ -0,0 +1,45 @@
|
||||
module;
|
||||
#include <mfem.hpp>
|
||||
|
||||
export module mean_field:physics.gravity;
|
||||
|
||||
export import :fem;
|
||||
|
||||
export namespace mean_field::physics {
|
||||
struct GravitySolution {
|
||||
mfem::ParGridFunction gradPhi;
|
||||
mfem::ParGridFunction phi;
|
||||
|
||||
explicit GravitySolution(fem::FEM& fem): gradPhi(fem.RT_fes.get()), phi(fem.L2_fes.get()) {}
|
||||
};
|
||||
|
||||
GravitySolution grav_potential(
|
||||
fem::FEM &f,
|
||||
const utils::Args &args,
|
||||
const mfem::GridFunction &rho,
|
||||
bool phi_warm = false
|
||||
);
|
||||
|
||||
mfem::GridFunction get_potential(
|
||||
fem::FEM &fem,
|
||||
const utils::Args &args,
|
||||
const mfem::GridFunction &rho,
|
||||
bool warm = false
|
||||
);
|
||||
|
||||
mfem::DenseMatrix compute_quadrupole_moment_tensor(
|
||||
const fem::FEM &fem,
|
||||
const mfem::GridFunction &rho,
|
||||
const mfem::Vector &com
|
||||
);
|
||||
|
||||
double l2_multipole_potential(
|
||||
const fem::FEM &fem,
|
||||
double total_mass,
|
||||
const mfem::Vector &phys_x
|
||||
);
|
||||
|
||||
void update_stiffness_matrix(fem::FEM &fem);
|
||||
}
|
||||
|
||||
|
||||
9
libmeanfield/interface/physics/solid.cppm
Normal file
9
libmeanfield/interface/physics/solid.cppm
Normal file
@@ -0,0 +1,9 @@
|
||||
module;
|
||||
#include <mfem.hpp>
|
||||
|
||||
export module mean_field:physics.solid_body;
|
||||
export import :fem;
|
||||
|
||||
export namespace mean_field::physics {
|
||||
double compute_moment_of_inertia(const fem::FEM &fem, const mfem::GridFunction &rho_ref);
|
||||
}
|
||||
Reference in New Issue
Block a user