PhreeqcUsers Discussion Forum
Click here to donate to keep PhreeqcUsers open

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • problems of Species Plot
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: problems of Species Plot  (Read 307 times)

Xavier.Qiu

  • Frequent Contributor
  • Posts: 10
problems of Species Plot
« on: September 20, 2022, 04:57:37 PM »
Hello!

    I try to make a species image according to the example given by the chapter 11 Species Plot in the manual

PhreeqcPlot, I enter 4 species but I can only see one specie in the image, I have checked the log file for many times, but

I don't find the errors. Here are what the log file show, I am sorry because it seems to be I can't upload the file to the

attachment because of some unknown erros.

     Thank you very much for read my questions!

Code: [Select]

*** PhreePlot 1 (Win-ifort-2021.5-x64) 11:05:43 3 Feb 2022
    Incorporating the iPhreeqc library (3.7.3-15968-x64)
      by DL Parkhurst, SR Charlton (USGS), & CAJ Appelo (Amsterdam)
    Hunt & Track by DG Kinniburgh and DM Cooper (CEH, NERC)
    Fitting by MJD Powell and others
    Postscript plotting by KE Kohler
    Linux & Mac versions by M Vetuschi Zuccolini (DISTAV, Univ. Genova)
 
23:44:32 20 September 2022
Input filename: D:\phreeqcplot\demo\species_try\ANDRA.ppi.
 
Job title                      U-Cl-H<sub>2</sub>O <br> speciation vs pH.
-------------------------------------------------------- System --------------------------------------------------------
Command line parameters
0                              C:\Program Files\PhreePlot\pp.exe
1                              D:\phreeqcplot\demo\species_try\ANDRA.ppi

PHREEPLOT environment variable D:\phreeqcplot
PHREEPLOT_PATH                 C:\Program Files\PhreePlot
PhreePlot version              1
Speciation program             PHREEQC
Version                        3.7.3-15968-x64
Database                       D:\phreeqcplot\demo\species_try\PHREEQC_Davies_e-_ThermoChimie_v11a.dat
Database version               
Current working directory      D:\phreeqcplot\demo\species_try\
System directory               D:\phreeqcplot\system\
Input file directory           D:\phreeqcplot\demo\species_try\
Fill colour dictionary         fillcolor.dat (not found)
Line colour dictionary         D:\phreeqcplot\demo\species_try\linecolor.dat
------------------------------------------------ Ghostscript and fonts -------------------------------------------------
Ghostscript executable         C:\Program Files\PhreePlot\gswin64c.exe (PhreePlot)
Ghostscript version            GPL Ghostscript 9.52 (2020-03-19)
Fonts file                     D:\phreeqcplot\system\fonts.dat
Font family or font requested  Times-Roman
Base font used                 Times-Roman
 
==================================== Job: U-Cl-H<sub>2</sub>O <br> speciation vs pH ====================================
Calculation type               custom
Calculation method             calculate and plot
Main species                   UNDEFINED
<loop>                         min = UNDEFINED       max = UNDEFINED       int = UNDEFINED
<y_axis>                       min = UNDEFINED       max = UNDEFINED
<x_axis>                       min =   -13.000       max =   -6.0000
Resolution                     100
 
====================================================== Input file ======================================================
SPECIATION
    jobTitle "U-Cl-H<sub>2</sub>O <br> speciation vs pH"
    calculationType custom
    calculationMethod 1
    xmin -13.0
    xmax -6.0
    # determines the number of points at which speciation is calculated
    resolution 100
    database PHREEQC_Davies_e-_ThermoChimie_v11a.dat
PLOT
    plotTitle "U-Cl-H<sub>2</sub>O <br> speciation vs pH"
    xtitle pH
    ytitle "% species"
    pxmax 13
    # explicit naming of species - order defined in user_punchU.inc
    lines UO2+2 UO2Cl2  UO2CO3 UO2Cl+
    lineColor blue
    pointSize 5.0
    xaxisLength 200
    font Times-Roman
    # use first column as defined by include files - this is pH
    customXcolumn 1
    # this prevents minor species being plotted
    minimumYValueForPlotting 5.0
    extraText "extratextUspeciation.dat"
CHEMISTRY
include 'Uvsph.inc' # nested includes
-------------------------------------------------- Override settings ---------------------------------------------------
# add any input here that you want to override settings in pp.set and *.ppi
--------------------------------------------------- Input chemistry ----------------------------------------------------

