Conceptual Models > Incorporation PHREEQC in programming languages
PhreeqcRM failed in the middle of the numerical simulation
Zhaoyang:
Dear all,
I encountered a problem when running the model that couples PhreeqcRM with a transport model. In the middle of the numerical simulation (30350 out of 72000 steps), PhreeqcRM failed because of
"ERROR: RunString: bad allocation; Stopping; ERROR: Run Cells failed in worker 0 from an unhandled exception; ERROR: RunString: bad allocation; ERROR: PhreeqcRM failed; PhreeqcRM:: RunCells."
I checked the latest result from the coupling model before the error occurred. The result is quite normal before the model reaches the steady state. To fix this problem, I changed parameters for the transport model, including setting a finer mesh, increasing the dispersivity which makes the model more stable. However, all of things I have tried don't work. Does anyone have experience in solving this problem? Thanks for your help in advance.
Best regards,
Zhaoyang
dlparkhurst:
Maybe you ran out of memory? Otherwise, I really don't know.
Zhaoyang:
Thanks for your reply.
To work it out, I have tried different ways including a finer mesh, a larger dispersivity coefficient and a smaller time step. These usually make the numerical model more stable, but the problem is still there. In addition, I notice that the simulation with the same parameters stopped at different steps. Therefore, I think you are right. I was wondering if I can increase the memory to solve this problem. It should be noted that the latest input from the model is reasonable even though the simulation failed in the middle.
Furthermore, I have another question about implementing warm start in my coupling model. I have 17141 nodes (61 in vertical direction and 281 in horizontal direction). I want to use warm start to save time. However, whatever concentrations I set to the transport model, the initial concentrations are always zero for all secies. I guess there are some problems in:
--- Code: --- ! Set printing of chemistry file to false
status = RM_SetPrintChemistryOn(id, 0, 1, 0) ! workers, initial_phreeqc, utility
! Load database
status = RM_LoadDatabase(id, "phreeqc.dat")
status = RM_RunFile(id, 1, 1, 1, "advect.pqi")
! Clear contents of workers and utility
string = "DELETE; -all"
status = RM_RunString(id, 1, 0, 1, string) ! workers, initial_phreeqc, utility
--- End code ---
Could you please give me some suggestions and explain a bit more about workers, initial_phreeqc and utility? Thanks for your help in advance.
By the way, I found that I can't upload files to this forum.
dlparkhurst:
The error message that you included in your first post looks like you ran out of memory and it failed in an effort to allocate more memory. If you are running on Windows, you can use the TaskManager to look at the memory consumption of your program; on Linux you can use "top" command among others.
If it is memory, it could be your side or PhreeqcRM. PhreeqcRM does not have any memory leaks that we know of, but there are probably some ways you could continuously use more memory. Multiple calls to SaveState without calling StateDelete would use more and more memory. Running with a coarser grid will require less memory, so you could test whether you get farther in your simulation as you use a coarser grid (or run less model time with a finer grid). Using a computer with more memory is obviously a possibility.
I don't think that deleting all of the cells in the workers for a warm start is possible or effective. You will simply have to recreate the definitions for each cell, which should use the same amount of memory. Plus, you will be deleting the state of all of the reactants (like EQUILIBRIUM_PHASES) which you would have to somehow retrieve from a saved state.
You could probably delete all of the definitions in initial_phreeqc once you populated all of the cells in the worker instances (except for changing boundary condition information). The intention is that there are just a few definitions in the initial_phreeqc instance; an end-member case is that initial conditions are the same throughout your domain, in which case only one set of initial solution and reaction definitions in initial_phreeqc would suffice to populate all of the cells. In this case, there is not much memory associated with the initial_phreeqc instance. Depending on how you do it, you could possibly have separate definitions for each cell in the initial_phreeqc instance, in which case there could be a significant savings by deleting everything in initial_phreeqc. Usually, the utility instance is not used, so there usually is not a lot of memory associated with it, but, depending on the logic of your program, you might be able to delete everything in the utility instance.
Usually, I think the amount of memory required would be similar from one time step to the next in PhreeqcRM. So, I am not sure what would be using more and more memory as the program progresses.
Zhaoyang:
By monitoring memory, I am sure the stop is because of running out of memory. Memory used by the simulation first increases and then decreases. After that, the memory used by the simulation increases again until the simulation fails.
To figure out this problem, I run the simulation without reactions (turning of PhreeqcRM). In this way, the simulation ends normally. In addition, memory used by the simulation is stable during the whole simulation. Do you have any suggestions? Thanks for your help in advance.
Best regards,
Zhaoyang
Navigation
[0] Message Index
[#] Next page
Go to full version