Skip to content

Thermodynamics

 import minuteman.cpg.thermo as thermo

Calorically perfect gases are those where gases are chemically unreactive and intermolecular forces are neglected. Internal energy and enthalpy are functions of temperature only and the specific heats are constant.

This is the case for atmospheric air below ~1000 K. However, at higher temperatures where \(O_2\) and \(N_2\) vibrational motion/excitation becomes important, the gas is no longer calorically perfect.

High-level API

minuteman.cpg.thermo.isentropic_process_by_density

isentropic_process_by_density(
    density_ratio: ArraylikeFloat, specific_heat_ratio: ArraylikeFloat
) -> IsentropicProcessResult

Compute the state change of an isentropic process from the change in density, \(\rho_2 / \rho_1\).

Parameters:

  • density_ratio (ArraylikeFloat) –

    density ratio, \(\rho_2 / \rho_1\). Bounds: \((0, \infty)\)

  • specific_heat_ratio (ArraylikeFloat) –

    ratio of specific heats, \(\gamma\). Bounds: \((1, 1.67]\)

Returns:

Raises:

  • OutOfBoundsError –

    invalid inputs

minuteman.cpg.thermo.isentropic_process_by_pressure

isentropic_process_by_pressure(
    pressure_ratio: ArraylikeFloat, specific_heat_ratio: ArraylikeFloat
) -> IsentropicProcessResult

Compute the state change of an isentropic process from the change in pressure, \(p_2 / p_1\).

Parameters:

  • pressure_ratio (ArraylikeFloat) –

    pressure ratio, \(p_2 / p_1\). Bounds: \((0, \infty)\)

  • specific_heat_ratio (ArraylikeFloat) –

    ratio of specific heats, \(\gamma\). Bounds: \((1, 1.67]\)

Returns:

Raises:

  • OutOfBoundsError –

    invalid inputs

minuteman.cpg.thermo.isentropic_process_by_speed_of_sound

isentropic_process_by_speed_of_sound(
    speed_of_sound_ratio: ArraylikeFloat, specific_heat_ratio: ArraylikeFloat
) -> IsentropicProcessResult

Compute the state change of an isentropic process from the change in speed of sound, \(a_2 / a_1\).

Parameters:

  • speed_of_sound_ratio (ArraylikeFloat) –

    speed of sound ratio, \(a_2 / a_1\). Bounds: \((0, \infty)\)

  • specific_heat_ratio (ArraylikeFloat) –

    ratio of specific heats, \(\gamma\). Bounds: \((1, 1.67]\)

Returns:

Raises:

  • OutOfBoundsError –

    invalid inputs

minuteman.cpg.thermo.isentropic_process_by_temperature

isentropic_process_by_temperature(
    temperature_ratio: ArraylikeFloat, specific_heat_ratio: ArraylikeFloat
) -> IsentropicProcessResult

Compute the state change of an isentropic process from the change in temperature, \(T_2 / T_1\).

Parameters:

  • temperature_ratio (ArraylikeFloat) –

    temperature ratio, \(T_2 / T_1\). Bounds: \((0, \infty)\)

  • specific_heat_ratio (ArraylikeFloat) –

    ratio of specific heats, \(\gamma\). Bounds: \((1, 1.67]\)

Returns:

Raises:

  • OutOfBoundsError –

    invalid inputs

Low-level API

minuteman.cpg.thermo.entropy_change_pv

entropy_change_pv(
    pressure_ratio: ArraylikeFloat,
    specific_volume_ratio: ArraylikeFloat,
    specific_heat_constant_pressure: ArraylikeFloat,
    specific_heat_constant_volume: ArraylikeFloat,
) -> NDArrayFloat

Compute the change in specific entropy \(s_2 - s_1\) for a known change in pressure and specific volume.

Parameters:

  • pressure_ratio (ArraylikeFloat) –

    pressure ratio, \(p_2 / p_1\)

  • specific_volume_ratio (ArraylikeFloat) –

    specific volume ratio, \(v\!\!\text{-}_2 / v\!\!\text{-}_1\)

  • specific_heat_constant_pressure (ArraylikeFloat) –

    specific heat of constant pressure, \(c_p\)

  • specific_heat_constant_volume (ArraylikeFloat) –

    specific heat of constant volume, \(c_v\)

Returns:

  • NDArrayFloat –

    Change in specific entropy, \(s_2 - s_1\)

minuteman.cpg.thermo.entropy_change_tp

entropy_change_tp(
    temperature_ratio: ArraylikeFloat,
    pressure_ratio: ArraylikeFloat,
    specific_heat_constant_pressure: ArraylikeFloat,
    gas_constant: ArraylikeFloat,
) -> NDArrayFloat

Compute the change in specific entropy \(s_2 - s_1\) for a known change in temperature and pressure.

Parameters:

  • temperature_ratio (ArraylikeFloat) –

    temperature ratio, \(T_2 / T_1\)

  • pressure_ratio (ArraylikeFloat) –

    pressure ratio, \(p_2 / p_1\)

  • specific_heat_constant_pressure (ArraylikeFloat) –

    specific heat at constant pressure, \(c_p\)

  • gas_constant (ArraylikeFloat) –

    specific gas constant, \(R\)

Returns:

  • NDArrayFloat –

    Change in specific entropy, \(s_2 - s_1\)

minuteman.cpg.thermo.entropy_change_tv

entropy_change_tv(
    temperature_ratio: ArraylikeFloat,
    specific_volume_ratio: ArraylikeFloat,
    specific_heat_constant_volume: ArraylikeFloat,
    gas_constant: ArraylikeFloat,
) -> NDArrayFloat

Compute the change in specific entropy \(s_2 - s_1\) for a known change in temperature and specific volume.

