Initialization module#

CT built-in functions are written to perform fast parametric studies, thus the data passed between the functions has been organized in a hierarchical tree structure (except for the GUI which is based on OOP) as shown in Fig.1, namely:

  • self (App): parent node; contains all the data of the code, e.g., databases, input values, and results.

  • Constants (C): contains constant values.

  • Elements (E): contains data of the chemical elements in the problem (names and indices for fast data access).

  • Species (S): contains data of the chemical species in the problem (names and indices for fast data access), as well as lists (cells) with the species for complete combustion.

  • Problem Description (PD): contains data of the problem to solve, e.g., initial mixture (composition, temperature, pressure), problem type, and its configuration.

  • Problem Solution (PS): contains results (mixtures).

  • Tuning Properties (TN): contains parameters that control the numerical error of the algorithms implemented in the different modules.

  • Miscellaneous (Misc): contains values that configure the auto-generated plots and export setup, as well as flags, e.g., setting FLAG_RESULTS = true (by default) the results are shown in the command window (only in the desktop environment).

  • Database master (DB_master): a structured thermochemical database including data from McBride [2002], Burcat and Ruscic [2005].

  • Database (DB): a structured thermochemical database with griddedInterpolant objects (see MATLAB built-in function griddedInterpolant.m) that contain piecewise cubic Hermite interpolating polynomials (PCHIP) [Fritsch and Carlson, 1980] for faster data access.


Figure 1: Combustion Toolbox hierarchical data tree structure, where App.m is the initialization function.

App#

Routines to initialize the Combustion Toolbox.


Routines
App(varargin)#

Generate self variable with all the data required to initialize the computations

Optional Args:
  • LS (cell): List of species

  • obj (class): Class combustion_toolbox_app (GUI)

  • type (char): If value is ‘fast’ initialize from the given Databases

  • DB_master (struct): Master database

  • DB (struct): Database with custom thermodynamic polynomials functions generated from NASAs 9 polynomials fits

Returns:

self (struct) – Data of the mixture (initialization - empty), conditions, and databases

Examples

  • self = App() % This initialization will consider all all the possible species

    that can appear depending on the elements of the reactant (see routine find products.m)

  • self = App(‘Air_ions’) % Specify predefined list of species (see routine list_species.m)

  • self = App({‘N2’, ‘O2’, ‘NO’, ‘N’, ‘O’}) % Specify species to consider as possible products

  • self = App(‘Complete’) % Complete combustion

  • self = App(‘fast’, DB_master, DB) % Fast initialization that injects preloaded databases

  • self = App(‘fast’, DB_master, DB, {‘N2’, ‘O2’, ‘NO’, ‘N’, ‘O’}) % Fast initialization

    that injects preloaded databases and considers the given list of species in the calculations

  • self_2 = App(‘copy’, self, {‘N2’, ‘O2’, ‘NO’, ‘N’, ‘O’}) % Copy previous initialization

    in another variable with a different set of species in the calculation

  • self = App(app) % Initialization for the GUI

  • self = App(app, {‘N2’, ‘O2’, ‘NO’, ‘N’, ‘O’}) % Initialization for the GUI

complete_initialize(self, species)#

Complete initialization process

Parameters:
  • self (struct) – Data of the mixture, conditions, and databases

  • species (cell) – List of reactants

Returns:

self (struct) – Data of the mixture, conditions, and databases

contained_elements(self)#

Obtain containted elements from the given set of species (reactants and products)

Parameters:

self (struct) – Data of the mixture, conditions, and databases

Returns:

self (struct) – Data of the mixture, conditions, and databases

initialize(self)#
This routine has three tasks:
  • Check that all species are contained in the Database

  • Establish cataloged list of species according to the state of the phase (gaseous or condensed). It also obtains the indices of cryogenic liquid species, e.g., liquified gases

  • Compute Stoichiometric Matrix

Parameters:

self (struct) – Data of the mixture, conditions, and databases

Returns:

self (struct) – Data of the mixture, conditions, and databases

set_DB(self, FLAG_REDUCED_DB, FLAG_FAST)#

Generate Database with custom polynomials from DB_master

Parameters:
  • self (struct) – Data of the mixture, conditions, and databases

  • FLAG_REDUCED_DB (bool) – Flag compute from reduced database

  • FLAG_FAST (bool) – Flag load databases

Returns:

self (struct) – Data of the mixture, conditions, and databases

Constants#

