Cantera  2.0
Public Member Functions | Public Attributes | List of all members
VCS_PROB Class Reference

Interface class for the vcs thermo equilibrium solver package, which generally describes the problem to be solved. More...

#include <vcs_prob.h>

Collaboration diagram for VCS_PROB:
[legend]

Public Member Functions

 VCS_PROB (size_t nsp, size_t nel, size_t nph)
 Constructor.
 
 ~VCS_PROB ()
 Destructor.
 
void resizePhase (size_t nPhase, int force)
 Resizes all of the phase lists within the structure.
 
void resizeSpecies (size_t nsp, int force)
 Resizes all of the species lists within the structure.
 
void resizeElements (size_t nel, int force)
 Resizes all of the element lists within the structure.
 
void set_gai ()
 Calculate the element abundance vector.
 
void prob_report (int print_lvl)
 Print out the problem specification in all generality as it currently exists in the VCS_PROB object.
 
void addPhaseElements (vcs_VolPhase *volPhase)
 Add elements to the local element list.
 
size_t addElement (const char *elNameNew, int elType, int elactive)
 This routine resizes the number of elements in the VCS_PROB object by adding a new element to the end of the element list.
 
size_t addOnePhaseSpecies (vcs_VolPhase *volPhase, size_t k, size_t kT)
 This routines adds entries for the formula matrix for one species.
 
void reportCSV (const std::string &reportFile)
 
void setDebugPrintLvl (int vcs_debug_print_lvl)
 Set the debug level.
 

Public Attributes

int prob_type
 Problem type. I.e., the identity of what is held constant.
 
size_t nspecies
 Total number of species in the problems.
 
size_t NSPECIES0
 Species number used to malloc data structures.
 
size_t ne
 Number of element constraints in the equilibrium problem.
 
size_t NE0
 Number of element constraints used to malloc data structures involving elements.
 
size_t NPhase
 Number of phases in the problem.
 
size_t NPHASE0
 Number of phases used to malloc data structures.
 
std::vector< double > m_gibbsSpecies
 Vector of chemical potentials of the species.
 
std::vector< double > w
 Total number of moles of the kth species.
 
std::vector< double > mf
 Mole fraction vector.
 
std::vector< double > gai
 Element abundances for jth element.
 
DoubleStarStar FormulaMatrix
 Formula Matrix for the problem.
 
std::vector< int > SpeciesUnknownType
 Specifies the species unknown type.
 
double T
 Temperature (Kelvin)
 
double PresPA
 Pressure.
 
double Vol
 Volume of the entire system.
 
std::vector< double > VolPM
 Partial Molar Volumes of species.
 
int m_VCS_UnitsFormat
 Units for the chemical potential data, pressure data, volume, and species amounts.
 
int iest
 Specification of the initial estimate method.
 
double tolmaj
 Tolerance requirement for major species.
 
double tolmin
 Tolerance requirement for minor species.
 
std::vector< size_t > PhaseID
 Mapping between the species and the phases.
 
std::vector< std::string > SpName
 Vector of strings containing the species names.
 
std::vector< std::string > ElName
 vector of strings containing the element names
 
std::vector< int > m_elType
 vector of Element types
 
std::vector< int > ElActive
 Specifies whether an element constraint is active.
 
std::vector< double > WtSpecies
 Molecular weight of species.
 
std::vector< double > Charge
 Charge of each species.
 
std::vector< vcs_VolPhase * > VPhaseList
 Array of phase structures.
 
std::string Title
 
std::vector< VCS_SPECIES_THERMO * > SpeciesThermo
 Vector of pointers to thermo structures which identify the model and parameters for evaluating the thermodynamic functions for that particular species.
 
int m_Iterations
 Number of iterations.
 
int m_NumBasisOptimizations
 Number of basis optimizations used.
 
int m_printLvl
 Print level for print routines.
 
int vcs_debug_print_lvl
 Debug print lvl.
 

Detailed Description

Interface class for the vcs thermo equilibrium solver package, which generally describes the problem to be solved.

HKM add: HaveEstimate -> 0 no estimate, or estimate that doesn't satisfy elem abundances 1 have an estimate that satisfies elem_abund. 2 Have an estimate that minimizes a subproblem and satisfies elem abund. solnFound -> True, soln to current problem found and included here False, soln has not been found.

