GEOS
ImmiscibleMultiphaseFlow.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_IMMISCIBLEMULTIPHASEFLOW_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_IMMISCIBLEMULTIPHASEFLOW_HPP_
22 
25 
26 namespace geos
27 {
28 
29 //START_SPHINX_INCLUDE_00
36 {
37 public:
38 
44  ImmiscibleMultiphaseFlow( const string & name,
45  Group * const parent );
46 
49 
52 
55 
58 
61 
65  virtual ~ImmiscibleMultiphaseFlow() override = default;
70  static string catalogName() { return "ImmiscibleMultiphaseFlow"; }
74  string getCatalogName() const override { return catalogName(); }
75 
76  virtual void registerDataOnMesh( Group & meshBodies ) override final;
77 
78  virtual void
79  implicitStepSetup( real64 const & time_n,
80  real64 const & dt,
81  DomainPartition & domain ) override;
82 
83  virtual void
84  assembleSystem( real64 const time_n,
85  real64 const dt,
86  DomainPartition & domain,
87  DofManager const & dofManager,
89  arrayView1d< real64 > const & localRhs ) override;
90 
91  virtual real64
92  calculateResidualNorm( real64 const & GEOS_UNUSED_PARAM( time_n ),
93  real64 const & GEOS_UNUSED_PARAM( dt ),
94  DomainPartition const & domain,
95  DofManager const & dofManager,
96  arrayView1d< real64 const > const & localRhs ) override;
97 
98  virtual void
99  applySystemSolution( DofManager const & dofManager,
100  arrayView1d< real64 const > const & localSolution,
101  real64 const scalingFactor,
102  real64 const dt,
103  DomainPartition & domain ) override;
104 
105  virtual void
106  setupDofs( DomainPartition const & domain,
107  DofManager & dofManager ) const override;
108 
109  virtual void
111  real64 const dt,
112  DomainPartition & domain,
113  DofManager const & dofManager,
114  CRSMatrixView< real64, globalIndex const > const & localMatrix,
115  arrayView1d< real64 > const & localRhs ) override;
116 
117  virtual void
119 
120  virtual void
122  real64 const & dt,
123  DomainPartition & domain ) override;
124 
125  void updateFluidState( ElementSubRegionBase & subRegion ) const;
126 
127  void updateVolumeConstraint( ElementSubRegionBase & subRegion ) const;
128 
129  virtual void saveConvergedState( ElementSubRegionBase & subRegion ) const override final;
130 
131  virtual void updateState( DomainPartition & domain ) override final;
132 
137  integer numFluidPhases() const { return m_numPhases; }
138 
149  DofManager const & dofManager,
150  CRSMatrixView< real64, globalIndex const > const & localMatrix,
151  arrayView1d< real64 > const & localRhs ) const;
152 
162  virtual void
164  DomainPartition const & domain,
165  DofManager const & dofManager,
166  CRSMatrixView< real64, globalIndex const > const & localMatrix,
167  arrayView1d< real64 > const & localRhs ) const;
168 
178  void applyDirichletBC( real64 const time,
179  real64 const dt,
180  DofManager const & dofManager,
181  DomainPartition & domain,
182  CRSMatrixView< real64, globalIndex const > const & localMatrix,
183  arrayView1d< real64 > const & localRhs ) const;
184 
185  void applySourceFluxBC( real64 const time,
186  real64 const dt,
187  DofManager const & dofManager,
188  DomainPartition & domain,
189  CRSMatrixView< real64, globalIndex const > const & localMatrix,
190  arrayView1d< real64 > const & localRhs ) const;
198  virtual real64 setNextDtBasedOnStateChange( real64 const & currentDt,
199  DomainPartition & domain ) override;
200 
201  virtual void initializePreSubGroups() override;
202 
204 
205  virtual void initializeFluidState( MeshLevel & mesh, string_array const & regionNames ) override;
206 
207 
212  void updatePhaseMass( ElementSubRegionBase & subRegion ) const;
213 
215  {
216  // inputs
217 
218  // density averaging scheme
219  static constexpr char const * gravityDensitySchemeString() { return "gravityDensityScheme"; }
220 
221  // time stepping controls
222  static constexpr char const * solutionChangeScalingFactorString() { return "solutionChangeScalingFactor"; }
223  static constexpr char const * targetRelativePresChangeString() { return "targetRelativePressureChangeInTimeStep"; }
224  static constexpr char const * targetPhaseVolFracChangeString() { return "targetPhaseVolFractionChangeInTimeStep"; }
225 
226  // nonlinear solver parameters
227  static constexpr char const * maxRelativePresChangeString() { return "maxRelativePressureChange"; }
228  static constexpr char const * useTotalMassEquationString() { return "useTotalMassEquation"; }
229 
230  static constexpr char const * capPressureNamesString() { return "capillary_pressure"; }
231  static constexpr char const * relPermNamesString() { return "relative_permeability"; }
232  static constexpr char const * elemDofFieldString() { return "elemDofField"; }
233  };
234 
235 
236 private:
237 
238  virtual void postInputInitialization() override;
239 
244  void updateFluidModel( ObjectManagerBase & dataGroup ) const;
245 
250  void updateRelPermModel( ObjectManagerBase & dataGroup ) const;
251 
256  void updateCapPressureModel( ObjectManagerBase & dataGroup ) const;
257 
262  void updatePhaseMobility( ObjectManagerBase & dataGroup ) const;
263 
265  integer m_numPhases;
266 
268  bool m_hasCapPressure;
269 
271  integer m_useTotalMassEquation;
272 
274  GravityDensityScheme m_gravityDensityScheme;
275 
277  real64 m_targetRelativePresChange;
278 
280  real64 m_targetPhaseVolFracChange;
281 
283  real64 m_solutionChangeScalingFactor;
284 
285 
286 private:
287 
293  bool validateDirichletBC( DomainPartition & domain,
294  real64 const time ) const;
295 
296  virtual void setConstitutiveNames( ElementSubRegionBase & subRegion ) const override;
297 
298 };
299 
300 
301 } // namespace geos
302 
303 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_IMMISCIBLEMULTIPHASEFLOW_HPP_
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
Definition: GeosxMacros.hpp:97
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...
ImmiscibleMultiphaseFlow & operator=(ImmiscibleMultiphaseFlow &&)=delete
deleted move operator
virtual ~ImmiscibleMultiphaseFlow() override=default
default destructor
virtual void implicitStepComplete(real64 const &time, real64 const &dt, DomainPartition &domain) override
perform cleanup for implicit timestep
virtual void updateState(DomainPartition &domain) override final
Recompute all dependent quantities from primary variables (including constitutive models)
virtual void saveConvergedState(ElementSubRegionBase &subRegion) const override final
Utility function to save the converged state.
ImmiscibleMultiphaseFlow(ImmiscibleMultiphaseFlow const &)=delete
deleted copy constructor
virtual void initializePostInitialConditionsPreSubGroups() override
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
virtual void initializePreSubGroups() override
Called by Initialize() prior to initializing sub-Groups.
void updatePhaseMass(ElementSubRegionBase &subRegion) const
Function to update fluid mass.
virtual real64 setNextDtBasedOnStateChange(real64 const &currentDt, DomainPartition &domain) override
function to set the next time step size
virtual void implicitStepSetup(real64 const &time_n, real64 const &dt, DomainPartition &domain) override
function to perform setup for implicit timestep
ImmiscibleMultiphaseFlow(ImmiscibleMultiphaseFlow &&)=default
default move constructor
ImmiscibleMultiphaseFlow(const string &name, Group *const parent)
main constructor for Group Objects
void assembleAccumulationTerm(DomainPartition &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const
assembles the accumulation and volume balance terms for all cells
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.
integer numFluidPhases() const
Getter for the number of fluid phases.
virtual void assembleFluxTerms(real64 const dt, DomainPartition const &domain, DofManager const &dofManager, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const
assembles the flux terms for all cells
static string catalogName()
name of the solver in the object catalog
void applyDirichletBC(real64 const time, real64 const dt, DofManager const &dofManager, DomainPartition &domain, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs) const
Function to perform the Application of Dirichlet type BC's.
virtual void resetStateToBeginningOfStep(DomainPartition &domain) override
reset state of physics back to the beginning of the step.
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 setupDofs(DomainPartition const &domain, DofManager &dofManager) const override
Populate degree-of-freedom manager with fields relevant to this solver.
ImmiscibleMultiphaseFlow()=delete
deleted default constructor
virtual void registerDataOnMesh(Group &meshBodies) override final
Register wrappers that contain data on the mesh objects.
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
ImmiscibleMultiphaseFlow & operator=(ImmiscibleMultiphaseFlow const &)=delete
deleted assignment operator
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.
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
GravityDensityScheme
Options for density treatment in gravity.