ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ShocColumnData.H File Reference
#include "ERF_ShocTypes.H"
#include "ERF_ShocGpuUtils.H"
#include <AMReX_Arena.H>
#include <AMReX_Box.H>
Include dependency graph for ERF_ShocColumnData.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ShocColumnWorkspace
 

Functions

ShocColumnLayout make_shoc_layout (const amrex::Box &bx, const amrex::Geometry &geom)
 
template<typename F >
void for_each_shoc_fab (ShocColumnData &col, F &&f)
 
void reset_shoc_column_data (ShocColumnData &col, shoc::InitRunOn init_run_on=shoc::default_init_run_on())
 
void define_shoc_column_data (ShocColumnData &col, const ShocColumnLayout &layout, amrex::Arena *arena=amrex::The_Async_Arena(), shoc::InitRunOn init_run_on=shoc::default_init_run_on())
 
bool shoc_layout_fits (const ShocColumnLayout &active, const ShocColumnLayout &capacity)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int shoc_column_index (const ShocColumnLayout &layout, int i, int j)
 

Function Documentation

◆ define_shoc_column_data()

void define_shoc_column_data ( ShocColumnData col,
const ShocColumnLayout layout,
amrex::Arena *  arena = amrex::The_Async_Arena(),
shoc::InitRunOn  init_run_on = shoc::default_init_run_on() 
)
inline
58 {
59  col.layout = layout;
60 
61  const amrex::Box cell_box(amrex::IntVect(0,0,0),
62  amrex::IntVect(layout.ncell-1, layout.nlev-1, 0));
63  const amrex::Box iface_box(amrex::IntVect(0,0,0),
64  amrex::IntVect(layout.ncell-1, layout.nlev, 0));
65  const amrex::Box scal_box(amrex::IntVect(0,0,0),
66  amrex::IntVect(layout.ncell-1, 0, 0));
67 
68  auto make2 = [&] (amrex::FArrayBox& fab) { fab.resize(cell_box, 1, arena); };
69  auto make2i = [&] (amrex::FArrayBox& fab) { fab.resize(iface_box, 1, arena); };
70  auto make1 = [&] (amrex::FArrayBox& fab) { fab.resize(scal_box, 1, arena); };
71 
72  make2(col.zt); make2i(col.zi); make2(col.dz); make2(col.p_mid); make2i(col.p_int);
73  make2(col.rho); make2(col.theta); make2(col.exner); make2(col.theta_v); make2(col.thetal);
74  make2(col.qv); make2(col.qc); make2(col.qi); make2(col.qw); make2(col.tabs); make2(col.tke);
75  make2(col.u); make2(col.v); make2(col.w); make2(col.host_dse);
76  make1(col.pblh); make1(col.obklen); make1(col.ustar);
77  make2(col.shoc_mix); make2(col.brunt); make2(col.isotropy); make2(col.tk); make2(col.tkh);
78  make2(col.shear_prod); make2(col.buoy_prod); make2(col.diss_tke);
79  make2(col.wthv_sec); make2(col.shoc_cldfrac); make2(col.shoc_ql); make2(col.shoc_ql2);
80  make2(col.wqls_sec); make2(col.shoc_cond); make2(col.shoc_evap); make2i(col.thl_sec); make2i(col.qw_sec);
81  make2i(col.qwthl_sec); make2i(col.wthl_sec); make2i(col.wqw_sec); make2i(col.uw_sec);
82  make2i(col.vw_sec); make2i(col.wtke_sec); make2i(col.w3); make2(col.w_sec);
83  make2(col.thetal_base); make2(col.theta_base); make2(col.qv_base); make2(col.qc_base); make2(col.qi_base);
84  make2(col.u_base); make2(col.v_base); make2(col.tke_base_state);
85  make2(col.theta_tend); make2(col.qv_tend); make2(col.qc_tend); make2(col.qi_tend); make2(col.u_tend);
86  make2(col.v_tend); make2(col.tke_tend);
87  make1(col.surf_sens_flux); make1(col.surf_lat_flux); make1(col.surf_tau_u); make1(col.surf_tau_v);
88 
89  reset_shoc_column_data(col, init_run_on);
90 }
void reset_shoc_column_data(ShocColumnData &col, shoc::InitRunOn init_run_on=shoc::default_init_run_on())
Definition: ERF_ShocColumnData.H:45
amrex::FArrayBox theta_v
Definition: ERF_ShocTypes.H:216
amrex::FArrayBox theta
Definition: ERF_ShocTypes.H:214
amrex::FArrayBox qc_tend
Definition: ERF_ShocTypes.H:271
amrex::FArrayBox theta_base
Definition: ERF_ShocTypes.H:261
amrex::FArrayBox v_tend
Definition: ERF_ShocTypes.H:274
amrex::FArrayBox shoc_cond
Definition: ERF_ShocTypes.H:246
amrex::FArrayBox qi
Definition: ERF_ShocTypes.H:220
amrex::FArrayBox buoy_prod
Definition: ERF_ShocTypes.H:239
amrex::FArrayBox dz
Definition: ERF_ShocTypes.H:210
amrex::FArrayBox diss_tke
Definition: ERF_ShocTypes.H:240
amrex::FArrayBox w_sec
Definition: ERF_ShocTypes.H:258
amrex::FArrayBox tk
Definition: ERF_ShocTypes.H:236
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:257
amrex::FArrayBox vw_sec
Definition: ERF_ShocTypes.H:255
amrex::FArrayBox surf_lat_flux
Definition: ERF_ShocTypes.H:277
amrex::FArrayBox ustar
Definition: ERF_ShocTypes.H:232
amrex::FArrayBox shoc_evap
Definition: ERF_ShocTypes.H:247
amrex::FArrayBox shoc_mix
Definition: ERF_ShocTypes.H:233
amrex::FArrayBox v_base
Definition: ERF_ShocTypes.H:266
amrex::FArrayBox wthv_sec
Definition: ERF_ShocTypes.H:241
amrex::FArrayBox shear_prod
Definition: ERF_ShocTypes.H:238
amrex::FArrayBox rho
Definition: ERF_ShocTypes.H:213
amrex::FArrayBox tke_base_state
Definition: ERF_ShocTypes.H:267
amrex::FArrayBox wqw_sec
Definition: ERF_ShocTypes.H:253
amrex::FArrayBox qv_base
Definition: ERF_ShocTypes.H:262
amrex::FArrayBox shoc_ql
Definition: ERF_ShocTypes.H:243
amrex::FArrayBox uw_sec
Definition: ERF_ShocTypes.H:254
amrex::FArrayBox w
Definition: ERF_ShocTypes.H:226
amrex::FArrayBox host_dse
Definition: ERF_ShocTypes.H:227
amrex::FArrayBox pblh
Definition: ERF_ShocTypes.H:230
amrex::FArrayBox qc
Definition: ERF_ShocTypes.H:219
amrex::FArrayBox surf_tau_v
Definition: ERF_ShocTypes.H:279
amrex::FArrayBox isotropy
Definition: ERF_ShocTypes.H:235
amrex::FArrayBox tke
Definition: ERF_ShocTypes.H:223
amrex::FArrayBox p_int
Definition: ERF_ShocTypes.H:212
amrex::FArrayBox qw_sec
Definition: ERF_ShocTypes.H:250
amrex::FArrayBox qi_base
Definition: ERF_ShocTypes.H:264
amrex::FArrayBox tkh
Definition: ERF_ShocTypes.H:237
amrex::FArrayBox exner
Definition: ERF_ShocTypes.H:215
amrex::FArrayBox u_base
Definition: ERF_ShocTypes.H:265
amrex::FArrayBox tke_tend
Definition: ERF_ShocTypes.H:275
amrex::FArrayBox qi_tend
Definition: ERF_ShocTypes.H:272
amrex::FArrayBox qc_base
Definition: ERF_ShocTypes.H:263
amrex::FArrayBox u_tend
Definition: ERF_ShocTypes.H:273
ShocColumnLayout layout
Definition: ERF_ShocTypes.H:205
amrex::FArrayBox zi
Definition: ERF_ShocTypes.H:209
amrex::FArrayBox tabs
Definition: ERF_ShocTypes.H:222
amrex::FArrayBox surf_sens_flux
Definition: ERF_ShocTypes.H:276
amrex::FArrayBox qw
Definition: ERF_ShocTypes.H:221
amrex::FArrayBox v
Definition: ERF_ShocTypes.H:225
amrex::FArrayBox zt
Definition: ERF_ShocTypes.H:208
amrex::FArrayBox qv
Definition: ERF_ShocTypes.H:218
amrex::FArrayBox p_mid
Definition: ERF_ShocTypes.H:211
amrex::FArrayBox wtke_sec
Definition: ERF_ShocTypes.H:256
amrex::FArrayBox u
Definition: ERF_ShocTypes.H:224
amrex::FArrayBox theta_tend
Definition: ERF_ShocTypes.H:269
amrex::FArrayBox obklen
Definition: ERF_ShocTypes.H:231
amrex::FArrayBox wqls_sec
Definition: ERF_ShocTypes.H:245
amrex::FArrayBox surf_tau_u
Definition: ERF_ShocTypes.H:278
amrex::FArrayBox qv_tend
Definition: ERF_ShocTypes.H:270
amrex::FArrayBox wthl_sec
Definition: ERF_ShocTypes.H:252
amrex::FArrayBox thl_sec
Definition: ERF_ShocTypes.H:249
amrex::FArrayBox shoc_ql2
Definition: ERF_ShocTypes.H:244
amrex::FArrayBox thetal_base
Definition: ERF_ShocTypes.H:260
amrex::FArrayBox qwthl_sec
Definition: ERF_ShocTypes.H:251
amrex::FArrayBox brunt
Definition: ERF_ShocTypes.H:234
amrex::FArrayBox shoc_cldfrac
Definition: ERF_ShocTypes.H:242
amrex::FArrayBox thetal
Definition: ERF_ShocTypes.H:217
int nlev
Definition: ERF_ShocTypes.H:196
int ncell
Definition: ERF_ShocTypes.H:195

