Gems3k
3.1
GEMS3K standalone solver for geochemical equilibria
|
Contains chemical thermodynamic work data for GEM IPM-3 algorithm. More...
#include <ms_multi.h>
Public Attributes | |
char | stkey [EQ_RKLEN+1] |
Record key identifying IPM minimization problem. | |
char | PunE |
Units of energy { j; J c C N reserved }. | |
char | PunV |
Units of volume { j; c L a reserved }. | |
char | PunP |
Units of pressure { b; B p P A reserved }. | |
char | PunT |
Units of temperature { C; K F reserved }. | |
long int | N |
N - number of IC in IPM problem. | |
long int | NR |
NR - dimensions of R matrix. | |
long int | L |
L - number of DC in IPM problem. | |
long int | Ls |
Ls - total number of DC in multi-component phases. | |
long int | LO |
LO - index of water-solvent in IPM DC list. | |
long int | PG |
PG - number of DC in gas phase. | |
long int | PSOL |
PSOL - number of DC in liquid hydrocarbon phase. | |
long int | Lads |
Total number of DC in sorption phases included into this system. | |
long int | FI |
FI - number of phases in IPM problem. | |
long int | FIs |
FIs - number of multicomponent phases. | |
long int | FIa |
FIa - number of sorption phases. | |
long int | FI1 |
FI1 - number of phases present in eqstate. | |
long int | FI1s |
FI1s - number of multicomponent phases present in eqstate. | |
long int | FI1a |
FI1a - number of sorption phases present in eqstate. | |
long int | IT |
It - number of completed IPM iterations. | |
long int | E |
PE - flag of electroneutrality constraint { 0 1 }. | |
long int | PD |
PD - mode of calling CalculateActivityCoefficients() { 0 1 2 3 4 }. | |
long int | PV |
Flag for the volume balance constraint (on Vol IC) - for indifferent equilibria at P_Sat { 0 1 }. | |
long int | PLIM |
PU - flag of activation of DC/phase restrictions { 0 1 }. | |
long int | Ec |
CalculateActivityCoefficients() return code: 0 (OK) or 1 (error) | |
long int | K2 |
Number of IPM loops performed ( >1 up to 6 because of PSSC() ) | |
long int | PZ |
Indicator of PSSC() status (since r1594): 0 untouched, 1 phase(s) inserted 2 insertion done after 5 major IPM loops. | |
long int | pNP |
Mode of FIA selection: 0-automatic-LP AIA, 1-smart SIA, -1-user's choice. | |
long int | pESU |
Unpack old eqstate from EQSTAT record? 0-no 1-yes. | |
long int | pIPN |
State of IPN-arrays: 0-create; 1-available; -1 remake. | |
long int | pBAL |
State of reloading CSD: 1- BAL only; 0-whole CSD. | |
long int | tMin |
Type of thermodynamic potential to minimize. | |
long int | pTPD |
State of reloading thermod data: 0-all -1-full from database 1-new system 2-no. | |
long int | pULR |
Start recalc kinetic constraints (0-do not, 1-do )internal. | |
long int | ITaia |
Number of IPM iterations completed in AIA mode (renamed from pRR1) | |
long int | FIat |
max. number of surface site types | |
long int | MK |
IPM return code: 0 - continue; 1 - converged. | |
long int | W1 |
Indicator ofSpeciationCleanup() status (since r1594) 0 untouched, -1 phase(s) removed, 1 some DCs inserted. | |
long int | is |
is - index of IC for IPN equations ( CalculateActivityCoefficients() ) | |
long int | js |
js - index of DC for IPN equations ( CalculateActivityCoefficients() ) | |
long int | next |
for IPN equations (is it really necessary? TW please check! | |
long int | sitNcat |
Can be re-used. | |
long int | sitNan |
Can be re-used. | |
double | TC |
Temperature T, min. (0,2000 C) | |
double | TCc |
Temperature T, max. (0,2000 C) | |
double | T |
T, min. K. | |
double | Tc |
T, max. K. | |
double | P |
Pressure P, min(0,10000 bar) | |
double | Pc |
Pressure P, max.(0,10000 bar) | |
double | VX_ |
V(X) - volume of the system, min., cm3. | |
double | VXc |
V(X) - volume of the system, max., cm3. | |
double | GX_ |
Gibbs potential of the system G(X), min. (J) | |
double | GXc |
Gibbs potential of the system G(X), max. (J) | |
double | AX_ |
Helmholtz potential of the system F(X) | |
double | AXc |
reserved | |
double | UX_ |
Internal energy of the system U(X) | |
double | UXc |
reserved | |
double | HX_ |
Total enthalpy of the system H(X) | |
double | HXc |
reserved | |
double | SX_ |
Total entropy of the system S(X) | |
double | SXc |
reserved | |
double | CpX_ |
reserved | |
double | CpXc |
reserved | |
double | CvX_ |
reserved | |
double | CvXc |
reserved | |
double | TMols |
Input total moles in b vector before rescaling. | |
double | SMols |
Standart total moles (upscaled) {1000}. | |
double | MBX |
Total mass of the system, kg. | |
double | FX |
Current Gibbs potential of the system in IPM, moles. | |
double | IC |
Effective molal ionic strength of aqueous electrolyte. | |
double | pH |
pH of aqueous solution | |
double | pe |
pe of aqueous solution | |
double | Eh |
Eh of aqueous solution, V. | |
double | DHBM |
balance (relative) precision criterion | |
double | DSM |
min amount of phase DS | |
double | GWAT |
used in ipm_gamma() | |
double | YMET |
reserved | |
double | PCI |
Current value of Dikin criterion of IPM convergence DK>=DX. | |
double | DXM |
IPM convergence criterion threshold DX (1e-5) | |
double | lnP |
log Ptotal | |
double | RT |
RT: 8.31451*T (J/mole/K) | |
double | FRT |
F/RT, F - Faraday constant = 96485.309 C/mol. | |
double | Yw |
Current number of moles of solvent in aqueous phase. | |
double | ln5551 |
ln(55.50837344) | |
double | aqsTail |
v_j asymmetry correction factor for aqueous species | |
double | lowPosNum |
Minimum mole amount considered in GEM calculations (MinPhysAmount = 1.66e-24) | |
double | logXw |
work variable | |
double | logYFk |
work variable | |
double | YFk |
Current number of moles in a multicomponent phase. | |
double | FitVar [5] |
Internal. | |
double | denW [5] |
Density of water, first T, second T, first P, second P derivative for Tc,Pc. | |
double | denWg [5] |
Density of steam for Tc,Pc. | |
double | epsW [5] |
Diel. constant of H2O(l)for Tc,Pc. | |
double | epsWg [5] |
Diel. constant of steam for Tc,Pc. | |
long int * | L1 |
l_a vector - number of DCs included into each phase [Fi] | |
long int * | LsMod |
Number of interaction parameters. | |
long int * | LsMdc |
for multi-site models: [3*FIs] - number of nonid. params per component; number of sublattices nS; number of moieties nM. | |
long int * | IPx |
Collected indexation table for interaction parameters of non-ideal solutions ->LsMod[k,0] x LsMod[k,1] over FIs. | |
long int * | mui |
IC indices in RMULTS IC list [N]. | |
long int * | muk |
Phase indices in RMULTS phase list [FI]. | |
long int * | muj |
DC indices in RMULTS DC list [L]. | |
long int(* | SATX )[4] |
Setup of surface sites and species (will be applied separately within each sorption phase) [Lads]. | |
double * | PMc |
Collected interaction parameter coefficients for the (built-in) non-ideal mixing models -> LsMod[k,0] x LsMod[k,2]. | |
double * | DMc |
Non-ideality coefficients f(TPX) for DC -> L1[k] x LsMdc[k][0]. | |
double * | MoiSN |
End member moiety- site multiplicity number tables -> L1[k] x LsMdc[k][1] x LsMdc[k][2]. | |
double * | SitFr |
Tables of sublattice site fractions for moieties -> LsMdc[k][1] x LsMdc[k][2]. | |
double * | A |
DC stoichiometry matrix A composed of a_ji [0:N-1][0:L-1]. | |
double * | Awt |
IC atomic (molar) mass, g/mole [0:N-1]. | |
double * | Wb |
Relative Born factors (HKF, reserved) [0:Ls-1]. | |
double * | Wabs |
Absolute Born factors (HKF, reserved) [0:Ls-1]. | |
double * | Rion |
Ionic or solvation radii, A (reserved) [0:Ls-1]. | |
double * | HYM |
reserved | |
double * | ENT |
reserved no object | |
double * | H0 |
DC pmolar enthalpies, reserved [L]. | |
double * | A0 |
DC molar Helmholtz energies, reserved [L]. | |
double * | U0 |
DC molar internal energies, reserved [L]. | |
double * | S0 |
DC molar entropies, reserved [L]. | |
double * | Cp0 |
DC molar heat capacity, reserved [L]. | |
double * | Cv0 |
DC molar Cv, reserved [L]. | |
double * | VL |
ln mole fraction of end members in phases-solutions | |
double * | Xcond |
conductivity of phase carrier, sm/m2 [0:FI-1], reserved | |
double * | Xeps |
diel.permeability of phase carrier (solvent) [0:FI-1], reserved | |
double * | Aalp |
Full vector of specific surface areas of phases (m2/g) [0:FI-1]. | |
double * | Sigw |
Specific surface free energy for phase-water interface (J/m2) [0:FI-1]. | |
double * | Sigg |
Specific surface free energy for phase-gas interface (J/m2) (not yet used) [0:FI-1], reserved. | |
double(* | Xr0h0 )[2] |
mean r & h of particles (- pores), nm [0:FI-1][2], reserved | |
double(* | Nfsp )[MST] |
Fractions of the sorbent specific surface area allocated to surface types [FIs][FIat]. | |
double(* | MASDT )[MST] |
Total maximum site density per surface type (mkmol/g) [FIs][FIat]. | |
double(* | XcapF )[MST] |
Capacitance density of Ba EDL layer F/m2 [FIs][FIat]. | |
double(* | XcapA )[MST] |
Capacitance density of 0 EDL layer, F/m2 [FIs][FIat]. | |
double(* | XcapB )[MST] |
Capacitance density of B EDL layer, F/m2 [FIs][FIat]. | |
double(* | XcapD )[MST] |
Eff. cap. density of diffuse layer, F/m2 [FIs][FIat]. | |
double(* | XdlA )[MST] |
Effective thickness of A EDL layer, nm [FIs][FIat], reserved. | |
double(* | XdlB )[MST] |
Effective thickness of B EDL layer, nm [FIs][FIat], reserved. | |
double(* | XdlD )[MST] |
Effective thickness of diffuse layer, nm [FIs][FIat], reserved. | |
double(* | XlamA )[MST] |
Factor of EDL discretness A < 1 [FIs][FIat], reserved. | |
double(* | Xetaf )[MST] |
Density of permanent surface type charge (mkeq/m2) for each surface type on sorption phases [FIs][FIat]. | |
double(* | MASDJ )[DFCN] |
Parameters of surface species in surface complexation models [Lads][DFCN]. | |
double * | XFs |
Current quantities of phases X_a at IPM iterations [0:FI-1]. | |
double * | Falps |
Current Karpov criteria of phase stability F_a [0:FI-1]. | |
double * | Fug |
Demo partial fugacities of gases [0:PG-1]. | |
double * | Fug_l |
Demo log partial fugacities of gases [0:PG-1]. | |
double * | Ppg_l |
Demo log partial pressures of gases [0:PG-1]. | |
double * | DUL |
VG Vector of upper kinetic restrictions to x_j, moles [L]. | |
double * | DLL |
NG Vector of lower kinetic restrictions to x_j, moles [L]. | |
double * | fDQF |
Increments to molar G0 values of DCs from pure gas fugacities or DQF terms, normalized [L]. | |
double * | PUL |
Vector of upper restrictions to phases amounts X_a (reserved)[FIs]. | |
double * | PLL |
Vector of lower restrictions to phases amounts X_a (reserved)[FIs]. | |
double * | YOF |
Surface free energy parameter for phases (J/g) (to accomodate for variable phase composition) [FI]. | |
double * | Vol |
DC molar volumes, cm3/mol [L]. | |
double * | MM |
DC molar masses, g/mol [L]. | |
double * | Pparc |
Partial pressures or fugacities of pure DC, bar (Pc by default) [0:L-1]. | |
double * | Y_m |
Molalities of aqueous species and sorbates [0:Ls-1]. | |
double * | Y_la |
log activity of DC in multi-component phases (mju-mji0) [0:Ls-1] | |
double * | Y_w |
Mass concentrations of DC in multi-component phases,%(ppm)[Ls]. | |
double * | Gamma |
DC activity coefficients in molal or other phase-specific scale [0:L-1]. | |
double * | lnGmf |
ln of initial DC activity coefficients for correcting G0 [0:L-1] | |
double * | lnGmM |
ln of DC pure gas fugacity (or metastability) coeffs or DDF correction [0:L-1] | |
double * | EZ |
Formula charge of DC in multi-component phases [0:Ls-1]. | |
double * | FVOL |
phase volumes, cm3 comment corrected DK 04.08.2009 [0:FI-1] | |
double * | FWGT |
phase (carrier) masses, g [0:FI-1] | |
double * | G |
Normalized DC energy function c(j), mole/mole [0:L-1]. | |
double * | G0 |
Input normalized g0_j(T,P) for DC at unified standard scale[L]. | |
double * | lnGam |
ln of DC activity coefficients in unified (mole-fraction) scale [0:L-1] | |
double * | lnGmo |
Copy of lnGam from previous IPM iteration (reserved) | |
double(* | lnSAC )[4] |
former lnSAT ln surface activity coeff and Coulomb's term [Lads][4] | |
double * | B |
Input bulk chem. compos. of the system - b vector, moles of IC[N]. | |
double * | U |
IC chemical potentials u_i (mole/mole) - dual IPM solution [N]. | |
double * | U_r |
IC chemical potentials u_i (J/mole) [0:N-1]. | |
double * | C |
Calculated IC mass-balance deviations (moles) [0:N-1]. | |
double * | IC_m |
Total IC molalities in aqueous phase (excl.solvent) [0:N-1]. | |
double * | IC_lm |
log total IC molalities in aqueous phase [0:N-1] | |
double * | IC_wm |
Total dissolved IC concentrations in g/kg_soln [0:N-1]. | |
double * | BF |
Output bulk compositions of multicomponent phases bf_ai[FIs][N]. | |
double * | BFC |
Total output bulk composition of all solid phases [1][N]. | |
double * | XF |
Output total number of moles of phases Xa[0:FI-1]. | |
double * | YF |
Approximation of X_a in the next IPM iteration [0:FI-1]. | |
double * | XFA |
Quantity of carrier in asymmetric phases Xwa, moles [FIs]. | |
double * | YFA |
Approximation of XFA in the next IPM iteration [0:FIs-1]. | |
double * | Falp |
Karpov phase stability criteria F_a [0:FI-1] or phase stability index (PC==2) | |
double(* | VPh )[MIXPHPROPS] |
Volume properties for mixed phases [FIs]. | |
double((* | GPh )[MIXPHPROPS] |
Gibbs energy properties for mixed phases [FIs]. | |
double(((* | HPh )[MIXPHPROPS] |
Enthalpy properties for mixed phases [FIs]. | |
double((((* | SPh )[MIXPHPROPS] |
Entropy properties for mixed phases [FIs]. | |
double(((((* | CPh )[MIXPHPROPS] |
Heat capacity Cp properties for mixed phases [FIs]. | |
double((((((* | APh )[MIXPHPROPS] |
Helmholtz energy properties for mixed phases [FIs]. | |
double(((((((* | UPh )[MIXPHPROPS] |
Internal energy properties for mixed phases [FIs]. | |
double(* | XetaA )[MST] |
Total EDL charge on A (0) EDL plane, moles [FIs][FIat]. | |
double(* | XetaB )[MST] |
Total charge of surface species on B (1) EDL plane, moles[FIs][FIat]. | |
double(* | XetaD )[MST] |
Total charge of surface species on D (2) EDL plane, moles[FIs][FIat]. | |
double(* | XpsiA )[MST] |
Relative potential at A (0) EDL plane,V [FIs][FIat]. | |
double(* | XpsiB )[MST] |
Relative potential at B (1) EDL plane,V [FIs][FIat]. | |
double(* | XpsiD )[MST] |
Relative potential at D (2) plane,V [FIs][FIat]. | |
double(* | XFTS )[MST] |
Total number of moles of surface DC at surface type [FIs][FIat]. | |
double * | X |
DC quantities at eqstate x_j, moles - primal IPM solution [L]. | |
double * | Y |
Copy of x_j from previous IPM iteration [0:L-1]. | |
double * | XY |
Copy of x_j from previous loop of Selekt2() [0:L-1]. | |
double * | Qp |
Work variables related to non-ideal phases FIs*(QPSIZE=180) | |
double * | Qd |
Work variables related to DC in non-ideal phases FIs*(QDSIZE=60) | |
double * | MU |
mu_j values of differences between dual DC chem.potentials [L] | |
double * | EMU |
Exponents of DC increment to F_a criterion for phase [L]. | |
double * | NMU |
DC increments to F_a criterion for phase [L]. | |
double * | W |
Weight multipliers for DC (incl restrictions) in IPM [L]. | |
double * | Fx |
Dual DC chemical potentials defined via u_i and a_ji [L]. | |
double * | Wx |
Mole fractions Wx of DC in multi-component phases [L]. | |
double * | F |
Primal DC chemical potentials defined via g0_j, Wx_j and lnGam_j[L]. | |
double * | F0 |
Excess Gibbs energies for (metastable) DC, mole/mole [L]. | |
double(* | D )[MST] |
Reserved; new work array for calc. surface act.coeff. | |
char(* | sMod )[6] |
Codes for built-in mixing models of multicomponent phases [FIs]. | |
char(* | dcMod )[6] |
Codes for PT corrections for dependent component data [L]. | |
char(* | SB )[MAXICNAME+MAXSYMB] |
List of IC names in the system [N]. | |
char(* | SB1 )[MAXICNAME] |
List of IC names in the system [N]. | |
char(* | SM )[MAXDCNAME] |
List of DC names in the system [L]. | |
char(* | SF )[MAXPHNAME+MAXSYMB] |
List of phase names in the system [FI]. | |
char(* | SM2 )[MAXDCNAME] |
List of multicomp. phase DC names in the system [Ls]. | |
char(* | SM3 )[MAXDCNAME] |
List of adsorption DC names in the system [Lads]. | |
char * | DCC3 |
Classifier of DCs involved in sorption phases [Lads]. | |
char(* | SF2 )[MAXPHNAME+MAXSYMB] |
List of multicomp. phase names in the syst [FIs]. | |
char(* | SFs )[MAXPHNAME+MAXSYMB] |
List of phases currently present in non-zero quantities [FI]. | |
char * | pbuf |
Text buffer for table printouts. | |
char * | RLC |
Code of metastability constraints for DCs [L] enum DC_LIMITS. | |
char * | RSC |
Units of metastability/kinetic constraints for DCs [L]. | |
char * | RFLC |
Classifier of restriction types for XF_a [FIs]. | |
char * | RFSC |
Classifier of restriction scales for XF_a [FIs]. | |
char * | ICC |
Classifier of IC { e o h a z v i <int> } [N]. | |
char * | DCC |
Classifier of DC { TESKWL GVCHNI JMFD QPR <0-9> AB XYZ O } [L]. | |
char * | PHC |
Classifier of phases { a g f p m l x d h } [FI]. | |
char(* | SCM )[MST] |
Classifier of built-in electrostatic models applied to surface types in sorption phases [FIs][FIat]. | |
char * | SATT |
Classifier of applied SACT equations (isotherm corrections) [Lads]. | |
char * | DCCW |
internal DC class codes [L] | |
long int | ITF |
Number of completed IA EFD iterations. | |
long int | ITG |
Number of completed GEM IPM iterations. | |
clock_t | t_start |
clock_t | t_end |
double | t_elap_sec |
work variables for determining IPM calculation time | |
double * | Guns |
mu.L work vector of uncertainty space increments to tp->G + sy->GEX | |
double * | Vuns |
mu.L work vector of uncertainty space increments to tp->Vm | |
double * | tpp_G |
Partial molar(molal) Gibbs energy g(TP) (always), J/mole. | |
double * | tpp_S |
Partial molar(molal) entropy s(TP), J/mole/K. | |
double * | tpp_Vm |
Partial molar(molal) volume Vm(TP) (always), J/bar. | |
double * | XU |
dual-thermo calculation of DC amount X(j) from A matrix and u vector [L] | |
double(* | Uc )[2] |
Internal copy of IC chemical potentials u_i (mole/mole) at r-1 and r-2 [N][2]. | |
double * | Uefd |
Internal copy of IC chemical potentials u_i (mole/mole) - EFD function [N]. | |
char | errorCode [100] |
code of error in IPM (Ec number of error) | |
char | errorBuf [1024] |
description of error in IPM | |
double | logCDvalues [5] |
Collection of lg Dikin crit. values for the new smoothing equation. | |
double * | GamFs |
Copy of activity coefficients Gamma before the first enter in PhaseSelection() [L] new. | |
double | Pai [4] |
Pressure P, bar: start, end, increment for MTP array in DataCH , Ptol. | |
double | Tai [4] |
Temperature T, C: start, end, increment for MTP array in DataCH , Ttol. | |
double | Fdev1 [2] |
Function1 and target deviations for minimization of thermodynamic potentials. | |
double | Fdev2 [2] |
Function2 and target deviations for minimization of thermodynamic potentials. | |
double | XwMinM |
Cutoff mole amount for elimination of water-solvent { 1e-13 }. | |
double | ScMinM |
Cutoff mole amount for elimination of solid sorbent { 1e-13 }. | |
double | DcMinM |
Cutoff mole amount for elimination of solution- or surface species { 1e-30 }. | |
double | PhMinM |
Cutoff mole amount for elimination of non-electrolyte condensed phase { 1e-23 } insertion values (re-scaled to system size) | |
double | DFYwM |
Insertion mole amount for water-solvent { 1e-6 }. | |
double | DFYaqM |
Insertion mole amount for aqueous and surface species { 1e-6 }. | |
double | DFYidM |
Insertion mole amount for ideal solution components { 1e-6 }. | |
double | DFYrM |
Insertion mole amount for major solution components (incl. sorbent) { 1e-6 }. | |
double | DFYhM |
Insertion mole amount for minor solution components { 1e-6 }. | |
double | DFYcM |
Insertion mole amount for single-component phase { 1e-6 }. | |
double | DFYsM |
Insertion mole amount used in PhaseSelect() for a condensed phase component { 1e-7 }. | |
double | SizeFactor |
factor for re-scaling the cutoffs/insertions to the system size |
Contains chemical thermodynamic work data for GEM IPM-3 algorithm.
double MULTI::FitVar[5] |
Internal.
FitVar[0] is total mass (g) of solids in the system (sum over the BFC array) FitVar[1], [2] reserved FitVar[4] is the AG smoothing parameter; FitVar[3] is the actual smoothing coefficient
long int * MULTI::LsMod |
Number of interaction parameters.
Max parameter order (cols in IPx), and number of coefficients per parameter in PMc table [3*FIs]