Peano
Loading...
Searching...
No Matches
LOH.py
Go to the documentation of this file.
2import peano4.api, exahype2
3import os
4
5from exahype2.solvers.aderdg.ADERDG import Polynomials
6
7from Elastic import flux, eigenvalue, initial, boundary
8
9min_level = 3
10max_depth = 0
11order = 5
12precision = "double"
13e_t = 2.0
14plot_dt = 0.1
15polynomials = "legendre"
16use_tracers = True
17
18size_1d = 9.0 #3.0**min_level
19size = [size_1d, size_1d, size_1d] # thousand meters
20offset = [-size[0]/2., -size[1]/2., 0.0] # thousand meters
21
22unknowns = {"v": 3, "sigma": 6}
23auxiliary_variables = {"rho":1, "cp": 1, "cs": 1}
24
25max_h = 1.1 * min(size) / (3.0**min_level)
26min_h = max_h / (3.0**max_depth)
27
28project = exahype2.Project( ["applications", "exahype2", "elastic"], ".",
29 executable="LOH_level_"+str(min_level)+"_order_"+str(order)+"_"+polynomials+"_precision_"+str(precision) )
30
31theSolver=exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
32 name="elastic", order=order,
33 unknowns=unknowns, auxiliary_variables=auxiliary_variables,
34 min_cell_h=min_h, max_cell_h=max_h, time_step_relaxation=0.9
35)
36
37theSolver.add_kernel_optimisations(
38 is_linear=True, polynomials=(Polynomials.Gauss_Lobatto if polynomials=="lobatto" else Polynomials.Gauss_Legendre)
39 ,solution_persistent_storage_precision=precision
40 ,predictor_computation_precisions=[precision]
41 ,corrector_computation_precision=precision
42)
43
44theSolver.set_implementation(
45 initial_conditions = initial(),
46 boundary_conditions = boundary(),
47 eigenvalues = eigenvalue(),
48 flux = flux(),
49 refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation,
50 point_source = 1
51)
52
53project.add_solver(theSolver)
54
55if use_tracers:
56 tracer_particles = project.add_tracer(name="Tracer", attribute_count=12)
57
58 project.add_action_set_to_initialisation(
59 exahype2.tracer.InsertParticlesByCoordinates(
60 particle_set=tracer_particles,
61 coordinates=[ [0.693, 0.000, 0.000], [7.348, 7.348, 0.000] ]
62 )
63 )
64
65 project.add_action_set_to_timestepping(
66 peano4.api.toolbox.particles.api.UpdateParallelState(particle_set=tracer_particles)
67 )
68
69 project.add_action_set_to_timestepping(
70 exahype2.tracer.DiscontinuousGalerkinTracing(
71 tracer_particles, theSolver,
72 project_on_tracer_properties_kernel="::exahype2::dg::projectAllValuesOntoParticle"
73 )
74 )
75
76 project.add_action_set_to_timestepping(
77 exahype2.tracer.DumpTracerIntoDatabase(
78 particle_set=tracer_particles, solver=theSolver,
79 filename="tracers/Cartesian_level_"+str(min_level)+"_order_"+str(order)+"_"+polynomials+"_precision_"+str(precision),
80 data_delta_between_two_snapsots=1e16, time_delta_between_two_snapsots=0.000001,
81 output_precision=10, clear_database_after_flush=False
82 )
83 )
84
85 if not os.path.exists("tracers"):
86 os.makedirs("tracers")
87
88if plot_dt > 0.0:
89 project.set_output_path("solutions")
90
91project.set_global_simulation_parameters(
92 dimensions = 3,
93 offset = offset[0:3],
94 size = size[0:3],
95 min_end_time = e_t,
96 first_plot_time_stamp = 0.0,
97 time_in_between_plots = plot_dt,
98)
99
100project.set_load_balancing( "toolbox::loadbalancing::strategies::SpreadOutOnceGridStagnates", "new ::exahype2::LoadBalancingConfiguration()" )
101project.set_Peano4_installation( "../../../../", peano4.api.output.CompileMode.RELEASE )
102peano4_project = project.generate_Peano4_project("False")
103peano4_project.output.makefile.add_h_file("elastic.h")
104peano4_project.output.makefile.add_cpp_file("elastic.cpp")
105
106peano4_project.build(make_clean_first=True)
Update the parallel state of particles and keep stats of them.