fix(poly): polytrope converges to solution

first commit where the polytrope module converges to a solution. I have not yet validated if it is a correct solution
This commit is contained in:
2025-02-20 16:05:02 -05:00
parent 776174c093
commit 9925f56e34
3 changed files with 22 additions and 7 deletions

View File

@@ -6,6 +6,8 @@
#include "polyMFEMUtils.h"
#include "warning_control.h"
namespace polyMFEMUtils {
NonlinearPowerIntegrator::NonlinearPowerIntegrator(
mfem::Coefficient &coeff,
@@ -242,7 +244,11 @@ namespace polyMFEMUtils {
y[i] = F[i];
}
mfem::GridFunction u_gf(C.FESpace());
u_gf.SetData(u);
DEPRECATION_WARNING_OFF
u_gf.SetData(u);
DEPRECATION_WARNING_ON
y[lambdaDofOffset] = C.operator()(u_gf);
// add -lambda * C to the residual
@@ -275,8 +281,13 @@ namespace polyMFEMUtils {
mfem::SparseMatrix *J_aug = new mfem::SparseMatrix(height, width);
// Copy the original Jacobian into the augmented Jacobian
for (int i = 0; i < Jnfl_sparse->Height(); i++) {
for (int j = 0; j < Jnfl_sparse->Width(); j++) {
J_aug->Set(i, j, Jnfl_sparse->Elem(i, j));
const int *J_cols = Jnfl_sparse->GetRowColumns(i);
const double *J_vals = Jnfl_sparse->GetRowEntries(i);
for (int jj = 0; jj < Jnfl_sparse->RowSize(i); jj++) {
int j = J_cols[jj];
double val = J_vals[jj];
J_aug->Set(i, j, val);
}
}