https://mooseframework.inl.gov
GeochemistrySpatialReactor.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "GeochemicalSolver.h"
14 
19 {
20 public:
23 
26  virtual void initialize() override;
27 
29  virtual void finalize() override;
30  virtual void threadJoin(const UserObject & uo) override;
31 
32  virtual void initialSetup() override;
33  virtual void execute() override;
34  virtual void meshChanged() override;
35 
36  virtual const GeochemicalSystem & getGeochemicalSystem(dof_id_type node_id) const override;
37  virtual const std::stringstream & getSolverOutput(dof_id_type node_id) const override;
38  virtual unsigned getSolverIterations(dof_id_type node_id) const override;
39  virtual Real getSolverResidual(dof_id_type node_id) const override;
40  virtual const DenseVector<Real> & getMoleAdditions(dof_id_type node_id) const override;
41  virtual Real getMolesDumped(dof_id_type node_id, const std::string & species) const override;
42 
43 protected:
49  const unsigned _num_kin;
51  std::vector<ModelGeochemicalDatabase> _mgd_at_node;
53  std::vector<GeochemicalSystem> _egs_at_node;
63  const std::vector<std::string> _source_species_names;
65  const unsigned _num_source_species;
67  std::vector<const VariableValue *> _source_species_rates;
69  const std::vector<std::string> _remove_fixed_activity_name;
71  const std::vector<Real> _remove_fixed_activity_time;
73  const unsigned _num_removed_fixed;
75  std::vector<std::vector<bool>> _removed_fixed_activity;
77  const std::vector<std::string> _controlled_activity_species_names;
79  const unsigned _num_controlled_activity;
81  std::vector<const VariableValue *> _controlled_activity_species_values;
83  DenseVector<Real> _mole_rates;
85  std::vector<DenseVector<Real>> _mole_additions;
87  std::vector<DenseMatrix<Real>> _dmole_additions;
89  const unsigned _ramp_subsequent;
91  std::unordered_map<dof_id_type, unsigned> _my_node_number;
93  std::vector<bool> _execute_done;
97  const Real _dt_min;
99  const Real _dt_dec;
101  const Real _dt_inc;
103  unsigned _nthreads;
104 
106  void buildMyNodeNumber();
107 };
virtual void threadJoin(const UserObject &uo) override
Class that controls the space-dependent and time-dependent geochemistry reactions.
const Real _close_system_at_time
Defines the time at which to close the system.
const unsigned _ramp_subsequent
the ramp_max_ionic_strength to use during time-stepping
void buildMyNodeNumber()
Build the _my_node_number map.
const unsigned _num_controlled_activity
Number of species with controlled activity or fugacity.
virtual void initialSetup() override
virtual const std::stringstream & getSolverOutput(dof_id_type node_id) const override
std::vector< const VariableValue * > _source_species_rates
Rates of the source species.
std::vector< DenseMatrix< Real > > _dmole_additions
Derivative of moles_added.
GeochemicalSolver _solver
The solver.
const Real _initial_temperature
Initial equilibration temperature.
DenseVector< Real > _mole_rates
Rate of mole additions.
const bool _adaptive_timestepping
Whether to use adaptive timestepping at the nodes.
virtual Real getSolverResidual(dof_id_type node_id) const override
virtual Real getMolesDumped(dof_id_type node_id, const std::string &species) const override
unsigned _nthreads
number of threads used to execute this UserObject
static InputParameters validParams()
virtual void finalize() override
the main-thread information is used to set the other-thread information in finalize() ...
const VariableValue & _temperature
Temperature specified by user.
const Real _dt_inc
value to multiply dt my in the case of a successful solve
std::vector< std::vector< bool > > _removed_fixed_activity
Whether the activity or activity constraint has been removed at each node.
const unsigned _num_source_species
Number of source species.
const unsigned _num_kin
Number of kinetic species.
GeochemicalSystem _egs_copy
GeochemicalSystem into which the nodal GeochemicalSystem is copied to enable recovery during adaptive...
const Real _dt_dec
value to multiply dt my in the case of a failed solve
std::vector< GeochemicalSystem > _egs_at_node
GeochemicalSystem at each node.
virtual const DenseVector< Real > & getMoleAdditions(dof_id_type node_id) const override
OutputTools< Real >::VariableValue VariableValue
std::vector< const VariableValue * > _controlled_activity_species_values
Activity or fugacity of the species with controlled activity or fugacity.
GeochemistrySpatialReactor(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters sharedParams()
params that are shared with AddTimeDependentReactionSolverAction
std::vector< bool > _execute_done
whether execute has been called using this thread
This class holds information about bulk composition, molalities, activities, activity coefficients...
virtual unsigned getSolverIterations(dof_id_type node_id) const override
const InputParameters & parameters() const
std::unordered_map< dof_id_type, unsigned > _my_node_number
_my_node_number[_current_node->id()] = node number used in this object that corresponds to _current_n...
const std::vector< std::string > _controlled_activity_species_names
Names of the species with controlled activity or fugacity.
bool _closed_system
Whether the system has been closed.
virtual const GeochemicalSystem & getGeochemicalSystem(dof_id_type node_id) const override
Base class that controls the spatio-temporal solution of geochemistry reactions.
const unsigned _num_removed_fixed
Number of elements in the vector _remove_fixed_activity_name;.
std::vector< DenseVector< Real > > _mole_additions
Moles of each basis species added at each node at the current timestep, along with kinetic rates...
This class contains methods to solve the algebraic system in GeochemicalSystem.
const Real _dt_min
minimum value of dt allowed during adpative timestepping. This is set to a large number if _adaptive_...
const std::vector< std::string > _source_species_names
Names of the source species.
const std::vector< Real > _remove_fixed_activity_time
Times at which to remove the fixed activity or fugacity from the species in _remove_fixed_activity_na...
std::vector< ModelGeochemicalDatabase > _mgd_at_node
ModelGeochemicalDatabase at each node.
uint8_t dof_id_type
const std::vector< std::string > _remove_fixed_activity_name
Names of species to remove the fixed activity or fugacity constraint from.