ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_NOAHMP.H
Go to the documentation of this file.
1 #ifndef NOAHMP_H
2 #define NOAHMP_H
3 
4 #include <string>
5 #include <vector>
6 #include <memory>
7 #include <limits>
8 #include <functional>
9 
10 #include <AMReX_ParmParse.H>
11 #include <AMReX_Interpolater.H>
12 #include <AMReX_FillPatchUtil.H>
13 #include <AMReX_FArrayBox.H>
14 #include <AMReX_Geometry.H>
15 #include <AMReX_MultiFabUtil.H>
16 #include <AMReX_Vector.H>
17 #include <AMReX_MFIter.H>
18 #include <AMReX_VisMF.H>
19 #include <AMReX_Utility.H>
20 
21 #include <ERF_NullSurf.H>
22 #include <ERF_NumericalConstants.H>
23 #include <ERF_IndexDefines.H>
24 #include <ERF_DataStruct.H>
26 
27 #include <NoahmpIO.H>
28 #include <ERF_NOAHMP_Fields.H>
29 
30 // Small POD helpers used by the Advance_With_State
31 namespace erf_noahmp {
32  // Typed precip accumulator views collected once per Advance: per slot, the
33  // borrowed native accumulator, its native->kg/m^2 factor, and whether it is filled.
34  struct PrecipSlots {
35  const amrex::MultiFab* accum [NoahmpPrecipSlot::NumSlots] = {};
38  bool have_any = false;
39  };
40 
41  // Cells the precip guard clamped this call (per rank); reported after the box loop.
42  struct ClampedPrecipCell { int i; int j; amrex::Real raw_mm; };
43 
44  // Cells where frozen components violated MP_SNOW+MP_GRAUP <= MP_RAINNC and were
45  // rescaled (per rank); reported after the loop.
47 
48  // Per-surface-box handles co-indexed by idb: the NoahmpIO block plus its
49  // pinned input/output staging buffers.
51  NoahmpIO_type* io; // &noahmpio_vect[idb]
52  amrex::Array4<amrex::Real> input; // noahmp_input_tmp[idb]->array()
53  amrex::Array4<amrex::Real> output; // noahmp_output_tmp[idb]->array()
54  };
55 }
56 
57 class NOAHMP : public NullSurf {
58 
59  using FabPtr = std::shared_ptr<amrex::MultiFab>;
60 
61 public:
62  // Bring the base-class Init overloads into scope so the single override below
63  // does not hide them (-Woverloaded-virtual), matching SLM.
64  using NullSurf::Init;
65 
66  // Constructor
67  NOAHMP () {}
68 
69  // Destructor
70  virtual ~NOAHMP () = default;
71 
72  // Set thermo and grid properties
73  void
74  Define (SolverChoice& sc) override
75  {
76  // Whether the configured radiation model writes Noah-MP's radiation inputs
77  // (SWDOWN, GLW, COSZEN); see the first-land-step check in Advance_With_State.
79  m_radiation_model_name = amrex::getEnumNameString(sc.rad_type);
80  // A run initialized from WRF or metgrid files names a finer level's file with
81  // erf.nc_init_file_<lev>; an idealized one has none (see Init).
82  m_idealized_init = (sc.init_type != InitType::WRFInput &&
83  sc.init_type != InitType::Metgrid);
84  }
85 
86  // Whether this level runs the Noah-MP driver on a land setup file of its own (level 0
87  // always does), as opposed to taking its land state from level 0 (interp_from_lev0).
88  // Set in Init.
89  [[nodiscard]] bool
90  Runs_Own_Land_Driver () const override { return m_has_nc_file; }
91 
92  // Initialize data structures
93  void
94  Init (const int& lev,
95  const amrex::MultiFab& cons_in,
96  const amrex::Geometry& geom,
97  const amrex::Geometry& geom0,
98  amrex::Vector<amrex::BCRec>& domain_bcs_type,
99  amrex::IntVect& refRatio,
100  const amrex::Real& dt,
101  amrex::Vector<amrex::Vector<std::string>>& nc_init_file) override;
102 
103  // Wrapper to do all the updating
104  void
105  Advance_With_State (const int& lev,
106  amrex::MultiFab& cons_in,
107  amrex::MultiFab& xvel_in,
108  amrex::MultiFab& yvel_in,
109  amrex::MultiFab* hfx3_out,
110  amrex::MultiFab* qfx3_out,
111  const SurfacePrecipAccumulationSources& precip_sources,
112  const amrex::Real& elapsed_time,
113  const amrex::Real& dt,
114  const int& nstep,
115  const bool updated_lev0,
116  amrex::MultiFab* z_nd) override;
117 
118  void
119  Plot_Landfile (const int& nstep) override;
120 
121  // Get state vars from lsm class
122  amrex::MultiFab*
123  Lsm_Data_Ptr (const int& varIdx) override
124  {
125  int lsmIdx = LsmDataMap[varIdx];
126  AMREX_ALWAYS_ASSERT(lsmIdx < NOAHMP::m_lsm_data_size && lsmIdx>=0);
127  return lsm_fab_data[lsmIdx].get();
128  }
129 
130  // Get flux vars from lsm class
131  amrex::MultiFab*
132  Lsm_Flux_Ptr (const int& varIdx) override
133  {
134  int lsmIdx = LsmFluxMap[varIdx];
135  AMREX_ALWAYS_ASSERT(lsmIdx < NOAHMP::m_lsm_flux_size && lsmIdx>=0);
136  return lsm_fab_flux[lsmIdx].get();
137  }
138 
139  // Get lsm geometry
140  amrex::Geometry
141  Lsm_Geom ( ) override { return m_lsm_geom; }
142 
143  // Get number of vars. Parent queries this before Init (to size lsm_data), so
144  // resolve the soil-layer count here on first use rather than relying on Init.
145  int
147 
148  // Get number of fluxes lsm class contains
149  int
150  Lsm_Flux_Size () override { return NOAHMP::m_lsm_flux_size; }
151 
152  // Get variable names
153  std::string
154  Lsm_DataName (const int& varIdx) override
155  {
156  int lsmIdx = LsmDataMap[varIdx];
157  AMREX_ALWAYS_ASSERT(lsmIdx < NOAHMP::m_lsm_data_size && lsmIdx>=0);
158  return LsmDataName[lsmIdx];
159  }
160 
161  // Get variable index from name
162  int
163  Lsm_DataIndex (const std::string& varname) override
164  {
165  int varIdx = -1;
166  std::string lc_varname = amrex::toLower(varname);
167  for (int idx(0); idx<m_lsm_data_size; ++idx) {
168  if (lc_varname == amrex::toLower(LsmDataName[idx])) {
169  varIdx = idx;
170  }
171  }
172  return varIdx;
173  }
174 
175  // Get flux variable names
176  std::string
177  Lsm_FluxName (const int& varIdx) override
178  {
179  int lsmIdx = LsmFluxMap[varIdx];
180  AMREX_ALWAYS_ASSERT(lsmIdx < NOAHMP::m_lsm_flux_size && lsmIdx>=0);
181  return LsmFluxName[lsmIdx];
182  }
183 
184  // Get flux variable index from name
185  int
186  Lsm_FluxIndex (const std::string& varname) override
187  {
188  int varIdx = -1;
189  std::string lc_varname = amrex::toLower(varname);
190  for (int idx(0); idx<LsmFlux_NOAHMP::NumVars; ++idx) {
191  if (lc_varname == amrex::toLower(LsmFluxName[idx])) {
192  varIdx = idx;
193  }
194  }
195  return varIdx; // -1 if this model does not carry that flux; callers probe with this
196  }
197 
198  void
199  Lsm_Set_Lev0_Data_Ptr (const int& varIdx,
200  amrex::MultiFab* lev0_data_ptr) override
201  {
202  AMREX_ALWAYS_ASSERT(varIdx >= 0 && varIdx < m_lsm_data_size);
203  lsm_lev0_data[varIdx] = lev0_data_ptr;
204  }
205 
206  void
207  Lsm_Set_Lev0_Flux_Ptr (const int& varIdx,
208  amrex::MultiFab* lev0_flux_ptr) override
209  {
210  AMREX_ALWAYS_ASSERT(varIdx >= 0 && varIdx < int(LsmFlux_NOAHMP::NumVars));
211  lsm_lev0_flux[varIdx] = lev0_flux_ptr;
212  }
213 
214  bool
215  Get_Update_Status () override { return m_updated; }
216 
217  // Checkpoint/restore the NoahMP substep counter via m_itimestep (valid on every
218  // rank, unlike noahmpio_vect[0] which is absent on land-free ranks).
219  int
220  Get_LSM_Step () const override
221  {
222  return m_itimestep;
223  }
224 
225  void
226  Set_LSM_Step (int step) override
227  {
228  m_itimestep = step;
229  for (auto& noahmpio : noahmpio_vect) {
230  noahmpio.itimestep = step;
231  }
232  }
233 
234  // Write/read the full NoahMP prognostic state to/from a NetCDF restart dir so a
235  // restart reproduces a cold-start trajectory bitwise (#3255). ERF_NOAHMP_IO.cpp.
236  void
237  Write_Lsm_Restart (const std::string& dir) const override;
238 
239  void
240  Read_Lsm_Restart (const std::string& dir) override;
241 
242  // --- Advance_With_State pipeline helpers (ERF_NOAHMP_Advance.cpp) ---------
243 
244  // Fine-level (lev>0) coupling data/flux fill by interpolation from level 0,
245  // taken when there is no per-level NetCDF land file. Sets m_updated.
246  void
247  interp_from_lev0 (const int& lev,
248  amrex::MultiFab& cons_in,
249  const int& nstep);
250 
251  // Subcycling gate: true if the model fires this ERF step (sets m_updated). The
252  // lockstep counter is retired after the block loop, not here. Same on every rank.
253  bool
254  time_to_fire (const amrex::Real& elapsed_time);
255 
256  // Per surface box: stage ERF forcing into the pinned input buffer and copy into
257  // the NoahmpIO arrays (steps 1-3). blk bundles the block + its staging buffers.
258  void
259  stage_forcing (const amrex::MFIter& mfi,
260  const erf_noahmp::NoahmpBlockViews& blk,
261  const amrex::Box& bx,
262  const int& klo,
263  const int& lev,
264  const bool is_moist,
265  amrex::MultiFab& cons_in,
266  amrex::MultiFab& xvel_in,
267  amrex::MultiFab& yvel_in,
268  amrex::MultiFab* z_nd,
270  amrex::Vector<erf_noahmp::ClampedPrecipCell>& clamped_cells,
271  amrex::Vector<erf_noahmp::InvariantPrecipCell>& invariant_cells);
272 
273  // Per surface box: read NoahmpIO results into the pinned output buffer and scatter
274  // them into the ERF coupling fields (steps 5-6), applying the -9999 fill guard.
275  void
276  read_results (const amrex::MFIter& mfi,
277  const erf_noahmp::NoahmpBlockViews& blk,
278  const amrex::Box& bx,
279  const amrex::Box& gbx,
280  amrex::MultiFab& cons_in);
281 
282  // --- Precip bookkeeping (ERF_NOAHMP_Precip.cpp) --------------------------
283 
284  // Collect the typed precip accumulator views for this Advance.
287 
288  // Lazily allocate + seed the per-level "previous cumulative accum" snapshots
289  // (cold start seeds from current; restart consumes m_precip_accum_restored).
290  void
291  prepare_precip_snapshots (const int& lev,
293 
294  // Advance the snapshots to the current accumulation after the land call.
295  void
296  advance_precip_snapshots (const int& lev,
298 
299  // Report (per rank, never silent) any cells clamped or rescaled by the guard.
300  void
301  report_precip_diagnostics (const int& lev,
302  const amrex::Vector<erf_noahmp::ClampedPrecipCell>& clamped_cells,
303  const amrex::Vector<erf_noahmp::InvariantPrecipCell>& invariant_cells);
304 
305  // 3 soil variable groups: smois, sh2o, tslb. All 3*nsoil buffer-size occurrences use this.
306  static constexpr int m_num_soil_groups = 3;
307 
308  // Index of soil field (g in {0:smois,1:sh2o,2:tslb}, k in [0,nsoil)) within
309  // lsm_fab_data. Output-buffer index is NoahmpOutputComp::NumComps + g*m_nsoil + k.
310  int soil_data_idx (int g, int k) const {
311  return LsmData_NOAHMP::NumVars + g*m_nsoil + k;
312  }
313 
314  // Resolve the soil-layer count and total LSM data size exactly once, before Init
315  // (the parent queries Lsm_Data_Size() first). Init later asserts vs namelist NSOIL.
316  bool m_nsoil_resolved = false;
318  if (m_nsoil_resolved) { return; }
319  amrex::ParmParse pp_nsoil("erf");
320  pp_nsoil.queryAdd("lsm_nsoil", m_nsoil);
321  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_nsoil >= 1, "erf.lsm_nsoil must be >= 1");
323  m_nsoil_resolved = true;
324  }
325 
326  // VisMF file prefix for the level-l, slot-s previous-accumulation snapshot.
327  static std::string
328  m_precip_snapshot_name (const std::string& dir, int l, int s) {
329  return dir + "/precip_accum_prev_Level_" + std::to_string(l)
330  + "_slot_" + std::to_string(s);
331  }
332 
333 private:
334 
335  // Runs fn(noahmpio) per local block on a land-owning MPI subcommunicator, so a
336  // rank with zero local boxes doesn't join the collective nf90_create in
337  // WriteLand/WriteRestart/ReadRestart. ERF_NOAHMP_IO.cpp.
338  void with_land_comm (const std::function<void(NoahmpIO_type&)>& fn) const;
339 
340  // lsm data var count = fixed 2D fields + runtime soil profile (3 x m_nsoil).
341  // Finalized once m_nsoil is known; the fixed-field count is a safe lower bound.
343 
344  // number of lsm flux variables
346 
347  // LsmData map (state indices -> LsmVar enum)
348  amrex::Vector<int> LsmDataMap;
349 
350  // LsmFlux map (state indices -> LsmFlux enum)
351  amrex::Vector<int> LsmFluxMap;
352 
353  // Lsm data names
354  amrex::Vector<std::string> LsmDataName;
355 
356  // Lsm flux names
357  amrex::Vector<std::string> LsmFluxName;
358 
359  // geometry for atmosphere
360  amrex::Geometry m_geom;
361 
362  // geometry for atmosphere at lev==0
363  amrex::Geometry m_geom0;
364 
365  // geometry for lsm
366  amrex::Geometry m_lsm_geom;
367 
368  // refinement ratio between lev==0 and this level (the product across every
369  // interface beneath it), since interp_from_lev0 interpolates from m_geom0
370  amrex::IntVect m_refRatio;
371 
372  // domain bc types
373  amrex::Vector<amrex::BCRec> m_domain_bcs_type;
374 
375 
376  // Authoritative NoahMP substep counter, kept on the class so the firing decision
377  // is identical on every rank (including land-free ranks with empty noahmpio_vect).
378  int m_itimestep = 0;
379 
380  // NoahMP timestep (DTBL), broadcast to all ranks in Init so the firing
381  // decision is well-defined on land-free ranks too.
382  amrex::Real m_dtbl = std::numeric_limits<amrex::Real>::max();
383 
384  // Default -1; not written at runtime (single-slab LSM has no z extent to track).
385  int khi_lsm = -1;
386 
387  // Number of grid points in z
388  int m_nz_lsm = 1;
389 
390  // Size of grid spacing in z
392 
393  // LSM data variables, sized at runtime to NumVars + 3*m_nsoil (fixed 2D fields +
394  // the SMOIS/SH2O/TSLB soil profile). Vector, since m_nsoil is only known in Init.
395  amrex::Vector<FabPtr> lsm_fab_data;
396 
397  // LSM flux variables
398  amrex::Array<FabPtr, LsmFlux_NOAHMP::NumVars> lsm_fab_flux;
399 
400  // LSM data variables at level 0 (runtime-sized, see lsm_fab_data)
401  amrex::Vector<amrex::MultiFab*> lsm_lev0_data;
402 
403  // LSM flux variables at level 0
404  amrex::Array<amrex::MultiFab*, LsmFlux_NOAHMP::NumVars> lsm_lev0_flux {};
405 
406  // Number of Noah-MP soil layers, set from erf.lsm_nsoil (identical on every rank,
407  // so no broadcast needed for the collective writes). Asserted vs namelist NSOIL.
408  int m_nsoil = 4;
409 
410  // Vector to store NoahmpIO objects at a level
411  NoahmpIO_vector noahmpio_vect;
412 
413  // Pinned memory buffers for host/device coupling to Noah-MP
414  amrex::Vector<std::unique_ptr<amrex::FArrayBox>> noahmp_input_tmp;
415  amrex::Vector<std::unique_ptr<amrex::FArrayBox>> noahmp_output_tmp;
416 
417  // Previous cumulative precip accumulator (native units) per slot per level;
418  // interval precip is (current - this) * native_to_kg_m2. Only provided slots exist.
419  amrex::Vector<amrex::Array<std::unique_ptr<amrex::MultiFab>, NoahmpPrecipSlot::NumSlots>>
421 
422  // Checkpointed previous-accumulation snapshots staged by Read_Lsm_Restart, consumed
423  // (reset) by the first Advance. Empty on a cold start or legacy checkpoint.
424  amrex::Array<std::unique_ptr<amrex::MultiFab>, NoahmpPrecipSlot::NumSlots> m_precip_accum_restored;
425 
426  // This instance's AMR level (set in Init); keys the per-level snapshot filenames.
427  int m_lev = 0;
428 
429  // Update status
430  bool m_updated = false;
431 
432  // Does this level run the driver on a land setup file of its own? (See Init.)
433  bool m_has_nc_file = false;
434 
435  // Not initialized from WRF or metgrid files (set in Define).
436  bool m_idealized_init = false;
437 
438  // Set once a land step has seen valid radiation inputs (or warned that a model
439  // that never writes them is in use), so the check in Advance_With_State (a global
440  // reduction) stops running. Reset by Init: a rebuilt level (regrid, including the
441  // one a restart can trigger) re-installs the lsm_undefined sentinel, so a verdict
442  // from before the wipe no longer holds.
444 
445  // Set when the missing-radiation-inputs warning for a restarted/rebuilt level has
446  // been printed, so re-checking on later land steps does not repeat it.
448 
449  // The ERF step of the first Advance_With_State call since this level was last
450  // (re)built: 0 only on a run started from scratch, positive after a restart or a
451  // mid-run regrid (Init resets it to -1 when it re-installs the sentinel).
452  // Distinguishes "RRTMGP has certainly computed since the fields were initialized"
453  // (a fresh run computes radiation on step 0, before any land step) from "RRTMGP
454  // may not have recomputed yet" (after a restart or regrid it recomputes only on
455  // its rad_freq_in_steps schedule). Set by Advance_With_State.
457 
458  // True when the configured radiation model writes the radiation inputs (RRTMGP, or
459  // TwoStream), so an input still missing on the first land step is a broken coupling,
460  // not a configuration without radiation. Set in Define, with the model's name for the
461  // messages.
462  bool m_radiation_feeds_lsm = false;
464 };
465 #endif
const int klo
Definition: ERF_InitCustomPert_ABL.H:75
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int idx(int i, int j, int k, int nx, int ny)
Definition: ERF_InitForEnsemble.cpp:396
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_NOAHMP.H:57
std::string Lsm_DataName(const int &varIdx) override
Definition: ERF_NOAHMP.H:154
int khi_lsm
Definition: ERF_NOAHMP.H:385
bool m_nsoil_resolved
Definition: ERF_NOAHMP.H:316
NOAHMP()
Definition: ERF_NOAHMP.H:67
std::string Lsm_FluxName(const int &varIdx) override
Definition: ERF_NOAHMP.H:177
amrex::Vector< amrex::BCRec > m_domain_bcs_type
Definition: ERF_NOAHMP.H:373
void Plot_Landfile(const int &nstep) override
Definition: ERF_NOAHMP_IO.cpp:46
virtual void Init(const int &, const amrex::MultiFab &, const amrex::Geometry &, const amrex::Geometry &, amrex::Vector< amrex::BCRec > &, amrex::IntVect &, const amrex::Real &, amrex::Vector< amrex::Vector< std::string >> &)
Definition: ERF_NullSurf.H:27
static std::string m_precip_snapshot_name(const std::string &dir, int l, int s)
Definition: ERF_NOAHMP.H:328
bool m_idealized_init
Definition: ERF_NOAHMP.H:436
amrex::Array< amrex::MultiFab *, LsmFlux_NOAHMP::NumVars > lsm_lev0_flux
Definition: ERF_NOAHMP.H:404
amrex::Array< FabPtr, LsmFlux_NOAHMP::NumVars > lsm_fab_flux
Definition: ERF_NOAHMP.H:398
bool m_updated
Definition: ERF_NOAHMP.H:430
int Get_LSM_Step() const override
Definition: ERF_NOAHMP.H:220
void Write_Lsm_Restart(const std::string &dir) const override
Definition: ERF_NOAHMP_IO.cpp:54
amrex::Vector< std::string > LsmDataName
Definition: ERF_NOAHMP.H:354
std::shared_ptr< amrex::MultiFab > FabPtr
Definition: ERF_NOAHMP.H:59
amrex::Vector< int > LsmDataMap
Definition: ERF_NOAHMP.H:348
void read_results(const amrex::MFIter &mfi, const erf_noahmp::NoahmpBlockViews &blk, const amrex::Box &bx, const amrex::Box &gbx, amrex::MultiFab &cons_in)
Definition: ERF_NOAHMP_Advance.cpp:243
int Lsm_DataIndex(const std::string &varname) override
Definition: ERF_NOAHMP.H:163
amrex::Vector< std::unique_ptr< amrex::FArrayBox > > noahmp_output_tmp
Definition: ERF_NOAHMP.H:415
int soil_data_idx(int g, int k) const
Definition: ERF_NOAHMP.H:310
amrex::Vector< std::unique_ptr< amrex::FArrayBox > > noahmp_input_tmp
Definition: ERF_NOAHMP.H:414
void stage_forcing(const amrex::MFIter &mfi, const erf_noahmp::NoahmpBlockViews &blk, const amrex::Box &bx, const int &klo, const int &lev, const bool is_moist, amrex::MultiFab &cons_in, amrex::MultiFab &xvel_in, amrex::MultiFab &yvel_in, amrex::MultiFab *z_nd, const erf_noahmp::PrecipSlots &precip, amrex::Vector< erf_noahmp::ClampedPrecipCell > &clamped_cells, amrex::Vector< erf_noahmp::InvariantPrecipCell > &invariant_cells)
Definition: ERF_NOAHMP_Advance.cpp:91
bool m_radiation_feeds_lsm
Definition: ERF_NOAHMP.H:462
int m_nsoil
Definition: ERF_NOAHMP.H:408
int Lsm_Flux_Size() override
Definition: ERF_NOAHMP.H:150
bool Get_Update_Status() override
Definition: ERF_NOAHMP.H:215
int Lsm_Data_Size() override
Definition: ERF_NOAHMP.H:146
amrex::Geometry Lsm_Geom() override
Definition: ERF_NOAHMP.H:141
amrex::IntVect m_refRatio
Definition: ERF_NOAHMP.H:370
void Read_Lsm_Restart(const std::string &dir) override
Definition: ERF_NOAHMP_IO.cpp:73
amrex::Vector< FabPtr > lsm_fab_data
Definition: ERF_NOAHMP.H:395
NoahmpIO_vector noahmpio_vect
Definition: ERF_NOAHMP.H:411
int m_lsm_data_size
Definition: ERF_NOAHMP.H:342
erf_noahmp::PrecipSlots collect_precip_sources(const SurfacePrecipAccumulationSources &precip_sources)
Definition: ERF_NOAHMP_Precip.cpp:20
bool m_checked_radiation_inputs
Definition: ERF_NOAHMP.H:443
void with_land_comm(const std::function< void(NoahmpIO_type &)> &fn) const
Definition: ERF_NOAHMP_IO.cpp:19
void report_precip_diagnostics(const int &lev, const amrex::Vector< erf_noahmp::ClampedPrecipCell > &clamped_cells, const amrex::Vector< erf_noahmp::InvariantPrecipCell > &invariant_cells)
Definition: ERF_NOAHMP_Precip.cpp:80
virtual ~NOAHMP()=default
int m_lev
Definition: ERF_NOAHMP.H:427
int m_first_advance_nstep
Definition: ERF_NOAHMP.H:456
amrex::Geometry m_lsm_geom
Definition: ERF_NOAHMP.H:366
int m_itimestep
Definition: ERF_NOAHMP.H:378
amrex::Geometry m_geom0
Definition: ERF_NOAHMP.H:363
void prepare_precip_snapshots(const int &lev, const erf_noahmp::PrecipSlots &precip)
Definition: ERF_NOAHMP_Precip.cpp:38
bool m_has_nc_file
Definition: ERF_NOAHMP.H:433
void Define(SolverChoice &sc) override
Definition: ERF_NOAHMP.H:74
int m_nz_lsm
Definition: ERF_NOAHMP.H:388
amrex::Vector< amrex::MultiFab * > lsm_lev0_data
Definition: ERF_NOAHMP.H:401
int m_lsm_flux_size
Definition: ERF_NOAHMP.H:345
amrex::Vector< amrex::Array< std::unique_ptr< amrex::MultiFab >, NoahmpPrecipSlot::NumSlots > > m_precip_accum_prev
Definition: ERF_NOAHMP.H:420
int Lsm_FluxIndex(const std::string &varname) override
Definition: ERF_NOAHMP.H:186
amrex::Real m_dtbl
Definition: ERF_NOAHMP.H:382
void interp_from_lev0(const int &lev, amrex::MultiFab &cons_in, const int &nstep)
Definition: ERF_NOAHMP_Advance.cpp:25
void Lsm_Set_Lev0_Flux_Ptr(const int &varIdx, amrex::MultiFab *lev0_flux_ptr) override
Definition: ERF_NOAHMP.H:207
amrex::Vector< int > LsmFluxMap
Definition: ERF_NOAHMP.H:351
void Advance_With_State(const int &lev, amrex::MultiFab &cons_in, amrex::MultiFab &xvel_in, amrex::MultiFab &yvel_in, amrex::MultiFab *hfx3_out, amrex::MultiFab *qfx3_out, const SurfacePrecipAccumulationSources &precip_sources, const amrex::Real &elapsed_time, const amrex::Real &dt, const int &nstep, const bool updated_lev0, amrex::MultiFab *z_nd) override
Definition: ERF_NOAHMP_Advance.cpp:378
std::string m_radiation_model_name
Definition: ERF_NOAHMP.H:463
void Lsm_Set_Lev0_Data_Ptr(const int &varIdx, amrex::MultiFab *lev0_data_ptr) override
Definition: ERF_NOAHMP.H:199
void Set_LSM_Step(int step) override
Definition: ERF_NOAHMP.H:226
amrex::MultiFab * Lsm_Data_Ptr(const int &varIdx) override
Definition: ERF_NOAHMP.H:123
bool m_warned_radiation_inputs
Definition: ERF_NOAHMP.H:447
static constexpr int m_num_soil_groups
Definition: ERF_NOAHMP.H:306
amrex::Array< std::unique_ptr< amrex::MultiFab >, NoahmpPrecipSlot::NumSlots > m_precip_accum_restored
Definition: ERF_NOAHMP.H:424
void m_ensure_nsoil_resolved()
Definition: ERF_NOAHMP.H:317
bool Runs_Own_Land_Driver() const override
Definition: ERF_NOAHMP.H:90
amrex::Vector< std::string > LsmFluxName
Definition: ERF_NOAHMP.H:357
void advance_precip_snapshots(const int &lev, const erf_noahmp::PrecipSlots &precip)
Definition: ERF_NOAHMP_Precip.cpp:66
amrex::Geometry m_geom
Definition: ERF_NOAHMP.H:360
bool time_to_fire(const amrex::Real &elapsed_time)
Definition: ERF_NOAHMP_Advance.cpp:75
amrex::Real m_dz_lsm
Definition: ERF_NOAHMP.H:391
amrex::MultiFab * Lsm_Flux_Ptr(const int &varIdx) override
Definition: ERF_NOAHMP.H:132
Definition: ERF_NullSurf.H:15
virtual void Init(const int &, const amrex::MultiFab &, const amrex::Geometry &, const amrex::Geometry &, amrex::Vector< amrex::BCRec > &, amrex::IntVect &, const amrex::Real &, amrex::Vector< amrex::Vector< std::string >> &)
Definition: ERF_NullSurf.H:27
@ NumVars
Definition: ERF_NOAHMP_Fields.H:110
@ NumVars
Definition: ERF_NOAHMP_Fields.H:123
@ NumSlots
Definition: ERF_NOAHMP_Fields.H:136
@ precip
Definition: ERF_SLM.H:133
Definition: ERF_NOAHMP.H:31
real(c_double), parameter g
Definition: ERF_module_model_constants.F90:19
Definition: ERF_DataStruct.H:685
static InitType init_type
Initial-condition source selected for the run.
Definition: ERF_DataStruct.H:2218
bool rad_feeds_lsm() const
True when the radiation model's outputs feed the land model (downwelling shortwave,...
Definition: ERF_DataStruct.H:2556
RadiationType rad_type
Radiation model.
Definition: ERF_DataStruct.H:2538
Definition: ERF_SurfacePrecipitation.H:34
Definition: ERF_NOAHMP.H:42
int i
Definition: ERF_NOAHMP.H:42
amrex::Real raw_mm
Definition: ERF_NOAHMP.H:42
int j
Definition: ERF_NOAHMP.H:42
Definition: ERF_NOAHMP.H:46
int j
Definition: ERF_NOAHMP.H:46
amrex::Real froz_mm
Definition: ERF_NOAHMP.H:46
amrex::Real total_mm
Definition: ERF_NOAHMP.H:46
int i
Definition: ERF_NOAHMP.H:46
Definition: ERF_NOAHMP.H:50
NoahmpIO_type * io
Definition: ERF_NOAHMP.H:51
amrex::Array4< amrex::Real > output
Definition: ERF_NOAHMP.H:53
amrex::Array4< amrex::Real > input
Definition: ERF_NOAHMP.H:52
Definition: ERF_NOAHMP.H:34
bool have_any
Definition: ERF_NOAHMP.H:38
bool has[NoahmpPrecipSlot::NumSlots]
Definition: ERF_NOAHMP.H:37
const amrex::MultiFab * accum[NoahmpPrecipSlot::NumSlots]
Definition: ERF_NOAHMP.H:35
amrex::Real factor[NoahmpPrecipSlot::NumSlots]
Definition: ERF_NOAHMP.H:36