GEOS
AcousticWaveEquationDG.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOS Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
15 
20 #ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICWAVEEQUATIONDG_HPP_
21 #define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICWAVEEQUATIONDG_HPP_
22 
23 #include "mesh/MeshFields.hpp"
28 
29 namespace geos
30 {
31 
33 {
34 public:
35 
36  using EXEC_POLICY = parallelDevicePolicy< 32 >;
37  using ATOMIC_POLICY = AtomicPolicy< EXEC_POLICY >;
38 
39  AcousticWaveEquationDG( const std::string & name,
40  Group * const parent );
41 
42  virtual ~AcousticWaveEquationDG() override;
43 
44  AcousticWaveEquationDG() = delete;
47 
48  AcousticWaveEquationDG & operator=( AcousticWaveEquationDG const & ) = delete;
49  AcousticWaveEquationDG & operator=( AcousticWaveEquationDG && ) = delete;
50 
51 
52  static string catalogName() { return "AcousticDG"; }
53 
54  string getCatalogName() const override { return catalogName(); }
55 
56  virtual void initializePreSubGroups() override;
57 
58  virtual void registerDataOnMesh( Group & meshBodies ) override final;
59 
60 
67  virtual real64 explicitStepForward( real64 const & time_n,
68  real64 const & dt,
69  integer const cycleNumber,
70  DomainPartition & domain,
71  integer const computeGradient ) override;
72 
73  virtual real64 explicitStepBackward( real64 const & time_n,
74  real64 const & dt,
75  integer const cycleNumber,
76  DomainPartition & domain,
77  integer const computeGradient ) override;
78 
79 
80 
86  virtual real32 getGlobalMinWavespeed( MeshLevel & mesh, string_array const & regionNames ) override;
87 
88 
92  virtual void initializePML() override;
93 
96  virtual real64 computeTimeStep( real64 & dtOut ) override;
97 
101  virtual void cleanup( real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition & domain ) override;
102 
104  {
105  static constexpr char const * pressureNp1AtReceiversString() { return "pressureNp1AtReceivers"; }
106 
107  static constexpr char const * sourceElemString() { return "sourceElem"; }
108  static constexpr char const * sourceRegionString() { return "sourceRegion"; }
109  static constexpr char const * receiverElemString() { return "receiverElem"; }
110 
111  } waveEquationViewKeys;
112 
113 
123  real64 const & dt,
124  integer const cycleNumber,
125  DomainPartition & domain );
126 
127  void computeUnknowns( real64 const & time_n,
128  real64 const & dt,
129  DomainPartition & domain,
130  MeshLevel & mesh,
131  string_array const & regionNames );
132 
133  void synchronizeUnknowns( real64 const & time_n,
134  real64 const & dt,
135  DomainPartition & domain,
136  MeshLevel & mesh,
137  string_array const & regionNames );
138 
139  void prepareNextTimestep( MeshLevel & mesh );
140 
141  void updatePressure( localIndex const size, localIndex const numNodesPerElem, arrayView2d< real32 > const p_nm1, arrayView2d< real32 > const p_n, arrayView2d< real32 > p_np1 );
142 
143 protected:
144 
145  virtual void postInputInitialization() override final;
146 
147  //Nothing to do inside ? (no global mass or damping)
148  virtual void initializePostInitialConditionsPreSubGroups() override final;
149 
150 private:
151 
157  virtual void precomputeSourceAndReceiverTerm( MeshLevel & baseMesh, MeshLevel & mesh, string_array const & regionNames ) override;
158 
164  virtual void applyFreeSurfaceBC( real64 const time, DomainPartition & domain ) override;
165 
171  virtual void applyPML( real64 const time, DomainPartition & domain ) override;
172 
174  array2d< real32 > m_pressureNp1AtReceivers;
175 
177  array1d< localIndex > m_sourceElem;
178 
180  array1d< localIndex > m_sourceRegion;
181 
183  ArrayOfArrays< array2d< real64 > > m_referenceInvMassMatrix;
184 
186  ArrayOfArrays< array3d< real64 > > m_boundaryInvMassPlusDamping;
187 
188 };
189 
190 } /* namespace geos */
191 
192 #endif /* GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICWAVEEQUATIONDG_HPP_ */
string getCatalogName() const override
virtual void initializePreSubGroups() override
Called by Initialize() prior to initializing sub-Groups.
virtual void registerDataOnMesh(Group &meshBodies) override final
Register wrappers that contain data on the mesh objects.
virtual void postInputInitialization() override final
virtual void initializePML() override
Initialize Perfectly Matched Layer (PML) information.
virtual real32 getGlobalMinWavespeed(MeshLevel &mesh, string_array const &regionNames) override
Get the minimum wavespeed on a mesh.
virtual void initializePostInitialConditionsPreSubGroups() override final
Called by InitializePostInitialConditions() prior to initializing sub-Groups.
virtual void cleanup(real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Overridden from ExecutableGroup. Used to write last seismogram if needed.
real64 explicitStepInternal(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain)
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1317
virtual real64 explicitStepBackward(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain, integer const computeGradient) override
Perform backward explicit step.
virtual real64 explicitStepForward(real64 const &time_n, real64 const &dt, integer const cycleNumber, DomainPartition &domain, integer const computeGradient) override
Perform forward explicit step.
stdVector< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:361
float real32
32-bit floating point type.
Definition: DataTypes.hpp:96
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:191
Array< T, 3, PERMUTATION > array3d
Alias for 3D array.
Definition: DataTypes.hpp:207
std::string string
String type.
Definition: DataTypes.hpp:90
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
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:281