GEOS
AdaptiveInnerProduct.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_FINITEVOLUME_MIMETICINNERPRODUCTS_ADAPTIVEINNERPRODUCT_HPP_
21 #define GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_ADAPTIVEINNERPRODUCT_HPP_
22 
24 
25 namespace geos
26 {
27 namespace mimeticInnerProduct
28 {
29 
47 template< typename MFD_IP >
49 {
62  template< localIndex NF >
64  static void
66  ArrayOfArraysView< localIndex const > const & faceToNodes,
67  arraySlice1d< localIndex const > const & elemToFaces,
68  arraySlice1d< real64 const > const & elemCenter,
69  real64 const & elemVolume,
70  real64 const (&elemPerm)[ 3 ],
71  real64 const & lengthTolerance,
72  real64 const & weight,
73  arraySlice2d< real64 > const & M )
74  {
75  stackArray2d< real64, NF *NF > mfdMassMatrix( NF, NF );
76  stackArray2d< real64, NF *NF > tpfaMassMatrix( NF, NF );
77 
78  MFD_IP::template computeM< NF >( nodePosition,
79  faceToNodes,
80  elemToFaces,
81  elemCenter,
82  elemVolume,
83  elemPerm,
84  lengthTolerance,
85  mfdMassMatrix );
86 
87  TPFAInnerProduct::computeM< NF >( nodePosition,
88  faceToNodes,
89  elemToFaces,
90  elemCenter,
91  elemVolume,
92  elemPerm,
93  lengthTolerance,
94  tpfaMassMatrix );
95 
96  for( localIndex i = 0; i < NF; ++i )
97  {
98  for( localIndex j = 0; j < NF; ++j )
99  {
100  M[i][j] = weight * mfdMassMatrix( i, j ) + ( 1.0 - weight ) * tpfaMassMatrix( i, j );
101  }
102  }
103  }
104 };
105 
106 } // end namespace mimeticInnerProduct
107 
108 } // end namespace geos
109 
110 #endif //GEOS_FINITEVOLUME_MIMETICINNERPRODUCTS_ADAPTIVEINNERPRODUCT_HPP_
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
StackArray< T, 2, MAXSIZE > stackArray2d
Alias for 2D stack array.
Definition: DataTypes.hpp:203
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
Definition: DataTypes.hpp:285
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
Definition: DataTypes.hpp:199
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
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
Definition: DataTypes.hpp:183
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
Adaptive mixed-form inner product blending the MFD mass matrix of MFD_IP with the diagonal TPFA mass ...
static GEOS_HOST_DEVICE void computeM(arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const &nodePosition, ArrayOfArraysView< localIndex const > const &faceToNodes, arraySlice1d< localIndex const > const &elemToFaces, arraySlice1d< real64 const > const &elemCenter, real64 const &elemVolume, real64 const (&elemPerm)[3], real64 const &lengthTolerance, real64 const &weight, arraySlice2d< real64 > const &M)
Compute the blended mixed-form mass matrix M_adapt in a given element.