GEOS
DirichletFluxComputeKernel.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_COMPOSITIONAL_DIRICHLETFLUXCOMPUTEKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_DIRICHLETFLUXCOMPUTEKERNEL_HPP
22 
23 #include "common/DataTypes.hpp"
25 
26 #include "FluxComputeKernel.hpp"
27 
28 namespace geos
29 {
30 
31 namespace isothermalCompositionalMultiphaseFVMKernels
32 {
33 
34 /******************************** DirichletFluxComputeKernel ********************************/
35 
44 template< typename FLUIDWRAPPER, typename POLICY, integer NUM_COMP, integer NUM_DOF = NUM_COMP + 1 >
46  NUM_DOF,
47  BoundaryStencilWrapper >
48 {
49 public:
50 
57  template< typename VIEWTYPE >
59 
61  using DofNumberAccessor = AbstractBase::DofNumberAccessor;
66 
67  using AbstractBase::m_dt;
72  using AbstractBase::m_gravCoef;
75  using AbstractBase::m_dPhaseCompFrac;
79  using AbstractBase::m_kernelFlags;
80 
82  using Base::numComp;
83  using Base::numDof;
84  using Base::numEqn;
86  using Base::m_phaseMob;
87  using Base::m_dPhaseMob;
89  using Base::m_dPhaseMassDens;
91  using Base::m_dPerm_dPres;
92  using Base::m_seri;
93  using Base::m_sesri;
94  using Base::m_sei;
95 
113  DirichletFluxComputeKernel( integer const numPhases,
114  globalIndex const rankOffset,
115  FaceManager const & faceManager,
116  BoundaryStencilWrapper const & stencilWrapper,
117  FLUIDWRAPPER const & fluidWrapper,
118  DofNumberAccessor const & dofNumberAccessor,
119  CompFlowAccessors const & compFlowAccessors,
120  MultiFluidAccessors const & multiFluidAccessors,
121  CapPressureAccessors const & capPressureAccessors,
122  PermeabilityAccessors const & permeabilityAccessors,
123  real64 const dt,
124  CRSMatrixView< real64, globalIndex const > const & localMatrix,
125  arrayView1d< real64 > const & localRhs,
126  BitFlags< KernelFlags > kernelFlags );
127 
133  {
134 public:
135 
143  localIndex GEOS_UNUSED_PARAM( numElems )) {}
144 
145  // Transmissibility
146  real64 transmissibility = 0.0;
147 
148  // Component fluxes and derivatives
149 
156 
157  // Local degrees of freedom and local residual/jacobian
158 
161 
166  };
167 
172  void launchKernel( localIndex const numConnections );
173 
180  void setup( localIndex const iconn,
181  StackVariables & stack ) const;
182 
190  template< typename FUNC = NoOpFunc >
192  void computeFlux( localIndex const iconn,
193  StackVariables & stack,
194  FUNC && compFluxKernelOp = NoOpFunc{} ) const;
195 
201  template< typename FUNC = NoOpFunc >
203  void complete( localIndex const iconn,
204  StackVariables & stack,
205  FUNC && assemblyKernelOp = NoOpFunc{} ) const;
206 
207 protected:
208 
211  arrayView1d< real64 const > const m_faceTemp;
213 
216 
218  FLUIDWRAPPER const m_fluidWrapper;
219 };
220 
221 
225 template< typename POLICY >
227 {
228 public:
229 
246  static void
247  createAndLaunch( integer const numComps,
248  integer const numPhases,
249  globalIndex const rankOffset,
250  BitFlags< KernelFlags > kernelFlags,
251  string const & dofKey,
252  string const & solverName,
253  FaceManager const & faceManager,
254  ElementRegionManager const & elemManager,
255  BoundaryStencilWrapper const & stencilWrapper,
256  constitutive::MultiFluidBase & fluidBase,
257  real64 const dt,
258  CRSMatrixView< real64, globalIndex const > const & localMatrix,
259  arrayView1d< real64 > const & localRhs );
260 };
261 
262 } // namespace isothermalCompositionalMultiphaseFVMKernels
263 
264 } // namespace geos
265 
266 
267 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_DIRICHLETFLUXCOMPUTEKERNEL_HPP
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
Definition: GeosxMacros.hpp:97
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
typename ElementViewAccessor< VIEWTYPE >::NestedViewTypeConst ElementViewConst
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:44
A struct to automatically construct and store element view accessors.
A struct to automatically construct and store element view accessors.
static void createAndLaunch(integer const numComps, integer const numPhases, globalIndex const rankOffset, BitFlags< KernelFlags > kernelFlags, string const &dofKey, string const &solverName, FaceManager const &faceManager, ElementRegionManager const &elemManager, BoundaryStencilWrapper const &stencilWrapper, constitutive::MultiFluidBase &fluidBase, real64 const dt, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Create a new kernel and launch.
Define the interface for the assembly kernel in charge of Dirichlet face flux terms.
ElementRegionManager::ElementViewConst< VIEWTYPE > ElementViewConst
The type for element-based data. Consists entirely of ArrayView's.
GEOS_HOST_DEVICE void computeFlux(localIndex const iconn, StackVariables &stack, FUNC &&compFluxKernelOp=NoOpFunc{}) const
Compute the local Dirichlet face flux contributions to the residual and Jacobian.
arrayView1d< real64 const > const m_faceGravCoef
View on the face gravity coefficient.
GEOS_HOST_DEVICE void complete(localIndex const iconn, StackVariables &stack, FUNC &&assemblyKernelOp=NoOpFunc{}) const
Performs the complete phase for the kernel.
DirichletFluxComputeKernel(integer const numPhases, globalIndex const rankOffset, FaceManager const &faceManager, BoundaryStencilWrapper const &stencilWrapper, FLUIDWRAPPER const &fluidWrapper, DofNumberAccessor const &dofNumberAccessor, CompFlowAccessors const &compFlowAccessors, MultiFluidAccessors const &multiFluidAccessors, CapPressureAccessors const &capPressureAccessors, PermeabilityAccessors const &permeabilityAccessors, real64 const dt, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs, BitFlags< KernelFlags > kernelFlags)
Constructor for the kernel interface.
void launchKernel(localIndex const numConnections)
Launch the kernel for a given number of connections.
arrayView1d< real64 const > const m_facePres
Views on face pressure, temperature, and composition.
GEOS_HOST_DEVICE void setup(localIndex const iconn, StackVariables &stack) const
Performs the setup phase for the kernel.
Base class for FluxComputeKernel that holds all data not dependent on template parameters (like stenc...
ElementViewConst< arrayView1d< globalIndex const > > const m_dofNumber
Views on dof numbers.
ElementViewConst< arrayView1d< real64 const > > const m_pres
Views on pressure.
ElementViewConst< arrayView1d< integer const > > const m_ghostRank
Views on ghost rank numbers and gravity coefficients.
ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const m_phaseCompFrac
Views on phase component fractions.
CRSMatrixView< real64, globalIndex const > const m_localMatrix
View on the local CRS matrix.
ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const m_dCompFrac_dCompDens
Views on derivatives of comp fractions.
Define the interface for the assembly kernel in charge of flux terms.
static constexpr integer numEqn
Compute time value for the number of equations (all of them, except the volume balance equation)
ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const m_phaseMassDens
Views on phase mass densities.
ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const m_phaseMob
Views on phase mobilities.
static constexpr integer numDof
Compute time value for the number of degrees of freedom.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:87
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:309
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Kernel variables (dof numbers, jacobian and residual) located on the stack.
Kernel variables (dof numbers, jacobian and residual) located on the stack.
real64 dCompFlux_dC[numComp][numComp]
Derivatives of component fluxes wrt component densities.
globalIndex dofColIndices[numDof]
Indices of the matrix rows/columns corresponding to the dofs in this face.
GEOS_HOST_DEVICE StackVariables(localIndex const GEOS_UNUSED_PARAM(size), localIndex GEOS_UNUSED_PARAM(numElems))
Constructor for the stack variables.