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 »
  • SELECTED_OUTPUT »
  • Selected output mineral precipitation
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Selected output mineral precipitation  (Read 64 times)

Yongqiang

  • Top Contributor
  • Posts: 81
Selected output mineral precipitation
« on: March 17, 2023, 03:23:44 AM »
Hi PHREEQC developers and users,

I wonder if there is any method for PHREEQC to automatically output all the mineral precipitations?

Regards,
Michael
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2823
Re: Selected output mineral precipitation
« Reply #1 on: March 17, 2023, 04:45:48 AM »
There is no single option to print all of the EQUILIBRIUM_PHASES mole transfers, if that is what you are asking. There are possibiities to get the information, but it requires a bit of work.

The best that can be done is to use the SYS function to generate the output. Here is one possibility.

Code: [Select]
SOLUTION
END
USE solution 1
EQUILIBRIUM_PHASES
Calcite 0 10
Gypsum 0 10
REACTION
CO2 1
0.1 mol in 4 steps
SELECTED_OUTPUT 2
-file equi_list
USER_PUNCH 2
-heading Minerals
10 e = SYS("equi", count , name$ , type$ , moles, 1 )
20 tab$ = CHR$(9)
30 FOR i = 1 TO count
40   s$ = s$ + name$(i) + tab$ + STR_E$(EQUI_DELTA(name$(i)),15,6) + tab$
50 NEXT i
60 PUNCH s$
END

If you use the same set of EQUILIBRIUM_PHASES throughout a series of calculations, you can make a preliminary calculation, and automate writing a SELECTED_OUTPUT or SELECTED_OUTPUT and USER_PUNCH data block, and then use INCLUDE$ to include the data block(s) (see example 8 in the manual).

If you are using PhreeqcRM, there are methods to obtain a complete list of EQUILIBRIUM_PHASES that are defined through the InitialPhreeqc instance. It is then possible to construct a SELECTED_OUTPUT and USER_PUNCH data blocks that can be used in the simulation, in a way similar to example 8. The examples Advect_cpp, Advect_c, Advect_f90 have subroutines named example_selected_output that demonstrate how you could automatically generate the data blocks that would write the mole transfers for all the equilibrium phases and other types of reactants.
Logged

Yongqiang

  • Top Contributor
  • Posts: 81
Re: Selected output mineral precipitation
« Reply #2 on: March 17, 2023, 05:11:19 AM »
Many thanks, David.
It is very informative.

Thank you,
Michael
Logged

Yongqiang

  • Top Contributor
  • Posts: 81
Re: Selected output mineral precipitation
« Reply #3 on: March 17, 2023, 06:39:37 AM »
If there are two brines mixing together, can we output all the precipitated solid minerals automatically?

Regards,
Michael
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2823
Re: Selected output mineral precipitation
« Reply #4 on: March 17, 2023, 01:41:52 PM »
If you want to beat it to death, here is a script that will determine the mole transfers of the stable phase assemblage automatically. However, it simply considers all minerals in the database, which may include some unlikely reactants. It also assumes that all of the elements to be considered are in SOLUTION 1.

Code: [Select]
SOLUTION 1  SEAWATER FROM NORDSTROM AND OTHERS (1979)
        units   ppm
        pH      8.22
        pe      8.451
        density 1.023
        temp    25.0
        Ca              412.3
        Mg              1291.8
        Na              10768.0
        K               399.1
        Cl              19353.0
        Alkalinity      141.682 as HCO3
        S(6)            2712.0
SELECTED_OUTPUT 2
-file equi-so.pqi
USER_PUNCH 2
10 s = SYS("phases", count , name$ , type$ , moles, 1)
20 s$ = "SELECTED_OUTPUT 3" + EOL$
30 s$ = s$ + "  -file minerals.sel" + EOL$
40 s$ = s$ + "  -equilibrium_phases" + EOL$
50 FOR i = 1 TO count
60   s$ = s$ + name$(i) + EOL$
70 NEXT i
100 s$ = s$ + "EQUILIBRIUM_PHASES 1" + EOL$
110 FOR i = 1 to count
120   s$ = s$ + name$(i) + " 0.0 0.0" + EOL$
130 NEXT i
140 s$ = s$ + "END" + EOL$
150 PUNCH s$
END
SELECTED_OUTPUT 2
-active false
END
SOLUTION 2
-units mol/kgw
Ca 1
Cl 2
END
INCLUDE$ equi-so.pqi
MIX
1 0.5
2 0.5
USE equilibrium_phases 1
END
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • USER_PUNCH/USER_GRAPH »
  • SELECTED_OUTPUT »
  • Selected output mineral precipitation
 

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