Skip to content

Skip SCALAR variables during AMR projection#4503

Open
BozoVazic wants to merge 1 commit into
libMesh:develfrom
BozoVazic:fix-scalar-amr-projection
Open

Skip SCALAR variables during AMR projection#4503
BozoVazic wants to merge 1 commit into
libMesh:develfrom
BozoVazic:fix-scalar-amr-projection

Conversation

@BozoVazic

@BozoVazic BozoVazic commented Jul 23, 2026

Copy link
Copy Markdown

Skip SCALAR variables during AMR projection

Summary

Exclude global SCALAR variables from spatial AMR projection and copy their degrees of freedom directly between the old and new solution vectors.

Problem

System::project_vector() classified variables using FEInterface::field_type(). Both spatial scalar-valued variables and global SCALAR variables have TYPE_SCALAR, so global SCALAR variables were incorrectly passed to GenericProjector.

During fine-to-coarse projection with element-interior degrees of freedom, this caused GenericProjector::ProjectInteriors to call FE<2, SCALAR>::reinit(), which failed because global SCALAR variables do not have a spatial finite-element representation.

Change

Separate variables with the SCALAR FE family before classifying the remaining spatial variables.

The global SCALAR variables are then handled only by the existing direct degree-of-freedom mapping logic.

Testing

Added a CppUnit regression that:

  • creates a refined two-dimensional mesh;
  • combines a CONSTANT MONOMIAL spatial variable with a global SCALAR variable;
  • performs a fine-to-coarse EquationSystems::reinit();
  • verifies that the global scalar value is preserved.

The test fails without this change in FE<2, SCALAR>::reinit() and passes with the fix.

Also ran the complete SystemsTest and EquationSystemsTest selection: 47 tests passed.

Related report

Addresses idaholab/moose#33366 also discussed in idaholab/moose#33008

Future possible work

Other projection paths contain similar interactions between spatial projection and explicit handling of global SCALAR variables. While working on this I also came accros issue but did not reproduce the same failure there - this is becuase I'm not sure how to reproduce them as for this PR I actually had a MOOSE input file. Thus, this PR is only to System::project_vector() issue. Other projection paths may warrant separate follow-up review e.g., project_matrix.

Global SCALAR variables should be copied directly rather than passed through the spatial GenericProjector.

Add a regression covering fine-to-coarse projection with MONOMIAL and SCALAR variables.
@moosebuild

Copy link
Copy Markdown

Job Coverage, step Generate coverage on 40b3894 wanted to post the following:

Coverage

bc1d1a #4503 40b389
Total Total +/- New
Rate 65.66% 65.68% +0.01% 100.00%
Hits 78815 78832 +17 10
Misses 41214 41198 -16 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

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