Cantera
2.3.0
|
Interface class for the vcs thermo equilibrium solver package, which generally describes the problem to be solved. More...
#include <vcs_prob.h>
Public Member Functions | |
VCS_PROB (size_t nsp, size_t nel, size_t nph) | |
Constructor. More... | |
void | resizePhase (size_t nPhase, int force) |
Resizes all of the phase lists within the structure. More... | |
void | resizeSpecies (size_t nsp, int force) |
Resizes all of the species lists within the structure. More... | |
void | resizeElements (size_t nel, int force) |
Resizes all of the element lists within the structure. More... | |
void | set_gai () |
Calculate the element abundance vector from the mole numbers. More... | |
void | prob_report (int print_lvl) |
Print out the problem specification in all generality as it currently exists in the VCS_PROB object. More... | |
void | addPhaseElements (vcs_VolPhase *volPhase) |
Add elements to the local element list. More... | |
size_t | addElement (const char *elNameNew, int elType, int elactive) |
This routine resizes the number of elements in the VCS_PROB object by adding a new element to the end of the element list. More... | |
size_t | addOnePhaseSpecies (vcs_VolPhase *volPhase, size_t k, size_t kT) |
This routines adds entries for the formula matrix for one species. More... | |
void | reportCSV (const std::string &reportFile) |
void | setDebugPrintLvl (int vcs_debug_print_lvl) |
Set the debug level. More... | |
Public Attributes | |
int | prob_type |
Problem type. More... | |
size_t | nspecies |
Total number of species in the problems. More... | |
size_t | NSPECIES0 |
Species number used to size data structures. More... | |
size_t | ne |
Number of element constraints in the equilibrium problem. More... | |
size_t | NE0 |
Number of element constraints used to size data structures involving elements. More... | |
size_t | NPhase |
Number of phases in the problem. More... | |
size_t | NPHASE0 |
Number of phases used to size data structures. More... | |
vector_fp | m_gibbsSpecies |
Vector of chemical potentials of the species. More... | |
vector_fp | w |
Total number of moles of the kth species. More... | |
vector_fp | mf |
Mole fraction vector. More... | |
vector_fp | gai |
Element abundances for jth element. More... | |
Array2D | FormulaMatrix |
Formula Matrix for the problem. More... | |
vector_int | SpeciesUnknownType |
Specifies the species unknown type. More... | |
double | T |
Temperature (Kelvin) More... | |
double | PresPA |
Pressure. More... | |
double | Vol |
Volume of the entire system. More... | |
vector_fp | VolPM |
Partial Molar Volumes of species. More... | |
int | iest |
Specification of the initial estimate method. More... | |
double | tolmaj |
Tolerance requirement for major species. More... | |
double | tolmin |
Tolerance requirement for minor species. More... | |
std::vector< size_t > | PhaseID |
Mapping between the species and the phases. More... | |
std::vector< std::string > | SpName |
Vector of strings containing the species names. More... | |
std::vector< std::string > | ElName |
vector of strings containing the element names More... | |
vector_int | m_elType |
vector of Element types More... | |
vector_int | ElActive |
Specifies whether an element constraint is active. More... | |
vector_fp | WtSpecies |
Molecular weight of species. More... | |
vector_fp | Charge |
Charge of each species. More... | |
std::vector< vcs_VolPhase * > | VPhaseList |
Array of phase structures. More... | |
std::string | Title |
std::vector< VCS_SPECIES_THERMO * > | SpeciesThermo |
Vector of pointers to thermo structures which identify the model and parameters for evaluating the thermodynamic functions for that particular species. More... | |
int | m_Iterations |
Number of iterations. This is an output variable. More... | |
int | m_NumBasisOptimizations |
Number of basis optimizations used. This is an output variable. More... | |
int | m_printLvl |
Print level for print routines. More... | |
int | vcs_debug_print_lvl |
Debug print lvl. More... | |
Interface class for the vcs thermo equilibrium solver package, which generally describes the problem to be solved.
Definition at line 22 of file vcs_prob.h.
VCS_PROB | ( | size_t | nsp, |
size_t | nel, | ||
size_t | nph | ||
) |
Constructor.
This constructor initializes the sizes within the object to parameter values.
nsp | number of species |
nel | number of elements |
nph | number of phases |
Definition at line 24 of file vcs_prob.cpp.
void resizePhase | ( | size_t | nPhase, |
int | force | ||
) |
Resizes all of the phase lists within the structure.
Note, this doesn't change the number of phases in the problem. It will change NPHASE0 if nPhase
is greater than NPHASE0.
nPhase | size to dimension all the phase lists to |
force | If true, this will dimension the size to be equal to nPhase even if nPhase is less than the current value of NPHASE0 |
Definition at line 104 of file vcs_prob.cpp.
References VCS_PROB::NPHASE0, and Cantera::warn_deprecated().
void resizeSpecies | ( | size_t | nsp, |
int | force | ||
) |
Resizes all of the species lists within the structure.
Note, this doesn't change the number of species in the problem. It will change NSPECIES0 if nsp
is greater than NSPECIES0.
nsp | size to dimension all the species lists to |
force | If true, this will dimension the size to be equal to nsp even if nsp is less than the current value of NSPECIES0 |
Definition at line 113 of file vcs_prob.cpp.
References VCS_PROB::Charge, VCS_PROB::FormulaMatrix, VCS_PROB::m_gibbsSpecies, VCS_PROB::mf, VCS_PROB::NE0, VCS_PROB::nspecies, VCS_PROB::NSPECIES0, VCS_PROB::PhaseID, Array2D::resize(), VCS_PROB::SpeciesUnknownType, VCS_PROB::SpName, VCS_SPECIES_TYPE_MOLNUM, VCS_PROB::VolPM, VCS_PROB::w, Cantera::warn_deprecated(), and VCS_PROB::WtSpecies.
void resizeElements | ( | size_t | nel, |
int | force | ||
) |
Resizes all of the element lists within the structure.
Note, this doesn't change the number of element constraints in the problem. It will change NE0 if nel
is greater than NE0.
nel | size to dimension all the elements lists |
force | If true, this will dimension the size to be equal to nel even if nel is less than the current value of NE0 |
Definition at line 135 of file vcs_prob.cpp.
References VCS_PROB::ElActive, VCS_PROB::ElName, VCS_PROB::FormulaMatrix, VCS_PROB::gai, VCS_PROB::m_elType, VCS_PROB::ne, VCS_PROB::NE0, VCS_PROB::NSPECIES0, Array2D::resize(), and VCS_ELEM_TYPE_ABSPOS.
Referenced by VCS_PROB::addElement().
void set_gai | ( | ) |
Calculate the element abundance vector from the mole numbers.
Definition at line 148 of file vcs_prob.cpp.
References VCS_PROB::FormulaMatrix, VCS_PROB::gai, VCS_PROB::ne, VCS_PROB::nspecies, VCS_PROB::SpeciesUnknownType, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_PROB::w.
Referenced by Cantera::vcs_Cantera_update_vprob().
void prob_report | ( | int | print_lvl | ) |
Print out the problem specification in all generality as it currently exists in the VCS_PROB object.
print_lvl | Parameter lvl for printing
|
Definition at line 160 of file vcs_prob.cpp.
References VCS_PROB::ElActive, VCS_PROB::ElName, vcs_VolPhase::eos_name(), vcs_VolPhase::G0_calc_one(), VCS_PROB::gai, vcs_VolPhase::GStar_calc_one(), VCS_PROB::iest, VCS_PROB::m_elType, vcs_VolPhase::m_gasPhase, VCS_PROB::m_printLvl, vcs_VolPhase::m_singleSpecies, VCS_PROB::ne, VCS_PROB::NPhase, VCS_PROB::nspecies, vcs_VolPhase::nSpecies(), VCS_PROB::PhaseID, vcs_VolPhase::PhaseName, plogf, VCS_PROB::PresPA, VCS_PROB::prob_type, vcs_VolPhase::setState_TP(), VCS_PROB::SpeciesUnknownType, vcs_VolPhase::spGlobalIndexVCS(), VCS_PROB::SpName, VCS_PROB::T, vcs_VolPhase::totalMoles(), vcs_VolPhase::totalMolesInert(), VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_TYPE_MOLNUM, vcs_VolPhase::VP_ID_, VCS_PROB::VPhaseList, and VCS_PROB::w.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP().
void addPhaseElements | ( | vcs_VolPhase * | volPhase | ) |
Add elements to the local element list.
This routine sorts through the elements defined in the vcs_VolPhase object. It then adds the new elements to the VCS_PROB object, and creates a global map, which is stored in the vcs_VolPhase object. Id and matching of elements is done strictly via the element name, with case not mattering.
The routine also fills in the position of the element in the vcs_VolPhase object's ElGlobalIndex field.
volPhase | Object containing the phase to be added. The elements in this phase are parsed for addition to the global element list |
Definition at line 261 of file vcs_prob.cpp.
References VCS_PROB::addElement(), vcs_VolPhase::elementName(), vcs_VolPhase::elementType(), VCS_PROB::ElName, VCS_PROB::ne, vcs_VolPhase::nElemConstraints(), Cantera::npos, and vcs_VolPhase::setElemGlobalIndex().
size_t addElement | ( | const char * | elNameNew, |
int | elType, | ||
int | elactive | ||
) |
This routine resizes the number of elements in the VCS_PROB object by adding a new element to the end of the element list.
The element name is added. Formula vector entries ang element abundances for the new element are set to zero.
elNameNew | New name of the element |
elType | Type of the element |
elactive | boolean indicating whether the element is active |
Definition at line 288 of file vcs_prob.cpp.
References VCS_PROB::ElActive, VCS_PROB::ElName, VCS_PROB::m_elType, VCS_PROB::ne, and VCS_PROB::resizeElements().
Referenced by VCS_PROB::addPhaseElements().
size_t addOnePhaseSpecies | ( | vcs_VolPhase * | volPhase, |
size_t | k, | ||
size_t | kT | ||
) |
This routines adds entries for the formula matrix for one species.
This routines adds entries for the formula matrix for this object for one species
This object also fills in the index filed, IndSpecies, within the volPhase object.
volPhase | object containing the species |
k | Species number within the volPhase k |
kT | global Species number within this object |
Definition at line 303 of file vcs_prob.cpp.
References AssertThrowMsg, vcs_VolPhase::elemGlobalIndex(), VCS_PROB::FormulaMatrix, vcs_VolPhase::getFormulaMatrix(), vcs_VolPhase::nElemConstraints(), Cantera::npos, VCS_PROB::nspecies, and vcs_VolPhase::setSpGlobalIndexVCS().
void setDebugPrintLvl | ( | int | vcs_debug_print_lvl | ) |
Set the debug level.
vcs_debug_print_lvl | input debug level |
Definition at line 449 of file vcs_prob.cpp.
References VCS_PROB::vcs_debug_print_lvl.
int prob_type |
Problem type.
I.e., the identity of what is held constant. Currently, T and P are held constant, and this input is ignored
Definition at line 27 of file vcs_prob.h.
Referenced by VCS_PROB::prob_report(), Cantera::vcs_Cantera_to_vprob(), and Cantera::vcs_Cantera_update_vprob().
size_t nspecies |
Total number of species in the problems.
Definition at line 30 of file vcs_prob.h.
Referenced by VCS_PROB::addOnePhaseSpecies(), vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), VCS_PROB::set_gai(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_PS().
size_t NSPECIES0 |
Species number used to size data structures.
Definition at line 33 of file vcs_prob.h.
Referenced by VCS_PROB::resizeElements(), and VCS_PROB::resizeSpecies().
size_t ne |
Number of element constraints in the equilibrium problem.
Definition at line 36 of file vcs_prob.h.
Referenced by VCS_PROB::addElement(), VCS_PROB::addPhaseElements(), VCS_PROB::prob_report(), VCS_PROB::resizeElements(), VCS_PROB::set_gai(), Cantera::vcs_Cantera_to_vprob(), VCS_SOLVE::vcs_PS(), and VCS_SOLVE::vcs_wellPosed().
size_t NE0 |
Number of element constraints used to size data structures involving elements.
Definition at line 40 of file vcs_prob.h.
Referenced by VCS_PROB::resizeElements(), and VCS_PROB::resizeSpecies().
size_t NPhase |
Number of phases in the problem.
Definition at line 43 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), vcs_MultiPhaseEquil::reportCSV(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_update(), and VCS_SOLVE::vcs_PS().
size_t NPHASE0 |
Number of phases used to size data structures.
Definition at line 46 of file vcs_prob.h.
Referenced by VCS_PROB::resizePhase().
vector_fp m_gibbsSpecies |
Vector of chemical potentials of the species.
This is a calculated output quantity. length = number of species.
Definition at line 50 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::reportCSV(), VCS_PROB::resizeSpecies(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
Total number of moles of the kth species.
This is both an input and an output variable. On input, this is an estimate of the mole numbers. The actual element abundance vector contains the problem specification.
On output, this contains the solution for the total number of moles of the kth species.
Definition at line 61 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), VCS_PROB::set_gai(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
vector_fp mf |
Mole fraction vector.
This is a calculated vector, calculated from w[]. length number of species.
Definition at line 65 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::reportCSV(), VCS_PROB::resizeSpecies(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
vector_fp gai |
Element abundances for jth element.
This is input from the input file and is considered a constant from thereon within the vcs_solve_TP().
Definition at line 72 of file vcs_prob.h.
Referenced by VCS_PROB::prob_report(), VCS_PROB::resizeElements(), VCS_PROB::set_gai(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_wellPosed().
Array2D FormulaMatrix |
Formula Matrix for the problem.
FormulaMatrix(kspec,j) = Number of elements, j, in the kspec species
Definition at line 78 of file vcs_prob.h.
Referenced by VCS_PROB::addOnePhaseSpecies(), VCS_PROB::resizeElements(), VCS_PROB::resizeSpecies(), and VCS_PROB::set_gai().
vector_int SpeciesUnknownType |
Specifies the species unknown type.
There are two types. One is the straightforward species, with the mole number w[k], as the unknown. The second is the an interfacial voltage where w[k] refers to the interfacial voltage in volts.
These species types correspond to metallic electrons corresponding to electrodes. The voltage and other interfacial conditions sets up an interfacial current, which is set to zero in this initial treatment. Later we may have non-zero interfacial currents.
Definition at line 91 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), VCS_PROB::set_gai(), Cantera::vcs_Cantera_update_vprob(), and VCS_SOLVE::vcs_prob_update().
double T |
Temperature (Kelvin)
Specification of the temperature for the equilibrium problem
Definition at line 97 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
double PresPA |
Pressure.
Definition at line 100 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
double Vol |
Volume of the entire system.
Note, this is an output variable atm
Definition at line 106 of file vcs_prob.h.
Referenced by Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
vector_fp VolPM |
Partial Molar Volumes of species.
This is a calculated vector, calculated from w[]. length number of species.
Definition at line 113 of file vcs_prob.h.
Referenced by VCS_PROB::resizeSpecies(), and VCS_SOLVE::vcs_prob_update().
int iest |
Specification of the initial estimate method.
Definition at line 121 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), and VCS_SOLVE::vcs_prob_specify().
double tolmaj |
Tolerance requirement for major species.
Definition at line 124 of file vcs_prob.h.
Referenced by VCS_SOLVE::vcs_prob_specify().
double tolmin |
Tolerance requirement for minor species.
Definition at line 127 of file vcs_prob.h.
Referenced by VCS_SOLVE::vcs_prob_specify().
std::vector<size_t> PhaseID |
Mapping between the species and the phases.
Definition at line 130 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), and Cantera::vcs_Cantera_update_vprob().
std::vector<std::string> SpName |
Vector of strings containing the species names.
Definition at line 133 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), and Cantera::vcs_Cantera_update_vprob().
std::vector<std::string> ElName |
vector of strings containing the element names
Definition at line 136 of file vcs_prob.h.
Referenced by VCS_PROB::addElement(), VCS_PROB::addPhaseElements(), VCS_PROB::prob_report(), and VCS_PROB::resizeElements().
vector_int m_elType |
vector of Element types
Definition at line 139 of file vcs_prob.h.
Referenced by VCS_PROB::addElement(), VCS_PROB::prob_report(), and VCS_PROB::resizeElements().
vector_int ElActive |
Specifies whether an element constraint is active.
The default is true Length = nelements
Definition at line 146 of file vcs_prob.h.
Referenced by VCS_PROB::addElement(), VCS_PROB::prob_report(), and VCS_PROB::resizeElements().
vector_fp WtSpecies |
Molecular weight of species.
WtSpecies[k] = molecular weight of species in gm/mol
Definition at line 152 of file vcs_prob.h.
Referenced by VCS_PROB::resizeSpecies().
vector_fp Charge |
Charge of each species.
Definition at line 155 of file vcs_prob.h.
Referenced by VCS_PROB::resizeSpecies().
std::vector<vcs_VolPhase*> VPhaseList |
Array of phase structures.
Definition at line 158 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), vcs_MultiPhaseEquil::reportCSV(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().
std::vector<VCS_SPECIES_THERMO*> SpeciesThermo |
Vector of pointers to thermo structures which identify the model and parameters for evaluating the thermodynamic functions for that particular species.
Definition at line 166 of file vcs_prob.h.
int m_Iterations |
Number of iterations. This is an output variable.
Definition at line 169 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::reportCSV(), and VCS_SOLVE::vcs_prob_update().
int m_NumBasisOptimizations |
Number of basis optimizations used. This is an output variable.
Definition at line 172 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::reportCSV(), and VCS_SOLVE::vcs_prob_update().
int m_printLvl |
Print level for print routines.
Definition at line 175 of file vcs_prob.h.
Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), and vcs_MultiPhaseEquil::vcs_MultiPhaseEquil().
int vcs_debug_print_lvl |
Debug print lvl.
Definition at line 178 of file vcs_prob.h.
Referenced by VCS_PROB::setDebugPrintLvl().