ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ProblemBase Class Referenceabstract

#include <ERF_ProbCommon.H>

Collaboration diagram for ProblemBase:

Public Member Functions

virtual ~ProblemBase ()=default
 
virtual void erf_init_dens_hse (amrex::MultiFab &, std::unique_ptr< amrex::MultiFab > &, std::unique_ptr< amrex::MultiFab > &, amrex::Geometry const &)
 
virtual void erf_init_dens_hse_moist (amrex::MultiFab &, std::unique_ptr< amrex::MultiFab > &, amrex::Geometry const &)
 
virtual void init_custom_pert (const amrex::Box &, const amrex::Box &, const amrex::Box &, const amrex::Box &, amrex::Array4< amrex::Real const > const &, amrex::Array4< amrex::Real > const &, amrex::Array4< amrex::Real > const &, amrex::Array4< amrex::Real > const &, amrex::Array4< amrex::Real > const &, amrex::Array4< amrex::Real > const &, amrex::Array4< amrex::Real > const &, amrex::Array4< amrex::Real const > const &, amrex::Array4< amrex::Real const > const &, amrex::GeometryData const &, amrex::Array4< amrex::Real const > const &, amrex::Array4< amrex::Real const > const &, amrex::Array4< amrex::Real const > const &, const SolverChoice &)
 
virtual void update_rhotheta_sources (const amrex::Real &, amrex::Vector< amrex::Real > &src, amrex::Gpu::DeviceVector< amrex::Real > &d_src, const amrex::Geometry &geom, std::unique_ptr< amrex::MultiFab > &z_phys_cc)
 
virtual void update_rhoqt_sources (const amrex::Real &, amrex::Vector< amrex::Real > &qsrc, amrex::Gpu::DeviceVector< amrex::Real > &d_qsrc, const amrex::Geometry &geom, std::unique_ptr< amrex::MultiFab > &z_phys_cc)
 
virtual void update_w_subsidence (const amrex::Real &, amrex::Vector< amrex::Real > &wbar, amrex::Gpu::DeviceVector< amrex::Real > &d_wbar, const amrex::Geometry &geom, std::unique_ptr< amrex::MultiFab > &z_phys_cc)
 
virtual void update_geostrophic_profile (const amrex::Real &, amrex::Vector< amrex::Real > &u_geos, amrex::Gpu::DeviceVector< amrex::Real > &d_u_geos, amrex::Vector< amrex::Real > &v_geos, amrex::Gpu::DeviceVector< amrex::Real > &d_v_geos, const amrex::Geometry &geom, std::unique_ptr< amrex::MultiFab > &z_phys_cc)
 
void init_terrain_surface (const amrex::Geometry &geom, amrex::FArrayBox &terrain_fab, const amrex::Real &time)
 
void read_custom_terrain (const std::string &fname, const bool is_usgs, const amrex::Geometry &geom, amrex::FArrayBox &terrain_fab, const amrex::Real &)
 
virtual void init_custom_terrain (const amrex::Geometry &, amrex::FArrayBox &terrain_fab, const amrex::Real &)
 
virtual void erf_init_rayleigh (amrex::Vector< amrex::Vector< amrex::Real > > &, amrex::Geometry const &, std::unique_ptr< amrex::MultiFab > &, amrex::Real)
 
void init_uniform (const amrex::Box &bx, amrex::Array4< amrex::Real > const &state)
 

Protected Member Functions

void init_base_parms (amrex::Real rho_0, amrex::Real T_0)
 
virtual std::string name ()=0
 

Protected Attributes

ProbParmDefaults base_parms
 

Detailed Description

Class to hold problem-specific routines

Constructor & Destructor Documentation

◆ ~ProblemBase()

virtual ProblemBase::~ProblemBase ( )
virtualdefault

Virtual destructor to avoid data leakage with derived class

Member Function Documentation

◆ erf_init_dens_hse()

virtual void ProblemBase::erf_init_dens_hse ( amrex::MultiFab &  ,
std::unique_ptr< amrex::MultiFab > &  ,
std::unique_ptr< amrex::MultiFab > &  ,
amrex::Geometry const &   
)
inlinevirtual

Function to initialize the hydrostatic reference density

Parameters
[out]rho_hsehydrostatic reference density
[in]z_phys_ndheight coordinate at nodes
[in]z_phys_ccheight coordinate at cell centers
[in]geomcontainer for geometric information
44  {
45  amrex::Print() << "Hydrostatically balanced density was NOT set"
46  << " -- an appropriate init_type should probably have been specified"
47  << " (e.g., input_sounding, ideal, real, or metgrid)"
48  << std::endl;
49  amrex::Error("Should never call erf_init_dens_hse for "+name()+" problem");
50  }
virtual std::string name()=0
Here is the call graph for this function:

