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

Wrapper class for managing urban models across AMR levels. More...

#include <ERF_Urban.H>

Collaboration diagram for Urban:

Public Member Functions

 Urban ()=default
 
 ~Urban ()=default
 
void ReSize (const int &nlev, const amrex::Vector< int > &active_levs)
 Resizes urban-model storage and records active AMR levels. More...
 
template<class NewUrbanModel >
void SetModel ()
 Instantiates an urban model on each active AMR level. More...
 
void Define (const int &lev, SolverChoice &sc)
 Defines the urban model on an active level. More...
 
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, const amrex::MultiFab &z_phys_nd, const amrex::iMultiFab &land_type, const amrex::MultiFab &urb_frac)
 Initializes the urban model on an active level. More...
 
void Advance (const int &lev, const amrex::Real &dt_advance, const amrex::Real &time, const amrex::Real &start_time, const amrex::Geometry &geom, const amrex::MultiFab *z_phys_nd, amrex::MultiFab &eddyDiffs_lev, const amrex::Real &calday)
 Advances the urban model on an active level. More...
 
void Update_Urban_Vars_Lev (const int &lev, amrex::MultiFab &cons_in, amrex::MultiFab &u_in, amrex::MultiFab &v_in)
 Updates coupled urban fields on an active level. More...
 
void Update_State_Vars_Lev (const int &lev, amrex::MultiFab &cons_in)
 Updates atmospheric state fields on an active level. More...
 
amrex::MultiFab * Get_Data_Ptr (const int &lev, const int &varIdx)
 Returns a model data field, or null for an inactive level. More...
 
amrex::MultiFab * Get_Flux_Ptr (const int &lev, const int &varIdx)
 Returns a model flux field, or null for an inactive level. More...
 
amrex::Geometry Get_Urban_Geom (const int &lev)
 Returns the urban-model geometry for a level. More...
 
int Get_Data_Size ()
 Returns the number of model data fields. More...
 
std::string Get_DataName (const int &varIdx)
 Returns a model data-field name. More...
 
int Get_DataIdx (const int &lev, const std::string &varname)
 Returns a model data-field index. More...
 
void set_urban_flux_inputs (const int &lev, const amrex::Real &declin)
 Sets flux inputs on an active level. More...
 
void set_urban_terrain_inputs (const int &lev, const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab >>> &tsk_in, const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab >>> &lmask_in, const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab >>> &land_type_in, const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab >>> &urb_frac_in, amrex::MultiFab *lat_in, amrex::MultiFab *lon_in)
 Sets terrain inputs on an active level. More...
 

Private Attributes

amrex::Vector< std::unique_ptr< NullUrban > > m_urban_model
 
amrex::Vector< int > m_active_levs
 
int m_first_active_lev = -1
 

Detailed Description

Wrapper class for managing urban models across AMR levels.

Constructor & Destructor Documentation

◆ Urban()

Urban::Urban ( )
default

◆ ~Urban()

Urban::~Urban ( )
default

Member Function Documentation

◆ Advance()

void Urban::Advance ( const int &  lev,
const amrex::Real &  dt_advance,
const amrex::Real &  time,
const amrex::Real &  start_time,
const amrex::Geometry &  geom,
const amrex::MultiFab *  z_phys_nd,
amrex::MultiFab &  eddyDiffs_lev,
const amrex::Real &  calday 
)
inline

Advances the urban model on an active level.

79  {
80  if (m_active_levs[lev] == 1) {
81  m_urban_model[lev]->Advance(dt_advance, time, start_time, geom,
82  z_phys_nd, eddyDiffs_lev, calday);
83  }
84  }
amrex::Vector< int > m_active_levs
Definition: ERF_Urban.H:187
amrex::Vector< std::unique_ptr< NullUrban > > m_urban_model
Definition: ERF_Urban.H:186

◆ Define()

void Urban::Define ( const int &  lev,
SolverChoice &  sc 
)
inline

Defines the urban model on an active level.

51  {
52  if (m_active_levs[lev] == 1) {
53  m_urban_model[lev]->Define(sc);
54  }
55  }

◆ Get_Data_Ptr()

amrex::MultiFab* Urban::Get_Data_Ptr ( const int &  lev,
const int &  varIdx 
)
inline

Returns a model data field, or null for an inactive level.

111  {
112  return m_active_levs[lev] ? m_urban_model[lev]->Urban_Data_Ptr(varIdx) : nullptr;
113  }

◆ Get_Data_Size()

int Urban::Get_Data_Size ( )
inline

Returns the number of model data fields.

135  {
136  return (m_first_active_lev != -1)
137  ? m_urban_model[m_first_active_lev]->Urban_Data_Size() : 0;
138  }
int m_first_active_lev
Definition: ERF_Urban.H:188

