25 void VCS_SOLVE::prob_report(
int print_lvl)
27 m_printLvl = print_lvl;
31 writeline(
'=', 80,
true,
true);
32 writeline(
'=', 20,
false);
33 plogf(
" VCS_PROB: PROBLEM STATEMENT ");
37 plogf(
"\tSolve a constant T, P problem:\n");
38 plogf(
"\t\tT = %g K\n", m_temperature);
39 double pres_atm = m_pressurePA / 1.01325E5;
41 plogf(
"\t\tPres = %g atm\n", pres_atm);
43 plogf(
" Phase IDs of species\n");
44 plogf(
" species phaseID phaseName ");
45 plogf(
" Initial_Estimated_Moles Species_Type\n");
46 for (
size_t i = 0; i < m_nsp; i++) {
47 vcs_VolPhase* Vphase = m_VolPhaseList[m_phaseID[i]].get();
48 plogf(
"%16s %5d %16s", m_mix->speciesName(i), m_phaseID[i],
50 if (m_doEstimateEquil >= 0) {
51 plogf(
" %-10.5g", m_molNumSpecies_old[i]);
66 writeline(
'-', 80,
true,
true);
67 plogf(
" Information about phases\n");
68 plogf(
" PhaseName PhaseNum SingSpec GasPhase "
70 plogf(
" TMolesInert TKmoles\n");
72 for (
size_t iphase = 0; iphase < m_numPhases; iphase++) {
78 if (m_doEstimateEquil >= 0) {
85 plogf(
"\nElemental Abundances: ");
86 plogf(
" Target_kmol ElemType ElActive\n");
87 for (
size_t i = 0; i < m_nelem; ++i) {
88 writeline(
' ', 26,
false);
89 plogf(
"%-2.2s", m_elementName[i]);
90 plogf(
"%20.12E ", m_elemAbundancesGoal[i]);
91 plogf(
"%3d %3d\n", m_elType[i], m_elementActive[i]);
94 plogf(
"\nChemical Potentials: (J/kmol)\n");
95 plogf(
" Species (phase) "
96 " SS0ChemPot StarChemPot\n");
97 for (
size_t iphase = 0; iphase < m_numPhases; iphase++) {
100 for (
size_t kindex = 0; kindex < Vphase->
nSpecies(); kindex++) {
102 plogf(
"%16s ", m_mix->speciesName(kglob));
113 writeline(
'=', 80,
true,
true);
114 writeline(
'=', 20,
false);
115 plogf(
" VCS_PROB: END OF PROBLEM STATEMENT ");
126 for (
size_t eVP = 0; eVP < neVP; eVP++) {
127 size_t foundPos =
npos;
132 for (
size_t e = 0; e < m_nelem; e++) {
133 std::string en = m_elementName[e];
134 if (!strcmp(enVP.c_str(), en.c_str())) {
139 if (foundPos ==
npos) {
141 int elactive = volPhase->elementActive(eVP);
142 size_t e = addElement(enVP.c_str(), elType, elactive);
148 size_t VCS_SOLVE::addElement(
const char* elNameNew,
int elType,
int elactive)
152 "error: element must have a name");
157 m_formulaMatrix.resize(m_nsp, m_nelem, 0.0);
158 m_stoichCoeffRxnMatrix.resize(m_nelem, m_nsp, 0.0);
159 m_elType.push_back(elType);
160 m_elementActive.push_back(elactive);
161 m_elemAbundances.push_back(0.0);
162 m_elemAbundancesGoal.push_back(0.0);
163 m_elementMapIndex.push_back(0);
164 m_elementName.push_back(elNameNew);
168 size_t VCS_SOLVE::addOnePhaseSpecies(
vcs_VolPhase* volPhase,
size_t k,
size_t kT)
172 throw CanteraError(
"VCS_SOLVE::addOnePhaseSpecies",
"Shouldn't be here");
178 "element not found");
179 m_formulaMatrix(kT,e) = fm(k,eVP);
Header for intermediate ThermoPhase object for phases which employ molality based activity coefficien...
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Equilfu...
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Base class for exceptions thrown by Cantera classes.
Phase information and Phase calculations for vcs.
std::string eos_name() const
Return the name corresponding to the equation of state.
size_t elemGlobalIndex(const size_t e) const
Returns the global index of the local element index for the phase.
size_t nSpecies() const
Return the number of species in the phase.
std::string elementName(const size_t e) const
Name of the element constraint with index e.
size_t VP_ID_
Original ID of the phase in the problem.
const Array2D & getFormulaMatrix() const
Get a constant form of the Species Formula Matrix.
double totalMolesInert() const
Returns the value of the total kmol of inert in the phase.
bool m_singleSpecies
If true, this phase consists of a single species.
void setElemGlobalIndex(const size_t eLocal, const size_t eGlobal)
sets a local phase element to a global index value
size_t nElemConstraints() const
Returns the number of element constraints.
size_t spGlobalIndexVCS(const size_t spIndex) const
Return the Global VCS index of the kth species in the phase.
double GStar_calc_one(size_t kspec) const
Gibbs free energy calculation for standard state of one species.
bool m_gasPhase
If true, this phase is a gas-phase like phase.
std::string PhaseName
String name for the phase.
double G0_calc_one(size_t kspec) const
Gibbs free energy calculation at a temperature for the reference state of a species,...
void setState_TP(const double temperature_Kelvin, const double pressure_PA)
Sets the temperature and pressure in this object and underlying ThermoPhase objects.
int elementType(const size_t e) const
Type of the element constraint with index e.
void setSpGlobalIndexVCS(const size_t spIndex, const size_t spGlobalIndex)
set the Global VCS index of the kth species in the phase
double totalMoles() const
Return the total moles in the phase.
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
const size_t npos
index returned by functions to indicate "no position"
Namespace for the Cantera kernel.
Header for the object representing each phase within vcs.
Defines and definitions within the vcs package.
#define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE
Unknown refers to the voltage level of a phase.
#define VCS_SPECIES_TYPE_MOLNUM
Unknown refers to mole number of a single species.
Internal declarations for the VCSnonideal package.
#define plogf
define this Cantera function to replace printf
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...