Peano
dynamic-rupture.py
Go to the documentation of this file.
1 import os, sys, peano4, exahype2
2 
3 from exahype2.solvers.aderdg.ADERDG import Polynomials
4 
5 sys.path.insert(0, os.path.abspath("../pml"))
6 
7 import PMLElastic
8 import DynamicRuptureElastic
9 
10 #sys.path.insert(0, os.path.abspath("../ExaSeis_core/Scenario"))
11 #import TPV5, TPV26, TPV28, TPV29
12 
13 sys.path.insert(0, os.path.abspath("../ExaSeis_core"))
14 import Scenario
15 
16 
17 available_scenarios = {
18  "TPV5": Scenario.TPV5(),
19  "TPV26": Scenario.TPV26(),
20  "TPV28": Scenario.TPV28(),
21  "TPV29": Scenario.TPV29()
22 }
23 
24 
25 scenario = "TPV5"
26 scenario_string = scenario.lower()
27 my_scenario = available_scenarios[scenario]
28 
29 unknowns = {"v": 3, "sigma": 6, "u": 3}
30 auxiliary_variables = {
31  "rho": 1, "cp": 1, "cs": 1, "jacobian": 1,
32  "metric_derivative": 9,
33  "curve_grid": 3,
34 }
35 
36 offset = my_scenario.domain_offset
37 size = my_scenario.domain_size
38 
39 plot_dt = 0.0
40 end_time = my_scenario.end_time
41 
42 order = 5
43 min_level = 3
44 max_depth = 0
45 max_h = 1.1 * min(size) / (3.0**min_level)
46 min_h = max_h / (3.0**max_depth)
47 
48 precision = "fp32"
49 
50 my_scenario.generate_required_files(order)
51 
52 theSolver = exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
53  name="ElasticSolver",
54  order=order,
55  unknowns=unknowns,
56  auxiliary_variables=auxiliary_variables,
57  min_cell_h=min_h,
58  max_cell_h=max_h,
59  time_step_relaxation=0.9
60 )
61 
62 theSolver.add_kernel_optimisations(
63  is_linear=True,
64  polynomials=Polynomials.Gauss_Lobatto,
65  initialise_patches=True,
66  precision=precision
67 )
68 
69 theSolver.set_implementation(
70  initial_conditions = DynamicRuptureElastic.initial(my_scenario.initial_conditions()), #same as curvi, which still need to be templated for initial conditions
71  boundary_conditions = PMLElastic.boundary(),
72  max_eigenvalue = PMLElastic.eigenvalue(),
73  flux = DynamicRuptureElastic.flux(), #same as curvi
74  ncp = DynamicRuptureElastic.ncp(), # same as curvi
75  material_parameters = DynamicRuptureElastic.multiplyMaterialParameterMatrix(), #same as curvi +u term
78 )
79 
80 theSolver._finish_time_step_implementation += DynamicRuptureElastic.finish_time_step_implementation(scenario_string)
81 theSolver._abstract_solver_user_declarations += DynamicRuptureElastic.abstractDeclarations()
82 theSolver._abstract_solver_user_definitions += DynamicRuptureElastic.abstractUserDefinitions()
83 theSolver._start_grid_initialisation_implementation += DynamicRuptureElastic.init_grid_step_implementation(scenario_string)
84 theSolver._destructor_implementation += DynamicRuptureElastic.abstractDestructor()
85 theSolver.add_user_solver_includes(DynamicRuptureElastic.userIncludes())
86 
87 filename=scenario+"_l_"+str(min_level)+"_o_"+str(order)+"_pr_"+str(precision)
88 project = exahype2.Project(["exahype2", "elastic"], "dynamicRupture", executable=filename)
89 project.add_solver(theSolver)
90 
91 project.add_action_set_to_timestepping(
92  exahype2.tracer.NewDGTracer(
93  coordinates= my_scenario.tracer_coordinates,
94  solver=theSolver,
95  filename=filename,
96  data_delta_between_two_snapshots=1e16, time_delta_between_two_snapshots=0.01,
97  output_precision=10, clear_database_after_flush=False
98 ))
99 
100 if plot_dt > 0.0:
101  project.set_output_path("solutions"+filename)
102 
103 project.set_global_simulation_parameters(
104  dimensions=3,
105  offset=offset,
106  size=size,
107  min_end_time=end_time,
108  max_end_time=end_time,
109  first_plot_time_stamp=0.0,
110  time_in_between_plots = plot_dt,
111  periodic_BC=[False, False, False]
112 )
113 
114 project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration")
115 project.set_Peano4_installation( "../../../../", peano4.output.CompileMode.Release )
116 peano4_project = project.generate_Peano4_project(verbose=False)
117 peano4_project.build(make_clean_first=True)
Part of a series of benchmarks by the Statewide California Earthquake Center (SCEC)
Definition: TPV26.py:7
Part of a series of benchmarks by the Statewide California Earthquake Center (SCEC)
Definition: TPV28.py:7
Part of a series of benchmarks by the Statewide California Earthquake Center (SCEC)
Definition: TPV29.py:7
Part of a series of benchmarks by the Statewide California Earthquake Center (SCEC)
Definition: TPV5.py:7
def finish_time_step_implementation(scenario_string)
def initial(pointwise_initial_conditions)
def init_grid_step_implementation(scenario_string)
def boundary()
Definition: PMLElastic.py:92
def eigenvalue()
Definition: PMLElastic.py:99
static double min(double const x, double const y)
str
Definition: ccz4.py:55