Peano
HHS1.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
3 from .Scenario import Scenario
4 
5 import os
6 
7 class HHS1(Scenario):
8  """
9  Part of a series of benchmarks by the SeISmic MOdeling Web INterfacE (Sismowine)
10 
11  Single point-source in a homogeneous medium.
12  Purpose: Assess the precision of modeling a planar free surface
13 
14  The description of the scenario can be found at: https://sismowine.org/model/WP1_HHS1.pdf
15  """
16 
17  domain_offset = [-2.025, 0.0, -2.025]
18  domain_size = [12.15, 12.15, 12.15]
19 
20  end_time = 10.0
21 
22  tracer_coordinates = [
23  [0.000, 0., 0.693], [0.000, 0., 5.543], [0.000, 0., 10.392],
24  [0.490, 0., 0.490], [3.919, 0., 3.919], [7.348, 0., 7.3480],
25  [0.577, 0., 0.384], [4.612, 0., 3.075], [8.647, 0., 5.7640]
26  ]
27 
28  def initial_conditions(self):
29  return """
30  Q[Shortcuts::rho] = 2.7;
31  Q[Shortcuts::cp ] = 6.0;
32  Q[Shortcuts::cs ] = 3.464;
33 """
34 
35  def point_source():
36  return """
37  std::fill_n(forceVector, 9, 0.);
38 
39  auto jacobian = Q[Shortcuts::jacobian];
40 
41  assertion2(n == 0, "Only a single pointSource for HHS1",n);
42 
43  constexpr double t0 = 0.1;
44  constexpr double M0 = 1000.0;
45 
46  double f = M0*t/(t0*t0)*std::exp(-t/t0);
47 
48  forceVector[Shortcuts::sigma + 4] = f;
49 
50  for (int i = 0; i < NumberOfUnknowns; i++) {
51  forceVector[i] = forceVector[i] / jacobian;
52  }
53 """
55  return """
56  pointSourceLocation[0][0] = 0.0;
57  pointSourceLocation[0][1] = 2.0;
58  pointSourceLocation[0][2] = 0.0;
59 
60  context->correctPointSourceLocation(pointSourceLocation);
61 """
62 
63  def generate_required_files(self, order):
64 
65  dictionary = { "MODE": order+1 }
66  self.generate_file_from_templategenerate_file_from_template(
67 
68  os.path.dirname(os.path.realpath(__file__))+"/LOH1/loh1.yaml.template",
69  "hhs1.yaml", dictionary
70  )
71 
72  return
Part of a series of benchmarks by the SeISmic MOdeling Web INterfacE (Sismowine)
Definition: HHS1.py:7
def initial_conditions(self)
Definition: HHS1.py:28
def point_source()
Definition: HHS1.py:35
def generate_required_files(self, order)
Definition: HHS1.py:63
def init_point_source()
Definition: HHS1.py:54
def generate_file_from_template(self, template_file, full_qualified_filename, dictionary)
Definition: Scenario.py:21