Utilities#
A collection of routines with multiple purposes organized as follows:
unclasifieddatabasesdisplayeosexportextensionsroot_findingthermovalidations
Unclasified utility functions#
A collection of unclasified functions necessary to perform all the calculations in CT.
Routines
- Compute_YFuel(mix, mix_Fuel)#
Compute fuel mass fraction [-]
- Parameters:
mix (
struct) – Properties of the mixture (fuel + oxidizer + inerts)mix_Fuel (
struct) – Properties of the mixture (fuel)
- Returns:
Yi_Fuel (float) – Mass fractions of the fuel mixture
Example
Yi_Fuel = Compute_YFuel(mix, mix_Fuel)
- GPL()#
Return Combustion Toolbox license
- Returns:
license_content (char) – The license text
Example
license_content = GPL()
- append_cells(cell1, cell2, varargin)#
Append two or more cells in one common cell
- Parameters:
cell1 (
struct) – Cell 1cell2 (
struct) – Cell 2
- Optional Args:
celli (struct): Additional cells
- Returns:
append_cell (struct) – Merged cell
- append_structs(s1, s2, varargin)#
Append two or more structs in one common struct
- Parameters:
s1 (
struct) – Struct 1s2 (
struct) – Struct 2
- Optional Args:
si (struct): Additional structs
- Returns:
append_s (struct) – Merged struct
- assign_vector2cell(cell, vector, varargin)#
Assign values of a vector into a cell
- Parameters:
cell (
cell) – Cell in which the values of the given vector are going to be includedvector (
any) – Vector with the values that are going to be included in the cell
- Optional Args:
ind (float): List of index positions to assign specific positions to the cell
- Returns:
cell (cell) – Cell with the values of the given vector
- cell2vector(value, varargin)#
Convert values of an individual cell into a vector. If the value correspond with a struct it can return as a vector the values of a given fieldname.
- Parameters:
value (
cell or struct) – Data of the mixture, conditions, and databases
- Optional Args:
field (char): Fieldname of the given value (only for struct or objects)
- Returns:
vector (any) – Vector with the values of the individual cell/fieldname (only for struct or objects)
- convert_Pa_to_bar(value)#
Convert pressure in [Pa] units to [bar]
- Parameters:
value (
float) – Pressure value(s) in [bar]- Returns:
value (float) – Pressure value(s) in [bar]
Example
value = convert_Pa_to_bar(1e5)
- convert_atm_to_bar(value)#
Convert pressure in [atm] units to [bar]
- Parameters:
value (
float) – Pressure value(s) in [atm]- Returns:
value (float) – Pressure value(s) in [bar]
Example
value = convert_atm_to_bar(1)
- convert_bar_to_Pa(value)#
Convert pressure in [bar] units to [Pa]
- Parameters:
value (
float) – Pressure value(s) in [bar]- Returns:
value (float) – Pressure value(s) in [Pa]
Example
value = convert_bar_to_Pa(1)
- convert_bar_to_atm(value)#
Convert pressure in [bar] units to [atm]
- Parameters:
value (
float) – Pressure value(s) in [bar]- Returns:
value (float) – Pressure value(s) in [atm]
Example
value = convert_bar_to_atm(1.01325)
- getTypeSpecies(obj)#
Create cell array with the type of species in the mixture
- Parameters:
obj (
Mixture) – Mixture class- Returns:
typeSpecies (cell) – Cell array with the type of species in the mixture
- get_FLAG_N(self)#
Flag if the number of moles of fuel, oxidant and inert species is specified. If not, consider 1 mole for the fuel and calculate the remaining moles from the equivalence relation.
- Parameters:
self (
struct) – Data of the mixture, conditions, and databases- Returns:
self (struct) – Data of the mixture, conditions, and databases
- post_results(self)#
Postprocess all the results with predefined plots
- Parameters:
self (
struct) – Data of the mixture, conditions, and databases
- print_error(ME, varargin)#
Print message error
- Parameters:
ME (
object) – MException object that allows to identify the error
- Optional Name-Value Pairs Args:
type (char): Type of message (error, warning, or other)
message_solution (char): Message solution
- Returns:
error_message (char) – Message error
Examples
error_message = print_error(ME, ‘Type’, ‘Warning’)
error_message = print_error(ME, ‘Type’, ‘Warning’, ‘Solution’, ‘Returning an empty index value.’)
- set_prop(self, varargin)#
Assign property values to the respective variables
- Parameters:
self (
struct) – Data of the mixture, conditions, and databases
- Optional Args:
field (str): Fieldname in Problem Description (PD)
value (float): Value/s to assing in the field in Problem Description (PD)
- Returns:
self (struct) – Data of the mixture, conditions, and databases
- set_transformation(self, field, value)#
Set the corresponding value of the field in Problem Description (PD)
- Parameters:
self (
struct) – Data of the mixture, conditions, and databasesfield (
str) – Fieldname in Problem Description (PD)value (
float) – Value/s to assign to the field
- Returns:
self (struct) – Data of the mixture, conditions, and databases
- smooth_data(x, y, varargin)#
Smooth data using Fourier NonlinearLeastSquares method
- Parameters:
x (
float) – data in the x directiony (
float) – data in the y direction
- Optional Args:
start_point (float): initial point of the fit
- Returns:
Tuple containing
x (float): smooth data in the x direction
y (float): smooth data in the y direction
- soundspeed_eq(self, mix, P0, T0)#
Compute speed of sound at equilibrium
- Parameters:
self (
struct) – Data of the mixture, conditions, and databasesmix (
struct) – Struct mix with all the properties of the mixtureP0 (
float) – Pressure [bar]T0 (
float) – Temperature [K]
- Returns:
sound (float) – sound speed [m/s]
- vector2cell(value)#
Create cell array from vector
- Parameters:
value (
any) – Vector with data of any type- Returns:
c (cell) – Cell with the values of the vector
Database functions#
A collection of functions necessary to obtain generate the databases in CT.
Routines
- findSpecies(listSpecies, cond_with, type_with, cond_without, type_without)#
Find species in the given list that contain all/any elements of cond_with and that not include all/any elements of cond_without
- Parameters:
listSpecies (
cell) – List of speciescond_with (
cell) – List of elements to includetype_with (
char) – Satisfy all or any of the elements in cond_withcond_without (
cell) – List of elements to avoidtype_without (
char) – Satisfy all or any of the elements in cond_without
- Returns:
listSpecies (cell) – List of species
Examples
- listSpecies = findSpecies(listSpecies, {‘C’,’N’,’O’,’minus’,’plus’,’Ar’}, ‘any’,…
- {‘I’, ‘S’, ‘L’, ‘T’, ‘P’, ‘F’, ‘ab’, ‘W’,…
‘Z’,’X’,’R’,’Os’,’Cr’,’H’,’Br’,’G’,’K’,… ‘U’,’Co’,’Cu’,’B’,’V’,’Ni’,’Na’,’Mg’,… ‘Mo’,’Ag’,’Nb’,’Cb’,’Cl’,’D’,’T’,… ‘Ca’,’Cs’,’Ne’,’Cd’,’Mn’}, ‘all’)
listSpecies = findSpecies(DB.listSpecies, {}, ‘any’, {‘_M’}, ‘all’)
- getIndexElements(listSpecies, database, elements, MAX_ELEMENTS)#
Get element indeces of each species contained in listSpecies
- Parameters:
listSpecies (
cell) – List of speciesdatabase (
Database) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fitselements (
cell) – Elements in the periodic tableMAX_ELEMENTS (
float) – Maximum number of elements contained in one species
- Returns:
indexElements (float) – Matrix numel(listSpecies) x MAX_ELEMENTS with element indeces of the species contained in listSpecies
Example
indexElements = getIndexElements(listSpecies, database, elements, MAX_ELEMENTS)
- set_DhT(listSpecies, T, DB)#
Function that computes the vector of thermal enthalpy for the given set of species [J/mol]
- Parameters:
listSpecies (
cell) – List of speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
DhT (float) – Thermal enthalpy in molar basis [J/mol]
Example
DhT = set_DhT({‘H2O’, ‘CO2’}, 298.15, DB)
- set_cP(listSpecies, T, DB)#
Function that computes the vector of specific heats at constant pressure for the given set of species [J/(mol-K)]
- Parameters:
listSpecies (
cell) – List of speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
cP (float) – Specific heat at constant pressure in molar basis [J/(mol-K)]
Example
cP = set_cP({‘H2O’, ‘CO2’}, 298.15, DB)
- set_e0(listSpecies, T, DB)#
Function that computes the vector of internal energy for the given set of species [J/mol]
- Parameters:
listSpecies (
cell) – List of speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
e0 (float) – Internal energy in molar basis [J/mol]
Example
e0 = set_e0({‘H2O’, ‘CO2’}, 298.15, DB)
- set_g0(listSpecies, T, DB)#
Function that computes the vector of gibbs free energy for the given set of species [J/mol]
- Parameters:
listSpecies (
cell) – List of speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
g0 (float) – Gibbs energy in molar basis [J/mol]
Example
g0 = set_g0({‘H2O’, ‘CO2’}, 298.15, DB)
- set_h0(listSpecies, T, DB)#
Function that computes the vector of enthalpies for the given set of species [J/mol]
- Parameters:
listSpecies (
cell) – List of speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
h0 (float) – Enthalpy in molar basis [J/mol]
Example
h0 = set_h0({‘H2O’, ‘CO2’}, 298.15, DB)
- set_prop_DB(listSpecies, property, DB)#
Function that gets the vector of the defined property for the given set of species
- Parameters:
listSpecies (
cell) – List of speciesproperty (
str) – Property to obtain from the databaseDB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
value (float) – Property vector
Example
value = set_prop_DB({‘H2O’, ‘CO2’}, ‘hf’, DB)
- set_s0(listSpecies, T, DB)#
Function that computes the vector of entropy for the given set of species [J/(mol-K)]
- Parameters:
listSpecies (
cell) – List of speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
s0 (float) – Entropy in molar basis [J/(mol-K)]
Example
s0 = set_s0({‘H2O’, ‘CO2’}, 298.15, DB)
- species_DeT(species, T, DB)#
Compute thermal internal energy [J/mol] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
DeT (float) – Thermal internal energy in molar basis [J/mol]
Example
DeT = species_DeT(‘H2O’, 300, DB)
- species_DhT(species, T, DB)#
Compute thermal enthalpy [J/mol] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
DhT (float) – Thermal enthalpy in molar basis [J/mol]
Example
DhT = species_DhT(‘H2O’, 300, DB)
- species_cP(species, T, DB)#
Compute specific heat at constant pressure [J/(mol-K)] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
cp (float) – Specific heat at constant pressure in molar basis [J/(mol-K)]
Example
cp = species_cP(‘H2O’, 300, DB)
- species_cV(species, T, DB)#
Compute specific heat at constant volume [J/(mol-K)] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
cv (float) – Specific heat at constant volume in molar basis [J/(mol-K)]
Example
cv = species_cv(‘H2O’, 300, DB)
- species_e0(species, T, DB)#
Compute internal energy [J/mol] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
e0 (float) – Internal energy in molar basis [J/mol]
Example
e0 = species_e0(‘H2O’, 300, DB)
- species_g0(species, T, DB, varargin)#
Compute Gibbs energy [J/mol] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
g0 (float) – Gibbs energy in molar basis [J/mol]
Example
g0 = species_g0(‘H2O’, 298.15, DB)
- species_gamma(species, T, DB)#
Compute adiabatic index of the species [-] at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
gamma (float) – Adiabatic index [-]
Example
gamma = species_gamma(‘H2O’, 300, DB)
- species_h0(species, T, DB)#
Compute enthalpy [J/mol] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
h0 (float) – Enthalpy in molar basis [J/mol]
Example
h0 = species_h0(‘H2O’, 300, DB)
- species_s0(species, T, DB)#
Compute entropy [J/(mol-K)] of the species at the given temperature [K] using piecewise cubic Hermite interpolating polynomials and linear extrapolation
- Parameters:
species (
char) – Chemical speciesT (
float) – Temperature [K]DB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Returns:
s0 (float) – Entropy in molar basis [J/(mol-K)]
Example
s0 = species_s0(‘H2O’, 300, DB)
Display functions#
A collection of functions necessary to display the results (command window and plots).
Routines
Equation of State functions#
A collection of Equation of States (EoS) implemented in CT.
Routines
Export functions#
A collection of functions to export results.
Routines
Extensions functions#
A collection of external functions from other repositories.
Combustion Toolbox’s color palette is obtained from the following repository: Stephen (2021). ColorBrewer: Attractive and Distinctive Colormaps (https://github.com/DrosteEffect/BrewerMap), GitHub. Retrieved December 3, 2021.
For validations, Combustion Toolbox uses CPU Info from the following repository: Ben Tordoff (2022). CPU Info (https://github.com/BJTor/CPUInfo/releases/tag/v1.3), GitHub. Retrieved March 22, 2022.
Combustion Toolbox’s splash screen is based on a routine from the following repository: Ben Tordoff (2022). SplashScreen (https://www.mathworks.com/matlabcentral/fileexchange/30508-splashscreen), MATLAB Central File Exchange. Retrieved October 15, 2022.
Root finding algorithms#
Roots algorithm used to obtain the temperature at equilibrium for a given thermochemical transformation. The methods implemented are:
Newton-Raphson method.
Steffensen-Aitken method.
Routines
Thermodynamic properties#
Functions to obtain thermodynamic properties from a given mixture.
Routines
- MolecularWeight(mix)#
Get the molecular weight [g/mol] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Molecular weight [g/mol] of the mixture
- adiabaticIndex(mix)#
Get the adiabatic index [-] of the mixture from the ratio of the specific heat capacities
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Adiabatic index of the mixture [-]
- adiabaticIndex_sound(mix)#
Get the adiabatic index [-] of the mixture from definition of sound velocity
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Adiabatic index [-] of the mixture
- compressibility_factor(mix)#
Compute compressibility factor of the mixture [-]
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
Z (float) – Compressibility factor [-]
- compute_heatrelease(mix1, mix2)#
Compute heat release [J/kg] of the chemical transformation of the mixture 1 to mixture 2
- Parameters:
mix1 (
struct) – Properties of the initial mixturemix2 (
struct) – Properties of the final mixture
- Returns:
q (float) – heat release [J/kg] == [m^2/s^2] Q (float): dimensionless heat release
- compute_sound(T, p, species, composition, varargin)#
Routine to compute sound velocity [m/s] for a given temperature-pressure profile
- Parameters:
T (
float) – Temperature [K]p (
float) – Pressure [bar]species (
cell) – List of speciescomposition (
float) – composition of species (mol)
- Optional Name-Value Pairs Args:
self (struct): Data of the mixtures, conditions, databases
- Returns:
sound (float) – Sound velocity [m/s]
Examples
sound = compute_sound(300, 1, {‘H2’, ‘O2’}, [1, 1]) sound = compute_sound(300, 1, {‘H2’, ‘O2’}, [1, 1], ‘self’, self)
- cp_mass(mix)#
Get the mass-basis specific heat at constant pressure [kJ/kg-K] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific heat at constant pressure [kJ/kg-K] of the mixture
- cp_mole(mix)#
Get the mole-basis specific heat at constant pressure [kJ/mol-K] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific heat at constant pressure [kJ/mol-K] of the mixture
- cv_mass(mix)#
Get the mass-basis specific heat at constant volume [kJ/kg-K] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific heat at constant volume [kJ/kg-K] of the mixture
- cv_mole(mix)#
Get the mole-basis specific heat at constant volume [kJ/mol-K] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific heat at constant volume [kJ/mol-K] of the mixture
- density(mix)#
Get the density [kg/m3] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – density [kg/m3] of the mixture
- enthalpy_formation_mass(mix)#
Get the mass specific enthalpy formation [kJ/kg] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific enthalpy formation [kJ/kg] of the mixture
- enthalpy_formation_mole(mix)#
Get the mole specific enthalpy formation [kJ/mol] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific enthalpy formation [kJ/mol] of the mixture
- enthalpy_mass(mix)#
Get the mass specific enthalpy [kJ/kg] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific enthalpy [kJ/kg] of the mixture
- enthalpy_mole(mix)#
Get the mole specific enthalpy [kJ/mol] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific enthalpy [kJ/mol] of the mixture
- entropy_mass(mix)#
Get the mass specific entropy [kJ/kg-K] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific entropy [kJ/kg-K] of the mixture
- entropy_mole(mix)#
Get the mole specific entropy [kJ/mol-K] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific entropy [kJ/mol-K] of the mixture
- equivalenceRatio(mix)#
Get the equivalence ratio of the initial mixture [-]
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Equivalence ratio of the initial mixture [-]
- gibbs_mass(mix)#
Get the mass specific gibbs free energy [kJ/kg] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific gibbs free energy [kJ/kg] of the mixture
- gibbs_mole(mix)#
Get the mole specific gibbs free energy [kJ/mol] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific gibbs free energy [kJ/mol] of the mixture
- humiditySpecific(T, p, humidityRelative)#
Get the specific humidity of air [kg_w/kg_da] at a given temperature, pressure, and relative humidity
- Parameters:
T (
float) – Temperature [K]p (
float) – Pressure [bar]humidityRelative (
float) – Relative humidity [%]
- Returns:
value (float) – Specific humidity of air [kg_w/kg_da]
- intEnergy_mass(mix)#
Get the mass specific internal energy [kJ/kg] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass-basis specific internal energy [kJ/kg] of the mixture
- intEnergy_mole(mix)#
Get the mole specific internal energy [kJ/mol] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole-basis specific internal energy [kJ/mol] of the mixture
- mass(mix)#
Get the mass [kg] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – mass [kg] of the mixture
- massFractions(mix)#
Get the mass fractions of all the species in the mixture [-]
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mass fractions of all the species in the mixture [-]
- meanMolecularWeight(mix)#
Get the mean molecular weight [g/mol] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mean molecular weight [g/mol] of the mixture
- moleFractions(mix)#
Get the mole fractions of all the species in the mixture [-]
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Mole fractions of all the species in the mixture [-]
- moles(mix)#
Get the moles [mol] of all the species in the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Moles [mol] of all the species in the mixture
- molesGas(mix)#
Get the moles of the gases in the mixture [mol]
- pressure(mix)#
Get the pressure [bar] in the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Pressure [bar] in the mixture
- soundspeed(mix)#
Get the speed of sound [m/s] in the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Speed of sound [m/s] in the mixture
- temperature(mix)#
Get the temperature [K] in the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Temperature [K] in the mixture
- velocity_relative(mix)#
Get the velocity of the gases relative to the shock front [m/s] in the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – Velocity of the gases relative to the shock front [m/s] in the mixture
- volume(mix)#
Get the volume [m3] of the mixture
- Parameters:
mix (
struct) – Properties of the mixture- Returns:
value (float) – volume [m3] of the mixture
Validations functions#
A collection of functions to generate the validations automatically.
Routines
- compute_error_moles_CEA(resultsCT, resultsCEA, varname_x, value, varname_y, listSpecies, tolMoles)#
Compute max error of CT against CEA
Args:
Returns:
Examples
- compute_error_prop_CEA(resultsCT, resultsCEA, varsname_x, value, varsname_y, type)#
Compute max error of CT against CEA
Args:
Returns:
Examples
- compute_error_prop_Cantera(resultsCT, resultsCantera, varsname_x, value, varsname_y, type)#
Compute max error of CT against Cantera
Args:
Returns:
Examples
- data_CEA(filename, varargin)#
- debug_plot_error(it, STOP, varargin)#
Debug function that plots the error per iteration along with the value of the correction factor
- load_struct(filename, variable_name)#
Load variable from a struct saved in a file
- plot_thermo_validation(species, property, DB, varargin)#
Validation custom thermodynamic polynomials with NASA’s 9 polynomials
- Parameters:
species (
cell) – List of speciesproperty (
str) – Name of the thermodynamic property to checkDB (
struct) – Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits
- Optional Args:
nfrec (float): Points frequency for NASA values
range (float): Temperature range [K]
- Returns:
ax (object) – Axes of the plotted figure
- plot_validation_shock_polar_SDToolbox(mixArray1, mixArray2, results_SDToolbox, config)#
Plot numerical results obtained with SDToolbox, which use CANTERA as a thermochemical kernel.
Pressure ratio with the deflection angle [deg]
Wave angle [deg] with the deflection angle [deg]
- read_CEA(filename)#
READ DATA FROM CEA AS TXT EXTENSION
- set_inputs_thermo_validations(property)#
Set corresponding thermodynamic functions for NASA and Combustion Toolbox
- Parameters:
property (
str) – Thermodynamic property name- Returns:
Tuple containing
funname_NASA (function): Function to use NASA’s polynomials
funname_CT (function): Function to use Combustion Toolbox polynomials
y_labelname (str): Label y axis