PhreeqcUsers Discussion Forum
Processes => Reactive transport modelling => Topic started by: Yongqiang on June 03, 2020, 03:45:08 PM

Dear PhreeqcRM exporters,
When coupling the PhreeqcRM with a transport code, an error has been come up to remind a material balancing and convergence problem (as attached figure shows).
I guess that it could be that the geochemical calculation step gives a lot of species while the transport equations only move a few of them. So is there a method to solve this problem?
Regards

First, I assume you used InitialPhreeqc2Module to load the initial conditions in the cells, and then RunCells was succesful. If not, start there.
My guess is that the values coming back from the transport calculations are not right. Try two things: (1) return the the same concentrations from GetConcentrations in SetConcentrations and see if RunCells works, and (2) transport for a very short time, the concentrations should change little, and RunCells should work correctly. After that, continue debugging.

Hi Parkhurst,
When using RM_GetConcentrations and RM_SetConcentrations, the problems can be avoided. But with RM_GetSpeciesConcentrations and RM_SpeciesConcentrations2Module, it always pops up errors even the time step is 10e5 s.
Regards,

Please be more specific.
If you use RM_GetSpeciesConcentrations and return the same array to RM_SpeciesConcentrations2Module (no transport), does a RM_RunCells calculation succeed?

Hi Parkhurst,
If use RM_GetSpeciesConcentrations and return the same array to RM_SpeciesConcentrations2Module (no transport), the RM_RunCells calculation works without warning and errors of the material imbalance.
Does it mean that the geochemical solver is good as no species movements in this case?
Regards,
Yongqiang

Every time it reads concentration from transport solvers, the errors come out as in the attached figure. Maybe the problems lie in the coupling code.

Then it seems like the problem is in your transport calculations. If you run the transport calculation for a short time, you should get nearly the same concentration array as retrieved with RM_GetSpeciesConcentrations. You should compare the arrays to see where your calculations are going wrong. (Obviously, simplify your calculations to something like an NaCl system.) Just a guess, but the largest residual in the screen shot is for charge balance; perhaps your solutions are not charge balanced or you need to transport more carefully to maintain charge balance during diffusion.

Hi Parkhurst,
Thanks. Finally, the code works. I am comparing it with Example 11 from the Manual
I found some very interesting things that when coupling Phreeqcrm and OpenFOAM. Inject CaCl2 into a column with NaCl, the ion exchange does not work properly if only NaCl exists in the initial solution. However, adding a small number of Ca2+ (10e8 mol/l) in the original solution would result in similar results with Example 11.