◆ erf_init_dens_hse_moist()

virtual void ProblemBase::erf_init_dens_hse_moist ( amrex::MultiFab &  ,
std::unique_ptr< amrex::MultiFab > &  ,
amrex::Geometry const &   
)
inlinevirtual
56  {
57 
58  }

◆ erf_init_rayleigh()

virtual void ProblemBase::erf_init_rayleigh ( amrex::Vector< amrex::Vector< amrex::Real > > &  ,
amrex::Geometry const &  ,
std::unique_ptr< amrex::MultiFab > &  ,
amrex::Real   
)
inlinevirtual

Function to define the quantities needed to impose Rayleigh damping

Parameters
[out]rayleigh_ptrs= {strength of Rayleigh damping, reference values for xvel/yvel/zvel/theta used to define Rayleigh damping}
[in]geomcontainer for geometric information
[in]z_phys_ccheight coordinate at cell centers
526  {
527  amrex::Error("Should never call erf_init_rayleigh for "+name()+" problem");
528  }
Here is the call graph for this function:

◆ init_base_parms()

void ProblemBase::init_base_parms ( amrex::Real  rho_0,
amrex::Real  T_0 
)
inlineprotected

Function to update default base parameters, currently only used for init_type == InitType::Uniform

557  {
558  base_parms.rho_0 = rho_0;
559  base_parms.T_0 = T_0;
560  }
ProbParmDefaults base_parms
Definition: ERF_ProbCommon.H:551
amrex::Real T_0
Definition: ERF_ProbCommon.H:16
amrex::Real rho_0
Definition: ERF_ProbCommon.H:15

◆ init_custom_pert()

virtual void ProblemBase::init_custom_pert ( const amrex::Box &  ,
const amrex::Box &  ,
const amrex::Box &  ,
const amrex::Box &  ,
amrex::Array4< amrex::Real const > const &  ,
amrex::Array4< amrex::Real > const &  ,
amrex::Array4< amrex::Real > const &  ,
amrex::Array4< amrex::Real > const &  ,
amrex::Array4< amrex::Real > const &  ,
amrex::Array4< amrex::Real > const &  ,
amrex::Array4< amrex::Real > const &  ,
amrex::Array4< amrex::Real const > const &  ,
amrex::Array4< amrex::Real const > const &  ,
amrex::GeometryData const &  ,
amrex::Array4< amrex::Real const > const &  ,
amrex::Array4< amrex::Real const > const &  ,
amrex::Array4< amrex::Real const > const &  ,
const SolverChoice  
)
inlinevirtual

Function to perform custom initialization of a test problem

Parameters
[in]bxcell-centered box on which to initialize scalars
[in]xbxbox on which to initialize x-component of velocity
[in]ybxbox on which to initialize y-component of velocity
[in]zbxbox on which to initialize z-component of velocity
[out]statecell-centered variables to be filled in this routine
[out]x_velocityx-component of velocity to be filled in this routine
[out]y_velocityy-component of velocity to be filled in this routine
[out]z_velocityz-component of velocity to be filled in this routine
[out]r_hsehydrostatic reference density
[out]p_hsehydrostatic reference pressure
[in]z_ndheight coordinate at nodes
[in]z_ccheight coordinate at cell centers
[in]qvwater vapor
[in]qccloud water
[in]qicloud ice
[in]mf_mmap factor on cell centers
[in]mf_umap factor on x-faces
[in]mf_vmap factor on y-faces
[in]scSolverChoice structure that carries parameters
102  {
103  amrex::Print() << "No perturbation to background fields supplied for "
104  << name() << " problem" << std::endl;
105  }
Here is the call graph for this function:

◆ init_custom_terrain()

virtual void ProblemBase::init_custom_terrain ( const amrex::Geometry &  ,
amrex::FArrayBox &  terrain_fab,
const amrex::Real &   
)
inlinevirtual

Function to perform custom initialization of terrain

Note: Terrain functionality can also be used to provide grid stretching.

Parameters
[in]geomcontainer for geometric information
[out]terrain_mfheight coordinate at nodes
[in]timecurrent time
499  {
500  amrex::Print() << "Initializing flat terrain" << std::endl;
501 
502  terrain_fab.template setVal<amrex::RunOn::Device>(0.0);
503 
505  }
static void set_flat_terrain_flag()
Definition: ERF_DataStruct.H:586

