ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_LandSurface.H
Go to the documentation of this file.
1 #ifndef ERF_LANDSURFACE_H
2 #define ERF_LANDSURFACE_H
3 
4 #include <typeinfo>
5 
6 #include <AMReX_PlotFileUtil.H>
7 #include <AMReX_MultiFabUtil.H>
8 
9 #include <ERF_NullSurf.H>
10 #include <ERF_SLM.H>
11 
12 #if ERF_USE_NOAHMP
13 #include <ERF_NOAHMP.H>
14 #endif
15 
16 /**
17  * @brief Wrapper class for managing land surface models across AMR levels.
18  */
19 class LandSurface {
20 
21 public:
22 
23  LandSurface () { }
24 
25  ~LandSurface () = default;
26 
27  void
28  ReSize (const int& nlev) { m_lsm_model.resize(nlev); }
29 
30  template<class NewSurfModel>
31  void
33  {
34  for (int lev(0); lev<m_lsm_model.size(); ++lev) {
35  m_lsm_model[lev] = std::make_unique<NewSurfModel>();
36  }
37  }
38 
39  void
40  Define (const int& lev,
41  SolverChoice& sc)
42  {
43  m_lsm_model[lev]->Define(sc);
44  }
45 
46  void
47  Init (const int& lev,
48  const amrex::MultiFab& cons_in,
49  const amrex::MultiFab& u_in,
50  const amrex::MultiFab& v_in,
51  const amrex::Geometry& geom,
52  const amrex::Geometry& geom0,
53  amrex::Vector<amrex::BCRec>& domain_bcs_type,
54  amrex::IntVect& refRatio,
55  const amrex::Real& dt_advance,
56  std::unique_ptr<amrex::MultiFab>& z_phys_nd,
57  amrex::Vector<amrex::Vector<std::string>>& nc_init_file)
58  {
59  m_lsm_model[lev]->Init(lev, cons_in, u_in, v_in, geom, geom0,
60  domain_bcs_type, refRatio, dt_advance,
61  z_phys_nd, nc_init_file);
62  }
63 
64  void
65  Init (const int& lev,
66  const amrex::MultiFab& cons_in,
67  const amrex::MultiFab& u_in,
68  const amrex::MultiFab& v_in,
69  const amrex::Geometry& geom,
70  const amrex::Real& dt_advance,
71  std::unique_ptr<amrex::MultiFab>& z_phys_nd)
72  {
73  amrex::Vector<amrex::BCRec> domain_bcs_type;
74  amrex::IntVect refRatio(1);
75  amrex::Vector<amrex::Vector<std::string>> nc_init_file;
76  Init(lev, cons_in, u_in, v_in, geom, geom,
77  domain_bcs_type, refRatio, dt_advance,
78  z_phys_nd, nc_init_file);
79  }
80 
81  void
82  Advance (const int& lev,
83  amrex::MultiFab& cons_in,
84  amrex::MultiFab& xvel_in,
85  amrex::MultiFab& yvel_in,
86  amrex::MultiFab* hfx3_out,
87  amrex::MultiFab* qfx3_out,
88  const SurfacePrecipAccumulationSources& precip_sources,
89  const double& time_d,
90  const double& dt_advance_d,
91  const int& nstep,
92  const bool updated_lev0,
93  amrex::MultiFab* z_nd)
94  {
95  amrex::Real time = static_cast<amrex::Real>(time_d);
96  amrex::Real dt_advance = static_cast<amrex::Real>(dt_advance_d);
97  m_lsm_model[lev]->Advance_With_State(lev, cons_in, xvel_in, yvel_in,
98  hfx3_out, qfx3_out,
99  precip_sources,
100  time, dt_advance, nstep,
101  updated_lev0, z_nd);
102  }
103 
104  void
105  Advance (const int& lev, const double& dt_advance_d)
106  {
107  amrex::Real dt_advance = static_cast<amrex::Real>(dt_advance_d);
108  m_lsm_model[lev]->Advance(dt_advance);
109  }
110 
111  void Advance (const int& lev, const amrex::Real& dt,
112  const amrex::Real& time, const amrex::Real& start_time)
113  {
114  m_lsm_model[lev]->Advance(dt, time, start_time);
115  }
116 
117  void
118  Plot (const int& lev, const int& nstep)
119  {
120  m_lsm_model[lev]->Plot_Landfile(nstep);
121  }
122 
123  void
124  Update_Micro_Vars_Lev (const int& lev, amrex::MultiFab& cons_in)
125  {
126  m_lsm_model[lev]->Update_Micro_Vars(cons_in);
127  }
128 
129  void Update_Lsm_Vars_Lev (const int& lev, amrex::MultiFab& cons_in,
130  amrex::MultiFab& u_in, amrex::MultiFab& v_in)
131  {
132  m_lsm_model[lev]->Update_Lsm_Vars(cons_in, u_in, v_in);
133  }
134 
135  void
136  Update_State_Vars_Lev (const int& lev, amrex::MultiFab& cons_in)
137  {
138  m_lsm_model[lev]->Update_State_Vars(cons_in);
139  }
140 
141  amrex::MultiFab*
142  Get_Data_Ptr (const int& lev, const int& varIdx) { return m_lsm_model[lev]->Lsm_Data_Ptr(varIdx); }
143 
144  amrex::MultiFab*
145  Get_Data_Ptr (const int& lev, const std::string& varname)
146  {
147  std::string name = varname;
148  const int index = m_lsm_model[lev]->Lsm_DataIndex(name);
149  return (index >= 0) ? m_lsm_model[lev]->Lsm_Data_Ptr(index) : nullptr;
150  }
151 
152  bool
153  Has_Model () const { return !m_lsm_model.empty() && m_lsm_model[0] != nullptr; }
154 
155  amrex::MultiFab*
156  Get_Flux_Ptr (const int& lev, const int& varIdx) { return m_lsm_model[lev]->Lsm_Flux_Ptr(varIdx); }
157 
158  amrex::Geometry
159  Get_Lsm_Geom (const int& lev ) { return m_lsm_model[lev]->Lsm_Geom(); }
160 
161  int
162  Get_Data_Size () { return m_lsm_model[0]->Lsm_Data_Size(); }
163 
164  int
165  Get_Flux_Size () { return m_lsm_model[0]->Lsm_Flux_Size(); }
166 
167  std::string
168  Get_DataName (const int& varIdx) { return m_lsm_model[0]->Lsm_DataName(varIdx); }
169 
170  amrex::Vector<std::string>
172  {
173  amrex::Vector<std::string> names;
174  if (m_lsm_model.empty() || m_lsm_model[0] == nullptr) {
175  return names;
176  }
177  const int nvars = Get_Data_Size();
178  names.reserve(nvars);
179  for (int var = 0; var < nvars; ++var) {
180  names.push_back(Get_DataName(var));
181  }
182  return names;
183  }
184 
185  int
186  Get_DataIdx (const int& lev, const std::string& varname) { return m_lsm_model[lev]->Lsm_DataIndex(varname); }
187 
188  /**
189  * Registers a source level's exposed state with a destination level.
190  */
191  void
192  Set_Source_Ptrs (const int& lev, const int& source_lev)
193  {
194  AMREX_ALWAYS_ASSERT(lev > 0);
195  AMREX_ALWAYS_ASSERT(source_lev >= 0);
196  AMREX_ALWAYS_ASSERT(m_lsm_model[lev]->Lsm_Type() == m_lsm_model[source_lev]->Lsm_Type());
197 
198  const int ndata = m_lsm_model[lev]->Lsm_Data_Size();
199  AMREX_ALWAYS_ASSERT(ndata == m_lsm_model[source_lev]->Lsm_Data_Size());
200  for (int varIdx(0); varIdx<ndata; ++varIdx) {
201  m_lsm_model[lev]->Lsm_Set_Source_Data_Ptr(
202  varIdx, m_lsm_model[source_lev]->Lsm_Data_Ptr(varIdx));
203  }
204 
205  const int nflux = m_lsm_model[lev]->Lsm_Flux_Size();
206  AMREX_ALWAYS_ASSERT(nflux == m_lsm_model[source_lev]->Lsm_Flux_Size());
207  for (int varIdx(0); varIdx<nflux; ++varIdx) {
208  m_lsm_model[lev]->Lsm_Set_Source_Flux_Ptr(
209  varIdx, m_lsm_model[source_lev]->Lsm_Flux_Ptr(varIdx));
210  }
211 
212  const int nunmapped = m_lsm_model[lev]->Lsm_Unmapped_Size();
213  AMREX_ALWAYS_ASSERT(nunmapped == m_lsm_model[source_lev]->Lsm_Unmapped_Size());
214  for (int varIdx(0); varIdx<nunmapped; ++varIdx) {
215  m_lsm_model[lev]->Lsm_Set_Source_Unmapped_Ptr(
216  varIdx, m_lsm_model[source_lev]->Lsm_Unmapped_Ptr(varIdx));
217  }
218  }
219 
220  /**
221  * Initializes a level from a source level using the requested state mode.
222  */
223  void
224  Initialize_From_Source (const int& lev, const int& source_lev,
225  const amrex::IntVect& ref_ratio,
226  const LSMTransferMode mode)
227  {
228  Set_Source_Ptrs(lev, source_lev);
229  m_lsm_model[lev]->Lsm_Interpolate_From_Source(
230  m_lsm_model[source_lev]->Lsm_Atmos_Geom(),
231  m_lsm_model[source_lev]->Lsm_Geom(), ref_ratio, mode);
232  }
233 
234  /**
235  * Rebuilds a land-surface level after ERF remakes its atmospheric grid.
236  */
237  void
238  Remake_Level (const int& lev,
239  const amrex::MultiFab& cons_in,
240  const amrex::MultiFab& u_in,
241  const amrex::MultiFab& v_in,
242  const amrex::Geometry& geom,
243  const amrex::Geometry& geom0,
244  amrex::Vector<amrex::BCRec>& domain_bcs_type,
245  amrex::IntVect& ref_ratio,
246  const amrex::Real& dt_advance,
247  std::unique_ptr<amrex::MultiFab>& z_phys_nd,
248  amrex::Vector<amrex::Vector<std::string>>& nc_init_file,
249  const int source_lev = -1,
250  const amrex::IntVect& source_ref_ratio = amrex::IntVect(1))
251  {
252  const bool has_source = source_lev >= 0;
253  if (has_source) {
254  Set_Source_Ptrs(lev, source_lev);
255  }
256 
257  const amrex::Geometry& source_geom = has_source
258  ? m_lsm_model[source_lev]->Lsm_Atmos_Geom() : geom;
259  const amrex::Geometry& source_lsm_geom = has_source
260  ? m_lsm_model[source_lev]->Lsm_Geom() : geom;
261  m_lsm_model[lev]->Lsm_Regrid_Level(
262  lev, cons_in, u_in, v_in, geom, geom0, domain_bcs_type,
263  ref_ratio, dt_advance, z_phys_nd, nc_init_file,
264  source_geom, source_lsm_geom, source_ref_ratio, has_source);
265  }
266 
267  void
268  Set_Lev0_Data_Ptr (const int& lev) {
269  // Ensure the same type of model for copy in place of flux data
270  if ( (lev > 0) && typeid(m_lsm_model[lev]) == typeid(m_lsm_model[0]) ) {
271  int ndata = this->Get_Data_Size();
272  for (int varIdx(0); varIdx<ndata; ++varIdx) {
273  amrex::MultiFab* Lev0_Data_Ptr = this->Get_Data_Ptr(0, varIdx);
274  m_lsm_model[lev]->Lsm_Set_Lev0_Data_Ptr(varIdx, Lev0_Data_Ptr);
275  }
276  } else {
277  amrex::Abort("Differing types of land surface models across levels is not supported!");
278  }
279  }
280 
281  std::string
282  Get_FluxName (const int& varIdx) { return m_lsm_model[0]->Lsm_FluxName(varIdx); }
283 
284  int
285  Get_FluxIdx (const int& lev, const std::string& varname) { return m_lsm_model[lev]->Lsm_FluxIndex(varname); }
286 
287  void
288  Set_Lev0_Flux_Ptr (const int& lev) {
289  // Ensure the same type of model for copy in place of flux data
290  if ( (lev > 0) && typeid(m_lsm_model[lev]) == typeid(m_lsm_model[0]) ) {
291  int nflux = this->Get_Flux_Size();
292  for (int varIdx(0); varIdx<nflux; ++varIdx) {
293  amrex::MultiFab* Lev0_Flux_Ptr = this->Get_Flux_Ptr(0, varIdx);
294  m_lsm_model[lev]->Lsm_Set_Lev0_Flux_Ptr(varIdx, Lev0_Flux_Ptr);
295  }
296  } else {
297  amrex::Abort("Differing types of land surface models across levels is not supported!");
298  }
299  }
300 
301  bool
302  Get_LSM_Update_Status (const int& lev) { return m_lsm_model[lev]->Get_Update_Status(); }
303 
304  [[nodiscard]] bool
305  Runs_Own_Land_Driver (const int& lev) const
306  {
307  return lev >= 0 && lev < static_cast<int>(m_lsm_model.size()) && m_lsm_model[lev] &&
308  m_lsm_model[lev]->Runs_Own_Land_Driver();
309  }
310 
311  std::unordered_map<std::string,std::string>&
312  Get_WRFInputNames () { return m_lsm_model[0]->Lsm_WRFInputNames(); }
313 
314  // Scalar LSM step counter (e.g., NoahMP itimestep) for checkpoint/restart.
315  int
316  Get_LSM_Step (const int& lev) const { return m_lsm_model[lev]->Get_LSM_Step(); }
317 
318  void
319  Set_LSM_Step (const int& lev, int step) { m_lsm_model[lev]->Set_LSM_Step(step); }
320 
321  // Full LSM prognostic-state restart I/O (e.g., NoahMP soil/snow/canopy).
322  // Write is const (called from the const WriteCheckpointFile); it only
323  // serializes state, it does not mutate the ERF-side model wrapper.
324  void
325  Write_Lsm_Restart (const int& lev, const std::string& dir) const { m_lsm_model[lev]->Write_Lsm_Restart(dir); }
326 
327  void
328  Read_Lsm_Restart (const int& lev, const std::string& dir) { m_lsm_model[lev]->Read_Lsm_Restart(dir); }
329 
330  void
331  Plot_Lsm_Data (const PlotFileType plotfile_type,
332  double time,
333  const amrex::Vector<int> &level_steps,
334  const amrex::Vector<amrex::IntVect> &ref_ratio, const int finest_level)
335  {
336  // Note we must use finest_level here rather than m_lsm_model.size(), which is
337  // (max_level+1) -- the models at levels that have not (yet) been created
338  // have been allocated but not Define'd or Init'ed, so their data pointers
339  // are still null
340  int nlev = finest_level + 1;
341  int nlev_valid = finest_level + 1;
342  int nvar = this->Get_Data_Size();
343  amrex::Vector<std::string> varnames;
344 
345  // Only write if we have valid pointers
346  if (this->Get_Data_Ptr(0,0)) {
347  varnames.resize(nvar);
348  m_lsm_geom_lev.resize(nlev);
349  m_lsm_data_lev.resize(nlev);
350  std::string plotfilename = amrex::Concatenate(plot_file_lsm, level_steps[0], 5);
351  for (int lev = 0; lev <= finest_level; ++lev) {
352  m_lsm_geom_lev[lev] = this->Get_Lsm_Geom(lev);
353 
354  if (m_lsm_geom_lev[lev].Domain().isEmpty()) {
355  nlev_valid--;
356  continue;
357  }
358 
359  amrex::MultiFab* mf_lsm = this->Get_Data_Ptr(lev,0);
360  amrex::IntVect ng(0,0,0);
361  amrex::BoxArray ba = mf_lsm->boxArray();
362  amrex::DistributionMapping dm = mf_lsm->DistributionMap();
363  m_lsm_data_lev[lev].define(ba, dm, nvar, ng);
364  for (int n(0); n<nvar; ++n) {
365  mf_lsm = this->Get_Data_Ptr(lev,n);
366  amrex::MultiFab::Copy(m_lsm_data_lev[lev],*(mf_lsm),0,n,1,0);
367  if (lev==0) varnames[n] = this->Get_DataName(n);
368  }
369  }
370  if (plotfile_type == PlotFileType::Amrex
371 #ifdef ERF_USE_NETCDF
372  || plotfile_type == PlotFileType::Netcdf
373 #endif
374  ) {
375 #ifdef ERF_USE_NETCDF
376  // NetCDF output of the land-surface fields is not implemented yet, so fall back
377  // to the AMReX format -- which is what these plotfiles were before the plotfile
378  // type was consulted here -- rather than silently writing nothing at all.
379  warn_nc_lsm_plot_fallback(plotfile_type);
380 #endif
381  WriteMultiLevelPlotfile (plotfilename, nlev_valid, GetVecOfConstPtrs(m_lsm_data_lev),
382  varnames, m_lsm_geom_lev, static_cast<amrex::Real>(time),
383  level_steps, ref_ratio);
384  } else {
385  amrex::Abort("Dont know this plotfile_type");
386  }
387 
388  m_lsm_geom_lev.clear();
389  m_lsm_data_lev.clear();
390  }
391 
392  if (nlev_valid > 0 && m_lsm_model[0]->Lsm_Type() == LSM_Type::SLM)
393  {
394  amrex::Vector<amrex::MultiFab> fab_2d(finest_level+1);
395  amrex::Vector<amrex::Geometry> geom_2d(finest_level+1);
396  amrex::Vector<std::string> varnames_2d;
397  std::string plotfilename_2d = amrex::Concatenate(plot_file_lsm + "2D_", level_steps[0], 5);
398  for (int lev = 0; lev <= finest_level; ++lev) {
399  static_cast<SLM*>(m_lsm_model[lev].get())->writeSLM_Data(plotfile_type, static_cast<amrex::Real>(time), plot_file_lsm, level_steps[0], lev, finest_level, fab_2d[lev], geom_2d[lev], varnames_2d);
400  }
401  // For a NetCDF run writeSLM_Data has already written these fields itself, one file
402  // per level, so only the AMReX format is assembled here.
403  if (plotfile_type == PlotFileType::Amrex) {
404  amrex::WriteMultiLevelPlotfile(plotfilename_2d, finest_level+1, GetVecOfConstPtrs(fab_2d), varnames_2d, geom_2d, static_cast<amrex::Real>(time), level_steps, ref_ratio);
405  }
406  }
407  }
408 
409  void set_LSM_precip_input (const int& lev,
410  const amrex::MultiFab* precip_in)
411  {
412  m_lsm_model[lev]->set_precip_input(precip_in);
413  }
414 
415  void set_LSM_terrain_inputs (const int& lev,
416  const amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>>& sst_in,
417  const amrex::Vector<amrex::Vector<std::unique_ptr<amrex::iMultiFab>>>& lmask_in)
418  {
419  m_lsm_model[lev]->set_terrain_inputs(sst_in[lev], lmask_in[lev]);
420  }
421 
422  template<class SurfModelType>
423  SurfModelType* get_model_lev (const int &lev) {
424  return static_cast<SurfModelType*>(m_lsm_model[lev].get());
425  }
426 
427  void WriteCheckpoint (const int &lev, const std::string &checkpointname) const
428  {
429  m_lsm_model[lev]->WriteCheckpoint(lev, checkpointname);
430  }
431 
432  void ReadCheckpoint (const int &lev, const std::string &checkpointname)
433  {
434  m_lsm_model[lev]->ReadCheckpoint(lev, checkpointname);
435  }
436 
437 private:
438 #ifdef ERF_USE_NETCDF
439  /**
440  * Tell the user once per run that the land-surface plotfile is written in the AMReX
441  * format even though erf.plotfile_type is netcdf, because there is no NetCDF writer
442  * for these fields.
443  */
444  void warn_nc_lsm_plot_fallback (const PlotFileType plotfile_type)
445  {
446  if (plotfile_type != PlotFileType::Netcdf || m_warned_nc_lsm_plot) { return; }
447  m_warned_nc_lsm_plot = true;
448  amrex::Print() << "NOTE: erf.plotfile_type = netcdf, but NetCDF output is not implemented "
449  "for the land-surface fields; writing " << plot_file_lsm
450  << "* in the AMReX plotfile format instead." << std::endl;
451  }
452 #endif
453 
454  // lsm model at each level
455  amrex::Vector<std::unique_ptr<NullSurf>> m_lsm_model;
456 
457  // plotfile prefix
458  std::string plot_file_lsm {"plt_lsm_"};
459 
460  // Vector of geometry
461  amrex::Vector<amrex::Geometry> m_lsm_geom_lev;
462 
463  // Vector of data pointers
464  amrex::Vector<amrex::MultiFab> m_lsm_data_lev;
465 
466 #ifdef ERF_USE_NETCDF
467  // Whether we have already told the user that LSM plotfiles fall back to the AMReX format
468  bool m_warned_nc_lsm_plot = false;
469 #endif
470 };
471 #endif
@ nvars
Definition: ERF_DataStruct.H:194
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
LSMTransferMode
Definition: ERF_NullSurf.H:10
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:105
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Wrapper class for managing land surface models across AMR levels.
Definition: ERF_LandSurface.H:19
amrex::Vector< amrex::Geometry > m_lsm_geom_lev
Definition: ERF_LandSurface.H:461
std::unordered_map< std::string, std::string > & Get_WRFInputNames()
Definition: ERF_LandSurface.H:312
int Get_FluxIdx(const int &lev, const std::string &varname)
Definition: ERF_LandSurface.H:285
void Remake_Level(const int &lev, const amrex::MultiFab &cons_in, const amrex::MultiFab &u_in, const amrex::MultiFab &v_in, const amrex::Geometry &geom, const amrex::Geometry &geom0, amrex::Vector< amrex::BCRec > &domain_bcs_type, amrex::IntVect &ref_ratio, const amrex::Real &dt_advance, std::unique_ptr< amrex::MultiFab > &z_phys_nd, amrex::Vector< amrex::Vector< std::string >> &nc_init_file, const int source_lev=-1, const amrex::IntVect &source_ref_ratio=amrex::IntVect(1))
Definition: ERF_LandSurface.H:238
void Advance(const int &lev, const amrex::Real &dt, const amrex::Real &time, const amrex::Real &start_time)
Definition: ERF_LandSurface.H:111
bool Runs_Own_Land_Driver(const int &lev) const
Definition: ERF_LandSurface.H:305
amrex::MultiFab * Get_Data_Ptr(const int &lev, const std::string &varname)
Definition: ERF_LandSurface.H:145
void Plot_Lsm_Data(const PlotFileType plotfile_type, double time, const amrex::Vector< int > &level_steps, const amrex::Vector< amrex::IntVect > &ref_ratio, const int finest_level)
Definition: ERF_LandSurface.H:331
int Get_Data_Size()
Definition: ERF_LandSurface.H:162
amrex::Geometry Get_Lsm_Geom(const int &lev)
Definition: ERF_LandSurface.H:159
~LandSurface()=default
SurfModelType * get_model_lev(const int &lev)
Definition: ERF_LandSurface.H:423
void Update_Lsm_Vars_Lev(const int &lev, amrex::MultiFab &cons_in, amrex::MultiFab &u_in, amrex::MultiFab &v_in)
Definition: ERF_LandSurface.H:129
void Read_Lsm_Restart(const int &lev, const std::string &dir)
Definition: ERF_LandSurface.H:328
void Init(const int &lev, const amrex::MultiFab &cons_in, const amrex::MultiFab &u_in, const amrex::MultiFab &v_in, const amrex::Geometry &geom, const amrex::Geometry &geom0, amrex::Vector< amrex::BCRec > &domain_bcs_type, amrex::IntVect &refRatio, const amrex::Real &dt_advance, std::unique_ptr< amrex::MultiFab > &z_phys_nd, amrex::Vector< amrex::Vector< std::string >> &nc_init_file)
Definition: ERF_LandSurface.H:47
void WriteCheckpoint(const int &lev, const std::string &checkpointname) const
Definition: ERF_LandSurface.H:427
void Plot(const int &lev, const int &nstep)
Definition: ERF_LandSurface.H:118
void Set_Lev0_Data_Ptr(const int &lev)
Definition: ERF_LandSurface.H:268
amrex::Vector< std::string > Get_DataNames()
Definition: ERF_LandSurface.H:171
void ReSize(const int &nlev)
Definition: ERF_LandSurface.H:28
amrex::Vector< amrex::MultiFab > m_lsm_data_lev
Definition: ERF_LandSurface.H:464
void Set_Source_Ptrs(const int &lev, const int &source_lev)
Definition: ERF_LandSurface.H:192
std::string Get_DataName(const int &varIdx)
Definition: ERF_LandSurface.H:168
int Get_LSM_Step(const int &lev) const
Definition: ERF_LandSurface.H:316
std::string Get_FluxName(const int &varIdx)
Definition: ERF_LandSurface.H:282
amrex::Vector< std::unique_ptr< NullSurf > > m_lsm_model
Definition: ERF_LandSurface.H:455
void Set_LSM_Step(const int &lev, int step)
Definition: ERF_LandSurface.H:319
void set_LSM_precip_input(const int &lev, const amrex::MultiFab *precip_in)
Definition: ERF_LandSurface.H:409
void SetModel()
Definition: ERF_LandSurface.H:32
void ReadCheckpoint(const int &lev, const std::string &checkpointname)
Definition: ERF_LandSurface.H:432
amrex::MultiFab * Get_Flux_Ptr(const int &lev, const int &varIdx)
Definition: ERF_LandSurface.H:156
int Get_DataIdx(const int &lev, const std::string &varname)
Definition: ERF_LandSurface.H:186
void Advance(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 double &time_d, const double &dt_advance_d, const int &nstep, const bool updated_lev0, amrex::MultiFab *z_nd)
Definition: ERF_LandSurface.H:82
void Initialize_From_Source(const int &lev, const int &source_lev, const amrex::IntVect &ref_ratio, const LSMTransferMode mode)
Definition: ERF_LandSurface.H:224
void Advance(const int &lev, const double &dt_advance_d)
Definition: ERF_LandSurface.H:105
bool Get_LSM_Update_Status(const int &lev)
Definition: ERF_LandSurface.H:302
LandSurface()
Definition: ERF_LandSurface.H:23
void Set_Lev0_Flux_Ptr(const int &lev)
Definition: ERF_LandSurface.H:288
void Init(const int &lev, const amrex::MultiFab &cons_in, const amrex::MultiFab &u_in, const amrex::MultiFab &v_in, const amrex::Geometry &geom, const amrex::Real &dt_advance, std::unique_ptr< amrex::MultiFab > &z_phys_nd)
Definition: ERF_LandSurface.H:65
void Update_State_Vars_Lev(const int &lev, amrex::MultiFab &cons_in)
Definition: ERF_LandSurface.H:136
void Define(const int &lev, SolverChoice &sc)
Definition: ERF_LandSurface.H:40
int Get_Flux_Size()
Definition: ERF_LandSurface.H:165
void set_LSM_terrain_inputs(const int &lev, const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab >>> &sst_in, const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab >>> &lmask_in)
Definition: ERF_LandSurface.H:415
amrex::MultiFab * Get_Data_Ptr(const int &lev, const int &varIdx)
Definition: ERF_LandSurface.H:142
void Write_Lsm_Restart(const int &lev, const std::string &dir) const
Definition: ERF_LandSurface.H:325
bool Has_Model() const
Definition: ERF_LandSurface.H:153
std::string plot_file_lsm
Definition: ERF_LandSurface.H:458
void Update_Micro_Vars_Lev(const int &lev, amrex::MultiFab &cons_in)
Definition: ERF_LandSurface.H:124
Definition: ERF_SLM.H:185
@ SLM
Definition: ERF_LSM_Types.H:8
@ ng
Definition: ERF_Morrison.H:50
@ precip_in
Definition: ERF_SLM.H:134
Definition: ERF_DataStruct.H:685
Definition: ERF_SurfacePrecipitation.H:34