GEOS
SinglePhaseFVM.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_SINGLEPHASEFVM_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEFVM_HPP_
22 
26 
27 namespace geos
28 {
29 
30 
38 template< typename BASE = SinglePhaseBase >
39 class SinglePhaseFVM : public BASE
40 {
41 public:
42 
43  // Aliasing public/protected members/methods of PhysicsSolverBase so we don't
44  // have to use this->member etc.
45  using BASE::forDiscretizationOnMeshTargets;
46  using BASE::m_discretizationName;
47  using BASE::m_linearSolverParameters;
48  using BASE::m_nonlinearSolverParameters;
49  using BASE::m_precond;
50 
51  // Aliasing public/protected members/methods of FlowSolverBase so we don't
52  // have to use this->member etc.
53  using BASE::m_numDofPerCell;
54  using BASE::m_isThermal;
55  using BASE::m_scalingType;
56 
62  SinglePhaseFVM( const string & name,
63  dataRepository::Group * const parent );
64 
65 
67  SinglePhaseFVM() = delete;
68 
70  SinglePhaseFVM( SinglePhaseFVM const & ) = delete;
71 
73  SinglePhaseFVM( SinglePhaseFVM && ) = default;
74 
76  SinglePhaseFVM & operator=( SinglePhaseFVM const & ) = delete;
77 
80 
84  virtual ~SinglePhaseFVM() override = default;
85 
90  static string catalogName()
91  {
92  if constexpr ( std::is_same_v< BASE, SinglePhaseBase > )
93  {
94  return "SinglePhaseFVM";
95  }
96  else if constexpr ( std::is_same_v< BASE, SinglePhaseProppantBase > )
97  {
98  return "SinglePhaseProppantFVM";
99  }
100  else
101  {
102  return BASE::catalogName();
103  }
104  }
105 
109  string getCatalogName() const override { return catalogName(); }
110 
118  virtual void
119  setupDofs( DomainPartition const & domain,
120  DofManager & dofManager ) const override;
121 
122  virtual void
124  DofManager & dofManager,
125  CRSMatrix< real64, globalIndex > & localMatrix,
126  ParallelVector & rhs,
127  ParallelVector & solution,
128  bool const setSparsity = true ) override;
129 
130  virtual std::unique_ptr< PreconditionerBase< LAInterface > >
131  createPreconditioner( DomainPartition & domain ) const override;
132 
133  virtual void
135  real64 const dt,
136  DomainPartition & domain,
137  DofManager const & dofManager,
138  CRSMatrixView< real64, globalIndex const > const & localMatrix,
139  arrayView1d< real64 > const & localRhs ) override;
140 
141  virtual real64
142  calculateResidualNorm( real64 const & time_n,
143  real64 const & dt,
144  DomainPartition const & domain,
145  DofManager const & dofManager,
146  arrayView1d< real64 const > const & localRhs ) override;
147 
148  virtual void
149  applySystemSolution( DofManager const & dofManager,
150  arrayView1d< real64 const > const & localSolution,
151  real64 const scalingFactor,
152  real64 const dt,
153  DomainPartition & domain ) override;
154  virtual void
156  DomainPartition const & domain,
157  DofManager const & dofManager,
158  CRSMatrixView< real64, globalIndex const > const & localMatrix,
159  arrayView1d< real64 > const & localRhs ) override;
160 
161  virtual void
163  DomainPartition const & domain,
164  DofManager const & dofManager,
165  CRSMatrixView< real64, globalIndex const > const & localMatrix,
166  arrayView1d< real64 > const & localRhs ) override;
167  virtual void
168  assembleEDFMFluxTerms( real64 const time_n,
169  real64 const dt,
170  DomainPartition const & domain,
171  DofManager const & dofManager,
172  CRSMatrixView< real64, globalIndex const > const & localMatrix,
173  arrayView1d< real64 > const & localRhs,
174  string const & jumpDofKey ) override final;
175 
176  virtual void
177  assembleHydrofracFluxTerms( real64 const time_n,
178  real64 const dt,
179  DomainPartition const & domain,
180  DofManager const & dofManager,
181  CRSMatrixView< real64, globalIndex const > const & localMatrix,
182  arrayView1d< real64 > const & localRhs,
184  stdMap< string, localIndex > const * const dR_dAperOffsets ) override final;
185 
188  virtual void
189  applyAquiferBC( real64 const time,
190  real64 const dt,
191  DomainPartition & domain,
192  DofManager const & dofManager,
193  CRSMatrixView< real64, globalIndex const > const & localMatrix,
194  arrayView1d< real64 > const & localRhs ) const override;
195 
196  virtual void initializePreSubGroups() override;
197 
198  struct viewKeyStruct : BASE::viewKeyStruct
199  {
200  // nonlinear solver parameters
201  static constexpr char const * scalingTypeString() { return "scalingType"; }
202  };
203 
204 private:
205 
215  void applyFaceDirichletBC( real64 const time_n,
216  real64 const dt,
217  DofManager const & faceSet,
218  DomainPartition & domain,
219  CRSMatrixView< real64, globalIndex const > const & localMatrix,
220  arrayView1d< real64 > const & localRhs );
221 
222 };
223 
224 } /* namespace geos */
225 
226 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEFVM_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...
SinglePhaseFVM & operator=(SinglePhaseFVM const &)=delete
deleted assignment operator
SinglePhaseFVM()=delete
deleted default constructor
virtual void initializePreSubGroups() override
Called by Initialize() prior to initializing sub-Groups.
SinglePhaseFVM(const string &name, dataRepository::Group *const parent)
main constructor for Group Objects
static string catalogName()
name of the node manager in the object catalog
SinglePhaseFVM & operator=(SinglePhaseFVM &&)=delete
deleted move operator
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.
virtual ~SinglePhaseFVM() override=default
default destructor
SinglePhaseFVM(SinglePhaseFVM const &)=delete
deleted copy constructor
string getCatalogName() const override
SinglePhaseFVM(SinglePhaseFVM &&)=default
default move constructor
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
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 setupSystem(DomainPartition &domain, DofManager &dofManager, CRSMatrix< real64, globalIndex > &localMatrix, ParallelVector &rhs, ParallelVector &solution, bool const setSparsity=true) override
Set up the linear system (DOF indices and sparsity patterns)
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 std::unique_ptr< PreconditionerBase< LAInterface > > createPreconditioner(DomainPartition &domain) const override
Create a preconditioner for this solver's linear system.
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 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
virtual void setupDofs(DomainPartition const &domain, DofManager &dofManager) const override
Populate degree-of-freedom manager with fields relevant to this solver.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
LvArray::CRSMatrix< T, COL_INDEX, INDEX_TYPE, LvArray::ChaiBuffer > CRSMatrix
Alias for CRS Matrix class.
Definition: DataTypes.hpp:305
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
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.