Parameters:

  • temperature_ratio (ArraylikeFloat) –

    temperature ratio, \(T_2 / T_1\)

  • specific_volume_ratio (ArraylikeFloat) –

    specific volume ratio, \(v\!\!\text{-}_2 / v\!\!\text{-}_1\)

  • specific_heat_constant_volume (ArraylikeFloat) –

    specific heat at constant volume, \(c_v\)

  • gas_constant (ArraylikeFloat) –

    specific gas constant, \(R\)

Returns:

  • NDArrayFloat –

    Change in specific entropy, \(s_2 - s_1\)

minuteman.cpg.thermo.entropy_state

entropy_state(
    pressure: ArraylikeFloat,
    density: ArraylikeFloat,
    specific_heat_ratio: ArraylikeFloat,
    gas_constant: ArraylikeFloat,
) -> NDArrayFloat

Compute entropy state of a calorically perfect gas, \(s\).

Parameters:

Returns:

minuteman.cpg.thermo.specific_enthalpy

specific_enthalpy(
    specific_internal_energy: ArraylikeFloat, pressure: ArraylikeFloat, density: ArraylikeFloat
) -> NDArrayFloat

Compute specific enthalpy (per unit mass), \(h\)

Parameters:

Returns:

minuteman.cpg.thermo.specific_heat_constant_pressure

specific_heat_constant_pressure(
    specific_heat_ratio: ArraylikeFloat, gas_constant: ArraylikeFloat
) -> NDArrayFloat

Computes the specific heat at constant pressure, \(c_p\).

Valid for perfect (thermally & calorically) gases.

Parameters:

  • specific_heat_ratio (ArraylikeFloat) –

    ratio of specific heats, \(\gamma\)

  • gas_constant (ArraylikeFloat) –

    specific gas constant, \(R\)

Returns:

  • NDArrayFloat –

    Specific heat at constant pressure, \(c_p\)

minuteman.cpg.thermo.specific_heat_constant_volume

specific_heat_constant_volume(
    specific_heat_ratio: ArraylikeFloat, gas_constant: ArraylikeFloat
) -> NDArrayFloat

Computes the specific heat at constant volume, \(c_v\).

Valid for perfect (thermally & calorically) gases.

Parameters:

  • specific_heat_ratio (ArraylikeFloat) –

    ratio of specific heats, \(\gamma\)

  • gas_constant (ArraylikeFloat) –

    specific gas constant, \(R\)

Returns:

  • NDArrayFloat –

    Specific heat at constant volume, \(c_v\)

minuteman.cpg.thermo.total_energy

total_energy(
    pressure: ArraylikeFloat,
    density: ArraylikeFloat,
    speed: ArraylikeFloat,
    specific_heat_ratio: ArraylikeFloat,
) -> NDArrayFloat

Compute total energy per unit volume, \(e\)

Parameters:

Returns:

Data Structures

minuteman.cpg.thermo.IsentropicProcessResult dataclass

The result of an isentropic process, containing the ratios between states 1 (initial) and 2 (final)

temperature_ratio: NDArrayFloat instance-attribute

Temperature ratio, \(T_2 / T_1\)

pressure_ratio: NDArrayFloat instance-attribute

Pressure ratio, \(p_2 / p_1\)

density_ratio: NDArrayFloat instance-attribute

Density ratio, \(\rho_2 / \rho_1\)

speed_of_sound_ratio: NDArrayFloat instance-attribute

Speed of sound ratio, \(a_2 / a_1\)

specific_heat_ratio: NDArrayFloat instance-attribute

Ratio of specific heats, \(\gamma\)

Constants

minuteman.cpg.thermo.avogadro = scc.Avogadro module-attribute

Avogadro constant, \(N_A\) [#/mol]

minuteman.cpg.thermo.boltzmann_imperial = scc.Boltzmann / (scc.foot * scc.pound_force * scc.convert_temperature(1.0, 'K', 'R')) module-attribute

Boltzmann constant \(k\) in Imperial units [ft-lb/R]

minuteman.cpg.thermo.boltzmann_si = scc.Boltzmann module-attribute

Boltzmann constant \(k\) in SI units [J/K]

minuteman.cpg.thermo.gas_constant_air_imperial_lbm = universal_gas_constant_imperial_lbm / molecular_weight_air module-attribute

Specific gas constant \(R\) for air in Imperial units [ft-lbf/(lbm R)]

minuteman.cpg.thermo.gas_constant_air_imperial_slug = universal_gas_constant_imperial_slug / molecular_weight_air module-attribute

Specific gas constant \(R\) for air in Imperial units [ft-lbf/(slug R)]

minuteman.cpg.thermo.gas_constant_air_si = universal_gas_constant_si / molecular_weight_air module-attribute

Specific gas constant \(R\) for air in SI units [J/(kg K)]

minuteman.cpg.thermo.molecular_weight_air = 28.9647 module-attribute

Molecular weight for dry air \(M_{air}\) [kg/kg-mol]

minuteman.cpg.thermo.universal_gas_constant_imperial_lbm = scc.R * scc.kilo * scc.pound / (scc.foot * scc.pound_force * scc.convert_temperature(1.0, 'K', 'R')) module-attribute

Universal gas constant \(R_U\) in Imperial units [ft-lbf/(lbm-mol R)]

minuteman.cpg.thermo.universal_gas_constant_imperial_slug = scc.R * scc.kilo * scc.slug / (scc.foot * scc.pound_force * scc.convert_temperature(1.0, 'K', 'R')) module-attribute

Universal gas constant \(R_U\) in Imperial units [ft-lbf/(slug-mol R)]

minuteman.cpg.thermo.universal_gas_constant_si = scc.R * scc.kilo module-attribute

Universal gas constant \(R_U\) in SI units [J/(kg-mol K)]