refactor(polySolver): turned on preconditioner and removed redundant validation check

This commit is contained in:
2025-05-18 15:33:06 -04:00
parent b16ba8a7b6
commit bd4aebedce

View File

@@ -183,11 +183,6 @@ void PolySolver::solve() const {
// Finalize with the initial state of theta for the initial jacobian calculation // Finalize with the initial state of theta for the initial jacobian calculation
m_polytropOperator->finalize(thetaVec); m_polytropOperator->finalize(thetaVec);
if (!m_polytropOperator->isFinalized()) {
LOG_ERROR(m_logger, "PolytropeOperator is not finalized. Cannot solve.");
throw std::runtime_error("PolytropeOperator is not finalized. Cannot solve.");
}
// It's safer to get the offsets directly from the operator after finalization // It's safer to get the offsets directly from the operator after finalization
const mfem::Array<int>& block_offsets = m_polytropOperator->GetBlockOffsets(); // Assuming a getter exists or accessing member if public/friend const mfem::Array<int>& block_offsets = m_polytropOperator->GetBlockOffsets(); // Assuming a getter exists or accessing member if public/friend
mfem::BlockVector state_vector(block_offsets); mfem::BlockVector state_vector(block_offsets);
@@ -411,7 +406,7 @@ solverBundle PolySolver::setupNewtonSolver() const {
solver.solver.SetPrintLevel(gmresPrintLevel); solver.solver.SetPrintLevel(gmresPrintLevel);
// Preconditioner turned off because the polytrope operator seems *very* well conditioned without it // Preconditioner turned off because the polytrope operator seems *very* well conditioned without it
// solver.solver.SetPreconditioner(m_polytropOperator->GetPreconditioner()); solver.solver.SetPreconditioner(m_polytropOperator->GetPreconditioner());
// --- Set up the Newton solver --- // --- Set up the Newton solver ---
solver.newton.SetRelTol(newtonRelTol); solver.newton.SetRelTol(newtonRelTol);
solver.newton.SetAbsTol(newtonAbsTol); solver.newton.SetAbsTol(newtonAbsTol);