19 double*
const sm,
double*
const ss)
25 plogf(
" --- Subroutine elem_rearrange() called to ");
26 plogf(
"check stoich. coefficient matrix\n");
27 plogf(
" --- and to rearrange the element ordering once\n");
33 double test = -1.0E10;
36 for (
size_t i = 0; i <
m_nelem; ++i) {
48 while (jr < ncomponents) {
57 for (
size_t ielem = jr; ielem <
m_nelem; ielem++) {
65 "Shouldn't be here. Algorithm misfired.");
82 for (
size_t j = 0; j < ncomponents; ++j) {
89 for (
size_t j = 0; j < jl; ++j) {
91 for (
size_t i = 0; i < ncomponents; ++i) {
92 ss[j] += sm[i + jr*ncomponents] * sm[i + j*ncomponents];
99 for (
size_t j = 0; j < jl; ++j) {
100 for (
size_t i = 0; i < ncomponents; ++i) {
101 sm[i + jr*ncomponents] -= ss[j] * sm[i + j*ncomponents];
109 for (
size_t ml = 0; ml < ncomponents; ++ml) {
110 sa[jr] += pow(sm[ml + jr*ncomponents], 2);
113 if (sa[jr] > 1.0e-6) {
120 plogf(
" --- %-2.2s(%9.2g) replaces %-2.2s(%9.2g) as element %3d\n",
125 std::swap(aw[jr], aw[k]);
140 "vcs_switch_elem_pos",
141 "inappropriate args: {} {}", ipos, jpos);
161 for (
size_t j = 0; j <
m_nsp; ++j) {
Base class for exceptions thrown by Cantera classes.
size_t m_numPhases
Number of Phases in the problem.
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...
vector_int m_elType
Type of the element constraint.
size_t m_nelem
Number of element constraints in the problem.
vector_fp m_elemAbundances
Element abundances vector.
int m_debug_print_lvl
Debug printing lvl.
vector_fp m_elemAbundancesGoal
Element abundances vector Goals.
Array2D m_formulaMatrix
Formula matrix for the problem.
size_t m_numComponents
Number of components calculated for the problem.
vector_int m_elementActive
Specifies whether an element constraint is active.
size_t m_nsp
Total number of species in the problems.
std::vector< std::unique_ptr< vcs_VolPhase > > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
std::vector< size_t > m_elementMapIndex
Index vector that keeps track of the rearrangement of the elements.
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< std::string > m_elementName
Vector of strings containing the element names.
Phase information and Phase calculations for vcs.
size_t elemGlobalIndex(const size_t e) const
Returns the global index of the local element index for the phase.
void setElemGlobalIndex(const size_t eLocal, const size_t eGlobal)
sets a local phase element to a global index value
size_t nElemConstraints() const
Returns the number of element constraints.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
Namespace for the Cantera kernel.
Contains declarations for string manipulation functions within Cantera.
Header for the object representing each phase within vcs.
#define plogf
define this Cantera function to replace printf
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...