ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_FirePrerequisites.H
Go to the documentation of this file.
1 #ifndef ERF_FIRE_PREREQUISITES_H
2 #define ERF_FIRE_PREREQUISITES_H
3 
4 #include <AMReX_MultiFab.H>
5 #include <string>
6 #include <AMReX_Geometry.H>
8 
9 // Forward declaration
10 class SurfaceLayer;
11 class ERF;
12 
13 /**
14  * @file ERF_FirePrerequisites.H
15  * @brief Start-up checks of the atmosphere side of the fire coupling
16  *
17  * Verifies that ERF is configured so that a fire grid can be coupled to it,
18  * whichever fire engine runs on that grid:
19  * - MOST surface layer is active with proper boundary conditions
20  * - The level the fire grid refines exists and keeps its boxes
21  * - No z-direction MPI decomposition (all z-levels on same rank)
22  * - The level's boxes cover one rectangle
23  * - Grid divisibility by refinement factor
24  *
25  * Each engine checks its own inputs after these (FireEngine::verify_prerequisites).
26  *
27  * The checks on the level the fire grid refines are those of every surface
28  * coupling (verify_surface_grid_level, ERF_SurfacePrerequisites.H); each
29  * check aborts with a message that names the input to change.
30  */
31 
32 /**
33  * @brief The AMR level the fire grid refines: erf.fire.anchor_level, or the
34  * finest level when it is -1 (the default).
35  *
36  * Aborts, naming the input, when the level is above the finest level.
37  *
38  * @param[in] anchor_level erf.fire.anchor_level (-1 = the finest level)
39  * @param[in] finest_level Finest level of the run at start-up
40  */
41 int fire_anchor_level(int anchor_level, int finest_level);
42 
43 /**
44  * @brief Start-up check for an engine that reads the rain of every column
45  * (FireEngine::wants_surface_precip): the microphysics scheme must
46  * provide surface precipitation accumulators.
47  *
48  * Aborts, naming the engine and erf.moisture_model, when the sources are
49  * empty (no moisture model, Kessler_NoRain, saturation adjustment only, ...).
50  * Called after the microphysics of the fire grid's level is initialized.
51  *
52  * @param[in] engine_name The engine's name (FireEngine::name)
53  * @param[in] sources Microphysics::Get_Surface_Precip_Accumulation_Ptrs(lev)
54  */
55 void verify_fire_precip_source(const std::string& engine_name,
56  const SurfacePrecipAccumulationSources& sources);
57 
58 /**
59  * @brief Verify the ERF configuration the fire coupling needs
60  *
61  * Called once at startup from FireCoupler::initialize() after the SurfaceLayer
62  * is ready, before the engine's own checks. Aborts with clear diagnostic
63  * messages if any requirement is not met.
64  *
65  * @param[in] erf ERF instance (for grids, dmap, Geom access)
66  * @param[in] lev AMR level the fire grid refines (fire_anchor_level)
67  * @param[in] surface_layer Pointer to initialized SurfaceLayer
68  * @param[in] grid_ratio erf.fire.grid_ratio, fire cells per atmospheric cell in x and y
69  *
70  * Checks performed (in order):
71  * 1. SurfaceLayer pointer is not null (zlo.type = surface_layer), unless
72  * needs_surface_layer is false (FireEngine::needs_surface_layer)
73  * 2-7b, 11. verify_surface_grid_level: 0 <= lev <= finest level; on a level
74  * above 0 static refinement (erf.regrid_int <= 0); every box of the level
75  * spans its full height (no z-decomposition); the level's boxes cover one
76  * rectangle in x and y; the domain starts at index 0
77  * 8. grid_ratio >= 1
78  * 9. All boxes divisible by grid_ratio in x and y
79  * 10. Distribution map size matches grid size
80  */
81 void verify_fire_prerequisites(const ERF& erf,
82  int lev,
83  const SurfaceLayer* surface_layer,
84  int grid_ratio,
85  bool needs_surface_layer = true);
86 
87 #endif
int fire_anchor_level(int anchor_level, int finest_level)
The AMR level the fire grid refines: erf.fire.anchor_level, or the finest level when it is -1 (the de...
Definition: ERF_FirePrerequisites.cpp:53
void verify_fire_prerequisites(const ERF &erf, int lev, const SurfaceLayer *surface_layer, int grid_ratio, bool needs_surface_layer=true)
Verify the ERF configuration the fire coupling needs.
Definition: ERF_FirePrerequisites.cpp:64
void verify_fire_precip_source(const std::string &engine_name, const SurfacePrecipAccumulationSources &sources)
Start-up check for an engine that reads the rain of every column (FireEngine::wants_surface_precip): ...
Definition: ERF_FirePrerequisites.cpp:58
Definition: ERF_SurfaceLayer.H:64
Definition: ERF_InterpolationUtils.H:15
Definition: ERF_SurfacePrecipitation.H:40