OGS
ChemicalSolverInterface.h File Reference

Detailed Description

Interface for coupling OpenGeoSys with an external geochemical solver.

Reactive transport in OGS is operator-split:

  • Transport: advection / diffusion of mobile (dissolved) components (PDE solve in OGS).
  • Chemistry: local reaction / speciation solved by an external chemistry backend (e.g. PHREEQC) for many independent local systems.

Each reactive control volume is identified by chemical_system_id. A chemical_system_id typically corresponds to one integration point of an element (i.e. one local reaction volume). During the chemistry step each chemical_system_id is treated as a well-mixed batch reactor. There is no mass exchange between different chemical_system_id in this step; spatial coupling happens only in the transport solve.

Per-timestep sequence (time increment dt):

  1. OGS solves flow / transport and updates, for each control volume:
    • total dissolved component amounts \(c_{T\alpha}\) (the transported primary components),
    • pore pressure p,
    • temperature T (if a thermal process is active),
    • porosity / saturation.
  2. setChemicalSystemConcrete(...): For each chemical_system_id, OGS provides the chemistry backend with the current local state at that point:
    • transported component totals \(c_{T\alpha}\),
    • pore pressure,
    • temperature,
    • porosity and saturation,
    • reactive mineral amounts and reactive surface area,
    • current time t and time step size dt. This populates the backend's internal representation of that local chemical system (e.g. PHREEQC SOLUTION, EQUILIBRIUM_PHASES / KINETICS, SURFACE, EXCHANGE blocks).
  3. executeSpeciationCalculation(dt): The backend advances geochemistry for all chemical_system_id over dt. Each local system is advanced as a closed batch reactor. The backend computes:
    • updated aqueous composition,
    • reaction/source terms \(R_{\alpha}\) for each transported component,
    • updated mineral amounts.
  4. updateVolumeFractionPostReaction(...), updatePorosityPostReaction(...): Reaction-induced precipitation / dissolution is pushed back to OGS:
    • solid volume fractions and mineral inventories are updated,
    • porosity is updated,
    • permeability / other medium properties can be updated based on the new porosity. These updated medium properties are then used in the next flow / transport step.
  5. computeSecondaryVariable(...): Assemble derived output fields (e.g. pH, mineral volume fractions, surface loading) for writing to the mesh.

Responsibilities of a concrete ChemicalSolverInterface implementation (e.g. the PHREEQC-based implementation):

  • store and initialize per-chemical_system_id chemical state (component inventories, pH / pe, kinetic and equilibrium reactants, ion-exchange / surface sites, etc.);
  • accept per-chemical_system_id inputs from OGS before each reaction step (component totals, pressure, temperature, porosity, etc.);
  • run local reaction / speciation over dt;
  • provide reaction/source terms and updated mineral / porosity data back to OGS;
  • expose component totals and component names for the next transport solve.

Thermodynamic state: Pressure and temperature are expected to be provided per chemical_system_id.

Definition in file ChemicalSolverInterface.h.

Include dependency graph for ChemicalSolverInterface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ChemistryLib::ChemicalSolverInterface

Namespaces

namespace  MaterialPropertyLib
namespace  ParameterLib
namespace  ChemistryLib