Peano
Loading...
Searching...
No Matches
elastic_planar_waves.py
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
3from .scenario import Scenario
4
5import os
6import sys
7
8sys.path.insert(0, os.path.abspath("../equations"))
9from equations import Elastic
10
11
13 """
14 Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006.03120.x (Chapter 5, p. 328)
15 """
16
17 _plot_dt = 0.0
18 _offset = -1.0
19 _domain_size = 2.0
20 _periodic_bc = True
21
22 def __init__(self, dimensions, iterations=2):
23 self._dimensions = dimensions
24 self._end_time = iterations
25 self._equation = Elastic(dimensions)
26
28 return """
29 // Lamé parameters
30 constexpr double mu = 4.0;
31 constexpr double lambda = -4.0;
32
33 // Constant auxiliary parameters
34 constexpr double rho = 1.0;
35 constexpr double cp = 2.0;
36 constexpr double cs = 2.0;
37
38 const double val_x = cos( -std::numbers::pi*x[0]);
39 const double val_y = cos( -std::numbers::pi*x[1]);
40""" + (
41 """
42 const double val_z = cos( -std::numbers::pi*x[2]);
43
44 // Stresses
45 Q[3] = val_x*(lambda+2*mu) + val_y*lambda + val_z*lambda; //xx
46 Q[4] = val_x*lambda + val_y*(lambda+2*mu) + val_z*lambda; //yy
47 Q[5] = val_x*lambda + val_y*lambda + val_z*(lambda+2*mu); //zz
48 Q[6] = val_x*mu; //xy
49 Q[7] = val_z*mu; //xz
50 Q[8] = val_y*mu; //yz
51
52 // Velocities
53 Q[0] = val_x*cp + val_z*cs; //vx
54 Q[1] = val_y*cp + val_x*cs; //vy
55 Q[2] = val_z*cp + val_y*cs; //vz
56
57 // Auxiliary variables
58 Q[9] = rho; //rho
59 Q[10] = cp; //cp
60 Q[11] = cs; //cs
61"""
62 if self._dimensions == 3
63 else """
64 // Stresses
65 Q[2] = val_x*(lambda+2*mu) + val_y*lambda; //xx
66 Q[3] = val_x*lambda + val_y*(lambda+2*mu); //yy
67 Q[4] = val_x*mu + val_y*mu; //xy
68
69 // Velocities
70 Q[0] = val_x*cp + val_y*cs; //vx
71 Q[1] = val_y*cp + val_x*cs; //vy
72
73 // Auxiliary variables
74 Q[5] = rho; //rho
75 Q[6] = cp; //cp
76 Q[7] = cs; //cs
77"""
78 )
79
81 return """
82 // Lamé parameters
83 constexpr double mu = 4.0;
84 constexpr double lambda = -4.0;
85
86 // Constant auxiliary parameters
87 constexpr double rho = 1.0;
88 constexpr double cp = 2.0;
89 constexpr double cs = 2.0;
90
91 constexpr double w = -2*M_PI;
92
93 const double val_x = cos( w*t -std::numbers::pi*x[0]);
94 const double val_y = 0.0;//cos( w*t -std::numbers::pi*x[1]);
95""" + (
96 """
97 const double val_z = cos( -std::numbers::pi*x[2]);
98
99 // Stresses
100 solution[3] = val_x*(lambda+2*mu) + val_y*lambda + val_z*lambda; //xx
101 solution[4] = val_x*lambda + val_y*(lambda+2*mu) + val_z*lambda; //yy
102 solution[5] = val_x*lambda + val_y*lambda + val_z*(lambda+2*mu); //zz
103 solution[6] = val_x*mu; //xy
104 solution[7] = val_z*mu; //xz
105 solution[8] = val_y*mu; //yz
106
107 // Velocities
108 solution[0] = val_x*cp + val_z*cs; //vx
109 solution[1] = val_y*cp + val_x*cs; //vy
110 solution[2] = val_z*cp + val_y*cs; //vz
111"""
112 if self._dimensions == 3
113 else """
114 // Stresses
115 solution[2] = val_x*(lambda+2*mu) + val_y*lambda; //xx
116 solution[3] = val_x*lambda + val_y*(lambda+2*mu); //yy
117 solution[4] = val_x*mu + val_y*mu; //xy
118
119 // Velocities
120 solution[0] = val_x*cp + val_y*cs; //vx
121 solution[1] = val_y*cp + val_x*cs; //vy
122"""
123 )
Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006....