Referenced by ShocEnergyFixer::apply_column(), and ShocColumnWorkspace::ensure_capacity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ for_each_shoc_fab()

template<typename F >
void for_each_shoc_fab ( ShocColumnData col,
F &&  f 
)
inline
28 {
29  for (amrex::FArrayBox* fab : {&col.zt,&col.zi,&col.dz,&col.p_mid,&col.p_int,&col.rho,&col.theta,
30  &col.exner,&col.theta_v,&col.thetal,&col.qv,&col.qc,&col.qi,&col.qw,&col.tabs,&col.tke,
31  &col.u,&col.v,&col.w,&col.host_dse,&col.pblh,&col.obklen,&col.ustar,
32  &col.shoc_mix,&col.brunt,&col.isotropy,&col.tk,&col.tkh,&col.shear_prod,&col.buoy_prod,&col.diss_tke,&col.wthv_sec,
33  &col.shoc_cldfrac,&col.shoc_ql,&col.shoc_ql2,&col.wqls_sec,&col.shoc_cond,&col.shoc_evap,
34  &col.thl_sec,&col.qw_sec,&col.qwthl_sec,&col.wthl_sec,
35  &col.wqw_sec,&col.uw_sec,&col.vw_sec,&col.wtke_sec,&col.w3,&col.w_sec,
36  &col.thetal_base,&col.theta_base,&col.qv_base,&col.qc_base,&col.qi_base,
37  &col.u_base,&col.v_base,&col.tke_base_state,
38  &col.theta_tend,&col.qv_tend,&col.qc_tend,&col.qi_tend,&col.u_tend,&col.v_tend,&col.tke_tend,
39  &col.surf_sens_flux,&col.surf_lat_flux,&col.surf_tau_u,&col.surf_tau_v}) {
40  f(*fab);
41  }
42 }

