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 »
  • SURFACE_MODIFY in PhreeqcRM
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: SURFACE_MODIFY in PhreeqcRM  (Read 10746 times)

eeftekhari

  • Frequent Contributor
  • Posts: 20
SURFACE_MODIFY in PhreeqcRM
« on: 09/05/16 11:22 »
Dear all,

I work on water-flooding application where oil-phase is defined as a surface and its number of surface cites is a function of oil-saturation. Therefore, after each transport step I need to modify the surface properties in each cell. In a transport model, is there any way to change the properties of the surface in each cell other than using the SURFACE_MODIFY keyword? If I understand it correctly, after each transport step I can only change the surface properties in each cell by building a SURFACE_MODIFY block as an string and running it by calling RM_RunString function.
What I'm hoping for is something that is as convenient as RM_SetConcentrations to modify the surfaces!

Thanks a lot in advance,
Ehsan

P.S. I have written a tiny wrapper to call PhreeqcRM from Julia language. Here's a modified version of example 11 in Julia: https://github.com/simulkade/JPhreeqc.jl/blob/master/test/advection_c.jl
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4298
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #1 on: 09/05/16 17:27 »
First, you need to be careful when changing the number of surface sites. If you just increase Surf_w, for example, you will get some unwanted reactions. You really need to add Surf_wOH, which means you need to increase the moles of O and H too.

And sorry, no, there is nothing as convenient as RM_SetConcentrations. It is of course possible to add methods, but you would be on your own. The only thing I can think of, is there is a capability to link the number of surface sites to a kinetic reaction (or an equilibrium phase). If you can devise a kinetic reaction that has a moles of reaction that is proportional to the number of sites that you want, then you could use that mechanism. To do that you will probably need to get information from transport side of the calculations to the chemistry side of the calculations (PhreeqcRM).

It will probably be messy, but there is a mechanism to callback to the transport side from Basic to get information. It gets difficult when you are using parallel processing with MPI in that you need to make sure the information you need is at the process that is running the chemistry. It is a bit easier when using OpenMP (multi threading) because each thread can see the entire dataspace.
Logged

eeftekhari

  • Frequent Contributor
  • Posts: 20
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #2 on: 09/05/16 20:51 »
Thanks a lot David for your quick and -as always- useful reply. What I had in mind was to get the molalities of all the surface species (here the surface is oil) using a SELECTED_OUTPUT (-molalities species) code and transport all the species. Basically, I want to treat the oil surface as a solution. I guess I have to calculate the total mole of each element on the surface after transport and then modify -totals and -charge_balance with a SURFACE_MODIFY string. Is it correct?
One other question: what happens if I only modify the -grams with the SURFACE_MODIFY? Does it change only the total number of cites, without changing other adsorbed species?

Just to be clear, I don't use the phreeqc transport. The transport is solved with my own finite volume solver.
« Last Edit: 09/05/16 20:53 by eeftekhari »
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4298
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #3 on: 09/05/16 21:50 »
Another alternative is as below using the REACTION keyword. I think all you want to do is effectively add (in this case) HfoOH in the appropriate amount. Don't think you should change charge balance or anything else, but I could be wrong.

I am also not sure if REACTION would work in PhreeqcRM; you will have to experiment. I don't usually use REACTION in transport. I think a constant KINETICS reaction that introduces the proper amount of oil over the time step would be an alternative. 




SOLUTION 1
Pb 1
Cl 2
END
SURFACE 1
    Hfo_wOH    1         600       1
-eq 1
END
USE solution 1
USE surface 1
SAVE solution 1
SAVE surface 1
END
REACTION 1
Hfo_wOH 1
USE solution 1
USE surface 1
END
Logged

