Added a special constructor for setting the element potential directly.
This commit is contained in:
parent
9373fe02f7
commit
c7ce446b32
2 changed files with 66 additions and 10 deletions
|
|
@ -22,8 +22,9 @@
|
|||
#include "SpeciesThermo.h"
|
||||
#include "ThermoFactory.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <string>
|
||||
#include "SimpleThermo.h"
|
||||
namespace Cantera {
|
||||
//====================================================================================================================
|
||||
/*
|
||||
|
|
@ -96,6 +97,38 @@ namespace Cantera {
|
|||
chemPot_ = (m_h0_RT[0] - m_s0_R[0]) * GasConstant * temperature();
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
FixedChemPotSSTP::FixedChemPotSSTP(std::string Ename, doublereal val) :
|
||||
SingleSpeciesTP(),
|
||||
chemPot_(0.0)
|
||||
{
|
||||
|
||||
std::string pname = Ename + "Fixed";
|
||||
setID(pname);
|
||||
setName(pname);
|
||||
setNDim(3);
|
||||
addUniqueElement(Ename, -12345.);
|
||||
freezeElements();
|
||||
int nel = nElements();
|
||||
vector_fp ecomp(nel, 0.0);
|
||||
ecomp[0] = 1.0;
|
||||
double chrg = 0.0;
|
||||
SpeciesThermo* spth = new SimpleThermo();
|
||||
setSpeciesThermo(spth);
|
||||
addUniqueSpecies(pname, &ecomp[0], chrg, 0.0);
|
||||
double c[4];
|
||||
c[0] = 298.15;
|
||||
c[1] = val;
|
||||
c[2] = 0.0;
|
||||
c[3] = 0.0;
|
||||
m_spthermo->install(pname, 0, SIMPLE, c, 0.0, 1.0E30, OneAtm);
|
||||
freezeSpecies();
|
||||
initThermo();
|
||||
m_p0 = OneAtm;
|
||||
m_tlast = 298.15;
|
||||
setChemicalPotential(val);
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
// Copy constructor
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -76,9 +76,11 @@ namespace Cantera {
|
|||
*
|
||||
* <b> Instanteation of the Class </b>
|
||||
*
|
||||
* The constructor for this phase is located in the default ThermoFactory
|
||||
* for %Cantera. A new %FixedChemPotSSTP may be created by a standalone xml file
|
||||
* which is given below.
|
||||
* This phase may be instanteated by calling the default ThermoFactory routine
|
||||
* for %Cantera. This new %FixedChemPotSSTP object must then have a standalone xml file
|
||||
* description an example of which is given below.
|
||||
*
|
||||
*
|
||||
*
|
||||
* It may also be created by the following code snippets. The code
|
||||
* includes the special member function setChemicalPotential( chempot), which
|
||||
|
|
@ -101,13 +103,19 @@ namespace Cantera {
|
|||
* importPhase(*xm, &solid);
|
||||
* @endcode
|
||||
*
|
||||
* The phase may also be created by a special constructor so that element
|
||||
* potentials may be set. The constructor takes the name of the element and
|
||||
* the value of the element chemical potential. An example is given below.
|
||||
*
|
||||
* @code
|
||||
* FixedChemPotSSTP *LiFixed = new FixedChemPotSSTP("Li", -2.3E7);
|
||||
* @endcode
|
||||
*
|
||||
* <b> XML Example </b>
|
||||
*
|
||||
* The phase model name for this is called StoichSubstance. It must be supplied
|
||||
* The phase model name for this is called FixedChemPot. It must be supplied
|
||||
* as the model attribute of the thermo XML element entry.
|
||||
* Within the phase XML block,
|
||||
* the density of the phase must be specified. An example of an XML file
|
||||
* this phase is given below.
|
||||
*
|
||||
*
|
||||
* @verbatim
|
||||
<?xml version="1.0"?>
|
||||
|
|
@ -182,6 +190,18 @@ namespace Cantera {
|
|||
* @param right Object to be copied
|
||||
*/
|
||||
FixedChemPotSSTP(const FixedChemPotSSTP &right);
|
||||
|
||||
//! Special constructor for the FixecChemPotSSTP class setting an element chemical
|
||||
//! potential directly
|
||||
/*!
|
||||
* This will create a %FixedChemPotSSTP consisting of a single species with the
|
||||
* stoichiometry of one of the specified atom. It will have a chemical potential
|
||||
* that is given by the second argument.
|
||||
*
|
||||
* @param Ename String name of the element
|
||||
* @param chemPot Value of the chemical potential of that element (J/kmol)
|
||||
*/
|
||||
FixedChemPotSSTP(std::string Ename, doublereal chemPot);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
|
|
@ -619,8 +639,11 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
|
||||
|
||||
double chemPot_;
|
||||
//! Value of the chemical potential of the bath species
|
||||
/*!
|
||||
* units are J/kmol
|
||||
*/
|
||||
doublereal chemPot_;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue