ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
LandSurface Class Reference

#include <ERF_LandSurface.H>

Collaboration diagram for LandSurface:

Public Member Functions

 LandSurface ()
 
 ~LandSurface ()=default
 
void ReSize (const int &nlev)
 
template<class NewSurfModel >
void SetModel ()
 
void Define (const int &lev, SolverChoice &sc)
 
void Init (const int &lev, const amrex::MultiFab &cons_in, const amrex::Geometry &geom, const amrex::Real &dt_advance)
 
void Advance (const int &lev, const amrex::Real &dt_advance)
 
void Update_Micro_Vars_Lev (const int &lev, amrex::MultiFab &cons_in)
 
void Update_State_Vars_Lev (const int &lev, amrex::MultiFab &cons_in)
 
amrex::MultiFab * Get_Data_Ptr (const int &lev, const int &varIdx)
 
amrex::MultiFab * Get_Flux_Ptr (const int &lev, const int &varIdx)
 
amrex::Geometry Get_Lsm_Geom (const int &lev)
 
int Get_Data_Size ()
 
std::string Get_VarName (const int &varIdx)
 
void Plot_Lsm_Data (amrex::Real time, const amrex::Vector< int > &level_steps, const amrex::Vector< amrex::IntVect > &ref_ratio)
 

Private Attributes

amrex::Vector< std::unique_ptr< NullSurf > > m_lsm_model
 
std::string plot_file_lsm {"plt_lsm_"}
 
amrex::Vector< amrex::Geometry > m_lsm_geom_lev
 
amrex::Vector< amrex::MultiFab > m_lsm_data_lev
 

Constructor & Destructor Documentation

◆ LandSurface()

LandSurface::LandSurface ( )
inline
18 { }

◆ ~LandSurface()

LandSurface::~LandSurface ( )
default

Member Function Documentation

◆ Advance()

void LandSurface::Advance ( const int &  lev,
const amrex::Real &  dt_advance 
)
inline
52  {
53  m_lsm_model[lev]->Advance(dt_advance);
54  }
amrex::Vector< std::unique_ptr< NullSurf > > m_lsm_model
Definition: ERF_LandSurface.H:121

◆ Define()

void LandSurface::Define ( const int &  lev,
SolverChoice sc 
)
inline
37  {
38  m_lsm_model[lev]->Define(sc);
39  }

◆ Get_Data_Ptr()

amrex::MultiFab* LandSurface::Get_Data_Ptr ( const int &  lev,
const int &  varIdx 
)
inline
69 { return m_lsm_model[lev]->Lsm_Data_Ptr(varIdx); }

Referenced by Plot_Lsm_Data().

Here is the caller graph for this function:

◆ Get_Data_Size()

int LandSurface::Get_Data_Size ( )
inline
78 { return m_lsm_model[0]->Lsm_Data_Size(); }

Referenced by Plot_Lsm_Data().

Here is the caller graph for this function:

◆ Get_Flux_Ptr()

amrex::MultiFab* LandSurface::Get_Flux_Ptr ( const int &  lev,
const int &  varIdx 
)
inline
72 { return m_lsm_model[lev]->Lsm_Flux_Ptr(varIdx); }

◆ Get_Lsm_Geom()

amrex::Geometry LandSurface::Get_Lsm_Geom ( const int &  lev)
inline
75 { return m_lsm_model[lev]->Lsm_Geom(); }

Referenced by Plot_Lsm_Data().

Here is the caller graph for this function:

◆ Get_VarName()

std::string LandSurface::Get_VarName ( const int &  varIdx)
inline
81 { return m_lsm_model[0]->Lsm_VarName(varIdx); }

Referenced by Plot_Lsm_Data().

Here is the caller graph for this function:

◆ Init()

void LandSurface::Init ( const int &  lev,
const amrex::MultiFab &  cons_in,
const amrex::Geometry &  geom,
const amrex::Real &  dt_advance 
)
inline
46  {
47  m_lsm_model[lev]->Init(cons_in, geom, dt_advance);
48  }

◆ Plot_Lsm_Data()

void LandSurface::Plot_Lsm_Data ( amrex::Real  time,
const amrex::Vector< int > &  level_steps,
const amrex::Vector< amrex::IntVect > &  ref_ratio 
)
inline
87  {
88  int nlev = m_lsm_model.size();
89  int nvar = this->Get_Data_Size();
90  amrex::Vector<std::string> varnames;
91 
92  // Only write if we have valid pointers
93  if (this->Get_Data_Ptr(0,0)) {
94  varnames.resize(nvar);
95  m_lsm_geom_lev.resize(nlev);
96  m_lsm_data_lev.resize(nlev);
97  std::string plotfilename = amrex::Concatenate(plot_file_lsm, level_steps[0], 5);
98  for (int lev(0); lev<nlev; ++lev) {
99  m_lsm_geom_lev[lev] = this->Get_Lsm_Geom(lev);
100 
101  amrex::MultiFab* mf_lsm = this->Get_Data_Ptr(lev,0);
102  amrex::IntVect ng(0,0,0);
103  amrex::BoxArray ba = mf_lsm->boxArray();
104  amrex::DistributionMapping dm = mf_lsm->DistributionMap();
105  m_lsm_data_lev[lev].define(ba, dm, nvar, ng);
106  for (int n(0); n<nvar; ++n) {
107  mf_lsm = this->Get_Data_Ptr(lev,n);
108  amrex::MultiFab::Copy(m_lsm_data_lev[lev],*(mf_lsm),0,n,1,0);
109  if (lev==0) varnames[n] = this->Get_VarName(n);
110  }
111  }
112  WriteMultiLevelPlotfile (plotfilename, nlev, GetVecOfConstPtrs(m_lsm_data_lev),
113  varnames, m_lsm_geom_lev, time, level_steps, ref_ratio);
114  m_lsm_geom_lev.clear();
115  m_lsm_data_lev.clear();
116  }
117  }
amrex::Vector< amrex::Geometry > m_lsm_geom_lev
Definition: ERF_LandSurface.H:127
std::string Get_VarName(const int &varIdx)
Definition: ERF_LandSurface.H:81
int Get_Data_Size()
Definition: ERF_LandSurface.H:78
amrex::Geometry Get_Lsm_Geom(const int &lev)
Definition: ERF_LandSurface.H:75
amrex::Vector< amrex::MultiFab > m_lsm_data_lev
Definition: ERF_LandSurface.H:130
amrex::MultiFab * Get_Data_Ptr(const int &lev, const int &varIdx)
Definition: ERF_LandSurface.H:69
std::string plot_file_lsm
Definition: ERF_LandSurface.H:124
Here is the call graph for this function:

◆ ReSize()

void LandSurface::ReSize ( const int &  nlev)
inline
23 { m_lsm_model.resize(nlev); }

◆ SetModel()

template<class NewSurfModel >
void LandSurface::SetModel ( )
inline
28  {
29  for (int lev(0); lev<m_lsm_model.size(); ++lev) {
30  m_lsm_model[lev] = std::make_unique<NewSurfModel>();
31  }
32  }

◆ Update_Micro_Vars_Lev()

void LandSurface::Update_Micro_Vars_Lev ( const int &  lev,
amrex::MultiFab &  cons_in 
)
inline
58  {
59  m_lsm_model[lev]->Update_Micro_Vars(cons_in);
60  }

◆ Update_State_Vars_Lev()

void LandSurface::Update_State_Vars_Lev ( const int &  lev,
amrex::MultiFab &  cons_in 
)
inline
64  {
65  m_lsm_model[lev]->Update_State_Vars(cons_in);
66  }

Member Data Documentation

◆ m_lsm_data_lev

amrex::Vector<amrex::MultiFab> LandSurface::m_lsm_data_lev
private

Referenced by Plot_Lsm_Data().

◆ m_lsm_geom_lev

amrex::Vector<amrex::Geometry> LandSurface::m_lsm_geom_lev
private

Referenced by Plot_Lsm_Data().

◆ m_lsm_model

◆ plot_file_lsm

std::string LandSurface::plot_file_lsm {"plt_lsm_"}
private

Referenced by Plot_Lsm_Data().


The documentation for this class was generated from the following file: