PhreeqcUsers Discussion Forum

Registrations currently disabled due to excessive spam. Please email phreeqcusers at gmail.com to request an account.
Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Reactive transport modelling »
  • Problems with defining surface complexation reaction in reactive transport model
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Problems with defining surface complexation reaction in reactive transport model  (Read 2652 times)

Yongqiang

  • Top Contributor
  • Posts: 123
Problems with defining surface complexation reaction in reactive transport model
« on: 01/06/20 16:32 »
Dear Phreeqc experts,

I encounter a problem with defining the surface complexation reactions when coupling Openfoam and PhreeqcRM. The compiler pops up the problems as shown in the attached figure. I run a similar SCM definition as following in the notepad version phreeqc, it works without any problem. So I wonder if the problem is with the RM_RunFile and RM_Runstring?

Regards,





SURFACE_MASTER_SPECIES
     Cal_s   Cal_sCaOH   
     Cal_w   Cal_wCO3H
SURFACE_SPECIES
   Cal_sCaOH = Cal_sCaOH
   log_k 0
   Cal_wCO3H = Cal_wCO3H
   log_k 0
   Cal_sCaOH + H+ = Cal_sCaOH2+
   log_k 11.85
   Cal_sCaOH + HCO3- = Cal_sCaCO3- + H2O
   log_k  5.8
   Cal_sCaOH2+ + SO4-2 = Cal_sCaSO4- + H2O
   log_k 2.1
   Cal_wCO3H = Cal_wCO3- + H+
   log_k -5.1
   Cal_wCO3H + Ca+2 = Cal_wCO3Ca+ + H+
   log_k -2.6
   Cal_wCO3H + Mg+2 = Cal_wCO3Mg+ + H+
   log_k -2.6
END
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #1 on: 01/06/20 17:38 »
I do not think you have made the surface complexation definitions in the worker instances.
Logged

Yongqiang

  • Top Contributor
  • Posts: 123
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #2 on: 01/06/20 17:57 »
Hi Parkhurst,

I wrote the code like this:\

   RM_LoadDatabase(id_, "constant/GeoChem.dat");//load phreeqc database   
   RM_RunFile(id_, 1, 1, 1, "constant/phreeqcReactions");//load reaction   
........
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #3 on: 01/06/20 18:12 »
The fact that the error message occurs multiple times and the file works with PHREEQC makes me think that the workers are the problem. Try using a different number of threads and see if the number of error messages change.

Add the definitions to the database to see if the problem goes away. You will just have to do some debugging of your code.

Logged

Yongqiang

  • Top Contributor
  • Posts: 123
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #4 on: 01/06/20 18:30 »
Thank you, Parkhurst. I'll do some debug on the code.
Logged

Yongqiang

  • Top Contributor
  • Posts: 123
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #5 on: 01/06/20 19:55 »
Dear Parkhurst,

I did some debugging. The problem may lie in the input file. When I define the surface in the following way in the input file, it works without any compiler complain.


SURFACE_MASTER_SPECIES
      Ca_w Ca_w
      Ca_s Ca_s
SURFACE_SPECIES
  Ca_w = Ca_w
  log_k 0
  Ca_s = Ca_s
  log_k 0
  Ca_w + Cl- = Ca_wCl-     
  log_k -1


END
SOLUTION 0 formation water
     units   mol/L
     density 0.997
   pH     7
   temp    25.
    Ca     0.1
    Cl    0.2
    C    0.01
END


However, if the surface master species is defined in the following way. If can not be run smoothly at the initialization step.

SURFACE_MASTER_SPECIES
      Ca_w Ca_wOH
      Ca_s Ca_sCO3
SURFACE_SPECIES
  Ca_wOH = Ca_wOH
  log_k 0
  Ca_sCO3 = Ca_sCO3
  log_k 0
  Ca_w + Cl- = Ca_wCl-     
  log_k -1


END
SOLUTION 0 formation water
     units   mol/L
     density 0.997
   pH     7
   temp    25.
    Ca     0.1
    Cl    0.2
    C    0.01
END


But both of the above definitions work in the Notepad version. Is there any difference between Phreeqc and PhreeqcRM?

Regards
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #6 on: 01/06/20 21:31 »
I was trusting that you had tested with PHREEQC, but the second file does not run in PHREEQC either. Clearly, there is no definition for Ca_w in SURFACE_SPECIES, which you are using in the last equation.

In addition, I think it is a bad idea to use CO3 in the master species for a surface. You should not use elements other than O and H.

Code: [Select]
SURFACE_SPECIES
  Ca_wOH = Ca_wOH
  log_k 0
  Ca_sCO3 = Ca_sCO3
  log_k 0
  Ca_w + Cl- = Ca_wCl-     
  log_k -1
Logged

Yongqiang

  • Top Contributor
  • Posts: 123
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #7 on: 01/06/20 22:17 »
Thank you very much for the instructions. Sorry for the stupid error. It is my bad.
The code can be run smoothly with surfaces assigning on the geometric walls.

Thanks for the suggestions on surface master species selection. It is the second time you give me this suggestion. These reactions are from several literatures. They proposed these reactions to describe the surface complexation reactions on the calcite surface. I did some calculations based on these reactions. Actually, the results are not always in line with experimental measurements. Maybe the selection of surface master species leads to this error. So if the surface complexation reactions are the same, will the selection of surface master species lead to different calculation results?

Regards,
Yongqiang
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Problems with defining surface complexation reaction in reactive transport model
« Reply #8 on: 02/06/20 00:29 »
If you have a species with Surf and with or without O and/or  H in your set of species, then choose it for the master species. You can rewrite the equations so that all the other species can be formed from the master species. Assuming you do the manipulations correctly, the results should be the same.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Reactive transport modelling »
  • Problems with defining surface complexation reaction in reactive transport model
 

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