Peano
Zugspitze.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 
8  """
9  Benchmark representing a rectangular area of 80x80km around the Zugspitze.
10  The scenario has no analytical solution, but the complex topography leads to
11  complicated scattering on the surface, which makes for an interesting benchmark.
12 
13  Mentioned e.g. in "A stable discontinuous Galerkin method for linear elastodynamics in 3D geometrically complex elastic solids using physics based numerical fluxes, Computer Methods in Applied Mechanics and Engineering"
14  by Kenneth Duru, Leonhard Rannabauer, Alice-Agnes Gabriel, On Ki Angel Ling, Heiner Igel, Michael Bader
15  (available at https://doi.org/10.1016/j.cma.2021.114386)
16  """
17 
18  domain_offset = [4358.459, 0.0, 2661.23]
19  domain_size = [80.85, 80.85, 80.85]
20 
21  end_time = 30.0
22 
23  tracer_coordinates = [
24  [4370.0, 0.0, 2675.0], [4395.0, 0.0, 2700.0], [4405.0, 0.0, 2670.0],
25  [4405.0, 0.0, 2710.0], [4375.0, 0.0, 2708.0], [4424.756, 0.0, 2675.783],
26  [4424.756, 11.320, 2675.783]
27  ]
28 
29  def initial_conditions(self):
30  return """
31  Q[Shortcuts::rho] = 2.67;
32  Q[Shortcuts::cp ] = 6.0;
33  Q[Shortcuts::cs ] = 3.464;
34 """
35 
36  #TODO: is this point source correct?
37  #it is in the scenario of ExaHyPE1 but also does not use certain parameters
38  # and is a 1-to-1 copy of LOH1
39  def point_source(self):
40  return """
41  std::fill_n(forceVector, 9, 0.);
42 
43  auto jacobian = Q[Shortcuts::jacobian];
44 
45  assertion2(n == 0, "Only a single pointSource for Zugspitze",n);
46 
47  constexpr double pi = 3.14159265359;
48  constexpr double sigma = 0.1149;
49  constexpr double t0 = 0.1;
50  constexpr double M0 = 1000.0;
51 
52  double f = M0*t/(t0*t0)*std::exp(-t/t0);
53 
54  forceVector[Shortcuts::sigma + 4] = f;
55 
56  for (int i = 0; i < NumberOfUnknowns; i++) {
57  forceVector[i] = forceVector[i] / jacobian;
58  }
59 """
60  def init_point_source(self):
61  return """
62  pointSourceLocation[0][0] = 4424.756;
63  pointSourceLocation[0][1] = 10.0; // or 11.320? ExaHyPE1 has this commented out
64  pointSourceLocation[0][2] = 2675.783;
65 
66  context->correctPointSourceLocation(pointSourceLocation);
67 """
68 
69  def generate_required_files(self, order):
70 
71  dictionary = { "MODE": order+1 }
72  self.generate_file_from_templategenerate_file_from_template(
73  os.path.dirname(os.path.realpath(__file__))+"/specs/Zugspitze/zugspitze.yaml.template",
74  "zugspitze.yaml", dictionary
75  )
76 
77  #using a symlink instead of a copy as the file is quite large
78  try:
79  os.symlink(
80  os.path.dirname(os.path.realpath(__file__))+"/specs/Zugspitze/zugspitze_25m_4345_100_2650_100.nc",
81  "zugspitze_25m_4345_100_2650_100.nc"
82  )
83  except:
84  print("creating symlink failed, assume the file already exists")
85 
86  return
def generate_file_from_template(self, template_file, full_qualified_filename, dictionary)
Definition: Scenario.py:21
Benchmark representing a rectangular area of 80x80km around the Zugspitze.
Definition: Zugspitze.py:7
def generate_required_files(self, order)
Definition: Zugspitze.py:69