ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
SDCellCounts Struct Reference

Numbers of super-droplets and of physical particles that an initialization, or one per-cell injection step, places in a cell of volume a_dv. More...

#include <ERF_SDInitialization.H>

Collaboration diagram for SDCellCounts:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool densityMode () const noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int numSD (const amrex::Real a_dv) const noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real numParticles (const amrex::Real a_dv) const noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int numSDCell (const amrex::Real a_dv) const noexcept
 

Public Attributes

bool inject = false
 
amrex::Real sd_density = -1
 
int ppc = 1
 
amrex::Real par_density = -1
 
double par_total = 0
 
double par_total_old = 0
 
amrex::Real frac_tol = 0
 

Detailed Description

Numbers of super-droplets and of physical particles that an initialization, or one per-cell injection step, places in a cell of volume a_dv.

Member Function Documentation

◆ densityMode()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool SDCellCounts::densityMode ( ) const
inlinenoexcept

True when a super-droplet density, not the per-cell count, sets the number of super-droplets (an injection without a super-droplet rate has sd_density 0)

279 { return inject ? (sd_density > 0) : (sd_density >= 0); }
bool inject
Definition: ERF_SDInitialization.H:268
amrex::Real sd_density
Definition: ERF_SDInitialization.H:269

Referenced by numSD().

Here is the caller graph for this function:

◆ numParticles()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real SDCellCounts::numParticles ( const amrex::Real  a_dv) const
inlinenoexcept

Number of physical particles in the cell. An injection step adds the whole particles that the injected number per cell volume has accumulated in this step, so the cell receives its rate times its volume over any sequence of steps.

300  {
301  if (!inject) {
302  return (par_density >= 0) ? std::ceil(par_density*a_dv) : amrex::Real(1);
303  }
304  // in double: the cumulative counts outgrow single precision long before their increments do
305  return static_cast<amrex::Real>(std::floor(par_total * double(a_dv) + double(frac_tol))
306  - std::floor(par_total_old * double(a_dv) + double(frac_tol)));
307  }
Definition: ERF_ConsoleIO.cpp:17
amrex::Real par_density
Definition: ERF_SDInitialization.H:271
double par_total
Definition: ERF_SDInitialization.H:272
double par_total_old
Definition: ERF_SDInitialization.H:273
amrex::Real frac_tol
Definition: ERF_SDInitialization.H:274

Referenced by SDInitialization::numParticlesPerCell(), numSD(), and numSDCell().

Here is the caller graph for this function:

◆ numSD()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int SDCellCounts::numSD ( const amrex::Real  a_dv) const
inlinenoexcept

Number of super-droplets in the cell (0 when it receives no particles)

284  {
285  if (!inject) {
286  if (numParticles(a_dv) <= 0) { return 0; }
287  return densityMode() ? static_cast<int>(std::ceil(sd_density*a_dv)) : ppc;
288  }
289  const amrex::Real num_par = numParticles(a_dv);
290  const int num_sd = densityMode() ? amrex::max(static_cast<int>(std::round(sd_density*a_dv)), 1)
291  : amrex::max(ppc, 1);
292  return static_cast<int>(amrex::min(amrex::Real(num_sd), num_par));
293  }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool densityMode() const noexcept
Definition: ERF_SDInitialization.H:279
int ppc
Definition: ERF_SDInitialization.H:270
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real numParticles(const amrex::Real a_dv) const noexcept
Definition: ERF_SDInitialization.H:299

Referenced by numSDCell(), and SDInitialization::numSDPerCell().

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

◆ numSDCell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int SDCellCounts::numSDCell ( const amrex::Real  a_dv) const
inlinenoexcept

Number of super-droplets in the cell when its counts follow its physical volume: at most one per physical particle, so that none has a zero multiplicity

313  {
314  return static_cast<int>(amrex::min(amrex::Real(numSD(a_dv)), numParticles(a_dv)));
315  }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int numSD(const amrex::Real a_dv) const noexcept
Definition: ERF_SDInitialization.H:283
Here is the call graph for this function:

Member Data Documentation

◆ frac_tol

amrex::Real SDCellCounts::frac_tol = 0

injection: tolerance below 1 at which an accumulated particle is injected

Referenced by SDInjection::cellCounts(), and numParticles().

◆ inject

bool SDCellCounts::inject = false

injection step (else initialization)

Referenced by SDInjection::cellCounts(), densityMode(), numParticles(), and numSD().

◆ par_density

amrex::Real SDCellCounts::par_density = -1

initialization: physical particles per m^3

Referenced by SDInitialization::cellCounts(), and numParticles().

◆ par_total

double SDCellCounts::par_total = 0

injection: physical particles per m^3 up to this step

Referenced by SDInjection::cellCounts(), and numParticles().

◆ par_total_old

double SDCellCounts::par_total_old = 0

injection: physical particles per m^3 before this step

Referenced by SDInjection::cellCounts(), and numParticles().

◆ ppc

int SDCellCounts::ppc = 1

super-droplets per cell when sd_density is not set

Referenced by SDInjection::cellCounts(), SDInitialization::cellCounts(), and numSD().

◆ sd_density

amrex::Real SDCellCounts::sd_density = -1

super-droplets per m^3; injection: per m^3 this step

Referenced by SDInjection::cellCounts(), SDInitialization::cellCounts(), densityMode(), and numSD().


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