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

Sampled-multiplicity weight of a super-droplet over its independently sampled components: the weights of the varying components multiply, and the constant components set the weight only when no component varies. Callers leave out constant species, as before. More...

#include <ERF_SDInitialization.H>

Collaboration diagram for SDSampledWeight:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void add (const SDDistributionType a_type, const amrex::Real a_w, const amrex::Real a_ndv) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real value () const noexcept
 

Public Attributes

amrex::Real var = zero
 
amrex::Real cst = zero
 
int nvar = 0
 

Detailed Description

Sampled-multiplicity weight of a super-droplet over its independently sampled components: the weights of the varying components multiply, and the constant components set the weight only when no component varies. Callers leave out constant species, as before.

Member Function Documentation

◆ add()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SDSampledWeight::add ( const SDDistributionType  a_type,
const amrex::Real  a_w,
const amrex::Real  a_ndv 
)
inlinenoexcept

a_w is the component's weight from SD_sample_mass_gpu, a_ndv the factor numdens*cell_volume that every varying weight carries

234  {
235  if (a_type == SDDistributionType::mass_constant) {
236  cst += a_w;
237  } else if (nvar == 0) {
238  var = a_w;
239  ++nvar;
240  } else {
241  var *= (a_ndv != zero) ? a_w / a_ndv : zero;
242  ++nvar;
243  }
244  }
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
int nvar
Definition: ERF_SDInitialization.H:228
amrex::Real cst
Definition: ERF_SDInitialization.H:227
amrex::Real var
Definition: ERF_SDInitialization.H:226

◆ value()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real SDSampledWeight::value ( ) const
inlinenoexcept
247 { return (nvar > 0) ? var : cst; }

Member Data Documentation

◆ cst

amrex::Real SDSampledWeight::cst = zero

sum of the constant-component weights

Referenced by add(), and value().

◆ nvar

int SDSampledWeight::nvar = 0

number of varying components

Referenced by add(), and value().

◆ var

amrex::Real SDSampledWeight::var = zero

product of the varying-component weights

Referenced by add(), and value().


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