Cantera
2.4.0
|
Cantera's Interface to the Multiphase chemical equilibrium solver. More...
#include <vcs_MultiPhaseEquil.h>
Public Member Functions | |
vcs_MultiPhaseEquil (MultiPhase *mix, int printLvl) | |
Constructor for the multiphase equilibrium solver. More... | |
int | iterations () const |
return the number of iterations More... | |
int | equilibrate (int XY, int estimateEquil=0, int printLvl=0, doublereal err=1.0e-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object. More... | |
int | equilibrate_TP (int estimateEquil=0, int printLvl=0, doublereal err=1.0e-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using constant T and P. More... | |
int | equilibrate_HP (doublereal Htarget, int XY, double Tlow, double Thigh, int estimateEquil=0, int printLvl=0, doublereal err=1.0E-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using either constant H and P or constant U and P. More... | |
int | equilibrate_SP (doublereal Starget, double Tlow, double Thigh, int estimateEquil=0, int printLvl=0, doublereal err=1.0E-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using constant S and P. More... | |
int | equilibrate_TV (int XY, doublereal xtarget, int estimateEquil=0, int printLvl=0, doublereal err=1.0E-6, int maxsteps=VCS_MAXSTEPS, int logLevel=-99) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using constant V and constant T, H, U or S. More... | |
void | reportCSV (const std::string &reportFile) |
Report the equilibrium answer in a comma separated table format. More... | |
Protected Attributes | |
vector_int | m_order |
Vector that takes into account of the current sorting of the species. More... | |
MultiPhase * | m_mix |
Pointer to the MultiPhase mixture that will be equilibrated. More... | |
int | m_printLvl |
Print level from the VCSnonlinear package. More... | |
DenseMatrix | m_N |
Stoichiometric matrix. More... | |
int | m_iter |
Iteration Count. More... | |
vector_int | m_species |
Vector of indices for species that are included in the calculation. More... | |
VCS_SOLVE | m_vsolve |
The object that contains the problem statement and does all of the equilibration work. More... | |
Cantera's Interface to the Multiphase chemical equilibrium solver.
Class vcs_MultiPhaseEquil is designed to be used to set a mixture containing one or more phases to a state of chemical equilibrium.
Note, as currently constructed, the underlying ThermoPhase objects are shared between the MultiPhase object and this object. Therefore, mix is not a const argument, and the return parameters are contained in underlying ThermoPhase objects.
Definition at line 30 of file vcs_MultiPhaseEquil.h.
vcs_MultiPhaseEquil | ( | MultiPhase * | mix, |
int | printLvl | ||
) |
Constructor for the multiphase equilibrium solver.
This constructor will initialize the object with a MultiPhase object, setting up the internal equilibration problem. Note, as currently constructed, the underlying ThermoPhase objects are shared between the MultiPhase object and this object. Therefore, mix is not a const argument, and the return parameters are contained in underlying ThermoPhase objects.
mix | Object containing the MultiPhase object |
printLvl | Determines the amount of printing to stdout that occurs for each call:
|
Definition at line 24 of file vcs_MultiPhaseEquil.cpp.
|
inline |
return the number of iterations
Definition at line 57 of file vcs_MultiPhaseEquil.h.
References vcs_MultiPhaseEquil::m_iter.
int equilibrate | ( | int | XY, |
int | estimateEquil = 0 , |
||
int | printLvl = 0 , |
||
doublereal | err = 1.0e-6 , |
||
int | maxsteps = VCS_MAXSTEPS , |
||
int | loglevel = -99 |
||
) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object.
Use the vcs algorithm to equilibrate the current multiphase mixture.
XY | Integer representing what two thermo quantities are held constant during the equilibration |
estimateEquil | integer indicating whether the solver should estimate its own initial condition.
|
printLvl | Determines the amount of printing that gets sent to stdout from the vcs package (Note, you may have to compile with debug flags to get some printing). |
err | Internal error level |
maxsteps | max steps allowed. |
loglevel | Determines the amount of printing to the output file. |
Definition at line 370 of file vcs_MultiPhaseEquil.cpp.
References MultiPhase::enthalpy(), MultiPhase::entropy(), vcs_MultiPhaseEquil::equilibrate_HP(), vcs_MultiPhaseEquil::equilibrate_SP(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::equilibrate_TV(), MultiPhase::IntEnergy(), vcs_MultiPhaseEquil::m_mix, MultiPhase::maxTemp(), MultiPhase::minTemp(), and MultiPhase::temperature().
Referenced by MultiPhase::equilibrate().
int equilibrate_TP | ( | int | estimateEquil = 0 , |
int | printLvl = 0 , |
||
doublereal | err = 1.0e-6 , |
||
int | maxsteps = VCS_MAXSTEPS , |
||
int | loglevel = -99 |
||
) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using constant T and P.
Use the vcs algorithm to equilibrate the current multiphase mixture.
estimateEquil | integer indicating whether the solver should estimate its own initial condition.
|
printLvl | Determines the amount of printing that gets sent to stdout from the vcs package (Note, you may have to compile with debug flags to get some printing). |
err | Internal error level |
maxsteps | max steps allowed. |
loglevel | Determines the amount of printing to the output file. |
Definition at line 415 of file vcs_MultiPhaseEquil.cpp.
References MultiPhase::getChemPotentials(), VCS_SOLVE::m_doEstimateEquil, vcs_MultiPhaseEquil::m_mix, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_pressurePA, vcs_MultiPhaseEquil::m_printLvl, VCS_SOLVE::m_printLvl, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_temperature, VCS_SOLVE::m_timing_print_lvl, VCS_SOLVE::m_VolPhaseList, vcs_MultiPhaseEquil::m_vsolve, MultiPhase::moleFraction(), MultiPhase::nSpecies(), vcs_VolPhase::nSpecies(), plogf, MultiPhase::pressure(), clockWC::secondsWC(), MultiPhase::speciesMoles(), MultiPhase::speciesName(), MultiPhase::temperature(), VCS_SOLVE::vcs(), and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
Referenced by vcs_MultiPhaseEquil::equilibrate(), vcs_MultiPhaseEquil::equilibrate_HP(), vcs_MultiPhaseEquil::equilibrate_SP(), and vcs_MultiPhaseEquil::equilibrate_TV().
int equilibrate_HP | ( | doublereal | Htarget, |
int | XY, | ||
double | Tlow, | ||
double | Thigh, | ||
int | estimateEquil = 0 , |
||
int | printLvl = 0 , |
||
doublereal | err = 1.0E-6 , |
||
int | maxsteps = VCS_MAXSTEPS , |
||
int | loglevel = -99 |
||
) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using either constant H and P or constant U and P.
Use the vcs algorithm to equilibrate the current multiphase mixture. The pressure of the calculation is taken from the current pressure stored with the MultiPhase object.
Htarget | Value of the total mixture enthalpy or total internal energy that will be kept constant. Note, this is and must be an extensive quantity. units = Joules |
XY | Integer flag indicating what is held constant. Must be either HP or UP. |
Tlow | Lower limit of the temperature. It's an error condition if the temperature falls below Tlow. |
Thigh | Upper limit of the temperature. It's an error condition if the temperature goes higher than Thigh. |
estimateEquil | integer indicating whether the solver should estimate its own initial condition.
|
printLvl | Determines the amount of printing that gets sent to stdout from the vcs package (Note, you may have to compile with debug flags to get some printing). See main constructor call for meaning of the levels. |
err | Internal error level |
maxsteps | max steps allowed. |
loglevel | Determines the amount of printing to the output file. |
Definition at line 128 of file vcs_MultiPhaseEquil.cpp.
References Cantera::clip(), MultiPhase::enthalpy(), vcs_MultiPhaseEquil::equilibrate_TP(), MultiPhase::IntEnergy(), vcs_MultiPhaseEquil::m_mix, MultiPhase::maxTemp(), MultiPhase::minTemp(), MultiPhase::phaseMoles(), plogf, MultiPhase::temperature(), and Cantera::Undef.
Referenced by vcs_MultiPhaseEquil::equilibrate(), and vcs_MultiPhaseEquil::equilibrate_TV().
int equilibrate_SP | ( | doublereal | Starget, |
double | Tlow, | ||
double | Thigh, | ||
int | estimateEquil = 0 , |
||
int | printLvl = 0 , |
||
doublereal | err = 1.0E-6 , |
||
int | maxsteps = VCS_MAXSTEPS , |
||
int | loglevel = -99 |
||
) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using constant S and P.
Use the vcs algorithm to equilibrate the current multiphase mixture. The pressure of the calculation is taken from the current pressure stored with the MultiPhase object.
Starget | Value of the total mixture entropy that will be kept constant. Note, this is and must be an extensive quantity. units = Joules/K |
Tlow | Lower limit of the temperature. It's an error condition if the temperature falls below Tlow. |
Thigh | Upper limit of the temperature. It's an error condition if the temperature goes higher than Thigh. |
estimateEquil | integer indicating whether the solver should estimate its own initial condition.
|
printLvl | Determines the amount of printing that gets sent to stdout from the vcs package (Note, you may have to compile with debug flags to get some printing). See main constructor call for meaning of the levels. |
err | Internal error level |
maxsteps | max steps allowed. |
loglevel | Determines the amount of printing to the output file. |
Definition at line 244 of file vcs_MultiPhaseEquil.cpp.
References MultiPhase::entropy(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::m_mix, MultiPhase::maxTemp(), MultiPhase::minTemp(), MultiPhase::phaseMoles(), plogf, MultiPhase::temperature(), and Cantera::Undef.
Referenced by vcs_MultiPhaseEquil::equilibrate(), and vcs_MultiPhaseEquil::equilibrate_TV().
int equilibrate_TV | ( | int | XY, |
doublereal | xtarget, | ||
int | estimateEquil = 0 , |
||
int | printLvl = 0 , |
||
doublereal | err = 1.0E-6 , |
||
int | maxsteps = VCS_MAXSTEPS , |
||
int | logLevel = -99 |
||
) |
Equilibrate the solution using the current element abundances stored in the MultiPhase object using constant V and constant T, H, U or S.
Use the vcs algorithm to equilibrate the current multiphase mixture. The pressure of the calculation is taken from the current pressure stored with the MultiPhase object.
XY | Integer flag indicating what is held constant. Must be either TV, HV, UV, or SV. |
xtarget | Value of the total thermodynamic parameter to be held constant in addition to V. Note, except for T, this must be an extensive quantity. units = Joules/K or Joules |
estimateEquil | integer indicating whether the solver should estimate its own initial condition.
|
printLvl | Determines the amount of printing that gets sent to stdout from the vcs package (Note, you may have to compile with debug flags to get some printing). See main constructor call for meaning of the levels. |
err | Internal error level |
maxsteps | max steps allowed. |
logLevel | Determines the amount of printing to the output file. |
Definition at line 31 of file vcs_MultiPhaseEquil.cpp.
References vcs_MultiPhaseEquil::equilibrate_HP(), vcs_MultiPhaseEquil::equilibrate_SP(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::m_mix, MultiPhase::maxTemp(), MultiPhase::minTemp(), MultiPhase::pressure(), MultiPhase::setPressure(), MultiPhase::setTemperature(), and MultiPhase::volume().
Referenced by vcs_MultiPhaseEquil::equilibrate().
void reportCSV | ( | const std::string & | reportFile | ) |
Report the equilibrium answer in a comma separated table format.
This routine is used for in the test suite.
reportFile | Base name of the file to get the report. File name is incremented by 1 for each report. |
Definition at line 493 of file vcs_MultiPhaseEquil.cpp.
References ThermoPhase::activityConvention(), VCS_COUNTERS::Basis_Opts, ThermoPhase::getActivities(), ThermoPhase::getActivityCoefficients(), ThermoPhase::getChemPotentials(), MolalityVPSSTP::getMolalities(), ThermoPhase::getPartialMolarVolumes(), ThermoPhase::getStandardChemPotentials(), VCS_COUNTERS::Its, vcs_MultiPhaseEquil::m_mix, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_VCount, VCS_SOLVE::m_VolPhaseList, vcs_MultiPhaseEquil::m_vsolve, Phase::moleFraction(), Phase::name(), Phase::nSpecies(), MultiPhase::phase(), MultiPhase::pressure(), Phase::speciesName(), MultiPhase::temperature(), and vcs_VolPhase::totalMoles().
|
protected |
Vector that takes into account of the current sorting of the species.
The index of m_order is the original k value of the species in the multiphase. The value of m_order, k_sorted, is the current value of the species index.
m_order[korig] = k_sorted
Definition at line 235 of file vcs_MultiPhaseEquil.h.
|
protected |
Pointer to the MultiPhase mixture that will be equilibrated.
Equilibrium solutions will be returned via this variable.
Definition at line 241 of file vcs_MultiPhaseEquil.h.
Referenced by vcs_MultiPhaseEquil::equilibrate(), vcs_MultiPhaseEquil::equilibrate_HP(), vcs_MultiPhaseEquil::equilibrate_SP(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::equilibrate_TV(), and vcs_MultiPhaseEquil::reportCSV().
|
protected |
Print level from the VCSnonlinear package.
(Note, you may have to compile with debug flags to get some printing).
Definition at line 256 of file vcs_MultiPhaseEquil.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP().
|
protected |
Stoichiometric matrix.
Definition at line 259 of file vcs_MultiPhaseEquil.h.
|
protected |
Iteration Count.
Definition at line 262 of file vcs_MultiPhaseEquil.h.
Referenced by vcs_MultiPhaseEquil::iterations().
|
protected |
Vector of indices for species that are included in the calculation.
This is used to exclude pure-phase species with invalid thermo data
Definition at line 266 of file vcs_MultiPhaseEquil.h.
|
protected |
The object that contains the problem statement and does all of the equilibration work.
The problem statement may contain some subtleties. For example, the element constraints may be different than just an element conservation contraint equations. There may be kinetically frozen degrees of freedom. There may be multiple electrolyte phases with zero charge constraints. All of these make the problem statement different than the simple element conservation statement.
VCS_SOLVE will have different ordering for species and element constraints than this object.
Definition at line 280 of file vcs_MultiPhaseEquil.h.
Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), and vcs_MultiPhaseEquil::reportCSV().