PhreeqcUsers Discussion Forum

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

Title: Balancing problem during transport
Post 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
Title: Re: Balancing problem during transport
Post by: dlparkhurst on June 03, 2020, 05:34:49 PM
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.
Title: Re: Balancing problem during transport
Post by: Yongqiang on July 01, 2020, 10:09:36 PM
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 10e-5 s.

Regards,
Title: Re: Balancing problem during transport
Post by: dlparkhurst on July 01, 2020, 10:36:35 PM
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?
Title: Re: Balancing problem during transport
Post by: Yongqiang on July 02, 2020, 02:59:49 PM
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
Title: Re: Balancing problem during transport
Post by: Yongqiang on July 02, 2020, 03:24:16 PM
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.

Title: Re: Balancing problem during transport
Post by: dlparkhurst on July 02, 2020, 03:52:07 PM
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 Na-Cl 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.
Title: Re: Balancing problem during transport
Post by: Yongqiang on July 03, 2020, 09:36:59 AM
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+ (10e-8 mol/l) in the original solution would result in similar results with Example 11.