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

Rock Class Reference

#include <Rock.h>

List of all members.

Public Member Functions

 Rock (void)
 blank constructor. STP assumed.
virtual ~Rock (void)
 destructor
virtual void setTk (double ltk)
 set T in Kelvins
virtual void setPa (double lpa)
 set P in Pascals
virtual void setlogfo2 (int mode, double delta)
 set logfo2 mode and delNNO (default none)
virtual void supressPhase (int iphase)
 supress phase number iphase. All suppressed by default.
virtual void enablePhase (int iphase)
 enable phase number iphase. All supressed by default.
virtual void setIsenthalpic (int i)
 put rock in isenthalpic mode (default 0);
virtual void setIsentropic (int i)
 put rock in isentropic mode (default 0);
virtual void setIsochoric (int i)
 put rock in isochoric mode (default 0);
virtual void setBulkCompM (double *bc)
 set bulk composition in mole fraction. Values copied to internal array.
virtual void setBulkCompW (double *bc)
 set bulk composition in weight%. Values copied to internal array.
virtual void fractionateSolids (double scale)
 fractionate solids (scale = fraction removed) from system
virtual void setVolume (double v)
 set system volume in J/Pa
virtual void setEnthalpy (double h)
 set system enthalpy in J
virtual void setEntropy (double s)
 set system entropy in J/K
virtual double getTk ()
 returns T in Kelvins
virtual double getPa ()
 returns P in Pascals
virtual int getNcomp ()
 returns number of rock components
virtual int getNLiqComp ()
 returns number of liquid components
virtual int getNSolPhases ()
 returns number of potential solid phases (suppressed and enabled)
virtual const char * getSolPhaseName (int iphase)
 returns name of solid phase i
virtual const char * getSolPhaseFormula (int iphase, int instance)
virtual const char * getSolPhaseFormula (int iphase)
virtual int getNSolComp (int i)
 returns number of components for phase i
virtual const char * getSolPhaseCompName (int iphase, int icomp)
virtual const char * getSolPhaseCompFormula (int iphase, int icomp)
virtual const char * getCompName (int i)
 returns pointer to name of bulk component (oxide)
virtual const char * getLiqCompName (int i)
 returns pointer to name of liquid component
virtual void getLiqComp (double *lx)
 returns liquid composition
virtual void getLiqCompWt (double *lx)
 returns liquid composition in wt% oxides
virtual void getLiqMu (double *lmu)
 returns liquid mu
virtual void getLiqActivity (double *lact)
 returns liquid activities
int getNSatSolid ()
 Returns number of saturated solid phases.
void getSatSolidList (int *ilist)
 Returns list of indices for currently saturated solids.
virtual int getSolComp (int iphase, int instance, double *sx)
virtual int getSolComp (int iphase, double *sx)
virtual int getSolCompWt (int iphase, int instance, double *sx)
virtual int getSolCompWt (int iphase, double *sx)
virtual int getSolMu (int iphase, int instance, double *smu)
virtual int getSolMu (int iphase, double *smu)
virtual double getAffinity (int iphase, double *x)
virtual int getSolVbar (int iphase, int instance, double *svbar)
virtual int getSolVbar (int iphase, double *svbar)
virtual double getlogfo2 ()
 get current log10fo2
virtual double getlogfo2 (int mode)
 get current log10fo2 relative to buffer specified in mode
virtual void getBulkCompM (double *bc)
 get bulk composition in moles
virtual void getBulkCompW (double *bc)
 get bulk composition in grams
virtual double getLiquidMass ()
 get liquid mass in gm
virtual double getSolidMass ()
 get solid mass in gm
virtual double getSolPhaseMass (int iphase, int instance)
virtual double getSolPhaseMass (int iphase)
virtual double getVolume ()
 returns system volume in J/Pa
virtual double getSolidGibbsFreeEnergy ()
 returns Gibbs free energy of solids in J/Pa
virtual double getSolidEnthalpy ()
 returns enthalpy of solids in J/Pa
virtual double getSolidEntropy ()
 returns entropy of solids in J/Pa
virtual double getSolidHeatCapacity ()
 returns heat capacity of solids in J/Pa
virtual double getSolidVolume ()
 returns volume of solids in J/Pa
virtual double getSolidGibbsFreeEnergy (int iphase, int instance)
virtual double getSolidGibbsFreeEnergy (int iphase)
virtual double getSolidEnthalpy (int iphase, int instance)
virtual double getSolidEnthalpy (int iphase)
virtual double getSolidEntropy (int iphase, int instance)
virtual double getSolidEntropy (int iphase)
virtual double getSolidHeatCapacity (int iphase, int instance)
virtual double getSolidHeatCapacity (int iphase)
virtual double getSolidVolume (int iphase, int instance)
virtual double getSolidVolume (int iphase)
virtual double getSoliddVdT (int iphase, int instance)
virtual double getSoliddVdT (int iphase)
virtual double getSoliddVdP (int iphase, int instance)
virtual double getSoliddVdP (int iphase)
virtual double getDeltaOxygen ()
 returns moles of oxygen added/removed from system
virtual double getOxygenGibbsFreeEnergy ()
 returns Oxygen Gibbs Free Energy in J/mol
virtual double getOxygenEnthalpy ()
 returns Oxygen enthalpy in J/mol
virtual double getOxygenEntropy ()
 returns Oxygen entropy in J/K-mol
virtual double getOxygenHeatCapacity ()
 returns Oxygen heat capacity in J/K-mol
virtual double getOxygenVolume ()
 returns Oxygen volume in J/Pa-mol
virtual double getLiquidGibbsFreeEnergy ()
 returns liquid Gibbs Free Energy in J
virtual double getLiquidEnthalpy ()
 returns liquid enthalpy in J
virtual double getLiquidEntropy ()
 returns liquid entropy in J/K
virtual double getLiquidHeatCapacity ()
 returns liquid heat capacity in J/K
virtual double getLiquidVolume ()
 returns liquid volume in J/Pa
virtual double getLiquiddVdT ()
 returns liquid dVdT in J/(Pa*K)
virtual double getLiquiddVdP ()
 returns liquid dVdP in J/Pa^2
virtual double getLiquidViscosity ()
 returns liquid viscosity in log10 (poise)
virtual int getPhaseNo (const char *lab)
 get integer value of solid phase corresponding to label
virtual int isSingleComponent (int iphase)
 returns boolean indicating if phase iphase is single-component.
virtual int getNumberCoexistPhase (int iphase)
 get number of coexisting phases in stable assemblage
virtual int findRockLiquidus ()
 find liquidus temperature for this bulk composition and sets state
virtual int equilibrateRock ()
 execute equilibration on current state

Public Attributes

const int fo2_none
 no oxygen fugacity constraint mode
const int fo2_hm
 hematite-magnetite oxygen fugacity constraint mode
const int fo2_nno
 Ni-NiO oxygen fugacity constraint mode.
const int fo2_qfm
 QFM oxygen fugacity constraint mode.
const int fo2_iw
 iron-wustite oxygen fugacity constraint mode

Protected Member Functions

virtual int init (void)
 private initialization routine
virtual int initializeState ()
 function turns off iso* modes to initialize Rock state. Arguments are working space
virtual void equilibrateError (int err)
 prints equilibrate error explanations
virtual void findLiquidusError (int err)
 prints findLiquidus error explanations
virtual void liquify ()
 converts everything to liquid and zero's solid.
virtual void printSilminStateStructure (SilminState *pt)
 utility to print current state of silminState variable

Protected Attributes

int nphase
 number of available solid phases
int * phasedex
 indexing array to convert from phase number to SilminState index
int stateinit
 boolean to indicate whether calculation state is initialized
SilminState * silminState
 state variables for silmin. Contains lots of stuff.
int curThread
 current thread (this class instance)
ThermoDataliquidCur
 state variables for silmin. Contains lots of stuff.
ThermoDatasolidsCur
 state variables for silmin. Contains lots of stuff.
ThermoDataoxygenCur
 state variables for silmin. Contains lots of stuff.

Static Protected Attributes

