Skip to content

Commit

Permalink
Multi-materials and derived variable output (AMReX-Codes#2888)
Browse files Browse the repository at this point in the history
## Summary

Output small plots if only derived variables are specified.
Also, make DeriveFuncFab a std::function<> instead of plain function-pointer.

## Additional background

We have been implementing small-plots for outputing variables at gauges (e.g. pressure at specific gauge locations). We may want to output the derived variable pressure only, and not all state-variables. The if-condition was incorrect in this case.

Further, multi-material simulations require a material index in order to compute derived variables, in addition to existing parameters. Making DeriveFuncFab a std::function is sufficient for our purposes.
  • Loading branch information
philip-blakely authored Jul 27, 2022
1 parent ce0fb74 commit 51542c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Src/Amr/AMReX_Amr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ Amr::writeSmallPlotFile ()

// Don't continue if we have no variables to plot.

if (stateSmallPlotVars().size() == 0) {
if (stateSmallPlotVars().size() == 0 && deriveSmallPlotVars().size() == 0) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions Src/Amr/AMReX_Derive.H
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ extern "C"
const int* level, const int* grid_no) ;
}

typedef void (*DeriveFuncFab) (const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datafab, const amrex::Geometry& geomdata,
amrex::Real time, const int* bcrec, int level);
typedef std::function<void(const amrex::Box& bx, amrex::FArrayBox& derfab, int dcomp, int ncomp,
const amrex::FArrayBox& datafab, const amrex::Geometry& geomdata,
amrex::Real time, const int* bcrec, int level)> DeriveFuncFab;

class DescriptorList;

Expand Down

0 comments on commit 51542c8

Please sign in to comment.