OGS
ChemistryLib::ChemicalSolverInterface Class Reference

Detailed Description

Definition at line 109 of file ChemicalSolverInterface.h.

#include <ChemicalSolverInterface.h>

Inheritance diagram for ChemistryLib::ChemicalSolverInterface:
[legend]
Collaboration diagram for ChemistryLib::ChemicalSolverInterface:
[legend]

Public Member Functions

 ChemicalSolverInterface (MeshLib::Mesh const &mesh, GlobalLinearSolver &linear_solver_)
std::vector< std::size_t > const & activeElementIDs () const
virtual void initialize ()
virtual void initializeChemicalSystemConcrete (std::vector< double > const &, GlobalIndexType const &, MaterialPropertyLib::Medium const &, ParameterLib::SpatialPosition const &, double const)
virtual void setChemicalSystemConcrete (std::vector< double > const &, GlobalIndexType const &, MaterialPropertyLib::Medium const *, MaterialPropertyLib::VariableArray const &, ParameterLib::SpatialPosition const &, double const, double const)
virtual void setAqueousSolutionsPrevFromDumpFile ()
virtual void executeSpeciationCalculation (double const dt)
virtual double getConcentration (int const, GlobalIndexType const) const
virtual std::vector< std::string > const getComponentList () const
virtual Eigen::SparseMatrix< double > const * getStoichiometricMatrix () const
virtual double getKineticPrefactor (std::size_t reaction_id) const
virtual void updateVolumeFractionPostReaction (GlobalIndexType const &, MaterialPropertyLib::Medium const &, ParameterLib::SpatialPosition const &, double const, double const, double const)
virtual void updatePorosityPostReaction (GlobalIndexType const &, MaterialPropertyLib::Medium const &, double &)
virtual void computeSecondaryVariable (std::size_t const, std::vector< GlobalIndexType > const &)
virtual ~ChemicalSolverInterface ()=default

Public Attributes

std::vector< GlobalIndexTypechemical_system_index_map
MeshLib::Mesh const & _mesh
GlobalLinearSolverlinear_solver

Private Attributes

std::vector< std::size_t > active_element_ids_

Constructor & Destructor Documentation

◆ ChemicalSolverInterface()

ChemistryLib::ChemicalSolverInterface::ChemicalSolverInterface ( MeshLib::Mesh const & mesh,
GlobalLinearSolver & linear_solver_ )
inline

Definition at line 112 of file ChemicalSolverInterface.h.

114 : _mesh(mesh), linear_solver(linear_solver_)
115 {
116 auto const* const bulk_element_ids = bulkElementIDs(_mesh);
117 if (bulk_element_ids == nullptr)
118 {
119 OGS_FATAL(
120 "The 'bulk_element_ids' property does not exist on the mesh "
121 "{:s}.",
122 _mesh.getName());
123 }
124 active_element_ids_.assign(bulk_element_ids->begin(),
125 bulk_element_ids->end());
126 }
#define OGS_FATAL(...)
Definition Error.h:19
PropertyVector< std::size_t > const * bulkElementIDs(Mesh const &mesh)
Definition Mesh.cpp:290

References _mesh, active_element_ids_, linear_solver, and OGS_FATAL.

Referenced by ChemistryLib::PhreeqcIOData::PhreeqcIO::PhreeqcIO(), ChemistryLib::PhreeqcKernelData::PhreeqcKernel::PhreeqcKernel(), and ChemistryLib::SelfContainedSolverData::SelfContainedSolver::SelfContainedSolver().

◆ ~ChemicalSolverInterface()

virtual ChemistryLib::ChemicalSolverInterface::~ChemicalSolverInterface ( )
virtualdefault

Member Function Documentation

◆ activeElementIDs()

std::vector< std::size_t > const & ChemistryLib::ChemicalSolverInterface::activeElementIDs ( ) const
inline

Definition at line 128 of file ChemicalSolverInterface.h.

129 {
130 return active_element_ids_;
131 }

References active_element_ids_.

◆ computeSecondaryVariable()

virtual void ChemistryLib::ChemicalSolverInterface::computeSecondaryVariable ( std::size_t const ,
std::vector< GlobalIndexType > const &  )
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 236 of file ChemicalSolverInterface.h.

239 {
240 }

◆ executeSpeciationCalculation()

virtual void ChemistryLib::ChemicalSolverInterface::executeSpeciationCalculation ( double const dt)
inlinevirtual

Run PHREEQC for all local chemical systems for the current timestep.

Uses the state previously provided by initializeChemicalSystemConcrete() / setChemicalSystemConcrete() for each chemical_system_id. Each local system is advanced as an isolated batch reactor over \(\Delta t\): no mass is exchanged between different systems inside PHREEQC.

PHREEQC returns, for each system:

  • updated aqueous composition,
  • reaction / source terms \(R_{\alpha}\) for each transported component,
  • updated mineral amounts and saturation state.

After this call completes, these reacted values are available for porosity update and for assembling the reaction/source term in the transport equation.