Routines to initialize the Constants branch in the self variable (struct).


Routines
Constants()#

Initialize struct with constants data

description#

Description of the struct

Type:

char

release#

Release of the Combustion Toolbox

Type:

char

date#

Date of the release

Type:

char

R0#

Universal gas constant [J/(K mol)]

Type:

float

gravity#

Standard gravity [m/s2]

Type:

float

A0#

Stoichiometric Matrix

Type:

struct

M0#

Matrix with properties of each species

Type:

struct

N_prop#

Number of properties in properties_matrix

Type:

struct

N0#

Reduced Matrix with number of moles and phase of each species

Type:

struct

MassorMolar#

‘mass’ or ‘molar’

Type:

char

mintol_display#

Minimum tolerance to display results

Type:

float

l_phi#

Length equivalence ratio vector

Type:

float

composition_units#

Possible values: mol, molar fraction or mass fraction

Type:

char

Returns:

self (struct) – Struct with constants data

Elements#

Routines to initialize the Elements branch in the self variable (struct).


Routines
Elements()#

Initialize struct with elements data

description#

Description of the struct

Type:

char

elements#

Cell with the elements in the periodic table

Type:

cell

NE#

Number of elements

Type:

float

ind_C#

Index element Carbon

Type:

float

ind_H#

Index element Hydrogen

Type:

float

ind_O#

Index element Oxygen

Type:

float

ind_N#

Index element Nytrogen

Type:

float

ind_E#

Index element Electron

Type:

float

ind_S#

Index element Sulfur

Type:

float

ind_Si#

Index element Silicon

Type:

float

Returns:

self (struct) – Struct with elements data

set_elements()#

Set cell with elements name

Returns:

Tuple containing

  • elements (cell): Elements

  • NE (struct): Number of elements

Miscellaneous#

Routines to initialize the Miscellaneous branch in the self variable (struct).


Routines
Miscellaneous()#

Initialize struct with miscellaneous data

description#

Description of the struct

Type:

char

timer_0#

Timer to measure the time of the computations (total time)

Type:

float

timer_loop#

Timer to measure the time of the computations (only calculation time)

Type:

float

config#

Struct with configuration data for plots

Type:

struct

FLAG_INITIALIZE#

Flag indicating self variable is not fully initialized

Type:

bool

FLAG_FIRST#

Flag indicating first calculation

Type:

bool

FLAG_FOI#

% Flag indicating that the reactant mixture has been checked

Type:

bool

FLAG_ADDED_SPECIES#

Flag indicating that there are added reactants species, because were not considered as products -> to recompute stochiometric matrix

Type:

bool

FLAG_N_Fuel#

Flag indicating that the number of moles of the fuel species are defined

Type:

bool

FLAG_N_Oxidizer#

Flag indicating that the number of moles of the oxidant species are defined

Type:

bool

FLAG_N_Inert#

Flag indicating that the number of moles of the inert species are defined

Type:

bool

FLAG_WEIGHT#

Flag indicating that the number of moles of the oxidizer/inert speces are defined from its weight percentage

Type:

bool

FLAG_RESULTS#

Flag to show results in the command window

Type:

bool

FLAG_CHECK_INPUTS#

Flag indicating that the algorithm has checked the input variables

Type:

bool

FLAG_GUI#

Flag indicating that the user is using the GUI

Type:

bool

FLAG_LABELS#

Flag (to be completed)

Type:

bool

FLAG_PROP#

Struct with flags indicanting if there are several values of the respective property (fieldname)

Type:

struct

FLAG_LENGTH#

Flag indicating parametric study

Type:

struct

export_results#

Struct with data to export results

Type:

struct

index_LS_original#

Vector with the indeces original list of products

Type:

float

display_species#

Struct with data to display species

Type:

struct

i#

Index of the current calculation

Type:

float

Returns:

self (struct) – Struct with miscellaneous data

ProblemDescription#

Routines to initialize the ProblemDescription branch in the self variable (struct).


Routines
ProblemDescription()#

Initialize struct with problem description data

description#

Description of the problem

Type:

char

ProblemType#

Type of problem (TP, HP, SP, TV, EV, SV, SHOCK_I, SHOCK_R, …)

Type:

char

R_Fuel#

Fuel property matrix

Type:

float

R_Oxidizer#

Oxidizer property matrix

Type:

float

R_Inert#

Inert property matrix

Type:

float

phi#

Equivalence ratio (struct)