Chemistry divided into PHREEQC simulations:

    1: USER_PUNCH
    2: -heading pH UO2+2 UO2Cl2  UO2CO3 UO2Cl+
    3: -start
    4: 10 punch -la("H+")
    5: 20 Ut=SYS("U",n,n$,t$,c)
    6: 30 rem sort array n long
    7: 40 gosub 1000
    8: 50 for i=1 to n
    9: 60   punch 100*c(i)/Ut
   10: 65   print i, n$(i)
   11: 70 next i
   12: 80 print
   13: 90 end
   14: 1000 rem insertion sort (from Numerical Recipes)
   15: 1010 for j=2 to n
   16: 1020   a$=n$(j)
   17: 1021   t=c(j)
   18: 1030   for i=j-1 to 1 STEP -1
   19: 1040      if (n$(i)<=a$) then goto 1080
   20: 1050      n$(i+1)=n$(i)
   21: 1051      c(i+1)=c(i)
   22: 1060   next i
   23: 1070   i=0
   24: 1080   n$(i+1)=a$
   25: 1081   c(i+1)=t
   26: 1090 next j
   27: 1091 return
   28: -end
   29: PRINT
   30: -reset false
   31: PHASES
   32: Fixed_H+
   33: H+ = H+
   34: log_k 0.0
   35: SELECTED_OUTPUT
   36: -high_precision       true
   37: -reset                false
   38: SOLUTION 1
   39: temp      18.4
   40: pH        7.56
   41: units     mg/kgw
   42: density   1
   43: Cl(-1)    2000 charge
   44: Na        485.42
   45: U         10 mMol/kgw
   46: -water    1
   47: EQUILIBRIUM_PHASES
   48: O2(g)     -0.677  10
   49: Fixed_H+  <x_axis>  NaOH 10
   50: END
........................................................ End 1 .........................................................

1 PHREEQC simulations found.

The main loop simulation (1) has been run 100 times.

Calculation time for this loop was .768 sec.

 
====================================================== Plotting 1 ======================================================

The colour dictionary was found and opened: D:\phreeqcplot\demo\species_try\linecolor.dat.
The colour dictionary will NOT be used for reading colours (see useLineColorDictionary).

Reading plot data:
D:\phreeqcplot\demo\species_try\ANDRA.out
   100 points read from the file: D:\phreeqcplot\demo\species_try\ANDRA.out for the label, UO2+2.
D:\phreeqcplot\demo\species_try\ANDRA.out
   100 points read from the file: D:\phreeqcplot\demo\species_try\ANDRA.out for the label, UO2Cl2.
D:\phreeqcplot\demo\species_try\ANDRA.out
   100 points read from the file: D:\phreeqcplot\demo\species_try\ANDRA.out for the label, UO2CO3.
D:\phreeqcplot\demo\species_try\ANDRA.out
   100 points read from the file: D:\phreeqcplot\demo\species_try\ANDRA.out for the label, UO2Cl+.

Dataset Label(1:30)                    ------------- Lines -------------   ------------- Points -------------   ------ Rims -------    np
                                       selected  type  color        inch   selected   type  color        inch   color        factor
      1 UO2Cl+                           yes       1   blue4       0.012     no         1               0.197                 0.050   100

------------------------------------------------------ Labelling -------------------------------------------------------
Labelling effort = 1         Label size = 2.000 mm         Start label colour = black
Label positioning optimized.

Labelling for plot 1:
num       x(mm)     y(mm)        label
    1    113.628   155.932      "UO2Cl+"

extraText file read: extratextUspeciation.dat
Custom plot completed.
 
================================================= Writing Plot file(s) =================================================
ps   file written: D:\phreeqcplot\demo\species_try\ANDRA.ps.
ps   file written: D:\phreeqcplot\demo\species_try\plot.ps.
 
======================================================= Wrap-up ========================================================

Input file executed 100 times and any plotting completed in .902 sec.


Total time taken was 1.104 sec.

Done.

...
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2823
Re: problems of Species Plot
« Reply #1 on: September 21, 2022, 03:59:31 AM »
I am not sure what is wrong with your files. I would need to see the .ppi file and all of the auxiliary files. Even then, I might have to get in touch with David Kinniburgh.

I expect you are using the examples in the demo directory. Here is a ppi file I created based on the examples in the PHREEPLOT example demo\Uspeciation that shows the percent in the major species. I have used a slightly earlier version of the thermochimie database. The logic of the calculation uses the PHREEPLOT file as defined by: include 'speciesvsph.inc'.

