feat(poly): refactoring PolytropeOperator to work on the reduced system so as to avoid rank deficiencies
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#include "config.h"
|
||||
#include "integrators.h"
|
||||
#include "mfem.hpp"
|
||||
#include "operator.h"
|
||||
#include "polytropeOperator.h"
|
||||
#include "polyCoeff.h"
|
||||
#include "probe.h"
|
||||
#include "resourceManager.h"
|
||||
@@ -119,8 +119,7 @@ void PolySolver::assembleBlockSystem() {
|
||||
std::move(forms->Q),
|
||||
std::move(forms->D),
|
||||
std::move(forms->f),
|
||||
blockOffsets,
|
||||
m_polytropicIndex);
|
||||
blockOffsets);
|
||||
}
|
||||
|
||||
mfem::Array<int> PolySolver::computeBlockOffsets() const {
|
||||
@@ -149,7 +148,7 @@ std::unique_ptr<formBundle> PolySolver::buildIndividualForms(const mfem::Array<i
|
||||
m_negationCoeff = std::make_unique<mfem::VectorConstantCoefficient>(negOneVec);
|
||||
|
||||
// --- Add the integrators to the forms ---
|
||||
forms->M->AddDomainIntegrator(new mfem::MixedVectorWeakDivergenceIntegrator(*m_negationCoeff));
|
||||
forms->M->AddDomainIntegrator(new mfem::MixedVectorWeakDivergenceIntegrator());
|
||||
forms->Q->AddDomainIntegrator(new mfem::MixedVectorGradientIntegrator());
|
||||
forms->D->AddDomainIntegrator(new mfem::VectorFEMassIntegrator());
|
||||
|
||||
@@ -184,12 +183,12 @@ void PolySolver::solve() const {
|
||||
m_polytropOperator->finalize(thetaVec);
|
||||
|
||||
// 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->get_reduced_block_offsets(); // Assuming a getter exists or accessing member if public/friend
|
||||
mfem::BlockVector state_vector(block_offsets);
|
||||
state_vector.GetBlock(0) = thetaVec; // NOLINT(*-slicing)
|
||||
state_vector.GetBlock(1) = phiVec; // NOLINT(*-slicing)
|
||||
|
||||
mfem::Vector zero_rhs(block_offsets.Last());
|
||||
mfem::Vector zero_rhs(m_polytropOperator->get_reduced_system_size());
|
||||
zero_rhs = 0.0;
|
||||
|
||||
const solverBundle sb = setupNewtonSolver();
|
||||
@@ -308,7 +307,7 @@ void PolySolver::setInitialGuess() const {
|
||||
}
|
||||
|
||||
void PolySolver::saveAndViewSolution(const mfem::BlockVector& state_vector) const {
|
||||
mfem::BlockVector x_block(const_cast<mfem::BlockVector&>(state_vector), m_polytropOperator->GetBlockOffsets());
|
||||
mfem::BlockVector x_block(const_cast<mfem::BlockVector&>(state_vector), m_polytropOperator->get_block_offsets());
|
||||
mfem::Vector& x_theta = x_block.GetBlock(0);
|
||||
mfem::Vector& x_phi = x_block.GetBlock(1);
|
||||
|
||||
@@ -335,7 +334,7 @@ void PolySolver::saveAndViewSolution(const mfem::BlockVector& state_vector) cons
|
||||
|
||||
void PolySolver::setOperatorEssentialTrueDofs() const {
|
||||
const SSE::MFEMArrayPairSet ess_tdof_pair_set = getEssentialTrueDof();
|
||||
m_polytropOperator->SetEssentialTrueDofs(ess_tdof_pair_set);
|
||||
m_polytropOperator->set_essential_true_dofs(ess_tdof_pair_set);
|
||||
}
|
||||
|
||||
void PolySolver::LoadSolverUserParams(double &newtonRelTol, double &newtonAbsTol, int &newtonMaxIter, int &newtonPrintLevel, double &gmresRelTol, double &gmresAbsTol, int &gmresMaxIter, int &gmresPrintLevel) const {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "integrators.h"
|
||||
#include "4DSTARTypes.h"
|
||||
#include "operator.h"
|
||||
#include "polytropeOperator.h"
|
||||
#include "config.h"
|
||||
#include "meshIO.h"
|
||||
#include "probe.h"
|
||||
|
||||
Reference in New Issue
Block a user