ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SetupDiff.H
Go to the documentation of this file.
1 /** \cond */
2  // include common definitions used in the implicit diffusion solve
3 #include "ERF_SetupVertDiff.H"
4 
5  const Real dx_inv = cellSizeInv[0];
6  const Real dy_inv = cellSizeInv[1];
7 
8  const Box xbx = surroundingNodes(bx,0);
9  const Box ybx = surroundingNodes(bx,1);
10  const Box zbx = surroundingNodes(bx,2);
11 
12  [[maybe_unused]] const int end_comp = start_comp + num_comp - 1;
13  [[maybe_unused]] bool l_use_keqn = turbChoice.use_keqn;
14  [[maybe_unused]] bool l_use_mynn = turbChoice.use_pbl_tke;
15 
16  // used by ERF_AddTKESources.H
17  [[maybe_unused]] const bool use_ref_theta = (turbChoice.theta_ref > 0);
18  [[maybe_unused]] const Real l_inv_theta0 = (use_ref_theta) ? one / turbChoice.theta_ref : one;
19 
20  // vertical diffusivities are defined in ERF_SetupVertDiff.H
21  // The number of quantities following Scalar_h must be equal to the number
22  // of quantities in the conserved state following RhoScalar_comp -- this is
23  // currently all the moist quantities, which tops out at 11 for the Morrison model
24  Vector<int> eddy_diff_idx{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::Scalar_h,
29  Vector<int> eddy_diff_idy{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::Scalar_h,
34 
35  // Device vectors
36  Gpu::AsyncVector<int> eddy_diff_idx_d;
37  Gpu::AsyncVector<int> eddy_diff_idy_d;
38 
39  eddy_diff_idx_d.resize(eddy_diff_idx.size());
40  eddy_diff_idy_d.resize(eddy_diff_idy.size());
41 
42  Gpu::copy(Gpu::hostToDevice, eddy_diff_idx.begin(), eddy_diff_idx.end(), eddy_diff_idx_d.begin());
43  Gpu::copy(Gpu::hostToDevice, eddy_diff_idy.begin(), eddy_diff_idy.end(), eddy_diff_idy_d.begin());
44 
45  // Capture pointers for device code
46  int* d_eddy_diff_idx = eddy_diff_idx_d.data();
47  int* d_eddy_diff_idy = eddy_diff_idy_d.data();
48 /** \endcond */
constexpr amrex::Real one
Definition: ERF_Constants.H:9
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ Q_h
Definition: ERF_IndexDefines.H:210
@ Scalar_h
Definition: ERF_IndexDefines.H:209
@ Theta_h
Definition: ERF_IndexDefines.H:207
@ KE_h
Definition: ERF_IndexDefines.H:208