Public Member Functions | Protected Member Functions | Protected Attributes

Solution Class Reference

#include <Solution.h>

Inheritance diagram for Solution:
Phase FeNiMet MeltsSolution RegularSolution SilicateLiq SpecSolution AlloyLiquid AlloySolid Biotite Clinoamphibole Clinopyroxene Cummingtonite Feldspar Garnet Hornblende Kalsilite Leucite Melilite Nepheline Olivine Orthoamphibole Orthopyroxene RhmOxide Spinel FeNiLiq FeNiMetChuang COHSClFGasSol COHSGasSol SpecSolNID

List of all members.

Public Member Functions

 Solution ()
 Generic constructor. Assumes STP.
virtual ~Solution ()
 destructor
int getNcomp (void)
 Returns number of components in system.
virtual double getMW (int i)
 Returns molecular weight of component i.
virtual double getMW ()
 Returns gram formula weight of solution.
virtual int getCompNo (char *lab)
virtual const char * getCompName (int i)
virtual const char * getCompFormula (int i)
virtual void setTk (double ltk)
 set temperature in Kelvins
virtual void setPa (double lpa)
 set pressure in Pascals
virtual void setMoles (double m) throw (PhaseError *)
virtual void setMass (double w)
 set total mass of solution in grams.
virtual void setComps (double *rawcomps)
 Set component moles. Coppies values to internal array.
virtual void setCompWeights (double *wt)
virtual void setCompWtPct (double *wt)
virtual void setElements (double *ele) throw (PhaseError *)
virtual void resetTPbounds (double lowTbound, double hiTbound, double lowPbound, double hiPbound)
double getMoles ()
 returns sum of moles of components
double getMass ()
 returns total mass of phase in grams
virtual void getComps (double *rawcomps)
 Returns component moles in caller-allocated vector.
virtual void getCompWeights (double *wt)
 Returns component grams in caller-allocated vector.
virtual void getCompWtPct (double *wt)
 Returns components in weight percent. Does not allocate space.
virtual void getElements (double *ele)
 Returns moles of elements in caller-allocated space.
virtual void getAddElements (double *ele, double mol)
virtual double getGibbs ()
 Returns Gibbs free energy relative to elements at STP in J.
virtual double getMu0 (int icomp)
 returns single standard state chemical potential in J/mole
virtual void getMu0 (double *m0)
virtual double getMu (int i)
 Returns chemical potential in J/mole.
virtual void getMu (double *m)
virtual double getActivity (int icomp)
 Returns single activity.
virtual void getActivity (double *a)
virtual double getdMudX (int i, int j)
 Returns dMu[i]/dX[j]).
virtual double getdMudP (int i)
 Returns partial molar volume in m^3.
virtual void getdGdm (double *dgdm)
virtual void getd2Gdm2 (double **d2gdm2)
virtual void getd3Gdm3 (double ***d3gdm3)
virtual void getHessian (double **h)
virtual double ** getHessian ()
virtual double getGmix ()
 Mixing contribution to Gibbs free energy. Hmix - T*Smix.
virtual double getEnthalpy ()
 Returns enthalpy in Joules. Ideal solution assumed.
virtual double getEntropy ()
 Returns entropy in Joules/Kelvin. Ideal solution assumed.
virtual void getdSdm (double *dsdm)
virtual void getd2Sdm2 (double **d2sdm2)
virtual double getSmix ()
 Entropy of mixing. Ideal in generic case.
virtual double getCp ()
 Constant-pressure heat capacity in Joules/Kelvin.
virtual double getdCpdT ()
 derivative of Cp with respect to temperature
virtual void getdCpdm (double *dcpdm)
 derivative of Cp with respect to composition.
virtual double getVolume ()
 Volume in cubic meters = Joules/Pascal.
virtual void getdVdm (double *dvdm)
 derivative of volume with respect to composition.
virtual void getd2Vdm2 (double **d2vdm2)
 second derivative of volume with respect to composition.
virtual double getdVdT ()
 dV/dT in M^3/Kelvin
virtual double getdVdP ()
 dV/dP in M^3/Pascal
virtual double getd2VdT2 ()
 d2V/dT2 in M^3/Kelvin^2
virtual double getd2VdTdP ()
 d2V/dTdP in M^3/KelvinPascal
virtual double getd2VdP2 ()
 d2V/dP2 in M^3/Pascal^2
virtual void getd2VdmdT (double *d2vdmdt)
 d2VdmdT in M^3/KelvinMole
virtual void getd2VdmdP (double *d2vdmdp)
 d2VdmdP in M^3/PascalMole
virtual int isStable ()
virtual void testHessian (double step)
 Finite difference tester routine for hessian.
virtual void update ()
 brings all internal variables to self-consistent equilibrium state
virtual void printAll ()
 prints almost everything about solution

Protected Member Functions

virtual void index ()
 index non-zero species
virtual void init ()
virtual int initElOxArrays ()

Protected Attributes

int nspec
 number of species. In Solutions set equal to ncomp in init().
int lcomp
 number of non-zero components. Set in index().
int lspec
 number of non-zero species. In Solutions ALWAYS equal to lcomp.
int * indx
 indexing array used to eliminate zero species
double * comps
 vector of components
Phase ** ss
 vector of standard state properties
double ** hessian
 Gibbs Hessian.
double ** A
 working space for SVD calculations
double ** v
double * w

Detailed Description

solution class. Generic class for Phases which are simple solutions. In generic implementation, ideal mixing is assumed. Converted to extensive properties 4/14/03

Id:
Solution.h,v 1.34 2008/05/30 01:15:14 kress Exp
Author:
Victor Kress
Version:
Revision:
1.34

Definition at line 20 of file Solution.h.


Member Function Documentation

virtual void Solution::getActivity ( double *  a  )  [virtual]

component activities

Parameters:
a user provide ncomp vector to hold results.

Reimplemented from Phase.

Reimplemented in MeltsSolution.

virtual void Solution::getAddElements ( double *  ele,
double  mol 
) [virtual]

Same as getElements but adds nmoles of phase elements to input array. Don't know why you would want this. Implemented for consistent behavior with single-component phases.

Reimplemented from Phase.

virtual const char* Solution::getCompFormula ( int  i  )  [virtual]

Returns pointer to component formula. Caution: string destroyed with Solution object.

Reimplemented from Phase.

Reimplemented in SilicateLiq.

virtual const char* Solution::getCompName ( int  i  )  [virtual]

Returns pointer to component name. Caution: string destroyed with Solution object.

Reimplemented from Phase.

Reimplemented in SilicateLiq.

virtual int Solution::getCompNo ( char *  lab  )  [virtual]

gets component number for input string. Match must be exact.

Parameters:
lab char* to name of phase
Returns:
integer index or -1 if not found.

Reimplemented from Phase.

virtual void Solution::getd2Gdm2 ( double **  d2gdm2  )  [virtual]

second derivative of Gibbs free energy with respect to moles (Joules/mole). param d2gdm2 ncomp by ncomp array to hold results.

Reimplemented from Phase.

Reimplemented in FeNiMet, MeltsSolution, RegularSolution, and SpecSolution.

virtual void Solution::getd2Sdm2 ( double **  d2sdm2  )  [virtual]

second derivative of entropy with respect to moles (Joules/(mole^2.Kelvin). Ideal mixing assumed.

Parameters:
d2sdm2 ncomp by ncomp array to store result

Reimplemented from Phase.

Reimplemented in MeltsSolution, and SpecSolution.

virtual void Solution::getd3Gdm3 ( double ***  d3gdm3  )  [virtual]

third derivative of Gibbs free energy with respect to moles (Joules/mole). param d3gdm3 ncomp by ncomp by ncomp array to hold results.

Reimplemented from Phase.

Reimplemented in MeltsSolution, RegularSolution, and SpecSolution.

virtual void Solution::getdGdm ( double *  dgdm  )  [virtual]

derivative of Gibbs free energy with respect to moles (Joules/mole). param dgdm ncomp vector to hold results.

Reimplemented from Phase.

Reimplemented in MeltsSolution.

virtual void Solution::getdSdm ( double *  dsdm  )  [virtual]

derivative of entropy with respect to moles (Joules/(mole.Kelvin). Ideal mixing assumed.

Parameters:
dsdm ncomp vector to store result

Reimplemented from Phase.

Reimplemented in MeltsSolution, and SpecSolution.

virtual void Solution::getHessian ( double **  h  )  [virtual]

calculates Gubbs Hessian and returns in user-allocated space.

Parameters:
h ncomp by ncomp array to hold Gibbs Hessian.

Reimplemented from Phase.

virtual double** Solution::getHessian (  )  [virtual]

calculates and returns pointer to Gibbs Hessian. This version is deprecated because it doesn't follow memory allocation standard. it will eventually become protected;

virtual void Solution::getMu ( double *  m  )  [virtual]

chemical potential in Joules.

Returns:
potential of all components in joules.

Reimplemented from Phase.

Reimplemented in MeltsSolution.

virtual void Solution::getMu0 ( double *  m0  )  [virtual]

standard state chemical potential in Joules.

Returns:
potential of all components in joules.

Reimplemented from Phase.

virtual void Solution::init (  )  [protected, virtual]
virtual int Solution::initElOxArrays (  )  [protected, virtual]

Initializes stoichiometric arrays from information in ss array. Must be called after members of ss array initialized.

virtual int Solution::isStable (  )  [virtual]

Checks for phase stability by Hessian test.

Returns:
1 for stable, 0 if not.

Reimplemented from Phase.

virtual void Solution::resetTPbounds ( double  lowTbound,
double  hiTbound,
double  lowPbound,
double  hiPbound 
) [virtual]

used to reset default bounds for temperature and pressure.

Parameters:
lowTbound new lower temperature bound
hiTbound new upper temperature bound
lowPbound new lower pressure bound
hiPbound new upper pressure bound

Reimplemented from Phase.

virtual void Solution::setCompWeights ( double *  wt  )  [virtual]

sets component weights in kg

Parameters:
wt ncomp array of grams of each component.

Reimplemented from Phase.

virtual void Solution::setCompWtPct ( double *  wt  )  [virtual]

sets components from vector in weight percent (nmoles set to 1.0) Maintained for backward compatibility

Reimplemented from Phase.

virtual void Solution::setElements ( double *  ele  )  throw (PhaseError *) [virtual]

Set moles of elements.

Parameters:
ele Moles of elements on entry, remainder after max phase comp removed on exit.

Reimplemented from Phase.

Reimplemented in MeltsSolution.

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

set moles. In Solution and subclasses, nmoles is total of component moles.

Reimplemented from Phase.

Reimplemented in SilicateLiq, and SpecSolution.


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