Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes

SpecSolution Class Reference

#include <SpecSolution.h>

Inheritance diagram for SpecSolution:
Solution Phase COHSClFGasSol COHSGasSol SpecSolNID DMWvapor DuanetalVaporSolution SulfLiq

List of all members.

Public Member Functions

 SpecSolution ()
 generic constructor.
virtual ~SpecSolution ()
 generic destructor.
int getNspec (void)
 returns number of species
virtual const char * getSpecName (int i)
 returns pointer to species name
virtual const char * getSpecFormula (int i)
 returns pointer to species formula
virtual void setTk (double ltk)
 set phase temperature in Kelvins
virtual void setPa (double lpa)
 set phase pressure in Pascals
virtual void setMoles (double m) throw (PhaseError *)
virtual void setComps (double *lcomps)
virtual void setSpecs (double *lspecs)
virtual void setSpecsFull (double *lspecs)
 like setSpecs except all potential species are activated
virtual void getSpecs (double *lspecs)
 Get phase species abundances in moles.
double getGibbs ()
 Gibbs free energy at T,P,X.
virtual double getMu0 (int ispec)
 standard-state chemical potential at T and P.
virtual double getMu (int i)
 chemical potential of component in J/mole. Calls getCompMu()
virtual double getCompMu (int i)
 chemical potential of component
virtual double getSpecMu (int i)
 chemical potential of species
virtual double getdMudX (int i, int j)
 dMu[i]/dX[j] for components.
virtual void getd2Gdm2 (double **d2gdm2)
 get second derivative of G with respect to component vector.
virtual void getd3Gdm3 (double ***d3Gdm3)
 third derivative of G with respect to composition. Not yet implemented.
double getGmix ()
 mixing component of Gibbs free energy in Joules
virtual double getEnthalpy ()
 enthalpy at T,P,X
virtual double getHmix ()
 enthalpy of mixing in Joules
virtual double getEntropy ()
 entropy at T,P,X
virtual void getdSdm (double *dsdm)
 derivative of entropy with respect to mole vector
virtual void getd2Sdm2 (double **d2sdm2)
 second derivative of entropy with respect to mole vector
virtual double getSmix ()
 entropy of mixing in Joules/Kelvin
virtual double getCp ()
 heat capacity.
virtual double getdCpdT ()
 dCp/dT
virtual double getVolume ()
 volume in cubic meters
virtual double getVmix ()
 volume of mixing in cubic meters (Joules/Pascal)
virtual double getdVdT ()
 dVdt in M^3/K
virtual void supressSpecies (int i)
 suppress formation of species i. Cannot supress component.
virtual void setSpeciateTolerance (double tol)
 Set fractional convergence tolerance for homogeneous equilibrium calculation.
virtual void update ()
 Calculates homogenious equilibrium. Replaces dummy routine in Phase.
virtual double getSpecCalcErr ()
 returns error in last homogenious speciation calculation (Joules)
virtual int isUpdated ()
 returns boolean indicating if hom. eq. calculated for curr. conditions
virtual void printAll ()
 prints most properties of phase

Public Attributes

int verbose
 flag for verbose progress output during equilibration. 0 by default.

Protected Member Functions

virtual int speciate ()
virtual int speciate_function (double tol)
virtual void init ()
 space allocation and variable initialization
virtual int fillSpecs ()
 transfers comps to specs
virtual void fillComps ()
 transfers specs to comps
virtual void index ()
 index non-zero species
virtual void getd2Gds2 (double **d2gds2)
virtual void getd3Gds2dT (double **d3gds2dt)
 derivative of dmu/ds (d2G/ds2) with respect to T
virtual void getd3Gds3 (double ***d3gds3)
virtual void getdSds (double *dsds)
virtual void getdVds (double *dsds)
virtual void updateTransformKernel ()
virtual double dmufunc (int m, int p, double *s)

Protected Attributes

int * supressSpec
 nspec array of boolean to indicate species should be suppressed
int * rdx
double * mu
 species chemical potentials
double ** dmuds
 species hessian (indexed in reduced coordinates)
double ** K
double ** m1
 generic working space
double ** m2
double ** m3
double * v1
double * v2
double *** mmm
double * specs
 Vector of species moles.
double specSum
 sum of species moles
double ** spstoich
 Species stoichiometries [nspec][ncomp].First ncomp rows MUST be identity.
double ** nu
 reaction stoich. matrix. Indexed on non-zero species and reactions
int nuRank
 rank of nu matrix
double * specCharge
 vector of species charges (NULL if no charge balance constraints)

Static Protected Attributes

static const int TSUPRESS = 1
static const int PSUPRESS = 2
static const int SUPRESS = 4

Private Attributes

double spectol
 tolerance for speciation
double * rhs
 speciation variables and arrays
double * psi
double * b
double * bm
double * delta

Detailed Description

Generic class to deal with associated solutions. In generic case ideal mixing assumed. First ncomp species MUST correspond to components. nmoles is total of component moles. This will NOT correspond to sum of species moles. version 1.1 added RAND algorithm. Moved some stuff here from SpecSolNID. `version 1.33 added capability to handle charge balance constraints.

Author:
Victor Kress
Version:
Revision:
1.35

Definition at line 24 of file SpecSolution.h.


Member Function Documentation

virtual double SpecSolution::dmufunc ( int  m,
int  p,
double *  s 
) [protected, virtual]

function that returns dmu[m]/dx[p] for species. Maintained as separate function (not incorporated in d2Gds2()) because flexibility required for speciation calculations. DEPRECATED! Do not use in new applications.

Parameters:
m species number
p species number
s species moles

Reimplemented in DMWvapor, and SpecSolNID.

virtual void SpecSolution::getd2Gds2 ( double **  d2gds2  )  [protected, virtual]

returns current d2G/ds2 at constant xi, where s is species vector. Reduced coordinates.

Reimplemented in SpecSolNID.

virtual void SpecSolution::getd3Gds3 ( double ***  d3gds3  )  [protected, virtual]

returns current d3G/ds3 at constant xi, where s is species vector. Reduced coordinates.

Reimplemented in SpecSolNID.

virtual void SpecSolution::getdSds ( double *  dsds  )  [protected, virtual]

returns dS/ds at constant xi, where s is species vector. Reduced coordinates.

virtual void SpecSolution::getdVds ( double *  dsds  )  [protected, virtual]

returns dV/ds at constant xi, where s is species vector. Reduced coordinates.

virtual void SpecSolution::setComps ( double *  lcomps  )  [virtual]

Set component vector in moles. Species filled but not equilibrated.

Reimplemented from Solution.

virtual void SpecSolution::setMoles ( double  m  )  throw (PhaseError *) [virtual]

set total moles. This is sum of component moles. Sum of species moles will be different, and dependent on speciation.

Reimplemented from Solution.

virtual void SpecSolution::setSpecs ( double *  lspecs  )  [virtual]

Set species vector in moles. Components set automatically. Not automatically equilibrated. Only non-zero species will be included in calculations.

virtual int SpecSolution::speciate (  )  [protected, virtual]

Calculates homogenious equilibrium. Invoked by update()

Returns:
number of iterations to convergence
virtual int SpecSolution::speciate_function ( double  tol  )  [protected, virtual]

Guts of speciation routine. Ideal solution assumed. Implements RAND speciation algorithm as presented in: Smith and Missen (1982) Chemical Reaction Equilibrium Analysis: Theory and Algorithms. Krieger. Gf is vector of standard state chemical potentials at T

Reimplemented in SpecSolNID.

virtual void SpecSolution::updateTransformKernel (  )  [protected, virtual]

update transform kernel for most property transforms. Reduced coordinates.

See also:
K

Member Data Documentation

double** SpecSolution::K [protected]

transform kernel for calculating most property derivatives. Indexed to non-zero species.

Definition at line 149 of file SpecSolution.h.

const int SpecSolution::PSUPRESS = 2 [static, protected]

Supress species because of P bound violation

See also:
suppressSpec

Definition at line 136 of file SpecSolution.h.

int* SpecSolution::rdx [protected]

indexing array used to eliminate unused reactions. r is recalculated from lcomp and lspec as needed.

Definition at line 142 of file SpecSolution.h.

const int SpecSolution::SUPRESS = 4 [static, protected]

Supress species for any reason

See also:
suppressSpec

Definition at line 139 of file SpecSolution.h.

const int SpecSolution::TSUPRESS = 1 [static, protected]

Supress species because of T bound violation

See also:
suppressSpec

Definition at line 133 of file SpecSolution.h.


The documentation for this class was generated from the following file: