Adiabatic Motion

class tests.test_case_0dparcel.adiabatic_motion.AdiabaticMotion(amp, tau)[source]

Bases: object

A class for driving the adiabatic expansion/contraction of a volume of air.

Enacts adiabatic sinusoidal pressure change of parcel of air.

Args:
amp (float):

Amplitude of pressure sinusoid [Pa].

tau (float):

Time period of the pressure sinusoid [s].

Attributes:
amp (float):

Amplitude of pressure sinusoid [Pa].

omega (float):

Angular frequency of pressure sinusoid (tau is time period) [radians s^-1].

cp_dry (float):

Specific heat capacity of water vapour [J/Kg/K] (IAPWS97 at 273.15K).

rgas_dry (float):

Specific gas constant for dry air [J/Kg/K] (approx. 287 J/Kg/K).

epsilon (float):

Ratio of gas constants, dry air / water vapour (approx. 0.622).

adiabatic_odes(y, time, qvap)[source]
dpress_dtime(time)[source]

Calculate the rate of change of pressure with respect to time.

The rate of change of pressure with respect to time is calculated from the equation:

\[\frac{dP}{dt} = - \omega \cdot A \cos(\omega t)\]

so that pressure evolution follows:

\[P(t) = P_{\rm init} - A \sin(\omega t)\]

where \(P_{\rm init} = P(t=t_{\rm{init}})\)

Args:

time (float): Current time [s].

Returns:

float: Rate of change of pressure with respect to time [Pa/s].

drho_dtime(qvap, temp, rho, dtemp_dt, dpress_dt)[source]

Calculate the rate of change of density with respect to time.

The rate of change of temperature with respect to time is calculated from the equation:

\[\frac{d\rho}{dt} = \frac{\rho}{P} \frac{dP}{dt} - \frac{\rho}{T} \frac{dT}{dt}\]

where

\[P = \rho R_{\rm dry} \left(1 + \frac{q_{\rm v}}{\epsilon}\right) T\]

assuming \(q_{\rm v} \approx r_{\rm v}\), i.e. \(q_{\rm dry} \gg q_{\rm v}\).

Args:
temp (np.ndarray):

Temperature of air [K].

rho (np.ndarray):

Density of air [Kg/m^3].

qvap (np.ndarray):

Mass mixing ratio of water vapor [Kg/Kg].

dpress_dt (np.ndarray):

Rate of change of pressure with respect to time [Pa/s].

dtemp_dt (np.ndarray):

Rate of change of temperature with respect to time [K/s].

Returns:

np.ndarray: Rate of change of density with respect to time [Kg/m^3/s].

dtemp_dtime(rho, dpress_dt)[source]

Calculate the rate of change of temperature with respect to time.

The rate of change of temperature with respect to time is calculated from the equation:

\[\frac{dT}{dt} = \frac{1}{\rho c_{\rm p, dry}} \frac{dP}{dt}\]

assuming \(c_{\rm p} \approx c_{\rm p, dry}\), i.e. \(q_{\rm dry}c_{\rm p, dry} \gg q_{\rm v}c_{\rm p, v}\), and \(q_{\rm dry}c_{\rm p, dry} \gg q_{\rm v}c_{\rm k}\) for all condensates \(k\).

Args:
rho (np.ndarray):

Density of air [Kg/m^3].

dpress_dt (np.ndarray):

Rate of change of pressure with respect to time [Pa/s].

Returns:

np.ndarray: Rate of change of temperature with respect to time [K/s].

run(time, timestep, thermo)[source]

Run the adiabatic motion computations.

This method integrates the equations from time to time+timestep for adiabatic expansion/contraction of a parcel of air.

Args:
time (float):

Current time [s].

timestep (float):

Time step size for the simulation [s].

thermo (Thermodynamics):

Object representing the thermodynamic state of the air.

Returns:

Thermodynamics: Updated thermodynamic state of the air.