Collisions

Header file: <libs/superdrops/collisions/collisions.hpp> [source]

template<typename P>
concept PairProbability
#include <collisions.hpp>

Concept for objects that return a probability of collision between two (real) droplets.

Object (has operator that) returns prob_jk, the probability a pair of droplets undergo some kind of collision process. Usually prob_jk = K(drop1, drop2) delta_t/delta_vol, where K(drop1, drop2) := C(drop1, drop2) * |v1−v2| is the coalescence kernel (see Shima 2009 eqn 3). For example a type of PairProbability may return prob_jk which is the probability of collision-coalescence according to a particular coalescence kernel, or collision-breakup.

tparam P:

The type representing the pair probability object.

template<typename X>
concept PairEnactX
#include <collisions.hpp>

Concept for objects that enact a sucessful collision event between two superdroplets, e.g. to model the coalscence and/or rebound and/or breakup of two superdroplets.

Object (has operator that) enacts a collision-X event between two superdroplets. For example it may enact collision-coalescence of a pair of superdroplets by changing the multiplicity, radius and solute mass of each superdroplet in the pair.

tparam X:

The type representing the pair enactment object.

template<PairProbability Probability, PairEnactX EnactCollision>
struct DoCollisions

Implements microphysical processes for collisions between superdroplets.

Template Parameters:
  • Probability – The type representing the pair probability object.

  • EnactCollision – The type representing the pair enactment object.

Public Functions

inline DoCollisions(const double DELT, Probability p, EnactCollision x)

Constructs a DoCollisions object.

Note: If DoCollisions used at the MicrophysicsFunction type for a ConstTstepMicrophysics instance, the interval between calls of DoCollisions operator() in model timesteps must be concordant with DELT [s].

Parameters:
  • DELT – Time interval [s] over which probability of collision is calculated.

  • p – The probability object for calculating the probability of a collision.

  • x – The enactment object for enacting collision events.

inline subviewd_supers operator()(const TeamMember &team_member, const unsigned int subt, subviewd_supers supers, const State &state) const

Operator used as an “adaptor” for using collisions as the MicrophysicsFunction type for a ConstTstepMicrophysics instance (hint which itself satsifies the MicrophysicalProcess concept).

i.e. Operator allows DoCollisions to be used as the function in a microphysical process with a constant timestep between events. Note: If object used in this way, the interval between calls to this function (i.e. between collision events) in model timesteps should be concordant witih DELT of the instance.

Parameters:
  • team_member – The Kokkos team member.

  • subt – The sub-time step.

  • supers – The superdroplets.

  • state – The state.

Returns:

The updated superdroplets.

Private Functions

inline double scaled_probability(const Superdrop &drop1, const Superdrop &drop2, const double scale_p, const double VOLUME) const

Scaled probability of collision for a pair of super-droplets.

Returns the probability of pair of super-droplets colliding according to Shima et al. 2009 (“p_alpha” in paper). Function assumes drop1.xi >= drop2.xi.

Note: multiplicity, xi, of drop1 is cast to double for the calculation.

Parameters:
  • drop1 – The first super-droplet.

  • drop2 – The second super-droplet.

  • scale_p – The scaling factor.

  • VOLUME – The volume.

Returns:

The scaled probability of the collision.

inline Kokkos::pair<Superdrop&, Superdrop&> assign_drops(Superdrop &dropA, Superdrop &dropB) const

Assigns references to super-droplets in a pair based on their multiplicities.

Compare dropA’s multiplicity with dropB’s, and returns (non-const) references to dropA and dropB in a pair {drop1, drop2} such that drop1’s multiplicity is always >= drop2’s. *

Parameters:
  • dropA – The first super-droplet.

  • dropB – The second super-droplet.

Returns:

A pair of references to super-droplets ordered by descending xi value.

inline bool collide_superdroplet_pair(Superdrop &dropA, Superdrop &dropB, const double scale_p, const double VOLUME) const

Performs collision event for a pair of superdroplets.

Monte Carlo Routine from Shima et al. 2009 for collision-coalescence generalised to any collision-[X] process for a pair of super-droplets.

Parameters:
  • dropA – The first superdroplet.

  • dropB – The second superdroplet.

  • scale_p – The scaling factor.

  • VOLUME – The volume.

Returns:

True if the collision event results in null superdrops with xi=0), otherwise false.

inline size_t collide_supers(const TeamMember &team_member, subviewd_supers supers, const double volume) const

Performs collisions between super-droplets in supers view.

Enacts collisions for pairs of super-droplets in supers view adapted from collision-coalescence of Shima et al. 2009 to generalise to allow for other types of collision-[X] events.

Function uses Kokkos nested parallelism for paralelism over supers inside parallelised loop for member ‘teamMember’. In serial Kokkos::parallel_reduce([…]) is equivalent to summing nnull over for loop: for (size_t jj(0); jj < npairs; ++jj) {[…]}.

NOTE: function assumes supers is already randomly shuffled and these superdrops are colliding some ‘VOLUME’ [m^3]).

Parameters:
  • team_member – The Kokkos team member.

  • supers – The randomly shuffled view of super-droplets.

  • volume – The volume in which to calculate the probability of collisions.

Returns:

The number of null (xi=0) superdrops.

inline subviewd_supers do_collisions(const TeamMember &team_member, subviewd_supers supers, const double volume) const

Executes collision events for pairs of superdroplets.

Superdroplet collision algorithm adapted from collision-coalescence in Shima et al. 2009. This function shuffles supers to get random pairs of superdroplets (SDs) and then calls the collision function for each pair assuming these superdrops are colliding some ‘VOLUME’ [m^3]. Function is designed to be called inside a parallelised loop for member ‘teamMember’.

Parameters:
  • team_member – The Kokkos team member.

  • supers – The view of super-droplets.

  • volume – The volume in which to calculate the probability of collisions.

Returns:

The updated superdroplets.

Private Members

const double DELT

time interval [s] over which probability of collision is calculated.

const Probability probability

Probability object for calculating collision probabilities.

const EnactCollision enact_collision

Enactment object for enacting collision events.

const GenRandomPool genpool

Kokkos thread-safe random number generator pool.