Peano
Loading...
Searching...
No Matches
LOH1.py
Go to the documentation of this file.
2import peano4, exahype2
3import os, sys
4
5from exahype2.solvers.aderdg.ADERDG import Polynomials
6
7sys.path.insert(0, os.path.abspath("../../../applications/exahype2/exaseis/cartesian"))
8import Elastic
9
10sys.path.insert(0, os.path.abspath("./coupling"))
11from coupling import StaticCoupling
12
13min_level = 3
14max_depth = 0
15order = 5
16
17e_t = 2.0
18plot_dt = 0.0
19polynomials = "legendre"
20use_tracers = True
21
22# size = [ 9.0, 9.0, 9.0] # thousand meters
23# offset = [-4.5, 0., -4.5] # thousand meters
24
25offset = [-2.025, 0.0, -2.025]
26size = [12.15, 12.15, 12.15]
27
28unknowns = {"v": 3, "sigma": 6}
29auxiliary_variables = {"rho":1, "cp": 1, "cs": 1}
30
31max_h = 1.1 * min(size) / (3.0**min_level)
32min_h = max_h / (3.0**max_depth)
33
34project = exahype2.Project( ["applications", "exahype2", "elastic"], ".",
35 executable="LOH_level_"+str(min_level)+"_order_"+str(order)+"_"+polynomials )
36
37hpSolver=exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
38 name="hpElastic", order=order,
39 unknowns=unknowns, auxiliary_variables=auxiliary_variables,
40 min_cell_h=min_h, max_cell_h=max_h, time_step_relaxation=0.9
41)
42
43hpSolver.add_kernel_optimisations(
44 precision = "fp64"
45)
46
47lpSolver=exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
48 name="lpElastic", order=order,
49 unknowns=unknowns, auxiliary_variables=auxiliary_variables,
50 min_cell_h=min_h, max_cell_h=max_h, time_step_relaxation=0.9
51)
52
53lpSolver.add_kernel_optimisations(
54 precision = "fp32"
55)
56
57for theSolver in [hpSolver, lpSolver]:
58
59 theSolver.set_implementation(
60 initial_conditions = Elastic.initial(),
61 boundary_conditions = Elastic.boundary(),
62 max_eigenvalue = Elastic.eigenvalue(),
63 flux = Elastic.flux(),
64 refinement_criterion = Elastic.refinement_criterion(),
65 riemann_solver=Elastic.riemann_solver(),
66 number_of_point_sources = 1,
67 point_source=Elastic.point_source(),
68 init_point_source_location=Elastic.init_point_source()
69 )
70
71 theSolver.add_kernel_optimisations(
72 is_linear=True, polynomials=(Polynomials.Gauss_Lobatto if polynomials=="lobatto" else Polynomials.Gauss_Legendre)
73 )
74
75 theSolver.add_user_solver_includes("""
76 #include "../../../applications/exahype2/exaseis/ExaSeis_core/Numerics/cartesianRoutines.h"
77 #include "../../../applications/exahype2/exaseis/ExaSeis_core/Numerics/riemannsolverIsotropic.h"
78 """)
79
80 project.add_solver(theSolver)
81
82 if use_tracers:
83 project.add_action_set_to_timestepping(
84 exahype2.tracer.NewDGTracer(
85 coordinates=[
86 [0.000, 0., 0.693], [0.000, 0., 5.543], [0.000, 0., 10.392],
87 [0.490, 0., 0.490], [3.919, 0., 3.919], [7.348, 0., 7.3480],
88 [0.577, 0., 0.384], [4.612, 0., 3.075], [8.647, 0., 5.7640]
89 ],
90 solver=theSolver,
91 filename="tracers/Cartesian_level_"+str(min_level)+"_order_"+str(order)+"_"+polynomials+theSolver.get_name_of_global_instance(),
92 data_delta_between_two_snapshots=1e16, time_delta_between_two_snapshots=0.01,
93 output_precision=10, clear_database_after_flush=False
94 ))
95
96 if not os.path.exists("tracers"):
97 os.makedirs("tracers")
98
99 theSolver._abstract_solver_user_declarations += "double QuadraturePoints1d[Order+1];"
100 theSolver._constructor_implementation += """
101 std::copy_n(
102 kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes,
103 (Order+1),
104 QuadraturePoints1d
105 );"""
106
107
108limiter = StaticCoupling(
109 name = "limitingSolver",
110 regularSolver = hpSolver,
111 limitingSolver = lpSolver,
112 limiting_criterion_implementation = """
113 // return
114 return // 9x8x11
115 x[0] > -2.025 && x[0] < 2.025 &&
116 x[1] < 3.600 &&
117 x[2] > -2.025 && x[2] <= 2.925
118 ;
119"""
120)
121project.add_solver(limiter)
122
123if plot_dt > 0.0:
124 project.set_output_path("solutions")
125
126project.set_global_simulation_parameters(
127 dimensions = 3,
128 offset = offset[0:3],
129 size = size[0:3],
130 min_end_time = e_t,
131 first_plot_time_stamp = 0.0,
132 time_in_between_plots = plot_dt,
133)
134
135project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration()")
136project.set_Peano4_installation( "../../../", peano4.output.CompileMode.Release )
137peano4_project = project.generate_Peano4_project("False")
138
139peano4_project.build(make_clean_first=True)
eigenvalue()
Definition Elastic.py:68
riemann_solver()
Definition Elastic.py:156
initial()
Definition Elastic.py:3
boundary()
Definition Elastic.py:32
refinement_criterion()
Definition Elastic.py:116
init_point_source()
Definition Elastic.py:149
point_source()
Definition Elastic.py:137
flux()
Definition Elastic.py:73