GEOS
LaplaceBaseH1.hpp
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 Total, S.A
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 
16 #ifndef GEOS_PHYSICSSOLVERS_SIMPLEPDE_LAPLACE_BASE_HPP
17 #define GEOS_PHYSICSSOLVERS_SIMPLEPDE_LAPLACE_BASE_HPP
18 
19 #include "common/format/EnumStrings.hpp" // facilities for enum-string conversion (for reading enum values from XML input)
20 #include "physicsSolvers/PhysicsSolverBase.hpp" // an abstraction class shared by all physics solvers
21 #include "fieldSpecification/FieldSpecificationManager.hpp" // a manager that can access and set values on the discretized domain
22 
23 namespace geos
24 {
25 
26 // Like most physics solvers, the Laplace solver derives from a generic PhysicsSolverBase class.
27 // The base class is densely Doxygen-commented and worth a look if you have not done so already.
28 // Most important system assembly steps, linear and non-linear resolutions, and time-stepping mechanisms
29 // are implemented at the PhysicsSolverBase class level and can thus be used in Laplace without needing reimplementation.
31 {
32 public:
34  LaplaceBaseH1() = delete;
35 
37  LaplaceBaseH1( const string & name,
38  Group * const parent );
39 
41  virtual ~LaplaceBaseH1() override;
42 
43 //START_SPHINX_INCLUDE_REGISTERDATAONMESH
44 
46  virtual void registerDataOnMesh( Group & meshBodies ) override final;
47 
48 //END_SPHINX_INCLUDE_REGISTERDATAONMESH
49 
50  //START_SPHINX_INCLUDE_SOLVERINTERFACE
51  virtual real64 solverStep( real64 const & time_n,
52  real64 const & dt,
53  integer const cycleNumber,
54  DomainPartition & domain ) override;
55 
56  virtual void
57  implicitStepSetup( real64 const & time_n,
58  real64 const & dt,
59  DomainPartition & domain ) override;
60 
61  virtual void
62  setupDofs( DomainPartition const & domain,
63  DofManager & dofManager ) const override;
64 
65  virtual void
67  real64 const dt,
68  DomainPartition & domain,
69  DofManager const & dofManager,
71  arrayView1d< real64 > const & localRhs ) override;
72 
73  virtual void
74  applySystemSolution( DofManager const & dofManager,
75  arrayView1d< real64 const > const & localSolution,
76  real64 const scalingFactor,
77  real64 const dt,
78  DomainPartition & domain ) override;
79 
80  virtual void updateState( DomainPartition & domain ) override final;
81 
82  virtual void
83  resetStateToBeginningOfStep( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) override;
84 
85  virtual void
87  real64 const & dt,
88  DomainPartition & domain ) override;
89 
93  virtual void applyDirichletBCImplicit( real64 const time,
94  DofManager const & dofManager,
95  DomainPartition & domain,
97  arrayView1d< real64 > const & localRhs );
98 
99  //END_SPHINX_INCLUDE_SOLVERINTERFACE
100 
102  //START_SPHINX_INCLUDE_TIMEINTOPT
104  {
105  SteadyState,
106  ImplicitTransient
107  };
108  //END_SPHINX_INCLUDE_TIMEINTOPT
109 
110 
113  //START_SPHINX_INCLUDE_VIEWKEY
115  {
116  static constexpr char const * timeIntegrationOption() { return "timeIntegrationOption"; }
117  static constexpr char const * fieldVarName() { return "fieldName"; }
118  };
119  //END_SPHINX_INCLUDE_VIEWKEY
120 
121 protected:
122 
123  // These two data members are specific to the Laplace solver:
125  string m_fieldName;
128 
129 };
130 
131 
132 /* REGISTERING NEW ENUMS:
133  --------------------------
134  In order to register an enumeration type with the Data Repository and have its value read from input,
135  we must define stream insertion/extraction operators. This is a common task, so GEOSX provides
136  a facility for automating it. Upon including ``common/EnumStrings.hpp``, we can call the following macro
137  at the namespace scope (in this case, right after the ``LaplaceBaseH1`` class definition is complete):
138  */
139 //START_SPHINX_INCLUDE_REGENUM
141  "SteadyState",
142  "ImplicitTransient" );
143 //END_SPHINX_INCLUDE_REGENUM
144 
145 } /* namespace geos */
146 
147 #endif /* GEOS_PHYSICSSOLVERS_SIMPLEPDE_LAPLACE_BASE_HPP */
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
Definition: GeosxMacros.hpp:72
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:44
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
string m_fieldName
User-defined name of the physical quantity we wish to solve for (such as "Temperature",...
TimeIntegrationOption m_timeIntegrationOption
Choice of transient treatment (SteadyState, ImplicitTransient)
LaplaceBaseH1(const string &name, Group *const parent)
The constructor needs a user-defined "name" and a parent Group (to place this instance in the tree st...
virtual void setupDofs(DomainPartition const &domain, DofManager &dofManager) const override
Populate degree-of-freedom manager with fields relevant to this solver.
TimeIntegrationOption
Choice of transient treatment options (steady or backward Euler scheme):
LaplaceBaseH1()=delete
The default nullary constructor is disabled to avoid compiler auto-generation:
virtual ~LaplaceBaseH1() override
Destructor.
virtual void registerDataOnMesh(Group &meshBodies) override final
This method ties properties with their supporting mesh.
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 real64 solverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain) override
entry function to perform a solver step
virtual void implicitStepSetup(real64 const &time_n, real64 const &dt, DomainPartition &domain) override
function to perform setup for implicit timestep
virtual void applyBoundaryConditions(real64 const time, 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 applyDirichletBCImplicit(real64 const time, DofManager const &dofManager, DomainPartition &domain, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
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.
Base class for all physics solvers.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
LvArray::CRSMatrixView< T, COL_INDEX, localIndex const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:310
ENUM_STRINGS(LinearSolverParameters::SolverType, "direct", "cg", "gmres", "fgmres", "bicgstab", "preconditioner")
Declare strings associated with enumeration values.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
Structure to hold scoped key names.