Definition at line 38 of file vcs_prob.h.

Constructor & Destructor Documentation

VCS_PROB ( size_t  nsp,
size_t  nel,
size_t  nph 
)
~VCS_PROB ( )

Destructor.

Definition at line 114 of file vcs_prob.cpp.

References VCS_PROB::NPhase, VCS_PROB::nspecies, VCS_PROB::SpeciesThermo, and VCS_PROB::VPhaseList.

Member Function Documentation

void resizePhase ( size_t  nPhase,
int  force 
)

Resizes all of the phase lists within the structure.

Note, this doesn't change the number of phases in the problem. It will change NPHASE0 if nsp is greater than NPHASE0.

Parameters
nPhasesize to dimension all the phase lists to
forceIf true, this will dimension the size to be equal to nPhase even if nPhase is less than the current value of NPHASE0

Definition at line 135 of file vcs_prob.cpp.

References VCS_PROB::NPHASE0.

void resizeSpecies ( size_t  nsp,
int  force 
)

Resizes all of the species lists within the structure.

Note, this doesn't change the number of species in the problem. It will change NSPECIES0 if nsp is greater than NSPECIES0.

Parameters
nspsize to dimension all the species lists to
forceIf true, this will dimension the size to be equal to nsp even if nsp is less than the current value of NSPECIES0

Definition at line 151 of file vcs_prob.cpp.

References VCS_PROB::Charge, VCS_PROB::FormulaMatrix, VCS_PROB::m_gibbsSpecies, VCS_PROB::mf, VCS_PROB::NE0, VCS_PROB::nspecies, VCS_PROB::NSPECIES0, VCS_PROB::PhaseID, plogf, DoubleStarStar::resize(), VCS_PROB::SpeciesUnknownType, VCS_PROB::SpName, VCS_SPECIES_TYPE_MOLNUM, VCS_PROB::VolPM, VCS_PROB::w, and VCS_PROB::WtSpecies.

void resizeElements ( size_t  nel,
int  force 
)

Resizes all of the element lists within the structure.

Note, this doesn't change the number of element constraints in the problem. It will change NE0 if nel is greater than NE0.

Parameters
nelsize to dimension all the elements lists
forceIf true, this will dimension the size to be equal to nel even if nel is less than the current value of NEL0

Definition at line 183 of file vcs_prob.cpp.

References VCS_PROB::ElActive, VCS_PROB::ElName, VCS_PROB::FormulaMatrix, VCS_PROB::gai, VCS_PROB::m_elType, VCS_PROB::ne, VCS_PROB::NE0, VCS_PROB::NSPECIES0, DoubleStarStar::resize(), and VCS_ELEM_TYPE_ABSPOS.

Referenced by VCS_PROB::addElement().

void set_gai ( )

Calculate the element abundance vector.

Calculates the element abundance vectors from the mole numbers

Definition at line 203 of file vcs_prob.cpp.

References DoubleStarStar::baseDataAddr(), VCS_PROB::FormulaMatrix, VCS_PROB::gai, VCS_PROB::ne, VCS_PROB::nspecies, VCS_DATA_PTR, and VCS_PROB::w.

void prob_report ( int  print_lvl)
void addPhaseElements ( vcs_VolPhase volPhase)

Add elements to the local element list.

This routine sorts through the elements defined in the vcs_VolPhase object. It then adds the new elements to the VCS_PROB object, and creates a global map, which is stored in the vcs_VolPhase object. Id and matching of elements is done strictly via the element name, with case not mattering.

The routine also fills in the position of the element in the vcs_VolPhase object's ElGlobalIndex field.

Parameters
volPhaseObject containing the phase to be added. The elements in this phase are parsed for addition to the global element list

Definition at line 389 of file vcs_prob.cpp.

References VCS_PROB::addElement(), vcs_VolPhase::elementName(), vcs_VolPhase::elementType(), VCS_PROB::ElName, VCS_PROB::ne, vcs_VolPhase::nElemConstraints(), Cantera::npos, and vcs_VolPhase::setElemGlobalIndex().

size_t addElement ( const char *  elNameNew,
int  elType,
int  elactive 
)

This routine resizes the number of elements in the VCS_PROB object by adding a new element to the end of the element list.

