Peano
Loading...
Searching...
No Matches
PML_Loh1.py
Go to the documentation of this file.
2import exahype2
3import os
4
5import exahype2.solvers.aderdg
6from exahype2.solvers.aderdg.GlobalAdaptiveTimeStep import (
7 GlobalAdaptiveTimeStep,
8)
9from exahype2.solvers.aderdg.ADERDG import Polynomials
10
11project = exahype2.Project(["exahype2", "elastic"], "pml", executable="LOH1")
12
13
14unknowns = {"v": 3, "sigma": 6, "pml": 27}
15auxiliary_variables = {
16 "rho": 1, "cp": 1, "cs": 1,
17 "dmp_pml": 3, "jacobian": 1,
18 "metric_derivative": 9,
19 "curve_grid": 3,
20}
21
22offset = [-2.28662, 0.0, -2.28662]
23size = [16.3333, 16.3333, 16.3333]
24end_time = 1.0 # 10.0
25order = 5
26min_level = 2
27max_depth = 0
28max_h = 1.1 * min(size) / (3.0**min_level)
29min_h = max_h / (3.0**max_depth)
30
31
32theSolver = GlobalAdaptiveTimeStep(
33 name="ElasticSolver",
34 order=order,
35 unknowns=unknowns,
36 auxiliary_variables=auxiliary_variables,
37 min_cell_h=min_h,
38 max_cell_h=max_h,
39 time_step_relaxation=0.9,
40 refinement_criterion=exahype2.solvers.PDETerms.User_Defined_Implementation,
41 flux=exahype2.solvers.PDETerms.User_Defined_Implementation,
42 ncp=exahype2.solvers.PDETerms.User_Defined_Implementation,
43 source_term=exahype2.solvers.PDETerms.User_Defined_Implementation,
44 material_parameters=exahype2.solvers.PDETerms.User_Defined_Implementation,
45 point_source=1,
46)
47
48theSolver.add_kernel_optimisations(
49 is_linear=True,
50 architecture="noarch",
51 polynomials=Polynomials.Gauss_Lobatto,
52 initialise_patches=True,
53 riemann_solver_implementation=exahype2.solvers.PDETerms.User_Defined_Implementation,
54)
55
56project.add_solver(theSolver)
57
58
59tracer_particles = project.add_tracer(name="Tracer", attribute_count=55)
60
61project.add_action_set_to_initialisation(
62 exahype2.tracer.InsertParticlesByCoordinates(
63 particle_set=tracer_particles,
64 coordinates=[
65 [0.000, 0., 0.693], [0.000, 0., 5.543], [0.000, 0., 10.392],
66 [0.490, 0., 0.490], [3.919, 0., 3.919], [7.348, 0., 7.3480],
67 [0.577, 0., 0.384], [4.612, 0., 3.075], [8.647, 0., 5.7640]
68 ],
69 )
70)
71
72project.add_action_set_to_timestepping(
73 peano4.api.toolbox.particles.api.UpdateParallelState(particle_set=tracer_particles)
74)
75
76project.add_action_set_to_timestepping(
77 exahype2.tracer.DiscontinuousGalerkinTracing(
78 tracer_particles, theSolver,
79 project_on_tracer_properties_kernel="::exahype2::dg::projectAllValuesOntoParticle"
80 )
81)
82
83project.add_action_set_to_timestepping(
84 exahype2.tracer.DumpTracerIntoDatabase(
85 particle_set=tracer_particles, solver=theSolver,
86 filename="tracer-PML-d-"+str(min_level)+"-o-"+str(order),
87 data_delta_between_two_snapsots=1e16, time_delta_between_two_snapsots=0.000001,
88 output_precision=10, clear_database_after_flush=False
89 )
90)
91
92project.set_global_simulation_parameters(
93 dimensions=3,
94 offset=offset,
95 size=size,
96 min_end_time=end_time,
97 max_end_time=end_time,
98 first_plot_time_stamp=0.0,
99 time_in_between_plots=0.000,
100 periodic_BC=[False, False, False],
101)
102
103
104#
105# So here's the parallel stuff. This is new compared to the serial
106# prototype we did start off with.
107#
108project.set_load_balancing( "toolbox::loadbalancing::strategies::SpreadOutOnceGridStagnates", "new ::exahype2::LoadBalancingConfiguration()" )
109project.set_Peano4_installation( "../../../../", peano4.api.output.CompileMode.RELEASE )
110peano4_project = project.generate_Peano4_project("False")
111
112peano4_project.output.makefile.set_CXX_compiler("mpicxx")
113peano4_project.output.makefile.add_CXX_flag("-fopenmp -DUSE_ASAGI")
114peano4_project.output.makefile.add_library(
115 "-fopenmp -lcurvi -leasi -lyaml-cpp -limpalajit -lasagi -lnetcdf -lnuma -lmpi -DUSE_ASAGI"
116)
117
118peano4_project.build(make_clean_first=True, number_of_parallel_builds=32)
Update the parallel state of particles and keep stats of them.