Cantera
2.0
|
This is the main structure used to hold the internal data used in vcs_solve_TP(), and to solve TP systems. More...
#include <vcs_solve.h>
Public Member Functions | |
VCS_SOLVE () | |
Constructor for the VCS_SOLVE class. | |
~VCS_SOLVE () | |
Destructor. | |
void | vcs_initSizes (const size_t nspecies0, const size_t nelements, const size_t nphase0) |
Initialize the sizes within the VCS_SOLVE object. | |
int | vcs (VCS_PROB *vprob, int ifunc, int ipr, int ip1, int maxit) |
Solve an equilibrium problem. | |
int | vcs_solve_TP (int print_lvl, int printDetails, int maxit) |
Main routine that solves for equilibrium at constant T and P using a variant of the VCS method. | |
int | vcs_PS (VCS_PROB *vprob, int iph, int printLvl, double &feStable) |
void | vcs_reinsert_deleted (size_t kspec) |
int | vcs_basopt (const bool doJustComponents, double aw[], double sa[], double sm[], double ss[], double test, bool *const usedZeroedSpecies) |
Choose the optimum species basis for the calculations. | |
size_t | vcs_basisOptMax (const double *const molNum, const size_t j, const size_t n) |
Choose a species to test for the next component. | |
int | vcs_species_type (const size_t kspec) const |
Evaluate the species category for the indicated species. | |
bool | vcs_evaluate_speciesType () |
void | vcs_chemPotPhase (const int stateCalc, const size_t iph, const double *const molNum, double *const ac, double *const mu_i, const bool do_deleted=false) |
We calculate the dimensionless chemical potentials of all species in a single phase. | |
void | vcs_dfe (const int stateCalc, const int ll, const size_t lbot, const size_t ltop) |
Calculate the dimensionless chemical potentials of all species or of certain groups of species, at a fixed temperature and pressure. | |
void | vcs_printSpeciesChemPot (const int stateCalc) const |
Print out a table of chemical potentials. | |
void | vcs_updateVP (const int stateCalc) |
This routine uploads the state of the system into all of the vcs_VolumePhase objects in the current problem. | |
bool | vcs_popPhasePossible (const size_t iphasePop) const |
Utility function that evaluates whether a phase can be popped into existence. | |
int | vcs_phasePopDeterminePossibleList () |
Determine the list of problems that need to be checked to see if there are any phases pops. | |
size_t | vcs_popPhaseID (std::vector< size_t > &phasePopPhaseIDs) |
Decision as to whether a phase pops back into existence. | |
int | vcs_popPhaseRxnStepSizes (const size_t iphasePop) |
Calculates the deltas of the reactions due to phases popping into existence. | |
size_t | vcs_RxnStepSizes (int &forceComponentCalc, size_t &kSpecial) |
Calculates formation reaction step sizes. | |
double | vcs_tmoles () |
Calculates the total number of moles of species in all phases. | |
void | vcs_deltag (const int l, const bool doDeleted, const int vcsState, const bool alterZeroedPhases=true) |
This subroutine calculates reaction free energy changes for all noncomponent formation reactions. | |
void | vcs_printDeltaG (const int stateCalc) |
void | vcs_deltag_Phase (const size_t iphase, const bool doDeleted, const int stateCalc, const bool alterZeroedPhases=true) |
Calculate deltag of formation for all species in a single phase. | |
void | vcs_switch_pos (const bool ifunc, const size_t k1, const size_t k2) |
Swaps the indices for all of the global data for two species, k1 and k2. | |
double | vcs_birthGuess (const int kspec) |
Birth guess returns the number of moles of a species that is coming back to life. | |
int | vcs_solve_phaseStability (const int iphase, int ifunc, double &funcval, int print_lvl) |
double | vcs_phaseStabilityTest (const size_t iph) |
Main program to test whether a deleted phase should be brought back into existence. | |
int | vcs_TP (int ipr, int ip1, int maxit, double T, double pres) |
Solve an equilibrium problem at a particular fixed temperature and pressure. | |
int | vcs_evalSS_TP (int ipr, int ip1, double Temp, double pres) |
void | vcs_fePrep_TP () |
Initialize the chemical potential of single species phases. | |
double | vcs_VolTotal (const double tkelvin, const double pres, const double w[], double volPM[]) |
Calculation of the total volume and the partial molar volumes. | |
int | vcs_prep_oneTime (int printLvl) |
This routine is mostly concerned with changing the private data to be consistent with what's needed for solution. | |
int | vcs_prep () |
Prepare the object for solution. | |
bool | vcs_wellPosed (VCS_PROB *vprob) |
In this routine, we check for things that will cause the algorithm to fail. | |
int | vcs_elem_rearrange (double *const aw, double *const sa, double *const sm, double *const ss) |
Rearrange the constraint equations represented by the Formula Matrix so that the operational ones are in the front. | |
void | vcs_switch_elem_pos (size_t ipos, size_t jpos) |
Swaps the indices for all of the global data for two elements, ipos and jpos. | |
int | vcs_rxn_adj_cg (void) |
Calculates reaction adjustments using a full Hessian approximation. | |
double | vcs_Hessian_diag_adj (size_t irxn, double hessianDiag_Ideal) |
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficients on the mole numbers. | |
double | vcs_Hessian_actCoeff_diag (size_t irxn) |
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficients on the mole numbers. | |
void | vcs_CalcLnActCoeffJac (const double *const moleSpeciesVCS) |
double | vcs_line_search (const size_t irxn, const double dx_orig) |
int | vcs_report (int iconv) |
Print out a report on the state of the equilibrium problem to standard output. | |
int | vcs_rearrange () |
Switch all species data back to the original order. | |
double | vcs_nondim_Farad (int mu_units, double TKelvin) const |
Returns the multiplier for electric charge terms. | |
double | vcs_nondimMult_TP (int mu_units, double TKelvin) const |
Returns the multiplier for the nondimensionalization of the equations. | |
void | vcs_nondim_TP () |
Nondimensionalize the problem data. | |
void | vcs_redim_TP () |
Redimensionalize the problem data. | |
void | vcs_printChemPotUnits (int unitsFormat) const |
Print the string representing the Chemical potential units. | |
void | vcs_elab () |
Computes the current elemental abundances vector. | |
bool | vcs_elabcheck (int ibound) |
void | vcs_elabPhase (size_t iphase, double *const elemAbundPhase) |
int | vcs_elcorr (double aa[], double x[]) |
int | vcs_inest_TP () |
Create an initial estimate of the solution to the thermodynamic equilibrium problem. | |
double | vcs_Total_Gibbs (double *w, double *fe, double *tPhMoles) |
double | vcs_GibbsPhase (size_t iphase, const double *const w, const double *const fe) |
Calculate the total dimensionless Gibbs free energy of a single phase. | |
int | vcs_prob_update (VCS_PROB *pub) |
Transfer the results of the equilibrium calculation back to VCS_PROB. | |
int | vcs_prob_specifyFully (const VCS_PROB *pub) |
Fully specify the problem to be solved using VCS_PROB. | |
int | vcs_prob_specify (const VCS_PROB *pub) |
Specify the problem to be solved using VCS_PROB, incrementally. | |
Public Attributes | |
size_t | NSPECIES0 |
value of the number of species used to malloc data structures | |
size_t | NPHASE0 |
value of the number of phases used to malloc data structures | |
size_t | m_numSpeciesTot |
Total number of species in the problems. | |
size_t | m_numElemConstraints |
Number of element constraints in the problem. | |
size_t | m_numComponents |
Number of components calculated for the problem. | |
size_t | m_numRxnTot |
Total number of non-component species in the problem. | |
size_t | m_numSpeciesRdc |
Current number of species in the problems. | |
size_t | m_numRxnRdc |
Current number of non-component species in the problem. | |
size_t | m_numRxnMinorZeroed |
Number of active species which are currently either treated as minor species. | |
size_t | m_numPhases |
Number of Phases in the problem. | |
DoubleStarStar | m_formulaMatrix |
Formula matrix for the problem. | |
DoubleStarStar | m_stoichCoeffRxnMatrix |
Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form. | |
std::vector< double > | m_scSize |
Absolute size of the stoichiometric coefficients. | |
std::vector< double > | m_spSize |
total size of the species | |
std::vector< double > | m_SSfeSpecies |
Standard state chemical potentials for species K at the current temperature and pressure. | |
std::vector< double > | m_feSpecies_old |
Free energy vector from the start of the current iteration. | |
std::vector< double > | m_feSpecies_new |
Dimensionless new free energy for all the species in the mechanism at the new tentatite T, P, and mole numbers. | |
int | m_doEstimateEquil |
Setting for whether to do an initial estimate. | |
std::vector< double > | m_molNumSpecies_old |
Total moles of the species. | |
std::vector< int > | m_speciesUnknownType |
Specifies the species unknown type. | |
DoubleStarStar | m_deltaMolNumPhase |
Change in the number of moles of phase, iphase, due to the noncomponent formation reaction, irxn, for species, k: | |
IntStarStar | m_phaseParticipation |
This is 1 if the phase, iphase, participates in the formation reaction irxn, and zero otherwise. | |
std::vector< double > | m_phasePhi |
electric potential of the iph phase | |
std::vector< double > | m_molNumSpecies_new |
Tentative value of the mole number vector. | |
std::vector< double > | m_deltaGRxn_new |
Delta G(irxn) for the noncomponent species in the mechanism. | |
std::vector< double > | m_deltaGRxn_old |
Last deltag[irxn] from the previous step. | |
std::vector< double > | m_deltaGRxn_Deficient |
Last deltag[irxn] from the previous step with additions for possible births of zeroed phases. | |
std::vector< double > | m_deltaGRxn_tmp |
Temporary vector of Rxn DeltaG's. | |
std::vector< double > | m_deltaMolNumSpecies |
Reaction Adjustments for each species during the current step. | |
std::vector< double > | m_elemAbundances |
Element abundances vector. | |
std::vector< double > | m_elemAbundancesGoal |
Element abundances vector Goals. | |
double | m_totalMolNum |
Total number of kmoles in all phases. | |
std::vector< double > | m_tPhaseMoles_old |
Total kmols of species in each phase. | |
std::vector< double > | m_tPhaseMoles_new |
total kmols of species in each phase in the tentative soln vector | |
std::vector< double > | m_TmpPhase |
Temporary vector of length NPhase. | |
std::vector< double > | m_TmpPhase2 |
Temporary vector of length NPhase. | |
std::vector< double > | m_deltaPhaseMoles |
Change in the total moles in each phase. | |
double | m_temperature |
Temperature (Kelvin) | |
double | m_pressurePA |
Pressure (units are determined by m_VCS_UnitsFormat. | |
std::vector< double > | TPhInertMoles |
Total kmoles of inert to add to each phase. | |
double | m_tolmaj |
Tolerance requirement for major species. | |
double | m_tolmin |
Tolerance requirements for minor species. | |
double | m_tolmaj2 |
Below this, major species aren't refined any more. | |
double | m_tolmin2 |
Below this, minor species aren't refined any more. | |
std::vector< size_t > | m_speciesMapIndex |
Index vector that keeps track of the species vector rearrangement. | |
std::vector< size_t > | m_speciesLocalPhaseIndex |
Index that keeps track of the index of the species within the local phase. | |
std::vector< size_t > | m_elementMapIndex |
Index vector that keeps track of the rearrangement of the elements. | |
std::vector< size_t > | m_indexRxnToSpecies |
Mapping between the species index for noncomponent species and the full species index. | |
std::vector< int > | m_speciesStatus |
Major -Minor status vector for the species in the problem. | |
std::vector< size_t > | m_phaseID |
Mapping from the species number to the phase number. | |
std::vector< char > | m_SSPhase |
Boolean indicating whether a species belongs to a single-species phase. | |
std::vector< std::string > | m_speciesName |
Species string name for the kth species. | |
std::vector< std::string > | m_elementName |
Vector of strings containing the element names. | |
std::vector< int > | m_elType |
Type of the element constraint. | |
std::vector< int > | m_elementActive |
Specifies whether an element constraint is active. | |
std::vector< vcs_VolPhase * > | m_VolPhaseList |
Array of Phase Structures. | |
std::string | m_title |
String containing the title of the run. | |
char | m_unitsState |
This specifies the current state of units for the Gibbs free energy properties in the program. | |
double | m_totalMoleScale |
Multiplier for the mole numbers within the nondimensionless formulation. | |
std::vector< int > | m_actConventionSpecies |
specifies the activity convention of the phase containing the species | |
std::vector< int > | m_phaseActConvention |
specifies the activity convention of the phase. | |
std::vector< double > | m_lnMnaughtSpecies |
specifies the ln(Mnaught) used to calculate the chemical potentials | |
std::vector< double > | m_actCoeffSpecies_new |
Molar-based Activity Coefficients for Species. | |
std::vector< double > | m_actCoeffSpecies_old |
Molar-based Activity Coefficients for Species based on old mole numbers. | |
DoubleStarStar | m_dLnActCoeffdMolNum |
Change in activity coefficient with mole number. | |
std::vector< double > | m_wtSpecies |
Molecular weight of each species. | |
std::vector< double > | m_chargeSpecies |
Charge of each species. | |
std::vector< std::vector < size_t > > | phasePopProblemLists_ |
std::vector< VCS_SPECIES_THERMO * > | m_speciesThermoList |
Vector of pointers to thermostructures which identify the model and parameters for evaluating the thermodynamic functions for that particular species. | |
int | m_useActCoeffJac |
Choice of Hessians. | |
double | m_totalVol |
Total volume of all phases. | |
std::vector< double > | m_PMVolumeSpecies |
Partial molar volumes of the species. | |
double | m_Faraday_dim |
dimensionless value of Faraday's constant | |
VCS_COUNTERS * | m_VCount |
Timing and iteration counters for the vcs object. | |
int | m_debug_print_lvl |
Debug printing lvl. | |
int | m_timing_print_lvl |
printing level of timing information | |
int | m_VCS_UnitsFormat |
Units for the chemical potential data: | |
Private Member Functions | |
int | vcs_zero_species (const size_t kspec) |
Zero out the concentration of a species. | |
int | vcs_delete_species (const size_t kspec) |
Change a single species from active to inactive status. | |
bool | vcs_delete_multiphase (const size_t iph) |
This routine handles the bookkeepking involved with the deletion of multiphase phases from the problem. | |
int | delta_species (const size_t kspec, double *const delta_ptr) |
Change the concentration of a species by delta moles. | |
size_t | vcs_add_all_deleted () |
Provide an estimate for the deleted species in phases that are not zeroed out. | |
int | vcs_recheck_deleted () |
Recheck deleted species in multispecies phases. | |
bool | recheck_deleted_phase (const int iphase) |
Recheck deletion condition for multispecies phases. | |
double | vcs_minor_alt_calc (size_t kspec, size_t irxn, bool *do_delete) const |
Minor species alternative calculation. | |
bool | vcs_globStepDamp () |
This routine optimizes the minimization of the total gibbs free energy by making sure the slope of the following functional stays negative: | |
void | vcs_switch2D (double *const *const Jac, const size_t k1, const size_t k2) const |
Switch rows and columns of a sqare matrix. | |
double | l2normdg (double dg[]) const |
Calculate the norm of a deltaGibbs free energy vector. | |
void | vcs_inest (double *const aw, double *const sa, double *const sm, double *const ss, double test) |
Estimate equilibrium compositions. | |
void | vcs_SSPhase (void) |
Calculate the status of single species phases. | |
double | deltaG_Recalc_Rxn (const int stateCalc, const size_t irxn, const double *const molNum, double *const ac, double *const mu_i) |
This function recalculates the deltaG for reaction, irxn. | |
void | vcs_delete_memory () |
Delete memory that isn't just resizeable STL containers. | |
void | vcs_counters_init (int ifunc) |
Initialize the internal counters. | |
void | vcs_TCounters_report (int timing_print_lvl=1) |
Create a report on the plog file containing timing and its information. | |
void | vcs_setFlagsVolPhases (const bool upToDate, const int stateCalc) |
void | vcs_setFlagsVolPhase (const size_t iph, const bool upToDate, const int stateCalc) |
void | vcs_updateMolNumVolPhases (const int stateCalc) |
Update all underlying vcs_VolPhase objects. | |
Friends | |
class | vcs_phaseStabilitySolve |
This is the main structure used to hold the internal data used in vcs_solve_TP(), and to solve TP systems.
The indices of information in this structure may change when the species basis changes or when phases pop in and out of existence. Both of these operations change the species ordering.
Definition at line 55 of file vcs_solve.h.
VCS_SOLVE | ( | ) |
Constructor for the VCS_SOLVE class.
Definition at line 34 of file vcs_solve.cpp.
~VCS_SOLVE | ( | ) |
Destructor.
Definition at line 246 of file vcs_solve.cpp.
References VCS_SOLVE::vcs_delete_memory().
void vcs_initSizes | ( | const size_t | nspecies0, |
const size_t | nelements, | ||
const size_t | nphase0 | ||
) |
Initialize the sizes within the VCS_SOLVE object.
This resizes all of the internal arrays within the object. This routine operates in two modes. If all of the parameters are the same as it currently exists in the object, nothing is done by this routine; a quick exit is carried out and all of the data in the object persists.
IF any of the parameters are different than currently exists in the object, then all of the data in the object must be redone. It may not be zeroed, but it must be redone.
nspecies0 | Number of species within the object |
nelements | Number of element constraints within the problem |
nphase0 | Number of phases defined within the problem. |
Definition at line 82 of file vcs_solve.cpp.
References VCS_SOLVE::m_actCoeffSpecies_new, VCS_SOLVE::m_actCoeffSpecies_old, VCS_SOLVE::m_actConventionSpecies, VCS_SOLVE::m_chargeSpecies, VCS_SOLVE::m_deltaGRxn_Deficient, VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_deltaGRxn_old, VCS_SOLVE::m_deltaGRxn_tmp, VCS_SOLVE::m_deltaMolNumPhase, VCS_SOLVE::m_deltaMolNumSpecies, VCS_SOLVE::m_deltaPhaseMoles, VCS_SOLVE::m_dLnActCoeffdMolNum, VCS_SOLVE::m_elemAbundances, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementActive, VCS_SOLVE::m_elementMapIndex, VCS_SOLVE::m_elementName, VCS_SOLVE::m_elType, VCS_SOLVE::m_feSpecies_new, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_formulaMatrix, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_lnMnaughtSpecies, VCS_SOLVE::m_molNumSpecies_new, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseActConvention, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_phaseParticipation, VCS_SOLVE::m_phasePhi, VCS_SOLVE::m_PMVolumeSpecies, VCS_SOLVE::m_scSize, VCS_SOLVE::m_speciesLocalPhaseIndex, VCS_SOLVE::m_speciesMapIndex, VCS_SOLVE::m_speciesName, VCS_SOLVE::m_speciesStatus, VCS_SOLVE::m_speciesThermoList, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_spSize, VCS_SOLVE::m_SSfeSpecies, VCS_SOLVE::m_SSPhase, VCS_SOLVE::m_stoichCoeffRxnMatrix, VCS_SOLVE::m_timing_print_lvl, VCS_SOLVE::m_TmpPhase, VCS_SOLVE::m_TmpPhase2, VCS_SOLVE::m_tPhaseMoles_new, VCS_SOLVE::m_tPhaseMoles_old, VCS_SOLVE::m_useActCoeffJac, VCS_SOLVE::m_VCount, VCS_SOLVE::m_VCS_UnitsFormat, VCS_SOLVE::m_VolPhaseList, VCS_SOLVE::m_wtSpecies, VCS_SOLVE::NPHASE0, VCS_SOLVE::NSPECIES0, plogf, IntStarStar::resize(), DoubleStarStar::resize(), VCS_SOLVE::TPhInertMoles, VCS_SOLVE::vcs_counters_init(), VCS_SOLVE::vcs_delete_memory(), VCS_ELEM_TYPE_ABSPOS, and VCS_SPECIES_TYPE_MOLNUM.
Referenced by VCS_SOLVE::vcs().
int vcs | ( | VCS_PROB * | vprob, |
int | ifunc, | ||
int | ipr, | ||
int | ip1, | ||
int | maxit | ||
) |
Solve an equilibrium problem.
This is the main interface routine to the equilibrium solver
Input:
vprob | Object containing the equilibrium Problem statement |
ifunc | Determines the operation to be done: Valid values: 0 -> Solve a new problem by initializing structures first. An initial estimate may or may not have been already determined. This is indicated in the VCS_PROB structure. 1 -> The problem has already been initialized and set up. We call this routine to resolve it using the problem statement and solution estimate contained in the VCS_PROB structure. 2 -> Don't solve a problem. Destroy all the private structures. |
ipr | Printing of results ipr = 1 -> Print problem statement and final results to standard output 0 -> don't report on anything |
ip1 | Printing of intermediate results IP1 = 1 -> Print intermediate results. |
maxit | Maximum number of iterations for the algorithm |
Output:
Definition at line 317 of file vcs_solve.cpp.
References VCS_COUNTERS::Its, VCS_SOLVE::m_timing_print_lvl, VCS_SOLVE::m_VCount, ckr::max(), VCS_PROB::ne, VCS_PROB::NPhase, VCS_PROB::nspecies, plogf, VCS_PROB::PresPA, clockWC::secondsWC(), VCS_PROB::T, VCS_COUNTERS::T_Time_vcs, VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_report(), VCS_SUCCESS, VCS_SOLVE::vcs_TCounters_report(), VCS_SOLVE::vcs_TP(), and VCS_SOLVE::vcs_wellPosed().
Referenced by vcs_MultiPhaseEquil::equilibrate_TP().
int vcs_solve_TP | ( | int | print_lvl, |
int | printDetails, | ||
int | maxit | ||
) |
Main routine that solves for equilibrium at constant T and P using a variant of the VCS method.
This is the main routine taht solves for equilibrium at constant T and P using a variant of the VCS method. Nonideal phases can be accommodated as well.
Any number of single-species phases and multi-species phases can be handled by the present version.
Input
print_lvl | 1 -> Print results to standard output 0 -> don't report on anything |
printDetails | 1 -> Print intermediate results. |
maxit | Maximum number of iterations for the algorithm |
Definition at line 102 of file vcs_solve_TP.cpp.
References vcs_VolPhase::exists(), vcs_VolPhase::m_singleSpecies, ckr::max(), vcs_VolPhase::molefraction(), Cantera::npos, vcs_VolPhase::nSpecies(), vcs_VolPhase::PhaseName, plogendl, plogf, clockWC::secondsWC(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_DELETE_PHASE_CUTOFF, VCS_ELEM_TYPE_ABSPOS, VCS_PHASE_EXIST_NO, VCS_RELDELETE_SPECIES_CUTOFF, VCS_SPECIES_INTERFACIALVOLTAGE, VCS_SPECIES_MAJOR, VCS_SPECIES_MINOR, VCS_SPECIES_STOICHZERO, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_TYPE_MOLNUM, VCS_SPECIES_ZEROEDMS, VCS_SPECIES_ZEROEDSS, VCS_STATECALC_NEW, VCS_STATECALC_OLD, and VCS_SUCCESS.
Referenced by VCS_SOLVE::vcs_TP().
int vcs_basopt | ( | const bool | doJustComponents, |
double | aw[], | ||
double | sa[], | ||
double | sm[], | ||
double | ss[], | ||
double | test, | ||
bool *const | usedZeroedSpecies | ||
) |
Choose the optimum species basis for the calculations.
Choose the optimum component species basis for the calculations. This is done by choosing the species with the largest mole fraction not currently a linear combination of the previous components. Then, calculate the stoichiometric coefficient matrix for that basis.
Rearranges the solution data to put the component data at the front of the species list.
Then, calculates m_stoichCoeffRxnMatrix[irxn][jcomp] the formation reactions for all noncomponent species in the mechanism. Also calculates DNG(I) and DNL(I), the net mole change for each formation reaction. Also, initializes IR(I) to the default state.
doJustComponents | If true, the m_stoichCoeffRxnMatrix[][] and m_deltaMolNumPhase[] are not calculated. |
aw | Vector of mole fractions which will be used to construct an optimal basis from. |
sa | Gram-Schmidt orthog work space (nc in length) sa[j] |
ss | Gram-Schmidt orthog work space (nc in length) ss[j] |
sm | QR matrix work space (nc*ne in length) sm[i+j*ne] |
test | This is a small negative number dependent upon whether an estimate is supplied or not. |
usedZeroedSpecies | = If true, then a species with a zero concentration was used as a component. The problem may be converged. Or, the problem may have a range space error and may not have a proper solution. |
m_numComponents Number of component species component species This routine calculates the m_numComponent species. It switches their positions in the species vector so that they occupy the first m_numComponent spots in the species vector. m_stoichCoeffRxnMatrix[irxn][jcomp] Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form. jcomp refers to the component number, and irxn refers to the irxn_th non-component species. m_deltaMolNumPhase[irxn] Change in the number of total number of moles of species in all phases due to the noncomponent formation reaction, irxn. m_deltaMolNumPhase[irxn][iphase] Change in the number of moles in phase, iphase, due to the noncomponent formation reaction, irxn. m_phaseParticipation[irxn] This is 1 if the phase, iphase, participates in the formation reaction, irxn, and zero otherwise.
Definition at line 3061 of file vcs_solve_TP.cpp.
References ckr::min(), Cantera::npos, plogendl, plogf, clockWC::secondsWC(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_ELEM_TYPE_ABSPOS, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_SUCCESS.
Referenced by VCS_SOLVE::vcs_inest(), and VCS_SOLVE::vcs_prep_oneTime().
size_t vcs_basisOptMax | ( | const double *const | molNum, |
const size_t | j, | ||
const size_t | n | ||
) |
Choose a species to test for the next component.
We make the choice based on testing (molNum[i] * spSize[i]) for its maximum value. Preference for single species phases is also made.
molNum | Mole number vector |
j | index into molNum[] that indicates where the search will start from Previous successful components are swapped into the fronto of molNum[]. |
n | Length of molNum[] |
Definition at line 3646 of file vcs_solve_TP.cpp.
References AssertThrowVCS.
int vcs_species_type | ( | const size_t | kspec | ) | const |
Evaluate the species category for the indicated species.
All evaluations are done using the "old" version of the solution.
kspec | Species to be evaluated |
Definition at line 3689 of file vcs_solve_TP.cpp.
References vcs_VolPhase::exists(), plogf, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_ELEM_TYPE_ABSPOS, VCS_PHASE_EXIST_YES, VCS_PHASE_EXIST_ZEROEDPHASE, VCS_SPECIES_ACTIVEBUTZERO, VCS_SPECIES_INTERFACIALVOLTAGE, VCS_SPECIES_MAJOR, VCS_SPECIES_MINOR, VCS_SPECIES_STOICHZERO, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_ZEROEDMS, VCS_SPECIES_ZEROEDPHASE, and VCS_SPECIES_ZEROEDSS.
void vcs_chemPotPhase | ( | const int | stateCalc, |
const size_t | iph, | ||
const double *const | molNum, | ||
double *const | ac, | ||
double *const | mu_i, | ||
const bool | do_deleted = false |
||
) |
We calculate the dimensionless chemical potentials of all species in a single phase.
We calculate the dimensionless chemical potentials of all species in a single phase.
Note, for multispecies phases which are currently zeroed out, the chemical potential is filled out with the standard chemical potential.
For species in multispecies phases whose concentration is zero, we need to set the mole fraction to a very low value. Its chemical potential is then calculated using the VCS_DELETE_MINORSPECIES_CUTOFF concentration to keep numbers positive.
Ideal Mixtures: m_feSpecies(I) = m_SSfeSpecies(I) + ln(z(I)) - ln(m_tPhaseMoles[iph]) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase]; ( This is equivalent to the adding the log of the mole fraction onto the standard chemical potential. ) Non-Ideal Mixtures: ActivityConvention = 0: m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph]) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase]; ( This is equivalent to the adding the log of the mole fraction multiplied by the activity coefficient onto the standard chemical potential. ) ActivityConvention = 1: -> molality activity formulation m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph]) - ln(Mnaught * m_units) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase]; note: m_SSfeSpecies(I) is the molality based standard state. However, ActCoeff[I] is the molar based activity coefficient We have used the formulas; ActCoeff_M[I] = ActCoeff[I] / Xmol[N] where Xmol[N] is the mole fraction of the solvent ActCoeff_M[I] is the molality based act coeff. note: This is equivalent to the "normal" molality formulation: m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff_M[I] * m(I)) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase] where m[I] is the molality of the ith solute m[I] = Xmol[I] / ( Xmol[N] * Mnaught * m_units) note: z(I)/tPhMoles_ptr[iph] = Xmol[i] is the mole fraction of i in the phase.
NOTE: As per the discussion in vcs_dfe(), for small species where the mole fraction is small:
z(i) < VCS_DELETE_MINORSPECIES_CUTOFF
The chemical potential is calculated as:
m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[i](VCS_DELETE_MINORSPECIES_CUTOFF))
iph : Phase to be calculated molNum(i) : Number of moles of species i (VCS species order) ff : standard state chemical potentials. These are the chemical potentials of the standard states at the same T and P as the solution. (VCS species order)
ac[] : Activity coefficients for species in phase (VCS species order) mu_i[] : Dimensionless chemical potentials for phase species (VCS species order)
We calculate the dimensionless chemical potentials of all species in a single phase.
Note, for multispecies phases which are currently zeroed out, the chemical potential is filled out with the standard chemical potential.
For species in multispecies phases whose concentration is zero, we need to set the mole fraction to a very low value. Its chemical potential is then calculated using the VCS_DELETE_MINORSPECIES_CUTOFF concentration to keep numbers positive.
Ideal Mixtures: m_feSpecies(I) = m_SSfeSpecies(I) + ln(z(I)) - ln(m_tPhaseMoles[iph]) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase]; ( This is equivalent to the adding the log of the mole fraction onto the standard chemical potential. ) Non-Ideal Mixtures: ActivityConvention = 0: m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph]) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase]; ( This is equivalent to the adding the log of the mole fraction multiplied by the activity coefficient onto the standard chemical potential. ) ActivityConvention = 1: -> molality activity formulation m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph]) - ln(Mnaught * m_units) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase]; note: m_SSfeSpecies(I) is the molality based standard state. However, ActCoeff[I] is the molar based activity coefficient We have used the formulas; ActCoeff_M[I] = ActCoeff[I] / Xmol[N] where Xmol[N] is the mole fraction of the solvent ActCoeff_M[I] is the molality based act coeff. note: This is equivalent to the "normal" molality formulation: m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff_M[I] * m(I)) + m_chargeSpecies[I] * Faraday_dim * m_phasePhi[iphase] where m[I] is the molality of the ith solute m[I] = Xmol[I] / ( Xmol[N] * Mnaught * m_units) note: z(I)/tPhMoles_ptr[iph] = Xmol[i] is the mole fraction of i in the phase.
NOTE: As per the discussion in vcs_dfe(), for small species where the mole fraction is small:
z(i) < VCS_DELETE_MINORSPECIES_CUTOFF
The chemical potential is calculated as:
m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[i](VCS_DELETE_MINORSPECIES_CUTOFF))
iph | Phase to be calculated |
molNum | molNum[i] is the number of moles of species i (VCS species order) |
do_deleted | Do species that are deleted (default = false) |
ac | Activity coefficients for species in phase (VCS species order) |
mu_i | Dimensionless chemical potentials for phase species (VCS species order) |
Definition at line 3984 of file vcs_solve_TP.cpp.
References vcs_VolPhase::electricPotential(), vcs_VolPhase::nSpecies(), plogf, vcs_VolPhase::sendToVCS_ActCoeff(), vcs_VolPhase::setMolesFromVCS(), vcs_VolPhase::spGlobalIndexVCS(), VCS_DELETE_MINORSPECIES_CUTOFF, VCS_SPECIES_DELETED, and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
Referenced by VCS_SOLVE::deltaG_Recalc_Rxn().
void vcs_dfe | ( | const int | stateCalc, |
const int | ll, | ||
const size_t | lbot, | ||
const size_t | ltop | ||
) |
Calculate the dimensionless chemical potentials of all species or of certain groups of species, at a fixed temperature and pressure.
We calculate the dimensionless chemical potentials of all species or certain groups of species here, at a fixed temperature and pressure, for the input mole vector z[] in the parameter list. Nondimensionalization is achieved by division by RT.
Note, for multispecies phases which are currently zeroed out, the chemical potential is filled out with the standard chemical potential.
For species in multispecies phases whose concentration is zero, we need to set the mole fraction to a very low value. Its chemical potential is then calculated using the VCS_DELETE_MINORSPECIES_CUTOFF concentration to keep numbers positive.
Ideal Mixtures: m_feSpecies(I) = m_SSfeSpecies(I) + ln(z(I)) - ln(m_tPhaseMoles[iph]) + Charge[I] * Faraday_dim * phasePhi[iphase]; ( This is equivalent to the adding the log of the mole fraction onto the standard chemical potential. ) Non-Ideal Mixtures: -> molar activity formulation ActivityConvention = 0: m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph]) + Charge[I] * Faraday_dim * phasePhi[iphase]; ( This is equivalent to the adding the log of the mole fraction multiplied by the activity coefficient onto the standard chemical potential. ) note: z(I)/tPhMoles_ptr[iph] = Xmol[i] is the mole fraction of i in the phase. ActivityConvention = 1: -> molality activity formulation m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph]) - ln(Mnaught * m_units) + Charge[I] * Faraday_dim * phasePhi[iphase]; note: m_SSfeSpecies(I) is the molality based standard state. However, ActCoeff[I] is the molar based activity coefficient We have used the formulas; ActCoeff_M[I] = ActCoeff[I] / Xmol[N] where Xmol[N] is the mole fraction of the solvent ActCoeff_M[I] is the molality based act coeff. m_feSpecies(I) = m_SSfeSpecies(I) + ln(ActCoeff_M[I] * m(I)) + Charge[I] * Faraday_dim * phasePhi[iphase]; where m[I] is the molality of the ith solute m[I] = Xmol[I] / ( Xmol[N] * Mnaught * m_units)
As per the discussion above, for small species where the mole fraction
z(i) < VCS_DELETE_MINORSPECIES_CUTOFF
The chemical potential is calculated as:
m_feSpecies(I)(I) = m_SSfeSpecies(I) + ln(ActCoeff[i](VCS_DELETE_MINORSPECIES_CUTOFF))
Species in the following categories are treated as "small species"
For species in multispecies phases which are currently not active, the treatment is different. These species are in the following species categories:
- VCS_SPECIES_ZEROEDMS - VCS_SPECIES_ZEROEDPHASE .
For these species, the ln( ActCoeff[I] X[I]) term is dropped altogether. The following equation is used.
m_feSpecies(I) = m_SSfeSpecies(I) + Charge[I] * Faraday_dim * phasePhi[iphase];
These species have species types of VCS_SPECIES_TYPE_INTERFACIALVOLTAGE The chemical potentials for these "species" refer to electrons in metal electrodes. They have the following formula m_feSpecies(I) = m_SSfeSpecies(I) - F z[I] / RT F is Faraday's constant. R = gas constant T = temperature V = potential of the interface = phi_electrode - phi_solution For these species, the solution vector unknown, z[I], is V, the phase voltage, in volts.
ll | Determine which group of species gets updated ll = 0: Calculate for all species < 0: calculate for components and for major non-components 1: calculate for components and for minor non-components |
lbot | Restricts the calculation of the chemical potential to the species between LBOT <= i < LTOP. Usually LBOT and LTOP will be equal to 0 and MR, respectively. |
ltop | Top value of the loops |
stateCalc | Determines whether z is old or new or tentative: 1: Use the tentative values for the total number of moles in the phases, i.e., use TG1 instead of TG etc. 0: Use the base values of the total number of moles in each system. |
Also needed: ff : standard state chemical potentials. These are the chemical potentials of the standard states at the same T and P as the solution. tg : Total Number of moles in the phase.
Definition at line 4179 of file vcs_solve_TP.cpp.
References vcs_VolPhase::electricPotential(), vcs_VolPhase::m_singleSpecies, plogendl, plogf, vcs_VolPhase::sendToVCS_ActCoeff(), vcs_VolPhase::updateFromVCS_MoleNumbers(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_DIMENSIONAL_G, VCS_SPECIES_MINOR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_ZEROEDMS, VCS_SPECIES_ZEROEDPHASE, VCS_STATECALC_NEW, and VCS_STATECALC_OLD.
Referenced by VCS_SOLVE::vcs_inest(), and VCS_SOLVE::vcs_report().
void vcs_printSpeciesChemPot | ( | const int | stateCalc | ) | const |
Print out a table of chemical potentials.
stateCalc | Determines where to get the mole numbers from.
|
Definition at line 4454 of file vcs_solve_TP.cpp.
References vcs_VolPhase::electricPotential(), Cantera::GasConstant, Cantera::int2str(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_ZEROEDMS, VCS_SPECIES_ZEROEDPHASE, VCS_SPECIES_ZEROEDSS, and VCS_STATECALC_NEW.
void vcs_updateVP | ( | const int | stateCalc | ) |
This routine uploads the state of the system into all of the vcs_VolumePhase objects in the current problem.
stateCalc | Determines where to get the mole numbers from.
|
Definition at line 4654 of file vcs_solve_TP.cpp.
References plogendl, plogf, vcs_VolPhase::setMolesFromVCSCheck(), VCS_DATA_PTR, VCS_STATECALC_NEW, and VCS_STATECALC_OLD.
bool vcs_popPhasePossible | ( | const size_t | iphasePop | ) | const |
Utility function that evaluates whether a phase can be popped into existence.
iphasePop | id of the phase, which is currently zeroed, |
Definition at line 40 of file vcs_phaseStability.cpp.
References vcs_VolPhase::exists(), vcs_VolPhase::nSpecies(), vcs_VolPhase::spGlobalIndexVCS(), VCS_DELETE_ELEMENTABS_CUTOFF, and VCS_ELEM_TYPE_ABSPOS.
int vcs_phasePopDeterminePossibleList | ( | ) |
Determine the list of problems that need to be checked to see if there are any phases pops.
This routine evaluates and fills in the following quantities phasePopProblemLists_
Definition at line 147 of file vcs_phaseStability.cpp.
References vcs_VolPhase::exists(), vcs_VolPhase::nSpecies(), vcs_VolPhase::spGlobalIndexVCS(), and VCS_ELEM_TYPE_ABSPOS.
size_t vcs_popPhaseID | ( | std::vector< size_t > & | phasePopPhaseIDs | ) |
Decision as to whether a phase pops back into existence.
phasePopPhaseIDs | Vector containing the phase ids of the phases that will be popped this step. |
Definition at line 281 of file vcs_phaseStability.cpp.
References vcs_VolPhase::exists(), vcs_VolPhase::m_singleSpecies, Cantera::npos, vcs_VolPhase::PhaseName, plogf, and vcs_VolPhase::spGlobalIndexVCS().
int vcs_popPhaseRxnStepSizes | ( | const size_t | iphasePop | ) |
Calculates the deltas of the reactions due to phases popping into existence.
iphasePop | Phase id of the phase that will come into existence |
Definition at line 434 of file vcs_phaseStability.cpp.
References vcs_VolPhase::creationMoleNumbers(), DATA_PTR, vcs_VolPhase::exists(), vcs_VolPhase::m_singleSpecies, ckr::max(), vcs_VolPhase::nSpecies(), vcs_VolPhase::PhaseName, plogf, vcs_VolPhase::spGlobalIndexVCS(), VCS_DELETE_PHASE_CUTOFF, VCS_ELEM_TYPE_ABSPOS, VCS_SPECIES_COMPONENT, VCS_SPECIES_MAJOR, and VCS_SPECIES_MINOR.
size_t vcs_RxnStepSizes | ( | int & | forceComponentCalc, |
size_t & | kSpecial | ||
) |
Calculates formation reaction step sizes.
This is equation 6.4-16, p. 143 in Smith and Missen.
m_deltaMolNumSpecies(irxn) : reaction adjustments, where irxn refers to the irxn'th species formation reaction. This adjustment is for species irxn + M, where M is the number of components.
Special branching occurs sometimes. This causes the component basis to be reevaluated
forceComponentCalc | integer flagging whether a component recalculation needs to be carried out. |
kSpecial | species number of phase being zeroed. |
Definition at line 44 of file vcs_rxnadj.cpp.
References VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_deltaMolNumPhase, VCS_SOLVE::m_deltaMolNumSpecies, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numRxnRdc, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseID, vcs_VolPhase::m_singleSpecies, VCS_SOLVE::m_speciesName, VCS_SOLVE::m_speciesStatus, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_SSPhase, VCS_SOLVE::m_stoichCoeffRxnMatrix, VCS_SOLVE::m_tolmaj2, VCS_SOLVE::m_totalMolNum, VCS_SOLVE::m_tPhaseMoles_old, VCS_SOLVE::m_useActCoeffJac, VCS_SOLVE::m_VolPhaseList, Cantera::npos, vcs_VolPhase::nSpecies(), plogendl, plogf, VCS_DATA_PTR, VCS_DELETE_PHASE_CUTOFF, VCS_SOLVE::vcs_Hessian_diag_adj(), VCS_SMALL_MULTIPHASE_SPECIES, VCS_SPECIES_MAJOR, VCS_SPECIES_STOICHZERO, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_SPECIES_ZEROEDPHASE.
double vcs_tmoles | ( | ) |
Calculates the total number of moles of species in all phases.
Calculates the total number of moles in all phases and updates the variable m_totalMolNum. Reconciles Phase existence flags with total moles in each phase.
Definition at line 4599 of file vcs_solve_TP.cpp.
References vcs_VolPhase::setTotalMoles(), and VCS_SPECIES_TYPE_MOLNUM.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
void vcs_deltag | ( | const int | l, |
const bool | doDeleted, | ||
const int | vcsState, | ||
const bool | alterZeroedPhases = true |
||
) |
This subroutine calculates reaction free energy changes for all noncomponent formation reactions.
Formation reactions are reactions which create each noncomponent species from the component species. m_stoichCoeffRxnMatrix[irxn][jcomp] are the stoichiometric coefficients for these reactions. A stoichiometric coefficient of one is assumed for species irxn in this reaction.
INPUT
l | L < 0 : Calculate reactions corresponding to major noncomponent and zeroed species only L = 0 : Do all noncomponent reactions, i, between 0 <= i < irxnl L > 0 : Calculate reactions corresponding to minor noncomponent and zeroed species only |
doDeleted | Do deleted species |
vcsState | Calculate deltaG corresponding to either old or new free energies |
alterZeroedPhases | boolean indicating whether we should add in a special section for zeroed phases. |
Note we special case one important issue. If the component has zero moles, then we do not allow deltaG < 0.0 for formation reactions which would lead to the loss of more of that same component. This dG < 0.0 condition feeds back into the algorithm in several places, and leads to a infinite loop in at least one case.
Definition at line 4879 of file vcs_solve_TP.cpp.
References mdp::checkFinite(), vcs_VolPhase::m_singleSpecies, ckr::max(), vcs_VolPhase::nSpecies(), plogf, vcs_VolPhase::spGlobalIndexVCS(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_SPECIES_MINOR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_STATECALC_NEW, and VCS_STATECALC_OLD.
Referenced by VCS_SOLVE::vcs_inest().
void vcs_deltag_Phase | ( | const size_t | iphase, |
const bool | doDeleted, | ||
const int | stateCalc, | ||
const bool | alterZeroedPhases = true |
||
) |
Calculate deltag of formation for all species in a single phase.
Calculate deltag of formation for all species in a single phase. It is assumed that the fe[] is up to date for all species. Howevever, if the phase is currently zereoed out, a subproblem is calculated to solve for AC[i] and pseudo-X[i] for that phase.
iphase | phase index of the phase to be calculated |
doDeleted | boolean indicating whether to do deleted species or not |
stateCalc | integer describing which set of free energies to use and where to stick the results. |
alterZeroedPhases | boolean indicating whether we should add in a special section for zeroed phases. |
NOTE: this is currently not used used anywhere. It may be in the future?
Definition at line 5228 of file vcs_solve_TP.cpp.
References vcs_VolPhase::m_singleSpecies, plogendl, plogf, vcs_VolPhase::spGlobalIndexVCS(), VCS_DATA_PTR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_STATECALC_NEW, and VCS_STATECALC_OLD.
void vcs_switch_pos | ( | const bool | ifunc, |
const size_t | k1, | ||
const size_t | k2 | ||
) |
Swaps the indices for all of the global data for two species, k1 and k2.
ifunc,: | If true, switch the species data and the noncomponent reaction data. This must be called for a non-component species only. If false, switch the species data only. Typically, we use this option when determining the component species and at the end of the calculation, when we want to return unscrambled results. All rxn data will be out-of-date. |
k1 | First species index |
k2 | Second species index |
Definition at line 5397 of file vcs_solve_TP.cpp.
References plogf, vcs_VolPhase::setSpGlobalIndexVCS(), and vcs_VolPhase::spGlobalIndexVCS().
Referenced by VCS_SOLVE::vcs_rearrange().
double vcs_birthGuess | ( | const int | kspec | ) |
Birth guess returns the number of moles of a species that is coming back to life.
Birth guess returns the number of moles of a species that is coming back to life. Note, this routine is not applicable if the whole phase is coming back to life, not just one species in that phase.
Do a minor alt calculation. But, cap the mole numbers at 1.0E-15. For SS phases use VCS_DELETE_SPECIES_CUTOFF * 100.
The routine makes sure the guess doesn't reduce the concentration of a component by more than 1/3. Note this may mean that the vlaue coming back from this routine is zero or a very small number.
kspec | Species number that is coming back to life |
Definition at line 5527 of file vcs_solve_TP.cpp.
References ckr::min(), plogf, VCS_DELETE_MINORSPECIES_CUTOFF, and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
double vcs_phaseStabilityTest | ( | const size_t | iph | ) |
Main program to test whether a deleted phase should be brought back into existence.
iph | Phase id of the deleted phase |
Definition at line 631 of file vcs_phaseStability.cpp.
References vcs_VolPhase::creationMoleNumbers(), ckr::max(), Cantera::npos, vcs_VolPhase::nSpecies(), plogf, vcs_VolPhase::sendToVCS_ActCoeff(), vcs_VolPhase::setCreationMoleNumbers(), vcs_VolPhase::setMoleFractionsState(), vcs_VolPhase::spGlobalIndexVCS(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_STATECALC_OLD, and VCS_STATECALC_PHASESTABILITY.
int vcs_TP | ( | int | ipr, |
int | ip1, | ||
int | maxit, | ||
double | T, | ||
double | pres | ||
) |
Solve an equilibrium problem at a particular fixed temperature and pressure.
The actual problem statement is assumed to be in the structure already. This is a wrapper around the solve_TP() function. In this wrapper, we nondimensionalize the system we calculate the standard state gibbs free energies of the species, and we decide whether to we need to use the initial guess algorithm.
ipr | = 1 -> Print results to standard output 0 -> don't report on anything |
ip1 | = 1 -> Print intermediate results. 0 -> Dont print any intermediate results |
maxit | Maximum number of iterations for the algorithm |
T | Value of the Temperature (Kelvin) Param pres Value of the Pressure (units given by m_VCS_UnitsFormat variable |
Definition at line 17 of file vcs_TP.cpp.
References VCS_SOLVE::m_doEstimateEquil, VCS_SOLVE::m_pressurePA, VCS_SOLVE::m_temperature, plogf, VCS_SOLVE::vcs_fePrep_TP(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_solve_TP(), and VCS_SUCCESS.
Referenced by VCS_SOLVE::vcs().
void vcs_fePrep_TP | ( | void | ) |
Initialize the chemical potential of single species phases.
For single species phases, initialize the chemical potential with the value of the standard state chemical potential. This value doesn't change during the calculation
Definition at line 165 of file vcs_TP.cpp.
References VCS_SOLVE::m_feSpecies_new, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_SSfeSpecies, and VCS_SOLVE::m_SSPhase.
Referenced by VCS_SOLVE::vcs_TP().
double vcs_VolTotal | ( | const double | tkelvin, |
const double | pres, | ||
const double | w[], | ||
double | volPM[] | ||
) |
Calculation of the total volume and the partial molar volumes.
This function calculates the partial molar volume for all species, kspec, in the thermo problem at the temperature TKelvin and pressure, Pres, pres is in atm. And, it calculates the total volume of the combined system.
tkelvin | Temperature in kelvin() |
pres | Pressure in Pascal |
w | w[] is the vector containing the current mole numbers in units of kmol. |
volPM[] | For species in all phase, the entries are the partial molar volumes units of M**3 / kmol. |
Definition at line 1123 of file vcs_solve.cpp.
References VCS_SOLVE::m_numPhases, VCS_SOLVE::m_VolPhaseList, vcs_VolPhase::sendToVCS_VolPM(), vcs_VolPhase::setMolesFromVCS(), vcs_VolPhase::setState_TP(), and VCS_STATECALC_OLD.
Referenced by VCS_SOLVE::vcs_prob_update(), and VCS_SOLVE::vcs_report().
int vcs_prep_oneTime | ( | int | printLvl | ) |
This routine is mostly concerned with changing the private data to be consistent with what's needed for solution.
It is called one time for each new problem structure definition.
This routine is always followed by vcs_prep(). Therefore, tasks that need to be done for every call to vcsc() should be placed in vcs_prep() and not in this routine.
The problem structure refers to:
the number and identity of the species. the formula matrix and thus the number of components. the number and identity of the phases. the equation of state the method and parameters for determining the standard state The method and parameters for determining the activity coefficients.
Tasks: 0) Fill in the SSPhase[] array. 1) Check to see if any multispecies phases actually have only one species in that phase. If true, reassign that phase and species to be a single-species phase. 2) Determine the number of components in the problem if not already done so. During this process the order of the species is changed in the private data structure. All references to the species properties must employ the ind[] index vector.
printLvl | Print level of the routine |
Definition at line 106 of file vcs_prep.cpp.
References VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_doEstimateEquil, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numRxnRdc, VCS_SOLVE::m_numRxnTot, VCS_SOLVE::m_numSpeciesRdc, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_pressurePA, VCS_SOLVE::m_speciesLocalPhaseIndex, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_spSize, VCS_SOLVE::m_SSfeSpecies, VCS_SOLVE::m_temperature, VCS_SOLVE::m_VolPhaseList, plogf, vcs_VolPhase::speciesProperty(), VCS_SOLVE::vcs_basopt(), VCS_DATA_PTR, VCS_SOLVE::vcs_elem_rearrange(), VCS_SPECIES_TYPE_MOLNUM, VCS_SOLVE::vcs_SSPhase(), and VCS_SUCCESS.
Referenced by VCS_SOLVE::vcs().
int vcs_prep | ( | ) |
Prepare the object for solution.
This routine is mostly concerned with changing the private data to be consistent with that needed for solution. It is called for every invocation of the vcs_solve() except for the cleanup invocation.
Tasks: 1) Initialization of arrays to zero.
return code VCS_SUCCESS = everything went OK VCS_PUB_BAD = There is an irreconcilable difference in the public data structure from when the problem was initially set up.
Definition at line 279 of file vcs_prep.cpp.
References VCS_SOLVE::m_deltaMolNumPhase, VCS_SOLVE::m_deltaPhaseMoles, VCS_SOLVE::m_feSpecies_new, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_molNumSpecies_new, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseParticipation, VCS_SOLVE::m_tPhaseMoles_new, VCS_DATA_PTR, VCS_SUCCESS, and VCS_SOLVE::vcs_tmoles().
Referenced by VCS_SOLVE::vcs().
bool vcs_wellPosed | ( | VCS_PROB * | vprob | ) |
In this routine, we check for things that will cause the algorithm to fail.
We check to see if the problem is well posed. If it is not, we return false and print out error conditions.
Current there is one condition. If all the element abundances are zero, the algorithm will fail.
vprob | VCS_PROB pointer to the definition of the equilibrium problem |
Definition at line 315 of file vcs_prep.cpp.
References VCS_PROB::gai, VCS_PROB::ne, and plogf.
Referenced by VCS_SOLVE::vcs().
int vcs_elem_rearrange | ( | double *const | aw, |
double *const | sa, | ||
double *const | sm, | ||
double *const | ss | ||
) |
Rearrange the constraint equations represented by the Formula Matrix so that the operational ones are in the front.
This subroutine handles the rearrangement of the constraint
equations represented by the Formula Matrix. Rearrangement is only necessary when the number of components is less than the number of elements. For this case, some constraints can never be satisfied exactly, because the range space represented by the Formula Matrix of the components can't span the extra space. These constraints, which are out of the range space of the component Formula matrix entries, are migrated to the back of the Formula matrix.
A prototypical example is an extra element column in FormulaMatrix[], which is identically zero. For example, let's say that argon is has an element column in FormulaMatrix[], but no species in the mechanism actually contains argon. Then, nc < ne. Also, without perturbation of FormulaMatrix[] vcs_basopt[] would produce a zero pivot because the matrix would be singular (unless the argon element column was already the last column of FormulaMatrix[]. This routine borrows heavily from vcs_basopt's algorithm. It finds nc constraints which span the range space of the Component Formula matrix, and assigns them as the first nc components in the formula matrix. This guarantees that vcs_basopt[] has a nonsingular matrix to invert.
Other Variables
aw | aw[i[ Mole fraction work space (ne in length) |
sa | sa[j] = Gram-Schmidt orthog work space (ne in length) |
sm | sm[i+j*ne] = QR matrix work space (ne*ne in length) |
ss | ss[j] = Gram-Schmidt orthog work space (ne in length) |
Definition at line 60 of file vcs_elem_rearrange.cpp.
References VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementActive, VCS_SOLVE::m_elementName, VCS_SOLVE::m_formulaMatrix, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, Cantera::npos, plogendl, plogf, VCS_SUCCESS, and VCS_SOLVE::vcs_switch_elem_pos().
Referenced by VCS_SOLVE::vcs_prep_oneTime().
void vcs_switch_elem_pos | ( | size_t | ipos, |
size_t | jpos | ||
) |
Swaps the indices for all of the global data for two elements, ipos and jpos.
This function knows all of the element information with VCS_SOLVE, and can therefore switch element positions
ipos | first global element index |
jpos | second global element index |
Definition at line 229 of file vcs_elem_rearrange.cpp.
References vcs_VolPhase::elemGlobalIndex(), VCS_SOLVE::m_elemAbundances, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementActive, VCS_SOLVE::m_elementMapIndex, VCS_SOLVE::m_elementName, VCS_SOLVE::m_elType, VCS_SOLVE::m_formulaMatrix, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_VolPhaseList, vcs_VolPhase::nElemConstraints(), plogendl, plogf, and vcs_VolPhase::setElemGlobalIndex().
Referenced by VCS_SOLVE::vcs_elem_rearrange().
int vcs_rxn_adj_cg | ( | void | ) |
Calculates reaction adjustments using a full Hessian approximation.
Calculates reaction adjustments. This does what equation 6.4-16, p. 143 in Smith and Missen is suppose to do. However, a full matrix is formed and then solved via a conjugate gradient algorithm. No preconditioning is done.
If special branching is warranted, then the program bails out.
DS(I) : reaction adjustment, where I refers to the Ith species Special branching occurs sometimes. This causes the component basis to be reevaluated return = 0 : normal return 1 : A single species phase species has been zeroed out in this routine. The species is a noncomponent 2 : Same as one but, the zeroed species is a component.
Special attention is taken to flag cases where the direction of the update is contrary to the steepest descent rule. This is an important attribute of the regular vcs algorithm. We don't want to violate this.
NOTE: currently this routine is not used.
Definition at line 434 of file vcs_rxnadj.cpp.
References VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_deltaMolNumPhase, VCS_SOLVE::m_deltaMolNumSpecies, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numRxnMinorZeroed, VCS_SOLVE::m_numRxnRdc, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_speciesName, VCS_SOLVE::m_speciesStatus, VCS_SOLVE::m_SSPhase, VCS_SOLVE::m_stoichCoeffRxnMatrix, VCS_SOLVE::m_tolmaj2, VCS_SOLVE::m_tPhaseMoles_old, VCS_SOLVE::m_VolPhaseList, plogf, VCS_SPECIES_MAJOR, and VCS_SPECIES_MINOR.
double vcs_Hessian_diag_adj | ( | size_t | irxn, |
double | hessianDiag_Ideal | ||
) |
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficients on the mole numbers.
(See framemaker notes, Eqn. 20 - VCS Equations document)
We allow the diagonal to be increased positively to any degree. We allow the diagonal to be decreased to 1/3 of the ideal solution value, but no more -> it must remain positive.
NOTE: currently this routine is not used
Definition at line 657 of file vcs_rxnadj.cpp.
References plogf, and VCS_SOLVE::vcs_Hessian_actCoeff_diag().
Referenced by VCS_SOLVE::vcs_RxnStepSizes().
double vcs_Hessian_actCoeff_diag | ( | size_t | irxn | ) |
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficients on the mole numbers.
(See framemaker notes, Eqn. 20 - VCS Equations document)
NOTE: currently this routine is not used
Definition at line 683 of file vcs_rxnadj.cpp.
References VCS_SOLVE::m_dLnActCoeffdMolNum, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_SSPhase, and VCS_SOLVE::m_stoichCoeffRxnMatrix.
Referenced by VCS_SOLVE::vcs_Hessian_diag_adj().
int vcs_report | ( | int | iconv | ) |
Print out a report on the state of the equilibrium problem to standard output.
iconv | Indicator of convergence, to be printed out in the report:
|
Definition at line 47 of file vcs_report.cpp.
References VCS_COUNTERS::Basis_Opts, VCS_COUNTERS::Its, VCS_SOLVE::m_actCoeffSpecies_old, VCS_SOLVE::m_chargeSpecies, VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_elemAbundances, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementActive, VCS_SOLVE::m_elementName, VCS_SOLVE::m_elType, VCS_SOLVE::m_Faraday_dim, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_lnMnaughtSpecies, VCS_SOLVE::m_molNumSpecies_new, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numRxnTot, VCS_SOLVE::m_numSpeciesRdc, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_phasePhi, VCS_SOLVE::m_PMVolumeSpecies, VCS_SOLVE::m_pressurePA, VCS_SOLVE::m_speciesName, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_SSfeSpecies, VCS_SOLVE::m_stoichCoeffRxnMatrix, VCS_SOLVE::m_temperature, VCS_SOLVE::m_timing_print_lvl, VCS_SOLVE::m_totalMoleScale, VCS_SOLVE::m_totalVol, VCS_SOLVE::m_tPhaseMoles_old, VCS_SOLVE::m_unitsState, VCS_SOLVE::m_VCount, VCS_SOLVE::m_VCS_UnitsFormat, VCS_SOLVE::m_VolPhaseList, ckr::max(), vcs_VolPhase::PhaseName, plogf, VCS_COUNTERS::Time_basopt, VCS_COUNTERS::Time_vcs_TP, vcs_VolPhase::totalMoles(), VCS_SOLVE::TPhInertMoles, VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_SOLVE::vcs_dfe(), VCS_DIMENSIONAL_G, VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_nondimMult_TP(), VCS_SOLVE::vcs_printChemPotUnits(), VCS_SOLVE::vcs_redim_TP(), VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_TYPE_MOLNUM, VCS_STATECALC_OLD, VCS_SUCCESS, VCS_SOLVE::vcs_tmoles(), and VCS_SOLVE::vcs_VolTotal().
Referenced by VCS_SOLVE::vcs().
int vcs_rearrange | ( | ) |
Switch all species data back to the original order.
This destroys the data based on reaction ordering.
Definition at line 27 of file vcs_rearrange.cpp.
References VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_speciesMapIndex, and VCS_SOLVE::vcs_switch_pos().
double vcs_nondim_Farad | ( | int | mu_units, |
double | TKelvin | ||
) | const |
Returns the multiplier for electric charge terms.
Definition at line 33 of file vcs_nondim.cpp.
References Cantera::Avogadro, Cantera::GasConstant, plogendl, and plogf.
Referenced by VCS_SOLVE::vcs_nondim_TP().
double vcs_nondimMult_TP | ( | int | mu_units, |
double | TKelvin | ||
) | const |
Returns the multiplier for the nondimensionalization of the equations.
This is basically equal to RT
mu_units | integer representing the dimensional units system |
TKelvin | double Temperature in Kelvin |
Definition at line 69 of file vcs_nondim.cpp.
References Cantera::GasConst_cal_mol_K, Cantera::GasConstant, plogendl, and plogf.
Referenced by VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
void vcs_nondim_TP | ( | ) |
Nondimensionalize the problem data.
Nondimensionalize the free energies using the divisor, R * T
Essentially the internal data can either be in dimensional form or in nondimensional form. This routine switches the data from dimensional form into nondimensional form.
What we do is to divide by RT.
Definition at line 115 of file vcs_nondim.cpp.
References Cantera::fp2str(), VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_deltaGRxn_old, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elType, VCS_SOLVE::m_Faraday_dim, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_SSfeSpecies, VCS_SOLVE::m_temperature, VCS_SOLVE::m_totalMoleScale, VCS_SOLVE::m_unitsState, VCS_SOLVE::m_VCS_UnitsFormat, VCS_SOLVE::m_VolPhaseList, plogendl, plogf, vcs_VolPhase::setTotalMolesInert(), VCS_SOLVE::TPhInertMoles, VCS_DIMENSIONAL_G, VCS_ELEM_TYPE_ABSPOS, VCS_SOLVE::vcs_nondim_Farad(), VCS_NONDIMENSIONAL_G, VCS_SOLVE::vcs_nondimMult_TP(), VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_SOLVE::vcs_tmoles().
Referenced by VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_TP().
void vcs_redim_TP | ( | void | ) |
Redimensionalize the problem data.
Reddimensionalize the free energies using the multiplier R * T
Essentially the internal data can either be in dimensional form or in nondimensional form. This routine switches the data from nondimensional form into dimensional form.
What we do is to multiply by RT.
Definition at line 215 of file vcs_nondim.cpp.
References VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_deltaGRxn_old, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_Faraday_dim, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_SSfeSpecies, VCS_SOLVE::m_temperature, VCS_SOLVE::m_totalMoleScale, VCS_SOLVE::m_unitsState, VCS_SOLVE::m_VCS_UnitsFormat, VCS_SOLVE::m_VolPhaseList, plogendl, plogf, vcs_VolPhase::setTotalMolesInert(), VCS_SOLVE::TPhInertMoles, VCS_DIMENSIONAL_G, VCS_SOLVE::vcs_nondimMult_TP(), VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_SOLVE::vcs_tmoles().
Referenced by VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_TP().
void vcs_printChemPotUnits | ( | int | unitsFormat | ) | const |
Print the string representing the Chemical potential units.
This gets printed using plogf()
unitsFormat | Integer representing the units system |
Definition at line 267 of file vcs_nondim.cpp.
References plogf.
Referenced by VCS_SOLVE::vcs_report().
void vcs_elab | ( | ) |
Computes the current elemental abundances vector.
Computes the elemental abundances vector, m_elemAbundances[], and stores it back into the global structure
Definition at line 21 of file vcs_elem.cpp.
References VCS_SOLVE::m_elemAbundances, VCS_SOLVE::m_formulaMatrix, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_speciesUnknownType, and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
Referenced by VCS_SOLVE::vcs_inest_TP().
int vcs_inest_TP | ( | ) |
Create an initial estimate of the solution to the thermodynamic equilibrium problem.
Definition at line 399 of file vcs_inest.cpp.
References VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_doEstimateEquil, VCS_SOLVE::m_feSpecies_new, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_tPhaseMoles_old, VCS_SOLVE::m_VCount, plogendl, plogf, clockWC::secondsWC(), VCS_COUNTERS::T_Calls_Inest, VCS_COUNTERS::T_Time_inest, VCS_DATA_PTR, VCS_SOLVE::vcs_elab(), and VCS_SOLVE::vcs_inest().
Referenced by VCS_SOLVE::vcs_TP().
double vcs_GibbsPhase | ( | size_t | iphase, |
const double *const | w, | ||
const double *const | fe | ||
) |
Calculate the total dimensionless Gibbs free energy of a single phase.
-> Inert species are handled as if they had a standard free energy of zero and if they obeyed ideal solution/gas theory
iphase | ID of the phase |
w | Species mole number vector for all species |
fe | vector of partial molar free energies of all of the species |
Definition at line 68 of file vcs_Gibbs.cpp.
References vcs_VolPhase::m_gasPhase, VCS_SOLVE::m_numSpeciesRdc, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_pressurePA, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_VolPhaseList, VCS_SOLVE::TPhInertMoles, and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
Referenced by VCS_SOLVE::vcs_report().
int vcs_prob_update | ( | VCS_PROB * | pub | ) |
Transfer the results of the equilibrium calculation back to VCS_PROB.
The VCS_PUB structure is returned to the user.
pub | Pointer to VCS_PROB object that will get the results of the equilibrium calculation transfered to it. |
Definition at line 988 of file vcs_solve.cpp.
References VCS_COUNTERS::Basis_Opts, vcs_VolPhase::electricPotential(), VCS_COUNTERS::Its, VCS_SOLVE::m_feSpecies_old, VCS_PROB::m_gibbsSpecies, VCS_PROB::m_Iterations, VCS_SOLVE::m_molNumSpecies_old, VCS_PROB::m_NumBasisOptimizations, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_PMVolumeSpecies, VCS_SOLVE::m_pressurePA, VCS_SOLVE::m_speciesMapIndex, VCS_SOLVE::m_temperature, VCS_SOLVE::m_totalVol, VCS_SOLVE::m_VCount, VCS_SOLVE::m_VolPhaseList, VCS_PROB::mf, vcs_VolPhase::molefraction(), vcs_VolPhase::moleFractions(), VCS_PROB::NPhase, vcs_VolPhase::nSpecies(), vcs_VolPhase::phiVarIndex(), plogf, VCS_PROB::PresPA, vcs_VolPhase::setElectricPotential(), vcs_VolPhase::setMoleFractionsState(), vcs_VolPhase::setTotalMoles(), vcs_VolPhase::setTotalMolesInert(), VCS_PROB::SpeciesUnknownType, vcs_VolPhase::speciesUnknownType(), vcs_VolPhase::spGlobalIndexVCS(), VCS_PROB::T, vcs_VolPhase::totalMoles(), vcs_VolPhase::totalMolesInert(), VCS_DATA_PTR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_STATECALC_TMP, VCS_SUCCESS, VCS_SOLVE::vcs_tmoles(), VCS_SOLVE::vcs_VolTotal(), VCS_PROB::Vol, VCS_PROB::VolPM, VCS_PROB::VPhaseList, and VCS_PROB::w.
Referenced by VCS_SOLVE::vcs().
int vcs_prob_specifyFully | ( | const VCS_PROB * | pub | ) |
Fully specify the problem to be solved using VCS_PROB.
Use the contents of the VCS_PROB to specify the contents of the private data, VCS_SOLVE.
pub | Pointer to VCS_PROB that will be used to initialize the current equilibrium problem |
Definition at line 460 of file vcs_solve.cpp.
References VCS_PROB::Charge, VCS_PROB::ElActive, VCS_PROB::ElName, VCS_PROB::FormulaMatrix, VCS_PROB::gai, VCS_PROB::iest, VCS_SOLVE::m_actConventionSpecies, VCS_SOLVE::m_chargeSpecies, VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_doEstimateEquil, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementActive, VCS_SOLVE::m_elementMapIndex, VCS_SOLVE::m_elementName, VCS_PROB::m_elType, VCS_SOLVE::m_elType, VCS_SOLVE::m_formulaMatrix, VCS_SOLVE::m_lnMnaughtSpecies, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numRxnMinorZeroed, VCS_SOLVE::m_numRxnRdc, VCS_SOLVE::m_numRxnTot, VCS_SOLVE::m_numSpeciesRdc, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseActConvention, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_PMVolumeSpecies, VCS_SOLVE::m_pressurePA, VCS_SOLVE::m_speciesLocalPhaseIndex, VCS_SOLVE::m_speciesMapIndex, VCS_SOLVE::m_speciesName, VCS_SOLVE::m_speciesStatus, VCS_SOLVE::m_speciesThermoList, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_temperature, VCS_SOLVE::m_title, VCS_SOLVE::m_tolmaj, VCS_SOLVE::m_tolmaj2, VCS_SOLVE::m_tolmin, VCS_SOLVE::m_tolmin2, VCS_SOLVE::m_totalVol, VCS_PROB::m_VCS_UnitsFormat, VCS_SOLVE::m_VCS_UnitsFormat, VCS_SOLVE::m_VolPhaseList, VCS_SOLVE::m_wtSpecies, ckr::min(), VCS_PROB::ne, VCS_PROB::NPhase, VCS_SOLVE::NPHASE0, VCS_PROB::nspecies, vcs_VolPhase::nSpecies(), VCS_SOLVE::NSPECIES0, Cantera::OneAtm, vcs_VolPhase::p_activityConvention, VCS_PROB::PhaseID, vcs_VolPhase::PhaseName, plogf, VCS_PROB::PresPA, vcs_VolPhase::speciesProperty(), VCS_PROB::SpeciesThermo, VCS_PROB::SpeciesUnknownType, vcs_VolPhase::spGlobalIndexVCS(), VCS_PROB::SpName, VCS_PROB::T, VCS_PROB::tolmaj, VCS_PROB::tolmin, vcs_VolPhase::totalMolesInert(), VCS_SOLVE::TPhInertMoles, VCS_DATA_PTR, VCS_PROB::vcs_debug_print_lvl, VCS_ELEM_TYPE_ABSPOS, VCS_ELEM_TYPE_CHARGENEUTRALITY, VCS_ELEM_TYPE_LATTICERATIO, VCS_SPECIES_MAJOR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SUCCESS, VCS_PROB::Vol, VCS_PROB::VolPM, VCS_PROB::VPhaseList, VCS_PROB::w, and VCS_PROB::WtSpecies.
Referenced by VCS_SOLVE::vcs().
int vcs_prob_specify | ( | const VCS_PROB * | pub | ) |
Specify the problem to be solved using VCS_PROB, incrementally.
Use the contents of the VCS_PROB to specify the contents of the private data, VCS_SOLVE.
It's assumed we are solving the same problem.
pub | Pointer to VCS_PROB that will be used to initialize the current equilibrium problem |
Definition at line 855 of file vcs_solve.cpp.
References vcs_VolPhase::electricPotential(), VCS_PROB::gai, VCS_PROB::iest, VCS_SOLVE::m_doEstimateEquil, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementMapIndex, vcs_VolPhase::m_eqnState, VCS_SOLVE::m_feSpecies_old, vcs_VolPhase::m_gasPhase, VCS_PROB::m_gibbsSpecies, VCS_SOLVE::m_molNumSpecies_new, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_pressurePA, vcs_VolPhase::m_singleSpecies, VCS_SOLVE::m_speciesMapIndex, VCS_SOLVE::m_temperature, VCS_SOLVE::m_title, VCS_SOLVE::m_tolmaj, VCS_SOLVE::m_tolmaj2, VCS_SOLVE::m_tolmin, VCS_SOLVE::m_tolmin2, VCS_SOLVE::m_totalVol, VCS_PROB::m_VCS_UnitsFormat, VCS_SOLVE::m_VCS_UnitsFormat, VCS_SOLVE::m_VolPhaseList, VCS_PROB::mf, vcs_VolPhase::nSpecies(), vcs_VolPhase::PhaseName, plogf, VCS_PROB::PresPA, vcs_VolPhase::setElectricPotential(), vcs_VolPhase::setExistence(), vcs_VolPhase::setTotalMolesInert(), VCS_PROB::T, VCS_PROB::tolmaj, VCS_PROB::tolmin, vcs_VolPhase::totalMolesInert(), VCS_SOLVE::TPhInertMoles, VCS_SOLVE::vcs_SSPhase(), VCS_SUCCESS, VCS_SOLVE::vcs_tmoles(), VCS_PROB::Vol, vcs_VolPhase::VP_ID_, VCS_PROB::VPhaseList, and VCS_PROB::w.
Referenced by VCS_SOLVE::vcs().
|
private |
Zero out the concentration of a species.
Zero out the concentration of a species. Make sure to conserve elements and keep track of the total moles in all phases. w[] m_tPhaseMoles_old[]
kspec | Species index |
Definition at line 2249 of file vcs_solve_TP.cpp.
References plogendl, plogf, and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
|
private |
Change a single species from active to inactive status.
Rearrange data when species is added or removed. The Lth species is moved to the back of the species vector. The back of the species vector is indicated by the value of MR, the current number of active species in the mechanism.
kspec | Species Index |
Definition at line 2289 of file vcs_solve_TP.cpp.
References vcs_VolPhase::exists(), plogendl, plogf, vcs_VolPhase::setMolesFromVCSCheck(), VCS_DATA_PTR, VCS_PHASE_EXIST_ALWAYS, VCS_SPECIES_DELETED, VCS_SPECIES_MAJOR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_STATECALC_OLD.
|
private |
This routine handles the bookkeepking involved with the deletion of multiphase phases from the problem.
When they are deleted, all of their species become active species, even though their mole numbers are set to zero. The routine does not make the decision to eliminate multiphases.
Note, species in phases with zero mole numbers are still considered active. Whether the phase pops back into existence or not is checked as part of the main iteration loop.
iph | Phase to be deleted |
Definition at line 2465 of file vcs_solve_TP.cpp.
References vcs_VolPhase::PhaseName, plogf, vcs_VolPhase::setTotalMoles(), VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_SPECIES_ZEROEDMS.
|
private |
Change the concentration of a species by delta moles.
Make sure to conserve elements and keep track of the total kmoles in all phases.
kspec | The species index pointer to the delta for the species. This may change during the calculation |
Definition at line 2171 of file vcs_solve_TP.cpp.
References ckr::min(), plogendl, plogf, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_STATECALC_OLD.
|
private |
Provide an estimate for the deleted species in phases that are not zeroed out.
Try to add back in all deleted species. An estimate of the kmol numbers are obtained and the species is added back into the equation system, into the old state vector.
This routine is called at the end of the calculation, just before returning to the user.
Definition at line 2783 of file vcs_solve_TP.cpp.
References vcs_VolPhase::m_singleSpecies, ckr::min(), plogendl, plogf, vcs_VolPhase::sendToVCS_ActCoeff(), VCS_DATA_PTR, VCS_DELETE_MINORSPECIES_CUTOFF, VCS_STATECALC_NEW, and VCS_STATECALC_OLD.
|
private |
Recheck deleted species in multispecies phases.
We are checking the equation:
sum_u = sum_j_comp [ sigma_i_j * u_j ] = u_i_O + log((AC_i * W_i)/m_tPhaseMoles_old)
by first evaluating:
DG_i_O = u_i_O - sum_u.
Then, if TL is zero, the phase pops into existence if DG_i_O < 0. Also, if the phase exists, then we check to see if the species can have a mole number larger than VCS_DELETE_SPECIES_CUTOFF (default value = 1.0E-32).
Definition at line 2649 of file vcs_solve_TP.cpp.
References plogf, VCS_DATA_PTR, VCS_RELDELETE_SPECIES_CUTOFF, and VCS_STATECALC_NEW.
|
private |
Recheck deletion condition for multispecies phases.
We assume here that DG_i_0 has been calculated for deleted species correctly
m_feSpecies(I) = m_SSfeSpecies(I)
sum_u = sum_j_comp [ sigma_i_j * u_j ] = u_i_O + log((AC_i * W_i)/m_tPhaseMoles_old)
DG_i_0 = m_feSpecies(I) - sum_m{ a_i_m DG_m }
by first evaluating:
DG_i_O = u_i_O - sum_u.
Then, the phase pops into existence iff
phaseDG = 1.0 - sum_i{exp(-DG_i_O)} < 0.0
This formula works for both single species phases and for multispecies phases. It's an overkill for single species phases.
iphase | Phase index number |
NOTE: this routine is currently not used in the code, and contains some basic changes that are incompatible.
assumptions: 1) Vphase Existence is up to date 2) Vphase->IndSpecies is up to date 3) m_deltaGRxn_old[irxn] is up to date
Definition at line 2737 of file vcs_solve_TP.cpp.
References vcs_VolPhase::exists(), vcs_VolPhase::m_singleSpecies, vcs_VolPhase::nSpecies(), vcs_VolPhase::spGlobalIndexVCS(), VCS_PHASE_EXIST_NO, and VCS_PHASE_EXIST_ZEROEDPHASE.
|
private |
Minor species alternative calculation.
This is based upon the following approximation: The mole fraction changes due to these reactions don't affect the mole numbers of the component species. Therefore the following approximation is valid for a small component of an ideal phase:
0 = m_deltaGRxn_old(I) + log(molNum_new(I)/molNum_old(I))
m_deltaGRxn_old contains the contribution from
m_feSpecies_old(I) = m_SSfeSpecies(I) + log(ActCoeff[i] * molNum_old(I) / m_tPhaseMoles_old(iph)) Thus,
molNum_new(I)= molNum_old(I) * EXP(-m_deltaGRxn_old(I))
Most of this section is mainly restricting the update to reasonable values. We restrict the update a factor of 1.0E10 up and 1.0E-10 down because we run into trouble with the addition operator due to roundoff if we go larger than ~1.0E15. Roundoff will then sometimes produce zero mole fractions.
Note: This routine was generalized to incorporate nonideal phases and phases on the molality basis
kspec | The current species and corresponding formation reaction number. |
irxn | The current species and corresponding formation reaction number. |
do_delete,: | BOOLEAN which if true on return, then we branch to the section that deletes a species from the current set of active species. |
Definition at line 2035 of file vcs_solve_TP.cpp.
References VCS_DELETE_MINORSPECIES_CUTOFF, and VCS_SPECIES_TYPE_INTERFACIALVOLTAGE.
|
private |
This routine optimizes the minimization of the total gibbs free energy by making sure the slope of the following functional stays negative:
The slope of the following functional is equivalent to the slope of the total Gibbs free energy of the system:
d_Gibbs/ds = sum_k( m_deltaGRxn * m_deltaMolNumSpecies[k] )
along the current direction m_deltaMolNumSpecies[], by choosing a value, al: (0<al<1) such that the a parabola approximation to Gibbs(al) fit to the end points al = 0 and al = 1 is minimizied. s1 = slope of Gibbs function at al = 0, which is the previous solution = d(Gibbs)/d(al). s2 = slope of Gibbs function at al = 1, which is the current solution = d(Gibbs)/d(al). Only if there has been an inflection point (i.e., s1 < 0 and s2 > 0), does this code section kick in. It finds the point on the parabola where the slope is equal to zero.
Definition at line 2917 of file vcs_solve_TP.cpp.
References plogendl, plogf, VCS_DATA_PTR, VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, and VCS_STATECALC_NEW.
|
private |
Switch rows and columns of a sqare matrix.
Switches the row and column of a matrix. So that after
J[k1][j] = J_old[k2][j] and J[j][k1] = J_old[j][k2] J[k2][j] = J_old[k1][j] and J[j][k2] = J_old[j][k1]
Jac | Double pointer to the jacobiam |
k1 | first row/column value to be switched |
k2 | second row/column value to be switched |
Definition at line 4825 of file vcs_solve_TP.cpp.
|
private |
Calculate the norm of a deltaGibbs free energy vector.
Positive DG for species which don't exist are ignored.
dg | Vector of local delta G's. |
Definition at line 4574 of file vcs_solve_TP.cpp.
References VCS_SPECIES_MAJOR, VCS_SPECIES_MINOR, and VCS_SPECIES_ZEROEDMS.
|
private |
Estimate equilibrium compositions.
Estimates equilibrium compositions. Algorithm covered in a section of Smith and Missen's Book.
Linear programming module is based on using dbolm.
aw | aw[i[ Mole fraction work space (ne in length) |
sa | sa[j] = Gram-Schmidt orthog work space (ne in length) |
sm | sm[i+j*ne] = QR matrix work space (ne*ne in length) |
ss | ss[j] = Gram-Schmidt orthog work space (ne in length) |
test | This is a small negative number. |
Definition at line 39 of file vcs_inest.cpp.
References VCS_SOLVE::m_debug_print_lvl, VCS_SOLVE::m_deltaGRxn_new, VCS_SOLVE::m_deltaMolNumPhase, VCS_SOLVE::m_deltaMolNumSpecies, VCS_SOLVE::m_deltaPhaseMoles, VCS_SOLVE::m_elemAbundancesGoal, VCS_SOLVE::m_elementActive, VCS_SOLVE::m_elementName, VCS_SOLVE::m_feSpecies_new, VCS_SOLVE::m_feSpecies_old, VCS_SOLVE::m_formulaMatrix, VCS_SOLVE::m_indexRxnToSpecies, VCS_SOLVE::m_molNumSpecies_new, VCS_SOLVE::m_molNumSpecies_old, VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numRxnTot, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseID, VCS_SOLVE::m_speciesName, VCS_SOLVE::m_speciesUnknownType, VCS_SOLVE::m_SSfeSpecies, VCS_SOLVE::m_SSPhase, VCS_SOLVE::m_stoichCoeffRxnMatrix, VCS_SOLVE::m_TmpPhase, VCS_SOLVE::m_TmpPhase2, VCS_SOLVE::m_tPhaseMoles_new, VCS_SOLVE::m_tPhaseMoles_old, VCS_SOLVE::m_VolPhaseList, plogendl, plogf, VCS_SOLVE::TPhInertMoles, VCS_SOLVE::vcs_basopt(), VCS_DATA_PTR, VCS_SOLVE::vcs_deltag(), VCS_SOLVE::vcs_dfe(), VCS_SPECIES_TYPE_INTERFACIALVOLTAGE, VCS_SPECIES_TYPE_MOLNUM, VCS_STATECALC_NEW, VCS_STATECALC_OLD, and VCS_SOLVE::vcs_tmoles().
Referenced by VCS_SOLVE::vcs_inest_TP().
|
private |
Calculate the status of single species phases.
Definition at line 27 of file vcs_prep.cpp.
References VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_phaseID, vcs_VolPhase::m_singleSpecies, VCS_SOLVE::m_SSPhase, VCS_SOLVE::m_VolPhaseList, vcs_VolPhase::setExistence(), and VCS_SOLVE::TPhInertMoles.
Referenced by VCS_SOLVE::vcs_prep_oneTime(), and VCS_SOLVE::vcs_prob_specify().
|
private |
This function recalculates the deltaG for reaction, irxn.
This function recalculates the deltaG for reaction irxn, given the mole numbers in molNum. It uses the temporary space mu_i, to hold the recalculated chemical potentials. It only recalculates the chemical potentials for species in phases which participate in the irxn reaction.
irxn | Reaction number |
molNum | Current mole numbers of species to be used as input to the calculation (units = kmol) (length = totalNuMSpecies) |
ac | output Activity coefficients (length = totalNumSpecies) Note this is only partially formed. Only species in phases that participate in the reaction will be updated |
mu_i | dimensionless chemical potentials (length - totalNumSpecies Note this is only partially formed. Only species in phases that participate in the reaction will be updated |
This function recalculates the deltaG for reaction irxn, given the mole numbers in molNum. It uses the temporary space mu_i, to hold the recalculated chemical potentials. It only recalculates the chemical potentials for species in phases which participate in the irxn reaction. This function is used by the vcs_line_search algorithm() and should not be used widely due to the unknown state it leaves the system.
irxn | Reaction number |
molNum | Current mole numbers of species to be used as input to the calculation (units = kmol) (length = totalNuMSpecies) |
ac | output Activity coefficients (length = totalNumSpecies) Note this is only partially formed. Only species in phases that participate in the reaction will be updated |
mu_i | dimensionless chemical potentials (length - totalNumSpecies Note this is only partially formed. Only species in phases that participate in the reaction will be updated |
Note, this is a dangerous routine that leaves the underlying objects in an unknown state.
Definition at line 781 of file vcs_rxnadj.cpp.
References VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_phaseParticipation, VCS_SOLVE::m_stoichCoeffRxnMatrix, and VCS_SOLVE::vcs_chemPotPhase().
|
private |
Delete memory that isn't just resizeable STL containers.
This gets called by the destructor or by InitSizes().
Definition at line 256 of file vcs_solve.cpp.
References VCS_SOLVE::m_numComponents, VCS_SOLVE::m_numElemConstraints, VCS_SOLVE::m_numPhases, VCS_SOLVE::m_numSpeciesTot, VCS_SOLVE::m_speciesThermoList, VCS_SOLVE::m_VCount, VCS_SOLVE::m_VolPhaseList, VCS_SOLVE::NPHASE0, and VCS_SOLVE::NSPECIES0.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::~VCS_SOLVE().
|
private |
Initialize the internal counters.
Initialize the internal counters containing the subroutine call values and times spent in the subroutines.
ifunc = 0 Initialize only those counters appropriate for the top of vcs_solve_TP(). = 1 Initialize all counters.
Definition at line 1082 of file vcs_solve.cpp.
References VCS_COUNTERS::Basis_Opts, VCS_COUNTERS::Its, VCS_SOLVE::m_VCount, VCS_COUNTERS::T_Basis_Opts, VCS_COUNTERS::T_Calls_Inest, VCS_COUNTERS::T_Calls_vcs_TP, VCS_COUNTERS::T_Its, VCS_COUNTERS::T_Time_basopt, VCS_COUNTERS::T_Time_inest, VCS_COUNTERS::T_Time_vcs, VCS_COUNTERS::T_Time_vcs_TP, VCS_COUNTERS::Time_basopt, and VCS_COUNTERS::Time_vcs_TP.
Referenced by VCS_SOLVE::vcs_initSizes().
|
private |
Create a report on the plog file containing timing and its information.
timing_print_lvl | If 0, just report the iteration count. If larger than zero, report the timing information |
Definition at line 417 of file vcs_report.cpp.
References VCS_SOLVE::m_VCount, plogf, VCS_COUNTERS::T_Basis_Opts, VCS_COUNTERS::T_Calls_Inest, VCS_COUNTERS::T_Calls_vcs_TP, VCS_COUNTERS::T_Its, VCS_COUNTERS::T_Time_basopt, VCS_COUNTERS::T_Time_inest, VCS_COUNTERS::T_Time_vcs, and VCS_COUNTERS::T_Time_vcs_TP.
Referenced by VCS_SOLVE::vcs().
|
private |
Update all underlying vcs_VolPhase objects.
Update the mole numbers and the phase voltages of all phases in the vcs problem
stateCalc | Location of the update (either VCS_STATECALC_NEW or VCS_STATECALC_OLD). |
Definition at line 5637 of file vcs_solve_TP.cpp.
References vcs_VolPhase::updateFromVCS_MoleNumbers().
size_t NSPECIES0 |
value of the number of species used to malloc data structures
Definition at line 1453 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prob_specifyFully().
size_t NPHASE0 |
value of the number of phases used to malloc data structures
Definition at line 1456 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prob_specifyFully().
size_t m_numSpeciesTot |
Total number of species in the problems.
Definition at line 1459 of file vcs_solve.h.
Referenced by vcs_MultiPhaseEquil::getStoichVector(), VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_elab(), VCS_SOLVE::vcs_fePrep_TP(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_rearrange(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_RxnStepSizes(), VCS_SOLVE::vcs_SSPhase(), and VCS_SOLVE::vcs_switch_elem_pos().
size_t m_numElemConstraints |
Number of element constraints in the problem.
This is typically equal to the number of elements in the problem
Definition at line 1465 of file vcs_solve.h.
Referenced by vcs_MultiPhaseEquil::numElemConstraints(), VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_elab(), VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_switch_elem_pos().
size_t m_numComponents |
Number of components calculated for the problem.
Definition at line 1468 of file vcs_solve.h.
Referenced by VCS_SOLVE::deltaG_Recalc_Rxn(), vcs_MultiPhaseEquil::numComponents(), VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_Hessian_actCoeff_diag(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
size_t m_numRxnTot |
Total number of non-component species in the problem.
Definition at line 1471 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_report().
size_t m_numSpeciesRdc |
Current number of species in the problems.
Species can be deleted if they aren't stable under the current conditions
Definition at line 1478 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_report().
size_t m_numRxnRdc |
Current number of non-component species in the problem.
Species can be deleted if they aren't stable under the current conditions
Definition at line 1485 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
size_t m_numRxnMinorZeroed |
Number of active species which are currently either treated as minor species.
Definition at line 1489 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_rxn_adj_cg().
size_t m_numPhases |
Number of Phases in the problem.
Definition at line 1492 of file vcs_solve.h.
Referenced by VCS_SOLVE::deltaG_Recalc_Rxn(), VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), VCS_SOLVE::vcs_RxnStepSizes(), VCS_SOLVE::vcs_SSPhase(), VCS_SOLVE::vcs_switch_elem_pos(), and VCS_SOLVE::vcs_VolTotal().
DoubleStarStar m_formulaMatrix |
Formula matrix for the problem.
FormulaMatrix[j][kspec] = Number of elements, j, in the kspec species
Both element and species indices are swapped.
Definition at line 1500 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elab(), VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_switch_elem_pos().
DoubleStarStar m_stoichCoeffRxnMatrix |
Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form.
This is the stoichiometric coefficient matrix for the reaction which forms species kspec from the component species. A stoichiometric coefficient of one is assumed for the species kspec in this mechanism.
NOTE: kspec = irxn + m_numComponents
m_stoichCoeffRxnMatrix[irxn][j] : j refers to the component number, and irxn refers to the irxn_th non-component species. The stoichiometric coefficients multilplied by the Formula coefficients of the component species add up to the negative value of the number of elements in the species kspec.
length = [nspecies0][nelements0]
Definition at line 1518 of file vcs_solve.h.
Referenced by VCS_SOLVE::deltaG_Recalc_Rxn(), vcs_MultiPhaseEquil::getStoichVector(), VCS_SOLVE::vcs_Hessian_actCoeff_diag(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<double> m_scSize |
Absolute size of the stoichiometric coefficients.
scSize[irxn] = abs(Size) of the stoichiometric coefficients. These are used to determine whether a given species should be handled by the alt_min treatment or should be handled as a major species.
Definition at line 1528 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes().
std::vector<double> m_spSize |
total size of the species
This is used as a multiplier to the mole number in figuring out which species should be components.
Definition at line 1535 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prep_oneTime().
std::vector<double> m_SSfeSpecies |
Standard state chemical potentials for species K at the current temperature and pressure.
The first NC entries are for components. The following NR entries are for the current non-component species in the mechanism.
Definition at line 1543 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_fePrep_TP(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
std::vector<double> m_feSpecies_old |
Free energy vector from the start of the current iteration.
The free energies are saved at the start of the current iteration. Length = number of species
Definition at line 1550 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_fePrep_TP(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
std::vector<double> m_feSpecies_new |
Dimensionless new free energy for all the species in the mechanism at the new tentatite T, P, and mole numbers.
The first NC entries are for components. The following NR entries are for the current non-component species in the mechanism. Length = number of species
Definition at line 1559 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_fePrep_TP(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prep().
int m_doEstimateEquil |
Setting for whether to do an initial estimate.
Initial estimate: 0 Do not estimate the solution at all. Use the supplied mole numbers as is. 1 Only do an estimate if the element abundances aren't satisfied. -1 Force an estimate of the soln. Throw out the input mole numbers.
Definition at line 1570 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_TP().
std::vector<double> m_molNumSpecies_old |
Total moles of the species.
Total number of moles of the kth species. Length = Total number of species = m
Definition at line 1577 of file vcs_solve.h.
Referenced by vcs_VolPhase::setMolesFromVCS(), VCS_SOLVE::vcs_elab(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<int> m_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 1593 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elab(), VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_RxnStepSizes().
DoubleStarStar m_deltaMolNumPhase |
Change in the number of moles of phase, iphase, due to the noncomponent formation reaction, irxn, for species, k:
m_deltaMolNumPhase[irxn][iphase] = k = nc + irxn
Definition at line 1600 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
IntStarStar m_phaseParticipation |
This is 1 if the phase, iphase, participates in the formation reaction irxn, and zero otherwise.
PhaseParticipation[irxn][iphase]
Definition at line 1604 of file vcs_solve.h.
Referenced by VCS_SOLVE::deltaG_Recalc_Rxn(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prep().
std::vector<double> m_phasePhi |
electric potential of the iph phase
Definition at line 1607 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_report().
std::vector<double> m_molNumSpecies_new |
Tentative value of the mole number vector.
It's also used to store the mole fraction vector.
Definition at line 1612 of file vcs_solve.h.
Referenced by vcs_VolPhase::setMolesFromVCS(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_report().
std::vector<double> m_deltaGRxn_new |
Delta G(irxn) for the noncomponent species in the mechanism.
Computed by the subroutine deltaG. m_deltaGRxn is the free energy change for the reaction which forms species K from the component species. This vector has length equal to the number of noncomponent species in the mechanism. It starts with the first current noncomponent species in the mechanism.
Definition at line 1622 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<double> m_deltaGRxn_old |
Last deltag[irxn] from the previous step.
Definition at line 1625 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), and VCS_SOLVE::vcs_redim_TP().
std::vector<double> m_deltaGRxn_Deficient |
Last deltag[irxn] from the previous step with additions for possible births of zeroed phases.
Definition at line 1629 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes().
std::vector<double> m_deltaGRxn_tmp |
Temporary vector of Rxn DeltaG's.
This is used from time to time, for printing purposes
Definition at line 1635 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes().
std::vector<double> m_deltaMolNumSpecies |
Reaction Adjustments for each species during the current step.
delta Moles for each species during the current step. Length = number of species
Definition at line 1642 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<double> m_elemAbundances |
Element abundances vector.
Vector of moles of each element actually in the solution vector. Except for certain parts of the algorithm, this is a constant. Note other constraint conditions are added to this vector. This is input from the input file and is considered a constant from thereon. units = kmoles
Definition at line 1654 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elab(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_switch_elem_pos().
std::vector<double> m_elemAbundancesGoal |
Element abundances vector Goals.
Vector of moles of each element that are the goals of the simulation. This is a constant in the problem. Note other constraint conditions are added to this vector. This is input from the input file and is considered a constant from thereon. units = kmoles
Definition at line 1665 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_switch_elem_pos().
double m_totalMolNum |
Total number of kmoles in all phases.
This number includes the inerts. -> Don't use this except for scaling purposes
Definition at line 1673 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_RxnStepSizes().
std::vector<double> m_tPhaseMoles_old |
Total kmols of species in each phase.
This contains the total number of moles of species in each phase
Length = number of phases
Definition at line 1681 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<double> m_tPhaseMoles_new |
total kmols of species in each phase in the tentative soln vector
This contains the total number of moles of species in each phase in the tentative solution vector
Length = number of phases
Definition at line 1690 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prep().
|
mutable |
Temporary vector of length NPhase.
Definition at line 1693 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), and VCS_SOLVE::vcs_initSizes().
|
mutable |
Temporary vector of length NPhase.
Definition at line 1696 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), and VCS_SOLVE::vcs_initSizes().
std::vector<double> m_deltaPhaseMoles |
Change in the total moles in each phase.
Length number of phases.
Definition at line 1702 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prep().
double m_temperature |
Temperature (Kelvin)
Definition at line 1705 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_TP().
double m_pressurePA |
Pressure (units are determined by m_VCS_UnitsFormat.
Values units -1: atm 0: atm 1: atm 2: atm 3: Pa
Units being changed to Pa
Definition at line 1717 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_TP().
std::vector<double> TPhInertMoles |
Total kmoles of inert to add to each phase.
TPhInertMoles[iph] = Total kmoles of inert to add to each phase length = number of phases
Definition at line 1724 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_SSPhase().
double m_tolmaj |
Tolerance requirement for major species.
Definition at line 1727 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().
double m_tolmin |
Tolerance requirements for minor species.
Definition at line 1730 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().
double m_tolmaj2 |
Below this, major species aren't refined any more.
Definition at line 1733 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
double m_tolmin2 |
Below this, minor species aren't refined any more.
Definition at line 1736 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().
std::vector<size_t> m_speciesMapIndex |
Index vector that keeps track of the species vector rearrangement.
At the end of each run, the species vector and associated data gets put back in the original order.
Example
k = m_speciesMapIndex[kspec] kspec = current order in the vcs_solve object k = original order in the vcs_prob object and in the MultiPhase object
Definition at line 1750 of file vcs_solve.h.
Referenced by vcs_MultiPhaseEquil::component(), vcs_MultiPhaseEquil::getStoichVector(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), and VCS_SOLVE::vcs_rearrange().
std::vector<size_t> m_speciesLocalPhaseIndex |
Index that keeps track of the index of the species within the local phase.
This returns the local index of the species within the phase. Its argument is the global species index within the VCS problem.
k = m_speciesLocalPhaseIndex[kspec]
k varies between 0 and the nSpecies in the phase
Length = number of species
Definition at line 1764 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep_oneTime(), and VCS_SOLVE::vcs_prob_specifyFully().
std::vector<size_t> m_elementMapIndex |
Index vector that keeps track of the rearrangement of the elements.
At the end of each run, the element vector and associated data gets put back in the original order.
Example
e = m_elementMapIndex[eNum] eNum = current order in the vcs_solve object e = original order in the vcs_prob object and in the MultiPhase object
Definition at line 1778 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_switch_elem_pos().
std::vector<size_t> m_indexRxnToSpecies |
Mapping between the species index for noncomponent species and the full species index.
ir[irxn] = Mapping between the reaction index for noncomponent formation reaction of a species and the full species index.
Definition at line 1794 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_Hessian_actCoeff_diag(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<int> m_speciesStatus |
Major -Minor status vector for the species in the problem.
The index for this is species. The reaction that this is referring to is kspec = irxn + m_numComponents
kspec : 2 -> Component species VCS_SPECIES_COMPONENT -> deprecated, want to assign -2 to some component species. We can already determine whether the species is a component from its position in the species vector. 1 -> Major species VCS_SPECIES_MAJOR 0 -> Minor species VCS_SPECIES_MINOR -1 -> The species lies in a multicomponent phase that exists. Its concentration is currently very low, necessitating a different method of calculation.
VCS_SPECIES_ACTIVEBUTZERO -8 -> The species lies in a multicomponent phase which currently does exist. Its concentration is currently identically zero, though the phase exists. This is a permanent condition due to stoich constraints
Definition at line 1853 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<size_t> m_phaseID |
Mapping from the species number to the phase number.
Definition at line 1856 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_Hessian_actCoeff_diag(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), VCS_SOLVE::vcs_RxnStepSizes(), and VCS_SOLVE::vcs_SSPhase().
std::vector<char> m_SSPhase |
Boolean indicating whether a species belongs to a single-species phase.
Definition at line 1860 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_fePrep_TP(), VCS_SOLVE::vcs_Hessian_actCoeff_diag(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_rxn_adj_cg(), VCS_SOLVE::vcs_RxnStepSizes(), and VCS_SOLVE::vcs_SSPhase().
std::vector<std::string> m_speciesName |
Species string name for the kth species.
Species string name for the kth species
Definition at line 1866 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), and VCS_SOLVE::vcs_RxnStepSizes().
std::vector<std::string> m_elementName |
Vector of strings containing the element names.
ElName[j] = String containing element names
Definition at line 1872 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_switch_elem_pos().
std::vector<int> m_elType |
Type of the element constraint.
m_elType[j] = type of the element 0 VCS_ELEM_TYPE_ABSPOS Normal element that is positive or zero in all species. 1 VCS_ELEM_TPYE_ELECTRONCHARGE element dof that corresponds to the electronic charge DOF. 2 VCS_ELEM_TYPE_CHARGENEUTRALITY element dof that corresponds to a required charge neutrality constraint on the phase. The element abundance is always exactly zero. 3 VCS_ELEM_TYPE_OTHERCONSTRAINT Other constraint which may mean that a species has neg 0 or pos value of that constraint (other than charge)
Definition at line 1889 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_switch_elem_pos().
std::vector<int> m_elementActive |
Specifies whether an element constraint is active.
The default is true Length = nelements
Definition at line 1896 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_switch_elem_pos().
std::vector<vcs_VolPhase*> m_VolPhaseList |
Array of Phase Structures.
Length = number of phases
Definition at line 1902 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_GibbsPhase(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_redim_TP(), VCS_SOLVE::vcs_report(), VCS_SOLVE::vcs_rxn_adj_cg(), VCS_SOLVE::vcs_RxnStepSizes(), VCS_SOLVE::vcs_SSPhase(), VCS_SOLVE::vcs_switch_elem_pos(), and VCS_SOLVE::vcs_VolTotal().
std::string m_title |
String containing the title of the run.
Definition at line 1905 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().
char m_unitsState |
This specifies the current state of units for the Gibbs free energy properties in the program.
. The default is to have this unitless
Definition at line 1912 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
double m_totalMoleScale |
Multiplier for the mole numbers within the nondimensionless formulation.
All numbers within the main routine are on an absolute basis. This presents some problems wrt very large and very small mole numbers. We get around this by using a multiplier coming into and coming out of the equilibrium routines
Definition at line 1921 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
std::vector<int> m_actConventionSpecies |
specifies the activity convention of the phase containing the species
SpecActConvention[kspec] 0 = molar based 1 = molality based length = number of species
Definition at line 1930 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prob_specifyFully().
std::vector<int> m_phaseActConvention |
specifies the activity convention of the phase.
0 = molar based 1 = molality based length = number of phases
Definition at line 1938 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prob_specifyFully().
std::vector<double> m_lnMnaughtSpecies |
specifies the ln(Mnaught) used to calculate the chemical potentials
For molar based activity conventions this will be equal to 0.0 length = number of species
Definition at line 1946 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_report().
std::vector<double> m_actCoeffSpecies_new |
Molar-based Activity Coefficients for Species.
Length = number of species
Definition at line 1953 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes().
std::vector<double> m_actCoeffSpecies_old |
Molar-based Activity Coefficients for Species based on old mole numbers.
These activity coefficients are based on the m_molNumSpecies_old values Molar based activity coeffients. Length = number of species
Definition at line 1961 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_report().
DoubleStarStar m_dLnActCoeffdMolNum |
Change in activity coefficient with mole number.
length = [nspecies][nspecies]
(This is a temporary array that gets regenerated every time it's needed. It is not swapped wrt species
(unused atm)
Definition at line 1972 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_Hessian_actCoeff_diag(), and VCS_SOLVE::vcs_initSizes().
std::vector<double> m_wtSpecies |
Molecular weight of each species.
units = kg/kmol length = number of species
note: this is a candidate for removal. I don't think we use it.
Definition at line 1981 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prob_specifyFully().
std::vector<double> m_chargeSpecies |
Charge of each species.
Length = number of species
Definition at line 1987 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_report().
std::vector<VCS_SPECIES_THERMO*> m_speciesThermoList |
Vector of pointers to thermostructures which identify the model and parameters for evaluating the thermodynamic functions for that particular species.
SpeciesThermo[k] pointer to the thermo information for the kth species
Definition at line 1997 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_prob_specifyFully().
int m_useActCoeffJac |
Choice of Hessians.
If this is true, then we will use a better approximation to the Hessian based on Jacobian of the ln(ActCoeff) with respect to mole numbers
Definition at line 2005 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_RxnStepSizes().
double m_totalVol |
Total volume of all phases.
units are m^3
Definition at line 2011 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), and VCS_SOLVE::vcs_report().
std::vector<double> m_PMVolumeSpecies |
Partial molar volumes of the species.
units = mks (m^3/kmol) -determined by m_VCS_UnitsFormat Length = number of species
Definition at line 2018 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_prob_update(), and VCS_SOLVE::vcs_report().
double m_Faraday_dim |
dimensionless value of Faraday's constant
F / RT (1/volt)
Definition at line 2024 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().
VCS_COUNTERS* m_VCount |
Timing and iteration counters for the vcs object.
Definition at line 2027 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs(), VCS_SOLVE::vcs_counters_init(), VCS_SOLVE::vcs_delete_memory(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_prob_update(), VCS_SOLVE::vcs_report(), and VCS_SOLVE::vcs_TCounters_report().
int m_debug_print_lvl |
Debug printing lvl.
Levels correspond to the following guidlines
Levels of printing above 4 are only accessible when DEBUG_MODE is turned on
Definition at line 2044 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_elem_rearrange(), VCS_SOLVE::vcs_inest(), VCS_SOLVE::vcs_inest_TP(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prep_oneTime(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_RxnStepSizes().
int m_timing_print_lvl |
printing level of timing information
1 allowing printing of timing 0 do not allow printing of timing -> everything is printed as a NA.
Definition at line 2052 of file vcs_solve.h.
Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), VCS_SOLVE::vcs(), VCS_SOLVE::vcs_initSizes(), and VCS_SOLVE::vcs_report().
int m_VCS_UnitsFormat |
Units for the chemical potential data:
VCS_UnitsFormat = Units for the chemical potential data: -1: kcal/mol 0: MU/RT 1: kJ/mol 2: Kelvin 3: J / kmol and pressure data: -1: Pa 0: Pa 1: Pa 2: pa 3: Pa
Definition at line 2069 of file vcs_solve.h.
Referenced by VCS_SOLVE::vcs_initSizes(), VCS_SOLVE::vcs_nondim_TP(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), VCS_SOLVE::vcs_redim_TP(), and VCS_SOLVE::vcs_report().