Conceptual Models > Program coupling
SetValue Equilibrium_Phases_Modify
(1/1)
ciegolon:
Hi,
I'm trying to "set values" of mineral concentrations that were transported in a surface water model (written in Fortran) coupled to PhreeqcRM (BMIPhreeqcRM) using the Fortran interface. I've done it for the dissolved components, but now I realise that it seems there are no direct methods to SetValue for equilibrium phases.
In a previous post, it was explained that using the Phreeqc datablock EQUILIBRIUM_PHASES_MODIFY, this could be achieved, but I'm having trouble figuring out what method from the BMIPhreeqcRM module I should use to this end. Is there a particular BMI method that I should use to access Phreeqc's data blocks and modify their parameters?
Kind Regards,
Claudio
dlparkhurst:
Yes, I have considered an extension of PhreeqcRM to allow mobile solids, but sediment transport gets very complicated, especially when you consider multiple size classes of sediment moving independently. If anyone is interested in developing a non-proprietary capability for sediment transport, you can send me a message, but no promises.
Perhaps you can brute force a simple approach. To use EQUILIBRIUM_PHASES_MODIFY n, you will need to use the method RunString(true, false, false, string). MPI parallelization gets more complicated, so let's just consider the multithreaded version OpenMP.
So, you would have to develop a string that updates the amount of phases in each cell. It would look something like this:
--- Code: ---EQUILIBRIUM_PHASES_MODIFY 1
-component Calcite
-moles 1.1
EQUILIBRIUM_PHASES_MODIFY 2
-component Calcite
-moles 1.2
EQUILIBRIUM_PHASES_MODIFY 3
-component Calcite
-moles 1.1
...
END
--- End code ---
You would then use RunString to update the calcite concentrations before the call to RunCells. After RunCells, you would need to extract the calcite moles after reaction for sediment transport. With BMIPhreeqcRM, it is a little easier to get the calcite moles with the GetValue method (GetValue("equilibrium_phases_moles_Calcite", v), I think), rather than processing the selected-output array.
I may have not thought this through completely, so let me know if there are problems.
ciegolon:
Is there a Get_Value method to retrieve kinetic moles? I've been trying to run get_value('kinetics_moles_Calcite,v) but it seems not to work, unless it has a different nomenclature?
EDIT: it's -> kinetic_reaction_moles_xxx
bmif_get_output_var_names is very useful!
dlparkhurst:
Yes, the names are somewhat arbitrary, but GetOutputVarNames provides the list of variables retrievable with GetValue. These methods are C++, but there are equivalents in Fortran, Python, and C.
Here are some examples that cover all of the types of reactants in PHREEQC--EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, SOLID_SOLUTIONS, and SURFACE.
--- Code: ---ComponentCount
Components
Concentrations
DensityCalculated
ErrorString
FilePrefix
Gfw
GridCellCount
SaturationCalculated
SelectedOutput
SelectedOutputColumnCount
SelectedOutputCount
SelectedOutputHeadings
SelectedOutputRowCount
SolutionVolume
Time
TimeStep
CurrentSelectedOutputUserNumber
Porosity
Pressure
SelectedOutputOn
Temperature
Viscosity
equilibrium_phases_delta_moles_KCl
equilibrium_phases_moles_KCl
exchange_total_molality_X
exchange_X_species_log_molality_CaX2
exchange_X_species_log_molality_KX
exchange_X_species_log_molality_MgX2
exchange_X_species_log_molality_NaX
exchange_X_species_log_molality_X-
gas_phase_moles_Ntg(g)
gas_phase_phi_Ntg(g)
gas_phase_pressure_Ntg(g)
gas_phase_volume
kinetic_reaction_delta_moles_NoOp
kinetic_reaction_moles_NoOp
solid_solution_Divalent_moles_CaCl2
solid_solution_Divalent_moles_MgCl2
solution_alkalinity
solution_charge_balance
solution_ionic_strength
solution_pe
solution_percent_error
solution_ph
solution_specific_conductance
solution_total_molality_Ca
solution_total_molality_Cl
solution_total_molality_H
solution_total_molality_H(0)
solution_total_molality_H(1)
solution_total_molality_K
solution_total_molality_Mg
solution_total_molality_Na
solution_total_molality_Ntg
solution_total_molality_O
solution_total_molality_O(-2)
solution_total_molality_O(0)
solution_water_mass
surface_Hfo_w_species_log_molality_Hfo_wO-
surface_Hfo_w_species_log_molality_Hfo_wOCa+
surface_Hfo_w_species_log_molality_Hfo_wOH
surface_Hfo_w_species_log_molality_Hfo_wOH2+
surface_Hfo_w_species_log_molality_Hfo_wOMg+
surface_total_molality_Hfo_w
--- End code ---
Navigation
[0] Message Index
Go to full version