Type:

struct

Fuel#

Fuel data

Type:

struct

TR#

Temperature of reactants

Type:

struct

pR#

Pressure of reactants

Type:

struct

TP#

Temperature of products

Type:

struct

pP#

Pressure of products

Type:

struct

vP_vR#

Volume relation Products/Reactants

Type:

struct

u1#

Incident shock velocity

Type:

struct

overdriven#

Overdriven shock velocity

Type:

struct

theta#

Deflection angle - oblique shocks

Type:

struct

beta#

Wave angle - oblique shocks

Type:

struct

Aratio#

Area ratio exit/throat - rocket

Type:

struct

Aratio_c#

Area ratio combustion chamber/thoat - rocket

Type:

struct

S_Fuel#

Cell with the list of fuel species in the mixture

Type:

cell

N_Fuel#

Vector with the number of moles of the fuel species in the mixture

Type:

float

T_Fuel#

Vector with the temperature values of the fuel species in the mixture

Type:

float

S_Oxidizer#

Cell with the list of oxidizer species in the mixture

Type:

cell

N_Oxidizer#

Vector with the number of moles of the oxidizer species in the mixture

Type:

float

T_Oxidizer#

Vector with the temperature values of the oxidizer species in the mixture

Type:

float

S_Inert#

Cell with the list of inert species in the mixture

Type:

cell

N_Inert#

Vector with the number of moles of the inert species in the mixture

Type:

float

T_Inert#

Vector with the temperature values of the inert species in the mixture

Type:

float

ratio_oxidizers_O2#

Ratio oxidizers / O2 [% moles]

Type:

float

ratio_inerts_O2#

Ratio oxidizers / Inerts [% moles]

Type:

float

wt_ratio_oxidizers#

Weight ratio percentage of oxidizer species

Type:

float

wt_ratio_inerts#

Weight ratio percentage of inert species

Type:

float

EOS#

Equation of States

Type:

struct

FLAG_ION#

Flag to indicate if the system contains ionized species

Type:

bool

FLAG_TCHEM_FROZEN#

Flag to indicate if the thermodynamic properties are thermochemically frozen (calorically perfect gas)

Type:

bool

FLAG_FROZEN#

Flag to indicate if the thermodynamic properties are frozen (calorically imperfect gas with frozen chemistry)

Type:

bool

FLAG_IAC#

Flag to use IAC model for rocket computations

Type:

bool

FLAG_SUBSONIC#

Flag to indicate subsonic Area ratio (CT-ROCKET)

Type:

bool

FLAG_EOS#

Flag to use non-ideal Equation of States (EoS)

Type:

bool

Returns:

self (struct) – Struct with problem description data

ProblemSolution#

Routines to initialize the ProblemSolution branch in the self variable (struct).


Routines
ProblemSolution()#

Initialize struct with problem solution data

Returns:

self (struct) – struct with problem solution data

Species#

Routines to initialize the Species branch in the self variable (struct).


Routines
Species()#

Initialize struct with chemical species data

description#

Description of the struct

Type:

char

LS_DB#

List of species in the database

Type:

cell

NS_DB#

Number of species in the database

Type:

float

NG#

Number of gaseous species in the mixture

Type:

float

NS#

Number of species in the mixture

Type:

float

LS#

List of species in the mixture

Type:

cell

LS_formula#

Formula of each species contained in LS

Type:

cell

ind_nswt#

Indeces gaseous species

Type:

float

ind_swt#

Indeces condensed species

Type:

float

ind_cryogenic#

Indeces cryogenic liquified species

Type:

float

ind_ox_ref#

Indeces reference oxidizer (default: O2)

Type:

float

ind_ions#

Indeces ionized species in LS

Type:

float

ind_react#

Indeces react species

Type:

float

ind_frozen#

Indeces inert/frozen species

Type:

float

LS_lean#

List of species for a lean complete combustion (equivalence ratio < 1)

Type:

cell

LS_rich#

List of species for a lean complete combustion (equivalence ratio > 1)

Type:

cell

LS_soot#

List of species for a lean complete combustion (equivalence ratio > equivalence ratio soot)

Type:

cell

FLAG_COMPLETE#

Flag indicating if the complete combustion is considered

Type:

bool

FLAG_BURCAT#

Find all the combinations of species from the database (without BURCAT’s DB) that can appear as products for the given list of reactants

Type:

bool

FLAG_ION#

