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 »
  • Conceptual Models »
  • Kinetics and rate controlling factors »
  • Retrieving cell saturation in kinetics when using phreeqcRM
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Retrieving cell saturation in kinetics when using phreeqcRM  (Read 1426 times)

oatteia

  • Top Contributor
  • Posts: 32
Retrieving cell saturation in kinetics when using phreeqcRM
« on: 20/01/24 09:44 »
Hello,
In order to simulate PFAs sorption with PhreeqcRM (coupled with OpenFoam for unsaturated transport), I need to get the cell saturation in the kinetics. It is possible to get the porosity but not the cell saturaiton, I tried to use the Phast keyword cell_saturation but it does not work neither, is there a simple solution (I was looking n how to do in in modifying the cpp files but seems a little complex)
cheers
Olivier
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Retrieving cell saturation in kinetics when using phreeqcRM
« Reply #1 on: 20/01/24 20:49 »
I'm not sure that you are getting the correct porosity; I don't think there is a function implemented for PhreeqcRM. The functions cell_porosity and cell_saturation are defined for PHAST, but you would need to implement them (or whatever you prefer) in your code.

It has been a while, but it is possible to implement a callback function so that there is a working Basic function named "callback". When you call callback in RATES, it will got to a function you define to return the values of porosity, saturation, or other quantities known to your program, but not known by the IPhreeqc instances. Phreeqc only knows the number of moles in the aqueous phase (from which it can calculate a volume), and either the pressure or the volume for a gas phase.

A callback function is implemented in the test cases Advect_cpp.cpp and Advect_f90.F90 in the Tests directory of PhreeqcRM, where the values for arbitrary variable--hydraulic conductivity--can be found by the Basic program. There are two double arguments and one character argument in a callback definition. Here is the Basic code in the example that uses the first argument for the cell number and the character argument for the type of data that is requested (second argument is unused):

Code: [Select]
USER_PUNCH
  -heading  Temperature Pressure Hyd_K
  10 PUNCH TC, PRESSURE
  20 PUNCH CALLBACK(cell_no, 0, "HYDRAULIC_K")
END

Implementing the callback function is a little tricky, especially for MPI, but hopefully, you can emulate the example.
Logged

oatteia

  • Top Contributor
  • Posts: 32
Re: Retrieving cell saturation in kinetics when using phreeqcRM
« Reply #2 on: 21/01/24 07:28 »
Thank you
I will try
olivier
Logged

oatteia

  • Top Contributor
  • Posts: 32
Re: Retrieving cell saturation in kinetics when using phreeqcRM
« Reply #3 on: 21/01/24 09:18 »
me again,
it runs!
thanks a lot David
olivier
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Retrieving cell saturation in kinetics when using phreeqcRM
« Reply #4 on: 22/01/24 15:18 »
For a more extensive example, you can look at  the method "mpi_methods" in the PHAST code, where about 20 methods are added for MPI to extend capabilities to distribute data to the workers, run transport, as well as adding the CALLBACK functions. PHAST runs transport calculations in parallel by component.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Kinetics and rate controlling factors »
  • Retrieving cell saturation in kinetics when using phreeqcRM
 

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