PhreeqcUsers Discussion Forum

Processes => Reactive transport modelling => Topic started by: Rumple on 04/03/26 13:36

Title: species_cpp.cpp with python
Post by: Rumple on 04/03/26 13:36
Dear user,
  I've recently been paying attention to the usage of GetSpeciesConcentrations and SpeciesConcentrations2Module. I realize that my previous approach of directly using GetConcentrations and SetConcentrations from SimpleAdvection.py was rather crude. I now want to improve my understanding. I would like to ask whether species_cpp.cpp has a Python version available. In the official downloadable examples, it seems only C and Fortran versions are provided.
  If not, are the two statements GetSpeciesConcentrations and SpeciesConcentrations2Module still usable in Python? I might try to adapt it into a Python version myself.
  Thank you for your help.
Title: Re: species_cpp.cpp with python
Post by: dlparkhurst on 04/03/26 14:10
GetConcentrations and SetConcentrations is sufficient and faster unless you are calculating multicomponent diffusion or electrodiffusion, in which case you need the "Species" versions.

There is a TestAllMethods Python script that demonstrates the use of all of the methods available in Python--GetSpeciesConcentrations and SpeciesConcentrations2Module are included in the script.

If you install the Python version of PhreeqcRM:

pip install phreeqcrm
or
conda install -c conda-forge phreeqcrm

Here are examples of of commands to obtain documentation on methods for PhreeqcRM and BMIPhreeqcRM:

help("phreeqcrm.PhreeqcRM")
help("phreeqcrm.BMIPhreeqcRM")
help("phreeqcrm.PhreeqcRM.Concentrations2Utility“)
help("phreeqcrm.BMIPhreeqcRM.add_output_vars")

You should be able to translate species_cpp.cpp to Python, but don't do it unless you are doing multicomponent diffusion.
Title: Re: species_cpp.cpp with python
Post by: Rumple on 04/03/26 16:19
Yes, I am working on multicomponent diffusion, but I've just realized that it's possible to work with specific species. Previously, using elements was not powerful enough for my needs. Thank you for providing the command examples; I will give them a try.