Common classes#
Here we can find the documentation for the common functions and classes implemented in the Combustion Toolbox (CT).
Constants#
- class Constants#
Bases:
handle
Class with constants data
- R0#
Universal gas constant [J/(K mol)]
- Type:
float
- G#
Standard gravity [m/s2]
- Type:
float
- NA#
Avogadro’s number [molecule/mol]
- Type:
float
- release#
Release of the Combustion Toolbox
- Type:
char
- date#
Date of the release
- Type:
char
Examples
R0 = Constants.R0
g = Constants.G
release = Constants.release
- G = '9.80665'
Standard gravity [m/s2]
- HBAR = '6.626070041e-34'#
Planck constant [J-s]
- KB = '1.38064852e-23'#
Boltzmann constant [J/K]
- NA = '6.0221415e23'
Avogadro’s number [molecule/mol]
- R0 = '8.31446261815324'
Universal gas constant [J/(K mol)]
- date = "'20 Mar 2025'"
Release date
- release = "'v1.2.1'"
Release version
Units#
- class Units#
Bases:
handle
Class with conversion factors between different units
- C2K = '@(x) x + 273.15'#
Degrees Celsius to Kelvin
- F2C = '@(x) (x - 32) * 5/9'#
Fahrenheit to degrees Celsius
- K2C = '@(x) x - 273.15'#
Temperature conversion factors
- K2F = '@(x) (x - 273.15) * 9/5 + 32'#
Kelvin to Fahrenheit
- L2ft3 = '28.3168^-1'#
Liters to cubic feet
- L2m3 = '1e-3'#
Liters to cubic meters
- Pa2atm = '101325^-1'#
Pascales to atmospheres
- Pa2bar = '1e-5'#
Pascals to bar
- atm2Pa = '101325'#
Atmospheres to Pascales
- atm2bar = '1.01325'#
Pressure conversion factors
- bar2Pa = '1e5'#
Bar to Pascals
- bar2atm = '1.01325^-1'#
Bar to atmospheres
- static convert(value_in, unit_in, unit_out)#
Convert a value from one unit to another
- Parameters:
value_in (
double
) – Value to convertunit_in (
char
) – Unit of the input valueunit_out (
char
) – Unit of the output value
- Returns:
value_out – Value converted to the output unit
Examples
Units.convert(1, ‘atm’, ‘bar’)
Units.convert(273.15, ‘K’, ‘C’)
Units.convert(1, ‘kg’, ‘lbs’)
Units.convert(1, ‘m3’, ‘ft3’)
Units.convert(1, ‘m3’, ‘L’)
- static convertData2VelocityField(data)#
Convert the input to a VelocityField object
- Parameters:
data – Either a VelocityField object, a struct, or a 4D matrix
- Returns:
velocity (VelocityField) – VelocityField object
- static convertWeightPercentage2moles(listSpecies, weightPercentage, database)#
Convert weight percentage (wt%) to moles
- Parameters:
listSpecies (
cell
) – List of speciesweightPercentage (
float
) – Weight percentage of the species [%]database (
Database
) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
moles (float) – Number of moles [mol]
Example
moles = Units.WeightPercentage2moles({‘H2O’, ‘CO2’}, [50, 50], database)
- ft32L = '28.3168'#
Cubic feet to liters
- ft32m3 = '35.3147^-1'#
Cubic feet to cubic meters
- g2kg = '1e-3'#
Grams to kilograms
- kg2g = '1e3'#
Kilograms to grams
- kg2lbs = '2.20462'#
Mass conversion factors
- lbs2kg = '0.453592'#
Pounds to kilograms
- m32L = '1e3'#
Cubic meters to liters
- m32ft3 = '35.3147'#
Volume conversion factors