Referenced by init_terrain_surface().

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

◆ init_terrain_surface()

void ProblemBase::init_terrain_surface ( const amrex::Geometry &  geom,
amrex::FArrayBox &  terrain_fab,
const amrex::Real &  time 
)
inline

Function to perform custom initialization of terrain

Parameters
[in]geomcontainer for geometric information
[out]z_phys_ndheight coordinate at nodes
[in]timecurrent time
273  {
274  // Check if a valid text file exists for the terrain
275  std::string fname, fname_usgs;
276  amrex::ParmParse pp("erf");
277  auto valid_fname = pp.query("terrain_file_name",fname);
278  auto valid_fname_USGS = pp.query("terrain_file_name_USGS",fname_usgs);
279 
280  bool is_usgs;
281 
282  if (valid_fname) {
283  is_usgs = false;
284  read_custom_terrain(fname,is_usgs,geom,terrain_fab,time);
285 
286  } else if (valid_fname_USGS) {
287  is_usgs = true;
288  read_custom_terrain(fname_usgs,is_usgs,geom,terrain_fab,time);
289 
290  } else {
291  init_custom_terrain (geom, terrain_fab, time);
292  }
293  }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:219
void read_custom_terrain(const std::string &fname, const bool is_usgs, const amrex::Geometry &geom, amrex::FArrayBox &terrain_fab, const amrex::Real &)
Definition: ERF_ProbCommon.H:296
virtual void init_custom_terrain(const amrex::Geometry &, amrex::FArrayBox &terrain_fab, const amrex::Real &)
Definition: ERF_ProbCommon.H:496
Here is the call graph for this function:

◆ init_uniform()

void ProblemBase::init_uniform ( const amrex::Box &  bx,
amrex::Array4< amrex::Real > const &  state 
)
inline

Function to set uniform background density and pressure fields

535  {
536  amrex::Real rho_0 = base_parms.rho_0;
537  amrex::Real T_0 = base_parms.T_0;
538  amrex::Print() << "Initializing uniform fields"
539  << " rho=" << rho_0 << " theta=" << T_0
540  << std::endl;
541 
542  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
543  {
544  state(i, j, k, Rho_comp) = rho_0;
545  state(i, j, k, RhoTheta_comp) = rho_0 * T_0;
546  });
547  }
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37

◆ name()

virtual std::string ProblemBase::name ( )
protectedpure virtual

◆ read_custom_terrain()

