Skip to content

Commit

Permalink
fill ghost cells before output
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWibking committed Sep 7, 2023
1 parent 50b22e1 commit cfb2ffe
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ template <typename problem_t> class AMRSimulation : public amrex::AmrCore
[[nodiscard]] auto PlotFileName(int lev) const -> std::string;
[[nodiscard]] auto CustomPlotFileName(const char *base, int lev) const -> std::string;
[[nodiscard]] auto GetPlotfileVarNames() const -> amrex::Vector<std::string>;
[[nodiscard]] auto PlotFileMF() const -> amrex::Vector<amrex::MultiFab>;
[[nodiscard]] auto PlotFileMFAtLevel(int lev) const -> amrex::MultiFab;
[[nodiscard]] auto PlotFileMF() -> amrex::Vector<amrex::MultiFab>;
[[nodiscard]] auto PlotFileMFAtLevel(int lev) -> amrex::MultiFab;
void WriteMetadataFile(std::string const &plotfilename) const;
void ReadMetadataFile(std::string const &chkfilename);
void WritePlotFile() const;
void WritePlotFile();
void WriteCheckpointFile() const;
void SetLastCheckpointSymlink(std::string const &checkpointname) const;
void ReadCheckpointFile();
Expand Down Expand Up @@ -1575,7 +1575,7 @@ void AMRSimulation<problem_t>::AverageFCToCC(amrex::MultiFab &mf_cc, const amrex
amrex::Gpu::streamSynchronize();
}

template <typename problem_t> auto AMRSimulation<problem_t>::PlotFileMFAtLevel(int lev) const -> amrex::MultiFab
template <typename problem_t> auto AMRSimulation<problem_t>::PlotFileMFAtLevel(int lev) -> amrex::MultiFab
{
// Combine state_new_cc_[lev] and derived variables in a new MF
int comp = 0;
Expand All @@ -1594,8 +1594,10 @@ template <typename problem_t> auto AMRSimulation<problem_t>::PlotFileMFAtLevel(i
const int nghost_plotMF = nghost_cc;
amrex::MultiFab plotMF(grids[lev], dmap[lev], ncomp_plotMF, nghost_plotMF);

// initialise all the valid- and ghost-cells to zero, for all the components
plotMF.setVal(0.0);
// Fill ghost zones for state_new_cc_
// (N.B.: this means this function cannot be const)
fillBoundaryConditions(state_new_cc_[lev], state_new_cc_[lev], lev, tNew_[lev], quokka::centering::cc, quokka::direction::na, InterpHookNone,
InterpHookNone, FillPatchType::fillpatch_function);

// copy data from cell-centred state variables
for (int i = 0; i < ncomp_cc; i++) {
Expand All @@ -1621,7 +1623,7 @@ template <typename problem_t> auto AMRSimulation<problem_t>::PlotFileMFAtLevel(i
}

// put together an array of multifabs for writing
template <typename problem_t> auto AMRSimulation<problem_t>::PlotFileMF() const -> amrex::Vector<amrex::MultiFab>
template <typename problem_t> auto AMRSimulation<problem_t>::PlotFileMF() -> amrex::Vector<amrex::MultiFab>
{
amrex::Vector<amrex::MultiFab> r;
for (int i = 0; i <= finest_level; ++i) {
Expand Down Expand Up @@ -1713,7 +1715,7 @@ template <typename problem_t> auto AMRSimulation<problem_t>::GetPlotfileVarNames
}

// write plotfile to disk
template <typename problem_t> void AMRSimulation<problem_t>::WritePlotFile() const
template <typename problem_t> void AMRSimulation<problem_t>::WritePlotFile()
{
BL_PROFILE("AMRSimulation::WritePlotFile()");

Expand Down

0 comments on commit cfb2ffe

Please sign in to comment.