PhreeqcUsers Discussion Forum

Beginners => PHREEQC basics => Topic started by: cyprien on December 10, 2018, 03:16:54 PM

Title: initial amount of calcite for Equilibrium_phases in PhreeqcRM
Post by: cyprien on December 10, 2018, 03:16:54 PM
Dear Phreeqc developers/users,

I am coupling Phreeqc_RM with a finite volumes transport code to do precipitation/dissolution simulations (EQUILIBRIUM_PHASES so far).

I have a distribution of minerals in my domain. To simplify, let's say that I have regions containing calcites and regions containing fluids only (porosity=1 in the latter case). I am not sure about the initialization of the EQUILIBRIUM blocks. I am doing the following to assign an amount of calcite in each grid block (epsSolid is the volume fraction of solid per cells and Vm is the molar volume in L/mol):

Code: [Select]
status = phreeqc.SetUnitsPPassemblage(2);   // 0, mol/L cell; 1, mol/L water; 2 mol/L rock

std::vector<double> rv;
rv.resize(nxyz, 1.0); // 1.0=1 L
status = phreeqc.SetRepresentativeVolume(rv);

std::string input;

for (int i = 0; i < nxyz; i++)
double mineralMoleI = epsSolid[i]/Vm;

input +=
" EQUILIBRIUM_PHASES " + i + " ; \n"
  + “Calcite” +" 0.0 "+ mineralMoleI + ";\n"

input += " END; \n";

status = phreeqc.RunString(true, true, true, input.c_str());

I am not really sure about the value of mineralMoleI. In particular, I wonder where does the cell volume appear in the phreeqc calculation?

Title: Re: initial amount of calcite for Equilibrium_phases in PhreeqcRM
Post by: dlparkhurst on December 10, 2018, 04:07:31 PM
The strategy of PhreeqcRM is to define EQUILIBRIUM_PHASE in the initial phreeqc instance and then use InitialPhreeqc2Module to transfer it to the model cells. In this transfer, the units choice (SetUnitsPPassemblage) is used to convert to the proper amount of the mineral in the cell.

You can try to replicate the logic in your code, however, as you have your code, with parallel processing, each cell will be defined in each thread or process plus the initial phreeqc instance and the utility instance (true,true,true), so, if you have 8 processes for parallel processing, you will have 10 copies of each cell.