Fesolubilityxaxisloop2.ppi

SPECIATION
  calculationType                      custom
  calculationMethod                    1
  xmin                                 2                  # x-axis variable will vary from 2 to 12 in 100 steps in the final simulation
  xmax                                 12                 # these changes in the x- (and y-axis) variable do not cause a line feed in the 'out' file
  resolution                           100

  loopmin                              -4                 # looping over the entire input file with <loop> ranging from -4 to -1
  loopmax                              -1                 #   in log steps of 1
  loopint                              1
  looplogvar                           1                  # = 1 means that <loop> = 10^<loop> immediately after the value is generated

PLOT
  plotTitle                            "Fe(OH)3(a) solubility vs pH<br>(using x_axis and loop tags)"
  xtitle                               pH
  ytitle                               "log<sub>10</sub> Fe<sub>T</sub> (mol/kgw)"
  pymax                                0
  customXColumn                        pH                  # pH is defined as a column heading below
  lines                                FeT                 # FeT is defined as a column heading below
  changecolor                          T
  useLineColorDictionary               0                   # 0 = use the ‘randomly’ selected colours generated by PhreePlot not the dictionary
  legendTextSize                       2                   # legend is defined in extratext which includes legend title
  labels                               "10<sup>-4</sup>M F" "10<sup>-3</sup>M F" "10<sup>-2</sup>M F" "10<sup>-1</sup>M F"
  extratext                            extratextlegend.dat # contains the position to where the legend will be relocated


CHEMISTRY

# calculations done in two simulations - faster to only do the initial solution calculations once

# however, all simulations are repeated whenever the <loop> variable changes which makes this setup work

# first simulation - initial solution calculations will be carried out once for each loop

PHASES
Fix_H+; H+ = H+; log_k 0

SELECTED_OUTPUT
  -reset FALSE

USER_PUNCH
  headings pH FeT                                          # defines column names in the selected output and 'out' files
10 PUNCH -la("H+"), log10(TOT("Fe"))                       # defines the values

SOLUTION 1
   pH        1.8
   units     mol/kgw
   Fe(3)     1e-1                                          # total Fe+3
   Na        <loop>                                        # current value of <loop>
   F         <loop>
END

# it is computationally quicker to split into two simulations when possible
# second simulation - this final simulation only will be repeated whenever the <x_axis> variable changes ('final' is critical here)
USE solution 1
EQUILIBRIUM_PHASES 1
   Fix_H+ -<x_axis> NaOH 10
     -force_equality true
   O2(g)  -0.677

   Fe(OH)3(a) 0 0                                          # amorphous Fe(OH)3 will only precipitate, not dissolve
END