5from exahype2.solvers.aderdg.ADERDG
import Polynomials
7sys.path.insert(0, os.path.abspath(
"../../applications/exaseis/cartesian"))
10parser = exahype2.ArgumentParser(
"ExaHyPE 2 - ADER-DG Coupled Solvers Testing Script")
14 number_of_snapshots=0,
16args = parser.parse_args()
18order = args.degrees_of_freedom - 1
20if args.build_mode ==
"Debug":
25polynomials =
"legendre"
28offset = [-2.025, 0.0, -2.025]
29size = [12.15, 12.15, 12.15]
31unknowns = {
"v": 3,
"sigma": 6}
32auxiliary_variables = {
"rho":1,
"cp": 1,
"cs": 1}
34max_h = 1.1 * min(size) / (3.0**args.min_depth)
35min_h = max_h * 3.0 ** (-args.amr_levels)
37project = exahype2.Project([
"tests",
"exahype2",
"aderdg"],
".",
38 executable=
"coupled_LOH1" )
40hpSolver=exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
41 name=
"hpElastic", order=order,
42 unknowns=unknowns, auxiliary_variables=auxiliary_variables,
43 min_cell_h=min_h, max_cell_h=max_h, time_step_relaxation=0.9
46hpSolver.add_kernel_optimisations(
50lpSolver=exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
51 name=
"lpElastic", order=order,
52 unknowns=unknowns, auxiliary_variables=auxiliary_variables,
53 min_cell_h=min_h, max_cell_h=max_h, time_step_relaxation=0.9
56lpSolver.add_kernel_optimisations(
61 tracer_particles = project.add_tracer(name=
"Tracer", particle_attributes=12)
63 project.add_action_set_to_initialisation(
64 exahype2.tracer.InsertParticlesByCoordinates(
65 particle_set=tracer_particles,
67 [0.000, 0., 0.693], [0.000, 0., 5.543], [0.000, 0., 10.392],
68 [0.490, 0., 0.490], [3.919, 0., 3.919], [7.348, 0., 7.3480],
69 [0.577, 0., 0.384], [4.612, 0., 3.075], [8.647, 0., 5.7640]
74 project.add_action_set_to_timestepping(
75 peano4.toolbox.particles.api.UpdateParallelState(particle_set=tracer_particles)
78 if not os.path.exists(
"tracers"):
79 os.makedirs(
"tracers")
82from fuseADERSolvers
import fuseADERSolvers
83fuseADERSolvers(hpSolver, lpSolver,
"""
84 ( marker.getX()[0] < DomainOffset[0] + 9.1*marker.getH()[0] and
85 marker.getX()[1] < 8.1*marker.getH()[1] and
86 marker.getX()[2] < DomainOffset[2] + 11.1*marker.getH()[2])
88 ( marker.getX()[0] > DomainOffset[0] + 8.9*marker.getH()[0] or
89 marker.getX()[1] > 7.9*marker.getH()[1] or
90 marker.getX()[2] > DomainOffset[2] + 10.9*marker.getH()[2])
95for theSolver
in [hpSolver, lpSolver]:
97 theSolver.set_implementation(
104 number_of_point_sources = 1,
109 theSolver.add_kernel_optimisations(
110 is_linear=
True, polynomials=(Polynomials.Gauss_Lobatto
if polynomials==
"lobatto" else Polynomials.Gauss_Legendre)
113 theSolver.add_user_solver_includes(
"""
114 #include "../../applications/exaseis/ExaSeis_core/Numerics/cartesianRoutines.h"
115 #include "../../applications/exaseis/ExaSeis_core/Numerics/riemannsolverIsotropic.h"
118 project.add_solver(theSolver)
121 project.add_action_set_to_timestepping(
122 exahype2.tracer.DiscontinuousGalerkinTracing(
123 tracer_particles, theSolver,
124 project_on_tracer_properties_kernel=
"::exahype2::dg::projectAllValuesOntoParticle"
128 project.add_action_set_to_timestepping(
129 exahype2.tracer.DumpTracerIntoDatabase(
130 particle_set=tracer_particles, solver=theSolver,
131 filename=
"tracers/Cartesian_l"+str(args.min_depth)+
"_o"+str(order)+
"_"+polynomials+theSolver.get_name_of_global_instance(),
132 data_delta_between_two_snapsots=1e16, time_delta_between_two_snapsots=0.01,
133 output_precision=10, clear_database_after_flush=
False
137 theSolver._abstract_solver_user_declarations +=
"double QuadraturePoints1d[Order+1];"
138 theSolver._start_simulation_implementation +=
"""
140 kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes,
163if args.number_of_snapshots <= 0:
164 time_in_between_plots = 0.0
166 time_in_between_plots = end_time / args.number_of_snapshots
167 project.set_output_path(args.output)
169project.set_global_simulation_parameters(
171 offset = offset[0:3],
173 min_end_time = end_time,
174 first_plot_time_stamp = 0.0,
175 time_in_between_plots = time_in_between_plots,
178project.set_load_balancer(
"new ::exahype2::LoadBalancingConfiguration()")
179project.set_build_mode(mode=peano4.output.string_to_mode(args.build_mode))
180peano4_project = project.generate_Peano4_project(
"False")
181peano4_project.build(make_clean_first=
True)