Peano
Loading...
Searching...
No Matches
tpv5-2d.py
Go to the documentation of this file.
1import peano4, exahype2
2
3project = exahype2.Project(["exahype2", "elastic"], "pml", executable="TPV5_2D")
4
5unknowns = {"v": 2, "sigma": 3, "u": 2}
6auxiliary_variables = {
7 "rho": 1, "cp": 1, "cs": 1,
8 "jacobian": 1, "metric_derivative": 4,
9 "curve_grid": 2,
10}
11
12offset = [0.0, 0.0]
13size = [40., 40.]
14end_time = 5.0 # 10.0
15order = 5
16min_level = 3
17max_depth = 2
18max_h = 1.1 * min(size) / (3.0**min_level)
19min_h = max_h / (3.0**max_depth)
20
21
22theSolver = exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
23 name="ElasticSolver",
24 order=order,
25 unknowns=unknowns,
26 auxiliary_variables=auxiliary_variables,
27 min_cell_h=min_h,
28 max_cell_h=max_h,
29 time_step_relaxation=0.9,
30 refinement_criterion=exahype2.solvers.PDETerms.User_Defined_Implementation,
31 flux=exahype2.solvers.PDETerms.User_Defined_Implementation,
32 ncp=exahype2.solvers.PDETerms.User_Defined_Implementation,
33 source_term=exahype2.solvers.PDETerms.User_Defined_Implementation,
34 material_parameters=exahype2.solvers.PDETerms.User_Defined_Implementation,
35 # point_source=1,
36)
37
38theSolver.add_kernel_optimisations(
39 is_linear=True,
40 # polynomials=exahype2.solvers.aderdg.ADERDG.Polynomials.Gauss_Lobatto,
41 riemann_solver_implementation=exahype2.solvers.PDETerms.User_Defined_Implementation
42)
43
44project.add_solver(theSolver)
45project.set_output_path("solutions")
46
47tracer_particles = project.add_tracer(name="Tracer", attribute_count=17)
48
49project.add_action_set_to_initialisation(
50 exahype2.tracer.InsertParticlesByCoordinates(
51 particle_set=tracer_particles,
52 coordinates=[
53 [19.2593, 0], #on fault at surface
54 [19.2593, 2.5],
55 [19.2593, 4.5],
56 [19.2593, 6.5],
57 [19.2593, 7.5], #on fault hypocenter
58 [19.2593, 8.5],
59 [19.2593, 10.5],
60 [19.2593, 12.5],
61 [19.2593, 14.5]
62 ],
63 )
64)
65
66project.add_action_set_to_timestepping(
67 peano4.toolbox.particles.api.UpdateParallelState(particle_set=tracer_particles)
68)
69
70project.add_action_set_to_timestepping(
71 exahype2.tracer.DiscontinuousGalerkinTracing(
72 tracer_particles, theSolver,
73 project_on_tracer_properties_kernel="::exahype2::dg::projectAllValuesOntoParticle"
74 )
75)
76
77project.add_action_set_to_timestepping(
78 exahype2.tracer.DumpTracerIntoDatabase(
79 particle_set=tracer_particles, solver=theSolver,
80 filename="tracer-TPV5-"+str(min_level)+"-o-"+str(order),
81 data_delta_between_two_snapsots=1e16, time_delta_between_two_snapsots=0.01,
82 output_precision=10, clear_database_after_flush=False
83 )
84)
85
86project.set_global_simulation_parameters(
87 dimensions=2,
88 offset=offset,
89 size=size,
90 min_end_time=end_time,
91 max_end_time=end_time,
92 first_plot_time_stamp=0.0,
93 time_in_between_plots=0.1,
94 periodic_BC=[False, False, False],
95)
96
97project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration()")
98project.set_Peano4_installation( "../../../../", peano4.output.CompileMode.Release )
99peano4_project = project.generate_Peano4_project(verbose=False)
100peano4_project.build(make_clean_first=True, number_of_parallel_builds=32)