The element name is added. Formula vector entries ang element abundances for the new element are set to zero.

Returns the index number of the new element.

Parameters
elNameNewNew name of the element
elTypeType of the element
elactiveboolean indicating whether the element is active
Returns
returns the index number of the new element

Definition at line 438 of file vcs_prob.cpp.

References VCS_PROB::ElActive, VCS_PROB::ElName, VCS_PROB::m_elType, VCS_PROB::ne, plogf, and VCS_PROB::resizeElements().

Referenced by VCS_PROB::addPhaseElements().

size_t addOnePhaseSpecies ( vcs_VolPhase volPhase,
size_t  k,
size_t  kT 
)

This routines adds entries for the formula matrix for one species.

This routines adds entries for the formula matrix for this object for one species

This object also fills in the index filed, IndSpecies, within the volPhase object.

Parameters
volPhaseobject containing the species
kSpecies number within the volPhase k
kTglobal Species number within this object

Definition at line 466 of file vcs_prob.cpp.

References vcs_VolPhase::elemGlobalIndex(), VCS_PROB::FormulaMatrix, vcs_VolPhase::getFormulaMatrix(), vcs_VolPhase::nElemConstraints(), Cantera::npos, VCS_PROB::nspecies, plogf, and vcs_VolPhase::setSpGlobalIndexVCS().

void setDebugPrintLvl ( int  vcs_debug_print_lvl)

Set the debug level.

Parameters
vcs_debug_print_lvlinput debug level

Definition at line 651 of file vcs_prob.cpp.

References VCS_PROB::vcs_debug_print_lvl.

Member Data Documentation

int prob_type

Problem type. I.e., the identity of what is held constant.

Currently, T and P are held constant, and this input is ignored

Definition at line 47 of file vcs_prob.h.

Referenced by VCS_PROB::prob_report().

size_t nspecies
size_t NSPECIES0

Species number used to malloc data structures.

Definition at line 53 of file vcs_prob.h.

Referenced by VCS_PROB::resizeElements(), VCS_PROB::resizeSpecies(), and VCS_PROB::VCS_PROB().

size_t ne
size_t NE0

Number of element constraints used to malloc data structures involving elements.

Definition at line 60 of file vcs_prob.h.

Referenced by VCS_PROB::resizeElements(), VCS_PROB::resizeSpecies(), and VCS_PROB::VCS_PROB().

size_t NPhase
size_t NPHASE0

Number of phases used to malloc data structures.

Definition at line 66 of file vcs_prob.h.

Referenced by VCS_PROB::resizePhase(), and VCS_PROB::VCS_PROB().

std::vector<double> m_gibbsSpecies

Vector of chemical potentials of the species.

This is a calculated output quantity length = number of species units = m_VCS_UnitsFormat;

Definition at line 74 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::reportCSV(), VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().

std::vector<double> w

Total number of moles of the kth species.

This is both an input and an output variable. On input, this is an estimate of the mole numbers. The actual element abundance vector contains the problem specification.

On output, this contains the solution for the total number of moles of the kth species.

units = m_VCS_UnitsFormat

Definition at line 87 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), VCS_PROB::set_gai(), VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_prob_update().

std::vector<double> mf

Mole fraction vector.

This is a calculated vector, calculated from w[] length number of species. -> Take out? -> No, useful for storage of a quantity often needed

Definition at line 95 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), vcs_MultiPhaseEquil::reportCSV(), VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_update().

std::vector<double> gai

Element abundances for jth element.

This is input from the input file and is considered a constant from thereon within the vcs_solve_TP(). units = m_VCS_UnitsFormat

Definition at line 103 of file vcs_prob.h.

Referenced by VCS_PROB::prob_report(), VCS_PROB::resizeElements(), VCS_PROB::set_gai(), VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_wellPosed().

DoubleStarStar FormulaMatrix

Formula Matrix for the problem.

FormulaMatrix[j][kspec] = Number of elements, j, in the kspec species

Definition at line 110 of file vcs_prob.h.

Referenced by VCS_PROB::addOnePhaseSpecies(), VCS_PROB::resizeElements(), VCS_PROB::resizeSpecies(), VCS_PROB::set_gai(), VCS_PROB::VCS_PROB(), and VCS_SOLVE::vcs_prob_specifyFully().