◆ Get_DataIdx()

int Urban::Get_DataIdx ( const int &  lev,
const std::string &  varname 
)
inline

Returns a model data-field index.

153  {
154  return m_active_levs[lev] ? m_urban_model[lev]->Urban_DataIndex(varname) : -1;
155  }

◆ Get_DataName()

std::string Urban::Get_DataName ( const int &  varIdx)
inline

Returns a model data-field name.

144  {
145  return (m_first_active_lev != -1)
146  ? m_urban_model[m_first_active_lev]->Urban_DataName(varIdx) : "";
147  }

◆ Get_Flux_Ptr()

amrex::MultiFab* Urban::Get_Flux_Ptr ( const int &  lev,
const int &  varIdx 
)
inline

Returns a model flux field, or null for an inactive level.

119  {
120  return m_active_levs[lev] ? m_urban_model[lev]->Urban_Flux_Ptr(varIdx) : nullptr;
121  }

◆ Get_Urban_Geom()

amrex::Geometry Urban::Get_Urban_Geom ( const int &  lev)
inline

Returns the urban-model geometry for a level.

127  {
128  return m_active_levs[lev] ? m_urban_model[lev]->Urban_Geom() : amrex::Geometry();
129  }

◆ Init()

void Urban::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,
const amrex::MultiFab &  z_phys_nd,
const amrex::iMultiFab &  land_type,
const amrex::MultiFab &  urb_frac 
)
inline

Initializes the urban model on an active level.

65  {
66  if (m_active_levs[lev] == 1) {
67  m_urban_model[lev]->Init(cons_in, u_in, v_in, geom, dt_advance,
68  z_phys_nd, land_type, urb_frac);
69  }
70  }

◆ ReSize()

void Urban::ReSize ( const int &  nlev,
const amrex::Vector< int > &  active_levs 
)
inline

Resizes urban-model storage and records active AMR levels.

24  {
25  AMREX_ALWAYS_ASSERT(active_levs.size() == nlev);
26  m_urban_model.resize(nlev);
27  m_active_levs = active_levs;
28  }
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
Here is the call graph for this function:

◆ set_urban_flux_inputs()

void Urban::set_urban_flux_inputs ( const int &  lev,
const amrex::Real &  declin 
)
inline

Sets flux inputs on an active level.

161  {
162  if (m_active_levs[lev] == 1) {
163  m_urban_model[lev]->set_flux_inputs(declin);
164  }
165  }

◆ set_urban_terrain_inputs()

void Urban::set_urban_terrain_inputs ( const int &  lev,
const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab >>> &  tsk_in,
const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab >>> &  lmask_in,
const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::iMultiFab >>> &  land_type_in,
const amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab >>> &  urb_frac_in,
amrex::MultiFab *  lat_in,
amrex::MultiFab *  lon_in 
)
inline

Sets terrain inputs on an active level.

177  {
178  if (m_active_levs[lev] == 1) {
179  m_urban_model[lev]->set_terrain_inputs(
180  tsk_in[lev], lmask_in[lev], land_type_in[lev], urb_frac_in[lev],
181  lat_in, lon_in);
182  }
183  }

◆ SetModel()

template<class NewUrbanModel >
void Urban::SetModel ( )
inline

Instantiates an urban model on each active AMR level.

35  {
36  m_first_active_lev = -1;
37  for (int lev = 0; lev < m_urban_model.size(); ++lev) {
38  if (m_active_levs[lev] == 1) {
39  m_urban_model[lev] = std::make_unique<NewUrbanModel>();
40  if (m_first_active_lev == -1) {
41  m_first_active_lev = lev;
42  }
43  }
44  }
45  }

◆ Update_State_Vars_Lev()

void Urban::Update_State_Vars_Lev ( const int &  lev,
amrex::MultiFab &  cons_in 
)
inline

Updates atmospheric state fields on an active level.

101  {
102  if (m_active_levs[lev] == 1) {
103  m_urban_model[lev]->Update_State_Vars(cons_in);
104  }
105  }

◆ Update_Urban_Vars_Lev()

void Urban::Update_Urban_Vars_Lev ( const int &  lev,
amrex::MultiFab &  cons_in,
amrex::MultiFab &  u_in,
amrex::MultiFab &  v_in 
)
inline

Updates coupled urban fields on an active level.

91  {
92  if (m_active_levs[lev] == 1) {
93  m_urban_model[lev]->Update_Urban_Vars(cons_in, u_in, v_in);
94  }
95  }

Member Data Documentation

◆ m_active_levs

◆ m_first_active_lev

int Urban::m_first_active_lev = -1
private

◆ m_urban_model


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