The only thing that comes to mind is that the use of "minimumYValueForPlotting" may be part of the issue. The order in speciesvsph.inc is largest to smallest concentration. By using the order of species name, PHREEPLOT may stop when it encounters a small concentration because it expects all the remaining concentrations to be smaller. You could try making minimumYValueForPlottinga very small number (1e-100) to see if it makes a difference.

BTW, the SYS command has been modified optionally to accept one more parameter. If the sixth parameter is 1, then the data are ordered by the name, which is equivalent to your sorting subroutine.



Code: [Select]
SPECIATION
  jobTitle                             "Speciation vs pH using 'species' plot type"
  calculationType                      species
  calculationMethod                    1
  database                             Thermochimie_PhreeqC_Davies_electron_v10a.dat
  mainSpecies                          "U"                 # species vs pH for U
  xmin                                 3.0                 # pH min
  xmax                                 10.0                # pH max
  resolution                           100                 # number of points per curve
  numericTags                          <pCO2> = "-3.5" \   # used below
                                       <pO2> = "-0.7"
PLOT
  plotTitle                            "U speciation vs pH (oxidizing conditions)<br>(using thermochimie10a.dat)"
  pxmin                                3.0                 # plot limits
  pxmajor                              1.0                 # major ticks and numbering
  pxminor                              1.0                 # minor ticks
  useLineColorDictionary               1                   # force to take colours from dictionary
  labelSize                            1.5                 # curve labels inside plot
  minimumYValueForPlotting             5.0                 # omit any curve with max(concn)<5%

CHEMISTRY

include 'speciesvsph.inc'                                  # PHREEQC code to generate species-conc pairs

PHASES
Fix_H+
   H+ = H+
   log_k 0.0

SELECTED_OUTPUT
    -high_precision       true
    -reset                false

SOLUTION 1                                                 # first simulation - initial solution
   temp      25
   pH        7
   pe        4
   units     mol/kgw
   density   1
   U         1e-6
   Cl        0.01
   Na        0.01
END

USE solution 1                                             # second simulation - loop on this one
EQUILIBRIUM_PHASES
   O2(g)     <pO2>
   Fix_H+  -<x_axis>  NaOH
      -force_equality true
#   CO2(g)    <pCO2>
END
Logged

Xavier.Qiu

  • Frequent Contributor
  • Posts: 10
Re: problems of Species Plot
« Reply #2 on: September 21, 2022, 08:22:19 AM »
  Thank you for your reply much, when I change the minimumYValueForPlotting to 1e-100, it works.

  And I try to plot the image of proportion of each valence state of element U,but the proportion of the highest concentration of the 4 substances is 25% but not 100%. It seems strange.
 
  I am sorry that I can't upload the file because some errors unknown, so I attach the code in all of my related file. Could you help me check whether there are some errors? Thank you again for your patient reply!

 this is the code in the ppi file
Code: [Select]
SPECIATION
    jobTitle "U-Cl-H<sub>2</sub>O <br> speciation vs pH"
    calculationType custom
    calculationMethod 1
    xmin -13.0
    xmax -6.0
    # determines the number of points at which speciation is calculated
    resolution 100
    database PHREEQC_Davies_e-_ThermoChimie_v11a.dat
PLOT
    plotTitle "U-Cl-H<sub>2</sub>O <br> speciation vs pH"
    xtitle pH
    ytitle "% species"
    pxmax 13
    # explicit naming of species - order defined in user_punchU.inc
    lines U(+3) U(+4) U(+5) U(+6)
    lineColor blue
    pointSize 5.0
    xaxisLength 200
    font Times-Roman
    # use first column as defined by include files - this is pH
    customXcolumn 1
    # this prevents minor species being plotted
    minimumYValueForPlotting 1e-100
    extraText "extratextUspeciation.dat"
CHEMISTRY
include 'Uvsph.inc' # nested includes

this is the code in the user_punchU.inc file
Code: [Select]
USER_PUNCH
# headings depends on database used - they must be in ascending alphabetic order ignoring ()
-heading pH U(+3) U(+4) U(+5) U(+6)
-start
10 punch -la("H+")
20 Ut=SYS("U",n,n$,t$,c)
30 rem sort array n long
40 gosub 1000
50 for i=1 to n
60   punch 100*c(i)/Ut
65   print i, n$(i)          # but printed output only if PRINT is true
70 next i
80 print
90 end

include 'sort.inc'

this is the code in the Uvsph.inc file
Code: [Select]
include 'user_punchU.inc'
PRINT
 -reset false    # change to 'true' for printed output with debug = 2
PHASES
Fixed_H+
   H+ = H+
   log_k 0.0
SELECTED_OUTPUT
    -high_precision       true
    -reset                false
