neams-th-coe / cardinal

High-Fidelity Multiphysics
https://cardinal.cels.anl.gov/
Other
91 stars 45 forks source link

Enable Adaptive Mesh Refinement #964

Open nuclearkevin opened 6 days ago

nuclearkevin commented 6 days ago

This PR enables adaptive mesh refinement for the OpenMC mesh mirror. This allows for the use of AMR (as implemented in MOOSE) within Cardinal.

The main changes include looping over active elements instead of all elements when generating the cell -> element map and creating a copy of the mesh containing only active elements when using a MeshTally. The latter is required for two reasons: to avoid errors which are thrown by MOOSE because of the equation system created in the openmc::LibMesh class, and to prevent erroneous tallying on non-active elements in the refinement/coarsening hierarchy. Creating a copy of the mesh without the refinement hierarchy is a severe limitation of the current approach and should be remedied in the future.

moosebuild commented 6 days ago

Job Precheck, step Clang format on 3fa82c3 wanted to post the following:

Your code requires style changes.

A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:

curl -s https://mooseframework.inl.gov/cardinal/docs/PRs/964/clang_format/style.patch | git apply -v

Alternatively, with your repository up to date and in the top level of your repository:

git clang-format 884e51d697612fd7e6d712b3b2839bcd00a2393e

moosebuild commented 6 days ago

Job Documentation, step Sync to remote on 6bae6e9 wanted to post the following:

View the site here

This comment will be updated on new commits.

nuclearkevin commented 4 days ago

For some reason the AMR MeshTally test crashes in CIVET, but doesn't crash on Pinchot or my local machine. I've ran the test through gdb and Valgrind (thorough memtest) and it executes successfully, so I'm at a bit of a loss at the moment.

Since I use the MOOSE Conda environment on both my local machine and Pinchot (but CIVET builds libMesh from a specific commit hash), I'm starting to wonder if there is an incongruence between the version of libMesh in the Conda distribution and the one required for Cardinal's MOOSE submodule. I'm building from source to investigate that at the moment, hopefully it yields a simple fix so I can get the tests passing.

This wasn't the cause. Valgrind and GDB both report no errors when testing this branch compiled without the MOOSE Conda environment.