Skip to content

Fixes to enable mfem 4.8 support#313

Merged
trevilo merged 9 commits intomainfrom
mfem-4.8
Sep 24, 2025
Merged

Fixes to enable mfem 4.8 support#313
trevilo merged 9 commits intomainfrom
mfem-4.8

Conversation

@trevilo
Copy link
Contributor

@trevilo trevilo commented Sep 22, 2025

This PR implements minor changes required to upgrade to mfem 4.8.

shaering and others added 4 commits September 22, 2025 14:28
…mfem 4.8.

This primary change is to rename the tps RiemannSolver class to
RiemannSolverTPS.  This is done b/c mfem has introduced a
RiemannSolver into the mfem namespace, and tps is very promiscuous
about using namespace mfem, leading to a clash.  We could (probably
should) fix that, but renaming the tps RiemannSolver is quicker.
In mfem v4.7 the ElementTransformation::mesh data member was changed
to const.  We use this in the
GradientVectorGridFunctionCoefficient::Eval function, which reproduces
some code from mfem::RefinedToCoarse (see mfem/fem/coefficient.cpp).
So, for mfem 4.7 and later we require const here.

But, prior to mfem v4.7, we cannot use const here b/c the subsequent
function call to mesh::GetRefinementTransforms() violates
const-correctness.

So, the solution is the #if in this commit.
mpi4py = 3.1.4, to avoid issues with underlying mpi?
mfem = 4.6, to avoid tps test failure with 4.8 that is under investigation
@trevilo
Copy link
Contributor Author

trevilo commented Sep 23, 2025

Some notes about failing tests...

  1. With mfem 4.8, 4.7, and 4.6.2-rc0, the tests plasma.axisym.test and plasma.axisym.lte1d.test fail.
  2. With mfem 4.5.2 and 4.6, these tests pass.

The diffs are smallish (e.g., max absolute diff in density of ~5e-9, corresponding to a relative diff of roughly ~1e-7) but not small enough to automatically attribute to double precision arithmetic without further investigation.

I am currently trying to further pin down what mfem change between v4.6 and v4.6.2-rc0 leads to this behavior.

@trevilo
Copy link
Contributor Author

trevilo commented Sep 23, 2025

I am currently trying to further pin down what mfem change between v4.6 and v4.6.2-rc0 leads to this behavior.

It appears that the first point at which the tests fail is when mfem PR 3899 is merged. This PR appears to include a slight modification in the detection of boundary points. This could be the cause, but still digging into it.

@trevilo
Copy link
Contributor Author

trevilo commented Sep 24, 2025

This could be the cause, but still digging into it.

This is the cause. Local testing shows that prior to mfem PR 3899, the the tests pass as is and that very few "boundary" points are detected in the gslib-based interpolation. I think this is because gslib is only detecting points on actual boundaries rather than interelement boundaries, but it is hard to parse the gslib code so that is a tentative conclusion. Either way, after mfem PR 3899 is merged, many more boundary points are detected in the interpolation, and plasma.axisym.test and plasma.axisym.lte1d.test fail.

To address this, since I'm not ready to move to mfem 4.8 all test environements (since most folks are still using mfem 4.5.2), logic has been added to these tests to detect the mfem version and use an appropriate reference solution. This should allow the regression tests to pass regardless of the mfem version.

@trevilo trevilo self-assigned this Sep 24, 2025
@trevilo trevilo requested a review from shaering September 24, 2025 18:35
@trevilo trevilo marked this pull request as ready for review September 24, 2025 18:36
@trevilo trevilo merged commit c4b47c3 into main Sep 24, 2025
18 checks passed
@trevilo trevilo deleted the mfem-4.8 branch September 25, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants