36 for (
size_t i = 0; i < top; ++i) {
43 "Problem with charge neutrality condition");
52 bool multisign =
false;
88 elemAbundPhase[j] = 0.0;
103 plogf(
" --- vcsc_elcorr: Element abundances correction routine");
105 plogf(
" (m_numComponents != m_numElemConstraints)");
113 double l2before = 0.0;
115 l2before += x[i] * x[i];
122 bool changed =
false;
125 bool multisign =
false;
138 if (numNonZero < 2) {
149 int numCompNonZero = 0;
150 size_t compID =
npos;
160 if (numCompNonZero == 1) {
192 if (atomComp > 0.0) {
196 plogf(
" --- vcs_elcorr: Reduced species %s from %g to %g " 197 "due to %s max bounds constraint\n",
211 plogf(
" --- vcs_elcorr: Zeroed species %s and changed " 212 "status to %d due to max bounds constraint\n",
233 if (fabs(x[i]) > 1.0E-13) {
250 par = std::min(par, 100.0);
252 if (par < 1.0 && par > 0.0) {
295 double saveDir = 0.0;
296 bool goodSpec =
true;
299 if (fabs(dir) > 1.0E-10) {
380 bool useZeroed =
true;
420 double l2after = 0.0;
426 plogf(
" --- Elem_Abund: Correct Initial " 433 plogf(
" --- Diff_Norm: %20.12E %20.12E\n",
#define VCS_ELEM_TYPE_ELECTRONCHARGE
This refers to conservation of electrons.
std::vector< size_t > m_phaseID
Mapping from the species number to the phase number.
vector_int m_speciesUnknownType
Specifies the species unknown type.
vector_fp m_elemAbundances
Element abundances vector.
vector_fp m_molNumSpecies_old
Total moles of the species.
const size_t npos
index returned by functions to indicate "no position"
int vcs_elcorr(double aa[], double x[])
void vcs_elabPhase(size_t iphase, double *const elemAbundPhase)
double vcs_tmoles()
Calculates the total number of moles of species in all phases.
int solve(DenseMatrix &A, double *b, size_t nrhs, size_t ldb)
Solve Ax = b. Array b is overwritten on exit with x.
size_t m_numSpeciesRdc
Current number of species in the problems.
vector_int m_elementActive
Specifies whether an element constraint is active.
std::vector< std::string > m_elementName
Vector of strings containing the element names.
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...
#define VCS_SPECIES_ZEROEDSS
Species is a SS phase, that is currently zeroed out.
#define VCS_ELEM_TYPE_ABSPOS
Normal element constraint consisting of positive coefficients for the formula matrix.
#define VCS_DELETE_MINORSPECIES_CUTOFF
Cutoff relative mole number value, below which species are deleted from the equilibrium problem...
size_t m_numElemConstraints
Number of element constraints in the problem.
size_t m_numSpeciesTot
Total number of species in the problems.
#define VCS_ELEM_TYPE_CHARGENEUTRALITY
This refers to a charge neutrality of a single phase.
Base class for exceptions thrown by Cantera classes.
#define VCS_SPECIES_ACTIVEBUTZERO
Species lies in a multicomponent phase that is active, but species concentration is zero...
int m_debug_print_lvl
Debug printing lvl.
size_t m_numComponents
Number of components calculated for the problem.
vector_fp m_elemAbundancesGoal
Element abundances vector Goals.
void vcs_reinsert_deleted(size_t kspec)
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.
Array2D m_formulaMatrix
Formula matrix for the problem.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void vcs_elab()
Computes the current elemental abundances vector.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
vector_int m_speciesStatus
Major -Minor status vector for the species in the problem.
#define plogf
define this Cantera function to replace printf
#define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE
Unknown refers to the voltage level of a phase.
vector_int m_elType
Type of the element constraint.
Namespace for the Cantera kernel.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
bool vcs_elabcheck(int ibound)