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 »
  • USER_PUNCH/USER_GRAPH »
  • BASIC functions »
  • Iterating through solutions
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Iterating through solutions  (Read 831 times)

liamkun

  • Contributor
  • Posts: 3
Iterating through solutions
« on: January 12, 2020, 01:33:40 PM »
Is there a way to iterate through each solution without having to write out 50 separate simulations? I've tried looking at the manual for using Basic code but really not sure about the syntax, would this be the way to go or a RUN_CELLS routine?

Note: using FREZCHEM.dat,

Code: [Select]
SELECTED_OUTPUT
    -file all.txt
    -temperature
    -pH
    -activities HCO3- CO2 CO3-2 H2O
    -Ionic_strength
    -si Ice(s) Hydrohalite Halite Nahcolite Natron

SOLUTION_SPREAD 1
    -units mol/l
Number    Na    Cl   C(4)

1 0.11    0.1     0.01
2 0.51 .  0.1     0.01
...
50 4.5    4     0.5
END

USE SOLUTION 1
EQUILIBRIUM_PHASES
Ice(s) 0.0 0
REACTION_TEMPERATURE
    25 -35 in 25 steps
END
....

USE SOLUTION 50
EQUILIBRIUM_PHASES
Ice(s) 0.0 0
REACTION_TEMPERATURE
    25 -35 in 25 steps
END

Thank you in advance for any help
« Last Edit: January 12, 2020, 01:59:46 PM by liamkun »
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2544
Re: Iterating through solutions
« Reply #1 on: January 12, 2020, 06:16:38 PM »
One option is to define EQUILIBRIUM_PHASES 1, REACTION_TEMPERATURE 1, and SOLUTION_SPREAD followed by a line for each solution that you could generate in an editor or Excel:

Code: [Select]
USE solution 1; USE equilibrium_phases 1; USE reaction_temperature 1
USE solution 2; USE equilibrium_phases 1; USE reaction_temperature 1
...
USE solution 50; USE equilibrium_phases 1; USE reaction_temperature 1

Another option is to define EQUILIBRIUM_PHASES 1-50, REACTION_TEMPERATURE 1-50, and SOLUTION_SPREAD followed by RUN_CELLS (here demonstrating options for defining the list of cells):

Code: [Select]
RUN_CELLS
-cells 1  2-3 4-50
END
Logged

liamkun

  • Contributor
  • Posts: 3
Re: Iterating through solutions
« Reply #2 on: January 20, 2020, 12:01:11 PM »
Great Thanks for your help
Logged

Charlie

  • Admin
  • Posts: 159
Re: Iterating through solutions
« Reply #3 on: January 20, 2020, 04:20:53 PM »
USE solution 1; USE equilibrium_phases 1; USE REACTION 1; END
USE solution 2; USE equilibrium_phases 1; USE REACTION 1; END
USE solution 3; USE equilibrium_phases 1; USE REACTION 1; END
USE solution 4; USE equilibrium_phases 1; USE REACTION 1; END
USE solution 5; USE equilibrium_phases 1; USE REACTION 1; END

I found that adding END at the end made this work
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • USER_PUNCH/USER_GRAPH »
  • BASIC functions »
  • Iterating through solutions
 

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