feat(poly): locking phi surface flux and fixed phi boundary condition application

This commit is contained in:
2025-04-28 13:44:27 -04:00
parent d678c4bc33
commit ae5d61bd75
4 changed files with 47 additions and 111 deletions

View File

@@ -156,7 +156,7 @@ std::unique_ptr<formBundle> PolySolver::buildIndividualForms(const mfem::Array<i
forms->f->AddDomainIntegrator(new polyMFEMUtils::NonlinearPowerIntegrator(m_polytropicIndex));
return std::move(forms);
return forms;
}
void PolySolver::assembleAndFinalizeForm(auto &f) {
@@ -264,11 +264,11 @@ void PolySolver::setInitialGuess() const {
[this](const mfem::Vector &x) {
const double r = x.Norml2();
const double radius = Probe::getMeshRadius(*m_mesh);
const double u = 1/radius;
// const double u = 1/radius;
// return (-1.0/radius) * r + 1;
// return -std::pow((u*r), 2)+1.0; // The series expansion is a better guess; however, this is cheaper and ensures that the value at the surface is very close to zero in a way that the series expansion does not
return laneEmden::thetaSeriesExpansion(r, m_polytropicIndex, 5);
return laneEmden::thetaSeriesExpansion(r, m_polytropicIndex, 10);
}
);
@@ -399,7 +399,8 @@ solverBundle PolySolver::setupNewtonSolver() const {
solver.solver.SetMaxIter(gmresMaxIter);
solver.solver.SetPrintLevel(gmresPrintLevel);
solver.solver.SetPreconditioner(m_polytropOperator->GetPreconditioner());
// Preconditioner turned off because the polytrope operator seems *very* well conditioned without it
// solver.solver.SetPreconditioner(m_polytropOperator->GetPreconditioner());
// --- Set up the Newton solver ---
solver.newton.SetRelTol(newtonRelTol);
solver.newton.SetAbsTol(newtonAbsTol);