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 »
  • Phreeqc Coupled with Matlab
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Phreeqc Coupled with Matlab  (Read 880 times)

hagar.haithm@gmail.com

  • Contributor
  • Posts: 8
Phreeqc Coupled with Matlab
« on: October 29, 2020, 03:48:15 AM »
Hello everyone,

I am new to phreeqc and trying to generate H2S in using this code. but unfortunately it showing WARNING: Did not find phase, H2S.
The propose of this code is to be coupled with fluid flow using matlab.

your help is much appreciate,

Thanks,
Haitham,

DATABASE C:\Program Files (x86)\USGS\IPhreeqcCOM  3.6.2-15100\database\phreeqc.dat

   USER_PUNCH
      headings PV sumX MU
      start
      10 punch STEP_NO
      20 punch 3*MOL("AlX3")+2*(MOL("CaX2")+MOL("MgX2")+MOL("SrX2")+MOL("BaX2")+MOL("AlOHX2"))+MOL("NaX")+MOL("KX")+MOL("HX")+MOL("LiX")
      30 punch MU
      end
   SELECTED_OUTPUT
      high_precision true
      kinetic_reactants H2S
      saturation_indices H2S #CO2(g)
      totals Na K Ca Mg Ba Sr Cl S B Al Si Li C(+4)
      molalities Ca+2 CaX2 NaX HX MgX2 BaX2 SrX2 KX LiX AlOHX2 AlX3 Na+ Cl- K+ Mg+2 Ba+2 Sr+2 SO4-2 H3BO3 Al+3 H4SiO4 Li+ HCO3- CO2 CO3-2 H+
      temperature
   EXCHANGE_SPECIES
      H+ + X- = HX
      log_k   1.0
      gamma   9.0   0.0
   SOLUTION 0
      units              mol/kgw
      temperature        40
        water    0.473628337356982     # kg
      ph 2.99975780954008
      Na  0.0099999591223269
      K   0.000999995752103535
      Ca  1.00000351295713
      Mg  0.010000008172007
      Ba  0.00100000264052015
      Sr  0.00100003759818287
      Cl  0.00100000054642765
      S   1.00004877637147
      B   0.00100000054642368
      Al  0.00100000087963246
      Si  0.00100000054642368
      Li  0.000999993166893943
      C(+4) 0.012596858499283
   EQUILIBRIUM_PHASES 0
      CO2(g)  0.2
   EXCHANGE 0
      NaX 0.00109613372045271
      CaX2 0.147608010853332
      HX 0.00204119182931141
      MgX2 0.000313216909590112
      BaX2 0.000136956101122068
      SrX2 0.000148899456345357
      KX 0.000333541019145074
      LiX 0.000113079117154421
      AlOHX2 9.17654672516485e-08
      AlX3 6.22671324435576e-07
   RATES 0
   H2S
      start
         10  S = m*100.07*0.01 #n*M*beta
         20  k = 1e-6
         30  rate = k*m*(1-SR("H2S"))
         40  moles = rate*time
         100 SAVE moles
      end
   KINETICS 0
        H2S
           m0 1.67588079823454e-09
end


END
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2728
Re: Phreeqc Coupled with Matlab
« Reply #1 on: October 29, 2020, 05:21:16 AM »
The definition in PHASES is "H2S(g)", which you have to use to obtain the saturation index in SELECTED_OUTPUT and in the Basic function SR in RATES.

Note that SR will return the partial pressure of H2S gas, so your RATES definition is written to obtain a partial pressure of 1 atm.
Logged

hagar.haithm@gmail.com

  • Contributor
  • Posts: 8
Re: Phreeqc Coupled with Matlab
« Reply #2 on: October 31, 2020, 11:55:58 AM »
Thank you very much. It works now
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • Phreeqc Coupled with Matlab
 

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