Processes > Reactive transport modelling
Exporting Equilibrium Phases moles in Reactive Transport with PhreeqcRM
Sara Tabrizi:
Hello all,
I have coupled PhreeqcRM with a transport code for a test case containing Calcite and Dolomite dissolution/precipitation in the equilibrium phase. I would like to export the moles of equilibrium phases (Calcite and Dolomite) for model verification. Although it is very easy to export the moles per volume for equilibrium phases in the batch Phreeqc file by using the command "-equilibrium_phases" in the selected output data block, I cannot find the command to export these values in PhreeqcRM. Even though there are classes such as "GetEquilibriumPhasesCount" or "GetEquilibriumPhases" to get the numbers and names of the phases, I cannot get the values of moles for each equilibrium phase. I have been studying different classes in PhreeqcRM to find the relevant command for a while without success. I appreciate it if anyone who knows lets me know about exporting the moles of equilibrium phases during the reactive transport.
Thank you in advance,
Sara Tabrizinejadas
dlparkhurst:
In a few months, it should be much easier. We are working on a BMI version of PhreeqcRM that will provide a lot more variables through the BMI function GetValue.
For now, you will have to do it the old fashioned way by defining a selected output file. You will need to define SELECTED_OUTPUT n and USER_PUNCH n (if needed) data blocks and run them in the worker instances. There is the PhreeqcRM method SetSelectedOutputOn true/false that you can switch on for time steps you want to get the selected-output data.
Finally, there are methods to extract the selected-output data: GetSelectedOutputColumnCount, GetSelectedOuputHeadings, GetSelectedOutputRowCount, and GetSelectedOutput that allow you to retrieve and process the selected-output data.
You noted the lists of names of EQUILIBRIUM_PHASES, exchange species, surface species, and others are available, so you could automatically generate output by processing these names and writing a SELECTED_OUTPUT definition that you then process with the workers. The file advection_cpp.cpp in the Tests directory of the PhreeqcRM distribution has a rough version of how to generate a SELECTED_OUTPUT definition automatically in the subroutine example_selected_output.
Sara Tabrizi:
Dear Dr.Parkhurst,
Thank you very much for your reply. I have been trying to obtain the values of equilibrium phase moles with this approach. To do so I have defined equilibrium_phases in the Selected_output data block of the input .pqi file and this file has been run in the worker instances. I have used the following lines at the end of .pqi file:
"
SELECTED_OUTPUT 1-500
-distance true
-time true
-equilibrium_phases Calcite Dolomite
"
Also in the transport code I use the following lines to define the selected output:
"
IRM_RESULT status;
status = phreeqc_rm->SetSelectedOutputOn(1);
"
But apparently, this is not enough to define the selected output in the Phreeqcrm part of the code. Because when I call the class "GetSelectedOutputColumnCount()", I receive the error that the Selected output is not found. Could you please let me know what has been done wrong or what are the other necessary definitions to obtain the desired selected output?
Thank you very much,
Sara
dlparkhurst:
My bad. I forgot to explain that you need to select the selected-out definition that you wan
You can define multiple SELECTED_OUTPUT data blocks, which can be processed with PhreeqcRM. First, you should use only one user number for each (1, not 1-500). The SELECTED_OUTPUT/USER_PUNCH definitions must be run by the workers.
Here is the missing step--with the PhreeqcRM method SetCurrentSelectedOutputUserNumber you choose the SELECTED_OUTPUT that you want to retrieve.
Here is a snippet of code from the html documentation (https://water.usgs.gov/water-resources/software/PHREEQC/documentation/phreeqcrm-html/index.html or in the distribution directory/Doxygen/html/index.html).
--- Code: ---for (int isel = 0; isel < phreeqc_rm.GetSelectedOutputCount(); isel++)
{
int n_user = phreeqc_rm.GetNthSelectedOutputUserNumber(isel);
status = phreeqc_rm.SetCurrentSelectedOutputUserNumber(n_user);
std::vector so;
int col = phreeqc_rm.GetSelectedOutputColumnCount();
status = phreeqc_rm.GetSelectedOutput(so);
// Process results here
}
--- End code ---
Sara Tabrizi:
Thanks again for your reply. I think that this is not the problem. I changed what I had written in the .pqi file to the following lines :
"
SELECTED_OUTPUT 1
-file RUN1.sel
-distance true
-time true
-equilibrium_phases Calcite Dolomite
"
Also, I call the following required classes before running the .pqi file in the worker instance :
SetSelectedOutputOn(true);
SetCurrentSelectedOutputUserNumber(1);
However, it appears to me that the output of "GetSelectedOutputCount()" is zero and that is the reason why the selected output is not defined in the code. I do not understand what I am doing wrong, I appreciate it if you could give me a hint if something wrong in my procedure is pointing out to you.
Sorry for the repetitive question and thanks for your patience,
Sara
Navigation
[0] Message Index
[#] Next page
Go to full version