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  const int nsurface = m_lsm_model[lev]->Lsm_Surface_State_Size();
220  AMREX_ALWAYS_ASSERT(nsurface == m_lsm_model[source_lev]->Lsm_Surface_State_Size());
221  for (int varIdx(0); varIdx<nsurface; ++varIdx) {
222  m_lsm_model[lev]->Lsm_Set_Source_Surface_State_Ptr(
223  varIdx, m_lsm_model[source_lev]->Lsm_Surface_State_Ptr(varIdx));
224  }
225 
226  m_lsm_model[lev]->Lsm_Set_Source_Has_Atmos_State(
227  m_lsm_model[source_lev]->Lsm_Has_Atmos_State());
228  }
229 
230  /**
231  * Initializes a level from a source level using the requested state mode.
232  */
233  void
234  Initialize_From_Source (const int& lev, const int& source_lev,
235  const amrex::IntVect& ref_ratio,
236  const LSMTransferMode mode)
237  {
238  Set_Source_Ptrs(lev, source_lev);
239  m_lsm_model[lev]->Lsm_Interpolate_From_Source(
240  m_lsm_model[source_lev]->Lsm_Atmos_Geom(),
241  m_lsm_model[source_lev]->Lsm_Geom(), ref_ratio, mode);
242  }
243 
244  /**
245  * Rebuilds a land-surface level after ERF remakes its atmospheric grid.
246  */
247  void
248  Remake_Level (const int& lev,
249  const amrex::MultiFab& cons_in,
250  const amrex::MultiFab& u_in,
251  const amrex::MultiFab& v_in,
252  const amrex::Geometry& geom,
253  const amrex::Geometry& geom0,
254  amrex::Vector<amrex::BCRec>& domain_bcs_type,
255  amrex::IntVect& ref_ratio,
256  const amrex::Real& dt_advance,
257  std::unique_ptr<amrex::MultiFab>& z_phys_nd,
258  amrex::Vector<amrex::Vector<std::string>>& nc_init_file,
259  const int source_lev = -1,
260  const amrex::IntVect& source_ref_ratio = amrex::IntVect(1))
261  {
262  const bool has_source = source_lev >= 0;
263  if (has_source) {
264  Set_Source_Ptrs(lev, source_lev);
265  }
266 
267  const amrex::Geometry& source_geom = has_source
268  ? m_lsm_model[source_lev]->Lsm_Atmos_Geom() : geom;
269  const amrex::Geometry& source_lsm_geom = has_source
270  ? m_lsm_model[source_lev]->Lsm_Geom() : geom;
271  m_lsm_model[lev]->Lsm_Regrid_Level(
272  lev, cons_in, u_in, v_in, geom, geom0, domain_bcs_type,
273  ref_ratio, dt_advance, z_phys_nd, nc_init_file,
274  source_geom, source_lsm_geom, source_ref_ratio, has_source);
275  }
276 
277  void
278  Set_Lev0_Data_Ptr (const int& lev) {
279  // Ensure the same type of model for copy in place of flux data
280  if ( (lev > 0) && typeid(m_lsm_model[lev]) == typeid(m_lsm_model[0]) ) {
281  int ndata = this->Get_Data_Size();
282  for (int varIdx(0); varIdx<ndata; ++varIdx) {
283  amrex::MultiFab* Lev0_Data_Ptr = this->Get_Data_Ptr(0, varIdx);
284  m_lsm_model[lev]->Lsm_Set_Lev0_Data_Ptr(varIdx, Lev0_Data_Ptr);
285  }
286  } else {
287  amrex::Abort("Differing types of land surface models across levels is not supported!");
288  }
289  }
290 
291  std::string
292  Get_FluxName (const int& varIdx) { return m_lsm_model[0]->Lsm_FluxName(varIdx); }
293 
294  int
295  Get_FluxIdx (const int& lev, const std::string& varname) { return m_lsm_model[lev]->Lsm_FluxIndex(varname); }
296 
297  void
298  Set_Lev0_Flux_Ptr (const int& lev) {
299  // Ensure the same type of model for copy in place of flux data
300  if ( (lev > 0) && typeid(m_lsm_model[lev]) == typeid(m_lsm_model[0]) ) {
301  int nflux = this->Get_Flux_Size();
302  for (int varIdx(0); varIdx<nflux; ++varIdx) {
303  amrex::MultiFab* Lev0_Flux_Ptr = this->Get_Flux_Ptr(0, varIdx);
304  m_lsm_model[lev]->Lsm_Set_Lev0_Flux_Ptr(varIdx, Lev0_Flux_Ptr);
305  }
306  } else {
307  amrex::Abort("Differing types of land surface models across levels is not supported!");
308  }
309  }
310 
311  bool
312  Get_LSM_Update_Status (const int& lev) { return m_lsm_model[lev]->Get_Update_Status(); }
313 
314  [[nodiscard]] bool
315  Runs_Own_Land_Driver (const int& lev) const
316  {
317  return lev >= 0 && lev < static_cast<int>(m_lsm_model.size()) && m_lsm_model[lev] &&
318  m_lsm_model[lev]->Runs_Own_Land_Driver();
319  }
320 
321  std::unordered_map<std::string,std::string>&
322  Get_WRFInputNames () { return m_lsm_model[0]->Lsm_WRFInputNames(); }
323 
324  // Scalar LSM step counter (e.g., NoahMP itimestep) for checkpoint/restart.
325  int
326  Get_LSM_Step (const int& lev) const { return m_lsm_model[lev]->Get_LSM_Step(); }
327 
328  void
329  Set_LSM_Step (const int& lev, int step) { m_lsm_model[lev]->Set_LSM_Step(step); }
330 
331  // Full LSM prognostic-state restart I/O (e.g., NoahMP soil/snow/canopy).
332  // Write is const (called from the const WriteCheckpointFile); it only
333  // serializes state, it does not mutate the ERF-side model wrapper.
334  void
335  Write_Lsm_Restart (const int& lev, const std::string& dir) const { m_lsm_model[lev]->Write_Lsm_Restart(dir); }
336 
337  void
338  Read_Lsm_Restart (const int& lev, const std::string& dir) { m_lsm_model[lev]->Read_Lsm_Restart(dir); }
339 
340  void
341  Plot_Lsm_Data (const PlotFileType plotfile_type,
342  double time,
343  const amrex::Vector<int> &level_steps,
344  const amrex::Vector<amrex::IntVect> &ref_ratio, const int finest_level)
345  {
346  // Note we must use finest_level here rather than m_lsm_model.size(), which is
347  // (max_level+1) -- the models at levels that have not (yet) been created
348  // have been allocated but not Define'd or Init'ed, so their data pointers
349  // are still null
350  int nlev = finest_level + 1;
351  int nlev_valid = finest_level + 1;
352  int nvar = this->Get_Data_Size();
353  amrex::Vector<std::string> varnames;
354 
355  // Only write if we have valid pointers
356  if (this->Get_Data_Ptr(0,0)) {
357  varnames.resize(nvar);
358  m_lsm_geom_lev.resize(nlev);
359  m_lsm_data_lev.resize(nlev);
360  std::string plotfilename = amrex::Concatenate(plot_file_lsm, level_steps[0], 5);
361  for (int lev = 0; lev <= finest_level; ++lev) {
362  m_lsm_geom_lev[lev] = this->Get_Lsm_Geom(lev);
363 
364  if (m_lsm_geom_lev[lev].Domain().isEmpty()) {
365  nlev_valid--;
366  continue;
367  }
368 
369  amrex::MultiFab* mf_lsm = this->Get_Data_Ptr(lev,0);
370  amrex::IntVect ng(0,0,0);
371  amrex::BoxArray ba = mf_lsm->boxArray();
372  amrex::DistributionMapping dm = mf_lsm->DistributionMap();
373  m_lsm_data_lev[lev].define(ba, dm, nvar, ng);
374  for (int n(0); n<nvar; ++n) {
375  mf_lsm = this->Get_Data_Ptr(lev,n);
376  amrex::MultiFab::Copy(m_lsm_data_lev[lev],*(mf_lsm),0,n,1,0);
377  if (lev==0) varnames[n] = this->Get_DataName(n);
378  }
379  }
380  if (plotfile_type == PlotFileType::Amrex
381 #ifdef ERF_USE_NETCDF
382  || plotfile_type == PlotFileType::Netcdf
383 #endif
384  ) {
385 #ifdef ERF_USE_NETCDF
386  // NetCDF output of the land-surface fields is not implemented yet, so fall back
387  // to the AMReX format -- which is what these plotfiles were before the plotfile
388  // type was consulted here -- rather than silently writing nothing at all.
389  warn_nc_lsm_plot_fallback(plotfile_type);
390 #endif
391  WriteMultiLevelPlotfile (plotfilename, nlev_valid, GetVecOfConstPtrs(m_lsm_data_lev),
392  varnames, m_lsm_geom_lev, static_cast<amrex::Real>(time),
393  level_steps, ref_ratio);
394  } else {
395  amrex::Abort("Dont know this plotfile_type");
396  }
397 
398  m_lsm_geom_lev.clear();
399  m_lsm_data_lev.clear();
400  }
401 
402  if (nlev_valid > 0 && m_lsm_model[0]->Lsm_Type() == LSM_Type::SLM)
403  {
404  amrex::Vector<amrex::MultiFab> fab_2d(finest_level+1);
405  amrex::Vector<amrex::Geometry> geom_2d(finest_level+1);
406  amrex::Vector<std::string> varnames_2d;
407  std::string plotfilename_2d = amrex::Concatenate(plot_file_lsm + "2D_", level_steps[0], 5);
408  for (int lev = 0; lev <= finest_level; ++lev) {
409  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);
410  }
411  // For a NetCDF run writeSLM_Data has already written these fields itself, one file
412  // per level, so only the AMReX format is assembled here.
413  if (plotfile_type == PlotFileType::Amrex) {
414  amrex::WriteMultiLevelPlotfile(plotfilename_2d, finest_level+1, GetVecOfConstPtrs(fab_2d), varnames_2d, geom_2d, static_cast<amrex::Real>(time), level_steps, ref_ratio);
415  }
416  }
417  }
418 
419  void set_LSM_precip_input (const int& lev,
420  const amrex::MultiFab* precip_in)
421  {
422  m_lsm_model[lev]->set_precip_input(precip_in);
423  }
424 
425  void set_LSM_terrain_inputs (const int& lev,
426  const amrex::Vector<amrex::Vector<std::unique_ptr<amrex::MultiFab>>>& sst_in,
427  const amrex::Vector<amrex::Vector<std::unique_ptr<amrex::iMultiFab>>>& lmask_in)
428  {
429  m_lsm_model[lev]->set_terrain_inputs(sst_in[lev], lmask_in[lev]);
430  }
431 
432  template<class SurfModelType>
433  SurfModelType* get_model_lev (const int &lev) {
434  return static_cast<SurfModelType*>(m_lsm_model[lev].get());
435  }
436 
437  void WriteCheckpoint (const int &lev, const std::string &checkpointname) const
438  {
439  m_lsm_model[lev]->WriteCheckpoint(lev, checkpointname);
440  }
441 
442  void ReadCheckpoint (const int &lev, const std::string &checkpointname)
443  {
444  m_lsm_model[lev]->ReadCheckpoint(lev, checkpointname);
445  }
446 
447 private:
448 #ifdef ERF_USE_NETCDF
449  /**
450  * Tell the user once per run that the land-surface plotfile is written in the AMReX
451  * format even though erf.plotfile_type is netcdf, because there is no NetCDF writer
452  * for these fields.
453  */
454  void warn_nc_lsm_plot_fallback (const PlotFileType plotfile_type)
455  {
456  if (plotfile_type != PlotFileType::Netcdf || m_warned_nc_lsm_plot) { return; }
457  m_warned_nc_lsm_plot = true;
458  amrex::Print() << "NOTE: erf.plotfile_type = netcdf, but NetCDF output is not implemented "
459  "for the 3D land-surface plotfiles; writing " << plot_file_lsm
460  << "<step> in the AMReX plotfile format instead (the SLM fields are "
461  "written to " << plot_file_lsm << "lev<L>.nc)." << std::endl;
462  }
463 #endif
464 
465  // lsm model at each level
466  amrex::Vector<std::unique_ptr<NullSurf>> m_lsm_model;
467 
468  // plotfile prefix
469  std::string plot_file_lsm {"plt_lsm_"};
470 
471  // Vector of geometry
472  amrex::Vector<amrex::Geometry> m_lsm_geom_lev;
473 
474  // Vector of data pointers
475  amrex::Vector<amrex::MultiFab> m_lsm_data_lev;
476 
477 #ifdef ERF_USE_NETCDF
478  // Whether we have already told the user that LSM plotfiles fall back to the AMReX format
479  bool m_warned_nc_lsm_plot = false;
480 #endif
481 };
482 #endif
@ nvars
Definition: ERF_DataStruct.H:235
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
LSMTransferMode
Definition: ERF_NullSurf.H:10
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:139
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:472
std::unordered_map< std::string, std::string > & Get_WRFInputNames()
Definition: ERF_LandSurface.H:322
int Get_FluxIdx(const int &lev, const std::string &varname)
Definition: ERF_LandSurface.H:295
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:248
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:315
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:341
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:433
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:338
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:437
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:278
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:475
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:326
std::string Get_FluxName(const int &varIdx)
Definition: ERF_LandSurface.H:292
amrex::Vector< std::unique_ptr< NullSurf > > m_lsm_model
Definition: ERF_LandSurface.H:466
void Set_LSM_Step(const int &lev, int step)
Definition: ERF_LandSurface.H:329
void set_LSM_precip_input(const int &lev, const amrex::MultiFab *precip_in)
Definition: ERF_LandSurface.H:419
void SetModel()
Definition: ERF_LandSurface.H:32
void ReadCheckpoint(const int &lev, const std::string &checkpointname)
Definition: ERF_LandSurface.H:442
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:234
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:312
LandSurface()
Definition: ERF_LandSurface.H:23
void Set_Lev0_Flux_Ptr(const int &lev)
Definition: ERF_LandSurface.H:298
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:425
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:335
bool Has_Model() const
Definition: ERF_LandSurface.H:153
std::string plot_file_lsm
Definition: ERF_LandSurface.H:469
void Update_Micro_Vars_Lev(const int &lev, amrex::MultiFab &cons_in)
Definition: ERF_LandSurface.H:124
Definition: ERF_SLM.H:187
@ SLM
Definition: ERF_LSM_Types.H:8
@ ng
Definition: ERF_Morrison.H:51
@ precip_in
Definition: ERF_SLM.H:136
Definition: ERF_DataStruct.H:743
Definition: ERF_SurfacePrecipitation.H:40