eeftekhari

  • Frequent Contributor
  • Posts: 20
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #4 on: 10/05/16 09:00 »
The problem is that adding only HfoOH is not enough in my case. I do need to have other surface species transported to the new cells. Perhaps I don't understand it correctly, but isn't it correct that I need to transport all other species that are already attached to the Hfo_w?
Just one more follow up question: in the phreeqc manual I read the following about specifying Dw in the surface defintion:
Quote
Dw coefficient—Optional diffusion coefficient for the surface, m 2 /s; applies only when -multi_D
is true in a TRANSPORT calculation. If coefficient > 0, the surface is transported as a
colloid with advective, dispersive, and diffusive transport. Default is 0 m 2 /s, which means
the surface is immobile.
My question is in the phreeqc transport calculations when Dw is specified for a surface, do you only transport Hfo_wOH or other Hfo_w* species are transported?
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4298
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #5 on: 10/05/16 14:44 »
Ah, sorry, I was not understanding. I thought only new surface was being created. So, yes, you would need to transport each surface site and all elements and charge related to the surface. You can use SYS("surf", ... to get a list of surface species and moles of species, or you can use SURF. I don't think there is a function to return the surface charge. You could calculate it from the SYS("surf" function and SPECIES_FORMULA$ functions.

If you are calculating a diffuse layer -donnan (more robust) or -edl options, then you do not need to transport the charge, but you do need to transport the elements in the diffuse layer. You can get the moles of element in a diffuse layer with the EDL function. 

When a surface is transported in TRANSPORT, then the associated elements are also transported.
Logged

eeftekhari

  • Frequent Contributor
  • Posts: 20
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #6 on: 10/05/16 17:29 »
Thanks a lot David. This is exactly what I needed to know.
Logged

eeftekhari

  • Frequent Contributor
  • Posts: 20
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #7 on: 14/02/17 19:53 »
Dear David,

I'm using SURFACE_MODIFY keyword now and it works fine, by which I mean the simulations converge. I have had a few observation that perhaps need some clarifications:

1) the command EDL("surf", "element") for element = H and O returns the number of moles of H and O excluding water in the double layer. What I do now is that I get the mass of water in the double layer using EDL("surf", "water"), convert it to moles and add it to the H and O that is returned by the EDL command. Then I use these new values in the SURFACE_MODIFY block. Is it the right way of doing this? Does the same thing happen in the TRANSPORT function of phreeqc?

2) when I use -donnan option in my calcualtion, SURFACE_MODIFY keyword does not converge anymore. It only works with the default -edl option. Am I doing something wrong here?
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4298
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #8 on: 14/02/17 23:34 »
(1) What you are doing sounds reasonable. You can check the output to see if mass balance is preserved. Also DUMP could be used to help debug.

(2) If you are not getting convergence, my first guess is that you may have inadvertently introduced a redox reaction. If for example, you were to increase only the Na concentration, either in a SURFACE_MODIFY or a REACTION, PHREEQC will consider that to be Na metal, and will effectively create the following reaction:

Na + H2O = Na+ + OH- + 1/2H2(aq).

This reaction can move the system out of the stability field of water and cause convergence failure. I don't know if this is the problem you are having, so perhaps you should provide a simple example.
Logged

eeftekhari

  • Frequent Contributor
  • Posts: 20
Re: SURFACE_MODIFY in PhreeqcRM
« Reply #9 on: 15/02/17 22:52 »
Dear David,

Thank you for your reply. I have some other issues:

1) the SURF function does not return the number of moles of adsorbed elements on a specific site, which is needed in the SURFACE_MODIFY block. It only returns the moles of adsorbed elements on a surface. What I do now is that I transport all the surface species and calculate the moles of adsorbed elements myself, by getting their values using the SELECTED_OUTPUT keyword -molalities. However, I still have some mass balance issues.
I tried to make a simple example, but It is a bit difficult at the moment. I can send you the whole code by email if it helps.

2) As you mentioned before, there is no function to get the surface charge for a specific site. So again like the previous comment, I calculate the charge myself based on the moles of adsorbed species.

3) When I use more than one thread (openMP), I get this warning:
Code: [Select]
WARNING: Could not find SURFACE_MODIFY 44, ignoring modify data.It seems that PhreeqcRM somehow cannot find the surface modify block in OpenMP. Currently, I can only use one thread.

Thanks again for your help.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Reactive transport modelling »
  • SURFACE_MODIFY in PhreeqcRM
 

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