PhreeqcUsers Discussion Forum

Please email phreeqcusers at gmail.com with your name and affiliation to request an account.
Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Inverse modelling »
  • Inverse Modeling: Mixing Fractions and Mole Transfer
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Inverse Modeling: Mixing Fractions and Mole Transfer  (Read 11603 times)

avadhoot

  • Frequent Contributor
  • Posts: 10
Inverse Modeling: Mixing Fractions and Mole Transfer
« on: 21/11/25 23:35 »
I am trying to figure out mole transfer of phases that could account for water chemistry change from solution 1 to solution 2. The solution 1 is recharge water Ca-Mg-HCO3 which undergoes calcite dissolution and ion exchange to likely produce solution 2 which is Na-HCO3 water type.

Below is PHREEQC code I wrote, however I get following error:
Using Cl1 standard precision optimization routine.

Post_mortem examination of inverse modeling:

   ERROR: equality not satisfied for Ca, 3.834227e-04.
   ERROR: equality not satisfied for Na, -7.668454e-04.
   ERROR: inequality not satisfied for Na eps+, 2.087120e-03
   ERROR: inequality not satisfied for Ca eps+, 7.433807e-04
   ERROR: inequality not satisfied for Mg eps+, 2.903917e-04

Summary of inverse modeling:

   Number of models found: 0
   Number of minimal models found: 0
   Number of infeasible sets of phases saved: 1
   Number of calls to cl1: 3

TITLE Inverse Modeling
SOLUTION_SPREAD
-units mg/L

SELECTED_OUTPUT 1
    -file                 Sim-Inverse(Recharge_Water-NaHCO3-Water).txt
    -pH                   true
    -pe                   true
    -water                true
    -charge_balance       true
    -totals               Ca Cl Mg Na S(6) K Si Alkalinity
    -saturation_indices   Calcite Dolomite

SOLUTION 1 Recharge Water
    temp      25
    pH        7.6
    pe        4
    redox     pe
    units     mg/l
    density   1
    Ca        71.9
    Cl        2.7
    Mg        27.4
    Na        22.8
    S(6)      72.9
    K         2.3
    Alkalinity 302.0
    -water    1 # kg
END

SOLUTION 2 Sodium Bicarbonate Water
    temp      25
    pH        8.1
    pe        4
    redox     pe
    units     mg/l
    density   1
    Ca        24.0
    Cl        4.0
    Mg        16.0
    Na        136.0
    S(6)      132.0
    K         3.0
    Alkalinity 388.0
    -water    1 # kg
END

INVERSE_MODELING 1
    -solutions      1        2
    -uncertainty    0.1      0.1
    -phases
        Calcite dissolve
        CaX2    pre
        MgX2    pre
        Gypsum  dissolve
    -balances
        Cl          0.3      0.3
        K           0.3      0.3
        Na          0.3      0.3
        S(6)        0.3      0.3
    -range             1000
    -tolerance         1e-10
    -mineral_water     true
END


My questions are as follows:

1. How to optimize phases that may dissolve/precipitate? Based on saturation indices, I know there would be calcite, gypsum and halite dissolution
2. How to find inverse model where I find phases and mixing fractions that account for the processes: cation exchange, calcite dissolution?
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4318
Re: Inverse Modeling: Mixing Fractions and Mole Transfer
« Reply #1 on: 22/11/25 00:49 »
You should include all of the major elements in your inverse modeling. You also should include a separate source/sink for each element, at least to begin. If a source/sink is not needed for an element within the uncertainties, it can be eliminated by the calculation.

To begin, I prefer to use the -minimal option to find the simplest models given the uncertainties.

Here is a script that finds an inverse model. Solution 2 has a charge balance greater than 10 percent, so I set the uncertainty to 0.15. You can decide whether the model makes sense relative to your system and the saturation indices. If it is not plausible you can change uncertainties or phases to suit your system. Often, inverse modeling is used only to confirm that your conceptual model is plausible.

Code: [Select]
TITLE Inverse Modeling

SOLUTION 1 Recharge Water
    temp      25
    pH        7.6
    pe        4
    redox     pe
    units     mg/l
    density   1
    Ca        71.9
    Cl        2.7
    Mg        27.4
    Na        22.8
    S(6)      72.9
    K         2.3
    Alkalinity 302.0
    -water    1 # kg
END

SOLUTION 2 Sodium Bicarbonate Water
    temp      25
    pH        8.1
    pe        4
    redox     pe
    units     mg/l
    density   1
    Ca        24.0
    Cl        4.0
    Mg        16.0
    Na        136.0
    S(6)      132.0
    K         3.0
    Alkalinity 388.0
    -water    1 # kg
END

INVERSE_MODELING 1
    -solutions      1        2
    -uncertainty    0.1      0.15
    -phases
        Calcite
        CaX2   
        MgX2   
        NaX
        KX
        Gypsum 
        CO2(g)
        Halite
    -minimal
END
Logged

MichaelZ20

  • Top Contributor
  • Posts: 174
Re: Inverse Modeling: Mixing Fractions and Mole Transfer
« Reply #2 on: 22/11/25 09:09 »
Example 3 in the NETPATH manual investigates possible ways of sodium-bicarbonate water origin by inverse modeling.
Logged

avadhoot

  • Frequent Contributor
  • Posts: 10
Re: Inverse Modeling: Mixing Fractions and Mole Transfer
« Reply #3 on: 23/11/25 01:06 »
Dear Dr Parkhurst,

Thank you very much for this important input and the revised script. The model output completely makes sense as there is gypsum and halite dissolution with SI <0. I also tried to remove -minimal to understand how many models could be derived and there are 2 plausible models. Based on this philosophy, I could replicate the work done by Hendry and Schwartz paper (1989) Milk River Aquifer. I computed mass transfer as delta phases for all phases and my inverse model outputs match quite well.

Here is the code: TITLE Inverse Modeling Model 2

SOLUTION 1 Well 11
    temp      25
    pe        4
    redox     pe
    units     mmol/l
    density   1
    Ca        0.02
    Cl        1.3
    Mg        0.01
    Na        17.0
    C         14.6
    -water    1 # kg
END

SOLUTION 2 Well 18
    temp      25
    pe        4
    redox     pe
    units     mmol/l
    density   1
    Ca        0.09
    Cl        23.0
    Mg        0.07
    Na        44.4
    C         23.1
    -water    1 # kg
END

INVERSE_MODELING 1
    -solutions      1        2
    -uncertainty    0.12      0.10
    -phases
        Calcite
        Dolomite
        NaX 
        MgX2   
        KX       
        Gypsum
        CO2(g)
        Halite
END

Thank you very much for the valuable input!!
Avadhoot
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Inverse modelling »
  • Inverse Modeling: Mixing Fractions and Mole Transfer
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2