Parameters
dtTimestep size \(\Delta t\) used for kinetic reactions.

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO, and ChemistryLib::PhreeqcKernelData::PhreeqcKernel.

Definition at line 175 of file ChemicalSolverInterface.h.

176 {
177 }

◆ getComponentList()

virtual std::vector< std::string > const ChemistryLib::ChemicalSolverInterface::getComponentList ( ) const
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 186 of file ChemicalSolverInterface.h.

187 {
188 return {};
189 }

◆ getConcentration()

virtual double ChemistryLib::ChemicalSolverInterface::getConcentration ( int const ,
GlobalIndexType const  ) const
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 179 of file ChemicalSolverInterface.h.

182 {
183 return std::numeric_limits<double>::quiet_NaN();
184 }

◆ getKineticPrefactor()

virtual double ChemistryLib::ChemicalSolverInterface::getKineticPrefactor ( std::size_t reaction_id) const
inlinevirtual

Reimplemented in ChemistryLib::SelfContainedSolverData::SelfContainedSolver.

Definition at line 196 of file ChemicalSolverInterface.h.

198 {
199 return std::numeric_limits<double>::quiet_NaN();
200 }

◆ getStoichiometricMatrix()

virtual Eigen::SparseMatrix< double > const * ChemistryLib::ChemicalSolverInterface::getStoichiometricMatrix ( ) const
inlinevirtual

Reimplemented in ChemistryLib::SelfContainedSolverData::SelfContainedSolver.

Definition at line 191 of file ChemicalSolverInterface.h.

192 {
193 return nullptr;
194 }

◆ initialize()

virtual void ChemistryLib::ChemicalSolverInterface::initialize ( )
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 133 of file ChemicalSolverInterface.h.

133{}

◆ initializeChemicalSystemConcrete()

virtual void ChemistryLib::ChemicalSolverInterface::initializeChemicalSystemConcrete ( std::vector< double > const & ,
GlobalIndexType const & ,
MaterialPropertyLib::Medium const & ,
ParameterLib::SpatialPosition const & ,
double const  )
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 135 of file ChemicalSolverInterface.h.

140 {
141 }

◆ setAqueousSolutionsPrevFromDumpFile()

virtual void ChemistryLib::ChemicalSolverInterface::setAqueousSolutionsPrevFromDumpFile ( )
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 153 of file ChemicalSolverInterface.h.

153{}

◆ setChemicalSystemConcrete()

virtual void ChemistryLib::ChemicalSolverInterface::setChemicalSystemConcrete ( std::vector< double > const & ,
GlobalIndexType const & ,
MaterialPropertyLib::Medium const * ,
MaterialPropertyLib::VariableArray const & ,
ParameterLib::SpatialPosition const & ,
double const ,
double const  )
inlinevirtual

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 143 of file ChemicalSolverInterface.h.

150 {
151 }

◆ updatePorosityPostReaction()

virtual void ChemistryLib::ChemicalSolverInterface::updatePorosityPostReaction ( GlobalIndexType const & ,
MaterialPropertyLib::Medium const & ,
double &  )
inlinevirtual

Update porosity after chemical reactions.

This applies porosity changes caused by precipitation / dissolution in the local chemical system. The updated porosity can then be used to update flow parameters (e.g. permeability) in the next timestep.

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 229 of file ChemicalSolverInterface.h.

233 {
234 }

◆ updateVolumeFractionPostReaction()

virtual void ChemistryLib::ChemicalSolverInterface::updateVolumeFractionPostReaction ( GlobalIndexType const & ,
MaterialPropertyLib::Medium const & ,
ParameterLib::SpatialPosition const & ,
double const ,
double const ,
double const  )
inlinevirtual

Apply mineral precipitation / dissolution to the solid fraction in OGS.

Called after executeSpeciationCalculation(). For a given chemical_system_id, this function updates the solid / mineral inventory and related volume fractions based on the PHREEQC results for the last timestep.

Typical effect:

  • change in mineral volume fraction at this location,
  • updated solid composition available to mechanics / flow.

Reimplemented in ChemistryLib::PhreeqcIOData::PhreeqcIO.

Definition at line 214 of file ChemicalSolverInterface.h.

219 {
220 }

Member Data Documentation

◆ _mesh

MeshLib::Mesh const& ChemistryLib::ChemicalSolverInterface::_mesh

Definition at line 246 of file ChemicalSolverInterface.h.

Referenced by ChemicalSolverInterface().

◆ active_element_ids_

std::vector<std::size_t> ChemistryLib::ChemicalSolverInterface::active_element_ids_
private

Definition at line 252 of file ChemicalSolverInterface.h.

Referenced by ChemicalSolverInterface(), and activeElementIDs().

◆ chemical_system_index_map

std::vector<GlobalIndexType> ChemistryLib::ChemicalSolverInterface::chemical_system_index_map

◆ linear_solver

GlobalLinearSolver& ChemistryLib::ChemicalSolverInterface::linear_solver

The documentation for this class was generated from the following file: