0-D Model Test Case

Copyright (c) 2024 MPI-M, Clara Bayley

—– Microphysics Test Cases —– File: perform_0dparcel_test_case.py Project: test_case_0dparcel Created Date: Wednesday 28th February 2024 Author: Clara Bayley (CB) Additional Contributors: —– Last Modified: Wednesday 4th June 2025 Modified By: CB —– License: BSD 3-Clause “New” or “Revised” License https://opensource.org/licenses/BSD-3-Clause —– File Description: interface called by a test to run the 0-D parcel and then plot the results.

libs.test_case_0dparcel.perform_0dparcel_test_case.perform_0dparcel_test_case(time_init, time_end, timestep, thermo_init, microphys_scheme, binpath, run_name)[source]

Run test case for a 0-D parcel model.

This function runs a 0-D parcel model with a specified microphysics scheme and parcel dynamics given the initial thermodynamics. The data is then saved/plotted in the binpath directory using the run_name as a label.’’’

Args:
time_init (float):

Initial time for the simulation (s).

time_end (float):

End time for the simulation (s).

timestep (float):

Timestep for the simulation (s).

thermo_init (Thermodynamics):

Initial thermodynamic conditions.

microphys_scheme:

Microphysics scheme to use in test run.

binpath (str):

Path to the directory where data/plots will be saved.

run_name (str):

Name of the test run (used for labeling output).

Raises:

AssertionError: If the specified binpath does not exist or if run_name is empty.

Returns:

None

libs.test_case_0dparcel.perform_0dparcel_test_case.plot_0dparcel_massmix_ratios(out, binpath, run_name)[source]

Plot mass mixing ratios for a 0-D parcel model and save the plots.

This function plots the mass mixing ratios of water vapor, cloud liquid, cloud ice, rain, snow, and graupel for a run of the 0-D parcel model as a function of time and then saves the plots as a PNG image.

Args:
out (OutputThermodynamics):

OutputThermodynamics object containing the mass mixing ratio data.

binpath (str):

Path to the directory where the plots will be saved.

run_name (str):

Name of the test run to use in naming saved image.

Raises:

AssertionError: If the specified binpath does not exist or if run_name is empty.

Returns:

None

libs.test_case_0dparcel.perform_0dparcel_test_case.plot_0dparcel_thermodynamics(out, binpath, run_name)[source]

Plot thermodynamic variables for a 0-D parcel model and save the plots.

This function plots the pressure, density, temperature, and potential temperature(s) of a run of the 0-D parcel model as a function of time and then saves the plots as a PNG image.

Args:
out (OutputThermodynamics):

OutputThermodynamics object containing the thermodynamic data.

binpath (str):

Path to the directory where the plots will be saved.

run_name (str):

Name of the test run to use in naming saved image.

Raises:

AssertionError: If the specified binpath does not exist or if run_name is empty.

Returns:

None

libs.test_case_0dparcel.perform_0dparcel_test_case.plot_mse_on_axis(ax, time, temp, qvap)[source]

Plot moist static energy (MSE) on a specified axis.

This function calculates and plots MSE against time on a specified axis.

Args:

ax (matplotlib.axes.Axes): The (x-y) axis on which to plot the MSE. time (array-like): Time values (x axis). temp (OutputVariable): Temperature variable. qvap (OutputVariable): Mass mixing ratio of water vapour variable.

Returns:

None

libs.test_case_0dparcel.perform_0dparcel_test_case.plot_relh_on_axis(ax, time, temp, press, qvap)[source]

Plot relative humidity (relh) on a specified axis.

This function calculates and plots relh against time on a specified axis.

Args:

ax (matplotlib.axes.Axes): The (x-y) axis on which to plot relh. time (array-like): Time values (x axis). temp (OutputVariable): Temperature variable. press (OutputVariable): Pressure variable. qvap (OutputVariable): Mass mixing ratio of water vapour variable.

Returns:

None

libs.test_case_0dparcel.perform_0dparcel_test_case.plot_thetas_on_axis(ax, time, temp, press, qvap)[source]

Plot potential temperature(s) on a specified axis.

This function calculates and plots potential temperature(s) against time on a specified axis.

Args:

ax (matplotlib.axes.Axes): The (x-y) axis on which to plot the potential temperature(s). time (array-like): Time values (x axis). temp (OutputVariable): Temperature variable. press (OutputVariable): Pressure variable. qvap (OutputVariable): Mass mixing ratio of water vapour variable.

Returns:

None