std::vector<int> 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 126 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_prob_update().

double T
double PresPA
double Vol

Volume of the entire system.

units given by m_VCS_UnitsFormat Note, this is an output variable atm

Definition at line 146 of file vcs_prob.h.

Referenced by VCS_SOLVE::vcs_prob_specify(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_prob_update().

std::vector<double> VolPM

Partial Molar Volumes of species.

This is a calculated vector, calculated from w[] length number of species. -> Take out? -> No, useful for storage of a quantity often needed

Definition at line 154 of file vcs_prob.h.

Referenced by VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_SOLVE::vcs_prob_update().

int m_VCS_UnitsFormat

Units for the chemical potential data, pressure data, volume, and species amounts.

All internally stored quantities will have these units. Also, printed quantities will display in these units.

                     Chem_Pot                 Pres      vol   moles

-1 VCS_UNITS_KCALMOL = kcal/mol atm cm**3 gmol 0 VCS_UNITS_UNITLESS = MU / RT -> no units atm cm**3 gmol 1 VCS_UNITS_KJMOL = kJ / mol atm cm**3 gmol 2 VCS_UNITS_KELVIN = KELVIN -> MU / R atm cm**3 gmol

3 VCS_UNITS_MKS = Joules / Kmol (Cantera) Pa m**3 kmol

see vcs_defs.h for more information

Definition at line 173 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::determine_PhaseStability(), vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().

int iest

Specification of the initial estimate method.

iest = Initial estimate: 0 user estimate 1 user estimate if satisifies elements -1 machine estimate

Definition at line 181 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().

double tolmaj

Tolerance requirement for major species.

Definition at line 184 of file vcs_prob.h.

Referenced by VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().

double tolmin

Tolerance requirement for minor species.

Definition at line 187 of file vcs_prob.h.

Referenced by VCS_SOLVE::vcs_prob_specify(), and VCS_SOLVE::vcs_prob_specifyFully().

std::vector<size_t> PhaseID

Mapping between the species and the phases.

Definition at line 190 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::equilibrate_TP(), VCS_PROB::prob_report(), VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), and VCS_SOLVE::vcs_prob_specifyFully().

std::vector<std::string> SpName
std::vector<std::string> ElName
std::vector<int> m_elType
std::vector<int> ElActive

Specifies whether an element constraint is active.

The default is true Length = nelements

Definition at line 206 of file vcs_prob.h.

Referenced by VCS_PROB::addElement(), VCS_PROB::prob_report(), VCS_PROB::resizeElements(), VCS_PROB::VCS_PROB(), and VCS_SOLVE::vcs_prob_specifyFully().

std::vector<double> WtSpecies

Molecular weight of species.

WtSpecies[k] = molecular weight of species in gm/mol

Definition at line 212 of file vcs_prob.h.

Referenced by VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), and VCS_SOLVE::vcs_prob_specifyFully().

std::vector<double> Charge

Charge of each species.

Definition at line 215 of file vcs_prob.h.

Referenced by VCS_PROB::resizeSpecies(), VCS_PROB::VCS_PROB(), and VCS_SOLVE::vcs_prob_specifyFully().

std::vector<vcs_VolPhase*> VPhaseList
std::vector<VCS_SPECIES_THERMO*> SpeciesThermo

Vector of pointers to thermo structures which identify the model and parameters for evaluating the thermodynamic functions for that particular species.

Definition at line 226 of file vcs_prob.h.

Referenced by VCS_PROB::VCS_PROB(), VCS_SOLVE::vcs_prob_specifyFully(), and VCS_PROB::~VCS_PROB().

int m_Iterations

Number of iterations.

This is an output variable

Definition at line 232 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::reportCSV(), and VCS_SOLVE::vcs_prob_update().

int m_NumBasisOptimizations

Number of basis optimizations used.

This is an output variable

Definition at line 238 of file vcs_prob.h.

Referenced by vcs_MultiPhaseEquil::reportCSV(), and VCS_SOLVE::vcs_prob_update().

int m_printLvl
int vcs_debug_print_lvl

Debug print lvl.

Definition at line 244 of file vcs_prob.h.

Referenced by VCS_PROB::setDebugPrintLvl(), and VCS_SOLVE::vcs_prob_specifyFully().


The documentation for this class was generated from the following files: