ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_FireGrid.H
Go to the documentation of this file.
1 #ifndef ERF_FIRE_GRID_H
2 #define ERF_FIRE_GRID_H
3 
4 #include <ERF_SurfaceGrid.H>
5 
6 #include <AMReX_BoxArray.H>
7 #include <AMReX_DistributionMapping.H>
8 #include <AMReX_Geometry.H>
9 #include <AMReX_MultiFab.H>
10 
11 /**
12  * @file ERF_FireGrid.H
13  * @brief Fire grid data structure and construction
14  *
15  * Defines a 2D grid for fire simulation on the horizontal plane, refined by
16  * factor C relative to one atmospheric AMR level (erf.fire.anchor_level, the
17  * finest level by default). The fire grid covers that level's boxes, keeps their
18  * x-y decomposition and their MPI owners, and its index space starts at zero at
19  * the lower corner of the region they cover. It is the surface grid of the
20  * surface-coupling layer (ERF_SurfaceGrid.H) under the fire coupling's name;
21  * the functions below call that layer with the fire coupling's names.
22  */
23 
24 /// The fire coupling's names: erf.fire.<key>, "[FIRE]", "fire grid"
26 {
27  static const SurfaceCouplingNames names{"fire", "Fire", "FIRE"};
28  return names;
29 }
30 
31 /**
32  * @struct FireGrid
33  * @brief 2D horizontal fire computational grid
34  *
35  * Represents a 2D slab (kmax=1) with dimensions C*nx × C*ny × 1, where C is the
36  * refinement factor (erf.fire.grid_ratio) and (nx, ny) is the size of the
37  * region the atmospheric level's boxes cover: the whole domain on level 0, the
38  * refined region on a finer level. The members (ba, dm, geom, C, atm_lo, lev)
39  * are those of SurfaceGrid.
40  */
42 {
43 };
44 
45 /**
46  * @brief Construct a refined 2D fire grid over one atmospheric level's boxes
47  *
48  * @param[in] ba_atm BoxArray of the atmospheric level
49  * @param[in] dm_atm DistributionMapping of the atmospheric level
50  * @param[in] geom_atm Geometry of the atmospheric level
51  * @param[in] C Refinement factor (erf.fire.grid_ratio)
52  *
53  * @return FireGrid over the region the boxes cover; its lev is left at 0 for
54  * the caller to set. See create_surface_grid() for the algorithm.
55  */
56 FireGrid create_fire_grid(const amrex::BoxArray& ba_atm,
57  const amrex::DistributionMapping& dm_atm,
58  const amrex::Geometry& geom_atm,
59  int C);
60 
61 /**
62  * Exchange the ghost cells of a fire-grid MultiFab and fill the ones outside a
63  * non-periodic face of the domain by copying the nearest interior value
64  * (surface_fill_boundary).
65  *
66  * FillBoundary alone leaves those cells untouched, so with an inflow-outflow
67  * atmosphere (the fire grid inherits its periodicity) the gradient stencil of
68  * the level set read whatever the allocator had left there. Whether that was
69  * benign depended on the box layout: one box per rank happened to run, two
70  * boxes on a rank blew the level set up at the inflow face within three steps.
71  * Every fire-grid exchange goes through here.
72  */
73 inline void fire_fill_boundary (amrex::MultiFab& mf, const amrex::Geometry& geom)
74 {
76 }
77 
78 /**
79  * Copy a k = 0 atmospheric field onto the fire grid: every fire cell takes the
80  * value of the atmospheric column it lies in, (i / C + atm_lo[0], j / C + atm_lo[1])
81  * (surface_fill_from_atm_k0). Box n of the fire grid refines box n of the
82  * atmospheric level and has the same owner, so one MFIter serves both MultiFabs.
83  */
84 inline void fill_fire_from_atm_k0 (amrex::MultiFab& fire_mf, const amrex::MultiFab& atm_k0,
85  const FireGrid& fg)
86 {
87  surface_fill_from_atm_k0(fire_mf, atm_k0, fg, fire_coupling_names());
88 }
89 
90 #endif
void fire_fill_boundary(amrex::MultiFab &mf, const amrex::Geometry &geom)
Definition: ERF_FireGrid.H:73
FireGrid create_fire_grid(const amrex::BoxArray &ba_atm, const amrex::DistributionMapping &dm_atm, const amrex::Geometry &geom_atm, int C)
Construct a refined 2D fire grid over one atmospheric level's boxes.
void fill_fire_from_atm_k0(amrex::MultiFab &fire_mf, const amrex::MultiFab &atm_k0, const FireGrid &fg)
Definition: ERF_FireGrid.H:84
const SurfaceCouplingNames & fire_coupling_names()
The fire coupling's names: erf.fire.<key>, "[FIRE]", "fire grid".
Definition: ERF_FireGrid.H:25
The 2D surface grid of the fire and flood couplings, and the maps between it and the atmospheric colu...
void surface_fill_boundary(amrex::MultiFab &mf, const amrex::Geometry &geom, const SurfaceCouplingNames &names)
Definition: ERF_SurfaceGrid.H:130
void surface_fill_from_atm_k0(amrex::MultiFab &surf_mf, const amrex::MultiFab &atm_k0, const SurfaceGrid &sg, const SurfaceCouplingNames &names, int scomp=0, int acomp=0)
Definition: ERF_SurfaceGrid.H:170
@ fg
Definition: ERF_AdvanceMorrison.cpp:111
2D horizontal fire computational grid
Definition: ERF_FireGrid.H:42
Definition: ERF_SurfaceCouplingNames.H:18
2D horizontal surface grid
Definition: ERF_SurfaceGrid.H:34