Skip to content

Commit

Permalink
Refactor Reconstruction Functions (#570)
Browse files Browse the repository at this point in the history
### Description
I have relocated the reconstruction functions to all sit within the
HyperbolicSystem class, and tried to minimise code duplication.

### Checklist
- [x] I have added a description (see above).
- [ ] (Not Applicable) I have added a link to any related issues see
(see above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] (Not Applicable) I have added tests for any new physics that this
PR adds to the code.
- [x] I have tested this PR on my local computer and all tests pass.
- [x] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [x] I have requested a reviewer for this PR.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
AstroKriel and pre-commit-ci[bot] authored Apr 10, 2024
1 parent 54519af commit f8ed5f9
Show file tree
Hide file tree
Showing 3 changed files with 227 additions and 290 deletions.
17 changes: 9 additions & 8 deletions src/RadhydroSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,11 +1457,11 @@ void RadhydroSimulation<problem_t>::hydroFluxFunction(amrex::MultiFab const &pri
amrex::MultiFab const &x2Flat, amrex::MultiFab const &x3Flat, const int ng_reconstruct, const int nvars)
{
if (reconstructionOrder_ == 3) {
HydroSystem<problem_t>::template ReconstructStatesPPM<DIR>(primVar, leftState, rightState, ng_reconstruct, nvars);
HyperbolicSystem<problem_t>::template ReconstructStatesPPM<DIR>(primVar, leftState, rightState, ng_reconstruct, nvars);
} else if (reconstructionOrder_ == 2) {
HydroSystem<problem_t>::template ReconstructStatesPLM<DIR>(primVar, leftState, rightState, ng_reconstruct, nvars);
HyperbolicSystem<problem_t>::template ReconstructStatesPLM<DIR, SlopeLimiter::minmod>(primVar, leftState, rightState, ng_reconstruct, nvars);
} else if (reconstructionOrder_ == 1) {
HydroSystem<problem_t>::template ReconstructStatesConstant<DIR>(primVar, leftState, rightState, ng_reconstruct, nvars);
HyperbolicSystem<problem_t>::template ReconstructStatesConstant<DIR>(primVar, leftState, rightState, ng_reconstruct, nvars);
} else {
amrex::Abort("Invalid reconstruction order specified!");
}
Expand Down Expand Up @@ -1832,14 +1832,15 @@ void RadhydroSimulation<problem_t>::fluxFunction(amrex::Array4<const amrex::Real

if (radiationReconstructionOrder_ == 3) {
// mixed interface/cell-centered kernel
RadSystem<problem_t>::template ReconstructStatesPPM<DIR>(primVar.array(), x1LeftState.array(), x1RightState.array(), reconstructRange,
x1ReconstructRange, nvars);
HyperbolicSystem<problem_t>::template ReconstructStatesPPM<DIR>(primVar.array(), x1LeftState.array(), x1RightState.array(), reconstructRange,
x1ReconstructRange, nvars);
} else if (radiationReconstructionOrder_ == 2) {
// PLM and donor cell are interface-centered kernels
RadSystem<problem_t>::template ReconstructStatesPLM<DIR>(primVar.array(), x1LeftState.array(), x1RightState.array(), x1ReconstructRange, nvars);
HyperbolicSystem<problem_t>::template ReconstructStatesPLM<DIR, SlopeLimiter::MC>(primVar.array(), x1LeftState.array(), x1RightState.array(),
x1ReconstructRange, nvars);
} else if (radiationReconstructionOrder_ == 1) {
RadSystem<problem_t>::template ReconstructStatesConstant<DIR>(primVar.array(), x1LeftState.array(), x1RightState.array(), x1ReconstructRange,
nvars);
HyperbolicSystem<problem_t>::template ReconstructStatesConstant<DIR>(primVar.array(), x1LeftState.array(), x1RightState.array(),
x1ReconstructRange, nvars);
} else {
amrex::Abort("Invalid reconstruction order for radiation variables! Aborting...");
}
Expand Down
Loading

0 comments on commit f8ed5f9

Please sign in to comment.