feat(poly): moved to a block form for poly

essential dofs can be applied to both theta and phi (grad theta) if we move to a block form. I have done this derivation and made that change so that we can properly apply the central boundary condition to the slope
This commit is contained in:
2025-04-02 14:57:37 -04:00
parent 407eef4e48
commit e3afe90f37
12 changed files with 640 additions and 731 deletions

View File

@@ -2,13 +2,11 @@
#define POLYSOLVER_H
#include "mfem.hpp"
#include <iostream>
#include <string>
#include <memory>
#include <utility>
#include "meshIO.h"
#include "polyCoeff.h"
#include "polyMFEMUtils.h"
#include "integrators.h"
#include "operator.h"
#include "config.h"
#include "probe.h"
#include "quill/Logger.h"
@@ -20,35 +18,44 @@ namespace laneEmden {
}
class PolySolver {
private:
Config& config = Config::getInstance();
Probe::LogManager& logManager = Probe::LogManager::getInstance();
quill::Logger* logger;
double n, order;
mfem::Mesh& mesh;
std::unique_ptr<mfem::H1_FECollection> feCollection;
std::unique_ptr<mfem::FiniteElementSpace> feSpace;
std::unique_ptr<polyMFEMUtils::CompositeNonlinearIntegrator> compositeIntegrator;
std::unique_ptr<mfem::NonlinearForm> nonlinearForm;
std::unique_ptr<mfem::GridFunction> u;
std::unique_ptr<mfem::VectorFunctionCoefficient> diffusionCoeff;
std::unique_ptr<mfem::FunctionCoefficient> nonlinearSourceCoeff;
void assembleNonlinearForm();
public:
PolySolver(double n, double order, mfem::Mesh& mesh_);
public: // Public methods
PolySolver(double n, double order);
~PolySolver();
void solve();
mfem::Mesh& getMesh() { return mesh; }
mfem::GridFunction& getSolution() { return *u; }
double getN() { return n; }
double getOrder() { return order; }
double getN() { return m_polytropicIndex; }
double getOrder() { return m_feOrder; }
mfem::Mesh* getMesh() { return m_mesh.get(); }
mfem::GridFunction& getSolution() { return *m_theta; }
private: // Private Attributes
Config& m_config = Config::getInstance();
Probe::LogManager& m_logManager = Probe::LogManager::getInstance();
quill::Logger* m_logger = m_logManager.getLogger("log");
double m_polytropicIndex, m_feOrder;
std::unique_ptr<mfem::Mesh> m_mesh;
std::unique_ptr<mfem::H1_FECollection> m_fecH1;
std::unique_ptr<mfem::RT_FECollection> m_fecRT;
std::unique_ptr<mfem::FiniteElementSpace> m_feTheta;
std::unique_ptr<mfem::FiniteElementSpace> m_fePhi;
std::unique_ptr<mfem::GridFunction> m_theta;
std::unique_ptr<mfem::GridFunction> m_phi;
std::unique_ptr<PolytropeOperator> m_polytropOperator;
private: // Private methods
void assembleBlockSystem();
std::pair<mfem::Array<int>, mfem::Array<int>> getEssentialTrueDof();
mfem::Array<int> findCenterElement();
void setInitialGuess();
void saveAndViewSolution();
};
#endif // POLYSOLVER_H