g3d.gas package
Submodules
g3d.gas.gas module
Gas class definition
- class g3d.gas.gas.Gas(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntityGas: thermodynamic variables and gas relations (equation of state) extends G3DEntity
- Attributes:
Cpspecific heat at constant pressure
Cvspecific heat at constant volume
PrPrandtl number
Rgas constant (gas specific)
g_over_gm1ratio of specific heats over ratio of specific heats minus one
gammaratio of specific heat Cp/Cv
gm1ratio of specific heats minus one
gm1_over_gratio of specific heats minus one over ratio of specific heats
gp1ratio of specific heats plus one
one_over_gm1one over ratio of specific heats minus one
tagtag (string) used for identification
viscosityviscosity
Methods
copy(gas)copies gas properties from provided instance of class Gas input: gas example: copy(Gas g)
get_density(P, T)calculates density RO [kg/m^3] from provided pressure P [Pa] and temperature T [K] input: pressure P [Pa], temperature T [K] example: RO = get_density(P, T)
get_energy_from_primitive(ro, p, u[, v, w])calculates energy (ro * e_o) from provided primitive variables input: density, pressure, velocity example: roe_o = et_energy_from_primitive(ro, p, u, v, w)
returns gas data input: no input example: gamma, R, Cp, Cv = get_gas_data()
get_pressure(T, ro)calculates pressure P [Pa] from provided temperature T [K] and density RO [kg/m^3] input: temperature T [K], density RO [kg/m^3] example: P = get_pressure(T, RO)
get_pressure_from_conservative(ro, et, ru[, ...])calculates pressure from provided conservative variables input: ro, re_o, ru, rv, rw example: p = get_pressure_from_conservative(ro, re_o, ru, rv, rw)
calculates speed of sound C [m/s] from specified temperature T [K] input: temperature T[K] example: C = get_speed_of_sound(T)
get_temperature(P, ro)calculates temperature T [K] from provided pressure [Pa] and density [kg/m^3] input: pressure P [Pa], density RO [kg/m^3] example: T = get_temperature(P, RO)
calculates temperature T [K] from specified speed of sound C [m/s] input: speed of sound C [m/s] example: T = get_temperature_from_speed_of_sound(C)
calculates one over exponent in isentropic relation for pressure input: T2/T1 example: exp = inv_isentropic_exp_p(T2/T1
calculates one over exponent in isentropic relation for density input: T2/T1 example: exp = inv_isentropic_exp_ro(T2/T1
calculates exponent in isentropic relation for pressure input: T2/T1 example: exp = isentropic_exp_p(T2/T1
calculates exponent in isentropic relation for density input: T2/T1 example: exp = isentropic_exp_ro(T2/T1
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for Gas class: 'gamma', 'R', 'viscosity', 'Pr' example: set_from_key_value(key, value)
- property Cp: float
specific heat at constant pressure
- property Cv: float
specific heat at constant volume
- property Pr: float
Prandtl number
- property R: float
gas constant (gas specific)
- copy(gas: Gas) None[source]
copies gas properties from provided instance of class Gas input: gas example: copy(Gas g)
- property g_over_gm1: float
ratio of specific heats over ratio of specific heats minus one
- property gamma: float
ratio of specific heat Cp/Cv
- get_density(P: float | ndarray, T: float | ndarray) float | ndarray[source]
calculates density RO [kg/m^3] from provided pressure P [Pa] and temperature T [K] input: pressure P [Pa], temperature T [K] example: RO = get_density(P, T)
- get_energy_from_primitive(ro: float | ndarray, p: float | ndarray, u: float | ndarray, v: float | ndarray = 0.0, w: float | ndarray = 0.0) float | ndarray[source]
calculates energy (ro * e_o) from provided primitive variables input: density, pressure, velocity example: roe_o = et_energy_from_primitive(ro, p, u, v, w)
- get_gas_data() Tuple[float, float, float, float][source]
returns gas data input: no input example: gamma, R, Cp, Cv = get_gas_data()
- get_pressure(T: float | ndarray, ro: float | ndarray) float | ndarray[source]
calculates pressure P [Pa] from provided temperature T [K] and density RO [kg/m^3] input: temperature T [K], density RO [kg/m^3] example: P = get_pressure(T, RO)
- get_pressure_from_conservative(ro: float | ndarray, et: float | ndarray, ru: float | ndarray, rv: float | ndarray = 0.0, rw: float | ndarray = 0.0) float | ndarray[source]
calculates pressure from provided conservative variables input: ro, re_o, ru, rv, rw example: p = get_pressure_from_conservative(ro, re_o, ru, rv, rw)
- get_speed_of_sound(T: float | ndarray) float | ndarray[source]
calculates speed of sound C [m/s] from specified temperature T [K] input: temperature T[K] example: C = get_speed_of_sound(T)
- get_temperature(P: float | ndarray, ro: float | ndarray) float | ndarray[source]
calculates temperature T [K] from provided pressure [Pa] and density [kg/m^3] input: pressure P [Pa], density RO [kg/m^3] example: T = get_temperature(P, RO)
- get_temperature_from_speed_of_sound(a: float | ndarray) float | ndarray[source]
calculates temperature T [K] from specified speed of sound C [m/s] input: speed of sound C [m/s] example: T = get_temperature_from_speed_of_sound(C)
- property gm1: float
ratio of specific heats minus one
- property gm1_over_g: float
ratio of specific heats minus one over ratio of specific heats
- property gp1: float
ratio of specific heats plus one
- inv_isentropic_exp_p(x: float | ndarray) float | ndarray[source]
calculates one over exponent in isentropic relation for pressure input: T2/T1 example: exp = inv_isentropic_exp_p(T2/T1
- inv_isentropic_exp_ro(x: float | ndarray) float | ndarray[source]
calculates one over exponent in isentropic relation for density input: T2/T1 example: exp = inv_isentropic_exp_ro(T2/T1
- isentropic_exp_p(x: float | ndarray) float | ndarray[source]
calculates exponent in isentropic relation for pressure input: T2/T1 example: exp = isentropic_exp_p(T2/T1
- isentropic_exp_ro(x: float | ndarray) float | ndarray[source]
calculates exponent in isentropic relation for density input: T2/T1 example: exp = isentropic_exp_ro(T2/T1
- property one_over_gm1: float
one over ratio of specific heats minus one
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for Gas class: ‘gamma’, ‘R’, ‘viscosity’, ‘Pr’ example: set_from_key_value(key, value)
- property viscosity: float
Module contents
g3d/gas sub library
- class g3d.gas.Gas(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntityGas: thermodynamic variables and gas relations (equation of state) extends G3DEntity
- Attributes:
Cpspecific heat at constant pressure
Cvspecific heat at constant volume
PrPrandtl number
Rgas constant (gas specific)
g_over_gm1ratio of specific heats over ratio of specific heats minus one
gammaratio of specific heat Cp/Cv
gm1ratio of specific heats minus one
gm1_over_gratio of specific heats minus one over ratio of specific heats
gp1ratio of specific heats plus one
one_over_gm1one over ratio of specific heats minus one
tagtag (string) used for identification
viscosityviscosity
Methods
copy(gas)copies gas properties from provided instance of class Gas input: gas example: copy(Gas g)
get_density(P, T)calculates density RO [kg/m^3] from provided pressure P [Pa] and temperature T [K] input: pressure P [Pa], temperature T [K] example: RO = get_density(P, T)
get_energy_from_primitive(ro, p, u[, v, w])calculates energy (ro * e_o) from provided primitive variables input: density, pressure, velocity example: roe_o = et_energy_from_primitive(ro, p, u, v, w)
returns gas data input: no input example: gamma, R, Cp, Cv = get_gas_data()
get_pressure(T, ro)calculates pressure P [Pa] from provided temperature T [K] and density RO [kg/m^3] input: temperature T [K], density RO [kg/m^3] example: P = get_pressure(T, RO)
get_pressure_from_conservative(ro, et, ru[, ...])calculates pressure from provided conservative variables input: ro, re_o, ru, rv, rw example: p = get_pressure_from_conservative(ro, re_o, ru, rv, rw)
calculates speed of sound C [m/s] from specified temperature T [K] input: temperature T[K] example: C = get_speed_of_sound(T)
get_temperature(P, ro)calculates temperature T [K] from provided pressure [Pa] and density [kg/m^3] input: pressure P [Pa], density RO [kg/m^3] example: T = get_temperature(P, RO)
calculates temperature T [K] from specified speed of sound C [m/s] input: speed of sound C [m/s] example: T = get_temperature_from_speed_of_sound(C)
calculates one over exponent in isentropic relation for pressure input: T2/T1 example: exp = inv_isentropic_exp_p(T2/T1
calculates one over exponent in isentropic relation for density input: T2/T1 example: exp = inv_isentropic_exp_ro(T2/T1
calculates exponent in isentropic relation for pressure input: T2/T1 example: exp = isentropic_exp_p(T2/T1
calculates exponent in isentropic relation for density input: T2/T1 example: exp = isentropic_exp_ro(T2/T1
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for Gas class: 'gamma', 'R', 'viscosity', 'Pr' example: set_from_key_value(key, value)
- property Cp: float
specific heat at constant pressure
- property Cv: float
specific heat at constant volume
- property Pr: float
Prandtl number
- property R: float
gas constant (gas specific)
- copy(gas: Gas) None[source]
copies gas properties from provided instance of class Gas input: gas example: copy(Gas g)
- property g_over_gm1: float
ratio of specific heats over ratio of specific heats minus one
- property gamma: float
ratio of specific heat Cp/Cv
- get_density(P: float | ndarray, T: float | ndarray) float | ndarray[source]
calculates density RO [kg/m^3] from provided pressure P [Pa] and temperature T [K] input: pressure P [Pa], temperature T [K] example: RO = get_density(P, T)
- get_energy_from_primitive(ro: float | ndarray, p: float | ndarray, u: float | ndarray, v: float | ndarray = 0.0, w: float | ndarray = 0.0) float | ndarray[source]
calculates energy (ro * e_o) from provided primitive variables input: density, pressure, velocity example: roe_o = et_energy_from_primitive(ro, p, u, v, w)
- get_gas_data() Tuple[float, float, float, float][source]
returns gas data input: no input example: gamma, R, Cp, Cv = get_gas_data()
- get_pressure(T: float | ndarray, ro: float | ndarray) float | ndarray[source]
calculates pressure P [Pa] from provided temperature T [K] and density RO [kg/m^3] input: temperature T [K], density RO [kg/m^3] example: P = get_pressure(T, RO)
- get_pressure_from_conservative(ro: float | ndarray, et: float | ndarray, ru: float | ndarray, rv: float | ndarray = 0.0, rw: float | ndarray = 0.0) float | ndarray[source]
calculates pressure from provided conservative variables input: ro, re_o, ru, rv, rw example: p = get_pressure_from_conservative(ro, re_o, ru, rv, rw)
- get_speed_of_sound(T: float | ndarray) float | ndarray[source]
calculates speed of sound C [m/s] from specified temperature T [K] input: temperature T[K] example: C = get_speed_of_sound(T)
- get_temperature(P: float | ndarray, ro: float | ndarray) float | ndarray[source]
calculates temperature T [K] from provided pressure [Pa] and density [kg/m^3] input: pressure P [Pa], density RO [kg/m^3] example: T = get_temperature(P, RO)
- get_temperature_from_speed_of_sound(a: float | ndarray) float | ndarray[source]
calculates temperature T [K] from specified speed of sound C [m/s] input: speed of sound C [m/s] example: T = get_temperature_from_speed_of_sound(C)
- property gm1: float
ratio of specific heats minus one
- property gm1_over_g: float
ratio of specific heats minus one over ratio of specific heats
- property gp1: float
ratio of specific heats plus one
- inv_isentropic_exp_p(x: float | ndarray) float | ndarray[source]
calculates one over exponent in isentropic relation for pressure input: T2/T1 example: exp = inv_isentropic_exp_p(T2/T1
- inv_isentropic_exp_ro(x: float | ndarray) float | ndarray[source]
calculates one over exponent in isentropic relation for density input: T2/T1 example: exp = inv_isentropic_exp_ro(T2/T1
- isentropic_exp_p(x: float | ndarray) float | ndarray[source]
calculates exponent in isentropic relation for pressure input: T2/T1 example: exp = isentropic_exp_p(T2/T1
- isentropic_exp_ro(x: float | ndarray) float | ndarray[source]
calculates exponent in isentropic relation for density input: T2/T1 example: exp = isentropic_exp_ro(T2/T1
- property one_over_gm1: float
one over ratio of specific heats minus one
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for Gas class: ‘gamma’, ‘R’, ‘viscosity’, ‘Pr’ example: set_from_key_value(key, value)
- property viscosity: float