Flag indicating to include ionized species in the automatic finder of species

Type:

bool

Returns:

self (struct) – struct with chemical species data

get_index_ions(species)#

Get index of ions for the given list of species

Parameters:

species (str) – List of species

Returns:

index (float) – Index of ions

list_species(varargin)#

Set list of species in the mixture (products)

Predefined list of species:
  • SOOT FORMATION (default)

  • COMPLETE

  • HC/O2/N2 EXTENDED

  • SOOT FORMATION EXTENDED

  • NASA ALL

  • NASA ALL CONDENSED

  • NASA ALL IONS

  • AIR, DISSOCIATED AIR

  • AIR IONS, AIR_IONS

  • IDEAL_AIR, AIR_IDEAL

  • HYDROGEN

  • HYDROGEN_L, HYDROGEN (L)

  • HC/O2/N2 PROPELLANTS

  • SI/HC/O2/N2 PROPELLANTS

Optional Args:
  • self (struct): Data of the mixture, conditions, and databases

  • LS (cell): Name list species / list of species

  • phi (float): Equivalence ratio

  • phi_c (float): Equivalence ratio in which theoretically appears soot

Returns:

Tuple containing

  • self (struct): Data of the mixture, conditions, and databases

  • LS (cell): List of species

Examples

  • LS = list_species(‘soot formation’);

  • [self, LS] = list_species(self, ‘soot formation’);

  • [self, LS] = list_species(self, ‘complete’, 1.5, 2.5);

TuningProperties#

Routines to initialize the TuningProperties branch in the self variable (struct).


Routines
TuningProperties()#

Initialize struct with tunning properties attributes

FLAG_FAST#

Flag indicating use guess composition of the previous computation (default: true)

Type:

bool

FLAG_EXTRAPOLATE#

Flag indicating linear extrapolation of the polynomials fits (default: true)

Type:

bool

tolN#

Tolerance of the composition of the mixture (default: 1e-14)

Type:

float

tol_gibbs#

Tolerance of the Gibbs/Helmholtz minimization method (default: 1e-05)

Type:

float

itMax_gibbs#

Max number of iterations - Gibbs/Helmholtz minimization method (default: 70)

Type:

float

tolN_guess#

Tolerance of the molar composition of the mixture (guess) (default: 1e-06)

Type:

float

tolE#

Tolerance of the mass balance (default: 1e-06)

Type:

float

tol_pi_e#

Tolerance of the dimensionless Lagrangian multiplier - ions (default: 1e-04)

Type:

float

itMax_ions#

Max number of iterations - charge balance (ions) (default: 30)

Type:

float

T_ions#

Minimum temperature [K] to consider ionized species (default: 0)

Type:

float

tol0#

Tolerance of the root finding algorithm (default: 1e-03)

Type:

float

itMax#

Max number of iterations - root finding method - HP, EV, SP, SV (default: 30)

Type:

float

root_method#

Root finding method (default: newton)

Type:

function

root_T0_l#

First guess T [K] left branch - root finding method (default: 1000)

Type:

float

root_T0_r#

First guess T [K] right branch - root finding method (default: 3000)

Type:

float

root_T0#

Guess T[K] if it’s of previous range - root finding method (default: 3000)

Type:

float

tol_shocks#

Tolerance of shocks/detonations routines (default: 1e-05)

Type:

float

it_shocks#

Max number of iterations - shocks and detonations (default: 50)

Type:

float

Mach_thermo#

Pre-shock Mach number above which T2_guess will be computed considering h2 = h1 + u1^2 / 2 (default: 2)

Type:

float

tol_oblique#

Tolerance oblique shocks (default: 1e-03)

Type:

float

it_oblique#

Max number of iterations - oblique shocks (default: 20)

Type:

float

N_points_polar#

Number of points to compute shock polar (default: 100)

Type:

float

tol_limitRR#

Tolerance to calculate the limit of regular reflections (default: 1e-04)

Type:

float

it_limitRR#

Max number of iterations - limit of regular reflections (default: 10)

Type:

float

it_guess_det#
Type:

float

tol_rocket#

Tolerance rocket performance (default: 1e-04)

Type:

float

it_rocket#

Max number of iterations - rocket performance (default: 10)

Type:

float

tol_eos#

Tolerance of the EoS (default: 1e-04)

Type:

float

it_eos#

Max number of iterations - EoS (default: 30)

Type:

float

Returns:

self (struct) – struct with tunning properties data