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