Merge namespace VCSnonideal with namespace Cantera
This commit is contained in:
parent
5214672ab3
commit
808f088ffd
35 changed files with 140 additions and 182 deletions
|
|
@ -159,13 +159,6 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy,
|
|||
int vcs_determine_PhaseStability(MultiPhase& s, int iphase,
|
||||
double& funcStab, int printLvl, int loglevel);
|
||||
|
||||
}
|
||||
|
||||
//! Contains classes and functions implementing the VCS multi-phase
|
||||
//! equilibrium solver.
|
||||
namespace VCSnonideal
|
||||
{
|
||||
|
||||
//! Translate a MultiPhase object into a VCS_PROB problem definition object
|
||||
/*!
|
||||
* @param mphase MultiPhase object that is the source for all of the information
|
||||
|
|
@ -174,8 +167,7 @@ namespace VCSnonideal
|
|||
* Note, both objects share the underlying ThermoPhase objects. So, neither
|
||||
* can be const objects.
|
||||
*/
|
||||
int vcs_Cantera_to_vprob(Cantera::MultiPhase* mphase,
|
||||
VCSnonideal::VCS_PROB* vprob);
|
||||
int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob);
|
||||
|
||||
//! Translate a MultiPhase information into a VCS_PROB problem definition object
|
||||
/*!
|
||||
|
|
@ -185,8 +177,7 @@ int vcs_Cantera_to_vprob(Cantera::MultiPhase* mphase,
|
|||
* @param mphase MultiPhase object that is the source for all of the information
|
||||
* @param vprob VCS_PROB problem definition that gets all of the information
|
||||
*/
|
||||
int vcs_Cantera_update_vprob(Cantera::MultiPhase* mphase,
|
||||
VCSnonideal::VCS_PROB* vprob);
|
||||
int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob);
|
||||
|
||||
//! %Cantera's Interface to the Multiphase chemical equilibrium solver.
|
||||
/*!
|
||||
|
|
@ -224,7 +215,7 @@ public:
|
|||
* - 4: Print a table for each iteration
|
||||
* - 5: Print more than a table for each iteration
|
||||
*/
|
||||
vcs_MultiPhaseEquil(Cantera::MultiPhase* mix, int printLvl);
|
||||
vcs_MultiPhaseEquil(MultiPhase* mix, int printLvl);
|
||||
|
||||
virtual ~vcs_MultiPhaseEquil() {}
|
||||
|
||||
|
|
@ -254,7 +245,7 @@ public:
|
|||
* @param nu Vector of coefficients for the formation reaction. Length is
|
||||
* equal to the number of species in the MultiPhase object.
|
||||
*/
|
||||
void getStoichVector(size_t rxn, Cantera::vector_fp& nu);
|
||||
void getStoichVector(size_t rxn, vector_fp& nu);
|
||||
|
||||
//! return the number of iterations
|
||||
int iterations() const {
|
||||
|
|
@ -458,10 +449,8 @@ public:
|
|||
size_t numElemConstraints() const;
|
||||
|
||||
// Friend functions
|
||||
friend int vcs_Cantera_to_vprob(Cantera::MultiPhase* mphase,
|
||||
VCSnonideal::VCS_PROB* vprob);
|
||||
friend int vcs_Cantera_update_vprob(Cantera::MultiPhase* mphase,
|
||||
VCSnonideal::VCS_PROB* vprob);
|
||||
friend int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob);
|
||||
friend int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob);
|
||||
|
||||
protected:
|
||||
//! Vector that takes into account of the current sorting of the species
|
||||
|
|
@ -472,7 +461,7 @@ protected:
|
|||
*
|
||||
* `m_order[korig] = k_sorted`
|
||||
*/
|
||||
Cantera::vector_int m_order;
|
||||
vector_int m_order;
|
||||
|
||||
//! Object which contains the problem statement
|
||||
/*!
|
||||
|
|
@ -483,13 +472,13 @@ protected:
|
|||
* constraints. All of these make the problem statement different than
|
||||
* the simple element conservation statement.
|
||||
*/
|
||||
VCSnonideal::VCS_PROB m_vprob;
|
||||
VCS_PROB m_vprob;
|
||||
|
||||
//! Pointer to the MultiPhase mixture that will be equilibrated.
|
||||
/*!
|
||||
* Equilibrium solutions will be returned via this variable.
|
||||
*/
|
||||
Cantera::MultiPhase* m_mix;
|
||||
MultiPhase* m_mix;
|
||||
|
||||
//! Print level from the VCSnonlinear package
|
||||
/*!
|
||||
|
|
@ -507,7 +496,7 @@ protected:
|
|||
int m_printLvl;
|
||||
|
||||
//! Stoichiometric matrix
|
||||
Cantera::DenseMatrix m_N;
|
||||
DenseMatrix m_N;
|
||||
|
||||
//! Iteration Count
|
||||
int m_iter;
|
||||
|
|
@ -516,14 +505,14 @@ protected:
|
|||
/*!
|
||||
* This is used to exclude pure-phase species with invalid thermo data
|
||||
*/
|
||||
Cantera::vector_int m_species;
|
||||
vector_int m_species;
|
||||
|
||||
//! The object that does all of the equilibration work.
|
||||
/*!
|
||||
* VCS_SOLVE will have different ordering for species and element constraints
|
||||
* than this object or the VCS_PROB object.
|
||||
*/
|
||||
VCSnonideal::VCS_SOLVE m_vsolve;
|
||||
VCS_SOLVE m_vsolve;
|
||||
};
|
||||
|
||||
//! Global hook for turning on and off time printing.
|
||||
|
|
@ -535,4 +524,5 @@ protected:
|
|||
extern int vcs_timing_print_lvl;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
class VCS_SPECIES_THERMO;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
namespace Cantera
|
||||
{
|
||||
class ThermoPhase;
|
||||
}
|
||||
|
||||
namespace VCSnonideal
|
||||
{
|
||||
|
||||
//! Models for the standard state volume of each species
|
||||
#define VCS_SSVOL_IDEALGAS 0
|
||||
|
|
@ -286,7 +282,7 @@ public:
|
|||
* j = id of the species mole number
|
||||
* k = id of the species activity coefficient
|
||||
*/
|
||||
void sendToVCS_LnActCoeffJac(Cantera::Array2D& LnACJac_VCS);
|
||||
void sendToVCS_LnActCoeffJac(Array2D& LnACJac_VCS);
|
||||
|
||||
//! Set the pointer for Cantera's ThermoPhase parameter
|
||||
/*!
|
||||
|
|
@ -296,13 +292,13 @@ public:
|
|||
* @param tp_ptr Pointer to the ThermoPhase object corresponding
|
||||
* to this phase.
|
||||
*/
|
||||
void setPtrThermoPhase(Cantera::ThermoPhase* tp_ptr);
|
||||
void setPtrThermoPhase(ThermoPhase* tp_ptr);
|
||||
|
||||
//! Return a const ThermoPhase pointer corresponding to this phase
|
||||
/*!
|
||||
* @return pointer to the ThermoPhase.
|
||||
*/
|
||||
const Cantera::ThermoPhase* ptrThermoPhase() const;
|
||||
const ThermoPhase* ptrThermoPhase() const;
|
||||
|
||||
//! Return the total moles in the phase
|
||||
/*!
|
||||
|
|
@ -488,14 +484,14 @@ public:
|
|||
*
|
||||
* @param tPhase Pointer to the ThermoPhase object
|
||||
*/
|
||||
size_t transferElementsFM(const Cantera::ThermoPhase* const tPhase);
|
||||
size_t transferElementsFM(const ThermoPhase* const tPhase);
|
||||
|
||||
//! Get a constant form of the Species Formula Matrix
|
||||
/*!
|
||||
* Returns a `double**` pointer such that `fm[e][f]` is the formula
|
||||
* matrix entry for element `e` for species `k`
|
||||
*/
|
||||
const Cantera::Array2D& getFormulaMatrix() const;
|
||||
const Array2D& getFormulaMatrix() const;
|
||||
|
||||
//! Returns the type of the species unknown
|
||||
/*!
|
||||
|
|
@ -676,7 +672,7 @@ private:
|
|||
* FormulaMatrix(kspec,j) = Formula Matrix for the species
|
||||
* Number of elements, j, in the kspec species
|
||||
*/
|
||||
Cantera::Array2D m_formulaMatrix;
|
||||
Array2D m_formulaMatrix;
|
||||
|
||||
//! Type of the species unknown
|
||||
/*!
|
||||
|
|
@ -757,7 +753,7 @@ private:
|
|||
* If we are using Cantera, this is the pointer to the ThermoPhase
|
||||
* object. If not, this is null.
|
||||
*/
|
||||
Cantera::ThermoPhase* TP_ptr;
|
||||
ThermoPhase* TP_ptr;
|
||||
|
||||
//! Total mols in the phase. units are kmol
|
||||
double v_totalMoles;
|
||||
|
|
@ -836,7 +832,7 @@ private:
|
|||
* - j = id of the species mole number
|
||||
* - k = id of the species activity coefficient
|
||||
*/
|
||||
mutable Cantera::Array2D np_dLnActCoeffdMolNumber;
|
||||
mutable Array2D np_dLnActCoeffdMolNumber;
|
||||
|
||||
//! Status
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@
|
|||
#ifndef VCS_DEFS_H
|
||||
#define VCS_DEFS_H
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
/*!
|
||||
* ERROR CODES
|
||||
*
|
||||
|
|
@ -377,7 +376,9 @@ namespace VCSnonideal
|
|||
#define VCS_STATECALC_TMP 3
|
||||
//@}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// namespace alias for backward compatibility
|
||||
namespace VCSnonideal = Cantera;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,11 +12,8 @@
|
|||
#define _VCS_INTERNAL_H
|
||||
|
||||
#include "cantera/base/global.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
using Cantera::npos;
|
||||
|
||||
//! Points to the data in a std::vector<> object
|
||||
#define VCS_DATA_PTR(vvv) (&(vvv[0]))
|
||||
|
||||
|
|
@ -24,14 +21,14 @@ using Cantera::npos;
|
|||
/*!
|
||||
* We can replace this with printf easily
|
||||
*/
|
||||
#define plogf Cantera::writelogf
|
||||
#define plogf writelogf
|
||||
|
||||
//! define this Cantera function to replace cout << endl;
|
||||
/*!
|
||||
* We use this to place an endl in the log file, and
|
||||
* ensure that the IO buffers are flushed.
|
||||
*/
|
||||
#define plogendl() Cantera::writelogendl()
|
||||
#define plogendl() writelogendl()
|
||||
|
||||
//! Global hook for turning on and off time printing.
|
||||
/*!
|
||||
|
|
@ -198,10 +195,10 @@ typedef double(*VCS_FUNC_PTR)(double xval, double Vtarget,
|
|||
* double thetaR = Pi/2.0;
|
||||
* int printLvl = 4;
|
||||
*
|
||||
* iconv = VCSnonideal::vcsUtil_root1d(thetamin, thetamax, maxit,
|
||||
* funcZero,
|
||||
* (void *) 0, 0.0, 0,
|
||||
* &thetaR, printLvl);
|
||||
* iconv = vcsUtil_root1d(thetamin, thetamax, maxit,
|
||||
* funcZero,
|
||||
* (void *) 0, 0.0, 0,
|
||||
* &thetaR, printLvl);
|
||||
* printf("theta = %g\n", thetaR);
|
||||
* double h2Final = calc_h2_farfield(thetaR);
|
||||
* printf("h2Final = %g\n", h2Final);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "cantera/base/Array.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
class vcs_VolPhase;
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
/*!
|
||||
* FormulaMatrix(kspec,j) = Number of elements, j, in the kspec species
|
||||
*/
|
||||
Cantera::Array2D FormulaMatrix;
|
||||
Array2D FormulaMatrix;
|
||||
|
||||
//! Specifies the species unknown type
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* @file vcs_solve.h Header file for the internal object that holds the vcs
|
||||
* equilibrium problem (see Class \link VCSnonideal::VCS_SOLVE
|
||||
* equilibrium problem (see Class \link Cantera::VCS_SOLVE
|
||||
* VCS_SOLVE\endlink and \ref equilfunctions ).
|
||||
*/
|
||||
/*
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#include "cantera/equil/vcs_internal.h"
|
||||
#include "cantera/base/Array.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
/*
|
||||
* Forward references
|
||||
|
|
@ -1531,7 +1531,7 @@ public:
|
|||
*
|
||||
* Both element and species indices are swapped.
|
||||
*/
|
||||
Cantera::Array2D m_formulaMatrix;
|
||||
Array2D m_formulaMatrix;
|
||||
|
||||
//! Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form.
|
||||
/*!
|
||||
|
|
@ -1549,7 +1549,7 @@ public:
|
|||
*
|
||||
* size = nelements0 x nspecies0
|
||||
*/
|
||||
Cantera::Array2D m_stoichCoeffRxnMatrix;
|
||||
Array2D m_stoichCoeffRxnMatrix;
|
||||
|
||||
//! Absolute size of the stoichiometric coefficients
|
||||
/*!
|
||||
|
|
@ -1629,11 +1629,11 @@ public:
|
|||
/*!
|
||||
* m_deltaMolNumPhase(iphase,irxn) = k = nc + irxn
|
||||
*/
|
||||
Cantera::Array2D m_deltaMolNumPhase;
|
||||
Array2D m_deltaMolNumPhase;
|
||||
|
||||
//! This is 1 if the phase, iphase, participates in the formation reaction
|
||||
//! irxn, and zero otherwise. PhaseParticipation(iphase,irxn)
|
||||
Cantera::Array2D m_phaseParticipation;
|
||||
Array2D m_phaseParticipation;
|
||||
|
||||
//! electric potential of the iph phase
|
||||
std::vector<double> m_phasePhi;
|
||||
|
|
@ -1931,7 +1931,7 @@ public:
|
|||
* This is a temporary array that gets regenerated every time it's
|
||||
* needed. It is not swapped wrt species.
|
||||
*/
|
||||
Cantera::Array2D m_np_dLnActCoeffdMolNum;
|
||||
Array2D m_np_dLnActCoeffdMolNum;
|
||||
|
||||
//! Molecular weight of each species
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
class vcs_VolPhase;
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ void MultiPhase::equilibrate(const std::string& XY, const std::string& solver,
|
|||
if (solver == "auto" || solver == "vcs") {
|
||||
try {
|
||||
writelog("Trying VCS equilibrium solver\n", log_level);
|
||||
VCSnonideal::vcs_MultiPhaseEquil eqsolve(this, log_level-1);
|
||||
vcs_MultiPhaseEquil eqsolve(this, log_level-1);
|
||||
int ret = eqsolve.equilibrate(ixy, estimate_equil, log_level-1,
|
||||
rtol, max_steps);
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "cantera/equil/vcs_solve.h"
|
||||
#include "cantera/equil/vcs_VolPhase.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
double VCS_SOLVE::vcs_Total_Gibbs(double* molesSp, double* chemPot,
|
||||
double* tPhMoles)
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
using namespace Cantera;
|
||||
using namespace std;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
vcs_MultiPhaseEquil::vcs_MultiPhaseEquil() :
|
||||
m_vprob(0, 0, 0),
|
||||
|
|
@ -32,7 +31,7 @@ vcs_MultiPhaseEquil::vcs_MultiPhaseEquil() :
|
|||
{
|
||||
}
|
||||
|
||||
vcs_MultiPhaseEquil::vcs_MultiPhaseEquil(Cantera::MultiPhase* mix, int printLvl) :
|
||||
vcs_MultiPhaseEquil::vcs_MultiPhaseEquil(MultiPhase* mix, int printLvl) :
|
||||
m_vprob(mix->nSpecies(), mix->nElements(), mix->nPhases()),
|
||||
m_mix(0),
|
||||
m_printLvl(printLvl)
|
||||
|
|
@ -527,7 +526,7 @@ int vcs_MultiPhaseEquil::equilibrate_TP(int estimateEquil,
|
|||
size_t kGlob = 0;
|
||||
for (size_t ip = 0; ip < m_vprob.NPhase; ip++) {
|
||||
double phaseMole = 0.0;
|
||||
Cantera::ThermoPhase& tref = m_mix->phase(ip);
|
||||
ThermoPhase& tref = m_mix->phase(ip);
|
||||
for (size_t k = 0; k < tref.nSpecies(); k++, kGlob++) {
|
||||
phaseMole += m_vprob.w[kGlob];
|
||||
}
|
||||
|
|
@ -623,7 +622,7 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile)
|
|||
vol = 0.0;
|
||||
for (size_t iphase = 0; iphase < nphase; iphase++) {
|
||||
size_t istart = m_mix->speciesIndex(0, iphase);
|
||||
Cantera::ThermoPhase& tref = m_mix->phase(iphase);
|
||||
ThermoPhase& tref = m_mix->phase(iphase);
|
||||
size_t nSpecies = tref.nSpecies();
|
||||
VolPM.resize(nSpecies, 0.0);
|
||||
tref.getPartialMolarVolumes(VCS_DATA_PTR(VolPM));
|
||||
|
|
@ -648,7 +647,7 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile)
|
|||
|
||||
for (size_t iphase = 0; iphase < nphase; iphase++) {
|
||||
size_t istart = m_mix->speciesIndex(0, iphase);
|
||||
Cantera::ThermoPhase& tref = m_mix->phase(iphase);
|
||||
ThermoPhase& tref = m_mix->phase(iphase);
|
||||
string phaseName = tref.name();
|
||||
vcs_VolPhase* volP = m_vprob.VPhaseList[iphase];
|
||||
double TMolesPhase = volP->totalMoles();
|
||||
|
|
@ -751,8 +750,7 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile)
|
|||
* HKM -> Work on transferring the current value of the voltages into the
|
||||
* equilibrium problem.
|
||||
*/
|
||||
int vcs_Cantera_to_vprob(Cantera::MultiPhase* mphase,
|
||||
VCSnonideal::VCS_PROB* vprob)
|
||||
int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob)
|
||||
{
|
||||
VCS_SPECIES_THERMO* ts_ptr = 0;
|
||||
|
||||
|
|
@ -787,7 +785,7 @@ int vcs_Cantera_to_vprob(Cantera::MultiPhase* mphase,
|
|||
/*
|
||||
* Get the ThermoPhase object - assume volume phase
|
||||
*/
|
||||
Cantera::ThermoPhase* tPhase = &(mphase->phase(iphase));
|
||||
ThermoPhase* tPhase = &(mphase->phase(iphase));
|
||||
size_t nelem = tPhase->nElements();
|
||||
|
||||
/*
|
||||
|
|
@ -1141,8 +1139,7 @@ int vcs_Cantera_to_vprob(Cantera::MultiPhase* mphase,
|
|||
return VCS_SUCCESS;
|
||||
}
|
||||
|
||||
int vcs_Cantera_update_vprob(Cantera::MultiPhase* mphase,
|
||||
VCSnonideal::VCS_PROB* vprob)
|
||||
int vcs_Cantera_update_vprob(MultiPhase* mphase, VCS_PROB* vprob)
|
||||
{
|
||||
size_t totNumPhases = mphase->nPhases();
|
||||
size_t kT = 0;
|
||||
|
|
@ -1157,7 +1154,7 @@ int vcs_Cantera_update_vprob(Cantera::MultiPhase* mphase,
|
|||
vprob->Vol = mphase->volume();
|
||||
|
||||
for (size_t iphase = 0; iphase < totNumPhases; iphase++) {
|
||||
Cantera::ThermoPhase* tPhase = &(mphase->phase(iphase));
|
||||
ThermoPhase* tPhase = &(mphase->phase(iphase));
|
||||
vcs_VolPhase* volPhase = vprob->VPhaseList[iphase];
|
||||
/*
|
||||
* Set the electric potential of the volume phase from the
|
||||
|
|
@ -1265,7 +1262,7 @@ int vcs_Cantera_update_vprob(Cantera::MultiPhase* mphase,
|
|||
return VCS_SUCCESS;
|
||||
}
|
||||
|
||||
void vcs_MultiPhaseEquil::getStoichVector(size_t rxn, Cantera::vector_fp& nu)
|
||||
void vcs_MultiPhaseEquil::getStoichVector(size_t rxn, vector_fp& nu)
|
||||
{
|
||||
size_t nsp = m_vsolve.m_numSpeciesTot;
|
||||
nu.resize(nsp, 0.0);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
vcs_SpeciesProperties::vcs_SpeciesProperties(size_t indexPhase,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "cantera/equil/vcs_solve.h"
|
||||
#include "cantera/equil/vcs_VolPhase.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
int VCS_SOLVE::vcs_TP(int ipr, int ip1, int maxit, double T_arg, double pres_arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@
|
|||
#include <sstream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
vcs_VolPhase::vcs_VolPhase(VCS_SOLVE* owningSolverObject) :
|
||||
|
|
@ -724,7 +722,7 @@ double vcs_VolPhase::_updateVolPM() const
|
|||
|
||||
if (m_totalMolesInert > 0.0) {
|
||||
if (m_gasPhase) {
|
||||
double volI = m_totalMolesInert * Cantera::GasConstant * Temp_ / Pres_;
|
||||
double volI = m_totalMolesInert * GasConstant * Temp_ / Pres_;
|
||||
m_totalVol += volI;
|
||||
} else {
|
||||
throw CanteraError("vcs_VolPhase::_updateVolPM", "unknown situation");
|
||||
|
|
@ -812,7 +810,7 @@ void vcs_VolPhase::_updateLnActCoeffJac()
|
|||
_updateActCoeff();
|
||||
}
|
||||
|
||||
void vcs_VolPhase::sendToVCS_LnActCoeffJac(Cantera::Array2D& np_LnACJac_VCS)
|
||||
void vcs_VolPhase::sendToVCS_LnActCoeffJac(Array2D& np_LnACJac_VCS)
|
||||
{
|
||||
/*
|
||||
* update the Ln Act Coeff Jacobian entries with respect to the
|
||||
|
|
@ -833,7 +831,7 @@ void vcs_VolPhase::sendToVCS_LnActCoeffJac(Cantera::Array2D& np_LnACJac_VCS)
|
|||
}
|
||||
}
|
||||
|
||||
void vcs_VolPhase::setPtrThermoPhase(Cantera::ThermoPhase* tp_ptr)
|
||||
void vcs_VolPhase::setPtrThermoPhase(ThermoPhase* tp_ptr)
|
||||
{
|
||||
TP_ptr = tp_ptr;
|
||||
if (TP_ptr) {
|
||||
|
|
@ -863,16 +861,16 @@ void vcs_VolPhase::setPtrThermoPhase(Cantera::ThermoPhase* tp_ptr)
|
|||
} else {
|
||||
int eos = TP_ptr->eosType();
|
||||
switch (eos) {
|
||||
case Cantera::cIdealGas:
|
||||
case Cantera::cIncompressible:
|
||||
case Cantera::cSurf:
|
||||
case Cantera::cMetal:
|
||||
case Cantera::cStoichSubstance:
|
||||
case Cantera::cSemiconductor:
|
||||
case Cantera::cLatticeSolid:
|
||||
case Cantera::cLattice:
|
||||
case Cantera::cEdge:
|
||||
case Cantera::cIdealSolidSolnPhase:
|
||||
case cIdealGas:
|
||||
case cIncompressible:
|
||||
case cSurf:
|
||||
case cMetal:
|
||||
case cStoichSubstance:
|
||||
case cSemiconductor:
|
||||
case cLatticeSolid:
|
||||
case cLattice:
|
||||
case cEdge:
|
||||
case cIdealSolidSolnPhase:
|
||||
m_isIdealSoln = true;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -887,7 +885,7 @@ void vcs_VolPhase::setPtrThermoPhase(Cantera::ThermoPhase* tp_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
const Cantera::ThermoPhase* vcs_VolPhase::ptrThermoPhase() const
|
||||
const ThermoPhase* vcs_VolPhase::ptrThermoPhase() const
|
||||
{
|
||||
return TP_ptr;
|
||||
}
|
||||
|
|
@ -1121,7 +1119,7 @@ std::string vcs_VolPhase::elementName(const size_t e) const
|
|||
}
|
||||
|
||||
//! This function decides whether a phase has charged species or not.
|
||||
static bool hasChargedSpecies(const Cantera::ThermoPhase* const tPhase)
|
||||
static bool hasChargedSpecies(const ThermoPhase* const tPhase)
|
||||
{
|
||||
for (size_t k = 0; k < tPhase->nSpecies(); k++) {
|
||||
if (tPhase->charge(k) != 0.0) {
|
||||
|
|
@ -1137,7 +1135,7 @@ static bool hasChargedSpecies(const Cantera::ThermoPhase* const tPhase)
|
|||
* phase. It does this by searching for charged species. If it
|
||||
* finds one, and if the phase needs one, then it returns true.
|
||||
*/
|
||||
static bool chargeNeutralityElement(const Cantera::ThermoPhase* const tPhase)
|
||||
static bool chargeNeutralityElement(const ThermoPhase* const tPhase)
|
||||
{
|
||||
int hasCharge = hasChargedSpecies(tPhase);
|
||||
if (tPhase->chargeNeutralityNecessary()) {
|
||||
|
|
@ -1148,7 +1146,7 @@ static bool chargeNeutralityElement(const Cantera::ThermoPhase* const tPhase)
|
|||
return false;
|
||||
}
|
||||
|
||||
size_t vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase* const tPhase)
|
||||
size_t vcs_VolPhase::transferElementsFM(const ThermoPhase* const tPhase)
|
||||
{
|
||||
size_t nebase = tPhase->nElements();
|
||||
size_t ne = nebase;
|
||||
|
|
@ -1280,7 +1278,7 @@ void vcs_VolPhase::setElementType(const size_t e, const int eType)
|
|||
m_elementType[e] = eType;
|
||||
}
|
||||
|
||||
const Cantera::Array2D& vcs_VolPhase::getFormulaMatrix() const
|
||||
const Array2D& vcs_VolPhase::getFormulaMatrix() const
|
||||
{
|
||||
return m_formulaMatrix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
#include "cantera/base/ctexceptions.h"
|
||||
#include "cantera/numerics/ctlapack.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
void VCS_SOLVE::vcs_elab()
|
||||
{
|
||||
|
|
@ -41,8 +39,8 @@ bool VCS_SOLVE::vcs_elabcheck(int ibound)
|
|||
*/
|
||||
if (m_elType[i] == VCS_ELEM_TYPE_CHARGENEUTRALITY &&
|
||||
m_elemAbundancesGoal[i] != 0.0) {
|
||||
throw Cantera::CanteraError("VCS_SOLVE::vcs_elabcheck",
|
||||
"Problem with charge neutrality condition");
|
||||
throw CanteraError("VCS_SOLVE::vcs_elabcheck",
|
||||
"Problem with charge neutrality condition");
|
||||
}
|
||||
if (m_elemAbundancesGoal[i] == 0.0 || (m_elType[i] == VCS_ELEM_TYPE_ELECTRONCHARGE)) {
|
||||
double scale = VCS_DELETE_MINORSPECIES_CUTOFF;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@
|
|||
#include "cantera/base/stringUtils.h"
|
||||
#include "cantera/base/ctexceptions.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
int VCS_SOLVE::vcs_elem_rearrange(double* const aw, double* const sa,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ int vcs_equilibrate_1(MultiPhase& s, int ixy,
|
|||
|
||||
if (solver == 2) {
|
||||
try {
|
||||
VCSnonideal::vcs_MultiPhaseEquil* eqsolve = new VCSnonideal::vcs_MultiPhaseEquil(&s, printLvlSub);
|
||||
vcs_MultiPhaseEquil* eqsolve = new vcs_MultiPhaseEquil(&s, printLvlSub);
|
||||
int err = eqsolve->equilibrate(ixy, estimateEquil, printLvlSub, tol, maxsteps, loglevel);
|
||||
if (err != 0) {
|
||||
retn = -1;
|
||||
|
|
@ -167,7 +167,7 @@ int vcs_determine_PhaseStability(MultiPhase& s, int iphase,
|
|||
|
||||
s.init();
|
||||
try {
|
||||
VCSnonideal::vcs_MultiPhaseEquil* eqsolve = new VCSnonideal::vcs_MultiPhaseEquil(&s, printLvlSub);
|
||||
vcs_MultiPhaseEquil* eqsolve = new vcs_MultiPhaseEquil(&s, printLvlSub);
|
||||
iStab = eqsolve->determine_PhaseStability(iphase, funcStab, printLvlSub, loglevel);
|
||||
// hard code a csv output file.
|
||||
if (printLvl > 0) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "cantera/base/clockWC.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
static char pprefix[20] = " --- vcs_inest: ";
|
||||
|
|
@ -320,7 +320,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
|
|||
int VCS_SOLVE::vcs_inest_TP()
|
||||
{
|
||||
int retn = 0;
|
||||
Cantera::clockWC tickTock;
|
||||
clockWC tickTock;
|
||||
|
||||
if (m_doEstimateEquil > 0) {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@
|
|||
#include "cantera/base/stringUtils.h"
|
||||
#include "cantera/base/ctexceptions.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
double VCS_SOLVE::vcs_nondim_Farad(int mu_units, double TKelvin) const
|
||||
{
|
||||
|
|
@ -26,12 +24,11 @@ double VCS_SOLVE::vcs_nondim_Farad(int mu_units, double TKelvin) const
|
|||
case VCS_UNITS_MKS:
|
||||
case VCS_UNITS_KJMOL:
|
||||
case VCS_UNITS_KCALMOL:
|
||||
return Cantera::ElectronCharge * Cantera::Avogadro /
|
||||
(TKelvin * Cantera::GasConstant);
|
||||
return ElectronCharge * Avogadro / (TKelvin * GasConstant);
|
||||
case VCS_UNITS_UNITLESS:
|
||||
return Cantera::ElectronCharge * Cantera::Avogadro;
|
||||
return ElectronCharge * Avogadro;
|
||||
case VCS_UNITS_KELVIN:
|
||||
return Cantera::ElectronCharge * Cantera::Avogadro/ TKelvin;
|
||||
return ElectronCharge * Avogadro/ TKelvin;
|
||||
default:
|
||||
throw CanteraError("vcs_nondim_Farad",
|
||||
"unknown units: " + int2str(mu_units));
|
||||
|
|
@ -45,15 +42,15 @@ double VCS_SOLVE::vcs_nondimMult_TP(int mu_units, double TKelvin) const
|
|||
}
|
||||
switch (mu_units) {
|
||||
case VCS_UNITS_KCALMOL:
|
||||
return TKelvin * Cantera::GasConst_cal_mol_K * 1e-3;
|
||||
return TKelvin * GasConst_cal_mol_K * 1e-3;
|
||||
case VCS_UNITS_UNITLESS:
|
||||
return 1.0;
|
||||
case VCS_UNITS_KJMOL:
|
||||
return TKelvin * Cantera::GasConstant * 1e-6;
|
||||
return TKelvin * GasConstant * 1e-6;
|
||||
case VCS_UNITS_KELVIN:
|
||||
return TKelvin;
|
||||
case VCS_UNITS_MKS:
|
||||
return TKelvin * Cantera::GasConstant;
|
||||
return TKelvin * GasConstant;
|
||||
default:
|
||||
throw CanteraError("vcs_nondimMult_TP",
|
||||
"unknown units: " + int2str(mu_units));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @file vcs_phaseStability.cpp
|
||||
* Implementation class for functions associated with determining the stability of a phase
|
||||
* (see Class \link VCSnonideal::VCS_SOLVE VCS_SOLVE\endlink and \ref equilfunctions ).
|
||||
* (see Class \link Cantera::VCS_SOLVE VCS_SOLVE\endlink and \ref equilfunctions ).
|
||||
*/
|
||||
#include "cantera/equil/vcs_solve.h"
|
||||
#include "cantera/equil/vcs_VolPhase.h"
|
||||
|
|
@ -9,9 +9,8 @@
|
|||
#include "cantera/base/ctexceptions.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
bool VCS_SOLVE::vcs_popPhasePossible(const size_t iphasePop) const
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "cantera/equil/vcs_prob.h"
|
||||
#include "cantera/equil/vcs_VolPhase.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
void VCS_SOLVE::vcs_SSPhase()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,10 +18,9 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
using namespace Cantera;
|
||||
using namespace std;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
VCS_PROB::VCS_PROB(size_t nsp, size_t nel, size_t nph) :
|
||||
|
|
@ -336,7 +335,7 @@ size_t VCS_PROB::addOnePhaseSpecies(vcs_VolPhase* volPhase, size_t k, size_t kT)
|
|||
*/
|
||||
throw CanteraError("VCS_PROB::addOnePhaseSpecies", "Shouldn't be here");
|
||||
}
|
||||
const Cantera::Array2D& fm = volPhase->getFormulaMatrix();
|
||||
const Array2D& fm = volPhase->getFormulaMatrix();
|
||||
for (size_t eVP = 0; eVP < volPhase->nElemConstraints(); eVP++) {
|
||||
size_t e = volPhase->elemGlobalIndex(eVP);
|
||||
AssertThrowMsg(e != npos, "VCS_PROB::addOnePhaseSpecies",
|
||||
|
|
@ -397,7 +396,7 @@ void VCS_PROB::reportCSV(const std::string& reportFile)
|
|||
size_t istart = iK;
|
||||
|
||||
vcs_VolPhase* volP = VPhaseList[iphase];
|
||||
const Cantera::ThermoPhase* tp = volP->ptrThermoPhase();
|
||||
const ThermoPhase* tp = volP->ptrThermoPhase();
|
||||
string phaseName = volP->PhaseName;
|
||||
size_t nSpeciesPhase = volP->nSpecies();
|
||||
volP->sendToVCS_VolPM(VCS_DATA_PTR(volPM));
|
||||
|
|
@ -425,7 +424,7 @@ void VCS_PROB::reportCSV(const std::string& reportFile)
|
|||
vol += VolPhaseVolumes;
|
||||
|
||||
if (actConvention == 1) {
|
||||
const Cantera::MolalityVPSSTP* mTP = static_cast<const Cantera::MolalityVPSSTP*>(tp);
|
||||
const MolalityVPSSTP* mTP = static_cast<const MolalityVPSSTP*>(tp);
|
||||
tp->getChemPotentials(VCS_DATA_PTR(mu));
|
||||
mTP->getMolalities(VCS_DATA_PTR(molalities));
|
||||
tp->getChemPotentials(VCS_DATA_PTR(mu));
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include <cstdio>
|
||||
using namespace std;
|
||||
|
||||
namespace VCSnonideal {
|
||||
namespace Cantera {
|
||||
static int basisOptMax1(const double * const molNum,
|
||||
const int n) {
|
||||
// int largest = 0;
|
||||
|
|
@ -38,7 +38,7 @@ namespace VCSnonideal {
|
|||
int VCS_SOLVE::vcs_rank(const double * awtmp, size_t numSpecies, const double matrix[], size_t numElemConstraints,
|
||||
std::vector<size_t> &compRes, std::vector<size_t>& elemComp, int * const usedZeroedSpecies) const
|
||||
{
|
||||
Cantera::warn_deprecated("VCS_SOLVE::vcs_rank", "To be removed after Cantera 2.2");
|
||||
warn_deprecated("VCS_SOLVE::vcs_rank", "To be removed after Cantera 2.2");
|
||||
int lindep;
|
||||
size_t j, k, jl, i, l, ml;
|
||||
int numComponents = 0;
|
||||
|
|
@ -279,7 +279,7 @@ namespace VCSnonideal {
|
|||
|
||||
if (numComponentsR != numComponents) {
|
||||
printf("vcs_rank ERROR: number of components are different: %d %d\n", numComponentsR, numComponents);
|
||||
throw Cantera::CanteraError("vcs_rank ERROR:",
|
||||
throw CanteraError("vcs_rank ERROR:",
|
||||
" logical inconsistency");
|
||||
exit(-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "cantera/equil/vcs_solve.h"
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
int VCS_SOLVE::vcs_rearrange()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@
|
|||
#include "cantera/equil/vcs_VolPhase.h"
|
||||
#include "cantera/base/ctexceptions.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
int VCS_SOLVE::vcs_report(int iconv)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
#define TOL_CONV 1.0E-5
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
static void printProgress(const vector<string> &spName,
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@
|
|||
#include "cantera/base/clockWC.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
int vcs_timing_print_lvl = 1;
|
||||
|
|
@ -49,7 +48,7 @@ VCS_SOLVE::VCS_SOLVE() :
|
|||
m_totalMoleScale(1.0),
|
||||
m_useActCoeffJac(0),
|
||||
m_totalVol(0.0),
|
||||
m_Faraday_dim(Cantera::ElectronCharge* Cantera::Avogadro),
|
||||
m_Faraday_dim(ElectronCharge * Avogadro),
|
||||
m_VCount(0),
|
||||
m_debug_print_lvl(0),
|
||||
m_timing_print_lvl(1),
|
||||
|
|
@ -77,18 +76,18 @@ void VCS_SOLVE::vcs_initSizes(const size_t nspecies0, const size_t nelements,
|
|||
string ser = "VCS_SOLVE: ERROR:\n\t";
|
||||
if (nspecies0 <= 0) {
|
||||
plogf("%s Number of species is nonpositive\n", ser.c_str());
|
||||
throw Cantera::CanteraError("VCS_SOLVE()", ser +
|
||||
" Number of species is nonpositive\n");
|
||||
throw CanteraError("VCS_SOLVE()", ser +
|
||||
" Number of species is nonpositive\n");
|
||||
}
|
||||
if (nelements <= 0) {
|
||||
plogf("%s Number of elements is nonpositive\n", ser.c_str());
|
||||
throw Cantera::CanteraError("VCS_SOLVE()", ser +
|
||||
" Number of species is nonpositive\n");
|
||||
throw CanteraError("VCS_SOLVE()", ser +
|
||||
" Number of species is nonpositive\n");
|
||||
}
|
||||
if (nphase0 <= 0) {
|
||||
plogf("%s Number of phases is nonpositive\n", ser.c_str());
|
||||
throw Cantera::CanteraError("VCS_SOLVE()", ser +
|
||||
" Number of species is nonpositive\n");
|
||||
throw CanteraError("VCS_SOLVE()", ser +
|
||||
" Number of species is nonpositive\n");
|
||||
}
|
||||
|
||||
m_VCS_UnitsFormat = VCS_UNITS_UNITLESS;
|
||||
|
|
@ -245,7 +244,7 @@ void VCS_SOLVE::vcs_delete_memory()
|
|||
int VCS_SOLVE::vcs(VCS_PROB* vprob, int ifunc, int ipr, int ip1, int maxit)
|
||||
{
|
||||
int retn = 0, iconv = 0;
|
||||
Cantera::clockWC tickTock;
|
||||
clockWC tickTock;
|
||||
|
||||
int iprintTime = std::max(ipr, ip1);
|
||||
iprintTime = std::min(iprintTime, m_timing_print_lvl);
|
||||
|
|
@ -553,7 +552,7 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
|
|||
if (pub->PresPA > 0.0) {
|
||||
m_pressurePA = pub->PresPA;
|
||||
} else {
|
||||
m_pressurePA = Cantera::OneAtm;
|
||||
m_pressurePA = OneAtm;
|
||||
}
|
||||
/*
|
||||
* TPhInertMoles[] -> must be copied over here
|
||||
|
|
|
|||
|
|
@ -19,14 +19,12 @@
|
|||
#include <cstdio>
|
||||
|
||||
using namespace std;
|
||||
using namespace Cantera;
|
||||
|
||||
namespace {
|
||||
enum stages {MAIN, EQUILIB_CHECK, ELEM_ABUND_CHECK,
|
||||
RECHECK_DELETED, RETURN_A, RETURN_B};
|
||||
}
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
void VCS_SOLVE::checkDelta1(double* const dsLocal,
|
||||
|
|
@ -77,7 +75,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
|
|||
* Initialize and set up all counters
|
||||
*/
|
||||
vcs_counters_init(0);
|
||||
Cantera::clockWC ticktock;
|
||||
clockWC ticktock;
|
||||
|
||||
/*
|
||||
* Malloc temporary space for usage in this routine and in
|
||||
|
|
@ -2519,7 +2517,7 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[],
|
|||
size_t juse = npos;
|
||||
size_t jlose = npos;
|
||||
double* scrxn_ptr;
|
||||
Cantera::clockWC tickTock;
|
||||
clockWC tickTock;
|
||||
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
|
||||
plogf(" ");
|
||||
for (size_t i=0; i<77; i++) {
|
||||
|
|
@ -3627,7 +3625,7 @@ void VCS_SOLVE::vcs_printSpeciesChemPot(const int stateCalc) const
|
|||
}
|
||||
}
|
||||
|
||||
double RT = m_temperature * Cantera::GasConstant;
|
||||
double RT = m_temperature * GasConstant;
|
||||
printf(" --- CHEMICAL POT TABLE (J/kmol) Name PhID MolFR ChemoSS "
|
||||
" logMF Gamma Elect extra ElectrChem\n");
|
||||
printf(" ");
|
||||
|
|
@ -3665,7 +3663,7 @@ void VCS_SOLVE::vcs_printSpeciesChemPot(const int stateCalc) const
|
|||
printf(" --- ");
|
||||
}
|
||||
printf("%-24.24s", m_speciesName[kspec].c_str());
|
||||
printf(" %-3s", Cantera::int2str(iphase).c_str());
|
||||
printf(" %-3s", int2str(iphase).c_str());
|
||||
printf(" % -12.4e", mfValue);
|
||||
printf(" % -12.4e", m_SSfeSpecies[kspec] * RT);
|
||||
printf(" % -12.4e", log(mfValue) * RT);
|
||||
|
|
@ -4088,7 +4086,7 @@ void VCS_SOLVE::vcs_printDeltaG(const int stateCalc)
|
|||
actCoeff_ptr = VCS_DATA_PTR(m_actCoeffSpecies_new);
|
||||
tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_new);
|
||||
}
|
||||
double RT = m_temperature * Cantera::GasConstant;
|
||||
double RT = m_temperature * GasConstant;
|
||||
bool zeroedPhase = false;
|
||||
if (m_debug_print_lvl >= 2) {
|
||||
plogf(" --- DELTA_G TABLE Components:");
|
||||
|
|
@ -4167,7 +4165,7 @@ void VCS_SOLVE::vcs_printDeltaG(const int stateCalc)
|
|||
feFull += log(actCoeff_ptr[kspec]) + log(mfValue);
|
||||
}
|
||||
printf("%-24.24s", m_speciesName[kspec].c_str());
|
||||
printf(" %-3s", Cantera::int2str(iphase).c_str());
|
||||
printf(" %-3s", int2str(iphase).c_str());
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
printf(" NA ");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
int VCS_SOLVE::vcs_PS(VCS_PROB* vprob, int iphase, int printLvl, double& feStable)
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@
|
|||
#include "cantera/equil/vcs_internal.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(size_t indexPhase,
|
||||
size_t indexSpeciesPhase) :
|
||||
|
|
@ -99,8 +97,8 @@ double VCS_SPECIES_THERMO::GStar_R_calc(size_t kglob, double TKelvin,
|
|||
double T = TKelvin;
|
||||
if (UseCanteraCalls) {
|
||||
if (m_VCS_UnitsFormat != VCS_UNITS_MKS) {
|
||||
throw Cantera::CanteraError("VCS_SPECIES_THERMO::GStar_R_calc",
|
||||
"Possible inconsistency");
|
||||
throw CanteraError("VCS_SPECIES_THERMO::GStar_R_calc",
|
||||
"Possible inconsistency");
|
||||
}
|
||||
size_t kspec = IndexSpeciesPhase;
|
||||
OwningPhase->setState_TP(TKelvin, pres);
|
||||
|
|
@ -131,8 +129,8 @@ double VCS_SPECIES_THERMO::VolStar_calc(size_t kglob, double TKelvin,
|
|||
double T = TKelvin;
|
||||
if (UseCanteraCalls) {
|
||||
if (m_VCS_UnitsFormat != VCS_UNITS_MKS) {
|
||||
throw Cantera::CanteraError("VCS_SPECIES_THERMO::VolStar_calc",
|
||||
"Possible inconsistency");
|
||||
throw CanteraError("VCS_SPECIES_THERMO::VolStar_calc",
|
||||
"Possible inconsistency");
|
||||
}
|
||||
size_t kspec = IndexSpeciesPhase;
|
||||
OwningPhase->setState_TP(TKelvin, presPA);
|
||||
|
|
@ -143,7 +141,7 @@ double VCS_SPECIES_THERMO::VolStar_calc(size_t kglob, double TKelvin,
|
|||
vol = SSStar_Vol0;
|
||||
break;
|
||||
case VCS_SSVOL_IDEALGAS:
|
||||
vol= Cantera::GasConstant * T / presPA;
|
||||
vol= GasConstant * T / presPA;
|
||||
break;
|
||||
default:
|
||||
throw CanteraError("VCS_SPECIES_THERMO::VolStar_calc",
|
||||
|
|
@ -164,8 +162,8 @@ double VCS_SPECIES_THERMO::G0_R_calc(size_t kglob, double TKelvin)
|
|||
}
|
||||
if (UseCanteraCalls) {
|
||||
if (m_VCS_UnitsFormat != VCS_UNITS_MKS) {
|
||||
throw Cantera::CanteraError("VCS_SPECIES_THERMO::G0_R_calc",
|
||||
"Possible inconsistency");
|
||||
throw CanteraError("VCS_SPECIES_THERMO::G0_R_calc",
|
||||
"Possible inconsistency");
|
||||
}
|
||||
size_t kspec = IndexSpeciesPhase;
|
||||
OwningPhase->setState_T(TKelvin);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@
|
|||
#include <cstring>
|
||||
|
||||
using namespace std;
|
||||
using namespace Cantera;
|
||||
|
||||
namespace VCSnonideal
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
double vcs_l2norm(const std::vector<double> vec)
|
||||
|
|
@ -78,16 +77,16 @@ double vcsUtil_gasConstant(int mu_units)
|
|||
{
|
||||
switch (mu_units) {
|
||||
case VCS_UNITS_KCALMOL:
|
||||
return Cantera::GasConst_cal_mol_K * 1e-3;
|
||||
return GasConst_cal_mol_K * 1e-3;
|
||||
case VCS_UNITS_UNITLESS:
|
||||
return 1.0;
|
||||
case VCS_UNITS_KJMOL:
|
||||
return Cantera::GasConstant * 1e-6;
|
||||
return GasConstant * 1e-6;
|
||||
case VCS_UNITS_KELVIN:
|
||||
return 1.0;
|
||||
case VCS_UNITS_MKS:
|
||||
/* joules / kg-mol K = kg m2 / s2 kg-mol K */
|
||||
return Cantera::GasConstant;
|
||||
return GasConstant;
|
||||
default:
|
||||
throw CanteraError("vcsUtil_gasConstant",
|
||||
"uknown units: " + int2str(mu_units));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ void testProblem()
|
|||
{
|
||||
suppress_deprecation_warnings();
|
||||
double T = 273.15 + 352.0;
|
||||
VCSnonideal::vcs_timing_print_lvl = 0;
|
||||
vcs_timing_print_lvl = 0;
|
||||
|
||||
// Create the phases
|
||||
std::auto_ptr<ThermoPhase> LiSi_solid(newPhase("Li7Si3_ls.xml",
|
||||
|
|
@ -49,7 +49,7 @@ void testProblem()
|
|||
printf("um_li_chempot = %g\n", um_li_chempot);
|
||||
LiFixed.setChemicalPotential(um_li_chempot);
|
||||
|
||||
Cantera::MultiPhase mmm;
|
||||
MultiPhase mmm;
|
||||
|
||||
mmm.addPhase(&salt, 10.);
|
||||
mmm.addPhase(LiSi_solid.get(), 1.);
|
||||
|
|
@ -61,7 +61,7 @@ void testProblem()
|
|||
mmm.equilibrate("TP", "vcs", 1e-9, 50000, 100, estimateEquil, printLvl);
|
||||
std::cout << mmm << std::endl;
|
||||
|
||||
Cantera::appdelete();
|
||||
appdelete();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ int main(int argc, char** argv)
|
|||
int numFail = 0;
|
||||
int printLvl = 1;
|
||||
string inputFile = "HMW_NaCl.xml";
|
||||
VCSnonideal::vcs_timing_print_lvl = 0;
|
||||
vcs_timing_print_lvl = 0;
|
||||
|
||||
/*
|
||||
* Process the command line arguments
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue