Condensation represents the process that the vapor of a compound condenses onto the surface of existing particle population. MAM currently considers two trace gases: sulfur acid gas ($\rm H_2SO_4$, and its condensed particles $\rm SO_4$) and a single lumped gas species of secondary organic aerosol (SOAG, and its condensed particles SOA \cite{liu-2012-gmd}).
The key parameter of condensation process is the mass transfer coefficient of species $l$ ($l \in \{ {\rm SOAG, H_2SO_4} \}$) to/from particle population (unit: $\rm s^{-1}$). By assuming that the particles are spherical and the size distribution of the particle population is described by a few log-normal modes, MAM calculates the mass transfer coefficient of species $l$ in mode $i$ ($C_{_{l,i}}$) as \cite{fuchs-1971}:
\begin{equation} \label{kmt} C_{_{l,i}} = \int_{-\infty}^{\infty} 2 \pi D_{_p} \mathbb{D}_{_{g,l}} f(K_{_{n,l}},\alpha_{_{l}}) n_{_{i}}(\ln D_{_{p}}) d\ln D_{_{p}} \,, \end{equation}where
\begin{itemize} \item $D_{_{p}}$ is the aerosol particle diameter (unit: m); \item $n_{_{i}}(\ln D_{_{p}})$ is the log-normal size distribution of mode $i$; \item $\mathbb{D}_{_{g,l}}$ is the gas diffusivity (unit: $\rm m^2 \cdot s^{-1}$). It is calculated by \cite{fuller-1966-iec}: \begin{equation} \label{gasd} \mathbb{D}_{_{g,l}} = \frac{10^{-7}T^{1.75} \sqrt{\frac{1}{M_{_{w,l}}}+\frac{1}{M_{_{w,air}}}}} {p \left( \mathbb{V}_{_{D,l}}^\frac{1}{3}+ \mathbb{V}_{_{D,air}}^\frac{1}{3} \right)^2} \,, \end{equation} Here $T$ is air temperature (unit: K); $p$ is air pressure (unit: $\rm atm$ (the standard temperature and pressure)); $\mathbb{V}_{_{D,l}}$ (unitless) is the molecular diffusion volume; $M_{_{w,l}}$ is the molecular weight (unit: $\rm g \cdot mol^{-1}$). Both $\mathbb{V}_{_{D,l}}$ and $M_{_{w,l}}$ are constants for a given species $l$; \item $K_{_{n,l}}$ is the Knudsen number (unitless). It is calculated by: \begin{equation} \label{knu} K_{_{n,l}} = \frac{2\lambda_{_{l}}}{D_{_{p}}} \,, \end{equation} where $\lambda_{_{l}}$ is the mean free path of vapor molecules in air (unit: m) and it is calculated by: \begin{equation} \label{mfp} \lambda_{_{l}} = \frac{3\mathbb{D}_{_{g,l}}}{v_{_{l}}} \,, \end{equation} where $v_{_{l}} = \sqrt{\frac{8RT}{\pi M_{_{w,l}}}}$ is the mean speed of vapor molecules (unit: $\rm m \cdot s^{-1}$); \item $\alpha_{_{l}}$ is the accommodation coefficient (unitless), which is a constant for a given species $l$; \item $f(K_{_{n,l}}, \alpha_{_{l}})$ is a correction factor for the transition regime where the mean free path of vapor molecules is close to the particle diameter. It takes the formula below: \begin{equation} \label{fka} f(K_{_{n,l}}, \alpha_{_{l}}) = \frac{0.75 \alpha_{_{l}} (1+K_{_{n,l}})}{0.75 \alpha_{_{l}} + K_{_{n,l}} (1+K_{_{n,l}}+0.283 \alpha_{_{l}})} \,. \end{equation} \end{itemize}Currently MAM calculates the $C_{_{H_2SO_4,i}}$ through Eq. \eqref{kmt}. Due to the large uncertainty of speciation and physical properties of SOAG/SOA, MAM assumes $C_{_{SOAG,i}} \approx 0.81 C_{_{H_2SO_4,i}}$ for simplicity. More details about the model parameterization, assumption and numerical implementation can be found in a separate model documentation.
During the the calculation of $C_{_{l,i}}$, MAM used rounded constants instead of the formulae for some parameters (see details in Section 3.1). Using limited decimal digits would introduce numerical inaccuracy but the magnitude of error remains unknown. Thus in this test, we aim at examining the impact of using rouned parameters on the accuracy of the calculation of $C_{_{l,i}}$ in MAM. Since MAM assumes $C_{_{SOAG,i}} \approx 0.81 C_{_{H_2SO_4,i}}$, we then focus on the verification of $C_{_{H_2SO_4,i}}$.
This verification test uses a box model that inherits the data structure and condensation subroutines from MAM in E3SM. The box model serves as a driver program to specify the necessary parameters in order to calculate the MAM and reference solutions.
We call the original condensation subroutines in MAM to calculate the $C_{_{H_2SO_4,i}}$. 2 Gauss-Hermite quadrature roots are used to evaluate the integral in Eq. \eqref{kmt}. In addition, the following three rounded constants are used:
\begin{align} \frac{1}{M_{_{w,air}}} &\approx 0.035 \\ \text{standard pressure} &\approx 101300~Pa \\ \sqrt{\frac{8R}{\pi}} &\approx 145.5 \end{align}Therefore, the following three parameters are calculated approximately as:
\begin{align} p &\approx \frac{P}{101300} \,, \\ \mathbb{D}_{_{g,l}} &\approx \frac{10^{-7}T^{1.75} \sqrt{\frac{1}{M_{_{w,l}}}+0.035}} {p \left( \mathbb{V}_{_{D,l}}^\frac{1}{3}+2.7189 \right)^2} \,, \label{round_dgas} \\ v_{_{l}} &\approx 145.5\sqrt{\frac{T}{M_{_{w,l}}}} \,, \end{align}where P is the pressure with unit Pa. This solution is denoted as $C_{_{MAM}}$.
To generate the reference solutions, we first calculate the following terms with their original formulae:
\begin{align} \mathbb{D}_{_{g,l}} &= \frac{10^{-7}T^{1.75} \sqrt{\frac{1}{M_{_{w,l}}}+\frac{1}{M_{_{w,air}}}}} {p \left( \mathbb{V}_{_{D,l}}^\frac{1}{3}+ \mathbb{V}_{_{D,air}}^\frac{1}{3} \right)^2} \,, \\ p &= \frac{P}{101325} \,, \\ v_{_{l}} &= \sqrt{\frac{8RT}{\pi M_{_{w,l}}}} \,. \end{align}We then use 2 Gauss-Hermite quadrature points from the original MAM to evaluate the Eq. \eqref{kmt}. This solution is denoted as $C_{_{REF}}$. The accuracy of using Gauss-Hermite quadrature rule to evaluate the integral $\int_{-\infty}^{\infty} f(x)e^{-x^2} dx$, where f(x) is a polynomial, has been verified in a separate verification test.
In this verification test, the following quantities are specified:
\begin{enumerate} \item $\alpha_{_{H_2SO_4}} = 0.65$ \cite{poschl-1998-jpca}. \item Temperature $T$ (unit: K) and pressure $P$ (unit: Pa), for which 5 pairs of values are used to represent the typical conditions from troposphere to stratosphere: \begin{align} \rm T&: 310, 298, 273, 230, 200 \\ \rm P&: 10^5, 8.5 \times 10^4, 7 \times 10^4, 2 \times 10^4, 10^4 \end{align} \item Molecular diffusion volume $\mathbb{V}_{_{D,H_2SO_4}} = 42.88$ and $\mathbb{V}_{_{D,air}} = 20.1$ \item Molecular weight $M_{_{w,H_2SO_4}} = 98.0783997$ and $M_{_{w,air}} = 28.966$. \item Number concentration of particle population within each mode ($N_{_{t,i}}$, unit: $\# \cdot m^{-3}$). We set the values based on our previous experience and they are summarized in the table below. \item Geometric mean dry diameter ($D_{_{gn,d,i}}$, unit: $\mu m$) and geometric standard deviation ($\sigma_{_{g,i}}$) for each mode. The values of $D_{_{gn,d,i}}$ and $\sigma_{_{g,i}}$ are chosen to represent the midrange values for tropospheric aerosol observations, and are listed in the table below \cite{dick-2004-jgr}. The geometric mean wet diameter ($D_{_{gn,w,i}}$) is assumed to be 1.2 times the $D_{_{gn,d,i}}$ in this verification test for simplicity. $D_{gn,w,i}$ is the actual value used to evaluate the integral in Eq. \eqref{kmt}. \item 2 Gauss-Hermite quadrature points ($\mathbb{R_{_i}}$) and their associated weights ($\mathbb{W_{_i}}$) used in the original MAM (less accurate), based on the \cite{zwillinger2002crc}. \end{enumerate}With these parameters known, totally 20 (= 5×4) verification tests are performed.
In each test, the driver program calls MAM's condensation subroutines to calculate the $C_{_{MAM}}$ and $C_{_{REF}}$, respectively. The relative error between MAM solution and reference solution is then calculated as:
\begin{equation} \phi = \frac{\left| C_{_{MAM}} - C_{_{REF}} \right|}{C_{_{REF}}} \,. \label{relerr} \end{equation}Because the least accurate parameter is rounded to two digits (0.035 in Eq. \eqref{round_dgas}), an overall PASS is issued if $\phi \lt 10^{-2}$ for all the 20 tests.
The verification test requires a test driver to perform the verification test and the configuration files for compilation and execution of cmdv-test-runner (e.g., the yaml file). If we go the root directory of CMDV-Verification folder that is cloned from GitHub Repo, the test driver code (driver.F90) is under $\rm \color{blue}{tests/mam/restructed\_tests/F90\_SRC/test\_drivers/condensation/rounded\_parameter\_accuracy}$ and the yaml file is under $\rm \color{blue}{tests/mam/restructed\_tests/yaml\_files\_for\_test\_runner/condensation/rounded\_parameter\_accuracy.test.yaml}$.
Note that this test is not expected to run nightly and thus not included in the latest CMDV-Verification GitHub Repo. In order to run this test, please checkout the version with hash 5e0c49ae4b6866742414547a995e085ba92d60d8 first.
If the verification test runs successfully, we should obtain the netcdf file named "condensation_verification_test.nc" with MAM and reference solutions. Assume that the netcdf file is put under the "postprocess_input" folder, we could calculate the $\phi$ based on Eq. \eqref{relerr}. Then we could issue an overall PASS/FAIL based on the criterion in Section 3.4.
# load library and modules
import numpy as np
import xarray as xr
# define the file path and name
nc_file = "./postprocess_input/condensation_verification_test.nc"
# open the netcdf file and read in the MAM and reference solutions
ds = xr.open_dataset(nc_file)
mam = np.array(ds['rounded_para_sol'])
ref = np.array(ds['exact_para_sol'])
pver = ds['pver'].size
mode = ds['mode'].size
# calculate the relative errors
phi = np.zeros((pver,mode))
for k in np.arange(pver):
for n in np.arange(mode):
phi[k,n] = np.abs(mam[k,n] - ref[k,n]) / ref[k,n]
# check maximum/minimum relative error
print("maximum relative error: %.4e" % np.amax(phi))
print("minimum relative error: %.4e" % np.amin(phi))
# issue PASS/FAIL
test = phi < 1.e-2
if np.all(test):
print("PASS")
else:
print("FAIL")
[1] Liu X., Easter R. C., Ghan S. J. et al., ``Toward a minimal representation of aerosols in climate models: description and evaluation in the Community Atmosphere Model CAM5'', Geoscientific Model Development, vol. 5, number 3, pp. 709--739, 2012. online
[2] NA Fuchs and AG Sutugin, ``High dispersed aerosols: in: Topics in current aerosol research, edited by: Hidy, GM and Brock, JR, vol. 2'', 1971.
[3] Fuller Edward N, Schettler Paul D and Giddings J Calvin, ``New method for prediction of binary gas-phase diffusion coefficients'', Industrial \& Engineering Chemistry, vol. 58, number 5, pp. 18--27, 1966.
[4] P{\"o}schl Ulrich, Canagaratna Manjula, Jayne John T et al., ``Mass accommodation coefficient of H2SO4 vapor on aqueous sulfuric acid surfaces and gaseous diffusion coefficient of H2SO4 in N2/H2O'', The Journal of Physical Chemistry A, vol. 102, number 49, pp. 10082--10089, 1998.
[5] Easter Richard C., Ghan Steven J., Zhang Yang et al., ``MIRAGE: Model description and evaluation of aerosols and trace gases'', Journal of Geophysical Research: Atmospheres, vol. 109, number D20, pp. , 2004.
[6] Daniel Zwillinger, ``CRC standard mathematical tables and formulae'', 2002.