GEOS
SinglePhaseReactiveTransport.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEREACTIVETRANSPORT_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEREACTIVETRANSPORT_HPP_
22 
37 #include "constitutive/fluid/reactivefluid/ReactiveSinglePhaseFluid.hpp"
38 
39 
40 namespace geos
41 {
42 
49 {
50 
51 public:
52 
58  SinglePhaseReactiveTransport( const string & name,
59  dataRepository::Group * const parent );
60 
62 
65 
68 
71 
74 
78  virtual ~SinglePhaseReactiveTransport() override = default;
79 
80  using SinglePhaseBase::updatePorosityAndPermeability;
81 
86  static string catalogName()
87  {
88  return "SinglePhaseReactiveTransport";
89  }
90 
94  string getCatalogName() const override { return catalogName(); }
95 
96  virtual void registerDataOnMesh( dataRepository::Group & meshBodies ) override;
97 
98  virtual void
99  setupDofs( DomainPartition const & domain,
100  DofManager & dofManager ) const override;
101 
102  virtual void
103  implicitStepSetup( real64 const & time_n,
104  real64 const & dt,
105  DomainPartition & domain ) override final;
106 
107  virtual void
108  assembleSystem( real64 const time_n,
109  real64 const dt,
110  DomainPartition & domain,
111  DofManager const & dofManager,
112  CRSMatrixView< real64, globalIndex const > const & localMatrix,
113  arrayView1d< real64 > const & localRhs ) override;
114 
115  virtual void
117  real64 const dt,
118  DomainPartition & domain,
119  DofManager const & dofManager,
120  CRSMatrixView< real64, globalIndex const > const & localMatrix,
121  arrayView1d< real64 > const & localRhs ) override;
122 
123  virtual real64
124  calculateResidualNorm( real64 const & time_n,
125  real64 const & dt,
126  DomainPartition const & domain,
127  DofManager const & dofManager,
128  arrayView1d< real64 const > const & localRhs ) override;
129 
130  virtual void
131  applySystemSolution( DofManager const & dofManager,
132  arrayView1d< real64 const > const & localSolution,
133  real64 const scalingFactor,
134  real64 const dt,
135  DomainPartition & domain ) override;
136 
137  virtual void
139 
140  virtual void
142  real64 const & dt,
143  DomainPartition & domain ) override final;
144 
145  virtual void saveConvergedState( ElementSubRegionBase & subRegion ) const override final;
146 
147  virtual void
148  updateState ( DomainPartition & domain ) override final;
149 
150  void updateMixedReactionSystem( ElementSubRegionBase & subRegion ) const;
151 
152  void updateSurfaceArea( ElementSubRegionBase & subRegion ) const;
153 
154  void updateSpeciesAmount( ElementSubRegionBase & subRegion ) const;
155 
156  void updateKineticReactionMolarIncrements( real64 const dt,
157  ElementSubRegionBase & subRegion ) const;
158 
159  virtual void updateFluidModel( ObjectManagerBase & dataGroup ) const override;
160 
161  virtual void updatePorosityAndPermeability( CellElementSubRegion & subRegion ) const override;
162 
164 
165  virtual void initializeFluidState( MeshLevel & mesh, string_array const & regionNames ) override;
166 
167  void initializeEquilibriumReaction( ElementSubRegionBase & subRegion ) const;
168 
173  virtual void validateConstitutiveModels( DomainPartition & domain ) const override final;
174 
180 
190  DomainPartition & domain,
191  DofManager const & dofManager,
192  CRSMatrixView< real64, globalIndex const > const & localMatrix,
193  arrayView1d< real64 > const & localRhs ) const;
194 
203  virtual void
205  DomainPartition const & domain,
206  DofManager const & dofManager,
207  CRSMatrixView< real64, globalIndex const > const & localMatrix,
208  arrayView1d< real64 > const & localRhs ) override;
209 
219  virtual void
220  applySourceFluxBC( real64 const time_n,
221  real64 const dt,
222  DomainPartition & domain,
223  DofManager const & dofManager,
224  CRSMatrixView< real64, globalIndex const > const & localMatrix,
225  arrayView1d< real64 > const & localRhs ) const override;
226 
236  virtual void
237  applyDirichletBC( real64 const time_n,
238  real64 const dt,
239  DomainPartition & domain,
240  DofManager const & dofManager,
241  CRSMatrixView< real64, globalIndex const > const & localMatrix,
242  arrayView1d< real64 > const & localRhs ) const override;
243 
244  virtual void
245  applyAquiferBC( real64 const time,
246  real64 const dt,
247  DomainPartition & domain,
248  DofManager const & dofManager,
249  CRSMatrixView< real64, globalIndex const > const & localMatrix,
250  arrayView1d< real64 > const & localRhs ) const override;
251 
252  virtual void
254  real64 const dt,
255  DomainPartition const & domain,
256  DofManager const & dofManager,
257  CRSMatrixView< real64, globalIndex const > const & localMatrix,
258  arrayView1d< real64 > const & localRhs,
259  string const & jumpDofKey ) override final;
260 
261  virtual void
263  DomainPartition const & domain,
264  DofManager const & dofManager,
265  CRSMatrixView< real64, globalIndex const > const & localMatrix,
266  arrayView1d< real64 > const & localRhs ) override;
267 
269  {
270  static constexpr char const * diffusionNamesString() { return "diffusionNames"; }
271  static constexpr char const * isUpdateReactivePorosityString() { return "isUpdateReactivePorosity"; }
272  static constexpr char const * isUpdateSurfaceAreaString() { return "isUpdateSurfaceArea"; }
273  static constexpr char const * immobilePrimarySpeciesIndicesString() { return "immobilePrimarySpeciesIndices"; }
274  };
275 
276 protected:
277 
280 
283 
286 
289 
292 
295 
298 
299 private:
300 
310  void applyFaceDirichletBC( real64 const time_n,
311  real64 const dt,
312  DofManager const & faceSet,
313  DomainPartition & domain,
314  CRSMatrixView< real64, globalIndex const > const & localMatrix,
315  arrayView1d< real64 > const & localRhs );
316 
317 };
318 
319 
320 } /* namespace geos */
321 
322 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEREACTIVETRANSPORT_HPP_
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:45
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
virtual void initializePostInitialConditionsPreSubGroups() override
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
virtual void validateConstitutiveModels(DomainPartition &domain) const override final
Checks constitutive models for consistency.
virtual ~SinglePhaseReactiveTransport() override=default
default destructor
virtual void applyDirichletBC(real64 const time_n, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const override
Function to perform the Application of Dirichlet type BC's.
virtual void applySourceFluxBC(real64 const time_n, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const override
Apply source flux boundary conditions to the system.
virtual void resetStateToBeginningOfStep(DomainPartition &domain) override
reset state of physics back to the beginning of the step.
virtual void assembleStabilizedFluxTerms(real64 const dt, DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the flux terms for all cells including jump stabilization
virtual void applyBoundaryConditions(real64 const time_n, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
apply boundary condition to system
array1d< integer > m_immobilePrimarySpeciesIndices
array to store the indices of immobile primary species
virtual void saveConvergedState(ElementSubRegionBase &subRegion) const override final
Utility function to save the converged state.
virtual void applySystemSolution(DofManager const &dofManager, arrayView1d< real64 const > const &localSolution, real64 const scalingFactor, real64 const dt, DomainPartition &domain) override
Function to apply the solution vector to the state.
virtual void updateFluidModel(ObjectManagerBase &dataGroup) const override
Function to update all constitutive models.
integer m_isUpdateSurfaceArea
flag to determine whether or not to update the surface area
virtual void assembleSystem(real64 const time_n, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
function to assemble the linear system matrix and rhs
virtual void implicitStepComplete(real64 const &time, real64 const &dt, DomainPartition &domain) override final
perform cleanup for implicit timestep
virtual void updateState(DomainPartition &domain) override final
Recompute all dependent quantities from primary variables (including constitutive models)
integer numPrimarySpecies() const
Getter for the number of fluid components (species)
integer m_hasDiffusion
flag to determine whether or not to apply diffusion
integer m_isUpdateReactivePorosity
flag to determine whether or not to use the reactive porosity
SinglePhaseReactiveTransport(SinglePhaseReactiveTransport &&)=default
default move constructor
virtual void registerDataOnMesh(dataRepository::Group &meshBodies) override
Register wrappers that contain data on the mesh objects.
virtual void implicitStepSetup(real64 const &time_n, real64 const &dt, DomainPartition &domain) override final
function to perform setup for implicit timestep
void assembleAccumulationTermsInMassBalanceAndSpeciesAmountEqs(real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const
assembles the accumulation terms in total mass balance and primary species amount equation for all ce...
static string catalogName()
name of the node manager in the object catalog
virtual void setupDofs(DomainPartition const &domain, DofManager &dofManager) const override
Populate degree-of-freedom manager with fields relevant to this solver.
SinglePhaseReactiveTransport(SinglePhaseReactiveTransport const &)=delete
deleted copy constructor
virtual void assembleEDFMFluxTerms(real64 const time_n, real64 const dt, DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs, string const &jumpDofKey) override final
assembles the flux terms for all cells for the poroelastic case
integer m_numKineticReactions
the number of kinetic reactions
SinglePhaseReactiveTransport & operator=(SinglePhaseReactiveTransport const &)=delete
deleted assignment operator
SinglePhaseReactiveTransport(const string &name, dataRepository::Group *const parent)
main constructor for Group Objects
SinglePhaseReactiveTransport & operator=(SinglePhaseReactiveTransport &&)=delete
deleted move operator
virtual real64 calculateResidualNorm(real64 const &time_n, real64 const &dt, DomainPartition const &domain, DofManager const &dofManager, arrayView1d< real64 const > const &localRhs) override
calculate the norm of the global system residual
virtual void applyAquiferBC(real64 const time, real64 const dt, DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const override
Apply aquifer boundary conditions to the system.
integer m_numPrimarySpecies
the number of primary species in the fluid
virtual void assembleFluxTerms(real64 const dt, DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) override
assembles the flux terms for all cells
string m_reactiveFluidModelName
name of the reactive fluid constitutive model
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
stdVector< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:361
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:309
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175