Referenced by reset_shoc_column_data().

Here is the caller graph for this function:

◆ make_shoc_layout()

ShocColumnLayout make_shoc_layout ( const amrex::Box &  bx,
const amrex::Geometry &  geom 
)
inline
12 {
13  ShocColumnLayout layout;
14  layout.nx = bx.length(0);
15  layout.ny = bx.length(1);
16  layout.ncell = layout.nx * layout.ny;
17  layout.nlev = geom.Domain().length(2);
18  layout.imin = bx.smallEnd(0);
19  layout.jmin = bx.smallEnd(1);
20  layout.kmin = geom.Domain().smallEnd(2);
21  layout.kmax = geom.Domain().bigEnd(2);
22  return layout;
23 }
Definition: ERF_ShocTypes.H:192
int imin
Definition: ERF_ShocTypes.H:197
int kmax
Definition: ERF_ShocTypes.H:200
int jmin
Definition: ERF_ShocTypes.H:198
int ny
Definition: ERF_ShocTypes.H:194
int nx
Definition: ERF_ShocTypes.H:193
int kmin
Definition: ERF_ShocTypes.H:199

Referenced by ShocDriver::advance().

Here is the caller graph for this function:

◆ reset_shoc_column_data()

void reset_shoc_column_data ( ShocColumnData col,
shoc::InitRunOn  init_run_on = shoc::default_init_run_on() 
)
inline
47 {
48  for_each_shoc_fab(col, [&] (amrex::FArrayBox& fab) {
49  shoc::set_fab_val(fab, amrex::Real(0.0), init_run_on);
50  });
51 }
void for_each_shoc_fab(ShocColumnData &col, F &&f)
Definition: ERF_ShocColumnData.H:27
amrex::Real Real
Definition: ERF_ShocInterface.H:19
void set_fab_val(amrex::FArrayBox &fab, amrex::Real value, InitRunOn)
Definition: ERF_ShocGpuUtils.H:37

Referenced by define_shoc_column_data(), and ShocColumnWorkspace::ensure_capacity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shoc_column_index()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int shoc_column_index ( const ShocColumnLayout layout,
int  i,
int  j 
)
131 {
132  return (j - layout.jmin) * layout.nx + (i - layout.imin);
133 }

Referenced by ShocDriver::advance(), ShocDriver::debug_check_bad_column(), and ShocPreprocess::fill_columns().

Here is the caller graph for this function:

◆ shoc_layout_fits()

bool shoc_layout_fits ( const ShocColumnLayout active,
const ShocColumnLayout capacity 
)
inline
95 {
96  return capacity.ncell >= active.ncell &&
97  capacity.nlev >= active.nlev &&
98  capacity.kmin == active.kmin &&
99  capacity.kmax == active.kmax;
100 }

Referenced by ShocColumnWorkspace::ensure_capacity().

Here is the caller graph for this function: