Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
AMReX_AmrLevel.H
Go to the documentation of this file.
1
2#ifndef AMREX_AmrLevel_H_
3#define AMREX_AmrLevel_H_
4#include <AMReX_Config.H>
5
6#include <AMReX_REAL.H>
7#include <AMReX_Geometry.H>
8#include <AMReX_MultiFab.H>
10#include <AMReX_LayoutData.H>
11#include <AMReX_Derive.H>
12#include <AMReX_BCRec.H>
13#include <AMReX_Amr.H>
16#include <AMReX_StateData.H>
17#include <AMReX_VisMF.H>
18#include <AMReX_RungeKutta.H>
19#include <AMReX_FillPatcher.H>
20#ifdef AMREX_USE_EB
21#include <AMReX_EBSupport.H>
22#endif
23
24#include <memory>
25#include <map>
26
27namespace amrex {
28
29class TagBox;
30class TagBoxArray;
31
38{
39 friend class Amr;
40 friend class FillPatchIterator;
42
43public:
52 virtual ~AmrLevel ();
53
54 AmrLevel (const AmrLevel&) = delete;
55 AmrLevel (AmrLevel&&) = delete;
56 AmrLevel& operator= (const AmrLevel&) = delete;
58
60 void LevelDirectoryNames (const std::string &dir,
61 std::string &LevelDir,
62 std::string &FullPath) const;
64 virtual void CreateLevelDirectory (const std::string &dir);
69 void SetLevelDirectoryCreated(bool ldc) noexcept { levelDirectoryCreated = ldc; }
78 virtual std::string thePlotFileType () const
79 {
80 static const std::string the_plot_file_type("HyperCLaw-V1.1");
81 return the_plot_file_type;
82 }
86 virtual void writePlotFile (const std::string& dir,
87 std::ostream& os,
89
91 virtual void writePlotFilePre (const std::string& dir,
92 std::ostream& os);
93
95 virtual void writePlotFilePost (const std::string& dir,
96 std::ostream& os);
97
101 virtual void writeSmallPlotFile (const std::string& /*dir*/,
102 std::ostream& /*os*/,
103 VisMF::How /*how*/ = VisMF::NFiles) {}
105 virtual void checkPoint (const std::string& dir,
106 std::ostream& os,
108 bool dump_old = true);
110 virtual void checkPointPre (const std::string& dir,
111 std::ostream& os);
113 virtual void checkPointPost (const std::string& dir,
114 std::ostream& os);
116 virtual void restart (Amr& papa,
117 std::istream& is,
118 bool bReadSpecial = false);
119
121 virtual void set_state_in_checkpoint (Vector<int>& state_in_checkpoint);
122
124 static bool isStateVariable (const std::string& name,
125 int& state_indx,
126 int& ncomp);
127
128 static void FlushFPICache ();
133 virtual void computeInitialDt (int finest_level,
134 int sub_cycle,
135 Vector<int>& n_cycle,
136 const Vector<IntVect>& ref_ratio,
137 Vector<Real>& dt_level,
138 Real stop_time) = 0;
143 virtual void computeNewDt (int finest_level,
144 int sub_cycle,
145 Vector<int>& n_cycle,
146 const Vector<IntVect>& ref_ratio,
147 Vector<Real>& dt_min,
148 Vector<Real>& dt_level,
149 Real stop_time,
150 int post_regrid_flag) = 0;
156 virtual Real advance (Real time,
157 Real dt,
158 int iteration,
159 int ncycle) = 0;
160
165 virtual void post_timestep (int iteration);
170 virtual void postCoarseTimeStep (Real time);
174 virtual void post_restart () {}
180 virtual void post_regrid (int lbase,
181 int new_finest) = 0;
187 virtual void post_init (Real stop_time) = 0;
191 virtual int okToContinue () { return 1; }
197 virtual int okToRegrid ();
203 virtual void initData () = 0;
205 virtual void setTimeLevel (Real time,
206 Real dt_old,
207 Real dt_new);
209 virtual void allocOldData ();
211 virtual void removeOldData ();
217 virtual void init (AmrLevel &old) = 0;
223 virtual void init () = 0;
225 void reset ();
227 int Level () const noexcept { return level; }
229 const BoxArray& boxArray () const noexcept { return grids; }
230 const BoxArray& getEdgeBoxArray (int dir) const noexcept;
231 const BoxArray& getNodalBoxArray () const noexcept;
232 //
233 const DistributionMapping& DistributionMap () const noexcept { return dmap; }
234 //
235 const FabFactory<FArrayBox>& Factory () const noexcept { return *m_factory; }
236 //
237#ifdef AMREX_USE_EB
238 const EBFArrayBoxFactory&
239 EBFactory () const noexcept {
240 return static_cast<amrex::EBFArrayBoxFactory const&>(*m_factory);
241 }
242#endif
243
245 int numGrids () const noexcept { return static_cast<int>(grids.size()); }
247 int numStates () const noexcept { return static_cast<int>(state.size()); }
249 const Box& Domain () const noexcept { return geom.Domain(); }
251 int nStep () const noexcept { return parent->levelSteps(level); }
253 const Geometry& Geom () const noexcept { return geom; }
254 //
255 const IntVect& fineRatio () const noexcept { return fine_ratio; }
257 Long countCells () const noexcept;
258
260 const BoxArray& getAreaNotToTag () noexcept;
261 const Box& getAreaToTag () noexcept;
263 void constructAreaNotToTag ();
265 void setAreaNotToTag (BoxArray& ba) noexcept;
266
267 void resetFillPatcher ();
268
273 virtual void errorEst (TagBoxArray& tb,
274 int clearval,
275 int tagval,
276 Real time,
277 int n_error_buf = 0,
278 int ngrow = 0) = 0;
280 void FillCoarsePatch (MultiFab& mf,
281 int dcomp,
282 Real time,
283 int state_idx,
284 int scomp,
285 int ncomp,
286 int nghost = 0);
288 virtual void setPhysBoundaryValues (FArrayBox& dest,
289 int state_indx,
290 Real time,
291 int dest_comp,
292 int src_comp,
293 int num_comp);
300 virtual std::unique_ptr<MultiFab> derive (const std::string& name,
301 Real time,
302 int ngrow);
307 virtual void derive (const std::string& name,
308 Real time,
309 MultiFab& mf,
310 int dcomp);
312 StateData& get_state_data (int state_indx) noexcept { return state[state_indx]; }
314 MultiFab& get_old_data (int state_indx) noexcept { return state[state_indx].oldData(); }
316 const MultiFab& get_old_data (int state_indx) const noexcept { return state[state_indx].oldData(); }
318 MultiFab& get_new_data (int state_indx) noexcept { return state[state_indx].newData(); }
320 const MultiFab& get_new_data (int state_indx) const noexcept { return state[state_indx].newData(); }
322 static const DescriptorList& get_desc_lst () noexcept { return desc_lst; }
324 static DeriveList& get_derive_lst () noexcept;
326 int postStepRegrid () const noexcept { return post_step_regrid; }
328 void setPostStepRegrid (int new_val) noexcept { post_step_regrid = new_val; }
329
332
334 Vector<int> getBCArray (int State_Type,
335 int gridno,
336 int strt_comp,
337 int ncomp);
339 MultiFab& get_data (int state_indx, Real time) noexcept;
342 int state_index,
343 int scomp,
344 int dcomp,
345 int ncomp,
346 Real time) const;
351 virtual void manual_tags_placement (TagBoxArray& tags,
352 const Vector<IntVect>& bf_lev);
354 virtual void setPlotVariables ();
356 virtual void setSmallPlotVariables ();
362 virtual Real estimateWork();
363
365 virtual int WorkEstType () { return -1; }
366
371 TimeLevel which_time (int state_indx, Real time) const noexcept;
372
373 virtual bool checkPointNow ();
374
376 virtual bool writePlotNow ();
377
379 virtual bool writeSmallPlotNow ();
380
381#ifdef AMREX_PARTICLES
383 virtual void particle_redistribute (int /*lbase*/ = 0, bool /*a_init*/ = false) {;}
384#endif
385
397 void FillPatcherFill (amrex::MultiFab& mf, int dcomp, int ncomp, int nghost,
398 amrex::Real time, int state_index, int scomp);
399
400 static void FillPatch (AmrLevel& amrlevel,
401 MultiFab& leveldata,
402 int boxGrow,
403 Real time,
404 int index,
405 int scomp,
406 int ncomp,
407 int dcomp=0);
408
409 static void FillPatchAdd (AmrLevel& amrlevel,
410 MultiFab& leveldata,
411 int boxGrow,
412 Real time,
413 int index,
414 int scomp,
415 int ncomp,
416 int dcomp=0);
417
439 template <typename F, typename P = RungeKutta::PostStageNoOp>
440 void RK (int order, int state_type, Real time, Real dt, int iteration,
441 int ncycle, F&& f, P&& p = RungeKutta::PostStageNoOp());
442
443#ifdef AMREX_USE_EB
444 static void SetEBMaxGrowCells (int nbasic, int nvolume, int nfull) noexcept {
445 m_eb_basic_grow_cells = nbasic;
446 m_eb_volume_grow_cells = nvolume;
447 m_eb_full_grow_cells = nfull;
448 }
452 static void SetEBSupportLevel (EBSupport ebs) { m_eb_support_level = ebs; }
454#endif
455
457 static IntVect ProperBlockingFactor (AmrLevel const& amr_level, int boxGrow,
458 IndexType const& boxType,
459 StateDescriptor const& desc, int SComp);
460
461protected:
463 AmrLevel () noexcept {} // NOLINT
464
465 AmrLevel (Amr& papa,
466 int lev,
467 const Geometry& level_geom,
468 const BoxArray& ba,
469 const DistributionMapping& dm,
470 Real time);
471
473 void finishConstructor ();
474
475 //
476 // The Data.
477 //
478 int level{-1}; // AMR level (0 is coarsest).
479 Geometry geom; // Geom at this level.
480 BoxArray grids; // Cell-centered locations of grids.
481 DistributionMapping dmap; // Distribution of grids among processes
482 Amr* parent{nullptr};// Pointer to parent AMR structure.
483 IntVect crse_ratio; // Refinement ratio to coarser level.
484 IntVect fine_ratio; // Refinement ratio to finer level.
485 static DeriveList derive_lst; // List of derived quantities.
486 static DescriptorList desc_lst; // List of state variables.
487 Vector<StateData> state; // Array of state data.
488
489 BoxArray m_AreaNotToTag; //Area which shouldn't be tagged on this level.
490 Box m_AreaToTag; //Area which is allowed to be tagged on this level.
491
492 int post_step_regrid{0}; // Whether or not to do a regrid after the timestep.
493
494 bool levelDirectoryCreated{false}; // for checkpoints and plotfiles
495
496 std::unique_ptr<FabFactory<FArrayBox> > m_factory;
497
499
500private:
501
502 template <std::size_t order>
503 void storeRKCoarseData (int state_type, Real time, Real dt,
504 MultiFab const& S_old,
505 Array<MultiFab,order> const& rkk);
506
507 void FillRKPatch (int state_index, MultiFab& S, Real time,
508 int stage, int iteration, int ncycle);
509
510 mutable BoxArray edge_grids[AMREX_SPACEDIM]; // face-centered grids
511 mutable BoxArray nodal_grids; // all nodal grids
512};
513
514//
515// Forward declaration.
516//
518
520 :
521 public MFIter
522{
523 public:
524
525 friend class AmrLevel;
526
527 FillPatchIterator (AmrLevel& amrlevel,
528 MultiFab& leveldata);
529
530 FillPatchIterator (AmrLevel& amrlevel,
531 MultiFab& leveldata,
532 int boxGrow,
533 Real time,
534 int idx,
535 int scomp,
536 int ncomp);
537
538 void Initialize (int boxGrow,
539 Real time,
540 int idx,
541 int scomp,
542 int ncomp);
543
544 FArrayBox& operator() () noexcept { return m_fabs[MFIter::index()]; }
545
546 Box UngrownBox () const noexcept { return MFIter::validbox(); }
547
548 MultiFab& get_mf() noexcept { return m_fabs; }
549
550private:
551
552 void FillFromLevel0 (Real time, int idx, int scomp, int dcomp, int ncomp);
553 void FillFromTwoLevels (Real time, int idx, int scomp, int dcomp, int ncomp);
554
555 //
556 // The data.
557 //
560 std::vector< std::pair<int,int> > m_range;
563};
564
566{
567public:
568
569 friend class FillPatchIterator;
570
572 MultiFab& leveldata);
573
575 MultiFab& leveldata,
576 int boxGrow,
577 Real time,
578 int index,
579 int scomp,
580 int ncomp,
581 InterpBase* mapper);
582
583 void Initialize (int boxGrow,
584 Real time,
585 int idx,
586 int scomp,
587 int ncomp,
588 InterpBase* mapper);
589
590 void fill (FArrayBox& fab, int dcomp, int idx);
591
592private:
593 //
594 // The data.
595 //
599 Vector< Vector<MultiFabId> > m_mfid; // [level][oldnew]
600 Interpolater* m_map = nullptr;
601 std::map<int,Box> m_ba;
602 Real m_time = std::numeric_limits<Real>::lowest();
603 int m_growsize = std::numeric_limits<int>::lowest();
604 int m_index = -1;
605 int m_scomp = -1;
606 int m_ncomp = -1;
607 bool m_FixUpCorners = false;
608
609 std::map< int,Vector< Vector<Box> > > m_fbox; // [grid][level][validregion]
610 std::map< int,Vector< Vector<Box> > > m_cbox; // [grid][level][fillablesubbox]
611 std::map< int,Vector< Vector< Vector<FillBoxId> > > > m_fbid; // [grid][level][fillablesubbox][oldnew]
612};
613
614template <typename F, typename P>
615void AmrLevel::RK (int order, int state_type, Real time, Real dt, int iteration,
616 int ncycle, F&& f, P&& p)
617{
618 BL_PROFILE("AmrLevel::RK()");
619
620 AMREX_ASSERT(AmrLevel::desc_lst[state_type].nExtra() > 0); // Need ghost cells in StateData
621
622 MultiFab& S_old = get_old_data(state_type);
623 MultiFab& S_new = get_new_data(state_type);
624
625 if (order == 2) {
626 RungeKutta::RK2(S_old, S_new, time, dt, std::forward<F>(f),
627 [&] (int /*stage*/, MultiFab& mf, Real t) {
628 FillPatcherFill(mf, 0, mf.nComp(), mf.nGrow(), t,
629 state_type, 0); },
630 std::forward<P>(p));
631 } else if (order == 3) {
632 RungeKutta::RK3(S_old, S_new, time, dt, std::forward<F>(f),
633 [&] (int stage, MultiFab& mf, Real t) {
634 FillRKPatch(state_type, mf, t, stage, iteration, ncycle);
635 },
636 [&] (Array<MultiFab,3> const& rkk) {
637 if (level < parent->finestLevel()) {
638 storeRKCoarseData(state_type, time, dt, S_old, rkk);
639 }
640 },
641 std::forward<P>(p));
642 } else if (order == 4) {
643 RungeKutta::RK4(S_old, S_new, time, dt, std::forward<F>(f),
644 [&] (int stage, MultiFab& mf, Real t) {
645 FillRKPatch(state_type, mf, t, stage, iteration, ncycle);
646 },
647 [&] (Array<MultiFab,4> const& rkk) {
648 if (level < parent->finestLevel()) {
649 storeRKCoarseData(state_type, time, dt, S_old, rkk);
650 }
651 },
652 std::forward<P>(p));
653 } else {
654 amrex::Abort("AmrLevel::RK: order = "+std::to_string(order)+" is not supported");
655 }
656}
657
658template <std::size_t order>
659void AmrLevel::storeRKCoarseData (int state_type, Real time, Real dt,
660 MultiFab const& S_old,
661 Array<MultiFab,order> const& rkk)
662{
663 BL_PROFILE("AmrLevel::storeRKCoarseData()");
664 if (level == parent->finestLevel()) { return; }
665
666 const StateDescriptor& desc = AmrLevel::desc_lst[state_type];
667
668 auto& fillpatcher = parent->getLevel(level+1).m_fillpatcher[state_type];
669 fillpatcher = std::make_unique<FillPatcher<MultiFab>>
671 parent->Geom(level+1),
673 parent->Geom(level),
674 IntVect(desc.nExtra()), desc.nComp(), desc.interp(0));
675
676 fillpatcher->storeRKCoarseData(time, dt, S_old, rkk);
677}
678
679
680}
681
682#endif /*_AmrLevel_H_*/
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
Virtual base class for managing individual levels. AmrLevel functions both as a container for state d...
Definition AMReX_AmrLevel.H:38
virtual void post_regrid(int lbase, int new_finest)=0
Operations to be done after regridding This is a pure virtual function and hence MUST be implemented ...
virtual Real estimateWork()
Estimate the amount of work required to advance Just this level based on the number of cells....
Definition AMReX_AmrLevel.cpp:2053
virtual void restart(Amr &papa, std::istream &is, bool bReadSpecial=false)
Restart from a checkpoint file.
Definition AMReX_AmrLevel.cpp:386
BoxArray edge_grids[3]
Definition AMReX_AmrLevel.H:510
void reset()
Reset data to initial time by swapping new and old time data.
Definition AMReX_AmrLevel.cpp:596
Long countCells() const noexcept
Returns number of cells on level.
Definition AMReX_AmrLevel.cpp:504
IntVect fine_ratio
Definition AMReX_AmrLevel.H:484
int level
Definition AMReX_AmrLevel.H:478
virtual void checkPoint(const std::string &dir, std::ostream &os, VisMF::How how=VisMF::NFiles, bool dump_old=true)
Write current state to checkpoint file.
Definition AMReX_AmrLevel.cpp:510
int Level() const noexcept
Returns this AmrLevel.
Definition AMReX_AmrLevel.H:227
virtual void writePlotFilePre(const std::string &dir, std::ostream &os)
Do pre-plotfile work to avoid synchronizations while writing the amr hierarchy.
Definition AMReX_AmrLevel.cpp:372
virtual int WorkEstType()
Which state data type is for work estimates? -1 means none.
Definition AMReX_AmrLevel.H:365
virtual bool writePlotNow()
Does the AmrLevel want Amr to write a plotfile now?
Definition AMReX_AmrLevel.cpp:2065
virtual void init(AmrLevel &old)=0
Init data on this level from another AmrLevel (during regrid). This is a pure virtual function and he...
static int m_eb_volume_grow_cells
Definition AMReX_AmrLevel.H:450
const Geometry & Geom() const noexcept
Returns the geometry object.
Definition AMReX_AmrLevel.H:253
static IntVect ProperBlockingFactor(AmrLevel const &amr_level, int boxGrow, IndexType const &boxType, StateDescriptor const &desc, int SComp)
Recommendation of a proper blocking factor.
Definition AMReX_AmrLevel.cpp:2282
virtual void computeInitialDt(int finest_level, int sub_cycle, Vector< int > &n_cycle, const Vector< IntVect > &ref_ratio, Vector< Real > &dt_level, Real stop_time)=0
Compute the initial time step. This is a pure virtual function and hence MUST be implemented by deriv...
void FillRKPatch(int state_index, MultiFab &S, Real time, int stage, int iteration, int ncycle)
Definition AMReX_AmrLevel.cpp:2262
Vector< std::unique_ptr< FillPatcher< MultiFab > > > m_fillpatcher
Definition AMReX_AmrLevel.H:498
virtual bool writeSmallPlotNow()
Does the AmrLevel want Amr to write a small plotfile now?
Definition AMReX_AmrLevel.cpp:2071
void LevelDirectoryNames(const std::string &dir, std::string &LevelDir, std::string &FullPath) const
Get the level directory names.
Definition AMReX_AmrLevel.cpp:2229
virtual void computeNewDt(int finest_level, int sub_cycle, Vector< int > &n_cycle, const Vector< IntVect > &ref_ratio, Vector< Real > &dt_min, Vector< Real > &dt_level, Real stop_time, int post_regrid_flag)=0
Compute the next time step. This is a pure virtual function and hence MUST be implemented by derived ...
virtual std::unique_ptr< MultiFab > derive(const std::string &name, Real time, int ngrow)
Returns a MultiFab containing the derived data for this level. The user is responsible for deleting t...
Definition AMReX_AmrLevel.cpp:1615
const BoxArray & boxArray() const noexcept
List of grids at this level.
Definition AMReX_AmrLevel.H:229
virtual void manual_tags_placement(TagBoxArray &tags, const Vector< IntVect > &bf_lev)
Called in grid_places after other tagging routines to modify the list of tagged points....
Definition AMReX_AmrLevel.cpp:63
virtual void setPhysBoundaryValues(FArrayBox &dest, int state_indx, Real time, int dest_comp, int src_comp, int num_comp)
Function to set physical boundary conditions.
Definition AMReX_AmrLevel.cpp:647
const MultiFab & get_old_data(int state_indx) const noexcept
State data at old time.
Definition AMReX_AmrLevel.H:316
void SetLevelDirectoryCreated(bool ldc) noexcept
Set if the Level_ directory was created or to clear the value. CreateLevelDirectory sets levelDirecto...
Definition AMReX_AmrLevel.H:69
void setPostStepRegrid(int new_val) noexcept
Sets a new value for the post-timestep regrid trigger.
Definition AMReX_AmrLevel.H:328
const IntVect & fineRatio() const noexcept
Definition AMReX_AmrLevel.H:255
virtual void writePlotFilePost(const std::string &dir, std::ostream &os)
Do post-plotfile work to avoid synchronizations while writing the amr hierarchy.
Definition AMReX_AmrLevel.cpp:379
BoxArray nodal_grids
Definition AMReX_AmrLevel.H:511
Vector< int > getBCArray(int State_Type, int gridno, int strt_comp, int ncomp)
Boundary condition access function.
Definition AMReX_AmrLevel.cpp:1869
const FabFactory< FArrayBox > & Factory() const noexcept
Definition AMReX_AmrLevel.H:235
Box m_AreaToTag
Definition AMReX_AmrLevel.H:490
static void FillPatch(AmrLevel &amrlevel, MultiFab &leveldata, int boxGrow, Real time, int index, int scomp, int ncomp, int dcomp=0)
Definition AMReX_AmrLevel.cpp:2193
virtual void removeOldData()
Delete old-time data.
Definition AMReX_AmrLevel.cpp:587
Geometry geom
Definition AMReX_AmrLevel.H:479
TimeLevel which_time(int state_indx, Real time) const noexcept
Returns one the TimeLevel enums. Asserts that time is between AmrOldTime and AmrNewTime.
Definition AMReX_AmrLevel.cpp:2018
virtual void setTimeLevel(Real time, Real dt_old, Real dt_new)
Set the time levels of state data.
Definition AMReX_AmrLevel.cpp:476
virtual int okToContinue()
Is it ok to continue the calculation?
Definition AMReX_AmrLevel.H:191
const BoxArray & getNodalBoxArray() const noexcept
Definition AMReX_AmrLevel.cpp:637
StateData & get_state_data(int state_indx) noexcept
State data object.
Definition AMReX_AmrLevel.H:312
MultiFab & get_data(int state_indx, Real time) noexcept
Get state data at specified index and time.
Definition AMReX_AmrLevel.cpp:605
const EBFArrayBoxFactory & EBFactory() const noexcept
Definition AMReX_AmrLevel.H:239
BoxArray grids
Definition AMReX_AmrLevel.H:480
virtual void allocOldData()
Alloc space for old time data.
Definition AMReX_AmrLevel.cpp:578
virtual void set_state_in_checkpoint(Vector< int > &state_in_checkpoint)
Old checkpoint may have different number of states than the new source code.
Definition AMReX_AmrLevel.cpp:467
static int m_eb_full_grow_cells
Definition AMReX_AmrLevel.H:451
void UpdateDistributionMaps(DistributionMapping &dmap)
Update the distribution maps in StateData based on the size of the map.
Definition AMReX_AmrLevel.cpp:1852
const DistributionMapping & DistributionMap() const noexcept
Definition AMReX_AmrLevel.H:233
virtual void postCoarseTimeStep(Real time)
Contains operations to be done only after a full coarse timestep. The default implementation does not...
Definition AMReX_AmrLevel.cpp:43
virtual void post_timestep(int iteration)
Contains operations to be done after a timestep. If this function is overridden, don't forget to rese...
Definition AMReX_AmrLevel.cpp:35
const Box & Domain() const noexcept
Returns the indices defining physical domain.
Definition AMReX_AmrLevel.H:249
virtual void errorEst(TagBoxArray &tb, int clearval, int tagval, Real time, int n_error_buf=0, int ngrow=0)=0
Error estimation for regridding. This is a pure virtual function and hence MUST be implemented by der...
static DeriveList derive_lst
Definition AMReX_AmrLevel.H:485
void constructAreaNotToTag()
Construct the area not to tag.
Definition AMReX_AmrLevel.cpp:2091
bool levelDirectoryCreated
Definition AMReX_AmrLevel.H:494
static void SetEBSupportLevel(EBSupport ebs)
Definition AMReX_AmrLevel.H:452
static DeriveList & get_derive_lst() noexcept
Returns list of derived variables.
Definition AMReX_AmrLevel.cpp:57
IntVect crse_ratio
Definition AMReX_AmrLevel.H:483
virtual void setPlotVariables()
Modify list of variables to be plotted.
Definition AMReX_AmrLevel.cpp:1897
const Box & getAreaToTag() noexcept
Definition AMReX_AmrLevel.cpp:2081
virtual void writeSmallPlotFile(const std::string &, std::ostream &, VisMF::How=VisMF::NFiles)
Write small plot file stuff to specified directory.
Definition AMReX_AmrLevel.H:101
virtual bool checkPointNow()
Definition AMReX_AmrLevel.cpp:2059
TimeLevel
What time are we at?
Definition AMReX_AmrLevel.H:45
@ Amr1QtrTime
Definition AMReX_AmrLevel.H:48
@ AmrOldTime
Definition AMReX_AmrLevel.H:45
@ AmrNewTime
Definition AMReX_AmrLevel.H:47
@ AmrOtherTime
Definition AMReX_AmrLevel.H:50
@ AmrHalfTime
Definition AMReX_AmrLevel.H:46
@ Amr3QtrTime
Definition AMReX_AmrLevel.H:49
virtual void initData()=0
Init grid data at problem start-up. This is a pure virtual function and hence MUST be implemented by ...
AmrLevel & operator=(const AmrLevel &)=delete
virtual void checkPointPost(const std::string &dir, std::ostream &os)
Do post-checkpoint work to avoid synchronizations while writing the amr hierarchy.
Definition AMReX_AmrLevel.cpp:565
std::unique_ptr< FabFactory< FArrayBox > > m_factory
Definition AMReX_AmrLevel.H:496
void finishConstructor()
Common code used by all constructors.
Definition AMReX_AmrLevel.cpp:473
void RK(int order, int state_type, Real time, Real dt, int iteration, int ncycle, F &&f, P &&p=RungeKutta::PostStageNoOp())
Evolve one step with Runge-Kutta (2, 3, or 4)
Definition AMReX_AmrLevel.H:615
virtual void CreateLevelDirectory(const std::string &dir)
Create the Level_ directory for checkpoint and plot files.
Definition AMReX_AmrLevel.cpp:2245
virtual Real advance(Real time, Real dt, int iteration, int ncycle)=0
Do an integration step on this level. Returns maximum safe time step. This is a pure virtual function...
static void SetEBMaxGrowCells(int nbasic, int nvolume, int nfull) noexcept
Definition AMReX_AmrLevel.H:444
void FillCoarsePatch(MultiFab &mf, int dcomp, Real time, int state_idx, int scomp, int ncomp, int nghost=0)
Interpolate from coarse level to the valid area in mf.
Definition AMReX_AmrLevel.cpp:1519
int post_step_regrid
Definition AMReX_AmrLevel.H:492
static EBSupport m_eb_support_level
Definition AMReX_AmrLevel.H:453
BoxArray m_AreaNotToTag
Definition AMReX_AmrLevel.H:489
virtual int okToRegrid()
Should I regrid with this level as base level? This test is only evaluated if regrid_int > 0 and leve...
Definition AMReX_AmrLevel.cpp:1891
static void FillPatchAdd(AmrLevel &amrlevel, MultiFab &leveldata, int boxGrow, Real time, int index, int scomp, int ncomp, int dcomp=0)
Definition AMReX_AmrLevel.cpp:2211
virtual void checkPointPre(const std::string &dir, std::ostream &os)
Do pre-checkpoint work to avoid synchronizations while writing the amr hierarchy.
Definition AMReX_AmrLevel.cpp:557
int numStates() const noexcept
Number of states at this level.
Definition AMReX_AmrLevel.H:247
virtual void writePlotFile(const std::string &dir, std::ostream &os, VisMF::How how=VisMF::NFiles)
Write plot file stuff to specified directory.
Definition AMReX_AmrLevel.cpp:134
virtual std::string thePlotFileType() const
A string written as the first item in writePlotFile() at level zero. It is so we can distinguish betw...
Definition AMReX_AmrLevel.H:78
DistributionMapping dmap
Definition AMReX_AmrLevel.H:481
AmrLevel(AmrLevel &&)=delete
void storeRKCoarseData(int state_type, Real time, Real dt, MultiFab const &S_old, Array< MultiFab, order > const &rkk)
Definition AMReX_AmrLevel.H:659
static int m_eb_basic_grow_cells
Definition AMReX_AmrLevel.H:449
virtual void particle_redistribute(int=0, bool=false)
This function can be called from the parent.
Definition AMReX_AmrLevel.H:383
Vector< StateData > state
Definition AMReX_AmrLevel.H:487
const MultiFab & get_new_data(int state_indx) const noexcept
State data at new time.
Definition AMReX_AmrLevel.H:320
int nStep() const noexcept
Timestep n at this level.
Definition AMReX_AmrLevel.H:251
virtual void post_init(Real stop_time)=0
Operations to be done after initialization. This is a pure virtual function and hence MUST be impleme...
static void FlushFPICache()
void setAreaNotToTag(BoxArray &ba) noexcept
Set the area not to tag.
Definition AMReX_AmrLevel.cpp:2086
static bool isStateVariable(const std::string &name, int &state_indx, int &ncomp)
Is name a state variable?
Definition AMReX_AmrLevel.cpp:487
static DescriptorList desc_lst
Definition AMReX_AmrLevel.H:486
const BoxArray & getEdgeBoxArray(int dir) const noexcept
Definition AMReX_AmrLevel.cpp:626
AmrLevel(const AmrLevel &)=delete
virtual void set_preferred_boundary_values(MultiFab &S, int state_index, int scomp, int dcomp, int ncomp, Real time) const
Hack to allow override of (non-fine-fine) fillpatched boundary data.
Definition AMReX_AmrLevel.cpp:48
virtual void setSmallPlotVariables()
Modify list of variables to be plotted.
Definition AMReX_AmrLevel.cpp:1957
AmrLevel() noexcept
The constructors – for derived classes.
Definition AMReX_AmrLevel.H:463
static const DescriptorList & get_desc_lst() noexcept
Returns list of Descriptors.
Definition AMReX_AmrLevel.H:322
int postStepRegrid() const noexcept
Returns whether or not we want a post-timestep regrid.
Definition AMReX_AmrLevel.H:326
virtual void init()=0
int numGrids() const noexcept
Number of grids at this level.
Definition AMReX_AmrLevel.H:245
Amr * parent
Definition AMReX_AmrLevel.H:482
MultiFab & get_new_data(int state_indx) noexcept
State data at new time.
Definition AMReX_AmrLevel.H:318
MultiFab & get_old_data(int state_indx) noexcept
State data at old time.
Definition AMReX_AmrLevel.H:314
void resetFillPatcher()
Definition AMReX_AmrLevel.cpp:2128
virtual ~AmrLevel()
The destructor.
Definition AMReX_AmrLevel.cpp:572
void FillPatcherFill(amrex::MultiFab &mf, int dcomp, int ncomp, int nghost, amrex::Real time, int state_index, int scomp)
Fill with FillPatcher on level > 0 and AmrLevel::FillPatch on level 0.
Definition AMReX_AmrLevel.cpp:2136
virtual void post_restart()
Operations to be done after restart.
Definition AMReX_AmrLevel.H:174
const BoxArray & getAreaNotToTag() noexcept
Get the area not to tag.
Definition AMReX_AmrLevel.cpp:2076
const Vector< DistributionMapping > & DistributionMap() const noexcept
Definition AMReX_AmrMesh.H:107
int finestLevel() const noexcept
Return the finest level.
Definition AMReX_AmrMesh.H:95
const Vector< Geometry > & Geom() const noexcept
Definition AMReX_AmrMesh.H:106
const Vector< BoxArray > & boxArray() const noexcept
Definition AMReX_AmrMesh.H:108
Manage hierarchy of levels for time-dependent AMR computations.
Definition AMReX_Amr.H:35
AmrLevel & getLevel(int lev) noexcept
AmrLevel lev.
Definition AMReX_Amr.H:189
int levelSteps(int lev) const noexcept
Number of time steps at specified level.
Definition AMReX_Amr.H:103
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:551
Long size() const noexcept
Return the number of boxes in the BoxArray.
Definition AMReX_BoxArray.H:598
A list of DeriveRecs.
Definition AMReX_Derive.H:364
Definition AMReX_StateDescriptor.H:437
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:41
Definition AMReX_EBFabFactory.H:24
A Fortran Array of REALs.
Definition AMReX_FArrayBox.H:229
int nGrow(int direction=0) const noexcept
Return the grow factor that defines the region of definition.
Definition AMReX_FabArrayBase.H:78
int nComp() const noexcept
Return number of variables (aka components) associated with each point.
Definition AMReX_FabArrayBase.H:83
Definition AMReX_FabFactory.H:50
Definition AMReX_AmrLevel.H:566
void Initialize(int boxGrow, Real time, int idx, int scomp, int ncomp, InterpBase *mapper)
Definition AMReX_AmrLevel.cpp:739
std::map< int, Vector< Vector< Box > > > m_cbox
Definition AMReX_AmrLevel.H:610
std::map< int, Vector< Vector< Vector< FillBoxId > > > > m_fbid
Definition AMReX_AmrLevel.H:611
bool m_FixUpCorners
Definition AMReX_AmrLevel.H:607
std::map< int, Vector< Vector< Box > > > m_fbox
Definition AMReX_AmrLevel.H:609
int m_scomp
Definition AMReX_AmrLevel.H:605
AmrLevel * m_amrlevel
Definition AMReX_AmrLevel.H:596
int m_growsize
Definition AMReX_AmrLevel.H:603
void fill(FArrayBox &fab, int dcomp, int idx)
Definition AMReX_AmrLevel.cpp:1266
int m_index
Definition AMReX_AmrLevel.H:604
MultiFabCopyDescriptor m_mfcd
Definition AMReX_AmrLevel.H:598
int m_ncomp
Definition AMReX_AmrLevel.H:606
Real m_time
Definition AMReX_AmrLevel.H:602
Vector< Vector< MultiFabId > > m_mfid
Definition AMReX_AmrLevel.H:599
std::map< int, Box > m_ba
Definition AMReX_AmrLevel.H:601
MultiFab * m_leveldata
Definition AMReX_AmrLevel.H:597
Interpolater * m_map
Definition AMReX_AmrLevel.H:600
Definition AMReX_AmrLevel.H:522
std::vector< std::pair< int, int > > m_range
Definition AMReX_AmrLevel.H:560
void FillFromLevel0(Real time, int idx, int scomp, int dcomp, int ncomp)
Definition AMReX_AmrLevel.cpp:1100
FArrayBox & operator()() noexcept
Definition AMReX_AmrLevel.H:544
MultiFab * m_leveldata
Definition AMReX_AmrLevel.H:559
int m_ncomp
Definition AMReX_AmrLevel.H:562
MultiFab & get_mf() noexcept
Definition AMReX_AmrLevel.H:548
Box UngrownBox() const noexcept
Definition AMReX_AmrLevel.H:546
void FillFromTwoLevels(Real time, int idx, int scomp, int dcomp, int ncomp)
Definition AMReX_AmrLevel.cpp:1119
AmrLevel * m_amrlevel
Definition AMReX_AmrLevel.H:558
MultiFab m_fabs
Definition AMReX_AmrLevel.H:561
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:73
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:210
Definition AMReX_InterpBase.H:26
Virtual base class for interpolaters.
Definition AMReX_Interpolater.H:22
Definition AMReX_MFIter.H:57
Box validbox() const noexcept
Return the valid Box in which the current tile resides.
Definition AMReX_MFIter.H:132
int index() const noexcept
The index into the underlying BoxArray of the current FAB.
Definition AMReX_MFIter.H:144
void Initialize()
Definition AMReX_MFIter.cpp:274
Definition AMReX_MFCopyDescriptor.H:46
A collection (stored as an array) of FArrayBox objects.
Definition AMReX_MultiFab.H:38
Current and previous level-time data.
Definition AMReX_StateData.H:33
Attributes of StateData.
Definition AMReX_StateDescriptor.H:33
InterpBase * interp() const noexcept
Returns the interpolater.
Definition AMReX_StateDescriptor.cpp:251
int nComp() const noexcept
Returns number of components.
Definition AMReX_StateDescriptor.cpp:239
int nExtra() const noexcept
Returns the grow factor.
Definition AMReX_StateDescriptor.cpp:245
An array of TagBoxes.
Definition AMReX_TagBox.H:150
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
How
How we write out FabArray<FArrayBox>s. These are deprecated, we always use NFiles....
Definition AMReX_VisMF.H:41
@ NFiles
Definition AMReX_VisMF.H:41
void RK2(MF &Uold, MF &Unew, Real time, Real dt, F const &frhs, FB const &fillbndry, P const &post_stage=PostStageNoOp())
Time stepping with RK2.
Definition AMReX_RungeKutta.H:158
void RK4(MF &Uold, MF &Unew, Real time, Real dt, F const &frhs, FB const &fillbndry, R const &store_crse_data, P const &post_stage=PostStageNoOp())
Time stepping with RK4.
Definition AMReX_RungeKutta.H:246
void RK3(MF &Uold, MF &Unew, Real time, Real dt, F const &frhs, FB const &fillbndry, R const &store_crse_data, P const &post_stage=PostStageNoOp())
Time stepping with RK3.
Definition AMReX_RungeKutta.H:196
Definition AMReX_Amr.cpp:49
EBSupport
Definition AMReX_EBSupport.H:7
IntVectND< 3 > IntVect
Definition AMReX_BaseFwd.H:30
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:230
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_RungeKutta.H:51