iso.ppi
|
|
|
# simple example of fitting to a Langmuir isotherm using unit weighting
# basic fit with isotherm plot
SPECIATION
jobTitle "Test fitting: absolute errors (unit weighting)"
calculationType fit
calculationMethod 1
FIT
dataFile iso.dat # contains a list of observations and independent variables
onepass FALSE # does a separate PHREEQC simulation for each observation -
# slow but easy to set up
dependentVariableColumnObs Znsorbed # name of column in fit data file containing the observations (dep variable)
dependentVariableColumnCalc sorbZn # name of column in selected output file containing the calcd values of the dep variable
fitWeightingMethod 0 # 0 = unit weights
fitFiniteDiffStepSize 1.0E-3 # initial step size for each adjustable parameter
mainLoopColumn sim # column header in fit data file for which PHREEQC simulation(s) to use for each observation
numberOfFitParameters 2
fitParameterNames log_k M1
fitLogParameters 0 0 # 0 = parameters on a linear scale, 1 = log10 parameters before fitting
fitAdjustableParameters 1 1 # 1 = adjustable
fitParameterValues 3.0 1.0 # initial values (starting point)
PLOT
plotTitle "Zn sorption on Hfo"
xtitle "Zn concn (mmol/L)"
ytitle "Zn sorbed (mmol Zn/mol Fe)"
# plot isotherm (x = Znconcn, y = sorbed)
lines calculated # y = line from calculated values from out file with column heading = 'calculated'
points observed # y = points from observed values from out file with column heading = 'observed'
lineWidth 0.4
lineColor red
labelSize 0.0 # no labels on plot
legendTextSize 0.0 # no legend (key)
pointSize 4.0
customXcolumn Znconcn # x = Znconcn column in out file
extraText "extratextiso.dat" # extra text on plot
CHEMISTRY
PHASES
Fix_H+
H+ = H+
log_k 0.0
SURFACE_MASTER_SPECIES
Surf Surf
SURFACE_SPECIES
Surf = Surf
log_k 0.0
Surf + Zn+2 = SurfZn+2 # Langmuir model
log_K <log_k> # this is where log_k (updated parameter value) is substituted
SELECTED_OUTPUT
-high_precision true
-reset false
PRINT
-reset false
USER_PUNCH
# fit Langmuir isotherm
-headings sorbZn pH mmolZn step_no # these are the column headings used for tag names: NB this is the output pH not the input pH
10 sorbedZn=SURF("Zn","Surf")
20 if sorbedZn>0 THEN punch sorbedZn, -la("H+"), tot("Zn")*1e3, step_no # NB variable name (used internally) is distinct from column header
SOLUTION 1
-pH <pHobs>
-units mmol/L
Na 1000 # 1 M NaNO3 background electrolyte
N(5) 1000
Zn <Znconcn> # <Znconcn> from iso.dat
SURFACE
Surf <M1> # this is where the max number of sites (updated parameter) is substituted
-equil 1
-no_edl
EQUILIBRIUM_PHASES
Fix_H+ -<pHobs> NaOH # pHobs from the fit data file
-force_equality true
END
|
|