GEOS
surfaceGenerationKernelsHelpers.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 
21 #include "common/DataTypes.hpp"
22 #include "common/TimingMacros.hpp"
23 
24 namespace geos
25 {
26 
27 namespace surfaceGenerationKernelsHelpers
28 {
29 
31 inline void computeNodalForce( real64 const ( &stress) [ 6 ],
32  real64 const ( &dNdX) [ 3 ],
33  real64 const detJ,
34  real64 ( & force ) [ 3 ] )
35 {
36 
37  force[ 0 ] -= ( stress[ 0 ] * dNdX[ 0 ] +
38  stress[ 5 ] * dNdX[ 1 ] +
39  stress[ 4 ] * dNdX[ 2 ] ) * detJ;
40  force[ 1 ] -= ( stress[ 5 ] * dNdX[ 0 ] +
41  stress[ 1 ] * dNdX[ 1 ] +
42  stress[ 3 ] * dNdX[ 2 ] ) * detJ;
43  force[ 2 ] -= ( stress[ 4 ] * dNdX[ 0 ] +
44  stress[ 3 ] * dNdX[ 1 ] +
45  stress[ 2 ] * dNdX[ 2 ] ) * detJ;
46 }
47 
49 inline void scaleNodalForce( real64 const bulkModulus,
50  real64 const shearModulus,
51  real64 ( & force ) [ 3 ] )
52 {
53  real64 const YoungModulus = 9 * bulkModulus * shearModulus / ( 3 * bulkModulus + shearModulus );
54  real64 const poissonRatio = ( 3 * bulkModulus - 2 * shearModulus ) / ( 2 * ( 3 * bulkModulus + shearModulus ) );
55 
56  LvArray::tensorOps::scale< 3 >( force, YoungModulus );
57  LvArray::tensorOps::scale< 3 >( force, 1.0 / (1 - poissonRatio * poissonRatio) );
58 }
59 
60 
61 }
62 
63 }
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99