[Equil] Always use the member function versions of 'equilibrate'

The various free functions are deprecated, along with the now unnecessary
headers 'equil.h' and 'equilibrium.h'.
This commit is contained in:
Ray Speth 2014-11-08 00:53:45 +00:00
parent 8c934ab678
commit 39b751d655
30 changed files with 136 additions and 170 deletions

View file

@ -1,4 +1,3 @@
#include "cantera/equilibrium.h"
#include "cantera/thermo.h"
using namespace Cantera;
@ -7,7 +6,7 @@ void equil_demo()
{
ThermoPhase* gas = newPhase("h2o2.cti","ohmech");
gas->setState_TPX(1500.0, 2.0*OneAtm, "O2:1.0, H2:3.0, AR:1.0");
equilibrate(*gas, "TP");
gas->equilibrate("TP");
std::cout << gas->report() << std::endl;
}

View file

@ -3,9 +3,8 @@
Chemical Equilibrium Example Program
************************************
In the program below, the `equilibrate` function is called to set the gas to a
state of chemical equilibrium, holding the temperature and pressure fixed. This
function is declared in the `equilibrium.h` header file.
In the program below, the `equilibrate` method is called to set the gas to a
state of chemical equilibrium, holding the temperature and pressure fixed.
.. literalinclude:: demoequil.cpp
:language: c++
@ -54,10 +53,5 @@ this is true in the output above---the chemical potential of H2 is exactly
twice that of H, the chemical potential for OH is the sum of the values for H
and O, the value for H2O2 is twice as large as the value for OH, and so on.
We'll see later how the :ct:`equilibrate <Cantera::equilibrate(thermo_t&, const
char*, int, doublereal, int, int, int)>` function really works. For now, though,
the important points are these:
- The `equilibrate` procedure operates on an object, setting its state to a
chemical equilibrium state.
- To use `equilibrate`, you need to include the `equilibrium.h` header file.
We'll see later how the :ct:`equilibrate <Cantera::ThermoPhase::equilibrate>`
function really works.

View file

@ -5,16 +5,11 @@ C++ Header Files
Cantera provides some header files designed for use in C++ application
programs. These are designed to include those portions of Cantera needed for
particular types of calculations. For example, the header file ``equilibrium.h``
includes header files needed to do equilibrium calculations (specifically, files
``ChemEquil.h`` and ``MultiPhaseEquil.h``).
particular types of calculations.
These headers are designed for use in C++ application programs, and are not
included by the Cantera core. The headers and their functions are:
``equilibrium.h``
Chemical equilibrium.
``IdealGasMix.h``
Provides class :ct:`IdealGasMix`.

View file

@ -569,6 +569,22 @@ private:
//! Calculate the element abundance vector
void calcElemAbundances() const;
//! Set the mixture to a state of chemical equilibrium using the
//! MultiPhaseEquil solver.
/*!
* @param XY Integer flag specifying properties to hold fixed.
* @param err Error tolerance for \f$\Delta \mu/RT \f$ for all reactions.
* Also used as the relative error tolerance for the outer
* loop.
* @param maxsteps Maximum number of steps to take in solving the fixed
* TP problem.
* @param maxiter Maximum number of "outer" iterations for problems holding
* fixed something other than (T,P).
* @param loglevel Level of diagnostic output
*/
double equilibrate_MultiPhaseEquil(int XY, doublereal err, int maxsteps,
int maxiter, int loglevel);
//! Vector of the number of moles in each phase.
/*!
* Length = m_np, number of phases.

View file

@ -2,6 +2,8 @@
* @file equil.h
* This file contains the definition of some high level general equilibration
* routines.
* @deprecated All functions defined in this file are deprecated. To be removed
* after Cantera 2.2.
*/
// Copyright 2001 California Institute of Technology
@ -9,6 +11,8 @@
#ifndef CT_KERNEL_EQUIL_H
#define CT_KERNEL_EQUIL_H
#pragma message "cantera/equil/equil.h is deprecated"
#include "MultiPhase.h"
#include "vcs_defs.h"
@ -47,7 +51,7 @@ namespace Cantera
* are written as loglevel increases.
*
* @return The number of iterations it took to equilibrate the system.
*
* @deprecated Use ThermoPhase::equilibrate instead. To be removed after Cantera 2.2.
* @ingroup equilfunctions
*/
int equilibrate(thermo_t& s, const char* XY,
@ -72,7 +76,7 @@ int equilibrate(thermo_t& s, const char* XY,
* @param loglevel loglevel
*
* @return The number of iterations it took to equilibrate the system.
*
* @deprecated Use MultiPhase::equilibrate instead. To be removed after Cantera 2.2.
* @ingroup equilfunctions
*/
doublereal equilibrate(MultiPhase& s, const char* XY,

View file

@ -46,7 +46,8 @@ namespace Cantera
* @param loglevel Controls amount of diagnostic output. loglevel
* = 0 suppresses diagnostics, and increasingly-verbose
* messages are written as loglevel increases.
*
* @deprecated Use ThermoPhase::equilibrate instead. To be removed after
* Cantera 2.2.
* @ingroup equilfunctions
*/
int vcs_equilibrate(thermo_t& s, const char* XY,
@ -87,7 +88,8 @@ int vcs_equilibrate(thermo_t& s, const char* XY,
* @param loglevel Controls amount of diagnostic output. loglevel
* = 0 suppresses diagnostics, and increasingly-verbose
* messages are written as loglevel increases.
*
* @deprecated Use MultiPhase::equilibrate instead. To be removed after
* Cantera 2.2.
* @ingroup equilfunctions
*/
int vcs_equilibrate(MultiPhase& s, const char* XY,
@ -129,7 +131,8 @@ int vcs_equilibrate(MultiPhase& s, const char* XY,
* @param loglevel Controls amount of diagnostic output. loglevel
* = 0 suppresses diagnostics, and increasingly-verbose
* messages are written as loglevel increases.
*
* @deprecated Use MultiPhase::equilibrate instead. To be removed after
* Cantera 2.2.
* @ingroup equilfunctions
*/
int vcs_equilibrate_1(MultiPhase& s, int ixy,

View file

@ -2,9 +2,12 @@
* @file equilibrium.h
* cxx layer - Header file providing support for chemical equilibrium calculations
* (see \ref equilfunctions)
* @deprecated Equilibrium solvers are directly available through class
* Cantera::ThermoPhase and class Cantera::MultiPhase
*/
#ifndef CT_EQUIL_INCL
#define CT_EQUIL_INCL
#pragma message "cantera/equil/equil.h is deprecated"
#include "equil/equil.h"
#include "equil/ChemEquil.h"
#include "equil/MultiPhaseEquil.h"

View file

@ -1190,11 +1190,10 @@ public:
//! Stores the element potentials in the ThermoPhase object
/*!
* Called by function 'equilibrate' in ChemEquil.h to transfer
* the element potentials to this object after every successful
* equilibration routine.
* The element potentials are stored in their dimensionless
* forms, calculated by dividing by RT.
* Called by the ChemEquil equilibrium solver to transfer the element
* potentials to this object after every successful equilibration routine.
* The element potentials are stored in their dimensionless forms,
* calculated by dividing by RT.
*
* @param lambda Input vector containing the element potentials.
* Length = nElements. Units are Joules/kmol.

View file

@ -12,7 +12,6 @@
// to include core headers directly, use the format "cantera/module/*.h".
#include "cantera/IdealGasMix.h" // defines class IdealGasMix
#include "cantera/equilibrium.h" // chemical equilibrium
#include "cantera/transport.h" // transport properties
// All Cantera kernel names are in namespace Cantera. You can either
@ -49,7 +48,7 @@ void demoprog()
// set the gas to the equilibrium state with the same specific
// enthalpy and pressure
equilibrate(gas,"HP");
gas.equilibrate("HP");
printf("\n\nEquilibrium state:\n\n");
printf(

View file

@ -9,7 +9,6 @@
#include "cantera/oneD/Inlet1D.h"
#include "cantera/oneD/StFlow.h"
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
#include "cantera/transport.h"
using namespace Cantera;
@ -64,7 +63,7 @@ int flamespeed(int np, void* p)
gas.getMassFractions(yin);
try {
equilibrate(gas,"HP");
gas.equilibrate("HP");
} catch (CanteraError& err) {
std::cout << err.what() << std::endl;
}

View file

@ -40,7 +40,6 @@ IdealGasMix* _gasptr()
return _gas;
}
#include "cantera/equilibrium.h"
#include "cantera/transport.h"
// store a pointer to a transport manager
@ -277,7 +276,7 @@ extern "C" {
"two-character string required.");
}
string optstr = string(opt, 2);
equilibrate(*_gas, optstr.c_str());
_gas->equilibrate(optstr);
} catch (CanteraError& err) {
handleError(err);
}

View file

@ -12,7 +12,6 @@
#include "ct.h"
// Cantera includes
#include "cantera/equil/equil.h"
#include "cantera/kinetics/KineticsFactory.h"
#include "cantera/transport/TransportFactory.h"
#include "cantera/base/ctml.h"
@ -516,7 +515,7 @@ extern "C" {
try {
ThermoPhase& thrm = ThermoCabinet::item(n);
thrm.checkElementArraySize(lenm);
equilibrate(thrm, "TP", 0);
thrm.equilibrate("TP", "element_potential");
thrm.getElementPotentials(lambda);
return 0;
} catch (...) {
@ -592,14 +591,27 @@ extern "C" {
double rtol, int maxsteps, int maxiter, int loglevel)
{
try {
equilibrate(ThermoCabinet::item(n), XY, solver, rtol, maxsteps,
maxiter, loglevel);
string ssolver;
if (solver < 0) {
ssolver = "auto";
} else if (solver == 0) {
ssolver = "element_potential";
} else if (solver == 1) {
ssolver = "gibbs";
} else if (solver == 2) {
ssolver = "vcs";
} else {
throw CanteraError("th_equil",
"Invalid equilibrium solver specified.");
}
ThermoCabinet::item(n).equilibrate(XY, ssolver, rtol, maxsteps,
maxiter, 0, loglevel);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
doublereal th_refPressure(int n)
{
try {

View file

@ -5,10 +5,7 @@
#include "ctmultiphase.h"
// Cantera includes
#include "cantera/equil/equil.h"
#include "cantera/equil/MultiPhase.h"
#include "cantera/equil/MultiPhaseEquil.h"
#include "cantera/equil/vcs_MultiPhaseEquil.h"
#include "Cabinet.h"
using namespace std;
@ -297,8 +294,9 @@ extern "C" {
int maxiter, int loglevel)
{
try {
return equilibrate(mixCabinet::item(i), XY,
rtol, maxsteps, maxiter, loglevel);
mixCabinet::item(i).equilibrate(XY, "auto", rtol, maxsteps, maxiter,
0, loglevel);
return 0;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
@ -309,9 +307,20 @@ extern "C" {
int maxsteps, int maxiter, int loglevel)
{
try {
int retn = vcs_equilibrate(mixCabinet::item(i), XY, estimateEquil, printLvl, solver,
rtol, maxsteps, maxiter, loglevel);
return (double) retn;
string ssolver;
if (solver < 0) {
ssolver = "auto";
} else if (solver == 1) {
ssolver = "gibbs";
} else if (solver == 2) {
ssolver = "vcs";
} else {
throw CanteraError("mix_vcs_equilibrate",
"Invalid equilibrium solver specified.");
}
mixCabinet::item(i).equilibrate(XY, ssolver, rtol, maxsteps,
maxiter, estimateEquil, loglevel);
return 0;
} catch (...) {
return handleAllExceptions(ERR, ERR);
}

View file

@ -562,8 +562,18 @@ doublereal MultiPhase::volume() const
return sum;
}
doublereal MultiPhase::equilibrate(int XY, doublereal err,
int maxsteps, int maxiter, int loglevel)
double MultiPhase::equilibrate(int XY, doublereal err, int maxsteps,
int maxiter, int loglevel)
{
warn_deprecated("MultiPhase::equilibrate(int XY, ...)",
"Use MultiPhase::equilibrate(string XY, ...) instead. To be removed "
"after Cantera 2.2.");
return equilibrate_MultiPhaseEquil(XY, err, maxsteps, maxiter, loglevel);
}
double MultiPhase::equilibrate_MultiPhaseEquil(int XY, doublereal err,
int maxsteps, int maxiter,
int loglevel)
{
bool strt = false;
doublereal dt;
@ -667,7 +677,7 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err,
}
}
}
throw CanteraError("MultiPhase::equilibrate",
throw CanteraError("MultiPhase::equilibrate_MultiPhaseEquil",
"No convergence for T");
} else if (XY == SP) {
s0 = entropy();
@ -714,7 +724,7 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err,
}
}
}
throw CanteraError("MultiPhase::equilibrate",
throw CanteraError("MultiPhase::equilibrate_MultiPhaseEquil",
"No convergence for T");
} else if (XY == TV) {
doublereal v0 = volume();
@ -742,7 +752,8 @@ doublereal MultiPhase::equilibrate(int XY, doublereal err,
}
else {
throw CanteraError("MultiPhase::equilibrate","unknown option");
throw CanteraError("MultiPhase::equilibrate_MultiPhaseEquil",
"unknown option");
}
return -1.0;
}
@ -790,7 +801,8 @@ void MultiPhase::equilibrate(const std::string& XY, const std::string& solver,
try {
writelog("Trying MultiPhaseEquil (Gibbs) equilibrium solver\n",
log_level);
equilibrate(ixy, rtol, max_steps, max_iter, log_level-1);
equilibrate_MultiPhaseEquil(ixy, rtol, max_steps, max_iter,
log_level-1);
writelog("MultiPhaseEquil solver succeeded\n", log_level);
return;
} catch (std::exception& err) {

View file

@ -12,6 +12,8 @@ doublereal equilibrate(MultiPhase& s, const char* XY,
doublereal tol, int maxsteps, int maxiter,
int loglevel)
{
warn_deprecated("equilibrate(MultiPhase&, ...)",
"Use MultiPhase::equilibrate instead. To be removed after Cantera 2.2.");
s.init();
int ixy = _equilflag(XY);
if (ixy == TP || ixy == HP || ixy == SP || ixy == TV) {
@ -32,6 +34,8 @@ doublereal equilibrate(MultiPhase& s, const char* XY,
int equilibrate(thermo_t& s, const char* XY, int solver,
doublereal rtol, int maxsteps, int maxiter, int loglevel)
{
warn_deprecated("equilibrate(ThermoPhase&, ...)",
"Use ThermoPhase::equilibrate instead. To be removed after Cantera 2.2.");
bool redo = true;
int retn = -1;
int nAttempts = 0;

View file

@ -23,6 +23,8 @@ int vcs_equilibrate(thermo_t& s, const char* XY,
doublereal rtol, int maxsteps, int maxiter,
int loglevel)
{
warn_deprecated("vcs_equilibrate", "Use ThermoPhase::equilibrate instead. "
"To be removed after Cantera 2.2.");
MultiPhase* m = 0;
int retn = 1;
@ -107,6 +109,8 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy,
int estimateEquil, int printLvl, int solver,
doublereal tol, int maxsteps, int maxiter, int loglevel)
{
warn_deprecated("vcs_equilibrate_1", "Use MultiPhase::equilibrate instead. "
"To be removed after Cantera 2.2.");
static int counter = 0;
int retn = 1;

View file

@ -7,7 +7,6 @@
* pointers are passed to or from the calling application.
*/
// Cantera includes
#include "cantera/equil/equil.h"
#include "cantera/kinetics/KineticsFactory.h"
#include "cantera/transport/TransportFactory.h"
#include "cantera/thermo/ThermoFactory.h"
@ -559,7 +558,7 @@ extern "C" {
status_t th_equil_(const integer* n, char* XY, ftnlen lenxy)
{
try {
equilibrate(*_fth(n), f2string(XY,lenxy).c_str());
_fth(n)->equilibrate(f2string(XY,lenxy));
} catch (...) {
return handleAllExceptions(-1, ERR);
}

View file

@ -3,7 +3,6 @@
*/
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
using namespace std;
using namespace Cantera;
@ -16,9 +15,8 @@ int main(int argc, char** argv)
int numSucc = 0;
int numFail = 0;
try {
int retnSub;
double T = 500.;
int solver = -1;
string solver = "auto";
IdealGasMix g("gri30.xml", "gri30_mix");
double pres = OneAtm;
@ -38,19 +36,8 @@ int main(int argc, char** argv)
Xmol[iN2] = 0.4;
g.setState_TPX(T, pres, DATA_PTR(Xmol));
try {
retnSub = equilibrate(g, "TP", solver);
g.equilibrate("TP", solver);
cout << g.report(true, 0.0);
if (retnSub != 1) {
cerr << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
cout << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
exit(-1);
}
} catch (CanteraError& err) {
cout << g.report(true, 0.0);
std::cerr << err.what() << std::endl;
@ -74,19 +61,8 @@ int main(int argc, char** argv)
Xmol[iN2] = 0.4;
g.setState_TPX(T, pres, DATA_PTR(Xmol));
try {
retnSub = equilibrate(g, "TP", solver);
g.equilibrate("TP", solver);
cout << g.report(true, 0.0);
if (retnSub != 1) {
cerr << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
cout << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
exit(-1);
}
} catch (CanteraError& err) {
cout << g.report(true, 0.0);
std::cerr << err.what() << std::endl;
@ -112,19 +88,8 @@ int main(int argc, char** argv)
pres = OneAtm;
g.setState_TPX(T, pres, DATA_PTR(Xmol));
try {
retnSub = equilibrate(g, "TP", solver);
g.equilibrate("TP", solver);
cout << g.report(true, 0.0);
if (retnSub != 1) {
cerr << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
cout << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
exit(-1);
}
} catch (CanteraError& err) {
cout << g.report(true, 0.0);
std::cerr << err.what() << std::endl;
@ -150,19 +115,8 @@ int main(int argc, char** argv)
pres = 1.0;
g.setState_TPX(T, pres, DATA_PTR(Xmol));
try {
retnSub = equilibrate(g, "TP", solver);
g.equilibrate("TP", solver);
cout << g.report(true, 0.0);
if (retnSub != 1) {
cerr << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
cout << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
exit(-1);
}
} catch (CanteraError& err) {
cout << g.report(true, 0.0);
std::cerr << err.what() << std::endl;
@ -194,19 +148,9 @@ int main(int argc, char** argv)
*/
g.setState_TPX(T, pres, DATA_PTR(Xmol));
retnSub = 0;
try {
retnSub = equilibrate(g, "TP", solver);
if (retnSub != 1) {
cerr << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
cout << "ERROR: ChemEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
}
g.equilibrate("TP", solver);
numSucc++;
} catch (CanteraError& err) {
std::cerr << err.what() << std::endl;
cerr << "ERROR: equilibration step failed at "
@ -217,16 +161,11 @@ int main(int argc, char** argv)
<< " T = " << T
<< " Pres = " << pres
<< endl;
numFail++;
}
if (showResults) {
cout << g.report(true, 0.0);
}
if (retnSub ==1) {
numSucc++;
} else {
numFail++;
}
}
}
}

View file

@ -3,7 +3,6 @@
*/
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
#include <cstdio>
@ -19,14 +18,14 @@ int main(int argc, char** argv)
IdealGasMix g("gri30.xml", "gri30_mix");
double pres = 1.0E5;
g.setState_TPX(1500.0, pres, "CH4:0.3, O2:0.3, N2:0.4");
equilibrate(g, "TP", -1);
g.equilibrate("TP", "auto");
//cout << g;
double enth = g.enthalpy_mass();
printf(" enth = %g\n", enth);
enth -= 1.0E5;
printf("attempted equil at (H,P) = %10.5g, %10.5g\n", enth, pres);
g.setState_HP(enth, pres);
equilibrate(g, "HP", -1);
g.equilibrate("HP", "auto");
//cout << g;
double entrop = g.entropy_mass();
@ -34,7 +33,7 @@ int main(int argc, char** argv)
entrop += 1.0E2;
printf("attempted equil at (S,P) = %10.5g, %10.5g\n", entrop, pres);
g.setState_SP(entrop, pres);
equilibrate(g, "SP", -1);
g.equilibrate("SP", "auto");
//cout << g;
double dens = g.density();
@ -43,13 +42,13 @@ int main(int argc, char** argv)
double vol = 1.0/dens;
printf("attempted equil at (S,V,dens) = %10.5g, %10.5g, %10.5g\n", entrop, vol, 1.0/vol);
g.setState_SV(entrop, vol);
equilibrate(g, "SV", -1);
g.equilibrate("SV", "auto");
//cout << g;
double temp = 1800.;
printf("attempted equil at (T,V, dens) = %10.5g, %10.5g, %10.5g\n", temp, vol, 1.0/vol);
g.setTemperature(temp);
equilibrate(g, "TV", -1);
g.equilibrate("TV", "auto");
//cout << g;
double inte = g.intEnergy_mass();
@ -57,7 +56,7 @@ int main(int argc, char** argv)
inte -= 1.0E5;
printf("attempted equil at (U,V,dens) = %10.5g, %10.5g, %10.5g\n", inte, vol, 1.0/vol);
g.setState_UV(inte, vol);
equilibrate(g, "UV", -1);
g.equilibrate("UV", "auto");
//cout << g;

View file

@ -1,5 +1,4 @@
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
#include <cstdio>
@ -57,7 +56,7 @@ int main(int argc, char** argv)
double pres = gas->pressure();
printf("Initial T = %g, pres = %g atm\n", tkelvin, pres/OneAtm);
equilibrate(*gas,"UV", 0, 1e-12);
gas->equilibrate("UV", "element_potential", 1e-12);
tkelvin = gas->temperature();
pres = gas->pressure();

View file

@ -1,5 +1,5 @@
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
#include "cantera/equil/MultiPhase.h"
using namespace std;
using namespace Cantera;
@ -43,11 +43,7 @@ int main(int argc, char** argv)
* The ChemEquil solver throws an error for this case.
* The MultiPhaseEquil solver just gets the wrong result.
*/
int it = equilibrate(g, "TP", -1);
if (it != 1) {
cerr << "incorrect number of iterations." << endl;
return -1;
}
g.equilibrate("TP", "auto");
cout.unsetf(ios::floatfield);
cout.precision(3);
//cout << g;

View file

@ -3,7 +3,6 @@
*/
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
using namespace std;
using namespace Cantera;
@ -17,14 +16,14 @@ int main(int argc, char** argv)
IdealGasMix g("bad_air.xml", "air");
double pres = 1.0E5;
g.setState_TPX(1000.1, pres, "O2:0.4, N2:0.6");
equilibrate(g, "TP", -1);
g.equilibrate("TP", "auto");
//cout << g;
double enth = g.enthalpy_mass();
printf(" enth = %g\n", enth);
enth -= 2.0E2;
printf("attempted equil at (H,P) = %10.5g, %10.5g\n", enth, pres);
g.setState_HP(enth, pres);
equilibrate(g, "HP", -1);
g.equilibrate("HP", "auto");
enth = g.enthalpy_mass();
printf(" enth = %g\n", enth);
//cout << g;

View file

@ -2,10 +2,11 @@
#include "cantera/thermo/MargulesVPSSTP.h"
#include "cantera/thermo/FixedChemPotSSTP.h"
#include "cantera/thermo/LatticeSolidPhase.h"
#include "cantera/equilibrium.h"
#include "cantera/equil/vcs_MultiPhaseEquil.h"
#include "cantera/thermo.h"
#include <stdio.h>
#include <memory>
using namespace Cantera;
@ -54,11 +55,10 @@ void testProblem()
mmm.addPhase(LiSi_solid.get(), 1.);
mmm.addPhase(&LiFixed, 100.);
int solver = 2;
int printLvl = 3;
int estimateEquil = 0;
vcs_equilibrate(mmm, "TP", estimateEquil, printLvl, solver);
mmm.equilibrate("TP", "vcs", 1e-9, 50000, 100, estimateEquil, printLvl);
std::cout << mmm << std::endl;
Cantera::appdelete();

View file

@ -2,6 +2,7 @@ Number of elements = 3
chem pot = -2.3e+07
dg_corr = -1.57754e+08
um_li_chempot = -1.65555e+08
Trying VCS equilibrium solver
Unknown Cantera EOS to VCSnonideal: 0
Unknown Cantera EOS to VCSnonideal: 20
Unknown Cantera EOS to VCSnonideal: 70
@ -235,6 +236,7 @@ Li(i) 1.398e-13 1.398e-13 -1.691e+08
V(i) 5.000e-01 5.000e-01 -3.513e+06
LiFixed 1.000e+02 1.000e+00 -1.656e+08
-------------------------------------------------------------
VCS solver succeeded
*************** MoltenSalt_electrolyte *****************
Moles: 10

View file

@ -1,3 +1,4 @@
Trying VCS equilibrium solver
Unknown Cantera EOS to VCSnonideal: 45012
================================================================================
@ -308,6 +309,7 @@ N2 4.000e+00 9.763e-01 -5.719e+07
OH 3.747e-07 9.145e-08 -2.670e+08
NaCl(S) 4.788e+00 1.000e+00 -4.326e+08
-------------------------------------------------------------
VCS solver succeeded
*************** NaCl_electrolyte *****************
Moles: 2.32744

View file

@ -2,9 +2,7 @@
* Copyright 2002 California Institute of Technology
*/
#include "cantera/equilibrium.h"
#include "cantera/equil/vcs_MultiPhaseEquil.h"
#include "cantera/equil/vcs_internal.h"
#include "cantera/thermo/ThermoFactory.h"
#include "cantera/thermo/IdealGasPhase.h"
@ -83,7 +81,6 @@ int main(int argc, char** argv)
try {
int retnSub;
int estimateEquil = 0;
double T = 298.15;
double pres = OneAtm;
@ -122,20 +119,8 @@ int main(int argc, char** argv)
try {
retnSub = vcs_equilibrate(*mp, "TP", estimateEquil, printLvl);
mp->equilibrate("TP", "vcs", 1e-9, 50000, 100, estimateEquil, printLvl);
cout << *mp;
if (retnSub != 1) {
cerr << "ERROR: MultiEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
cout << "ERROR: MultiEquil equilibration step failed at "
<< " T = " << T
<< " Pres = " << pres
<< endl;
exit(-1);
}
numSucc++;
} catch (CanteraError& err) {
cout << *mp;

View file

@ -3,7 +3,6 @@
*/
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
#include "cantera/thermo/IdealSolnGasVPSS.h"
#include "cantera/thermo/ThermoFactory.h"
@ -22,7 +21,7 @@ int main(int argc, char** argv)
cout.precision(4);
g->setState_TPX(1500.0, 100.0, "SIH4:0.01, H2:0.99");
//g.setState_TPX(1500.0, 1.0132E5, "SIH4:0.01, H2:0.99");
equilibrate(*g, "TP");
g->equilibrate("TP");
cout << g->report(true, 0.0) << endl;
return 0;
} catch (CanteraError& err) {

View file

@ -6,7 +6,6 @@
/////////////////////////////////////////////////////////////
#include "example_utils.h"
#include "cantera/equilibrium.h"
#include "cantera/IdealGasMix.h"
@ -80,8 +79,7 @@ int equil_example1(int job)
}
gas.setState_TPX(temp, pres, "SIH4:0.01, H2:0.99");
// equilibrate(gas,"TP",1,1.0e-9,1000,100,15);
equilibrate(gas,"TP");
gas.equilibrate("TP");
output(0,i) = temp;
output(1,i) = gas.pressure();
gas.getMoleFractions(&output(2,i));

View file

@ -8,7 +8,6 @@
#include "cantera/transport.h"
#include "example_utils.h"
#include "cantera/equilibrium.h"
#include "cantera/IdealGasMix.h"
using namespace Cantera;
@ -34,7 +33,7 @@ int transport_example2(int job)
doublereal temp = 2000.0;
doublereal pres = 2.0*OneAtm;
gas.setState_TPX(temp, pres, "H2:1.0, O2:0.5, CH4:0.1, N2:0.2");
equilibrate(gas,"TP");
gas.equilibrate("TP");
// create a transport manager that implements
// multicomponent transport properties

View file

@ -3,7 +3,6 @@
*/
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
using namespace std;
using namespace Cantera;
@ -16,7 +15,7 @@ int main(int argc, char** argv)
try {
IdealGasMix g("silane.xml", "silane");
g.setState_TPX(1500.0, 100.0, "SIH4:0.01, H2:0.99");
equilibrate(g, "TP");
g.equilibrate("TP");
//cout << g;
return 0;
} catch (CanteraError& err) {