static int staticinit
 boolean to indicate if static variables have been allocated
static int threadCount
 number of active threads (instances of class)
static const int maxThreads = 25
 maximum number of class instances (from MELTS library)
static int * threadPool
static int mutexLock
 variable to hold thread lock (boolean)

Private Attributes

double * mSol
 working space
double * mLiq
double * r
double * x

Detailed Description

c++ wrapper for Ghiorso's Melts code. Inherits all Melts constants etc. through silmin.h.

Id:
Rock.h,v 1.23 2006/01/21 22:24:07 ghiorso Exp
Author:
Victor Kress
Version:
Revision:
1.23

Definition at line 14 of file Rock.h.


Member Function Documentation

virtual double Rock::getAffinity ( int  iphase,
double *  x 
) [virtual]

Returns affinity and composition guess for solid phase. If initial guess fails, Ghiorso's method will be used to try again.

Parameters:
iphase phase number
x estimate for mole fraction of components. Zeroed components will not be considered.
Returns:
affinity if undersaturated or zero if saturated
virtual int Rock::getSolComp ( int  iphase,
int  instance,
double *  sx 
) [virtual]

Returns solid composition in mol frac of phase components.

Parameters:
iphase phase number
instance phase instance index
sx double array to hold returned component moles.
Returns:
number of phase saturated or 0 if supressed or undersaturated.
virtual int Rock::getSolComp ( int  iphase,
double *  sx 
) [virtual]

Returns solid composition in mol frac of phase components.

Parameters:
iphase phase number
sx double array to hold returned component moles.
Returns:
number of phase saturated or 0 if supressed or undersaturated.
virtual int Rock::getSolCompWt ( int  iphase,
double *  sx 
) [virtual]

Returns solid composition in wt% oxides.

Parameters:
iphase phase number
sx double array to hold returned wt% oxide array.
Returns:
number of phase saturated or 0 if supressed or undersaturated.
virtual int Rock::getSolCompWt ( int  iphase,
int  instance,
double *  sx 
) [virtual]

Returns solid composition in wt% oxides.

Parameters:
iphase phase number
instance phase instance index
sx double array to hold returned wt% oxide array.
Returns:
number of phase saturated or 0 if supressed or undersaturated.
virtual double Rock::getSoliddVdP ( int  iphase,
int  instance 
) [virtual]

returns dVdP of solid iphase in J/(Pa^2)

Parameters:
iphase phase number
instance phase instance index
Returns:
dVdP of solid iphase in J/(Pa^2)
virtual double Rock::getSoliddVdP ( int  iphase  )  [virtual]

returns dVdP of solid iphase in J/(Pa^2)

Parameters:
iphase phase number
Returns:
dVdP of solid iphase in J/(Pa^2)
virtual double Rock::getSoliddVdT ( int  iphase  )  [virtual]

returns dVdT of solid iphase in J/(Pa*K)

Parameters:
iphase phase number
Returns:
dVdT of solid iphase in J/(Pa*K)
virtual double Rock::getSoliddVdT ( int  iphase,
int  instance 
) [virtual]

returns dVdT of solid iphase in J/(Pa*K)

Parameters:
iphase phase number
instance phase instance index
Returns:
dVdT of solid iphase in J/(Pa*K)
virtual double Rock::getSolidEnthalpy ( int  iphase,
int  instance 
) [virtual]

returns enthalpy of solid iphase in J

Parameters:
iphase phase number
instance phase instance index
Returns:
enthalpy of solid iphase in J
virtual double Rock::getSolidEnthalpy ( int  iphase  )  [virtual]

returns enthalpy of solid iphase in J

Parameters:
iphase phase number
Returns:
enthalpy of solid iphase in J
virtual double Rock::getSolidEntropy ( int  iphase,
int  instance 
) [virtual]

returns entropy of solid iphase in J/K

Parameters:
iphase phase number
instance phase instance index
Returns:
entropy of solid iphase in J/K
virtual double Rock::getSolidEntropy ( int  iphase  )  [virtual]

returns entropy of solid iphase in J/K

Parameters:
iphase phase number
Returns:
entropy of solid iphase in J/K
virtual double Rock::getSolidGibbsFreeEnergy ( int  iphase,
int  instance 
) [virtual]

returns Gibbs free energy of solid iphase in J

Parameters:
iphase phase number
instance phase instance index
Returns:
Gibbs free energy of solid iphase in J
virtual double Rock::getSolidGibbsFreeEnergy ( int  iphase  )  [virtual]

returns Gibbs free energy of solid iphase in J

Parameters:
iphase phase number
Returns:
Gibbs free energy of solid iphase in J
virtual double Rock::getSolidHeatCapacity ( int  iphase  )  [virtual]

returns heat capacity of solid iphase in J/K

Parameters:
iphase phase number
Returns:
heat capacity of solid iphase in J/K
virtual double Rock::getSolidHeatCapacity ( int  iphase,
int  instance 
) [virtual]

returns heat capacity of solid iphase in J/K

Parameters:
iphase phase number
instance phase instance index
Returns:
heat capacity of solid iphase in J/K
virtual double Rock::getSolidVolume ( int  iphase  )  [virtual]

returns volume of solid iphase in J/Pa

Parameters:
iphase phase number
Returns:
volume of solid iphase in J/Pa
virtual double Rock::getSolidVolume ( int  iphase,
int  instance 
) [virtual]

returns volume of solid iphase in J/Pa

Parameters:
iphase phase number
instance phase instance index
Returns:
volume of solid iphase in J/Pa
virtual int Rock::getSolMu ( int  iphase,
double *  smu 
) [virtual]

Returns solid mu in Joules.

Parameters:
iphase phase number
smu double array to hold returned component potentials in Joules.
Returns:
number of phase saturated or 0 if supressed or undersaturated.
virtual int Rock::getSolMu ( int  iphase,
int  instance,
double *  smu 
) [virtual]

Returns solid mu in Joules.

Parameters:
iphase phase number
instance phase instance index
smu double array to hold returned component potentials in Joules.
Returns:
number of phase saturated or 0 if supressed or undersaturated.
virtual const char* Rock::getSolPhaseCompFormula ( int  iphase,
int  icomp 
) [virtual]

Returns pointer to the formula of a component in a solid phase

Parameters:
iphase phase index
icomp component index
Returns:
pointer to the name of a component in a solid phase
virtual const char* Rock::getSolPhaseCompName ( int  iphase,
int  icomp 
) [virtual]

Returns pointer to the name of a component in a solid phase

Parameters:
iphase phase index
icomp component index
Returns:
pointer to the name of a component in a solid phase
virtual const char* Rock::getSolPhaseFormula ( int  iphase,
int  instance 
) [virtual]

returns formula of solid phase i call with iphase=-1 to free static array memory

Parameters:
iphase phase number.
instance instance number.
virtual const char* Rock::getSolPhaseFormula ( int  iphase  )  [virtual]

returns formula of solid phase i call with iphase=-1 to free static array memory

Parameters:
iphase phase number.
virtual double Rock::getSolPhaseMass ( int  iphase,
int  instance 
) [virtual]

Returns mass in gm of solid phase in assemblage

Parameters:
iphase phase number
instance phase instance index
Returns:
mass of the phase in gm
virtual double Rock::getSolPhaseMass ( int  iphase  )  [virtual]

Returns mass in gm of solid phase in assemblage

Parameters:
iphase phase number
Returns:
mass of the phase in gm
virtual int Rock::getSolVbar ( int  iphase,
double *  svbar 
) [virtual]

Returns solid partial molar volumes in J/Pa. Returns 0 if not present.

Parameters:
iphase phase number
svbar partial molar volume of components
virtual int Rock::getSolVbar ( int  iphase,
int  instance,
double *  svbar 
) [virtual]

Returns solid partial molar volumes in J/Pa. Returns 0 if not present.

Parameters:
iphase phase number
instance phase instance index
svbar partial molar volume of components

Member Data Documentation

int* Rock::threadPool [static, protected]

array that holds available indexes of class instances the pool of instances is limited by maxThreads

Definition at line 328 of file Rock.h.


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