isopp.ppi
|
|
|
# This demonstrates an efficient (fast) method of fitting data to a PHREEQC model.
# It uses the PhreePlot pre-processor which replicates blocks of PHREEQC code with minor changes.
# This enables the 'one pass' option to be used and avoids the copying normally necessary (cf ison.ppi).
# The expanded input file is writen to the log file.
SPECIATION
jobTitle "Test fitting"
calculationType "fit"
calculationMethod 1
FIT
dataFile "isopp.dat" # fit data file - has observations
onePass TRUE # this produces a block of selected output with 10 lines of data (not 1)
mainLoop 1
dependentVariableColumnObs sorbed # column in isopp.dat
dependentVariableColumnCalc Znsorbed # column in selected output
fitFiniteDiffStepSize 1.0E-03 # initial step size for parameter adjustment
weightColumn wt # column in fit data file with the weights
numberOfFitParameters 2
fitParameterNames "log_k" "M1"
fitLogParameters 0 0
fitAdjustableParameters 1 1 # 1= adjustable, 0 = fixed
fitParameterValues 3. 1. # initial values
PLOT
plotTitle "Zn sorption on Hfo<br>(all in one pass of the input preprocessor)"
xtitle "Zn concn (mmol/L)"
ytitle "Zn sorbed (mmol Zn/mol Fe)"
lines calculated # plot this column from the out file as lines
points observed
lineWidth 0.4
lineColor "red"
labelSize 0.0
legendTextSize 0.0
pointSize 4.0
customXcolumn Znconcn
# debug 3 # to see input and selected output on screen
CHEMISTRY
PRINT
-reset false
SURFACE_MASTER_SPECIES
Surf Surf
SURFACE_SPECIES
Surf = Surf
log_k 0
Surf + Zn+2 = SurfZn+2
log_k <log_k> # from fitParameterNames
SELECTED_OUTPUT
-high_precision true
-reset false
USER_PUNCH
-headings Znsorbed pH molZn step
10 sorbedZn=SURF("Zn","Surf")
20 if (step_no = 0) THEN punch sorbedZn, -la("H+"), tot("Zn")*1e3, step_no
SOLUTION_SPREAD
Description Zn pH Na N(5)
mmol/kgw mmol/kgw mmol/kgw
1 3.00E-02 5.5 1000 1000
2 6.90E-02 5.5 1000 1000
3 1.18E-01 5.5 1000 1000
4 1.66E-01 5.5 1000 1000
5 2.17E-01 5.5 1000 1000
6 2.70E-01 5.5 1000 1000
7 3.25E-01 5.5 1000 1000
8 3.88E-01 5.5 1000 1000
9 4.53E-01 5.5 1000 1000
10 5.12E-01 5.5 1000 1000
END
<repeatStart1> 1 10
SURFACE
Surf <M1> # from fitParameterNames
-no_edl
-equil <repeatValue1>
END
<repeatEnd1>
|
|