the Creative Commons Attribution 4.0 License.

Special issue: Particle-based methods for simulating atmospheric aerosol...

**Model description paper**
01 Jul 2019

**Model description paper** | 01 Jul 2019

# University of Warsaw Lagrangian Cloud Model (UWLCM) 1.0: a modern large-eddy simulation tool for warm cloud modeling with Lagrangian microphysics

Piotr Dziekan, Maciej Waruszewski, and Hanna Pawlowska

**Piotr Dziekan et al.**Piotr Dziekan, Maciej Waruszewski, and Hanna Pawlowska

- Institute of Geophysics, Faculty of Physics, University of Warsaw, Warsaw, Poland

- Institute of Geophysics, Faculty of Physics, University of Warsaw, Warsaw, Poland

**Correspondence**: Piotr Dziekan (pdziekan@fuw.edu.pl)

**Correspondence**: Piotr Dziekan (pdziekan@fuw.edu.pl)

Received: 07 Nov 2018 – Discussion started: 04 Feb 2019 – Revised: 03 Jun 2019 – Accepted: 07 Jun 2019 – Published: 01 Jul 2019

A new anelastic large-eddy simulation (LES) model with an Eulerian dynamical core and Lagrangian particle-based microphysics is presented. The dynamical core uses the multidimensional positive-definite advection transport algorithm (MPDATA) advection scheme and the generalized conjugate residual pressure solver, whereas the microphysics scheme is based on the super-droplet method. Algorithms for coupling of Lagrangian microphysics with Eulerian dynamics are presented, including spatial and temporal discretizations and a condensation substepping algorithm. The model is free of numerical diffusion in the droplet size spectrum. Activation of droplets is modeled explicitly, making the model less sensitive to local supersaturation maxima than models in which activation is parameterized. Simulations of a drizzling marine stratocumulus give results in agreement with other LES models. It is shown that in the super-droplet method a relatively low number of computational particles is sufficient to obtain correct averaged properties of a cloud, but condensation and collision–coalescence have to be modeled with a time step of the order of 0.1 s. Such short time steps are achieved by substepping, as the model time step is typically around 1 s. Simulations with and without an explicit subgrid-scale turbulence model are compared. Effects of modeling subgrid-scale motion of super-droplets are investigated. The model achieves high computational performance by using graphics processing unit (GPU) accelerators.

Over the last decade, Lagrangian particle-based cloud microphysics schemes have been drawing increasing attention. They are similar to Eulerian bin schemes in that they explicitly model the size spectrum of droplets and explicitly resolve microphysical processes, but have a number of advantages over them (Grabowski et al., 2018b). One of the advantages is that Lagrangian schemes have no numerical diffusion in the spectrum of droplet sizes. Several Lagrangian schemes for warm cloud microphysics have been developed thus far (Andrejczuk et al., 2008; Shima et al., 2009; Riechelmann et al., 2012). Arguably, the most important difference between these schemes is in the way collision–coalescence is modeled. The coalescence algorithm used in the super-droplet method (SDM) of Shima et al. (2009) seems to be the most promising, as it was found to be the most accurate of the coalescence algorithms used in various Lagrangian microphysics schemes (Unterstrasser et al., 2017, where it is called the “all-or-nothing” algorithm). A numerical implementation of the SDM is a major part of the libcloudph++ library (Arabas et al., 2015) developed by the cloud modeling group at the University of Warsaw.

In this paper, we document the development of a new large-eddy simulation (LES) model called the University of Warsaw Lagrangian Cloud Model (UWLCM). It is an anelastic model with a finite-difference Eulerian dynamical core and a Lagrangian microphysics scheme. The Lipps–Hemler anelastic approximation (Lipps and Hemler, 1982) is used, which is applicable to a wide range of atmospheric flows (Klein et al., 2010; Smolarkiewicz, 2011). The dynamical core is implemented using the libmpdata++ software library (Jaruga et al., 2015) also developed by the cloud modeling group at the University of Warsaw. libmpdata++ is a collection of solvers for the generalized transport equation. In libmpdata++, advection is modeled using the multidimensional positive-definite advection transport algorithm (MPDATA) – see Smolarkiewicz (2006) for a recent review. Liquid water is modeled with the SDM implemented in libcloudph++. We do not assume any artificial categorization of liquid water particles. Consequently, all particles, i.e., humidified aerosols, cloud droplets and rain drops, evolve according to the same set of basic equations.

One of the key reasons for developing a new model is to use a modern software development approach. The model code is written in the C++ programming language and makes use of many mature libraries available in that language (e.g., Blitz++, Boost and Thrust). The code is open-source and under a version-control system. A set of automated tests greatly helps in ensuring the correctness of the model. The automated tests include a 2-D moist thermal simulation, a 2-D kinematic stratocumulus simulation and a test of different combinations of model options. Moreover, modeling of physical processes, e.g., condensation, advection, coalescence, sedimentation, is tested separately by the libmpdata++ and libcloudph++ test suites. UWLCM makes efficient use of modern computers that have both central processing units (CPUs) and graphics processing units (GPUs). The Eulerian computations of the dynamical core are carried out on CPUs and, simultaneously, Lagrangian microphysical computations are undertaken on GPUs. However, it is also possible to run the Lagrangian microphysics on CPUs.

Some results obtained using earlier versions of UWLCM have already been published. In Grabowski et al. (2018a), UWLCM was used to model a 2-D moist thermal and in Grabowski et al. (2018b), an idealized 3-D cumulus cloud was modeled. Here, we present simulations of a drizzling marine stratocumulus using the second Dynamics and Chemistry of Marine Stratocumulus (DYCOMS-II) second research flight (RF02) setup. UWLCM results are compared with 11 LES models that took part in the Ackerman et al. (2009) intercomparison. Sensitivity of UWLCM to the parameters of the microphysics scheme and to the description of the subgrid-scale (SGS) turbulence is studied. It is of particular interest how much drizzle a LES model with Lagrangian microphysics produces, compared to models with bin or bulk microphysics that took part in the intercomparison. To our knowledge, LES simulations with warm cloud Lagrangian microphysics were used to study drizzling stratocumulus only by Andrejczuk et al. (2008, 2010). This type of model has more often been employed to study cumulus clouds (Riechelmann et al., 2012; Naumann and Seifert, 2015; Arabas and Shima, 2013; Hoffmann et al., 2015, 2017).

Section 2 presents the governing equations of the model, and Sect. 3 describes the numerical algorithms for solving these equations. The stratocumulus simulation results are discussed in Sect. 4. Section 5 contains a summary and planned developments of the model. A list of symbols used and their definitions are given in Appendix A, Appendix B compares two substepping algorithms for condensation and Appendix C contains a brief description of the software implementation of the model.

## 2.1 Eulerian variables

Eulerian prognostic variables of the model are the potential temperature *θ*, the water vapor mixing ratio *q*_{v} and the air velocity ** u**.
Equations governing the time evolution of these variables are obtained via the Lipps–Hemler approximation, which relies on the assumption that the atmosphere does not depart far from some stationary state, called the “reference state” (Lipps and Hemler, 1982).
The reference state is assumed here to be a dry, hydrostatically balanced state with constant stability

*S*

^{r}.

*S*

^{r}is equal to the average stability of the sounding used to initialize a simulation. Surface density and pressure of the reference state are equal to those of the initial sounding. Vertical profiles of potential temperature and of density of dry air in the reference state are (Clark and Farley, 1984) as follows:

where ${\mathit{\theta}}_{\mathrm{v}}^{\mathrm{0}}$ and *ρ*^{0} are values of the virtual potential temperature and of the air density taken from the initial sounding at the ground level, respectively.
An auxiliary “environmental state” is introduced to increase accuracy of numerical calculations (Smolarkiewicz et al., 2014, 2019).
It is a hydrostatically balanced moist state with stationary profiles *θ*^{e}(*z*), *p*^{e}(*z*), *T*^{e}(*z*), ${q}_{\mathrm{v}}^{\mathrm{e}}\left(z\right)$ and ${q}_{\mathrm{l}}^{\mathrm{e}}\left(z\right)$ calculated from the initial sounding.
If the initial sounding is supersaturated, all supersaturation is assumed to be condensed in the environmental state.

The set of anelastic Lipps–Hemler equations (Lipps and Hemler, 1982; Grabowski and Smolarkiewicz, 1996; Clark and Farley, 1984) that govern the time evolution of the Eulerian prognostic variables is as follows:

Here *D*_{t} denotes the material derivative, ${D}_{t}={\partial}_{t}+\mathit{u}\cdot \mathrm{\nabla}$, and *π* is the normalized pressure perturbation.
Following Grabowski and Smolarkiewicz (1996), buoyancy is defined as

The condensation rate *C* in Eqs. (4) and (5) and the liquid water mixing ratio *q*_{l} in Eq. (6) come from the Lagrangian microphysics scheme.
The terms *F*_{*} represent a total forcing due to surface fluxes, radiative heating/cooling, large-scale subsidence and absorbers,
whereas the terms 𝒟_{*} represent contributions from a SGS turbulence model.
The dry-air density is assumed to be equal to the reference state density profile ${\mathit{\rho}}_{\mathrm{d}}^{\mathrm{r}}$ and, characteristically for the anelastic approximation, the dry-air density at given position does not change with time: ${\partial}_{t}{\mathit{\rho}}_{\mathrm{d}}^{\mathrm{r}}=\mathrm{0}$.
By putting ${\partial}_{t}{\mathit{\rho}}_{\mathrm{d}}^{\mathrm{r}}=\mathrm{0}$ into the continuity equation, the following constraint on the velocity field is obtained:

which will be referred to as the “anelastic constraint”.
Throughout the model, the pressure is assumed to be equal to the environmental pressure profile *p*^{e}(*z*).
The only exception is the pressure gradient term appearing in Eq. (3), in which the pressure is adjusted so that ** u** satisfies the anelastic constraint (Eq. 7) (Lipps and Hemler, 1982; Grabowski and Smolarkiewicz, 1996).

UWLCM offers two methods for modeling diffusion of Eulerian variables due to the SGS turbulence. The first is an implicit LES (ILES) approach, in which there is no explicit parametrization of SGS mixing, i.e., ${\mathcal{D}}_{*}\equiv \mathrm{0}$. Instead, numerical diffusion of the advection scheme is used to mimic the SGS turbulence (Grinstein et al., 2007). The MPDATA algorithm is argued to be well-suited for ILES simulations (Margolin and Rider, 2002; Margolin et al., 2006). The other method is a Smagorinsky-type model (Smagorinsky, 1963; Lilly, 1962) with the SGS effects parameterized as follows:

Here *K*_{m} is the eddy viscosity, *K*_{h} and *K*_{q} are the eddy diffusivities, and
$\mathbf{E}=\mathrm{\nabla}\mathit{u}+(\mathrm{\nabla}\mathit{u}{)}^{T}-\frac{\mathrm{2}}{\mathrm{3}}(\mathrm{\nabla}\cdot \mathit{u})\mathbf{I}$ is the deformation tensor.
The eddy viscosity is given by

where *c*_{s} is the Smagorinsky constant, *λ* is the mixing length, and *R**i* is the Richardson number.
The eddy diffusivities are

where *P**r* is the Prandtl number. Following Schmidt and Schumann (1989) the mixing length is set to $\mathit{\lambda}=min(\mathrm{\Delta},{c}_{\mathrm{L}}z)$.
Given the highly anisotropic grid cells used in stratocumulus simulations we set Δ=Δ*z*, as in the Colorado State University System for Atmospheric Modeling (Khairoutdinov and Randall, 2003).
The values of the numerical constants are taken following Schmidt and Schumann (1989) as *c*_{s} = 0.165, *P**r*=0.42 and *c*_{L}=0.845.

## 2.2 Lagrangian particles

Liquid water is modeled with a Lagrangian, particle-based microphysics scheme from the libcloudph++ library (Arabas et al., 2015).
It is an implementation of the super-droplet method (SDM) (Shima et al., 2009).
The key idea is to represent all liquid particles using a small number of computational particles, called super-droplets (SDs).
Each SD represents a large number of real particles. The number of real particles represented by a given SD is called the multiplicity (also known as the weighting factor), and is denoted by *ξ*.
Other attributes of SDs are the dry radius *r*_{d}, the wet radius *r*, the hygroscopicity parameter *κ* and the position ** x** in the model domain.

The condensational growth rate of a SD is equal to that of a single real particle. We calculate it using the Maxwell–Mason approximation (see Arabas et al., 2015):

where

and water activity is calculated using the *κ*-Köhler parametrization (Petters and Kreidenweis, 2007):

Following Lipps and Hemler (1982), the relative humidity is defined as $\mathit{\varphi}={q}_{\mathrm{v}}/{q}_{\mathrm{vs}}$ and the saturation water vapor mixing ratio is calculated using the formula ${q}_{\mathrm{vs}}=\left({R}_{\mathrm{d}}/{R}_{\mathrm{v}}\right){e}_{\mathrm{s}}/\left({p}^{\mathrm{e}}-{e}_{\mathrm{s}}\right)$.
Formulas for *A* and *l*_{v} can be found in Arabas and Pawlowska (2011).
The vapor and heat diffusion coefficients *D* and *K* include gas kinetic and ventilation effects and are evaluated as in Arabas et al. (2015).

Collision–coalescence of droplets is treated as a stochastic process (Gillespie, 1972).
Collisions are possible only between droplets that are located within the same spatial cell, called the coalescence cell.
It is assumed that coalescence cells are well-mixed, i.e., that droplets are randomly and uniformly distributed within a coalescence cell.
Then, the probability that any two real droplets *j* and *k* that are located in the same coalescence cell coalesce during the time interval Δ*t*_{c} is given by the equation (Shima et al., 2009)

where *K*_{j,k} is the collision–coalescence kernel for these two droplets and Δ*V* is the volume of the coalescence cell.
The probability of coalescence of SDs needs to be increased to account for the fact that each SD represents a large number of real droplets.
The probability that any two SDs *j* and *k* that are in the same coalescence cell coalesce during the time interval Δ*t*_{c} is related to the probability of coalescence of real droplets in the following manner (Shima et al., 2009):

where SDs are labeled so that *ξ*_{j}≤*ξ*_{k} and this convention is assumed throughout the rest of this paragraph.
Coalescence of the two SDs is interpreted as a coalescence of *ξ*_{j} pairs of real droplets.
Each pair consists of one real droplet represented by the *j*th SD and one real droplets represented by the *k*th SD.
The remaining *ξ*_{k}−*ξ*_{j} real droplets represented by the *k*th SD are not affected by the coalescence of these two SDs.

Such treatment of coalescence, sometimes referred to as the “all-or-nothing algorithm”, assures that coalescence does not increase the number of SDs.
This algorithm was found to give the best results in a recent comparison of various coalescence algorithms used in Lagrangian schemes for microphysics (Unterstrasser et al., 2017).
Dziekan and Pawlowska (2017) showed that the all-or-nothing algorithm produces correct realizations of the stochastic coalescence process described in Gillespie (1972), but only for *ξ*=1.
For *ξ*>1, an average over realizations of the all-or-nothing algorithm is in good agreement with the expected value of the stochastic process, but the variability between realizations is much higher.
This is because the number of SDs is much smaller than the number of real droplets. Consequently, the statistical sample for *ξ*>1 is much smaller than in the more realistic case of *ξ*=1.
The collision–coalescence algorithm is not the only cause of the high variability for *ξ*>1.
Motion of SDs is also expected to give a high variability, because when a SD moves from one spatial cell to another, a large number of real particles is abruptly moved between these cells.
It is not certain if the high variability in the SDM associated with collision–coalescence of SDs and motion of SDs has any impact on averaged properties of a modeled cloud.
To determine if it does have an effect, we conduct simulations for various numbers of SDs (see Sect. 4.2).

Super-droplets are treated as non-inertial particles that always sediment with their terminal velocity. There is an option to model the diffusion of liquid water due to the SGS turbulence by adding a random velocity component ${{\mathit{u}}^{\mathbf{\prime}}}_{\mathrm{SD}}$ that is specific to each SD. Each component of this velocity perturbation evolves according to Eq. (10) from Grabowski and Abade (2017). It is important to note that this SGS velocity can only be added when the Smagorinsky scheme is used for Eulerian variables. Altogether, the velocity of a SD is equal to ${\mathit{u}}_{\mathrm{SD}}=\mathit{u}+{{\mathit{u}}^{\mathbf{\prime}}}_{\mathrm{SD}}+\left(\mathrm{0},\mathrm{0},{w}_{\mathrm{t}}\right)+\left(\mathrm{0},\mathrm{0},{w}_{\text{LS}}\right)$. This formula represents the combined effects of transport by the resolved air flow, SGS turbulence, sedimentation and large-scale subsidence.

## 3.1 Numerical integration of Eulerian equations

Numerical integration of the governing Eulerian equations is carried out using the MPDATA algorithm implemented in libmpdata++ (Jaruga et al., 2015). MPDATA is an algorithm for solving the generalized transport equation (Smolarkiewicz, 2006)

where *ψ* is a scalar field advected by the velocity field ** u**,

*R*is the source/sink right-hand side (RHS), and

*G*can represent the fluid density, the Jacobian of coordinate transformation or their product. The equivalent of Eq. (18) in Lagrangian description is

Eq. (3) for components of vector ** u** and Eqs. (4) and (5) have the same form as Eq. (19).
Equation (19) introduces notation that is convenient for presenting the numerical integration procedure of UWLCM.
All RHS terms, except buoyancy and pressure gradient terms in Eq. (3), are integrated with the forward Euler method.
These terms are denoted by

*R*

_{E}. The buoyancy and pressure gradient terms, denoted by

*R*

_{T}, are applied using the trapezoidal rule. The integration algorithm is as follows:

where ADV(*ψ*,** u**) is an operator representing MPDATA advection of a scalar field

*ψ*by the velocity field

**. Superscripts denote the time level. The mid-time-level velocity field ${\mathit{u}}^{\left[n+\mathrm{1}/\mathrm{2}\right]}$ is obtained by linear extrapolation from**

*u*

*u*^{[n−1]}and

*u*^{[n]}.

The pressure perturbation *π* is adjusted so that the velocity field satisfies Eq. (7).
By applying Eq. (7) to the equation for *u*^{[n+1]} discretized in the form of Eq. (20), the following elliptic equation for *π*^{[n+1]} is obtained:

where

and the thermodynamic fields required in *B*^{[n+1]} are already available when the equation has to be solved.
The pressure problem stated in Eq. (21) is solved with the generalized conjugate residual solver (Smolarkiewicz and Margolin, 2000; Smolarkiewicz and Szmelter, 2011).

## 3.2 Numerical algorithms for super-droplets

For numerical reasons, condensational growth of SDs is solved in terms of the squared wet radius (Chen, 1992; Shima et al., 2009).
Integration of Eq. (13) is carried out with a scheme that is implicit with respect to the wet radius and explicit with respect to *q*_{v} and *θ*:

Solution for Eq. (23) is found with a predictor–corrector procedure.
We refer the reader to Arabas et al. (2015) for details on this procedure.
Condensation can rapidly change the radii of small droplets.
Therefore to correctly model condensation, in particular during the crucial moment of droplet activation, it is necessary to model condensation with a relatively short time step.
Tests performed in a kinematic 2-D model of stratocumulus clouds have shown that the number of activated droplets converges for a condensation time step of around 0.1 s.
A typical time step Δ*t* of a LES model is around 1 s.
Therefore it is necessary to undertake several condensation time steps in a single LES time step, a procedure we call substepping.
To explain the idea of the substepping algorithm, we introduce the following notation: *S*_{c} for the number of substeps, $\mathit{\psi}=\left(\mathit{\theta},{q}_{\mathrm{v}}\right)$ for a vector of Eulerian variables, *ψ*_{old} for values of Eulerian variables after the substepping algorithm finished in the previous time step and *ψ*_{new} for values of Eulerian variables before the start of the substepping algorithm in the current time step.
In the first substep, Eulerian variables are set to ${\mathit{\psi}}_{\text{old}}+\frac{{\mathit{\psi}}_{\text{new}}-{\mathit{\psi}}_{\text{old}}}{{S}_{\mathrm{c}}}$ and then condensation is calculated using the procedure defined in Eq. (23).
Please note that this condensation procedure changes Eulerian variables.
In each subsequent time step, $\frac{{\mathit{\psi}}_{\text{new}}-{\mathit{\psi}}_{\text{old}}}{{S}_{\mathrm{c}}}$ is added to Eulerian variables and then the condensation procedure is run again.
Two types of the substepping algorithm are considered that differ only in the spatial cell from which the value of *ψ*_{old} is diagnosed.
In the “per-particle algorithm”, *ψ*_{old} is diagnosed from the cell in which the given SD was in the *previous* time step.
In the “per-cell algorithm”, *ψ*_{old} is diagnosed from the cell in which given SD is in the *current* time step.
The per-cell algorithm is computationally less demanding, because *ψ*_{old} is the same for all SDs in a given spatial cell.
In the per-particle algorithm *ψ*_{old} can be different for different SDs in the same cell, so each SD needs to remember its own value of *ψ*_{old}.
Moreover, in the per-particle algorithm, values of pressure and density also need to vary between substeps.
This is not necessary in the per-cell algorithm, because pressure and density in a given cell are constant in time.
A more detailed description of the substepping algorithms and a comparison of the results they produce is given in Appendix B.
The conclusion from that comparison is that the per-cell algorithm is correct for stationary clouds, but gives significant errors if cloud edge moves, whereas the per-particle algorithm is correct in both cases. All presented results of modeling stratocumulus clouds were obtained using the per-cell algorithm.

The stochastic collision–coalescence process described in Sect. 2.2 is modeled with a Monte Carlo algorithm developed by Shima et al. (2009). The key feature of this algorithm is that each SD can only collide with one other SD during a time step. Hence, the computational cost of the algorithm scales linearly, and not quadratically, with the number of SDs. Dziekan and Pawlowska (2017) showed that this “linear sampling” technique does not affect the mean (or the standard deviation) of the results. Note that in the coalescence algorithm of Shima et al. (2009), the same pair of SDs can collide multiple times during one time step. This feature was not implemented in libcloudph++ when the Arabas et al. (2015) study was published. libcloudph++ has since been modified and multiple collisions are now allowed. It is possible to run the coalescence algorithm with a shorter time step than the model time step; thus, coalescence is calculated more than once in each model time step, a procedure we call coalescence substepping.

The procedure for the initialization of SD sizes is described in detail in Dziekan and Pawlowska (2017), where it is called the “constant SD” initialization.
In short, the range of initial values of *r*_{d} is divided into *N*_{SD} bins, which have the same size in log (*r*_{d}). In each bin, a single value or dry radius is randomly selected and assigned to a single SD.
Multiplicity of the SD is readily calculated from the initial aerosol size spectrum.
Next, the wet radius is initialized to be in equilibrium with the initial relative humidity.
If the initial relative humidity is higher than 0.95, the wet radii are initialized as if it was equal to 0.95.
This procedure is performed for each spatial cell.
This initialization algorithm gives a good representation of the initial size spectrum even for small values of *N*_{SD}.

Advection of SDs is modeled with a predictor–corrector algorithm described in Grabowski et al. (2018a). Simpler, first-order algorithms for advection were found to cause inhomogeneous spatial distributions of SDs, with less SDs in regions of high vorticity.

## 3.3 Order of operations

The sequence of operations undertaken in a single time step is presented on a Unified Modeling Language (UML) sequence diagram in Fig. 1. The diagram is a convenient way of showing how coupling between Eulerian dynamics and Lagrangian microphysics is carried out. The diagram also shows operations that are undertaken simultaneously on CPUs and GPUs. Please note how the liquid water mixing ratio *q*_{l} is treated. Liquid water is resolved by the SDM and *q*_{l} could be diagnosed from the super-droplet size spectrum each time it is needed in the buoyancy term in Eq. (3) or radiative term in Eq. (4). Buoyancy is integrated with a trapezoidal scheme, which requires *q*_{l} after advection to be known. In a straightforward implementation, in which *q*_{l} is diagnosed from SDs after the advection of SDs, pressure solver calculations can only be started after advection of SDs has been calculated.
Hence, there is little parallelism of calculations on GPUs and CPUs.
To achieve more parallelism, we introduce an auxiliary Eulerian field for *q*_{l}.
The value of *q*_{l} is diagnosed from SDs once per time step, after the condensation calculation.
Then, *q*_{l} advection is carried out using a first-order accurate upwind scheme.
Using the auxiliary *q*_{l} field, it is possible to calculate coalescence and motion of SDs simultaneously with calculations of advection of Eulerian fields and of the pressure problem.

## 3.4 Spatial discretization

Eulerian dependent variables of the model are co-located.
Their positions form the nodes of the primary grid.
However, the libmpdata++ advection algorithms are formulated using a dual, staggered Arakawa-C grid (Arakawa and Lamb, 1977).
The cell centers of the dual grid are the nodes of the primary mesh.
A schematic of a 2-D computational domain with the Arakawa-C grid is shown in Fig. 2.
Throughout this paper, by “'grid cells”, “Eulerian cells” or simply “cells”, we refer to the cells of the dual grid.
To form the Arakawa-C arrangement, components of the vector ** u** are linearly interpolated to the edges of the dual grid (see Jaruga et al., 2015 for details).
Super-droplets are restricted to the physical space, which is the shaded region in Fig. 2.
Coupling of Eulerian variables with SDs is done using the dual grid.
All SDs that are located in the same cell of the dual grid are subjected to the same conditions that are equal to the values of scalars residing at the center of the cell.
Similarly, condensation of a given SD affects scalars in the center of the dual grid cell, in which this SD is located.
To calculate the velocity of air that advects a given SD, velocities, which reside at the edges of the dual grid, are interpolated to the position of the SD.
The interpolation is done linearly, separately in each dimension, as advocated by Grabowski et al. (2018a).
Spatial discretization is also necessary in the algorithm for modeling collision–coalescence (cf. Sect. 2.2).
We also use the dual grid cells as coalescence cells, with the exception of the cells at the domain edges.
There, only the physical (shaded) part of dual grid cells is used as coalescence cells.

UWLCM simulations of a marine stratocumulus cloud are presented in this section. The main goal is to validate UWLCM by comparing it with other LES models. We study sensitivity of the model to the way the SGS turbulence is modeled and to values of the microphysics scheme parameters. Results of this sensitivity study may provide some guidance to other users of Lagrangian microphysical schemes. The simulation setup is based on observations made during the second Dynamics and Chemistry of Marine Stratocumulus (DYCOMS-II) field study (Stevens et al., 2003). The setup, described in detail in Ackerman et al. (2009), is an idealization of conditions observed during the second research flight (RF02) of this campaign. Both heavily drizzling open cells and lightly drizzling closed cells were sampled by RF02. The initial thermodynamic conditions are an average of both types of cells and the microphysical conditions are an average over heavily drizzling cells only. Comparison of simulation results from 11 different LES models is presented in Ackerman et al. (2009). There is a large variability in the amount of drizzle predicted by different models, which illustrates how difficult it is for LES models to reproduce precipitation formation. One of the reasons why we chose to test UWLCM using this setup is to test how well Lagrangian microphysics performs in modeling drizzle. The models that took part in the intercomparison use either bin microphysics (one model with single-moment bin and one model with double-moment bin) or bulk microphysics (two models with single-moment bulk and seven models with double-moment bulk).

## 4.1 Simulation setup

The simulation setup follows Ackerman et al. (2009).
The domain size is 6.4 km × 6.4 km × 1.5 km with a regular grid of cells of 50 m × 50 m × 5 m size.
Rigid and periodic boundary conditions are used at the vertical and horizontal edges of the domain, respectively.
The simulations are run for 6 h.
The initial profiles of *q*_{v} and *θ* give high values of supersaturation in the layer in which a cloud was observed.
However, the simulation is initialized without any cloud water, because it is not known analytically what the initial wet radius distribution should be.
The first part of the simulation, called the “spin-up” period, is dedicated to obtaining a stationary distribution of wet radii.
During the spin-up, the collision–coalescence process is turned off and the supersaturation in the condensational growth equation is limited to 1 %.
Please note that in Ackerman et al. (2009) this supersaturation limit is applied only to the activation and not to the condensational growth.
This approach can not be used in UWLCM, because in UWLCM activation is not modeled as a separate process.
The spin-up period is 1 h long, which was found to be long enough to reach a stationary concentration of cloud droplets – indicating a stationary spectrum of the wet radius.
Aerosol is assumed to consist of ammonium sulfate with the initial size distribution as defined in Appendix A of Ackerman et al. (2009).
Following Petters and Kreidenweis (2007), the hygroscopicity parameter for ammonium sulfate is *κ*=0.61.
Collision efficiencies are taken from Hall (1980) for large droplets and from Davis (1972) for small droplets.
Coalescence efficiency is set to one.
Terminal velocities are calculated using a formula from Khvorostyanov and Curry (2002).
libmpdata++ allows the user to choose from a number of MPDATA options.
In the presented simulations, we use the “infinite-gauge” option *iga* for handling variable-signed fields combined with the non-oscillatory option *fct*.

## 4.2 The 2-D simulations: sensitivity study of SDM

The 2-D simulations are used to investigate sensitivity of the model to parameters of the SDM: the coalescence time step length Δ*t*_{coal} and the initial number of SDs *N*_{SD}.
Results are compared with 3-D simulations from Ackerman et al. (2009) in order to assert if 2-D simulations, which are computationally cheap, provide a reasonable representation of some of the features of 3-D simulations.
However, it has to be kept in mind that the turbulence behavior in 2-D is fundamentally different from that in 3-D.
Simulations are run for two model time step lengths: Δ*t*=0.1 s and Δ*t*=1 s.
No substepping is carried out for Δ*t*=0.1 s.
Results of these simulations provide a reference for simulations with longer time steps.
In simulations with Δ*t*=1 s, 10 substeps for condensation are carried out; hence, the condensation time step is Δ*t*_{cond}=0.1 s.
Using a longer condensation time step results in the activation of too many aerosols (result not shown in the following figures for clarity).
Two values of the coalescence time step are tested – Δ*t*_{coal}=1 s (no coalescence substepping) and Δ*t*_{coal}=0.1 s (10 coalescence substeps) – in combination with two values of the initial number of SDs – *N*_{SD}=40 (which is used in 3-D simulations) and *N*_{SD}=1000.
As the goal of 2-D simulations is to study the microphysical model, SGS turbulence is modeled using the ILES approach.
In 2-D, we observe significant variability in results of simulation runs undertaken for the same parameter values.
The variability comes from two sources: one is that the initial thermodynamic conditions include a small random perturbation;
the other is that initialization of SD radii and collision–coalescence of SDs are modeled with Monte Carlo algorithms.
To compensate for this inherent variability, all UWLCM results of 2-D simulations shown are averages from ensembles of 10 simulations.

Time series of selected domain averaged variables are shown in Fig. 3.
The only significant relationship between model parameters and results is that the amount of surface precipitation is ca. 2 times higher for Δ*t*_{coal}=1 s than for Δ*t*_{coal}=0.1 s.
Stronger precipitation induces differences in
LWP. Before the onset of precipitation, LWP is the same for all combinations of parameters. The amount of surface precipitation does not depend on the model time step or on the number of SDs.
Interestingly, 2-D simulations show an abrupt increase in the entrainment rate and in the maximum of variance of *w* at a simulation time of around 3 h.
This increase is preceded by the moment when the first precipitation reaches the surface.
This suggests that the increase in the maximum of the variance of *w* and in the entrainment rate is caused by rain evaporation.
The need for the spin-up period for microphysics is best seen on the *N*_{c} time series.
Initially, due to the large initial supersaturation, cloud droplets form on all aerosol particles.
Afterwards, *N*_{c} quickly decreases and after 1 h reaches a value of ca. 60 cm^{−3}, which is in agreement with the 3-D reference simulations.

Vertical profiles from the 2-D simulations are shown in Fig. 4.
As already observed in time series plots, precipitation flux strongly depends on Δ*t*_{coal}.
The precipitation flux profile reveals that precipitation flux also weakly depends on *N*_{SD}: it is slightly lower for *N*_{SD}=1000 than for *N*_{SD}=40.
A similar observation was made in Dziekan and Pawlowska (2017), where the autoconversion efficiency was shown to increase with *N*_{SD}.
The most striking differences between the 2-D UWLCM and the 3-D reference simulations are seen on the profiles of moments of the vertical velocity distribution.
This is associated with the decreased dimensionality of our simulations.
Interestingly, profiles of VAR(*w*) and of the third moment of *w* are in better agreement with observations (see Fig. 3 in Ackerman et al., 2009) in the 2-D UWLCM than in the 3-D reference simulations.

