Cantera  2.5.1
vcs_TP.cpp
Go to the documentation of this file.
1 //! @file vcs_TP.cpp
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at https://cantera.org/license.txt for license and copyright information.
5 
8 
9 namespace Cantera
10 {
11 int VCS_SOLVE::vcs_TP(int ipr, int ip1, int maxit, double T_arg, double pres_arg)
12 {
13  // Store the temperature and pressure in the private global variables
14  m_temperature = T_arg;
15  m_pressurePA = pres_arg;
17 
18  // Evaluate the standard state free energies
19  // at the current temperatures and pressures.
20  int iconv = vcs_evalSS_TP(ipr, ip1, m_temperature, pres_arg);
21 
22  // Prep the fe field
23  vcs_fePrep_TP();
24 
25  // Decide whether we need an initial estimate of the solution If so, go get
26  // one. If not, then
27  if (m_doEstimateEquil) {
28  int retn = vcs_inest_TP();
29  if (retn != VCS_SUCCESS) {
30  plogf("vcs_inest_TP returned a failure flag\n");
31  }
32  }
33 
34  // Solve the problem at a fixed Temperature and Pressure (all information
35  // concerning Temperature and Pressure has already been derived. The free
36  // energies are now in dimensionless form.)
37  iconv = vcs_solve_TP(ipr, ip1, maxit);
38 
39  // Return the convergence success flag.
40  return iconv;
41 }
42 
43 int VCS_SOLVE::vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
44 {
45  for (size_t iph = 0; iph < m_numPhases; iph++) {
46  vcs_VolPhase* vph = m_VolPhaseList[iph].get();
49  }
50  for (size_t k = 0; k < m_nsp; k++) {
52  }
53 
54  return VCS_SUCCESS;
55 }
56 
58 {
59  for (size_t i = 0; i < m_nsp; ++i) {
60  // For single species phases, initialize the chemical potential with the
61  // value of the standard state chemical potential. This value doesn't
62  // change during the calculation
63  if (m_SSPhase[i]) {
66  }
67  }
68 }
69 
70 }
size_t m_numPhases
Number of Phases in the problem.
Definition: vcs_solve.h:1068
int m_doEstimateEquil
Setting for whether to do an initial estimate.
Definition: vcs_solve.h:1145
int vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
Definition: vcs_TP.cpp:43
int vcs_inest_TP()
Create an initial estimate of the solution to the thermodynamic equilibrium problem.
Definition: vcs_inest.cpp:278
int vcs_TP(int ipr, int ip1, int maxit, double T, double pres)
Solve an equilibrium problem at a particular fixed temperature and pressure.
Definition: vcs_TP.cpp:11
vector_fp m_feSpecies_new
Dimensionless new free energy for all the species in the mechanism at the new tentative T,...
Definition: vcs_solve.h:1135
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.
double m_pressurePA
Pressure.
Definition: vcs_solve.h:1273
vector_fp m_feSpecies_old
Free energy vector from the start of the current iteration.
Definition: vcs_solve.h:1126
double m_Faraday_dim
dimensionless value of Faraday's constant, F / RT (1/volt)
Definition: vcs_solve.h:1481
std::vector< char > m_SSPhase
Boolean indicating whether a species belongs to a single-species phase.
Definition: vcs_solve.h:1361
size_t m_nsp
Total number of species in the problems.
Definition: vcs_solve.h:1044
std::vector< std::unique_ptr< vcs_VolPhase > > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
Definition: vcs_solve.h:1394
vector_fp m_SSfeSpecies
Standard state chemical potentials for species K at the current temperature and pressure.
Definition: vcs_solve.h:1119
void vcs_fePrep_TP()
Initialize the chemical potential of single species phases.
Definition: vcs_TP.cpp:57
double m_temperature
Temperature (Kelvin)
Definition: vcs_solve.h:1270
Phase information and Phase calculations for vcs.
Definition: vcs_VolPhase.h:82
void sendToVCS_GStar(double *const gstar) const
Fill in the partial molar volume vector for VCS.
void setState_TP(const double temperature_Kelvin, const double pressure_PA)
Sets the temperature and pressure in this object and underlying ThermoPhase objects.
const double Faraday
Faraday constant [C/kmol].
Definition: ct_defs.h:123
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:109
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
Header for the object representing each phase within vcs.
#define VCS_SUCCESS
Definition: vcs_defs.h:18
#define plogf
define this Cantera function to replace printf
Definition: vcs_internal.h:18
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...