void ProblemBase::read_custom_terrain ( const std::string &  fname,
const bool  is_usgs,
const amrex::Geometry &  geom,
amrex::FArrayBox &  terrain_fab,
const amrex::Real &   
)
inline
301  {
302  amrex::Vector<amrex::Real> m_xterrain,m_yterrain,m_zterrain;
303 
304  int nx = 0; int ny = 0;
305 
306  if (amrex::ParallelDescriptor::IOProcessor()) {
307  // Read terrain file
308  amrex::Print()<<"Reading terrain file: "<< fname<< std::endl;
309  std::ifstream file(fname);
310 
311  if (!file.is_open()) {
312  amrex::Abort("Error: Could not open the file " + fname+ "\n");
313  }
314 
315  // Check if file is empty
316  if (file.peek() == std::ifstream::traits_type::eof()) {
317  amrex::Abort("Error: The file " + fname+ " is empty.\n");
318  }
319 
320  amrex::Real value1,value2,value3;
321 
322  if (is_usgs) {
323  amrex::Real lat_min, lon_min;
324 
325  file >> lon_min >> lat_min;
326  if(std::fabs(lon_min) > 180.0) {
327  amrex::Error("The value of longitude for entry in the first line in " + fname
328  + " should not exceed 180. It is " + std::to_string(lon_min));
329  }
330  if(std::fabs(lat_min) > 90.0) {
331  amrex::Error("The value of latitude for entry in the first line in " + fname
332  + " should not exceed 90. It is " + std::to_string(lat_min));
333  }
334 
335  file >> nx >> ny;
336 
337  int counter = 0;
338  while (file >> value1 >> value2 >> value3) {
339  m_xterrain.push_back(value1);
340  if(counter%nx==0) {
341  m_yterrain.push_back(value2);
342  }
343  m_zterrain.push_back(value3);
344  counter += 1;
345  }
346  AMREX_ASSERT(m_xterrain.size() == static_cast<long int>(nx*ny));
347  AMREX_ASSERT(m_yterrain.size() == static_cast<long int>(ny));
348  AMREX_ASSERT(m_zterrain.size() == static_cast<long int>(nx*ny));
349 
350  } else {
351  file >> nx; file >> ny;
352  AMREX_ALWAYS_ASSERT(nx > 0);
353  AMREX_ALWAYS_ASSERT(ny > 0);
354  m_xterrain.resize(nx);
355  m_yterrain.resize(ny);
356  m_zterrain.resize(nx * ny);
357  for (int n = 0; n < nx; n++) {
358  file >> m_xterrain[n];
359  }
360  for (int n = 0; n < ny; n++) {
361  file >> m_yterrain[n];
362  }
363  for (int n = 0; n < nx * ny; n++) {
364  file >> m_zterrain[n];
365  }
366  }
367 
368  amrex::Print() << "NX " << nx << " " << ny << std::endl;
369 
370  // Close the file after reading
371  file.close();
372  }
373 
374  amrex::ParallelDescriptor::Bcast(&nx,1,amrex::ParallelDescriptor::IOProcessorNumber());
375  amrex::ParallelDescriptor::Bcast(&ny,1,amrex::ParallelDescriptor::IOProcessorNumber());
376 
377  int nz = nx * ny;
378 
379  m_xterrain.resize(nx);
380  m_yterrain.resize(ny);
381  m_zterrain.resize(nz);
382 
383  amrex::ParallelDescriptor::Bcast(m_xterrain.data(),nx,amrex::ParallelDescriptor::IOProcessorNumber());
384  amrex::ParallelDescriptor::Bcast(m_yterrain.data(),ny,amrex::ParallelDescriptor::IOProcessorNumber());
385  amrex::ParallelDescriptor::Bcast(m_zterrain.data(),nz,amrex::ParallelDescriptor::IOProcessorNumber());
386 
387  // Copy data to the GPU
388  amrex::Gpu::DeviceVector<amrex::Real> d_xterrain(nx),d_yterrain(ny),d_zterrain(nz);
389  amrex::Gpu::copy(amrex::Gpu::hostToDevice, m_xterrain.begin(), m_xterrain.end(), d_xterrain.begin());
390  amrex::Gpu::copy(amrex::Gpu::hostToDevice, m_yterrain.begin(), m_yterrain.end(), d_yterrain.begin());
391  amrex::Gpu::copy(amrex::Gpu::hostToDevice, m_zterrain.begin(), m_zterrain.end(), d_zterrain.begin());
392 
393  amrex::Real* d_xt = d_xterrain.data();
394  amrex::Real* d_yt = d_yterrain.data();
395  amrex::Real* d_zt = d_zterrain.data();
396 
397  auto dx = geom.CellSizeArray();
398  auto ProbLoArr = geom.ProbLoArray();
399 
400  int ilo = geom.Domain().smallEnd(0);
401  int jlo = geom.Domain().smallEnd(1);
402  int klo = geom.Domain().smallEnd(2);
403  int ihi = geom.Domain().bigEnd(0) + 1;
404  int jhi = geom.Domain().bigEnd(1) + 1;
405 
406  amrex::Box zbx = terrain_fab.box();
407  amrex::Array4<amrex::Real> const& z_arr = terrain_fab.array();
408 
409  amrex::ParallelFor(zbx, [=] AMREX_GPU_DEVICE (int i, int j, int /*k*/)
410  {
411  // Clip indices for ghost cells
412  int ii = amrex::min(amrex::max(i,ilo),ihi);
413  int jj = amrex::min(amrex::max(j,jlo),jhi);
414 
415  // Location of nodes
416  amrex::Real x = ProbLoArr[0] + ii * dx[0] + 1e-3;
417  amrex::Real y = ProbLoArr[1] + jj * dx[1] + 1e-3;
418 
419  int jindex_terrain = -1;
420  for (int it = 0; it < ny && jindex_terrain == -1; it++) {
421  if (d_yt[it] > y) {
422  jindex_terrain = it-1;
423  }
424  }
425  if (jindex_terrain == -1) {
426  jindex_terrain = ny-1;
427  }
428 
429  int ind11, ind12, ind21, ind22;
430  amrex::Real x1, x2, y1, y2;
431 
432  int iindex_terrain=-1;
433  if (is_usgs) {
434  int gstart = (jindex_terrain )*nx;
435  int gend = (jindex_terrain+1)*nx-1;
436  for (int it = gstart; it <= gend && iindex_terrain == -1; it++) {
437  if (d_xt[it] > x) {
438  iindex_terrain = it-gstart;
439  }
440  }
441 
442  // Define the four values to interpolate between
443  ind11 = jindex_terrain*nx + iindex_terrain;
444  ind12 = ind11+nx;
445  ind21 = ind11+1;
446  ind22 = ind12+1;
447  x1 = d_xt[ind11];
448  x2 = d_xt[ind21];
449  y1 = d_yt[jindex_terrain];
450  y2 = d_yt[jindex_terrain+1];
451 
452  } else {
453  for (int it = 0; it < nx && iindex_terrain == -1; it++) {
454  if (d_xt[it] > x) {
455  iindex_terrain = it-1;
456  }
457  }
458  if (iindex_terrain == -1) {
459  iindex_terrain = nx-1;
460  }
461 
462  // Define the four values to interpolate between
463  x1 = d_xt[iindex_terrain];
464  x2 = d_xt[iindex_terrain+1];
465  y1 = d_yt[jindex_terrain];
466  y2 = d_yt[jindex_terrain+1];
467 
468  ind11 = jindex_terrain * nx + iindex_terrain;
469  ind21 = std::min(jindex_terrain+1,ny-1) * nx + iindex_terrain;
470 
471  ind12 = jindex_terrain * nx + std::min(iindex_terrain+1,nx-1);
472  ind22 = std::min(jindex_terrain+1,ny-1) * nx + std::min(iindex_terrain+1,nx-1);
473  }
474 
475  // Do bilinear interpolation
476  amrex::Real denom = (x2-x1)*(y2-y1);
477  amrex::Real w_11 = (x2-x)*(y2-y)/denom;
478  amrex::Real w_12 = (x2-x)*(y-y1)/denom;
479  amrex::Real w_21 = (x-x1)*(y2-y)/denom;
480  amrex::Real w_22 = (x-x1)*(y-y1)/denom;
481 
482  z_arr(i,j,klo) = w_11*d_zt[ind11] + w_12*d_zt[ind12] + w_21*d_zt[ind21] + w_22*d_zt[ind22];
483  });
484  }

Referenced by init_terrain_surface().

Here is the caller graph for this function:

◆ update_geostrophic_profile()

virtual void ProblemBase::update_geostrophic_profile ( const amrex::Real &  ,
amrex::Vector< amrex::Real > &  u_geos,
amrex::Gpu::DeviceVector< amrex::Real > &  d_u_geos,
amrex::Vector< amrex::Real > &  v_geos,
amrex::Gpu::DeviceVector< amrex::Real > &  d_v_geos,
const amrex::Geometry &  geom,
std::unique_ptr< amrex::MultiFab > &  z_phys_cc 
)
inlinevirtual

Function to update user-specified geostrophic wind profile.

Parameters
[in]timecurrent time
[out]u_geosgeostrophic wind profile
[out]v_geosgeostrophic wind profile
[in]geomcontainer for geometric information
[in]z_phys_ccheight coordinate at cell centers
238  {
239  if (u_geos.empty()) return;
240 
241  if (z_phys_cc) {
242  // use_terrain=1
243  amrex::Error("Geostrophic wind profile not defined for "+name()+" problem with terrain");
244  } else {
245  const int khi = geom.Domain().bigEnd()[2];
246  // const amrex::Real* prob_lo = geom.ProbLo();
247  // const auto dx = geom.CellSize();
248  for (int k = 0; k <= khi; k++)
249  {
250  // const amrex::Real z_cc = prob_lo[2] + (k+0.5)* dx[2];
251  // set RHS term of RhoTheta equation based on time, z_cc here
252  u_geos[k] = 0.0;
253  v_geos[k] = 0.0;
254  }
255  }
256 
257  // Copy from host version to device version
258  amrex::Gpu::copy(amrex::Gpu::hostToDevice, u_geos.begin(), u_geos.end(), d_u_geos.begin());
259  amrex::Gpu::copy(amrex::Gpu::hostToDevice, v_geos.begin(), v_geos.end(), d_v_geos.begin());
260  }
Here is the call graph for this function:

◆ update_rhoqt_sources()

virtual void ProblemBase::update_rhoqt_sources ( const amrex::Real &  ,
amrex::Vector< amrex::Real > &  qsrc,
amrex::Gpu::DeviceVector< amrex::Real > &  d_qsrc,
const amrex::Geometry &  geom,
std::unique_ptr< amrex::MultiFab > &  z_phys_cc 
)
inlinevirtual

Function to update user-specified moisture source terms that can vary with time and height.

Parameters
[in]timecurrent time
[out]rhoqt_sourcemoisture forcing profile
[in]geomcontainer for geometric information
[in]z_phys_ccheight coordinate at cell centers
159  {
160  if (qsrc.empty()) return;
161 
162  if (z_phys_cc) {
163  // use_terrain=1
164  amrex::Error("Moisture forcing not defined for "+name()+" problem with terrain");
165  } else {
166  const int khi = geom.Domain().bigEnd()[2];
167  // const amrex::Real* prob_lo = geom.ProbLo();
168  // const auto dx = geom.CellSize();
169  for (int k = 0; k <= khi; k++)
170  {
171  // const amrex::Real z_cc = prob_lo[2] + (k+0.5)* dx[2];
172  // set RHS term of RhoQ1 equation based on time, z_cc here
173  qsrc[k] = 0.0;
174  }
175  }
176 
177  // Copy from host version to device version
178  amrex::Gpu::copy(amrex::Gpu::hostToDevice, qsrc.begin(), qsrc.end(), d_qsrc.begin());
179  }
Here is the call graph for this function:

◆ update_rhotheta_sources()

virtual void ProblemBase::update_rhotheta_sources ( const amrex::Real &  ,
amrex::Vector< amrex::Real > &  src,
amrex::Gpu::DeviceVector< amrex::Real > &  d_src,
const amrex::Geometry &  geom,
std::unique_ptr< amrex::MultiFab > &  z_phys_cc 
)
inlinevirtual

Function to update user-specified temperature source terms that can vary with time and height.

Parameters
[in]timecurrent time
[out]rhotheta_sourceforcing profile
[in]geomcontainer for geometric information
[in]z_phys_ccheight coordinate at cell centers
122  {
123  if (src.empty()) return;
124 
125  if (z_phys_cc) {
126  // use_terrain=1
127  amrex::Error("Temperature forcing not defined for "+name()+" problem with terrain");
128  } else {
129  const int khi = geom.Domain().bigEnd()[2];
130  // const amrex::Real* prob_lo = geom.ProbLo();
131  // const auto dx = geom.CellSize();
132  for (int k = 0; k <= khi; k++)
133  {
134  // const amrex::Real z_cc = prob_lo[2] + (k+0.5)* dx[2];
135  // set RHS term of RhoTheta equation based on time, z_cc here
136  src[k] = 0.0;
137  }
138  }
139 
140  // Copy from host version to device version
141  amrex::Gpu::copy(amrex::Gpu::hostToDevice, src.begin(), src.end(), d_src.begin());
142  }
Here is the call graph for this function:

◆ update_w_subsidence()

virtual void ProblemBase::update_w_subsidence ( const amrex::Real &  ,
amrex::Vector< amrex::Real > &  wbar,
amrex::Gpu::DeviceVector< amrex::Real > &  d_wbar,
const amrex::Geometry &  geom,
std::unique_ptr< amrex::MultiFab > &  z_phys_cc 
)
inlinevirtual

Function to update the vertical velocity profile, used to add subsidence source terms for x-mom, y-mom, rho*theta, rho*Q1, and rho*Q2.

TODO: Currently, this is only called by InitData, so there is no time dependence.

Parameters
[in]timecurrent time
[out]wbarw vel forcing profile
[in]geomcontainer for geometric information
[in]z_phys_ccheight coordinate at cell centers
199  {
200  if (wbar.empty()) return;
201 
202  if (z_phys_cc) {
203  // use_terrain=1
204  amrex::Error("Moisture forcing not defined for "+name()+" problem with terrain");
205  } else {
206  const int khi = geom.Domain().bigEnd()[2];
207  // const amrex::Real* prob_lo = geom.ProbLo();
208  // const auto dx = geom.CellSize();
209  for (int k = 0; k <= khi; k++)
210  {
211  // const amrex::Real z_cc = prob_lo[2] + (k+0.5)* dx[2];
212  // set vertical velocity profile based on time, z_cc here
213  wbar[k] = 0.0;
214  }
215  }
216 
217  // Copy from host version to device version
218  amrex::Gpu::copy(amrex::Gpu::hostToDevice, wbar.begin(), wbar.end(), d_wbar.begin());
219  }
@ wbar
Definition: ERF_DataStruct.H:70
Here is the call graph for this function:

Member Data Documentation

◆ base_parms

ProbParmDefaults ProblemBase::base_parms
protected

Referenced by init_base_parms(), and init_uniform().


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