Peano 4
Loading...
Searching...
No Matches
ElasticWaveKernels.h
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include "Constants.h"
6#include "tarch/Assertions.h"
7#include "tarch/la/Vector.h"
8
10 static inline double maxEigenvalue() InlineMethod { return std::max(std::abs(P_WAVE_SPEED), std::abs(S_WAVE_SPEED)); }
11
12 static inline void flux(const double* __restrict__ Q, int normal, double* __restrict__ F) InlineMethod {
13#ifdef GPUOffloadingOff
14 assertion(normal >= 0);
15 assertion(normal < Dimensions);
16#endif
17
18 static constexpr double Mu = RHO * S_WAVE_SPEED * S_WAVE_SPEED;
19 static constexpr double Lambda = RHO * P_WAVE_SPEED * P_WAVE_SPEED - 2.0 * Mu;
20
21 const double u = Q[0];
22 const double v = Q[1];
23 const double sxx = Q[2];
24 const double syy = Q[3];
25 const double sxy = Q[4];
26
27 switch (normal) {
28 case 0:
29 F[0] = -1.0 / RHO * sxx;
30 F[1] = -1.0 / RHO * sxy;
31 F[2] = -(2.0 * Mu + Lambda) * u;
32 F[3] = -Lambda * u;
33 F[4] = -Mu * v;
34 break;
35 case 1:
36 F[0] = -1.0 / RHO * sxy;
37 F[1] = -1.0 / RHO * syy;
38 F[2] = -Lambda * v;
39 F[3] = -(2.0 * Mu + Lambda) * v;
40 F[4] = -Mu * u;
41 break;
42 }
43 }
44
45 static void sourceTerm(const double* __restrict__ Q, const tarch::la::Vector<Dimensions, double>& x, double t, double* __restrict__ S) InlineMethod {
46 S[0] = 0.0;
47 S[1] = 0.0;
48 S[2] = 0.0;
49 S[3] = 0.0;
50 S[4] = 0.0;
51
52 const bool pointSource = tarch::la::norm2(x - tarch::la::Vector<Dimensions, double>({10, 10})) <= 1.0;
53 if (pointSource) {
54 static constexpr double t0 = 0.1;
55 static constexpr double M0 = 1000.0;
56 const double force = M0 * t / (t0 * t0) * std::exp(-t / t0);
57 S[4] = force;
58 }
59 }
60} // namespace applications::exahype2::elasticwave
#define assertion(expr)
static void sourceTerm(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &x, double t, double *__restrict__ S) InlineMethod
static void flux(const double *__restrict__ Q, int normal, double *__restrict__ F) InlineMethod
static double maxEigenvalue() InlineMethod
Scalar norm2(const Vector< Size, Scalar > &vector)
Computes the 2-norm of the vector, i.e.
Simple vector class.
Definition Vector.h:134
#define InlineMethod
This is the marker that is to be used after the argument list of a function declaration.
Definition tarch.h:58