#include <MeltsSolution.h>
Public Member Functions | |
MeltsSolution () | |
Generic constructor. Assumes STP. | |
virtual | ~MeltsSolution () |
destructor | |
virtual void | setTk (double ltk) |
set temperature in Kelvins | |
virtual void | setPa (double lpa) |
set pressure in Pascals | |
virtual void | setComps (double *rawcomps) |
virtual void | setElements (double *ele) throw (PhaseError *) |
virtual double | getGibbs () |
returns Gibbs free energy | |
virtual double | getMu (int i) |
returns component chemical potential | |
virtual void | getMu (double *m) |
returns component chemical potentials | |
virtual double | getActivity (int i) |
returns component activity | |
virtual void | getActivity (double *act) |
returns component activities | |
virtual double | getdMudX (int m, int p) |
dMu[m]/dX[p] | |
virtual double | getdMudP (int m) |
dMu[m]/dP | |
virtual void | getdGdm (double *dgdm) |
dG/dm vector | |
virtual void | getd2Gdm2 (double **d2gdm2) |
d2Gdm2 matrix | |
virtual void | getd3Gdm3 (double ***d3gdm3) |
d3Gdm3 matrix | |
virtual double | getEnthalpy () |
returns enthalpy | |
virtual double | getEntropy () |
returns entropy | |
virtual void | getdSdm (double *dsdm) |
virtual void | getd2Sdm2 (double **d2sdm2) |
virtual double | getCp () |
returns heat capacity | |
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 () |
returns volume in m^3 | |
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 () |
returns dVdT | |
virtual double | getdVdP () |
returns dVdP | |
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) |
d2V/dmdT in M^3/KelvinMole | |
virtual void | getd2VdmdP (double *d2vdmdp) |
d2V/dmdP in M^3/PascalMole | |
virtual double | getGmix () |
virtual double | getHmix () |
returns enthalpy of mixing | |
virtual double | getSmix () |
returns entropy of mixing | |
virtual double | getVmix () |
returns volume of mixing | |
virtual double | getCpmix () |
returns Cp of mixing | |
virtual double | getdVdTmix () |
returns dVdT of mixing | |
virtual double | getdVdPmix () |
returns dVdP of mixing | |
Protected Member Functions | |
virtual void | init () |
initialize data structures | |
virtual void | checkX (double *) throw (PhaseError *) |
method checks validity of argument as composition | |
Protected Attributes | |
const int | FIRST |
Argument BITMASKs for public solid solution functions: | |
const int | SECOND |
const int | THIRD |
const int | FOURTH |
const int | FIFTH |
const int | SIXTH |
const int | SEVENTH |
const int | EIGHTH |
const int | NINTH |
const int | TENTH |
const int | ELEVENTH |
const int | TWELFTH |
const int | THIRTEENTH |
const int | FOURTEENTH |
const int | FIFTEENTH |
const int | SIXTEENTH |
const int | SEVENTEENTH |
const int | EIGHTEENTH |
const int | NINETEENTH |
const int | TWENTIETH |
int(* | testcomp )(int mask, double t, double p, int na, int nr, char **names, char **formulas, double *r, double *m) |
void(* | convert )(int inpMask, int outMask, double t, double p, double *e, double *m, double *r, double *x, double **dm, double ***d2m, double **dr, double ****d3m) |
void(* | activity )(int mask, double t, double p, double *r, double *a, double *mu, double **dr) |
void(* | gmix )(int mask, double t, double p, double *r, double *gmix, double *dr, double **dr2, double ***dr3) |
void(* | hmix )(int mask, double t, double p, double *r, double *hmix) |
void(* | smix )(int mask, double t, double p, double *r, double *smix, double *dr, double **dr2) |
void(* | cpmix )(int mask, double t, double p, double *r, double *cpmix, double *dt, double *dr) |
void(* | vmix )(int mask, double t, double p, double *r, double *vmix, double *dr, double **dr2, double *dt, double *dp, double *dt2, double *dtdp, double *dp2, double *drdt, double *drdp) |
double * | space1d0 |
working vectors | |
double * | space1d1 |
double ** | space2d0 |
working 2D arrays | |
double ** | space2d1 |
double *** | space3d0 |
working 3D arrays | |
double *** | space3d1 |
double | pb |
pressure in bars | |
double * | rx |
reduced composition vector for Ghiorso routines | |
double ** | drxdm |
dr[i]/dm[j] n-1 by n matrix | |
double *** | d2rxdm2 |
d2r/m2 second derivative 3d matrix | |
double **** | d3rxdm3 |
d3r/m3 3rd derivative 4d matrix |
parent for MELTS-derived solutions.
Definition at line 17 of file MeltsSolution.h.
virtual void MeltsSolution::getd2Sdm2 | ( | double ** | d2sdm2 | ) | [virtual] |
second derivative of entropy with respect to moles (Joules/(mole^2.Kelvin).
d2sdm2 | ncomp by ncomp array to store result |
Reimplemented from Solution.
virtual void MeltsSolution::getdSdm | ( | double * | dsdm | ) | [virtual] |
derivative of entropy with respect to moles (Joules/(mole.Kelvin).
dsdm | ncomp vector to store result |
Reimplemented from Solution.
virtual double MeltsSolution::getGmix | ( | ) | [virtual] |
mixing routines returns mixing contribution to Gibbs free energy
Reimplemented from Solution.
virtual void MeltsSolution::setComps | ( | double * | rawcomps | ) | [virtual] |
Set component moles. For single-component phase, just sets moles.
rawcomps | ncomp array of moles of each component. |
Reimplemented from Solution.
virtual void MeltsSolution::setElements | ( | double * | ele | ) | throw (PhaseError *) [virtual] |
Set moles of elements.
ele | Moles of elements on entry. Unknown state on exit. |
Reimplemented from Solution.
void(* MeltsSolution::activity)(int mask, double t, double p, double *r, double *a,double *mu,double **dr) [protected] |
Generic activity routine
mask | binary mask to determine which variables are calculated | |
t | temperature in kelvins | |
p | pressure in bars | |
r | n-1 vector of independent components | |
a | n-vector of component activities BINARY MASK: 0001 | |
mu | n-vector of chemical potentials BINARY MASK: 0010 | |
dr | n-1 by n-1(pointer to dr[][]) d(a[])/d(r[]) BINARY MASK: 0100 |
Definition at line 206 of file MeltsSolution.h.
void(* MeltsSolution::convert)(int inpMask, int outMask, double t, double p, double *e,double *m,double *r,double *x,double **dm,double ***d2m,double **dr,double ****d3m) [protected] |
Generic component conversion routine Not all combinations of inpMask and outMask are feasible. Valid combinations are:
-- inpMask outMask (1) FIRST SECOND (2) SECOND THIRD | FOURTH | FIFTH | SIXTH | EIGHTH (3) THIRD FOURTH | SEVENTH
(1) converts a vector of moles of elements into a vector of moles of endmember olivine components. (2) calculates from a vector of moles of endmember components, one or all of: r[], x[], dr[]/dm[], d2r[]/dm[]dm[], or d3r[]/dm[]dm[]dm[] (3) calculates from a vector of independent compositional variables mole fractions of endmember components and/or the Jacobian matrix dx[]/dr[]
It is assumed that the elements are in the order of atomic no.
e | moles of elements BINARY MASK: 00000001 | |
m | n-1 moles of endmember components BINARY MASK: 00000010 | |
r | n-1 indep compositional variables BINARY MASK: 00000100 | |
x | mole fractions of endmember cmp BINARY MASK: 00001000 | |
dm | n-1 by n matrix[i][j]:dr[i]/dm[j] BINARY MASK: 00010000 | |
d2m | n-1 by n by n cube d2r[i]/dm[j]dm[k] MASK: 00100000 | |
dr,n-1 | by n-1 matrix[i][j]: dx[i]/dr[j] MASK: 01000000 | |
d3m | 4d[i][j][k][l]: d3r[i]/dm[j]dm[k]dm[l] MASK: 10000000 |
Definition at line 186 of file MeltsSolution.h.
void(* MeltsSolution::cpmix)(int mask, double t, double p, double *r, double *cpmix,double *dt,double *dr) [protected] |
Generic Cp mixing routine.
mask | binary mask to determine which variables are calculated | |
t | temperature in kelvins | |
p | pressure in bars | |
r | n-1 vector of independent components | |
cpmix | molar cp of mixing BINARY MASK: 001 | |
dt | dcpmix/dT BINARY MASK: 010 | |
dr | n-1 vector of dcpmix/dr BINARY MASK: 100 |
Definition at line 264 of file MeltsSolution.h.
void(* MeltsSolution::gmix)(int mask, double t, double p, double *r, double *gmix,double *dr,double **dr2,double ***dr3) [protected] |
Generic Gibbs mixing routine.
mask | binary mask to determine which variables are calculated | |
t | temperature in kelvins | |
p | pressure in bars | |
r | n-1 vector of independent components | |
gmix | molar Gibbs energy of mixing BINARY MASK: 0001 | |
dr | n-1 vector of dgmix/dr BINARY MASK: 0010 | |
dr2 | n-1 by n-1 matrix of d2gmix/dr2 BINARY MASK: 0100 | |
dr3 | n-1 by n-1 by n-1 3d array of d2gmix/dr3 BINARY MASK: 1000 |
Definition at line 222 of file MeltsSolution.h.
void(* MeltsSolution::hmix)(int mask, double t, double p, double *r, double *hmix) [protected] |
Generic enthalpy mixing routine.
mask | binary mask to determine which variables are calculated | |
t | temperature in kelvins | |
p | pressure in bars | |
r | n-1 vector of independent components | |
hmix | molar enthalpy of mixing. BINARY MASK: 1 |
Definition at line 236 of file MeltsSolution.h.
void(* MeltsSolution::smix)(int mask, double t, double p, double *r, double *smix,double *dr,double **dr2) [protected] |
Generic entropy of mixing routine.
mask | binary mask to determine which variables are calculated | |
t | temperature in kelvins | |
p | pressure in bars | |
r | n-1 vector of independent components | |
smix | molar entropy of mixing BINARY MASK: 001 | |
dr | n-1 vector of dsmix/dr BINARY MASK: 010 | |
dr2 | n-1 by n-1 matrix of d2smix/dr2 BINARY MASK: 100 |
Definition at line 249 of file MeltsSolution.h.
int(* MeltsSolution::testcomp)(int mask, double t, double p, int na, int nr, char **names, char **formulas, double *r, double *m) [protected] |
Generic component checking routine Mask takes the following values: (1) FIRST Test number of components (2) SECOND Test number of indep variables (3) THIRD Test component names (not relevant in MeltsSolution class) (4) FOURTH Test component formulas (not relevant in MeltsSolution class) (5) FIFTH Test bounds on independent composition variables (r) (6) SIXTH Test bounds on endmember components (m)
mask | results mask | |
na | Expected number of endmember components | |
nr | Expected number of independent compositional variables | |
names | array of strings of names of endmember components | |
formulas | array of strings of formulas of endmember components | |
r | array of indepependent compos variables, check bounds | |
m | array of moles of endmember components, check bounds |
Definition at line 155 of file MeltsSolution.h.
void(* MeltsSolution::vmix)(int mask, double t, double p, double *r, double *vmix,double *dr,double **dr2,double *dt,double *dp,double *dt2,double *dtdp,double *dp2,double *drdt,double *drdp) [protected] |
Generic volume mixing routine.
mask | binary mask to determine which variables are calculated | |
t | temperature in kelvins | |
p | pressure in bars | |
r | n-1 vector of independent components | |
vmix | molar volume of mixing BINARY MASK: 0000000001 | |
dr | n-1 vector of dvmix/dr BINARY MASK: 0000000010 | |
dr2 | n-1 by n-1 matrix of d2vmix/dr2 BINARY MASK: 0000000100 | |
dt | pointer to dvmix/dT BINARY MASK: 0000001000 | |
dp | pointer to dvmix/dP BINARY MASK: 0000010000 | |
dt2 | pointer to d2vmix/dT2 BINARY MASK: 0000100000 | |
dtdp | pointer to d2vmix/dTdP BINARY MASK: 0001000000 | |
dp2 | pointer to d2vmix/dP2 BINARY MASK: 0010000000 | |
drdt | n-1 vector of d2vmix/drdT BINARY MASK: 0100000000 | |
drdp | n-1 vector of d2vmix/drdP BINARY MASK: 1000000000 |
Definition at line 286 of file MeltsSolution.h.