GEOS
ReactionUpdateKernel.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_SINGLEPHASE_REACTIVE_REACTIONUPDATEKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_REACTIVE_REACTIONUPDATEKERNEL_HPP
22 
23 #include "common/DataTypes.hpp"
24 #include "common/GEOS_RAJA_Interface.hpp"
25 
26 #include "constitutive/fluid/reactivefluid/ReactiveFluidLayouts.hpp"
27 
28 namespace geos
29 {
30 
31 namespace singlePhaseReactiveBaseKernels
32 {
33 
34 /******************************** EquilibriumReactionUpdateKernel ********************************/
35 
37 {
38 
39  template< typename REACTION_WRAPPER_TYPE >
40  static void helper( REACTION_WRAPPER_TYPE const & reactionWrapper,
41  arrayView1d< real64 const > const & pres,
42  arrayView1d< real64 const > const & temp,
43  arrayView2d< real64, compflow::USD_COMP > const logPrimaryConc )
44  {
45  forAll< parallelDevicePolicy<> >( reactionWrapper.numElems(), [=] GEOS_HOST_DEVICE ( localIndex const k )
46  {
47  reactionWrapper.updateEquilibriumReaction( k, pres[k], temp[k], logPrimaryConc[k] );
48  } );
49  }
50 
51  template< typename REACTIVE_FLUID >
52  static void launch( REACTIVE_FLUID const & fluid,
53  arrayView1d< real64 const > const & pres,
54  arrayView1d< real64 const > const & temp,
55  arrayView2d< real64, compflow::USD_COMP > const logPrimaryConc )
56  {
57  std::visit( [&]( auto const & reactionWrapper )
58  {
59  helper( reactionWrapper, pres, temp, logPrimaryConc );
60  }, fluid.createReactionKernelWrapper());
61  }
62 };
63 
64 /******************************** MixedSystemReactionUpdateKernel ********************************/
65 
67 {
68 
69  template< typename REACTION_WRAPPER_TYPE >
70  static void helper( REACTION_WRAPPER_TYPE const & reactionWrapper,
71  arrayView1d< real64 const > const & pres,
72  arrayView1d< real64 const > const & temp,
75  {
76  forAll< parallelDevicePolicy<> >( reactionWrapper.numElems(), [=] GEOS_HOST_DEVICE ( localIndex const k )
77  {
78  reactionWrapper.updateMixedReactionSystem( k, pres[k], temp[k], logPrimaryConc[k], surfaceArea[k] );
79  } );
80  }
81 
82  template< typename REACTIVE_FLUID >
83  static void launch( REACTIVE_FLUID const & fluid,
84  arrayView1d< real64 const > const & pres,
85  arrayView1d< real64 const > const & temp,
88  {
89  std::visit( [&]( auto const & reactionWrapper )
90  {
91  helper( reactionWrapper, pres, temp, logPrimaryConc, surfaceArea );
92  }, fluid.createReactionKernelWrapper());
93  }
94 };
95 
96 } // namespace singlePhaseReactiveBaseKernels
97 
98 } // namespace geos
99 
100 #endif //GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_REACTIVE_FLUIDUPDATEKERNEL_HPP
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195