33#include "quill/Logger.h"
65 double a (
const int k,
const double n);
81 double c(
const int m,
const double n);
143 std::unique_ptr<mfem::MixedBilinearForm>
M;
151 std::unique_ptr<mfem::MixedBilinearForm>
Q;
158 std::unique_ptr<mfem::BilinearForm>
D;
165 std::unique_ptr<mfem::BilinearForm>
S;
172 std::unique_ptr<mfem::NonlinearForm>
f;
226 PolySolver(
const double n,
const double order);
295 std::unique_ptr<mfem::H1_FECollection>
m_fecH1;
296 std::unique_ptr<mfem::RT_FECollection>
m_fecRT;
299 std::unique_ptr<mfem::FiniteElementSpace>
m_fePhi;
303 std::unique_ptr<mfem::GridFunction>
m_phi;
307 std::unique_ptr<mfem::OperatorJacobiSmoother>
m_prec;
592 void LoadSolverUserParams(
double &newtonRelTol,
double &newtonAbsTol,
int &newtonMaxIter,
int &newtonPrintLevel,
593 double &gmresRelTol,
double &gmresAbsTol,
int &gmresMaxIter,
int &gmresPrintLevel)
const;
617 static void GetDofCoordinates(
const mfem::FiniteElementSpace &fes,
const std::string& filename);
void saveAndViewSolution(const mfem::BlockVector &state_vector) const
Saves the 1D radial solution and optionally displays the 2D/3D solution using GLVis.
~PolySolver()
Destructor for PolySolver.
double m_polytropicIndex
The polytropic index .
std::unique_ptr< mfem::H1_FECollection > m_fecH1
Finite Element Collection for (H1 elements).
serif::types::MFEMArrayPairSet getEssentialTrueDof() const
Computes the essential true degrees of freedom (DOFs) and their values for boundary conditions.
void solve() const
Solves the polytropic system.
PolySolver(const double n, const double order)
double m_feOrder
The polynomial order for H1 elements ( ). RT elements for are of order m_feOrder - 1.
std::unique_ptr< mfem::GridFunction > m_phi
Grid function for the vector flux .
mfem::GridFunction & getPhi() const
Gets a reference to the solution grid function for .
static void GetDofCoordinates(const mfem::FiniteElementSpace &fes, const std::string &filename)
Utility function to get and save the coordinates of degrees of freedom for a finite element space.
static void assembleAndFinalizeForm(auto &f)
Assemble and finalize a given MFEM form.
mfem::Array< int > computeBlockOffsets() const
Compute the block offsets for the operator. These are the offsets that define which dofs belong to wh...
solverBundle setupNewtonSolver() const
Sets up the Newton solver and its associated linear solver (GMRES).
quill::Logger * m_logger
Pointer to the specific logger instance for this class.
std::unique_ptr< PolytropeOperator > m_polytropOperator
The main nonlinear operator for the mixed system.
void assembleBlockSystem()
Assembles the block system operator m_polytropOperator.
void LoadSolverUserParams(double &newtonRelTol, double &newtonAbsTol, int &newtonMaxIter, int &newtonPrintLevel, double &gmresRelTol, double &gmresAbsTol, int &gmresMaxIter, int &gmresPrintLevel) const
Loads Newton and GMRES solver parameters from the configuration.
mfem::Mesh & m_mesh
Reference to the computational mesh (owned by ResourceManager).
void setOperatorEssentialTrueDofs() const
Sets the essential true DOFs on the PolytropeOperator.
std::unique_ptr< mfem::FiniteElementSpace > m_fePhi
Finite Element Space for .
std::unique_ptr< formBundle > buildIndividualForms(const mfem::Array< int > &blockOffsets)
Build the individual forms for the block operator (M, Q, D, S, and f).
static mfem::Mesh & prepareMesh(double n)
Prepares the mesh for the simulation.
std::pair< mfem::Array< int >, mfem::Array< int > > findCenterElement() const
Finds the degrees of freedom (DOFs) associated with the geometric center (origin) of the mesh.
mfem::GridFunction & getTheta() const
Gets a reference to the solution grid function for .
double getN() const
Gets the polytropic index .
std::unique_ptr< mfem::GridFunction > m_theta
Grid function for the scalar potential .
void setInitialGuess() const
Sets the initial guess for the solution variables and .
std::unique_ptr< mfem::FiniteElementSpace > m_feTheta
Finite Element Space for .
std::unique_ptr< mfem::OperatorJacobiSmoother > m_prec
Preconditioner (currently seems unused in polySolver.cpp).
mfem::Mesh & getMesh() const
Gets a reference to the computational mesh.
double getOrder() const
Gets the finite element order used for the variable.
serif::probe::LogManager & m_logManager
Reference to the global log manager instance.
std::unique_ptr< mfem::RT_FECollection > m_fecRT
Finite Element Collection for (Raviart-Thomas elements).
serif::config::Config & m_config
Reference to the global configuration manager instance.
Class to manage logging operations.
A collection of utilities for working with MFEM and solving the lane-emden equation.
Namespace for Lane-Emden equation related utility functions.
double thetaSeriesExpansion(const double xi, const double n, const int order)
double a(const int k, const double n)
Computes the coefficient for the Lane-Emden series expansion.
double c(const int m, const double n)
Computes the auxiliary coefficient used in determining .
std::pair< MFEMArrayPair, MFEMArrayPair > MFEMArrayPairSet
Structure to manage the lifetime of MFEM solver objects.
mfem::GMRESSolver solver
The linear solver (e.g., GMRES). Must be declared first.
mfem::NewtonSolver newton
The nonlinear solver (e.g., Newton). Must be declared second.