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 »
  • Basic question about Selected_Output
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Basic question about Selected_Output  (Read 260 times)

pdomski

  • Contributor
  • Posts: 7
Basic question about Selected_Output
« on: June 10, 2022, 06:21:08 PM »
Hello,

It's been a few years since I've used PHREEQC, I've living in EQ3/6 land, and I can't remember how to use Selected_Output to add consecutive lines to a file.  I've done it before, but I can't find my old input files, I want to calculate the solution composition in increasingly concentrated MgCl2 solns while increasing the pH, this is an exercise to check the log K of Mg2Cl(OH)3:4H2O against experimental data.  Without the END statement I only get the last solution comp, and with the END statement I don't get anything. I seem to recall needing a USER_PUNCH in there somewhere, thoughts?

Thanks for any insights.

Paul Domski

Here's the file:
SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Mg        1
    Cl        2
    -water    1 # kg

PHASES
pH_Fix
    H+ = H+
    log_k     0
EQUILIBRIUM_PHASES 1
    Mg2Cl(OH)3:4H2O 0 10
    pH_Fix    -9.07 HCl       10
END


SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Mg        1.5
    Cl        3.0
    -water    1 # kg

PHASES
pH_Fix
    H+ = H+
    log_k     0
EQUILIBRIUM_PHASES 1
    Mg2Cl(OH)3:4H2O 0 10
    pH_Fix    -8.97 HCl       10
END

SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Mg        2
    Cl        4.0
    -water    1 # kg

PHASES
pH_Fix
    H+ = H+
    log_k     0
EQUILIBRIUM_PHASES 1
    Mg2Cl(OH)3:4H2O 0 10
    pH_Fix    -8.88 HCl       10
END

SELECTED_OUTPUT 1
    -file                 P-3_1.csv
    -high_precision       true
    -simulation           false
    -state                false
    -solution             false
    -distance             false
    -time                 false
    -step                 false
    -pe                   false
    -reaction             false
    -temperature          false
    -alkalinity           false
    -ionic_strength       true
    -water                true
    -charge_balance       false
    -percent_error        false
    -totals               Mg  Cl
    -molalities           H+  OH- MgOH+
    -saturation_indices   Mg2Cl(OH)3:4H2O  Mg3Cl(OH)5:4H2O

Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Basic question about Selected_Output
« Reply #1 on: June 10, 2022, 09:43:50 PM »
The key is the END statements. Let's call the definitions between END statements a simulation (assume there is an END at the beginning of the file and the end of the file). SELECTED_OUTPUT will be in effect from the simulation in which it is defined and for all subsequent simulations.

So, if you move the SELECTED_OUTPUT definition to the beginning of the file it will apply to all calculations. In the case below, there will be an initial solution calculation and a reaction calculation for each of three "simulations", with the selected output file containing 6 lines.

With a few more END and USE statements, it is possible to omit initial solution calculations from the selected output file with PRINT; -selected_output false and PRINT; -selected_output true. There is also SELECTED_OUTPUT 1; -active true/false. USER_PUNCH n will follow the print logic for SELECTED_OUTPUT n.


Code: [Select]
PHASES 1
pH_Fix
    H+ = H+
    log_k     0
Mg2Cl(OH)3:4H2O
        Mg2Cl(OH)3:4H2O +3.0000 H+  =  + 1.0000 Cl- + 2.0000 Mg++ + 7.0000 H2O
        log_k           25.8319
-delta_H 0       # Not possible to calculate enthalpy of reaction Oxychloride-Mg
# Enthalpy of formation: 0 kcal/mol

SELECTED_OUTPUT 1
    -file                 P-3_1.csv
    -high_precision       true
    -simulation           false
    -state                false
    -solution             false
    -distance             false
    -time                 false
    -step                 false
    -pe                   false
    -reaction             false
    -temperature          false
    -alkalinity           false
    -ionic_strength       true
    -water                true
    -charge_balance       false
    -percent_error        false
    -totals               Mg  Cl
    -molalities           H+  OH- MgOH+
    -saturation_indices   Mg2Cl(OH)3:4H2O  Mg3Cl(OH)5:4H2O
SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Mg        1
    Cl        2
    -water    1 # kg
EQUILIBRIUM_PHASES 1
    Mg2Cl(OH)3:4H2O 0 10
    pH_Fix    -9.07 HCl       10
END

SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Mg        1.5
    Cl        3.0
    -water    1 # kg
EQUILIBRIUM_PHASES 1
    Mg2Cl(OH)3:4H2O 0 10
    pH_Fix    -8.97 HCl       10
END
SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Mg        2
    Cl        4.0
    -water    1 # kg

EQUILIBRIUM_PHASES 1
    Mg2Cl(OH)3:4H2O 0 10
    pH_Fix    -8.88 HCl       10
END
Logged

pdomski

  • Contributor
  • Posts: 7
Re: Basic question about Selected_Output
« Reply #2 on: June 11, 2022, 10:11:04 PM »
Thank you so much.  I ended up using a different approach to this problem, which gave the results I needed.  Rather than specifying the pH I let the code calculate it to show where brucite transitioned to the oxychloride phase in pH (pmH) - Mg space.

SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
   -water    1 # kg
PHASES
MgCl2
    MgCl2 = Mg++ + 2Cl-
    log_k     500

EQUILIBRIUM_PHASES 1
    Brucite   0 10
    Mg2Cl(OH)3:4H2O 0 10 precipitate_only

REACTION 1
    MgCl2      1
    6 moles in 60 steps


SELECTED_OUTPUT 1
    -file                 Alt_bruc3.csv
    -high_precision       true
    -simulation           false
    -state                false
    -solution             false
    -distance             false
    -time                 false
    -step                 false
    -pe                   false
    -reaction             false
    -temperature          false
    -alkalinity           false
    -ionic_strength       true
    -water                true
    -charge_balance       false
    -percent_error        false
    -totals               Mg  Cl
    -molalities           H+  OH-  MgOH+
    -equilibrium_phases   Mg2Cl(OH)3:4H2O  Brucite
    -saturation_indices   Mg2Cl(OH)3:4H2O  Mg3Cl(OH)5:4H2O Brucite
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • Basic question about Selected_Output
 

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