Cantera  2.3.0
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 http://www.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;
16 
17  // Evaluate the standard state free energies
18  // at the current temperatures and pressures.
19  int iconv = vcs_evalSS_TP(ipr, ip1, m_temperature, pres_arg);
20 
21  // Prepare the problem data: nondimensionalize the free energies using the
22  // divisor, R * T
23  vcs_nondim_TP();
24 
25  // Prep the fe field
26  vcs_fePrep_TP();
27 
28  // Decide whether we need an initial estimate of the solution If so, go get
29  // one. If not, then
30  if (m_doEstimateEquil) {
31  int retn = vcs_inest_TP();
32  if (retn != VCS_SUCCESS) {
33  plogf("vcs_inest_TP returned a failure flag\n");
34  }
35  }
36 
37  // Solve the problem at a fixed Temperature and Pressure (all information
38  // concerning Temperature and Pressure has already been derived. The free
39  // energies are now in dimensionless form.)
40  iconv = vcs_solve_TP(ipr, ip1, maxit);
41 
42  // Redimensionalize the free energies using the reverse of vcs_nondim to add
43  // back units.
44  vcs_redim_TP();
45 
46  // Return the convergence success flag.
47  return iconv;
48 }
49 
50 int VCS_SOLVE::vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
51 {
52  for (size_t iph = 0; iph < m_numPhases; iph++) {
53  vcs_VolPhase* vph = m_VolPhaseList[iph];
56  }
57 
58  return VCS_SUCCESS;
59 }
60 
62 {
63  for (size_t i = 0; i < m_numSpeciesTot; ++i) {
64  // For single species phases, initialize the chemical potential with the
65  // value of the standard state chemical potential. This value doesn't
66  // change during the calculation
67  if (m_SSPhase[i]) {
70  }
71  }
72 }
73 
74 }
void sendToVCS_GStar(double *const gstar) const
Fill in the partial molar volume vector for VCS.
vector_fp m_SSfeSpecies
Standard state chemical potentials for species K at the current temperature and pressure.
Definition: vcs_solve.h:1465
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
std::vector< vcs_VolPhase * > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
Definition: vcs_solve.h:1740
void vcs_nondim_TP()
Nondimensionalize the problem data.
Definition: vcs_nondim.cpp:17
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:1481
void vcs_redim_TP()
Redimensionalize the problem data.
Definition: vcs_nondim.cpp:91
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...
Header for the object representing each phase within vcs.
int m_doEstimateEquil
Setting for whether to do an initial estimate.
Definition: vcs_solve.h:1491
int vcs_inest_TP()
Create an initial estimate of the solution to the thermodynamic equilibrium problem.
Definition: vcs_inest.cpp:283
#define VCS_SUCCESS
Definition: vcs_defs.h:18
size_t m_numSpeciesTot
Total number of species in the problems.
Definition: vcs_solve.h:1387
vector_fp m_feSpecies_old
Free energy vector from the start of the current iteration.
Definition: vcs_solve.h:1472
int vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
Definition: vcs_TP.cpp:50
double m_temperature
Temperature (Kelvin)
Definition: vcs_solve.h:1616
std::vector< char > m_SSPhase
Boolean indicating whether a species belongs to a single-species phase.
Definition: vcs_solve.h:1707
Phase information and Phase calculations for vcs.
Definition: vcs_VolPhase.h:81
double m_pressurePA
Pressure.
Definition: vcs_solve.h:1619
#define plogf
define this Cantera function to replace printf
Definition: vcs_internal.h:18
Namespace for the Cantera kernel.
Definition: application.cpp:29
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...
size_t m_numPhases
Number of Phases in the problem.
Definition: vcs_solve.h:1414
void setState_TP(const double temperature_Kelvin, const double pressure_PA)
Sets the temperature and pressure in this object and underlying ThermoPhase objects.
void vcs_fePrep_TP()
Initialize the chemical potential of single species phases.
Definition: vcs_TP.cpp:61