yaelarieli / Calculate-adiabatic-fraction-in-a-cloud

0 stars 1 forks source link

Calculate adiabatic fraction in a cloud

This project was originally implemented as part of the Python programming course at the Weizmann Institute of Science taught by Gabor Szabo

This project is a program that calculates the adiabatic fraction (AF) in a cloud.

Short introduction

The cloud can be described as a mixture of undiluted – adiabatic parts that do not exchange energy and material with the surroundings and non-adiabatic parts that mix with the environment's air. Hence, the adiabatic fraction (AF) is a measure of adiabaticity, and we can use it as a measure of mixing. The AF is defined as $LWC/LWC{ad}$, where $LWC{ad}$ is the liquid water content that a parcel would gain while being lifted adiabatically from the cloud base. Eytan at el. (2021) tested different methods to calculate AF values by comparing them to an Eulerain passive tracer. The method found to be the most accurate follows the analytical derivation of Korolev and Mazin (2003) of the supersaturation in an adiabatic ascending parcel while changing the time domain to vertical coordinates (and changing $q_w = \frac{LWC}{\rho_d}$).

(1) $\frac{dlog(S+1)}{dz}=A_1-A_2\frac{dLWC}{dz}$

(2) $A_1=\frac{g}{T}(\frac{L_w}{c_pR_vT}-\frac{1}{R_a})$

(3) $A_2=\frac{1}{\rho_v}+\frac{L_w^2}{c_pR_vT^2\rho_d}$

where $S$ is the supersaturation, $g$ is the gravity acceleration, $T$ is the temperature, $L_w$ is the latent heat of water evaporation, $c_p$ is the specific heat of air at constant pressure, $R_v$ and $R_a$ are the specific gas constants of water vapor and dry air, respectively, and $\rho_v$ and $\rhod$ are the respective density of water vapor and dry air. Since these equations do not include mixing effects, we can consider that $LWC = LWC{ad}$. Additionally, for $S<<1$, Eq.1 can be approximated to

$LWC{ad}(z)\approx \int{z_0}^{z'}\frac{A_1(z')}{A2(z')}dz'-\int{z_0}^{z}\frac{1}{A_2(z')}\frac{dS}{dz'}dz'$

where $z_0 = 0$ at the cloud base.

For the calculation of $LWC_{ad}$, there is a need for thermodynamic profiles (temperature $T(z)$ and specific humidity $q_v(z)$ ). These profiles can be taken from the regions that are considered to be the most adiabatic; hence, the temperature and humidity profiles of the average of the points with the highest $5$% updraft values at each level.

Technicalities

Inputs

The required input for this program is a NetCDF file containing data from an LES simulation of a cloud.

The necessary fields are:

z need to be a 1D vector, all the rest of the field can be 2D matrix.

The constants are :

Install the dependencies

The requirement installations are in requirements.txt

pip install -r requirements.txt

Tests the program

To test the program run:

pytest

Run the program

The main program is contained in the project.py file, while the required functions are defined in func_for_project.py. The program will provide a figure of a cross-section of the AF field.

To run the program, you need to provide the input file name in the command line:

python project.py INPUT_FILE [OPTIONS]

Replace INPUT_FILE with the path to your netCDF file. You can use the file in the folder called data_for_AFcalc.nc.

Options

--CloudBase or -Zb: Index of cloud base height. The default value set to 60.

--CorePrecentage or -pact: Percentage of the highest values in the core variable. The default value is set to 95.