Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_Amr.H
Go to the documentation of this file.
1
2#ifndef AMREX_Amr_H_
3#define AMREX_Amr_H_
4#include <AMReX_Config.H>
5
6#include <AMReX_Box.H>
7#include <AMReX_Geometry.H>
8#include <AMReX_BoxArray.H>
9#include <AMReX_Array.H>
10#include <AMReX_Vector.H>
11#include <AMReX_BCRec.H>
12#include <AMReX_AmrCore.H>
13
19#include <iosfwd>
20#include <list>
21#include <memory>
22
23namespace amrex {
24
25class AmrLevel;
26class LevelBld;
27#if defined(AMREX_USE_SENSEI_INSITU) && !defined(AMREX_NO_SENSEI_AMR_INST)
28class AmrInSituBridge;
29#endif
30
39class Amr
40 : public AmrCore
41{
42 using BoundaryPointList = std::multimap< std::pair<int, int>, double >;
43
44public:
50 Amr (LevelBld* a_levelbld /* One must pass LevelBld* as an argument now*/);
51
61 Amr (const RealBox* rb, int max_level_in, const Vector<int>& n_cell_in, int coord,
62 LevelBld* a_levelbld /* One must pass LevelBld* as an argument now*/);
63
65 Amr (const Amr& rhs) = delete;
67 Amr (Amr&& rhs) = delete;
69 Amr& operator= (const Amr& rhs) = delete;
71 Amr& operator= (Amr&& rhs) = delete;
72
79 void InitAmr ();
80
82 ~Amr () override;
83
90 virtual void init (Real strt_time, Real stop_time);
91
102 void InitializeInit (Real strt_time, Real stop_time,
103 const BoxArray* lev0_grids = nullptr, const Vector<int>* pmap = nullptr);
104
106 void FinalizeInit (Real strt_time, Real stop_time);
107
109 void setDtLevel (const Vector<Real>& dt_lev) noexcept;
110
112 void setDtLevel (Real dt, int lev) noexcept;
113
115 void setDtMin (const Vector<Real>& dt_min_in) noexcept;
116
118 void setNCycle (const Vector<int>& ns) noexcept;
119
121 int subCycle () const noexcept { return sub_cycle; }
122
124 const std::string& subcyclingMode() const noexcept { return subcycling_mode; }
125
130 int level_being_advanced () const noexcept { return which_level_being_advanced; }
132 Real cumTime () const noexcept { return cumtime; }
134 void setCumTime (Real t) noexcept { cumtime = t; }
136 Real startTime () const noexcept { return start_time; }
138 void setStartTime (Real t) noexcept { start_time = t; }
140 Real dtLevel (int level) const noexcept { return dt_level[level]; }
142 Real dtMin (int level) const noexcept { return dt_min[level]; }
144 const Vector<Real>& dtLevel () const noexcept { return dt_level; }
146 int nCycle (int level) const noexcept { return n_cycle[level]; }
148 int levelSteps (int lev) const noexcept { return level_steps[lev]; }
155 void setLevelSteps (int lev, int n) noexcept { level_steps[lev] = n; }
157 int levelCount (int lev) const noexcept { return level_count[lev]; }
164 void setLevelCount (int lev, int n) noexcept { level_count[lev] = n; }
166 static bool RegridOnRestart () noexcept;
168 int regridInt (int lev) const noexcept { return regrid_int[lev]; }
170 int checkInt () const noexcept { return check_int; }
172 Real checkPer() const noexcept { return check_per; }
174 int plotInt () const noexcept { return plot_int; }
176 Real plotPer () const noexcept { return plot_per; }
178 Real plotLogPer () const noexcept { return plot_log_per; }
180 int plotMaxLevel () const noexcept { return plot_max_level; }
182 int smallplotInt () const noexcept { return small_plot_int; }
184 Real smallplotPer () const noexcept { return small_plot_per; }
186 Real smallplotLogPer () const noexcept { return small_plot_log_per; }
192 static const std::list<std::string>& statePlotVars () noexcept { return state_plot_vars; }
194 static const std::list<std::string>& stateSmallPlotVars () noexcept { return state_small_plot_vars; }
200 static bool isStatePlotVar (const std::string& name);
206 static bool isStateSmallPlotVar (const std::string& name);
212 static void addStatePlotVar (const std::string& name);
218 static void addStateSmallPlotVar (const std::string& name);
224 static void deleteStatePlotVar (const std::string& name);
226 static void clearStatePlotVarList ();
228 static void clearStateSmallPlotVarList ();
230 static void fillStatePlotVarList ();
232 static void fillStateSmallPlotVarList ();
234 static bool Plot_Files_Output ();
243 static const std::list<std::string>& derivePlotVars () noexcept { return derive_plot_vars; }
250 static const std::list<std::string>& deriveSmallPlotVars () noexcept { return derive_small_plot_vars; }
256 static bool isDerivePlotVar (const std::string& name) noexcept;
262 static bool isDeriveSmallPlotVar (const std::string& name) noexcept;
268 static void addDerivePlotVar (const std::string& name);
274 static void addDeriveSmallPlotVar (const std::string& name);
280 static void deleteDerivePlotVar (const std::string& name);
286 static void deleteDeriveSmallPlotVar (const std::string& name);
288 static void clearDerivePlotVarList ();
290 static void clearDeriveSmallPlotVarList ();
292 static void fillDerivePlotVarList ();
294 static void fillDeriveSmallPlotVarList ();
295
297 static void setComputeNewDtOnRegrid (bool flag) { compute_new_dt_on_regrid = flag; }
298
300 static void Initialize ();
302 static void Finalize ();
308 AmrLevel& getLevel (int lev) noexcept { return *amr_level[lev]; }
312 Long cellCount () noexcept;
314 Long cellCount (int lev) noexcept;
316 int numGrids () noexcept;
318 int numGrids (int lev) noexcept;
320 int okToContinue () noexcept;
328 void regrid (int lbase,
329 Real time,
330 bool initial = false) override;
337 void RegridOnly (Real time, bool do_io = true);
343 bool okToRegrid (int level) noexcept;
349 static const BoxArray& initialBa (int level) noexcept
350 { BL_ASSERT(level-1 < initial_ba.size()); return initial_ba[level-1]; }
352 static int initialBaLevels () noexcept { return static_cast<int>(initial_ba.size()); }
358 virtual void coarseTimeStep (Real stop_time);
359
366 Real coarseTimeStepDt (Real stop_time);
376 std::unique_ptr<MultiFab> derive (const std::string& name,
377 Real time,
378 int lev,
379 int ngrow);
388 void derive (const std::string& name,
389 Real time,
390 const Vector<MultiFab*>& mf,
391 int dcomp);
400 Vector<std::unique_ptr<MultiFab>> derive (const std::string& name,
401 amrex::Real time,
402 int ngrow);
404 const std::string& theRestartFile () const noexcept { return restart_chkfile; }
406 const std::string& theRestartPlotFile () const noexcept { return restart_pltfile; }
412 std::ostream& DataLog (int i);
414 std::string DataLogName (int i) const noexcept { return datalogname[i]; }
416 int NumDataLogs () noexcept;
431 static Real computeOptimalSubcycling (int n,
432 int* best,
433 const Real* dt_max,
434 const Real* est_work,
435 const int* cycle_max);
436
438
441 virtual void writePlotFile ();
443 int stepOfLastPlotFile () const noexcept {return last_plotfile;}
447 virtual void writeSmallPlotFile ();
449 int stepOfLastSmallPlotFile () const noexcept {return last_smallplotfile;}
451
454 virtual void checkPoint ();
456 int stepOfLastCheckPoint () const noexcept {return last_checkpoint;}
457
459 static const Vector<BoxArray>& getInitialBA() noexcept;
460
472 void setBoundaryGeometry(BoundaryPointList& IntersectLoX,
473 BoundaryPointList& IntersectHiX,
474 BoundaryPointList& IntersectLoY,
475 BoundaryPointList& IntersectHiY) noexcept
476 {
477 intersect_lox = IntersectLoX;
478 intersect_hix = IntersectHiX;
479 intersect_loy = IntersectLoY;
480 intersect_hiy = IntersectHiY;
481 }
482
496 void setBoundaryGeometry(BoundaryPointList& IntersectLoX,
497 BoundaryPointList& IntersectHiX,
498 BoundaryPointList& IntersectLoY,
499 BoundaryPointList& IntersectHiY,
500 BoundaryPointList& IntersectLoZ,
501 BoundaryPointList& IntersectHiZ) noexcept
502 {
503 intersect_lox = IntersectLoX;
504 intersect_hix = IntersectHiX;
505 intersect_loy = IntersectLoY;
506 intersect_hiy = IntersectHiY;
507 intersect_loz = IntersectLoZ;
508 intersect_hiz = IntersectHiZ;
509 }
510
512 BoundaryPointList& getIntersectLoX() noexcept
513 {
514 return intersect_lox;
515 }
517 BoundaryPointList& getIntersectHiX() noexcept
518 {
519 return intersect_hix;
520 }
522 BoundaryPointList& getIntersectLoY() noexcept
523 {
524 return intersect_loy;
525 }
527 BoundaryPointList& getIntersectHiY() noexcept
528 {
529 return intersect_hiy;
530 }
532 BoundaryPointList& getIntersectLoZ() noexcept
533 {
534 return intersect_loz;
535 }
537 BoundaryPointList& getIntersectHiZ() noexcept
538 {
539 return intersect_hiz;
540 }
541
542#ifdef AMREX_PARTICLES
548 void RedistributeParticles ();
549#endif
550
557 void InstallNewDistributionMap (int lev, const DistributionMapping& newdm);
558
560 static bool UsingPrecreateDirectories () noexcept;
561
562protected:
563
574 void initialInit (Real strt_time, Real stop_time,
575 const BoxArray* lev0_grids = nullptr, const Vector<int>* pmap = nullptr);
576#ifndef AMREX_NO_PROBINIT
578 void readProbinFile (int& init);
579#endif
581 void checkInput ();
583 void restart (const std::string& filename);
587 void defBaseLevel (Real strt_time, const BoxArray* lev0_grids = nullptr, const Vector<int>* pmap = nullptr);
589 void bldFineLevels (Real strt_time);
591 virtual void regrid_level_0_on_restart ();
600 void grid_places (int lbase,
601 Real time,
602 int& new_finest,
603 Vector<BoxArray>& new_grids);
604
610 DistributionMapping makeLoadBalanceDistributionMap (int lev, Real time, const BoxArray& ba) const;
616 void LoadBalanceLevel0 (Real time);
617
626 void ErrorEst (int lev, TagBoxArray& tags, Real time, int ngrow) override;
628 BoxArray GetAreaNotToTag (int lev) override;
636 void ManualTagsPlacement (int lev, TagBoxArray& tags, const Vector<IntVect>& bf_lev) override;
637
647 virtual void timeStep (int level,
648 Real time,
649 int iteration,
650 int niter,
651 Real stop_time);
652
653 // pure virtual function in AmrCore
654 void MakeNewLevelFromScratch (int /*lev*/, Real /*time*/, const BoxArray& /*ba*/, const DistributionMapping& /*dm*/) override
655 { amrex::Abort("How did we get here!"); }
656 void MakeNewLevelFromCoarse (int /*lev*/, Real /*time*/, const BoxArray& /*ba*/, const DistributionMapping& /*dm*/) override
657 { amrex::Abort("How did we get here!"); }
658 void RemakeLevel (int /*lev*/, Real /*time*/, const BoxArray& /*ba*/, const DistributionMapping& /*dm*/) override
659 { amrex::Abort("How did we get here!"); }
660 void ClearLevel (int /*lev*/) override
661 { amrex::Abort("How did we get here!"); }
662
664 bool checkPointNow () noexcept;
666 bool writePlotNow () noexcept;
668 bool writeSmallPlotNow () noexcept;
669
677 void printGridInfo (std::ostream& os,
678 int min_lev,
679 int max_lev);
680
682 void setRecordGridInfo (const std::string& filename);
683
685 void setRecordRunInfo (const std::string& filename);
686
688 void setRecordRunInfoTerse (const std::string& filename);
689
691 void setRecordDataInfo (int i, const std::string& filename);
692
694 void initSubcycle();
696 void initPltAndChk();
697
699 static int initInSitu();
701 int updateInSitu();
703 static int finalizeInSitu();
704
705 //
706 // The data ...
707 //
708 std::string regrid_grids_file;
709 std::string initial_grids_file;
710 Vector<std::unique_ptr<AmrLevel> > amr_level;
711 Real cumtime = std::numeric_limits<Real>::lowest();
712 Real start_time = std::numeric_limits<Real>::lowest();
717 std::string subcycling_mode;
723 std::string check_file_root;
736 std::string plot_file_root;
738
740
744 std::ofstream gridlog;
745 std::ofstream runlog;
746 std::ofstream runlog_terse;
747 Vector<std::unique_ptr<std::fstream> > datalog;
748 Vector<std::string> datalogname;
750 std::string restart_chkfile;
751 std::string restart_pltfile;
752#ifndef AMREX_NO_PROBINIT
753 std::string probin_file;
754#endif
761
763
764 //
765 // The static data ...
766 //
767 static std::list<std::string> state_plot_vars;
768 static std::list<std::string> state_small_plot_vars;
769 static std::list<std::string> derive_plot_vars;
770 static std::list<std::string> derive_small_plot_vars;
771 static bool first_plotfile;
777
778#if defined(AMREX_USE_SENSEI_INSITU) && !defined(AMREX_NO_SENSEI_AMR_INST)
779 static AmrInSituBridge *insitu_bridge;
780#endif
781
782public:
783 BoundaryPointList intersect_lox;
784 BoundaryPointList intersect_loy;
785 BoundaryPointList intersect_loz;
786 BoundaryPointList intersect_hix;
787 BoundaryPointList intersect_hiy;
788 BoundaryPointList intersect_hiz;
789
791
792private:
793 void checkInputExtended ();
794
795 void writePlotFileDoit (std::string const& pltfile, bool regular);
796};
797
798}
799
800#endif /*_Amr_H_*/
Base class for AMR applications that manages mesh hierarchy but not state data.
Fixed-size array types for use on GPU and CPU.
Boundary condition descriptors used throughout AMReX.
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
Container and helper utilities for sets of boxes on integer index space.
Integer-lattice boxes and helpers for defining index-space regions.
Problem-domain geometry: maps between index space and physical space.
Provide basic functionalities to set up an AMR hierarchy.
Definition AMReX_AmrCore.H:31
Virtual base class for managing individual levels. AmrLevel functions both as a container for state d...
Definition AMReX_AmrLevel.H:44
Manage hierarchy of levels for time-dependent AMR computations.
Definition AMReX_Amr.H:41
Real smallplotPer() const noexcept
Time between plot files.
Definition AMReX_Amr.H:184
std::string check_file_root
Root name of checkpoint file.
Definition AMReX_Amr.H:723
virtual void init(Real strt_time, Real stop_time)
Initialize hierarchy state (grid creation, initial conditions, etc.).
Definition AMReX_Amr.cpp:1260
std::string probin_file
Definition AMReX_Amr.H:753
virtual void writeSmallPlotFile()
Write the reduced “small plot” file (subset of variables/levels) to disk.
Definition AMReX_Amr.cpp:933
bool bUserStopRequest
Definition AMReX_Amr.H:762
BoundaryPointList & getIntersectHiX() noexcept
Definition AMReX_Amr.H:517
void RemakeLevel(int, Real, const BoxArray &, const DistributionMapping &) override
Remake an existing level using provided metadata and refill from old data.
Definition AMReX_Amr.H:658
static void clearDeriveSmallPlotVarList()
Clear the list of derived quantities written to small plot files.
Definition AMReX_Amr.cpp:739
static const std::list< std::string > & deriveSmallPlotVars() noexcept
List of derived quantities included when writing small plot files.
Definition AMReX_Amr.H:250
static void fillDerivePlotVarList()
Fill the list of derive_plot_vars with all derived quantities.
Definition AMReX_Amr.cpp:703
Vector< int > n_cycle
Definition AMReX_Amr.H:716
void checkInput()
Check for valid input.
Definition AMReX_Amr.cpp:1095
DistributionMapping makeLoadBalanceDistributionMap(int lev, Real time, const BoxArray &ba) const
Build a DistributionMapping for level lev at time time using grid layout ba.
Definition AMReX_Amr.cpp:2920
void setNCycle(const Vector< int > &ns) noexcept
Provide the number of time subcycles per level via ns.
Definition AMReX_Amr.cpp:854
Vector< int > level_count
Definition AMReX_Amr.H:715
Vector< Real > dt_level
Timestep at this level.
Definition AMReX_Amr.H:713
static const Vector< BoxArray > & getInitialBA() noexcept
Definition AMReX_Amr.cpp:3548
void setLevelSteps(int lev, int n) noexcept
Override the recorded time-step count for level lev.
Definition AMReX_Amr.H:155
int file_name_digits
How many digits to use in the plotfile and checkpoint names.
Definition AMReX_Amr.H:734
static const BoxArray & initialBa(int level) noexcept
Return the user-specified BoxArray that initializes level level (1-based).
Definition AMReX_Amr.H:349
static void deleteDerivePlotVar(const std::string &name)
Remove name from the full derived list.
Definition AMReX_Amr.cpp:761
int sub_cycle
Definition AMReX_Amr.H:749
const Vector< Real > & dtLevel() const noexcept
Vector of time steps (dt) for all levels.
Definition AMReX_Amr.H:144
void initPltAndChk()
Initialize plot/checkpoint cadence, names, and counters from inputs.
Definition AMReX_Amr.cpp:3387
int plot_max_level
Maximum AMR level to write to a plotfile.
Definition AMReX_Amr.H:729
int stream_max_tries
Definition AMReX_Amr.H:757
int NumDataLogs() noexcept
Definition AMReX_Amr.cpp:164
int stepOfLastSmallPlotFile() const noexcept
Return the AMR step index associated with the most recent small plot file.
Definition AMReX_Amr.H:449
virtual void timeStep(int level, Real time, int iteration, int niter, Real stop_time)
Do a single time step on level level.
Definition AMReX_Amr.cpp:2066
void MakeNewLevelFromCoarse(int, Real, const BoxArray &, const DistributionMapping &) override
Make a new level using provided metadata and populate it from the next coarser level.
Definition AMReX_Amr.H:656
std::string restart_pltfile
Definition AMReX_Amr.H:751
int smallplotInt() const noexcept
Number of time steps between small plot files.
Definition AMReX_Amr.H:182
Vector< std::string > datalogname
Definition AMReX_Amr.H:748
Real coarseTimeStepDt(Real stop_time)
Advance once and report the coarse level dt that was used.
Definition AMReX_Amr.cpp:2233
Vector< int > regrid_int
Interval between regridding.
Definition AMReX_Amr.H:719
void restart(const std::string &filename)
Restart from a checkpoint file named filename.
Definition AMReX_Amr.cpp:1517
int plotMaxLevel() const noexcept
Maximum level index to include when writing plot files.
Definition AMReX_Amr.H:180
Vector< std::unique_ptr< std::fstream > > datalog
Definition AMReX_Amr.H:747
static void clearStatePlotVarList()
Clear the list of state_plot_vars.
Definition AMReX_Amr.cpp:639
int message_int
How often checking messages touched by user, such as "stop_run".
Definition AMReX_Amr.H:735
Vector< int > level_steps
Number of time steps at this level.
Definition AMReX_Amr.H:714
void setRecordGridInfo(const std::string &filename)
Record the log filename filename used when dumping grid info metadata.
Definition AMReX_Amr.cpp:784
AmrLevel & getLevel(int lev) noexcept
Access the AmrLevel object stored at index lev.
Definition AMReX_Amr.H:308
void setDtMin(const Vector< Real > &dt_min_in) noexcept
Override the maximum allowable dt (typically CFL-limited) for each level using dt_min_in.
Definition AMReX_Amr.cpp:176
Real plotLogPer() const noexcept
Spacing in log10(time) of logarithmically spaced plot files.
Definition AMReX_Amr.H:178
std::unique_ptr< MultiFab > derive(const std::string &name, Real time, int lev, int ngrow)
Build a MultiFab containing the derived quantity named name.
Definition AMReX_Amr.cpp:202
static bool compute_new_dt_on_regrid
Definition AMReX_Amr.H:776
BoundaryPointList & getIntersectLoY() noexcept
Definition AMReX_Amr.H:522
static Real computeOptimalSubcycling(int n, int *best, const Real *dt_max, const Real *est_work, const int *cycle_max)
Compute the optimal subcycling pattern. This assumes that anything less than cycle_max[i] is a valid ...
Definition AMReX_Amr.cpp:3495
Vector< Real > dt_min
Definition AMReX_Amr.H:718
static bool isStateSmallPlotVar(const std::string &name)
Return true if name is already registered for small plotfiles.
Definition AMReX_Amr.cpp:618
const std::string & theRestartPlotFile() const noexcept
Name of the restart plotfile.
Definition AMReX_Amr.H:406
Vector< std::unique_ptr< AmrLevel > > amr_level
Vector of levels.
Definition AMReX_Amr.H:710
static Vector< BoxArray > initial_ba
Array of BoxArrays read in to initially define grid hierarchy.
Definition AMReX_Amr.H:773
void printGridInfo(std::ostream &os, int min_lev, int max_lev)
Print per-level grid metadata to os for levels [min_lev, max_lev].
Definition AMReX_Amr.cpp:3048
BoundaryPointList intersect_hiz
Definition AMReX_Amr.H:788
int loadbalance_level0_int
Definition AMReX_Amr.H:759
void InitializeInit(Real strt_time, Real stop_time, const BoxArray *lev0_grids=nullptr, const Vector< int > *pmap=nullptr)
First half of the two-phase initialization used by initialInit().
Definition AMReX_Amr.cpp:1409
static void clearDerivePlotVarList()
Clear the list of derive_plot_vars.
Definition AMReX_Amr.cpp:733
static std::list< std::string > derive_small_plot_vars
Derived Vars to dump to small plotfile.
Definition AMReX_Amr.H:770
BoundaryPointList & getIntersectHiY() noexcept
Definition AMReX_Amr.H:527
static bool isDerivePlotVar(const std::string &name) noexcept
Return true if name is already registered for full derived-output.
Definition AMReX_Amr.cpp:689
std::string small_plot_file_root
Root name of small plotfile.
Definition AMReX_Amr.H:737
static int finalizeInSitu()
Tear down in-situ infrastructure; returns 0 on success.
Definition AMReX_Amr.cpp:595
int nCycle(int level) const noexcept
Number of subcycled time steps taken per coarse step on level level.
Definition AMReX_Amr.H:146
static void addDerivePlotVar(const std::string &name)
Register name as a derived quantity to include in full plotfiles (no-op if already present).
Definition AMReX_Amr.cpp:745
void defBaseLevel(Real strt_time, const BoxArray *lev0_grids=nullptr, const Vector< int > *pmap=nullptr)
Definition AMReX_Amr.cpp:2661
Real plotPer() const noexcept
Time between plot files.
Definition AMReX_Amr.H:176
virtual void regrid_level_0_on_restart()
Regrid level 0 on restart.
Definition AMReX_Amr.cpp:2986
static void clearStateSmallPlotVarList()
Clear the list of variables written to small plot files.
Definition AMReX_Amr.cpp:659
int loadbalance_with_workestimates
Definition AMReX_Amr.H:758
int stepOfLastPlotFile() const noexcept
Return the AMR step index associated with the most recent plot file.
Definition AMReX_Amr.H:443
int small_plot_int
How often small plotfile (# of time steps)
Definition AMReX_Amr.H:730
void RegridOnly(Real time, bool do_io=true)
Regrid the hierarchy at physical time time without advancing any levels.
Definition AMReX_Amr.cpp:2031
BoundaryPointList & getIntersectLoX() noexcept
Definition AMReX_Amr.H:512
static std::list< std::string > state_small_plot_vars
State Vars to dump to small plotfile.
Definition AMReX_Amr.H:768
BoundaryPointList intersect_loy
Definition AMReX_Amr.H:784
Amr(Amr &&rhs)=delete
Amr instances are not movable; they rely on pointers registered with static callbacks.
const std::string & theRestartFile() const noexcept
Name of the most recent restart checkpoint file.
Definition AMReX_Amr.H:404
static std::list< std::string > state_plot_vars
State Vars to dump to plotfile.
Definition AMReX_Amr.H:767
std::ofstream runlog_terse
Definition AMReX_Amr.H:746
static bool isDeriveSmallPlotVar(const std::string &name) noexcept
Return true if name is already registered for small derived-output.
Definition AMReX_Amr.cpp:696
int plotInt() const noexcept
Number of time steps between plot files.
Definition AMReX_Amr.H:174
int regridInt(int lev) const noexcept
Interval (in steps) between regrids on level lev.
Definition AMReX_Amr.H:168
std::string plot_file_root
Root name of plotfile.
Definition AMReX_Amr.H:736
void setStartTime(Real t) noexcept
Set the recorded start time to t.
Definition AMReX_Amr.H:138
Vector< std::unique_ptr< AmrLevel > > & getAmrLevels() noexcept
Return the container of level objects (index 0..finest).
Definition AMReX_Amr.cpp:184
Real startTime() const noexcept
Physical time this simulation started.
Definition AMReX_Amr.H:136
int which_level_being_advanced
Only >=0 if we are in Amr::timeStep(level,...)
Definition AMReX_Amr.H:739
std::string subcycling_mode
Type of subcycling to use.
Definition AMReX_Amr.H:717
BoundaryPointList intersect_lox
Definition AMReX_Amr.H:783
static void setComputeNewDtOnRegrid(bool flag)
Toggle whether new time steps are recomputed immediately after each regrid (flag=true recomputes).
Definition AMReX_Amr.H:297
std::ostream & DataLog(int i)
Return the i th datalog stream (opened lazily) for writing diagnostics.
Definition AMReX_Amr.cpp:158
bool writeSmallPlotNow() noexcept
Whether to emit a small plot file on this step.
Definition AMReX_Amr.cpp:2588
void RedistributeParticles()
Trigger a particle redistribution pass across all levels.
Definition AMReX_Amr.cpp:3555
static std::list< std::string > derive_plot_vars
Derived Vars to dump to plotfile.
Definition AMReX_Amr.H:769
void ErrorEst(int lev, TagBoxArray &tags, Real time, int ngrow) override
Default error-estimation driver; forwards to the levelbld-defined callbacks.
Definition AMReX_Amr.cpp:3195
int levelSteps(int lev) const noexcept
Number of time steps completed so far on level lev.
Definition AMReX_Amr.H:148
BoundaryPointList & getIntersectLoZ() noexcept
Definition AMReX_Amr.H:532
void setCumTime(Real t) noexcept
Set the accumulated physical time to t.
Definition AMReX_Amr.H:134
int stepOfLastCheckPoint() const noexcept
Return the AMR step index associated with the most recent checkpoint.
Definition AMReX_Amr.H:456
Amr(const Amr &rhs)=delete
Amr owns global driver state—disable copying to avoid duplicate hierarchies.
BoundaryPointList & getIntersectHiZ() noexcept
Definition AMReX_Amr.H:537
int updateInSitu()
Drive any per-step in-situ actions; returns 0 on success.
Definition AMReX_Amr.cpp:582
int last_plotfile
Step number of previous plotfile.
Definition AMReX_Amr.H:724
~Amr() override
The destructor.
Definition AMReX_Amr.cpp:776
void ClearLevel(int) override
Delete level lev data structures owned by the derived class.
Definition AMReX_Amr.H:660
static bool isStatePlotVar(const std::string &name)
Return true if name is already registered for full plotfiles.
Definition AMReX_Amr.cpp:611
int plot_int
How often plotfile (# of time steps)
Definition AMReX_Amr.H:726
std::ofstream gridlog
Definition AMReX_Amr.H:744
void grid_places(int lbase, Real time, int &new_finest, Vector< BoxArray > &new_grids)
Define new grid locations (called from regrid) and store them in new_grids.
Definition AMReX_Amr.cpp:3094
void setRecordRunInfo(const std::string &filename)
Record the log filename filename used when writing detailed run information.
Definition AMReX_Amr.cpp:798
void setBoundaryGeometry(BoundaryPointList &IntersectLoX, BoundaryPointList &IntersectHiX, BoundaryPointList &IntersectLoY, BoundaryPointList &IntersectHiY) noexcept
Specialized version: register intersection points for faces orthogonal to X/Y.
Definition AMReX_Amr.H:472
void InitAmr()
Initialize Amr-wide defaults and parse the amr.* ParmParse options.
Definition AMReX_Amr.cpp:277
int okToContinue() noexcept
Definition AMReX_Amr.cpp:882
void readProbinFile(int &init)
Read the probin file, updating the flag init that tracks initialization iterations.
Definition AMReX_Amr.cpp:1299
static int initInSitu()
Set up in-situ analysis hooks; returns 0 on success.
Definition AMReX_Amr.cpp:568
bool abort_on_stream_retry_failure
Definition AMReX_Amr.H:756
LevelBld * levelbld
Definition AMReX_Amr.H:755
static void deleteDeriveSmallPlotVar(const std::string &name)
Remove name from the small derived list.
Definition AMReX_Amr.cpp:769
Real cumtime
Physical time variable.
Definition AMReX_Amr.H:711
void ManualTagsPlacement(int lev, TagBoxArray &tags, const Vector< IntVect > &bf_lev) override
Allow derived classes to override tagging manually on level lev.
Definition AMReX_Amr.cpp:3207
void regrid(int lbase, Real time, bool initial=false) override
Rebuild grid hierarchy finer than lbase.
Definition AMReX_Amr.cpp:2735
Real check_per
How often checkpoint (units of time).
Definition AMReX_Amr.H:722
static int initialBaLevels() noexcept
Definition AMReX_Amr.H:352
Real checkPer() const noexcept
Time between checkpoint files.
Definition AMReX_Amr.H:172
static void Initialize()
Initialize global, Amr-wide static state (e.g., ParmParse defaults, logs).
Definition AMReX_Amr.cpp:106
static void fillStatePlotVarList()
Fill the list of state_plot_vars with all of the state quantities.
Definition AMReX_Amr.cpp:625
BoundaryPointList intersect_hix
Definition AMReX_Amr.H:786
static bool Plot_Files_Output()
Write out plotfiles (True/False)?
Definition AMReX_Amr.cpp:155
Real small_plot_per
How often small plotfile (in units of time)
Definition AMReX_Amr.H:731
std::string regrid_grids_file
Grids file that will bypass regridding.
Definition AMReX_Amr.H:708
Amr & operator=(const Amr &rhs)=delete
Copy assignment is likewise disabled.
int check_int
How often checkpoint (# time steps).
Definition AMReX_Amr.H:721
Real dtLevel(int level) const noexcept
Time step currently stored for level level.
Definition AMReX_Amr.H:140
static const std::list< std::string > & stateSmallPlotVars() noexcept
List of state variables written to the reduced “small” plot files.
Definition AMReX_Amr.H:194
static void fillDeriveSmallPlotVarList()
Populate derive_small_plot_vars with every registered derived quantity.
Definition AMReX_Amr.cpp:718
static bool first_smallplotfile
Definition AMReX_Amr.H:790
bool checkPointNow() noexcept
Whether checkpoint criteria are satisfied on this step.
Definition AMReX_Amr.cpp:2467
std::string initial_grids_file
Grids file that will bypass regridding only at initialization.
Definition AMReX_Amr.H:709
const std::string & subcyclingMode() const noexcept
How are we subcycling?
Definition AMReX_Amr.H:124
void setRecordDataInfo(int i, const std::string &filename)
Configure the i th datalog stream to mirror file filename.
Definition AMReX_Amr.cpp:826
Long cellCount() noexcept
Definition AMReX_Amr.cpp:862
void LoadBalanceLevel0(Real time)
Compute and install a new distribution map for level 0.
Definition AMReX_Amr.cpp:2964
int record_run_info_terse
Definition AMReX_Amr.H:743
virtual void coarseTimeStep(Real stop_time)
Advance the hierarchy by one coarse step.
Definition AMReX_Amr.cpp:2240
static void deleteStatePlotVar(const std::string &name)
Remove name from the full-plot list if present.
Definition AMReX_Amr.cpp:681
Real small_plot_log_per
How often small plotfile (in units of log10(time))
Definition AMReX_Amr.H:732
void bldFineLevels(Real strt_time)
Define and initialize refined levels at simulation time strt_time.
Definition AMReX_Amr.cpp:3213
std::ofstream runlog
Definition AMReX_Amr.H:745
int record_grid_info
Definition AMReX_Amr.H:741
std::string restart_chkfile
Definition AMReX_Amr.H:750
Real plot_log_per
How often plotfile (in units of log10(time))
Definition AMReX_Amr.H:728
int checkInt() const noexcept
Number of time steps between checkpoint files.
Definition AMReX_Amr.H:170
static void addStatePlotVar(const std::string &name)
Register name as a state variable to include in full plotfiles (no-op if already present).
Definition AMReX_Amr.cpp:665
int last_smallplotfile
Step number of previous small plotfile.
Definition AMReX_Amr.H:725
void InstallNewDistributionMap(int lev, const DistributionMapping &newdm)
Replace the distribution map on level lev with newdm and update metadata.
Definition AMReX_Amr.cpp:2973
bool writePlotNow() noexcept
Whether to write a plotfile now.
Definition AMReX_Amr.cpp:2515
void setLevelCount(int lev, int n) noexcept
Set the current cycle count for level lev.
Definition AMReX_Amr.H:164
void initSubcycle()
Parse ParmParse state and initialize subcycling-related arrays/flags.
Definition AMReX_Amr.cpp:3285
BoundaryPointList intersect_loz
Definition AMReX_Amr.H:785
static const std::list< std::string > & statePlotVars() noexcept
The names of state variables to output in the plotfile. They can be set using the amr....
Definition AMReX_Amr.H:192
std::string DataLogName(int i) const noexcept
The filename backing the i th datalog stream.
Definition AMReX_Amr.H:414
bool write_plotfile_with_checkpoint
Write out a plotfile whenever we checkpoint.
Definition AMReX_Amr.H:733
void FinalizeInit(Real strt_time, Real stop_time)
Second half of initial initialization; pairs with InitializeInit() using times strt_time and stop_tim...
Definition AMReX_Amr.cpp:1441
static void fillStateSmallPlotVarList()
Populate state_small_plot_vars with every state quantity registered on AmrLevel 0.
Definition AMReX_Amr.cpp:645
Real dtMin(int level) const noexcept
Max time step (typically physics-limited) for level level.
Definition AMReX_Amr.H:142
static Vector< BoxArray > regrid_ba
Array of BoxArrays read in to externally define grid hierarchy at each regrid.
Definition AMReX_Amr.H:775
int levelCount(int lev) const noexcept
Which cycle number are we on for level lev?
Definition AMReX_Amr.H:157
static bool RegridOnRestart() noexcept
Whether to regrid right after restart.
Definition AMReX_Amr.cpp:170
BoundaryPointList intersect_hiy
Definition AMReX_Amr.H:787
int numGrids() noexcept
Definition AMReX_Amr.cpp:872
int record_run_info
Definition AMReX_Amr.H:742
Real start_time
Physical time this simulation started.
Definition AMReX_Amr.H:712
Real loadbalance_max_fac
Definition AMReX_Amr.H:760
static void Finalize()
Release global Amr static resources allocated by Initialize().
Definition AMReX_Amr.cpp:142
static void addStateSmallPlotVar(const std::string &name)
Append name to the small-plot variable list if not already present.
Definition AMReX_Amr.cpp:673
void setBoundaryGeometry(BoundaryPointList &IntersectLoX, BoundaryPointList &IntersectHiX, BoundaryPointList &IntersectLoY, BoundaryPointList &IntersectHiY, BoundaryPointList &IntersectLoZ, BoundaryPointList &IntersectHiZ) noexcept
General version: register intersections for all Cartesian faces.
Definition AMReX_Amr.H:496
Real cumTime() const noexcept
Physical time (time advanced so far).
Definition AMReX_Amr.H:132
int subCycle() const noexcept
Subcycle in time?
Definition AMReX_Amr.H:121
void setDtLevel(const Vector< Real > &dt_lev) noexcept
Set per-level time steps to the values in dt_lev.
Definition AMReX_Amr.cpp:840
void setRecordRunInfoTerse(const std::string &filename)
Record the log filename filename used for terse run information.
Definition AMReX_Amr.cpp:812
Real smallplotLogPer() const noexcept
Spacing in log10(time) of logarithmically spaced small plot files.
Definition AMReX_Amr.H:186
void MakeNewLevelFromScratch(int, Real, const BoxArray &, const DistributionMapping &) override
Create and fill a new level from scratch.
Definition AMReX_Amr.H:654
int last_checkpoint
Step number of previous checkpoint.
Definition AMReX_Amr.H:720
static const std::list< std::string > & derivePlotVars() noexcept
The names of derived variables to output in the plotfile. They can be set using the amr....
Definition AMReX_Amr.H:243
bool okToRegrid(int level) noexcept
Return true if level level is permitted to regrid on this step.
Definition AMReX_Amr.cpp:3485
Real plot_per
How often plotfile (in units of time)
Definition AMReX_Amr.H:727
static bool UsingPrecreateDirectories() noexcept
Whether plot/checkpoint writers pre-create directories (helps avoid races on some filesystems).
Definition AMReX_Amr.cpp:100
int level_being_advanced() const noexcept
What is "level" in Amr::timeStep? This is only relevant if we are still in Amr::timeStep; it is set b...
Definition AMReX_Amr.H:130
static bool first_plotfile
Definition AMReX_Amr.H:771
void initialInit(Real strt_time, Real stop_time, const BoxArray *lev0_grids=nullptr, const Vector< int > *pmap=nullptr)
Initialize the grid hierarchy (called by Amr::init()).
Definition AMReX_Amr.cpp:1391
static void addDeriveSmallPlotVar(const std::string &name)
Append name to the small-plot derived list if not already present.
Definition AMReX_Amr.cpp:753
BoxArray GetAreaNotToTag(int lev) override
Return cached regions that must not be tagged on level lev.
Definition AMReX_Amr.cpp:3201
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:681
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:51
Builds problem-specific AmrLevels.
Definition AMReX_LevelBld.H:27
A Box with real dimensions.
Definition AMReX_RealBox.H:28
An array of TagBoxes.
Definition AMReX_TagBox.H:151
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
amrex_long Long
Definition AMReX_INT.H:30
@ regular
Every cell in the region is regular.
virtual void writePlotFile()
Write a full-resolution plot file to disk using the current hierarchy state.
Definition AMReX_Amr.cpp:895
virtual void checkPoint()
Write current state into a chk* checkpoint directory.
Definition AMReX_Amr.cpp:1846
Definition AMReX_Amr.cpp:50
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:242