A conclusion for SDM modeling is that coalescence needs to be resolved with a time step of the order of 0.1 s, although more rigorous convergence tests should be carried out in the future.
This conclusion is surprising, because coalescence tests of SDM in box models give correct results for time steps larger than 1 s (result not shown), and Shima et al. (2009) estimated that the coalescence algorithm should work well for Δ*t*_{coal} of the order of 1 s.
Moreover, one might expect that using large Δ*t*_{coal} should give too little precipitation, as large Δ*t*_{coal} can cause the mean number of collisions to be lower than expected.
This is because SDM handles large Δ*t*_{coal} by allowing multiple collisions between SDs and sometimes, when one of the SDs has low multiplicity, not all of these multiple collisions can be realized.
However, we see that surface precipitation increases with Δ*t*_{coal}.
A possible explanation is that for large Δ*t*_{coal} some of the SDs become extremely lucky and grow much faster than expected due to multiple collisions.
Hence, even if the mean number of collisions is lower than it should be, some SDs become very large and cause the observed high surface precipitation.
The second conclusion for SDM modeling that can be drawn from the sensitivity test is that *N*_{SD} of the order of 40 is sufficient to obtain correct domain averaged results.
Certainly, this does not mean that this relatively low number of SDs is sufficient in all cases.
For example, a larger number of SDs would probably be needed in simulations in which SDs have more attributes, e.g., when modeling aqueous chemistry.
Also, we expect that observables other than domain averages, e.g., related to the spatial structure of a cloud, are more sensitive to the number of SDs.
Schwenkel et al. (2018) present how cloud structure depends on the number of SDs in more detail.
In general, 2-D UWLCM results do not deviate very much from the 3-D simulations from Ackerman et al. (2009).
The biggest difference is in the cloud base height – cloud layer is significantly deeper in 2-D.
This shows that cheap 2-D simulations can be used to coarsely study microphysical effects in stratocumulus clouds.

## 4.3 The 3-D simulations: model validation and SGS effects

Based on conclusions of the 2-D sensitivity test, 3-D simulations are undertaken for *N*_{SD}=40, Δ*t*=1 s, Δ*t*_{cond}=0.1 s and Δ*t*_{coal}=0.1 s.
Three different models of SGS turbulence are tested: implicit LES, the Smagorinsky scheme and the Smagorinsky scheme with turbulent SGS motion of SDs.
Contrary to the 2-D simulations, the 3-D simulations show very little variability between realizations, owing to the larger simulation domain.
Therefore, averaging over an ensemble of simulations, which was necessary in the 2-D case, is not needed here and the results shown come from single simulation runs.
Time series of the results are shown in Fig. 5.
The biggest difference between different descriptions of the SGS turbulence is in the liquid water content.
In ILES, in which there is no diffusion of liquid water, LWP increases over time and is much higher than in the reference simulations.
Using the Smagorinsky scheme alone, i.e., without diffusion of liquid water, gives less liquid water than ILES.
This indicates that diffusion of Eulerian variables in simulations with the Smagorinsky scheme is higher than in ILES.
Still, LWP in this case is close the maximum from the reference models.
Using the Smagorinsky scheme with turbulent motion of SDs, which models SGS diffusion of liquid water, further decreases LWP and results in better agreement with the reference models.
Using the Smagorinsky scheme also gives the best agreement with the reference models for other variables: entrainment rate, maximum of VAR(*w*) and cloud base height.
Diffusion of liquid water has a visible impact on LWP and therefore needs to be included in Lagrangian microphysics models.
Unfortunately, this can not be done in ILES with SDM, because in this case a measure of the SGS energy dissipation is not readily available.
Aside from decreasing LWP, SGS diffusion of liquid water is seen to decrease *N*_{c}, giving better agreement with the reference models right after the spin-up period.
Afterwards, SGS diffusion of liquid water causes *N*_{c} to slowly decrease with time.
A possible explanation is that in regions with little vertical motion, cloud droplets that diffuse out of supersaturated cells will evaporate, but aerosol particles that diffuse into supersaturated cells will not necessarily be activated, because condensational growth of larger cloud droplets already present in this region may consume all available supersaturation.
Surface precipitation is very low in all 3-D UWLCM simulations.
The 2-D UWLCM simulations give larger surface precipitation than the 3-D UWLCM simulations, which is attributed to a deeper cloud layer in 2-D.
There is a very large spread in surface precipitation in the reference models, with some of them producing as little as 3-D UWLCM.
The subject of discrepancy in surface precipitation is discussed in more detail in Sect. 4.4.

Profiles from 3-D simulations are presented in Fig. 6.
Using the Smagorinsky scheme with SGS diffusion of liquid water gives the best agreement with the reference models, with the exception of the cloud fraction that is smaller than reference.
However, the cloud fraction profile strongly depends on the definition of cloudy cells.
Following Ackerman et al. (2009), we define cloudy cells as those with a concentration of cloud droplets greater than 20 cm^{−3}.
Conversely, most of the reference models use parameterized microphysics.
Therefore, these models define cloudy cells as saturated cells.
Using this definition, all UWLCM runs give maximum cloud fraction of ca. 95 %, which is in agreement with the reference models.
Also, cloud cover, defined as the fraction of columns with LWP >20 g m^{−2}, is close to 100 % in all 3-D UWLCM simulations.
The choice of the SGS diffusion model also affects the structure of the velocity field.
Increasing SGS diffusion strength decreases the variance of *w* and increases the skewness of *w*, which shifts from negative for ILES to positive for the Smagorinsky scheme with the diffusion of liquid water.

## 4.4 Precipitation results

The purpose of this section is to study discrepancy between the amount of surface precipitation observed during the DYCOMS-II campaign (from ca. 0.25 to ca. 0.45 mm d^{−1}, Ackerman et al., 2009) and modeled by 3-D UWLCM (almost none).
The precipitation flux in UWLCM is ca. 2 times lower than the average of reference simulations (cf. Fig. 6).
To better understand this issue we make a comparison with the only models with bin microphysics that took part in the reference intercomparison: the Distributed Hydrodynamic Aerosol and Radiative Modeling Application (DHARMA, Stevens et al., 2002) and the Regional Atmospheric Modeling System (RAMS, RAMS Technical Description, 2016).
DHARMA uses single-moment bin microphysics and RAMS uses double-moment bin microphysics.
More details about DHARMA and RAMS simulations of the DYCOMS RF02 case can be found in Appendix B of Ackerman et al. (2009).
We only compare our results with these two models, because, contrary to the bulk schemes, bin schemes explicitly resolve the size spectrum of droplets and do not rely on parameterizations of the collision–coalescence process, i.e., they are at a similar level of precision as the SDM.
Bin microphysics are troubled by artificial broadening of the size spectrum of droplets due to numerical diffusion associated with advection in the physical space (Morrison et al., 2018).
Such artificial broadening increases the rate of collision–coalescence, meaning that models with bin microphysics might produce too much precipitation.
Lagrangian, particle-based schemes such as SDM have no numerical diffusion in the size spectrum.

Time series and profiles showing the amount of liquid water, surface precipitation and concentration of cloud droplets from UWLCM, DHARMA and RAMS are plotted in Fig. 7.
The precipitation flux and surface precipitation are similar in UWLCM and RAMS.
Both models produce almost no surface precipitation, aside from a short period at the start of the RAMS simulation, when the simulation has not yet reached a stationary state.
The DHARMA model stands out in that the amount of surface precipitation it produces is higher, which is in agreement with observations.
Cloud depth, LWP and *N*_{c} are similar in DHARMA and UWLCM.
So why does DHARMA give a much higher precipitation flux?
One possible explanation is that it is a result of the artificial broadening of the size spectra caused by numerical diffusion.
Conversely, why does UWLCM give less precipitation than observed?
Possibly, precipitation is affected by some physical processes that are not currently modeled by UWLCM.
The list of such unresolved processes that could affect precipitation includes, but is not limited to, the following: SGS turbulence affecting condensation and coalescence of droplets, the lucky droplets effect and giant CCN initiating rain formation.

In the bin microphysics of RAMS and DHARMA, water droplets are artificially divided into haze particles and cloud droplets, and droplet activation is modeled as an instantaneous process (Stevens et al., 1996; Ackerman et al., 1995).
Therefore even a short-lived maximum of supersaturation results in the activation of new droplets (Hoffmann, 2016).
In contrast, in the Lagrangian microphysics of UWLCM all water droplets grow according to the same equations, which include curvature and solute terms, and droplet activation is not modeled as a separate process.
Therefore, activation is not instantaneous, but happens over some time.
Differences between the treatment of activation in bin and Lagrangian microphysics are apparent in the profile of *N*_{c} in Fig. 7.
DHARMA and RAMS predict local maxima of *N*_{c} near the cloud base, where supersaturation is highest.
In UWLCM, owing to the explicit treatment of activation, the timescale of activation is resolved and the local maximum of supersaturation near cloud base does not cause activation of new droplets.
Therefore *N*_{c} in UWLCM monotonously increases near the cloud base.

We presented the University of Warsaw Lagrangian Cloud Model (UWLCM), a new large-eddy simulations model with Lagrangian particle-based cloud microphysics. The model is built by combining two open-source libraries, one for handling Eulerian dynamics and the other for implementing the Lagrangian microphysics scheme. Methods for coupling Lagrangian microphysics with Eulerian dynamics were presented, including spatial discretization, substepping algorithms and an algorithm for simultaneous computations of Eulerian and Lagrangian components. Simulations of a marine stratocumulus show that the model produces results that are in agreement with reference results from 11 other LES models, which proves the capability of Lagrangian microphysics to model realistic clouds. Both 2-D and 3-D simulations of the stratocumulus were performed. The 2-D simulations with UWLCM give reasonable results regarding microphysical phenomena at a fraction of the computational cost of the 3-D simulations, and were used to study sensitivity of the Lagrangian microphysics scheme. It was found that the condensational and collisional growth of droplets has to be modeled with a 0.1 s time step and that the number of computational particles does not affect domain averages, apart from small changes in the precipitation flux. The 0.1 s time step for condensation and coalescence is realized by carrying out multiple time steps for these processes at each model time step. Different approaches to modeling SGS turbulence were compared in 3-D simulations. The best agreement with other models is obtained using the Smagorinsky scheme and an algorithm for the SGS turbulent motion of computational particles. The implicit LES approach is troubled by the lack of diffusion of liquid water represented by Lagrangian computational particles. Surface precipitation modeled by UWLCM is lower than observed. This suggests that some physical phenomena not modeled by UWLCM, such as SGS turbulence affecting condensation and coalescence of droplets or giant CCN, are important for precipitation formation. In UWLCM, all particles, including humidified aerosols, evolve according to the same set of equations. Therefore, it is not necessary to include droplet activation as an additional process. Advantages of such an approach are most apparent near the cloud base, where bin schemes produce local maxima of cloud droplet concentration, whereas in UWLCM cloud droplet concentration increases monotonously.

The UWLCM, libmpdata++ and libcloudph++ source codes are available at https://github.com/igfuw (last access: 26 June 2019). In the study, the following code versions were used: UWLCM v1.0 (Dziekan and Waruszewski, 2019), libmpdata++ v1.2.0 (Jaruga et al., 2019) and libcloudph++ v2.1.0 (Arabas et al., 2019).

For simulation results, please contact Piotr Dziekan.

Consider condensation of SDs within cell *i* at time step *n*.
The vector of thermodynamic conditions in that cell at the moment right before condensation is calculated is denoted by ${\mathit{\psi}}_{i}^{\left[n\right]}={\left({\mathit{\theta}}^{\left[n\right]},{q}_{\mathrm{v}}^{\left[n\right]}\right)}_{i}$.
The number of time steps is denoted by *S*_{c} and substeps are indexed by *ν*, starting at *ν*=1.
Super-droplets within cell *i* are numbered by *μ*.
The vector of thermodynamic conditions that a given SD experiences at substep *ν* is denoted by ${\stackrel{\mathrm{\u02d8}}{\mathit{\psi}}}_{\mathit{\mu}}^{\left[\mathit{\nu}\right]}$.
Using this notation, the substepping algorithm is

where ${r}_{\mathit{\mu}}^{\mathrm{2}}$ is the square of the wet radius of the *μ*th SD, ${N}_{i}^{\left[n\right]}$ is the number of SDs in cell *i* at time step *n* and
$\mathit{A}=\left({\mathit{\theta}}^{\mathrm{e}}{l}_{\mathrm{v}}/\left({c}_{\mathrm{pd}}{T}^{\mathrm{e}}\right),-\mathrm{1}\right)$.
The sum in Eq. (B3) is calculated over all SDs in cell *i* at time step *n*.
For details on the predictor–corrector algorithm for the calculation of the change of radius in Eq. (B2), see Eqs. (17)–(19) in Arabas et al. (2015).
After the last substep, the value of ${\stackrel{\mathrm{\u02d8}}{\mathit{\psi}}}_{\mathit{\mu}}^{\left[\mathit{\nu}={S}_{\mathrm{c}}\right]}$ is the same for all SDs in the cell and the condensational RHS returned from the condensation algorithm is

The initial value ${\stackrel{\mathrm{\u02d8}}{\mathit{\psi}}}_{\mathit{\mu}}^{\left[\mathit{\nu}=\mathrm{1}\right]}$ is equal to the thermodynamic conditions after condensation finished in the previous time step. Two ways of defining ${\stackrel{\mathrm{\u02d8}}{\mathit{\psi}}}_{\mathit{\mu}}^{\left[\mathit{\nu}=\mathrm{1}\right]}$ are considered that differ regarding the spatial cell from which this initial condition is diagnosed:

referred to as “per-particle” substepping, and

a procedure we call “per-cell” substepping.
The notation *i*(n) stands for the index of the cell in which the *μ*th SD was at time step *n*.
The per-cell substepping is less accurate, but requires less computational time and uses less memory.
The reason for this is that in the per-cell method, all SDs in a given cell have the same values of ${\stackrel{\mathrm{\u02d8}}{\mathit{\psi}}}_{\mathit{\mu}}^{\left[\mathit{\nu}\right]}$.
Moreover, values of pressure and density do not need to be substepped in the per-cell method, as they are constant in time in each cell.

We expect the difference between the two substepping algorithms to be particularly large near a moving cloud edge.
We test this hypothesis by simulating cloud edge advection in an idealized 1-D setup, considering two spatial cells: one at saturation (*q*_{l}=0.029 g kg^{−1}, *N*_{c}≈52 cm^{−3}) and the other subsaturated (relative humidity of 94 %).
The boundaries are periodic and the only processes are diffusional growth and advection.
A single time step (Δ*t*=2 s) is performed, in which Eulerian fields and SDs are advected with the Courant number equal to one.
The expected result is that the two cells exchange their contents without any condensation/evaporation taking place.
The simulations are conducted for different substepping algorithms and different numbers of substeps.
Deviations from the expected result are presented in Table B1.

The per-cell algorithm causes artificial evaporation of droplets, and this error increases with the number of substeps, whereas the per-particle algorithm produces correct results independently of the number of substeps. Therefore, we conclude that in simulations in which there is a lot of cloud edge advection it is necessary to use the per-particle algorithm.

However, in simulations with little cloud edge advection, the per-cell algorithm might be sufficient.
We check this by using different substepping algorithms in a 2-D marine stratocumulus simulation (the DYCOMS RF02 case, cf. Sect. 4).
To limit differences in dynamics between runs, we use the piggybacking approach (Grabowski, 2014): velocity fields from a dynamical “driver” simulation with Δ*t*=0.1 s are used in two other “piggybacking” simulations with Δ*t*=1 s.
No substepping is carried out in the driver simulation and the piggybacking simulations have 10 substeps for condensation, one with the per-cell and the other with the per-particle algorithm.
Time step length in the “driver” run is shorter than in the piggybacking runs, because we want to properly model condensation in the “driver” simulation without substepping, in order to obtain reference results.
Obviously, due to the difference in time step length, the velocity field used in the “piggybacking” simulations is not exactly the same as in the “driver” simulations.
However, averaged vertical profiles of moments of the vertical velocity are similar in the “driver” and the “piggybacker”, so we expect the concentration of cloud droplets in the “piggybacker” to be similar to that of the “driver”.
We are interested in the cloud droplet concentration, because droplet activation is the process that requires short time steps for condensation.
To limit variability between runs caused by the Monte Carlo scheme used to initialize SD radii, a large number of SDs is used in these simulations (*N*_{SD}=1000).
Vertical profiles of concentration of cloud droplets from the “driver” and “piggybacker” runs are shown in Fig. B1.
Interestingly, the per-cell algorithm is in better agreement with the “driver” simulation than the per-particle algorithm. The latter slightly underestimates the concentration of cloud droplets, by ca. 5 %.
Nevertheless, we conclude that both substepping algorithms work well in simulations in which cloud edge does not move significantly.

UWLCM is coded in the C++ language. It relies heavily on two C++ libraries developed by the cloud modeling group at the University of Warsaw: libmpdata++ (Jaruga et al., 2015) for the Eulerian component and libcloudph++ (Arabas et al., 2015) for the Lagrangian component of the model. The structure of the libmpdata++ and libcloudph++ codes, and how they are used, in UWLCM is schematically depicted in Fig. C1.

libmpdata++ is a set of solvers for the generalized transport equations that use the MPDATA advection scheme. The solvers are organized in a hierarchy, ordered from solvers for simple flows to solvers for more complex flows. Each more complex solver inherits from the simpler solver in the hierarchy. Such a design simplifies code development, maintenance and reusability. Apart from the hierarchy of solvers, libmpdata++ contains three other independent modules: boundary conditions, concurrency handlers and output handlers, all of which are used in UWLCM.

libcloudph++ is an implementation of three microphysical models: SDM, a single-moment bulk model and a double-moment bulk model. The SDM is implemented using the Thrust library and the CUDA programming language. Therefore, the SDM can be run on multi-threaded CPUs as well as on multiple GPUs.

The UWLCM code is built on top of the libmpdata++ solvers.
Separate parts of the UWLCM code handle different types of simulations.
The “piggybacking” code makes it possible to run kinematic simulations, i.e., simulations with a prescribed velocity field.
The “2-D/3-D” part of the code handles the dimensionality of the problem.
The “forcings” code specifies external forcings, so it is the part of the code that depends on the simulation setup.
The “microphysics” module is responsible for handling the choice of microphysics (only Lagrangian microphysics is available in the current UWLCM release).
Owing to the code structure, different types of simulations, e.g., 2-D and 3-D simulations, different simulation setups or kinematic simulations, mostly use the same source code.
The highest performance is achieved when UWLCM is run on a system with GPUs.
In this case, the Eulerian component is calculated on CPUs and the Lagrangian component on GPUs.
A large part of these computations is carried out simultaneously (cf. Fig. 1).
The UWLCM code is open-source, under a version-control system and available from a git repository.
Model output is produced in the HDF5 format, ready for plotting in ParaView.
UWLCM also includes simple software for plotting time series and vertical profiles.
A number of test programs was developed for UWLCM, libcloudph++ and libmpdata++.
At this time UWLCM can only run in parallel on shared-memory systems.
An implementation for distributed-memory systems is currently under development.
The UWLCM code is inspired by the *icicle* kinematic model developed by Sylwester Arabas and Anna Jaruga (https://github.com/igfuw/libcloudphxx/models/kinematic_2D, last access: 26 June 2019).

PD developed the model code with contributions from MW. PD performed the simulations. PD and HP prepared the paper with contributions from MW.

The authors declare that they have no conflict of interest.

We thank Wojciech Grabowski for discussions about the model formulation and the paper. We are grateful to the Academic Computer Center CYFRONET AGH for providing computing power.

This research has been supported by the Polish National Science Center (grant no. 2016/23/B/ST10/00690).

This paper was edited by Klaus Gierens and reviewed by two anonymous referees.

Ackerman, A. S., Hobbs, P. V., and Toon, O. B.: A model for particle microphysics, turbulent mixing, and radiative transfer in the stratocumulus-topped marine boundary layer and comparisons with measurements, J. Atmos. Sci., 52, 1204–1236, 1995. a

Ackerman, A. S., vanZanten, M. C., Stevens, B., Savic-Jovcic, V., Bretherton, C. S., Chlond, A., Golaz, J.-C., Jiang, H., Khairoutdinov, M., Krueger, S. K., Lewellen, D. C., Lock, A., Moeng, C.-H., Nakamura, K., Petters, M. D., Snider, J. R., Weinbrecht, S., and Zulauf, M.: Large-Eddy Simulations of a Drizzling, Stratocumulus-Topped Marine Boundary Layer, Mon. Weather Rev., 137, 1083–1110, https://doi.org/10.1175/2008MWR2582.1, 2009. a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r

Andrejczuk, M., Reisner, J., Henson, B., Dubey, M., and Jeffery, C.: The potential impacts of pollution on a nondrizzling stratus deck: Does aerosol number matter more than type?, J. Geophys. Res.-Atmos., 113, D19204, https://doi.org/10.1029/2007JD009445, 2008. a, b

Andrejczuk, M., Grabowski, W., Reisner, J., and Gadian, A.: Cloud-aerosol interactions for boundary layer stratocumulus in the Lagrangian Cloud Model, J. Geophys. Res.-Atmos., 115, D22214, https://doi.org/10.1029/2010JD014248, 2010. a

Arabas, S. and Pawlowska, H.: Adaptive method of lines for multi-component aerosol condensational growth and CCN activation, Geosci. Model Dev., 4, 15–31, https://doi.org/10.5194/gmd-4-15-2011, 2011. a

Arabas, S. and Shima, S.-I.: Large-eddy simulations of trade wind cumuli using particle-based microphysics with Monte Carlo coalescence, J. Atmos. Sci., 70, 2768–2777, 2013. a

Arabas, S., Jaruga, A., Pawlowska, H., and Grabowski, W. W.: libcloudph++ 1.0: a single-moment bulk, double-moment bulk, and particle-based warm-rain microphysics library in C++, Geosci. Model Dev., 8, 1677–1707, https://doi.org/10.5194/gmd-8-1677-2015, 2015. a, b, c, d, e, f, g, h, i

Arabas, S., Jaruga, A., Dziekan, P., Waruszewski, M., and Jarecka, D.: libcloudphx++ code v2.1.0, Zenodo, https://doi.org/10.5281/zenodo.2790277, 2019. a

Arakawa, A. and Lamb, V. R.: Computational design of the basic dynamical processes of the UCLA general circulation model, General circulation models of the atmosphere, 17, 173–265, 1977. a

Chen, J.-P.: Numerical simulations of the redistribution of atmospheric trace chemicals through cloud processes, PhD thesis, Pennsylvania State University, 1992. a

Clark, T. L. and Farley, R. D.: Severe Downslope Windstorm Calculations in Two and Three Spatial Dimensions Using Anelastic Interactive Grid Nesting: A Possible Mechanism for Gustiness, J. Atmos. Sci., 41, 329–350, https://doi.org/10.1175/1520-0469(1984)041<0329:SDWCIT>2.0.CO;2, 1984. a, b

Davis, M. H.: Collisions of small cloud droplets: Gas kinetic effects, J. Atmos. Sci., 29, 911–915, 1972. a

Dziekan, P. and Pawlowska, H.: Stochastic coalescence in Lagrangian cloud microphysics, Atmos. Chem. Phys., 17, 13509–13520, https://doi.org/10.5194/acp-17-13509-2017, 2017. a, b, c, d

Dziekan, P. and Waruszewski, M.: University of Warsaw Lagrangian Cloud Model code v1.0, Zenodo, https://doi.org/10.5281/zenodo.2791156, 2019. a

Gillespie, D. T.: The stochastic coalescence model for cloud droplet growth, J. Atmos. Sci., 29, 1496–1510, 1972. a, b

Grabowski, W. W.: Extracting Microphysical Impacts in Large-Eddy Simulations of Shallow Convection, J. Atmos. Sci., 71, 4493–4499, https://doi.org/10.1175/JAS-D-14-0231.1, 2014. a

Grabowski, W. W. and Abade, G. C.: Broadening of Cloud Droplet Spectra through Eddy Hopping: Turbulent Adiabatic Parcel Simulations, J. Atmos. Sci., 74, 1485–1493, https://doi.org/10.1175/JAS-D-17-0043.1, 2017. a

Grabowski, W. W. and Smolarkiewicz, P. K.: Two-Time-Level Semi-Lagrangian Modeling of Precipitating Clouds, Mon. Weather Rev., 124, 487–497, https://doi.org/10.1175/1520-0493(1996)124<0487:TTLSLM>2.0.CO;2, 1996. a, b, c

Grabowski, W. W., Dziekan, P., and Pawlowska, H.: Lagrangian condensation microphysics with Twomey CCN activation, Geosci. Model Dev., 11, 103–120, https://doi.org/10.5194/gmd-11-103-2018, 2018a. a, b, c

Grabowski, W. W., Morrison, H., Shima, S.-i., Abade, G., Pawlowska, H., and Dziekan, P.: Modeling of cloud microphysics: Can we do better?, B. of Am. Meteorol. Soc., 100, 655–672, https://doi.org/10.1175/BAMS-D-18-0005.1, 2018b. a, b

Grinstein, F. F., Margolin, L. G., and Rider, W. J.: Implicit large eddy simulation: computing turbulent fluid dynamics, Cambridge university press, 2007. a

Hall, W. D.: A detailed microphysical model within a two-dimensional dynamic framework: Model description and preliminary results, J. Atmos. Sci., 37, 2486–2507, 1980. a

Hoffmann, F.: The Effect of Spurious Cloud Edge Supersaturations in Lagrangian Cloud Models: An Analytical and Numerical Study, Mon. Weather Rev., 144, 107–118, https://doi.org/10.1175/MWR-D-15-0234.1, 2016. a

Hoffmann, F., Raasch, S., and Noh, Y.: Entrainment of aerosols and their activation in a shallow cumulus cloud studied with a coupled LCM–LES approach, Atmos. Res., 156, 43–57, https://doi.org/10.1016/j.atmosres.2014.12.008, 2015. a

Hoffmann, F., Noh, Y., and Raasch, S.: The route to raindrop formation in a shallow cumulus cloud simulated by a Lagrangian cloud model, J. the Atmos. Sci., 74, 2125–2142, 2017. a

Jaruga, A., Arabas, S., Jarecka, D., Pawlowska, H., Smolarkiewicz, P. K., and Waruszewski, M.: libmpdata++ 1.0: a library of parallel MPDATA solvers for systems of generalised transport equations, Geosci. Model Dev., 8, 1005–1032, https://doi.org/10.5194/gmd-8-1005-2015, 2015. a, b, c, d, e

Jaruga, A., Arabas, S., Jarecka, D., Waruszewski, M., and Dziekan, P.: libmpdata++ code v1.2.0, Zenodo, https://doi.org/10.5281/zenodo.2787740, 2019. a

Khairoutdinov, M. F. and Randall, D. A.: Cloud resolving modeling of the ARM summer 1997 IOP: Model formulation, results, uncertainties, and sensitivities, J. Atmos. Sci., 60, 607–625, 2003. a

Khvorostyanov, V. I. and Curry, J. A.: Terminal Velocities of Droplets and Crystals: Power Laws with Continuous Parameters over the Size Spectrum, J. Atmospheric Sciences, 59, 1872–1884, https://doi.org/10.1175/1520-0469(2002)059<1872:TVODAC>2.0.CO;2, 2002. a

Klein, R., Achatz, U., Bresch, D., Knio, O. M., and Smolarkiewicz, P. K.: Regime of validity of soundproof atmospheric flow models, J. Atmos. Sci., 67, 3226–3237, 2010. a

Lilly, D. K.: On the numerical simulation of buoyant convection, Tellus, 14, 148–172, 1962. a

Lipps, F. B. and Hemler, R. S.: A Scale Analysis of Deep Moist Convection and Some Related Numerical Calculations, J. Atmos. Sci., 39, 2192–2210, https://doi.org/10.1175/1520-0469(1982)039<2192:ASAODM>2.0.CO;2, 1982. a, b, c, d, e

Margolin, L., Smolarkiewicz, P., and Wyszogradzki, A.: Dissipation in implicit turbulence models: A computational study, J. Appl. Mech., 73, 469–473, 2006. a

Margolin, L. G. and Rider, W. J.: A rationale for implicit turbulence modelling, Int. J. Numer. Meth. Fl., 39, 821–841, 2002. a

Morrison, H., Witte, M., Bryan, G. H., Harrington, J. Y., and Lebo, Z. J.: Broadening of modeled cloud droplet spectra using bin microphysics in an Eulerian spatial domain, J. Atmos. Sci., 75, 4005–4030, https://doi.org/10.1175/JAS-D-18-0055.1, 2018. a

Naumann, A. K. and Seifert, A.: A Lagrangian drop model to study warm rain microphysical processes in shallow cumulus, J. Adv. Model. Earth Sy., 7, 1136–1154, 2015. a

Petters, M. D. and Kreidenweis, S. M.: A single parameter representation of hygroscopic growth and cloud condensation nucleus activity, Atmos. Chem. Phys., 7, 1961-1971, https://doi.org/10.5194/acp-7-1961-2007, 2007. a, b

RAMS Technical Description: The Regional AtmosphericModeling System, Technical Description, available at: http://www.atmet.com/html/docs/rams/rams_techman.pdf, last access: 26 June 2019. a

Riechelmann, T., Noh, Y., and Raasch, S.: A new method for large-eddy simulations of clouds with Lagrangian droplets including the effects of turbulent collision, New J. Phys., 14, 065008, https://doi.org/10.1088/1367-2630/14/6/065008, 2012. a, b

Schmidt, H. and Schumann, U.: Coherent structure of the convective boundary layer derived from large-eddy simulations, J. Fluid Mech., 200, 511–562, 1989. a, b

Schwenkel, J., Hoffmann, F., and Raasch, S.: Improving collisional growth in Lagrangian cloud models: development and verification of a new splitting algorithm, Geosci. Model Dev., 11, 3929–3944, https://doi.org/10.5194/gmd-11-3929-2018, 2018. a

Shima, S.-I., Kusano, K., Kawano, A., Sugiyama, T., and Kawahara, S.: The super-droplet method for the numerical simulation of clouds and precipitation: A particle-based and probabilistic microphysics model coupled with a non-hydrostatic model, Q. J. Roy. Meteor. Soc., 135, 1307–1320, 2009. a, b, c, d, e, f, g, h, i

Smagorinsky, J.: General circulation experiments with the primitive equations: I. The basic experiment, Mon. Weather Rev., 91, 99–164, 1963. a

Smolarkiewicz, P. and Margolin, L.: Variational methods for elliptic problems in fluid models, in: Proc. ECMWF Workshop on Developments in numerical methods for very high resolution global models, 137–159, 2000. a

Smolarkiewicz, P. K.: Multidimensional positive definite advection transport algorithm: an overview, Int. J. Numer. Meth. Fl., 50, 1123–1144, https://doi.org/10.1002/fld.1071, 2006. a, b

Smolarkiewicz, P. K.: Modeling atmospheric circulations with soundproof equations, in: Proc. of the ECMWF Workshop on Nonhydrostatic Modelling, 8-10 November, 2010, Reading, UK, p 1–15, 2011. a

Smolarkiewicz, P. K. and Szmelter, J.: A nonhydrostatic unstructured-mesh soundproof model for simulation of internal gravity waves, Acta Geophys., 59, 1109, https://doi.org/10.2478/s11600-011-0043-z, 2011. a

Smolarkiewicz, P. K., Kühnlein, C., and Wedi, N. P.: A consistent framework for discrete integrations of soundproof and compressible PDEs of atmospheric dynamics, J. Comput. Phys., 263, 185–205, https://doi.org/10.1016/j.jcp.2014.01.031, 2014. a

Smolarkiewicz, P. K., Kühnlein, C., and Wedi, N. P.: Semi-implicit integrations of perturbation equations for all-scale atmospheric dynamics, J. Comput. Phys., 376, 145–159, 2019. a

Stevens, B., Feingold, G., Cotton, W. R., and Walko, R. L.: Elements of the microphysical structure of numerically simulated nonprecipitating stratocumulus, J. Atmos. Sci., 53, 980–1006, 1996. a

Stevens, B., Lenschow, D. H., Vali, G., Gerber, H., Bandy, A., Blomquist, B., Brenguier, J. L., Bretherton, C. S., Burnet, F., Campos, T., Chai, S., Faloona, I., Friesen, D., Haimov, S., Laursen, K., Lilly, D. K., Loehrer, S. M., Malinowski, S. P., Morley, B., Petters, M. D., Rogers, D. C., Russell, L., Savic-Jovcic, V., Snider, J. R., Straub, D., Szumowski, M. J., Takagi, H., Thornton, D. C., Tschudi, M., Twohy, C., Wetzel, M., and van Zanten, M. C.: Dynamics and Chemistry of Marine Stratocumulus–DYCOMS-II, B. Am. Meteorol. Soc., 84, 579–594, https://doi.org/10.1175/BAMS-84-5-579, 2003. a

Stevens, D. E., Ackerman, A. S., and Bretherton, C. S.: Effects of domain size and numerical resolution on the simulation of shallow cumulus convection, J. Atmos. Sci., 59, 3285–3301, 2002. a

Unterstrasser, S., Hoffmann, F., and Lerch, M.: Collection/aggregation algorithms in Lagrangian cloud microphysical models: rigorous evaluation in box model simulations, Geosci. Model Dev., 10, 1521–1548, https://doi.org/10.5194/gmd-10-1521-2017, 2017. a, b

- Abstract
- Introduction
- Governing equations
- Numerical algorithms
- Comparison with other models – marine stratocumulus simulations
- Summary
- Code availability
- Data availability
- Appendix A: List of symbols
- Appendix B: Condensation substepping algorithm
- Appendix C: Software implementation
- Author contributions
- Competing interests
- Acknowledgements
- Financial support
- Review statement
- References

- Abstract
- Introduction
- Governing equations
- Numerical algorithms
- Comparison with other models – marine stratocumulus simulations
- Summary
- Code availability
- Data availability
- Appendix A: List of symbols
- Appendix B: Condensation substepping algorithm
- Appendix C: Software implementation
- Author contributions
- Competing interests
- Acknowledgements
- Financial support
- Review statement
- References