Go to the documentation of this file.
25 for (
int j = 0; j < 82; j++) {
29 plogf(
" --- Subroutine vcs_RxnStepSizes called - Details:\n");
31 for (
int j = 0; j < 82; j++) {
35 plogf(
" --- Species KMoles Rxn_Adjustment DeltaG"
47 ANOTE =
"Normal Calc";
52 ANOTE =
"ZeroedPhase: Phase is artificially zeroed";
71 ANOTE = fmt::sprintf(
"MultSpec (%s): Species not born due to STOICH/PHASEPOP even though DG = %11.3E",
75 ANOTE = fmt::sprintf(
"MultSpec (%s): small species born again DG = %11.3E",
79 ANOTE = fmt::sprintf(
"MultSpec (%s):still dead, no phase pop, even though DG = %11.3E",
82 if (Vphase->
exists() > 0 && trphmoles > 0.0) {
84 ANOTE = fmt::sprintf(
"MultSpec (%s): birthed species because it was zero in a small existing phase with DG = %11.3E",
89 ANOTE = fmt::sprintf(
"MultSpec (%s): still dead DG = %11.3E",
100 ANOTE = fmt::sprintf(
"Skipped: superconverged DG = %11.3E",
m_deltaGRxn_new[irxn]);
103 plogf(
" %12.4E %12.4E %12.4E | %s\n",
113 ANOTE = fmt::sprintf(
"Skipped: IC = %3d and DG >0: %11.3E",
117 plogf(
" %12.4E %12.4E %12.4E | %s\n",
149 ANOTE = fmt::sprintf(
"Normal calc: diag adjusted from %g "
150 "to %g due to act coeff", s_old, s);
161 ANOTE = fmt::sprintf(
"Delta damped from %g "
166 ANOTE = fmt::sprintf(
"Delta damped from %g "
177 ANOTE = fmt::sprintf(
"Delta damped from %g "
225 if ((k == kspec) && (
m_SSPhase[kspec] != 1)) {
232 ANOTE = fmt::sprintf(
"Delta damped from %g to %g due to delete %s",
m_deltaMolNumSpecies[kspec],
237 plogf(
" %12.4E %12.4E %12.4E | %s\n",
245 for (
size_t j = 0; j <
m_nsp; j++) {
257 ANOTE = fmt::sprintf(
"Delete component SS phase %d named %s - SS phases only",
260 ANOTE = fmt::sprintf(
"Delete this SS phase %d - SS components only", iphDel);
264 plogf(
" %12.4E %12.4E %12.4E | %s\n",
267 plogf(
" --- vcs_RxnStepSizes Special section to set up to delete %s\n",
271 forceComponentCalc = 1;
284 plogf(
" %12.4E %12.4E %12.4E | %s\n",
299 double diag = hessianDiag_Ideal;
301 if (hessianDiag_Ideal <= 0.0) {
303 "We shouldn't be here");
305 if (hessActCoef >= 0.0) {
307 }
else if (fabs(hessActCoef) < 0.6666 * hessianDiag_Ideal) {
310 diag -= 0.6666 * hessianDiag_Ideal;
348 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
#define plogf
define this Cantera function to replace printf
doublereal * ptrColumn(size_t j)
Return a pointer to the top of column j, columns are contiguous in memory.
size_t m_nsp
Total number of species in the problems.
#define VCS_STATECALC_OLD
State Calculation based on the old or base mole numbers.
std::vector< std::unique_ptr< vcs_VolPhase > > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
std::vector< std::string > m_speciesName
Species string name for the kth species.
bool m_singleSpecies
If true, this phase consists of a single species.
size_t m_numPhases
Number of Phases in the problem.
size_t m_numComponents
Number of components calculated for the problem.
void setMolesFromVCS(const int stateCalc, const double *molesSpeciesVCS=0)
Set the moles within the phase.
bool isIdealSoln() const
Returns whether the phase is an ideal solution phase.
vector_fp m_molNumSpecies_old
Total moles of the species.
vector_fp m_deltaMolNumSpecies
Reaction Adjustments for each species during the current step.
Array2D m_stoichCoeffRxnMatrix
Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form.
#define VCS_SPECIES_MAJOR
Species is a major species.
void vcs_CalcLnActCoeffJac(const double *const moleSpeciesVCS)
Recalculate all of the activity coefficients in all of the phases based on input mole numbers.
int m_debug_print_lvl
Debug printing lvl.
size_t vcs_RxnStepSizes(int &forceComponentCalc, size_t &kSpecial)
Calculates formation reaction step sizes.
std::vector< size_t > m_phaseID
Mapping from the species number to the phase number.
vector_int m_speciesUnknownType
Specifies the species unknown type.
double m_totalMolNum
Total number of kmoles in all phases.
vector_fp m_tPhaseMoles_old
Total kmols of species in each phase.
vector_int m_speciesStatus
Major -Minor status vector for the species in the problem.
#define VCS_DELETE_PHASE_CUTOFF
Cutoff relative moles below which a phase is deleted from the equilibrium problem.
#define VCS_SPECIES_STOICHZERO
Species lies in a multicomponent phase that is active, but species concentration is zero due to stoic...
#define VCS_SPECIES_ZEROEDPHASE
Species lies in a multicomponent phase that is zeroed atm.
#define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE
Unknown refers to the voltage level of a phase.
std::vector< char > m_SSPhase
Boolean indicating whether a species belongs to a single-species phase.
double m_tolmaj2
Below this, major species aren't refined any more.
Array2D m_np_dLnActCoeffdMolNum
Change in the log of the activity coefficient with respect to the mole number multiplied by the phase...
int m_useActCoeffJac
Choice of Hessians.
Phase information and Phase calculations for vcs.
const char * vcs_speciesType_string(int speciesStatus, int length)
Returns a const char string representing the type of the species given by the first argument.
size_t m_numRxnRdc
Current number of non-component species in the problem.
double vcs_Hessian_actCoeff_diag(size_t irxn)
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficient...
Base class for exceptions thrown by Cantera classes.
const size_t npos
index returned by functions to indicate "no position"
int exists() const
int indicating whether the phase exists or not
vector_fp m_deltaGRxn_new
Delta G(irxn) for the noncomponent species in the mechanism.
std::vector< size_t > m_indexRxnToSpecies
Mapping between the species index for noncomponent species and the full species index.
#define VCS_SMALL_MULTIPHASE_SPECIES
Relative value of multiphase species mole number for a multiphase species which is small.
Namespace for the Cantera kernel.
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...
Array2D m_deltaMolNumPhase
Change in the number of moles of phase, iphase, due to the noncomponent formation reaction,...