SOLUTION 1
    temp      18.4
    pH        7.56
    units     mg/kgw
    density   1
    Cl(-1)    2000 charge
    Na        485.42
    U         10 mMol/kgw
    -water    1 # kg
EQUILIBRIUM_PHASES
   O2(g)     -0.677  10
   Fixed_H+  <x_axis>  NaOH 10
END

And at last it's the code in the  extratestUspeciation.dat
Code: [Select]
#1 auto auto "<input:SPECIATION,>" 1.1 red 0 0
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2823
Re: problems of Species Plot
« Reply #3 on: September 21, 2022, 02:27:42 PM »
Just changing the headings does not produce the plot that you want.

I don't know why you are sorting on the species name. That may be useful to you, but PHREEPLOT normally expects data in pairs of (a) name and (b) concentration, sorted from highest moles to lowest. I expect that only every other concentration is being used, so you are not getting 100 percent of anything, but you are not getting total redox states anyway.

If you look at demo\redox_predominance\Uredox.ppi, it plots a pH-O2 diagram of redox state predominance. It uses a file named 'ht1redox.inc' to calculate the predominant redox state using a series of calls to SYS with arguments U(-8), U(-7), .... U(8), sorting the results by concentration, and then identifying the nonzero redox states that are PUNCHed in USER_PUNCH. You can replace the call to 'ht1redox.inc' with 'ht1.inc' to generate a plot with the predominant species, instead of total redox state, as a function of pH and O2.
Logged

Xavier.Qiu

  • Frequent Contributor
  • Posts: 10
Re: problems of Species Plot
« Reply #4 on: September 23, 2022, 04:36:23 PM »
Thank you very much for your continued help, Mr. David!

And when I try to follow the guide in the manual PhreeqcPlot, I meet some problems.

This is the content in the page 137 of the manual

Therefore a pe-pH diagram can be most easily prepared by specifying the y-axis variable to be log f O2(g) and then converting the redox scale with the yscale setting. It is possible to drive the y axis with the pe by defining the pe in an analogous way to that used for pH:

Code: [Select]
Fixed_e
e- = e-
log_k 0.0

and then
Code: [Select]
EQUILIBRIUM_PHASES
...
Fixed_e- <loge-> O2(g)

where the sign of the y-axis variable is reversed using
Code: [Select]
numericTags <loge-> = -<y_axis>
I try to follow the guide to change my file ppi, and this is the code
Code: [Select]
SPECIATION
    calculationType "ht1"
    calculationMethod 1
    mainSpecies "U"
    xmin 2.0
    xmax 10.0
    ymin -80.0
    ymax 0.0
    loopmin -6
    loopmax -2
    loopint 2
    looplogvar 1
    resolution 200
    database PHREEQC_Davies_e-_ThermoChimie_v11a.dat
    png T
# used in extraText file
numericTag <logUt> = <logloop>
numericTag <loge-> = -<y_axis>
PLOT
    plotTitle "Uranium redox states"
    xtitle "pH"
    ytitle "log <i>f</i> O<sub>2</sub>(g)"
    yscale pe
    #extraText "extratextUredox.dat"
    multipagefile t
    font Times-Roman
    xaxisLength 180
    yaxisLength 120
CHEMISTRY
PHASES
    Fix_H+
    H+ = H+
    log_k 0.0
    Fixed_e-
    e- = e-
    log_k 0.0
#include 'ht1.inc'
include 'ht1redox.inc'
SOLUTION 1
    temp 25
    pH 1.8
units mol/kgw
    U <loop>
    Na 1e-1
    Cl 1e-1
SAVE solution 1
END
# main loop - iterate here
USE solution 1
EQUILIBRIUM_PHASES 1
    Fix_H+ -<x_axis> NaOH 10
    -force_equality true
    Fixed_e- <loge-> O2(g)
    CO2(g) -3.5 1.0
END

But the log file gives me errors
Code: [Select]
File:    D:\phreeqcplot\demo\dachuang\redox_state_ex39\ANDRA\ANDRA_redox_state.ppi:18
Keyword: numericTags
Error:   <loge->: <loge-> : Tag definition must not contain +-/* ()<>^\
<loge->  =   -<y_axis>
...

Total time taken was .036 sec.

Failed.

...

I am sorry that why '-' is not allowed to used in the tag definition,is there any other solution?

Thank you very much!
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2823
Re: problems of Species Plot
« Reply #5 on: September 23, 2022, 05:47:25 PM »
The file phreeplot\demo\Fe\hfope.ppi generates a pe-pH diagram.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • problems of Species Plot
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2