ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SetupVertDiff.H
Go to the documentation of this file.
1  const auto& dom_lo = lbound(domain);
2  const auto& dom_hi = ubound(domain);
3  amrex::ignore_unused(dom_lo, dom_hi);
4 
5  DiffChoice diffChoice = solverChoice.diffChoice;
6  TurbChoice turbChoice = solverChoice.turbChoice[level];
7 
10 
11  // Theta, KE, Scalar
12  Vector<Real> alpha_eff(NPRIMVAR_max, zero);
13  if (l_consA) {
14  for (int i = 0; i < NPRIMVAR_max; ++i) {
15  switch (i) {
16  case PrimTheta_comp:
18  break;
19  case PrimScalar_comp:
21  break;
22  case PrimQ1_comp:
24  break;
25  case PrimQ2_comp:
27  break;
28  case PrimQ3_comp:
30  break;
31  case PrimQ4_comp:
33  break;
34  case PrimQ5_comp:
36  break;
37  case PrimQ6_comp:
39  break;
40  default:
41  alpha_eff[i] = zero;
42  break;
43  }
44  }
45  } else {
46  for (int i = 0; i < NPRIMVAR_max; ++i) {
47  switch (i) {
48  case PrimTheta_comp:
50  break;
51  case PrimScalar_comp:
53  break;
54  case PrimQ1_comp:
56  break;
57  case PrimQ2_comp:
59  break;
60  case PrimQ3_comp:
62  break;
63  case PrimQ4_comp:
65  break;
66  case PrimQ5_comp:
68  break;
69  case PrimQ6_comp:
71  break;
72  default:
73  alpha_eff[i] = zero;
74  break;
75  }
76  }
77  }
78 
79  // The number of quantities following Scalar_h must be equal to the number
80  // of quantities in the conserved state following RhoScalar_comp -- this is
81  // currently all the moist quantities, which tops out at 11 for the Morrison model
82  Vector<int> eddy_diff_idz{EddyDiff::Theta_v, EddyDiff::KE_v, EddyDiff::Scalar_v,
87 
88  // Device vectors
89  Gpu::AsyncVector<Real> alpha_eff_d;
90  Gpu::AsyncVector<int> eddy_diff_idz_d;
91  alpha_eff_d.resize(alpha_eff.size());
92  eddy_diff_idz_d.resize(eddy_diff_idz.size());
93 
94  Gpu::copy(Gpu::hostToDevice, alpha_eff.begin() , alpha_eff.end() , alpha_eff_d.begin());
95  Gpu::copy(Gpu::hostToDevice, eddy_diff_idz.begin(), eddy_diff_idz.end(), eddy_diff_idz_d.begin());
96 
97  // Capture pointers for device code
99  [[maybe_unused]] int* d_eddy_diff_idz = eddy_diff_idz_d.data();
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
#define PrimQ1_comp
Definition: ERF_IndexDefines.H:58
#define NPRIMVAR_max
Definition: ERF_IndexDefines.H:33
#define PrimQ2_comp
Definition: ERF_IndexDefines.H:59
#define PrimQ4_comp
Definition: ERF_IndexDefines.H:61
#define PrimQ6_comp
Definition: ERF_IndexDefines.H:63
#define PrimQ5_comp
Definition: ERF_IndexDefines.H:62
#define PrimTheta_comp
Definition: ERF_IndexDefines.H:55
#define PrimScalar_comp
Definition: ERF_IndexDefines.H:57
#define PrimQ3_comp
Definition: ERF_IndexDefines.H:60
Gpu::AsyncVector< int > eddy_diff_idz_d
Definition: ERF_SetupVertDiff.H:90
const auto & dom_hi
Definition: ERF_SetupVertDiff.H:2
bool l_turb
Definition: ERF_SetupVertDiff.H:9
const auto & dom_lo
Definition: ERF_SetupVertDiff.H:1
bool l_consA
Definition: ERF_SetupVertDiff.H:8
Vector< Real > alpha_eff(NPRIMVAR_max, zero)
TurbChoice turbChoice
Definition: ERF_SetupVertDiff.H:6
int * d_eddy_diff_idz
Definition: ERF_SetupVertDiff.H:99
DiffChoice diffChoice
Definition: ERF_SetupVertDiff.H:5
Real * d_alpha_eff
Definition: ERF_SetupVertDiff.H:98
Gpu::AsyncVector< Real > alpha_eff_d
Definition: ERF_SetupVertDiff.H:89
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ Theta_v
Definition: ERF_IndexDefines.H:210
@ Scalar_v
Definition: ERF_IndexDefines.H:212
@ Q_v
Definition: ERF_IndexDefines.H:213
@ KE_v
Definition: ERF_IndexDefines.H:211
Definition: ERF_DiffStruct.H:19
amrex::Real rhoAlpha_C
Definition: ERF_DiffStruct.H:95
amrex::Real rhoAlpha_T
Definition: ERF_DiffStruct.H:94
amrex::Real alpha_T
Definition: ERF_DiffStruct.H:87
amrex::Real alpha_C
Definition: ERF_DiffStruct.H:88
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
Definition: ERF_TurbStruct.H:82
bool use_kturb
Definition: ERF_TurbStruct.H:465