OGS
PhreeqcIO.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <memory>
14
16#include "PhreeqcIOData/Knobs.h"
17
18namespace MeshLib
19{
20class Mesh;
21}
22
23namespace ChemistryLib
24{
25namespace PhreeqcIOData
26{
27struct ChemicalSystem;
28struct ReactionRate;
29struct Output;
30struct Dump;
31struct UserPunch;
32
34{
35public:
36 PhreeqcIO(MeshLib::Mesh const& mesh,
38 std::string const& project_file_name,
39 std::string&& database,
40 std::unique_ptr<ChemicalSystem>&& chemical_system,
41 std::vector<ReactionRate>&& reaction_rates,
42 std::unique_ptr<UserPunch>&& user_punch,
43 std::unique_ptr<Output>&& output,
44 std::unique_ptr<Dump>&& dump,
45 Knobs&& knobs);
46
47 ~PhreeqcIO();
48
49 void initialize() override;
50
52 std::vector<double> const& concentrations,
53 GlobalIndexType const& chemical_system_id,
54 MaterialPropertyLib::Medium const& medium,
56 double const t) override;
57
59 std::vector<double> const& concentrations,
60 GlobalIndexType const& chemical_system_id,
61 MaterialPropertyLib::Medium const* medium,
63 ParameterLib::SpatialPosition const& pos, double const t,
64 double const dt) override;
65
67
68 void executeSpeciationCalculation(double const dt) override;
69
70 double getConcentration(
71 int const component_id,
72 GlobalIndexType const chemical_system_id) const override;
73
74 friend std::ostream& operator<<(std::ostream& os,
75 PhreeqcIO const& phreeqc_io);
76
77 friend std::istream& operator>>(std::istream& in, PhreeqcIO& phreeqc_io);
78
80 GlobalIndexType const& chemical_system_id,
81 MaterialPropertyLib::Medium const& medium,
82 ParameterLib::SpatialPosition const& pos, double const porosity,
83 double const t, double const dt) override;
84
85 void updatePorosityPostReaction(GlobalIndexType const& chemical_system_id,
86 MaterialPropertyLib::Medium const& medium,
87 double& porosity) override;
88
90 std::size_t const ele_id,
91 std::vector<GlobalIndexType> const& chemical_system_indices) override;
92
93 std::vector<std::string> const getComponentList() const override;
94
95 std::string const _phreeqc_input_file;
96
97private:
98 void writeInputsToFile(double const dt);
99
100 void callPhreeqc() const;
101
102 void readOutputsFromFile();
103
104 PhreeqcIO& operator<<(double const dt)
105 {
106 _dt = dt;
107 return *this;
108 }
109
110 std::string const _database;
111 std::unique_ptr<ChemicalSystem> _chemical_system;
112 std::vector<ReactionRate> const _reaction_rates;
113 std::unique_ptr<UserPunch> _user_punch;
114 std::unique_ptr<Output> const _output;
115 std::unique_ptr<Dump> const _dump;
117 double _dt = std::numeric_limits<double>::quiet_NaN();
118 const int phreeqc_instance_id = 0;
119 std::size_t _num_chemical_systems = -1;
120};
121} // namespace PhreeqcIOData
122} // namespace ChemistryLib
GlobalMatrix::IndexType GlobalIndexType
friend std::ostream & operator<<(std::ostream &os, PhreeqcIO const &phreeqc_io)
double getConcentration(int const component_id, GlobalIndexType const chemical_system_id) const override
PhreeqcIO(MeshLib::Mesh const &mesh, GlobalLinearSolver &linear_solver, std::string const &project_file_name, std::string &&database, std::unique_ptr< ChemicalSystem > &&chemical_system, std::vector< ReactionRate > &&reaction_rates, std::unique_ptr< UserPunch > &&user_punch, std::unique_ptr< Output > &&output, std::unique_ptr< Dump > &&dump, Knobs &&knobs)
void setAqueousSolutionsPrevFromDumpFile() override
std::unique_ptr< ChemicalSystem > _chemical_system
Definition PhreeqcIO.h:111
std::vector< ReactionRate > const _reaction_rates
Definition PhreeqcIO.h:112
std::unique_ptr< UserPunch > _user_punch
Definition PhreeqcIO.h:113
void writeInputsToFile(double const dt)
void setChemicalSystemConcrete(std::vector< double > const &concentrations, GlobalIndexType const &chemical_system_id, MaterialPropertyLib::Medium const *medium, MaterialPropertyLib::VariableArray const &vars, ParameterLib::SpatialPosition const &pos, double const t, double const dt) override
PhreeqcIO & operator<<(double const dt)
Definition PhreeqcIO.h:104
std::unique_ptr< Dump > const _dump
Definition PhreeqcIO.h:115
std::unique_ptr< Output > const _output
Definition PhreeqcIO.h:114
void computeSecondaryVariable(std::size_t const ele_id, std::vector< GlobalIndexType > const &chemical_system_indices) override
void initializeChemicalSystemConcrete(std::vector< double > const &concentrations, GlobalIndexType const &chemical_system_id, MaterialPropertyLib::Medium const &medium, ParameterLib::SpatialPosition const &pos, double const t) override
void updateVolumeFractionPostReaction(GlobalIndexType const &chemical_system_id, MaterialPropertyLib::Medium const &medium, ParameterLib::SpatialPosition const &pos, double const porosity, double const t, double const dt) override
void executeSpeciationCalculation(double const dt) override
friend std::istream & operator>>(std::istream &in, PhreeqcIO &phreeqc_io)
std::vector< std::string > const getComponentList() const override
void updatePorosityPostReaction(GlobalIndexType const &chemical_system_id, MaterialPropertyLib::Medium const &medium, double &porosity) override