37 class VCS_SPECIES_THERMO;
72 void vcs_initSizes(
const size_t nspecies0,
const size_t nelements,
const size_t nphase0);
109 int vcs(
VCS_PROB* vprob,
int ifunc,
int ipr,
int ip1,
int maxit);
136 int vcs_solve_TP(
int print_lvl,
int printDetails,
int maxit);
138 int vcs_PS(
VCS_PROB* vprob,
int iph,
int printLvl,
double& feStable);
204 int vcs_basopt(
const bool doJustComponents,
double aw[],
double sa[],
double sm[],
205 double ss[],
double test,
bool*
const usedZeroedSpecies);
218 size_t vcs_basisOptMax(
const double*
const molNum,
const size_t j,
const size_t n);
345 void vcs_chemPotPhase(
const int stateCalc,
const size_t iph,
const double*
const molNum,
346 double*
const ac,
double*
const mu_i,
347 const bool do_deleted =
false);
434 void vcs_dfe(
const int stateCalc,
const int ll,
const size_t lbot,
const size_t ltop);
538 void check_tmoles()
const;
570 void vcs_deltag(
const int l,
const bool doDeleted,
const int vcsState,
571 const bool alterZeroedPhases =
true);
573 void vcs_printDeltaG(
const int stateCalc);
594 const int stateCalc,
const bool alterZeroedPhases =
true);
610 void vcs_switch_pos(
const bool ifunc,
const size_t k1,
const size_t k2);
690 int vcs_TP(
int ipr,
int ip1,
int maxit,
double T,
double pres);
702 int vcs_evalSS_TP(
int ipr,
int ip1,
double Temp,
double pres);
728 double vcs_VolTotal(
const double tkelvin,
const double pres,
729 const double w[],
double volPM[]);
829 double*
const sm,
double*
const ss);
912 char*
const ANOTE=0);
1022 void vcs_elabPhase(
size_t iphase,
double*
const elemAbundPhase);
1100 const double*
const fe);
1197 int delta_species(
const size_t kspec,
double*
const delta_ptr);
1306 char* ANOTE=0)
const;
1336 double l2normdg(
double dg[])
const;
1344 void checkDelta1(
double*
const ds,
double*
const delTPhMoles,
size_t kspec);
1358 void vcs_inest(
double*
const aw,
double*
const sa,
double*
const sm,
1359 double*
const ss,
double test);
1389 const size_t irxn,
const double*
const molNum,
1390 double*
const ac,
double*
const mu_i);
1416 void vcs_setFlagsVolPhases(
const bool upToDate,
const int stateCalc);
1418 void vcs_setFlagsVolPhase(
const size_t iph,
const bool upToDate,
const int stateCalc);
1431 int solve_tp_component_calc(
bool& allMinorZeroedSpecies);
1432 void solve_tp_inner(
size_t& iti,
size_t& it1,
bool& uptodate_minors,
1433 bool& allMinorZeroedSpecies,
int& forceComponentCalc,
1434 int& stage,
bool printDetails,
char* ANOTE);
1435 void solve_tp_equilib_check(
bool& allMinorZeroedSpecies,
bool& uptodate_minors,
1436 bool& giveUpOnElemAbund,
int& solveFail,
1437 size_t& iti,
size_t& it1,
int maxit,
1438 int& stage,
bool& lec);
1439 void solve_tp_elem_abund_check(
size_t& iti,
int& stage,
bool& lec,
1440 bool& giveUpOnElemAbund,
1441 int& finalElemAbundAttempts,
1442 int& rangeErrorFound);
1445 std::vector<double> m_sm;
1446 std::vector<double> m_ss;
1447 std::vector<double> m_sa;
1448 std::vector<double> m_aw;
1449 std::vector<double> m_wx;
1483 int vcs_rank(
const double* awtmp,
size_t numSpecies,
const double* matrix,
size_t numElemConstraints,
1484 std::vector<size_t> &compRes, std::vector<size_t> &elemComp,
int*
const usedZeroedSpecies)
const;
1947 std::vector<std::vector<size_t> > phasePopProblemLists_;
2016 friend class vcs_phaseStabilitySolve;
size_t vcs_RxnStepSizes(int &forceComponentCalc, size_t &kSpecial)
Calculates formation reaction step sizes.
int vcs_zero_species(const size_t kspec)
Zero out the concentration of a species.
void vcs_inest(double *const aw, double *const sa, double *const sm, double *const ss, double test)
Estimate equilibrium compositions.
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...
std::vector< size_t > m_phaseID
Mapping from the species number to the phase number.
std::vector< double > m_TmpPhase2
Temporary vector of length NPhase.
double vcs_Hessian_actCoeff_diag(size_t irxn)
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficient...
double vcs_nondimMult_TP(int mu_units, double TKelvin) const
Returns the multiplier for the nondimensionalization of the equations.
double vcs_line_search(const size_t irxn, const double dx_orig, char *const ANOTE=0)
A line search algorithm is carried out on one reaction.
double vcs_minor_alt_calc(size_t kspec, size_t irxn, bool *do_delete, char *ANOTE=0) const
Minor species alternative calculation.
std::vector< int > m_elType
Type of the element constraint.
double vcs_Total_Gibbs(double *w, double *fe, double *tPhMoles)
Calculate the total dimensionless Gibbs free energy.
double vcs_nondim_Farad(int mu_units, double TKelvin) const
Returns the multiplier for electric charge terms.
double m_totalMolNum
Total number of kmoles in all phases.
double m_Faraday_dim
dimensionless value of Faraday's constant, F / RT (1/volt)
VCS_COUNTERS * m_VCount
Timing and iteration counters for the vcs object.
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.
std::vector< VCS_SPECIES_THERMO * > m_speciesThermoList
Vector of pointers to thermostructures which identify the model and parameters for evaluating the the...
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 coefficient...
std::vector< double > m_wtSpecies
Molecular weight of each species.
Array2D m_stoichCoeffRxnMatrix
Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form...
double vcs_birthGuess(const int kspec)
Birth guess returns the number of moles of a species that is coming back to life. ...
int m_useActCoeffJac
Choice of Hessians.
std::vector< double > m_feSpecies_new
Dimensionless new free energy for all the species in the mechanism at the new tentatite T...
int vcs_elcorr(double aa[], double x[])
int vcs_TP(int ipr, int ip1, int maxit, double T, double pres)
Solve an equilibrium problem at a particular fixed temperature and pressure.
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.
void vcs_initSizes(const size_t nspecies0, const size_t nelements, const size_t nphase0)
Initialize the sizes within the VCS_SOLVE object.
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...
void vcs_elabPhase(size_t iphase, double *const elemAbundPhase)
std::vector< vcs_VolPhase * > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
std::vector< double > m_phasePhi
electric potential of the iph phase
void vcs_nondim_TP()
Nondimensionalize the problem data.
double vcs_tmoles()
Calculates the total number of moles of species in all phases.
std::vector< double > m_lnMnaughtSpecies
specifies the ln(Mnaught) used to calculate the chemical potentials
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
std::vector< double > m_spSize
total size of the species
std::vector< size_t > m_elementMapIndex
Index vector that keeps track of the rearrangement of the elements.
bool vcs_wellPosed(VCS_PROB *vprob)
In this routine, we check for things that will cause the algorithm to fail.
int vcs_prob_update(VCS_PROB *pub)
Transfer the results of the equilibrium calculation back to VCS_PROB.
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.
double m_tolmin
Tolerance requirements for minor species.
void vcs_redim_TP()
Redimensionalize the problem data.
void vcs_printChemPotUnits(int unitsFormat) const
Print the string representing the Chemical potential units.
int delta_species(const size_t kspec, double *const delta_ptr)
Change the concentration of a species by delta moles.
int m_VCS_UnitsFormat
Units for the chemical potential data.
size_t m_numRxnRdc
Current number of non-component species in the problem.
bool vcs_globStepDamp()
This routine optimizes the minimization of the total Gibbs free energy by making sure the slope of th...
std::vector< double > m_chargeSpecies
Charge of each species. Length = number of species.
size_t m_numSpeciesRdc
Current number of species in the problems.
std::vector< int > m_phaseActConvention
specifies the activity convention of the phase.
int vcs_prep()
Prepare the object for solution.
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...
std::vector< double > m_molNumSpecies_old
Total moles of the species.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Header file for class Cantera::Array2D.
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.
std::vector< std::string > m_elementName
Vector of strings containing the element names.
double vcs_phaseStabilityTest(const size_t iph)
Main program to test whether a deleted phase should be brought back into existence.
std::string m_title
String containing the title of the run.
int vcs_report(int iconv)
Print out a report on the state of the equilibrium problem to standard output.
Defines and definitions within the vcs package.
int m_doEstimateEquil
Setting for whether to do an initial estimate.
int vcs_inest_TP()
Create an initial estimate of the solution to the thermodynamic equilibrium problem.
std::vector< size_t > m_speciesMapIndex
Index vector that keeps track of the species vector rearrangement.
Internal declarations for the VCSnonideal package.
double vcs_VolTotal(const double tkelvin, const double pres, const double w[], double volPM[])
Calculation of the total volume and the partial molar volumes.
size_t vcs_add_all_deleted()
Provide an estimate for the deleted species in phases that are not zeroed out.
std::vector< double > m_tPhaseMoles_new
total kmols of species in each phase in the tentative soln vector
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 p...
std::vector< double > m_elemAbundances
Element abundances vector.
std::vector< double > m_actCoeffSpecies_new
Molar-based Activity Coefficients for Species.
size_t m_numElemConstraints
Number of element constraints in the problem.
void vcs_TCounters_report(int timing_print_lvl=1)
Create a report on the plog file containing timing and its information.
std::vector< int > m_actConventionSpecies
specifies the activity convention of the phase containing the species
double m_tolmin2
Below this, minor species aren't refined any more.
size_t m_numSpeciesTot
Total number of species in the problems.
std::vector< int > m_speciesUnknownType
Specifies the species unknown type.
int vcs_recheck_deleted()
Recheck deleted species in multispecies phases.
double l2normdg(double dg[]) const
Calculate the norm of a deltaGibbs free energy vector.
std::vector< double > m_scSize
Absolute size of the stoichiometric coefficients.
bool recheck_deleted_phase(const int iphase)
Recheck deletion condition for multispecies phases.
int vcs_solve_phaseStability(const int iphase, int ifunc, double &funcval, int print_lvl)
Routine that independently determines whether a phase should be popped under the current conditions...
int vcs(VCS_PROB *vprob, int ifunc, int ipr, int ip1, int maxit)
Solve an equilibrium problem.
std::vector< double > m_tPhaseMoles_old
Total kmols of species in each phase.
std::vector< double > m_deltaPhaseMoles
Change in the total moles in each phase.
int vcs_species_type(const size_t kspec) const
Evaluate the species category for the indicated species.
int m_debug_print_lvl
Debug printing lvl.
int m_timing_print_lvl
printing level of timing information
int vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
size_t m_numComponents
Number of components calculated for the problem.
std::vector< double > m_molNumSpecies_new
Tentative value of the mole number vector.
std::vector< double > m_SSfeSpecies
Standard state chemical potentials for species K at the current temperature and pressure.
size_t vcs_popPhaseID(std::vector< size_t > &phasePopPhaseIDs)
Decision as to whether a phase pops back into existence.
std::vector< double > m_actCoeffSpecies_old
Molar-based Activity Coefficients for Species based on old mole numbers.
int vcs_rxn_adj_cg(void)
Calculates reaction adjustments using a full Hessian approximation.
size_t NPHASE0
value of the number of phases used to malloc data structures
int vcs_prep_oneTime(int printLvl)
This routine is mostly concerned with changing the private data to be consistent with what's needed f...
size_t m_numRxnMinorZeroed
Number of active species which are currently either treated as minor species.
int vcs_delete_species(const size_t kspec)
Change a single species from active to inactive status.
double m_totalVol
Total volume of all phases. Units are m^3.
double m_temperature
Temperature (Kelvin)
void vcs_reinsert_deleted(size_t kspec)
std::vector< char > m_SSPhase
Boolean indicating whether a species belongs to a single-species phase.
int vcs_rearrange()
Switch all species data back to the original order.
int vcs_phasePopDeterminePossibleList()
Determine the list of problems that need to be checked to see if there are any phases pops...
std::vector< std::string > m_speciesName
Species string name for the kth species.
std::vector< double > m_TmpPhase
Temporary vector of length NPhase.
Array2D m_deltaMolNumPhase
Change in the number of moles of phase, iphase, due to the noncomponent formation reaction...
Array2D m_formulaMatrix
Formula matrix for the problem.
std::vector< int > m_elementActive
Specifies whether an element constraint is active.
double m_pressurePA
Pressure (units are determined by m_VCS_UnitsFormat.
double m_tolmaj
Tolerance requirement for major species.
void vcs_elab()
Computes the current elemental abundances vector.
int vcs_setMolesLinProg()
Estimate the initial mole numbers by constrained linear programming.
bool vcs_popPhasePossible(const size_t iphasePop) const
Utility function that evaluates whether a phase can be popped into existence.
std::vector< int > m_speciesStatus
Major -Minor status vector for the species in the problem.
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.
std::vector< double > m_PMVolumeSpecies
Partial molar volumes of the species.
void vcs_SSPhase(void)
Calculate the status of single species phases.
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.
int vcs_prob_specify(const VCS_PROB *pub)
Specify the problem to be solved using VCS_PROB, incrementally.
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.
void prneav() const
Print out and check the elemental abundance vector.
void vcs_updateMolNumVolPhases(const int stateCalc)
Update all underlying vcs_VolPhase objects.
int vcs_popPhaseRxnStepSizes(const size_t iphasePop)
Calculates the deltas of the reactions due to phases popping into existence.
std::vector< double > m_deltaMolNumSpecies
Reaction Adjustments for each species during the current step.
std::vector< double > m_deltaGRxn_tmp
Temporary vector of Rxn DeltaG's.
Class to keep track of time and iterations.
int vcs_rank(const double *awtmp, size_t numSpecies, const double *matrix, size_t numElemConstraints, std::vector< size_t > &compRes, std::vector< size_t > &elemComp, int *const usedZeroedSpecies) const
Calculate the rank of a matrix and return the rows and columns that will generate an independent basi...
void vcs_delete_memory()
Delete memory that isn't just resizable STL containers.
Array2D m_phaseParticipation
This is 1 if the phase, iphase, participates in the formation reaction irxn, and zero otherwise...
size_t NSPECIES0
value of the number of species used to malloc data structures
char m_unitsState
This specifies the current state of units for the Gibbs free energy properties in the program...
std::vector< size_t > m_indexRxnToSpecies
Mapping between the species index for noncomponent species and the full species index.
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...
size_t m_numPhases
Number of Phases in the problem.
Interface class for the vcs thermo equilibrium solver package, which generally describes the problem ...
double m_totalMoleScale
Multiplier for the mole numbers within the nondimensionless formulation.
size_t m_numRxnTot
Total number of non-component species in the problem.
void vcs_fePrep_TP()
Initialize the chemical potential of single species phases.
double m_tolmaj2
Below this, major species aren't refined any more.
bool vcs_evaluate_speciesType()
This routine evaluates the species type for all species.
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.
std::vector< double > TPhInertMoles
Total kmoles of inert to add to each phase.
Array2D m_np_dLnActCoeffdMolNum
Change in the log of the activity coefficient with respect to the mole number multiplied by the phase...
bool vcs_delete_multiphase(const size_t iph)
This routine handles the bookkeeping involved with the deletion of multiphase phases from the problem...
std::vector< double > m_elemAbundancesGoal
Element abundances vector Goals.
std::vector< double > m_feSpecies_old
Free energy vector from the start of the current iteration.
int vcs_prob_specifyFully(const VCS_PROB *pub)
Fully specify the problem to be solved using VCS_PROB.
void vcs_counters_init(int ifunc)
Initialize the internal counters.
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_new
Delta G(irxn) for the noncomponent species in the mechanism.
void vcs_CalcLnActCoeffJac(const double *const moleSpeciesVCS)
Recalculate all of the activity coefficients in all of the phases based on input mole numbers...
This is the main structure used to hold the internal data used in vcs_solve_TP(), and to solve TP sys...
bool vcs_elabcheck(int ibound)
std::vector< size_t > m_speciesLocalPhaseIndex
Index that keeps track of the index of the species within the local phase.
std::vector< double > m_deltaGRxn_old
Last deltag[irxn] from the previous step.