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  * All checks use AMREX_ALWAYS_ASSERT_WITH_MESSAGE for actionable diagnostics.
28  */
29 
30 /**
31  * @brief The AMR level the fire grid refines: erf.fire.anchor_level, or the
32  * finest level when it is -1 (the default).
33  *
34  * Aborts, naming the input, when the level is above the finest level.
35  *
36  * @param[in] anchor_level erf.fire.anchor_level (-1 = the finest level)
37  * @param[in] finest_level Finest level of the run at start-up
38  */
39 int fire_anchor_level(int anchor_level, int finest_level);
40 
41 /**
42  * @brief Start-up check for an engine that reads the rain of every column
43  * (FireEngine::wants_surface_precip): the microphysics scheme must
44  * provide surface precipitation accumulators.
45  *
46  * Aborts, naming the engine and erf.moisture_model, when the sources are
47  * empty (no moisture model, Kessler_NoRain, saturation adjustment only, ...).
48  * Called after the microphysics of the fire grid's level is initialised.
49  *
50  * @param[in] engine_name The engine's name (FireEngine::name)
51  * @param[in] sources Microphysics::Get_Surface_Precip_Accumulation_Ptrs(lev)
52  */
53 void verify_fire_precip_source(const std::string& engine_name,
54  const SurfacePrecipAccumulationSources& sources);
55 
56 /**
57  * @brief Verify the ERF configuration the fire coupling needs
58  *
59  * Called once at startup from FireCoupler::initialize() after the SurfaceLayer
60  * is ready, before the engine's own checks. Aborts with clear diagnostic
61  * messages if any requirement is not met.
62  *
63  * @param[in] erf ERF instance (for grids, dmap, Geom access)
64  * @param[in] lev AMR level the fire grid refines (fire_anchor_level)
65  * @param[in] surface_layer Pointer to initialized SurfaceLayer
66  * @param[in] grid_ratio erf.fire.grid_ratio, fire cells per atmospheric cell in x and y
67  *
68  * Checks performed (in order):
69  * 1. SurfaceLayer pointer is not null (zlo.type = surface_layer), unless
70  * needs_surface_layer is false (FireEngine::needs_surface_layer)
71  * 2. 0 <= lev <= finest level
72  * 3. On a level above 0: static refinement (erf.regrid_int <= 0)
73  * 7. Every box of the level spans its full height (no z-decomposition)
74  * 7b. The level's boxes cover one rectangle in x and y
75  * 8. grid_ratio >= 1
76  * 9. All boxes divisible by grid_ratio in x and y
77  * 10. Distribution map size matches grid size
78  * 11. Domain z, x and y indices start at 0
79  */
80 void verify_fire_prerequisites(const ERF& erf,
81  int lev,
82  const SurfaceLayer* surface_layer,
83  int grid_ratio,
84  bool needs_surface_layer = true);
85 
86 #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:52
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:78
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:64
Definition: ERF_SurfaceLayer.H:60
Definition: ERF_InterpolationUtils.H:15
Definition: ERF_SurfacePrecipitation.H:34