6parser = exahype2.ArgumentParser(
"ExaHyPE 2 - Finite Differences Testing Script")
10 degrees_of_freedom=16,
12 time_step_relaxation=0.4,
13 periodic_boundary_conditions_x=
False,
14 periodic_boundary_conditions_y=
False,
15 periodic_boundary_conditions_z=
False,
17args = parser.parse_args()
20/****************************************************************************************************************************************
24 * Zhang A, Li Y. Thermal Conductivity of Aluminum Alloys-A Review. Materials (Basel). 2023 Apr 8;16(8):2972. doi: 10.3390/ma16082972. *
25 * https://webbook.nist.gov/cgi/inchi/InChI%3D1S/Al, accessed on 12/09/2025 *
26 ****************************************************************************************************************************************/
29MOLAR_HEAT_CAPACITY = 25.78
30MOLAR_WEIGHT = 0.0269815386
31THERMAL_CONDUCTIVITY = 237
33SPECIFIC_HEAT_CAPACITY = MOLAR_HEAT_CAPACITY / MOLAR_WEIGHT
34THERMAL_DIFFUSIVITY = THERMAL_CONDUCTIVITY / (
35 SPECIFIC_HEAT_CAPACITY * DENSITY
38initial_conditions =
"""
39 Q[Shortcuts::T] = 400; // in K
40 Q[Shortcuts::kappa] = THERMAL_DIFFUSIVITY;
43boundary_conditions =
"""
44 // normal == 0 => left
45 // normal == 1 => bottom
46 // normal == 2 => right
50 Qoutside0[Shortcuts::T] = 300; // in K
51 Qoutside0[Shortcuts::kappa] = Qinside[Shortcuts::kappa];
53 // Insulation everywhere else
54 Qoutside0[Shortcuts::T] = Qinside[Shortcuts::T];
55 Qoutside0[Shortcuts::kappa] = Qinside[Shortcuts::kappa];
62fd_solver = exahype2.solvers.fd.GlobalFixedTimeStep(
64 patch_size=args.degrees_of_freedom,
66 auxiliary_variables={
"kappa": 1},
69 normalised_time_step_size=(
70 args.time_step_relaxation * (min_h) ** 2 / THERMAL_DIFFUSIVITY
75fd_solver.set_implementation(
76 initial_conditions=initial_conditions,
77 boundary_conditions=boundary_conditions,
79 {{COMPUTE_PRECISION}} temperatureLaplacian = 0.0;
81 temperatureLaplacian += (QRight0[Shortcuts::T] - 2.0 * Q[Shortcuts::T] + QLeft0[Shortcuts::T]) / (h(0) * h(0));
83 temperatureLaplacian += (QTop0[Shortcuts::T] - 2.0 * Q[Shortcuts::T] + QDown0[Shortcuts::T]) / (h(1) * h(1));
86 temperatureLaplacian += (QFront0[Shortcuts::T] - 2.0 * Q[Shortcuts::T] + QBack0[Shortcuts::T]) / (h(2) * h(2));
89 QNew[Shortcuts::T] = Q[Shortcuts::T] + dt * Q[Shortcuts::kappa] * temperatureLaplacian;
93project = exahype2.Project(
94 namespace=[
"tests",
"exahype2",
"fd"],
99project.add_solver(fd_solver)
101if args.number_of_snapshots <= 0:
102 time_in_between_plots = 0.0
104 time_in_between_plots = args.end_time / args.number_of_snapshots
105 project.set_output_path(args.output)
107project.set_global_simulation_parameters(
108 dimensions=args.dimensions,
109 size=[0.1, 0.1, 0.1][0 : args.dimensions],
110 offset=[0.0, 0.0, 0.0][0 : args.dimensions],
111 min_end_time=args.end_time,
112 max_end_time=args.end_time,
113 first_plot_time_stamp=0.0,
114 time_in_between_plots=time_in_between_plots,
116 args.periodic_boundary_conditions_x,
117 args.periodic_boundary_conditions_y,
118 args.periodic_boundary_conditions_z,
122project.set_load_balancer(
"new ::exahype2::LoadBalancingConfiguration")
123project.set_Peano4_installation(
124 "../../../", mode=peano4.output.string_to_mode(args.build_mode)
126project = project.generate_Peano4_project(verbose=
False)
127project.output.makefile.add_CXX_flag(f
"""-DTHERMAL_DIFFUSIVITY={THERMAL_DIFFUSIVITY}""")
128project.set_fenv_handler(args.fpe)
129project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)