ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_UpdateRhoThetaSources_SDMCongestus3D.H
Go to the documentation of this file.
1  ParmParse pp_prob("prob");
2 
3  Real advection_heating_rate = amrex::Real(5.4e-5); pp_prob.query("advection_heating_rate" , advection_heating_rate);
4  Real advection_heating_rate_base = amrex::Real(5.4e-5); pp_prob.query("advection_heating_rate_base", advection_heating_rate_base);
5 
6  auto prob_lo = geom.ProbLoArray();
7  auto prob_hi = geom.ProbHiArray();
8  auto dx = geom.CellSizeArray();
9 
10  // Define a point (xc,yc,zc) at the center of the domain
11  const Real xc = myhalf * (prob_lo[0] + prob_hi[0]);
12  const Real yc = myhalf * (prob_lo[1] + prob_hi[1]);
13 
14  // Only apply temperature source below nominal inversion height
15  for (MFIter mfi(*src, TilingIfNotGPU()); mfi.isValid(); ++mfi)
16  {
17  const auto &box = mfi.tilebox();
18  const Array4<Real>& src_arr = src->array(mfi);
19  if (box.length(0) != 1)
20  {
21  // if z dimension size is 1, then src is a spatially varying function over x,y at k=0
22  ParallelFor( box, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
23  {
24  auto x = prob_lo[0] + (i + myhalf) * dx[0];
25  auto y = prob_lo[1] + (j + myhalf) * dx[1];
26  auto z = prob_lo[2] + (k + myhalf) * dx[2];
27 
28  auto c = amrex::Real(2890000.0);
29  auto r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc));
30  auto rsqr = r*r;
31  if (time < 3600) {
32  src_arr(i, j, k) = (advection_heating_rate_base)*std::exp(-z/100);
33  } else {
34  src_arr(i, j, k) = (advection_heating_rate*std::exp(-rsqr / c)) * std::exp(-z*amrex::Real(0.01));
35  }
36  });
37  } else {
38  // src is a function over Z
39  ParallelFor(box, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
40  src_arr(i, j, k) = advection_heating_rate;
41  });
42  }
43  }
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
ParallelFor(grown_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
auto prob_lo
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:6
Real advection_heating_rate
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:3
const Real yc
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:12
ParmParse pp_prob("prob")
Real advection_heating_rate_base
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:4
auto prob_hi
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:7
const Real xc
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:11
auto dx
Definition: ERF_UpdateRhoThetaSources_SDMCongestus3D.H:8