Peano
Loading...
Searching...
No Matches
performance_testbed.py
Go to the documentation of this file.
1import os
2import sys
3import argparse
4
5import peano4
6import exahype2
7import peano4.toolbox.particles
8
9sys.path.insert(0, os.path.abspath("../../../../applications/exahype2/ccz4"))
10
11from Probe_file_gene import tracer_seeds_generate
12from ComputeFirstDerivatives import ComputeFirstDerivativesFD4RK
13
14modes = {
15 "release": peano4.output.CompileMode.Release,
16 "trace": peano4.output.CompileMode.Trace,
17 "assert": peano4.output.CompileMode.Asserts,
18 "stats": peano4.output.CompileMode.Stats,
19 "debug": peano4.output.CompileMode.Debug,
20}
21
22floatparams = {
23 "GLMc0": 1.5,
24 "GLMc": 1.2,
25 "GLMd": 2.0,
26 "GLMepsA": 1.0,
27 "GLMepsP": 1.0,
28 "GLMepsD": 1.0,
29 "itau": 1.0,
30 "k1": 0.1,
31 "k2": 0.0,
32 "k3": 0.5,
33 "eta": 1.0,
34 "f": 0.75,
35 "g": 0.0,
36 "xi": 1.0,
37 "e": 1.0,
38 "c": 1.0,
39 "mu": 0.2,
40 "ds": 1.0,
41 "sk": 1.0,
42 "bs": 1.0,
43 "domain_r": 1.5,
44 "smoothing": 0.0,
45 "KOSigma": 8.0 # , \
46 # "itau":1.0, "k1":0.1, "k2":0.0, "k3":0.5, "eta":1.0,
47 # "f":1.0, "g":0.0, "xi":1.0, "e":1.0, "c":1.0, "mu":0.2, "ds":1.0,
48 # "sk":1.0, "bs":1.0#, \
49 # "par_b":666.0, "center_offset_x":-1.0, "center_offset_y":0.0, "center_offset_z":0.0, \
50 # "target_m_plus":1.0, "par_p_plus_x":0.0, "par_p_plus_y":0.0, "par_p_plus_z":0.0, \
51 # "par_s_plus_x":0.0, "par_s_plus_y":0.0, "par_s_plus_z":0.0, \
52 # "target_m_minus":1.0, "par_p_minus_x":0.0, "par_p_minus_y":0.0, "par_p_minus_z":0.0, \
53 # "par_s_minus_x":0.0, "par_s_minus_y":0.0, "par_s_minus_z":0.0, \
54 # "tp_epsilon":1e-6
55}
56
57intparams = {
58 "BBHType": 2,
59 "LapseType": 1,
60 "tp_grid_setup": 0,
61 "swi": 99,
62 "ReSwi": 1,
63 "SO": 0,
64}
65# sss
66if __name__ == "__main__":
67 parser = argparse.ArgumentParser(description="ExaHyPE 2 - CCZ4 script")
68 parser.add_argument(
69 "-maxh",
70 "--max-h",
71 dest="max_h",
72 type=float,
73 default=0.05,
74 help="upper limit for refinement. Refers to volume size, i.e. not to patch size",
75 )
76 parser.add_argument(
77 "-minh",
78 "--min-h",
79 dest="min_h",
80 type=float,
81 default=0.02,
82 help="lower limit for refinement (set to 0 to make it equal to max_h - default). Refers to volume size, i.e. not to patch size",
83 )
84 parser.add_argument(
85 "-ps",
86 "--patch-size",
87 dest="patch_size",
88 type=int,
89 default=9,
90 help="Patch size, i.e. number of volumes per patch per direction",
91 )
92 parser.add_argument(
93 "-plt",
94 "--plot-step-size",
95 dest="plot_step_size",
96 type=float,
97 default=0,
98 help="Plot step size (0 to switch it off)",
99 )
100 parser.add_argument(
101 "-m", "--mode", dest="mode", default="release", help="|".join(modes.keys())
102 )
103 parser.add_argument(
104 "--gpu",
105 dest="GPU",
106 default=False,
107 action="store_true",
108 help="Run with accelerator support",
109 )
110 parser.add_argument(
111 "-impl",
112 "--implementation",
113 dest="implementation",
114 default="fd4-rk1-adaptive",
115 choices=["fd4-rk1-adaptive", "fd4-rk1-adaptive-enclave"],
116 help="Pick solver type",
117 )
118 parser.add_argument(
119 "-no-pbc",
120 "--no-periodic-boundary-conditions",
121 dest="periodic_bc",
122 action="store_false",
123 default=True,
124 help="switch on or off the periodic BC",
125 )
126 parser.add_argument(
127 "-sommerfeld",
128 "--sommerfeld-boundary-conditions",
129 dest="sommerfeld_bc",
130 action="store_true",
131 default=False,
132 help="switch on or off the Sommerfeld radiative BC",
133 )
134 parser.add_argument(
135 "-AMRMarker",
136 "--AMR-marker",
137 dest="marker",
138 choices=["none", "poisson"],
139 default="none",
140 help="switch on or off the AMR boundary marker",
141 )
142 parser.add_argument(
143 "-et",
144 "--end-time",
145 dest="end_time",
146 type=float,
147 default=0.01,
148 help="End (terminal) time",
149 )
150 parser.add_argument(
151 "-pst",
152 "--plot-start-time",
153 dest="plot_start_time",
154 type=float,
155 default=0.0,
156 help="start time for plot",
157 )
158 parser.add_argument(
159 "-s",
160 "--scenario",
161 dest="scenario",
162 default="single-puncture",
163 choices=[
164 "gauge",
165 "dia_gauge",
166 "linear",
167 "single-puncture",
168 "two-punctures",
169 "flat",
170 ],
171 help="Scenario",
172 )
173 parser.add_argument(
174 "-cfl", "--CFL-ratio", dest="cfl", type=float, default=0.1, help="Set CFL ratio"
175 )
176 parser.add_argument(
177 "-tracer",
178 "--add-tracer",
179 dest="add_tracer",
180 type=int,
181 default=0,
182 help="Add tracers and specify the seeds. 0-switch off, 1-static point tracer, 2-moving point tracer",
183 )
184 parser.add_argument(
185 "-tn",
186 "--tracer-name",
187 dest="tra_name",
188 type=str,
189 default="de",
190 help="name of output tracer file (temporary)",
191 )
192 parser.add_argument(
193 "-exn",
194 "--exe-name",
195 dest="exe_name",
196 type=str,
197 default="test",
198 help="name of output executable file",
199 )
200 parser.add_argument(
201 "-outdir",
202 "--output-directory",
203 dest="path",
204 type=str,
205 default="./",
206 help="specify the output directory, include the patch file and tracer file",
207 )
208 parser.add_argument(
209 "-interp",
210 "--interpolation",
211 dest="interpolation",
212 choices=[
213 "constant",
214 "order-2",
215 "linear-constant-extrap",
216 "linear-linear-extrap",
217 "linear-con-extrap-lin-normal-interp",
218 "linear-lin-extrap-lin-normal-interp",
219 "matrix",
220 "second_order",
221 "third_order",
222 ],
223 default="linear-lin-extrap-lin-normal-interp",
224 help="interpolation scheme for AMR",
225 )
226 parser.add_argument(
227 "-restrict",
228 "--restriction",
229 dest="restriction",
230 choices=["average", "inject", "matrix", "second_order"],
231 default="average",
232 help="restriction scheme for AMR",
233 )
234 parser.add_argument(
235 "-so",
236 "--second-order",
237 dest="SO_flag",
238 default=True,
239 action="store_true",
240 help="enable double communication per timestep, used in the soccz4 formulation.",
241 )
242
243 for k, v in floatparams.items():
244 parser.add_argument(
245 "--{}".format(k),
246 dest="CCZ4{}".format(k),
247 type=float,
248 default=v,
249 help="default: %(default)s",
250 )
251 for k, v in intparams.items():
252 if k == "ReSwi":
253 parser.add_argument(
254 "--{}".format(k),
255 dest="CCZ4{}".format(k),
256 type=int,
257 default=v,
258 help="default: %(default)s, choose refinement criterion, 0-no refinement, 1-radius based, 2-SBH phi gradient based, 3-BBH phi gradient based. Notice: 2 and 3 only work with -ext Full",
259 )
260 else:
261 parser.add_argument(
262 "--{}".format(k),
263 dest="CCZ4{}".format(k),
264 type=int,
265 default=v,
266 help="default: %(default)s",
267 )
268
269 args = parser.parse_args()
270
271 SuperClass = None
272
273 print(args.implementation)
274 if (
275 args.implementation == "fd4-rk1-adaptive"
276 or args.implementation == "fd4-rk4-adaptive"
277 ):
278 SuperClass = exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStep
279 if args.implementation == "fd4-rk1-adaptive-enclave":
280 SuperClass = exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStepWithEnclaveTasking
281 args.SO_flag = False
282 if args.implementation == "fd4-rk1-fixed" or args.implementation == "fd4-rk4-fixed":
283 SuperClass = exahype2.solvers.rkfd.fd4.GlobalFixedTimeStep
284
285 class CCZ4Solver(SuperClass):
287 self, name, patch_size, min_volume_h, max_volume_h, cfl, domain_r, KOSig
288 ):
289 unknowns = {
290 "G": 6, # 0-5
291 "K": 6, # 6-11
292 "theta": 1, # 12
293 "Z": 3, # 13-15
294 "lapse": 1, # 16
295 "shift": 3, # 17-19
296 "b": 3, # 20-22
297 "dLapse": 3, # 23-25
298 "dxShift": 3, # 26-28
299 "dyShift": 3, # 29-31
300 "dzShift": 3, # 32-34
301 "dxG": 6, # 35-40
302 "dyG": 6, # 41-46
303 "dzG": 6, # 47-52
304 "traceK": 1, # 53
305 "phi": 1, # 54
306 "P": 3, # 55-57
307 "K0": 1, # 58
308 }
309
310 number_of_unknowns = sum(unknowns.values())
311
313#include "../CCZ4Kernels.h"
314"""
315 if SuperClass == exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStep:
316 if (
317 args.implementation == "fd4-rk1-adaptive"
318 or args.implementation == "fd4-rk1-adaptive-enclave"
319 ):
320 rk_order = 1
321 else:
322 rk_order = 4
323 SuperClass.__init__(
324 self,
325 name=name,
326 patch_size=patch_size,
327 rk_order=rk_order,
328 unknowns=number_of_unknowns,
329 auxiliary_variables=0,
330 min_meshcell_h=min_volume_h,
331 max_meshcell_h=max_volume_h,
332 time_step_relaxation=cfl,
333 KOSigma=KOSig,
334 reconstruction_with_rk=args.SO_flag,
335 )
336 elif (
337 SuperClass
338 == exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStepWithEnclaveTasking
339 ):
340 if (
341 args.implementation == "fd4-rk1-adaptive"
342 or args.implementation == "fd4-rk1-adaptive-enclave"
343 ):
344 rk_order = 1
345 else:
346 rk_order = 4
347 SuperClass.__init__(
348 self,
349 name=name,
350 patch_size=patch_size,
351 rk_order=rk_order,
352 unknowns=number_of_unknowns,
353 auxiliary_variables=0,
354 min_meshcell_h=min_volume_h,
355 max_meshcell_h=max_volume_h,
356 time_step_relaxation=cfl,
357 KOSigma=KOSig,
358 pde_terms_without_state=True,
359 )
360 elif (
361 SuperClass == exahype2.solvers.rkfd.fd4.GlobalFixedTimeStep
362 or SuperClass
363 == exahype2.solvers.rkfd.fd4.GlobalFixedTimeStepWithEnclaveTasking
364 ):
365 if args.implementation == "fd4-rk1-fixed":
366 rk_order = 1
367 else:
368 rk_order = 4
369 SuperClass.__init__(
370 self,
371 name=name,
372 patch_size=patch_size,
373 rk_order=rk_order,
374 unknowns=number_of_unknowns,
375 auxiliary_variables=0,
376 min_meshcell_h=min_volume_h,
377 max_meshcell_h=max_volume_h,
378 normalised_time_step_size=0.01,
379 KOSigma=KOSig,
380 )
381 else:
382 SuperClass.__init__(
383 self,
384 name=name,
385 patch_size=patch_size,
386 unknowns=number_of_unknowns,
387 auxiliary_variables=0,
388 min_volume_h=min_volume_h,
389 max_volume_h=max_volume_h,
390 time_step_relaxation=cfl
391 # use_gpu =args.GPU #=="fv-fixed-gpu" else False
392 # use_gpu = True if args.implementation=="fv-adaptive-gpu" else False
393 )
394
395 self._patch_size = patch_size
396 self._domain_r = domain_r
397
398 self.set_implementation(
399 boundary_conditions=exahype2.solvers.PDETerms.User_Defined_Implementation,
400 ncp=exahype2.solvers.PDETerms.User_Defined_Implementation,
401 flux=exahype2.solvers.PDETerms.None_Implementation,
402 source_term=exahype2.solvers.PDETerms.User_Defined_Implementation,
403 refinement_criterion=exahype2.solvers.PDETerms.User_Defined_Implementation,
404 eigenvalues=exahype2.solvers.PDETerms.User_Defined_Implementation,
405 )
406
407 if (
408 SuperClass
409 == exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStepWithEnclaveTasking
410 ):
411 self._fused_compute_kernel_call_cpu = exahype2.solvers.rkfd.fd4.kernels.create_compute_kernel_for_FD4(
412 self._flux_implementation,
413 self._ncp_implementation,
414 self._source_term_implementation,
415 compute_max_eigenvalue_of_next_time_step=True,
416 solver_variant=exahype2.solvers.rkfd.kernels.SolverVariant.Multicore,
417 kernel_variant=exahype2.solvers.rkfd.kernels.KernelVariant.BatchedAoSHeap,
418 KOSigma=self._KO_Sigma,
419 )
420
422{
423"""
424
425 if (
426 SuperClass == exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStep
427 or SuperClass == exahype2.solvers.rkfd.fd4.GlobalFixedTimeStep
428 or SuperClass
429 == exahype2.solvers.rkfd.fd4.GlobalAdaptiveTimeStepWithEnclaveTasking
430 # or SuperClass==exahype2.solvers.rkfd.fd4.GlobalFixedTimeStepWithEnclaveTasking no fixed enclave version yet
431 ):
432 self.postprocess_updated_patch += """
433 #if DIMENSIONS==2
434 constexpr int itmax = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
435 #endif
436
437 #if DIMENSIONS==3
438 constexpr int itmax = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
439 #endif
440"""
441 # elif SuperClass == exahype2.solvers.rkdg.rusanov.GlobalAdaptiveTimeStep: fix it after rkdg is back
442 # self.postprocess_updated_patch = """
443 # constexpr int itmax = ({{ORDER}}+1) * ({{ORDER}}+1) * ({{ORDER}}+1); // only support 3d
444 # """
445 else:
446 self.postprocess_updated_patch += """
447 #if DIMENSIONS==2
448 constexpr int itmax = {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}};
449 #endif
450
451 #if DIMENSIONS==3
452 constexpr int itmax = {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}};
453 #endif
454"""
455
456 self.postprocess_updated_patch += """
457 int index = 0;
458 for (int i=0;i<itmax;i++)
459 {
460 applications::exahype2::ccz4::enforceCCZ4constraints( newQ+index );
461 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
462 }
463 }
464"""
465
467 SuperClass.create_action_sets(self)
468 self._action_set_couple_resolution_transitions_and_handle_dynamic_mesh_refinement.additional_includes += """
469#include "../CCZ4Kernels.h"
470 """
471
473 """
474 We take this routine to add a few additional include statements.
475 """
476 return (
477 SuperClass.get_user_action_set_includes(self) + self._my_user_includes
478 )
479
480
481
483 userinfo = []
484 exe = "peano4"
485
486 if args.exe_name != "":
487 exe += "_"
488 exe += args.exe_name
489 if not args.tra_name == "de":
490 exe += "_" + args.tra_name
491 project = exahype2.Project(
492 ["benchmarks", "exahype2", "ccz4"], "ccz4", executable=exe
493 )
494
495
498 is_aderdg = False
499 is_rkdg = False
500 solver_name = "CCZ4"
501 try:
502 if (
503 SuperClass
504 == exahype2.solvers.aderdg.NonFusedGenericRusanovFixedTimeStepSize
505 ):
506 is_aderdg = True
507 order = 3
508 unknowns = 59
509 time_step_size = 0.001
510 except Exception as e:
511 pass
512 # msg = "Warning: ADER-DG no supported on this machine"
513 # print(msg)
514 # userinfo.append((msg,e))
515
516 try:
517 if SuperClass == exahype2.solvers.rkdg.rusanov.GlobalAdaptiveTimeStep:
518 is_rkdg = True
519 except Exception as e:
520 pass
521 msg = "Warning: RKDG not supported on this machine"
522 print(msg)
523 userinfo.append((msg, e))
524
525 if is_aderdg:
526 solver_name = "ADERDG" + solver_name
527 elif is_rkdg:
528 solver_name = "RKDG" + solver_name
529 else:
530 solver_name = solver_name
531
532 # if args.SO_flag==True:
533 # args.cfl=args.cfl/2
534
535 min_h = args.min_h
536 if min_h <= 0.0:
537 print("No minimal mesh size chosen. Set it to max mesh size (regular grid)")
538 min_h = args.max_h
539
540 if is_aderdg:
541 my_solver = exahype2.solvers.aderdg.NonFusedGenericRusanovFixedTimeStepSize(
542 solver_name,
543 order,
544 unknowns,
545 0, # auxiliary_variables
546 exahype2.solvers.aderdg.Polynomials.Gauss_Legendre,
547 min_h,
548 args.max_h,
549 time_step_size,
550 flux=None,
551 ncp=exahype2.solvers.PDETerms.User_Defined_Implementation,
552 sources=exahype2.solvers.PDETerms.User_Defined_Implementation,
553 )
554 else:
555 my_solver = CCZ4Solver(
556 solver_name,
557 args.patch_size,
558 min_h,
559 args.max_h,
560 args.cfl,
561 args.CCZ4domain_r,
562 args.CCZ4KOSigma,
563 )
564 userinfo.append(("CFL ratio set as " + str(args.cfl), None))
565
566 userinfo.append(("The solver is " + args.implementation, None))
567
568
571
572 if args.interpolation == "order-2":
573 my_solver.overlap = 2
574
575 if args.interpolation == "constant":
576 my_solver.interpolation = "piecewise_constant"
577 print("Interpolation rule: piecewise_constant")
578 if args.interpolation == "linear-constant-extrap":
579 my_solver.interpolation = "linear_with_constant_extrapolation"
580 print("Interpolation rule: linear constant extrapolation")
581 if args.interpolation == "linear-linear-extrap":
582 my_solver.interpolation = "linear_with_linear_extrapolation"
583 print("Interpolation rule: linear extrapolation")
584 if args.interpolation == "linear-con-extrap-lin-normal-interp":
585 my_solver.interpolation = (
586 "linear_with_constant_extrapolation_and_linear_normal_interpolation"
587 )
588 print(
589 "Interpolation rule: linear+constant extrapolation and linear normal interpolation"
590 )
591
592 if args.interpolation == "order-2":
593 my_solver.interpolation = "linear"
594
595 tem_interp = ["TP_constant", "TP_linear_with_linear_extrap_normal_interp"]
596 tem_restrict = ["TP_inject_normal_extrap", "TP_average_normal_extrap"]
597 if "fd4-rk" in args.implementation:
598 if args.interpolation == "matrix":
599 exahype2.solvers.rkfd.fd4.switch_to_FD4_matrix_interpolation(my_solver)
600 elif args.interpolation == "second_order":
601 exahype2.solvers.rkfd.fd4.switch_to_FD4_second_order_interpolation(
602 my_solver
603 )
604 elif args.interpolation == "third_order":
605 exahype2.solvers.rkfd.fd4.switch_to_FD4_third_order_interpolation(my_solver)
606 else:
607 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_interpolation(
608 my_solver, tem_interp[1]
609 )
610 userinfo.append(("FD4 Interpolation: " + tem_interp[1], None))
611
612 if args.restriction == "matrix":
613 exahype2.solvers.rkfd.fd4.switch_to_FD4_matrix_restriction(my_solver)
614 elif args.restriction == "second_order":
615 exahype2.solvers.rkfd.fd4.switch_to_FD4_second_order_restriction(my_solver)
616 # elif args.restriction == "third_order":
617 # exahype2.solvers.rkfd.fd4.switch_to_FD4_third_order_restriction( my_solver )
618 else:
619 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_restriction(
620 my_solver, tem_restrict[1]
621 )
622 userinfo.append(("FD4 Restriction: " + tem_restrict[1], None))
623
624 # userinfo.append(("FD4 Interpolation: " + tem_interp[1] + " & Restriction: " + tem_restrict[1], None))
625
626
629 for k, v in intparams.items():
630 intparams.update({k: eval("args.CCZ4{}".format(k))})
631 for k, v in floatparams.items():
632 floatparams.update({k: eval("args.CCZ4{}".format(k))})
633
634 if args.SO_flag == True:
635 intparams.update({"SO": 1})
636
637 if args.scenario == "two-punctures":
638 msg = "Periodic BC deactivated because you pick Puncture scenario\nInitialize binary black holes"
639 print(msg)
640 periodic_boundary_conditions = [False, False, False]
641 intparams.update(
642 {"swi": 2}
643 ) # notice it may change, see according function in CCZ4.cpp
644 print(intparams)
645 userinfo.append((msg, None))
646 elif args.scenario == "single-puncture":
647 msg = "Periodic BC deactivated because you pick Puncture scenario\nInitialize single black hole"
648 print(msg)
649 periodic_boundary_conditions = [False, False, False]
650 intparams.update({"swi": 0})
651 userinfo.append((msg, None))
652 elif args.periodic_bc == True:
653 msg = "Periodic BC set"
654 print(msg)
655 periodic_boundary_conditions = [True, True, True] # Periodic BC
656 userinfo.append((msg, None))
657 else:
658 msg = "WARNING: Periodic BC deactivated by hand"
659 print(msg)
660 periodic_boundary_conditions = [False, False, False]
661 userinfo.append((msg, None))
662
663 solverconstants = ""
664
665 if args.scenario == "gauge":
666 solverconstants += "static constexpr int Scenario=0; /* Gauge wave */ \n "
667 userinfo.append(("picking gauge wave scenario", None))
668 floatparams.update({"sk": 0.0})
669 floatparams.update({"bs": 0.0})
670 intparams.update({"LapseType": 0})
671 elif (args.scenario == "two-punctures") or (args.scenario == "single-puncture"):
672 solverconstants += "static constexpr int Scenario=2; /* Two-puncture */ \n"
673 userinfo.append(("picking black hole scenario", None))
674 else:
675 raise Exception("Scenario " + args.scenario + " is now unknown")
676
677 for k, v in floatparams.items():
678 solverconstants += "static constexpr double {} = {};\n".format(
679 "CCZ4{}".format(k), v
680 )
681 for k, v in intparams.items():
682 solverconstants += "static constexpr int {} = {};\n".format(
683 "CCZ4{}".format(k), v
684 )
685 my_solver.add_solver_constants(solverconstants)
686
687 project.add_solver(my_solver)
688
689 build_mode = modes[args.mode]
690
691 dimensions = 3
692
693
696 floatparams.update({"domain_r": args.CCZ4domain_r})
697 dr = floatparams["domain_r"]
698 offset = [-dr, -dr, -dr]
699 domain_size = [2 * dr, 2 * dr, 2 * dr]
700 msg = "domain set as " + str(offset) + " and " + str(domain_size)
701 print(msg)
702 userinfo.append((msg, None))
703
704 project.set_global_simulation_parameters(
705 dimensions, # dimensions
706 offset,
707 domain_size,
708 args.end_time, # end time
709 args.plot_start_time,
710 args.plot_step_size, # snapshots
711 periodic_boundary_conditions,
712 8, # plotter precision
713 )
714 userinfo.append(
715 (
716 "plot start time: "
717 + str(args.plot_start_time)
718 + ", plot step size: "
719 + str(args.plot_step_size),
720 None,
721 )
722 )
723 userinfo.append(("Terminal time: " + str(args.end_time), None))
724
725 project.set_Peano4_installation("../../../..", build_mode)
726
727
730 path = "./"
731 if not args.path == "./":
732 path = args.path
733 # path="/cosma5/data/durham/dc-zhan3/bbh-c5-1"
734 # path="/cosma6/data/dp004/dc-zhan3/exahype2/sbh-fv3"
735 project.set_output_path(path)
736 probe_point = [-12, -12, 0.0]
737 project.add_plot_filter(probe_point, [24.0, 24.0, 0.01], 1)
738
739 project.set_load_balancer("new ::exahype2::LoadBalancingConfiguration")
740
741
744 peano4_project = project.generate_Peano4_project(verbose=True)
745 peano4_project.output.makefile.add_header_search_path(
746 "../../../../applications/exahype2/ccz4/"
747 )
748
749 if (
750 args.scenario == "gauge"
751 or args.scenario == "linear"
752 or args.scenario == "dia_gauge"
753 or args.scenario == "flat"
754 ):
755 pass
756 elif args.scenario == "two-punctures" or args.scenario == "single-puncture":
757 peano4_project.output.makefile.add_linker_flag("-lm -lgsl -lgslcblas")
758 peano4_project.output.makefile.add_cpp_file(
759 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Utilities.cpp"
760 )
761 peano4_project.output.makefile.add_cpp_file(
762 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Parameters.cpp"
763 )
764 peano4_project.output.makefile.add_cpp_file(
765 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Logging.cpp"
766 )
767 peano4_project.output.makefile.add_cpp_file(
768 "../../../../applications/exahype2/ccz4/libtwopunctures/TwoPunctures.cpp"
769 )
770 peano4_project.output.makefile.add_cpp_file(
771 "../../../../applications/exahype2/ccz4/libtwopunctures/CoordTransf.cpp"
772 )
773 peano4_project.output.makefile.add_cpp_file(
774 "../../../../applications/exahype2/ccz4/libtwopunctures/Equations.cpp"
775 )
776 peano4_project.output.makefile.add_cpp_file(
777 "../../../../applications/exahype2/ccz4/libtwopunctures/FuncAndJacobian.cpp"
778 )
779 peano4_project.output.makefile.add_cpp_file(
780 "../../../../applications/exahype2/ccz4/libtwopunctures/Newton.cpp"
781 )
782 peano4_project.output.makefile.add_CXX_flag("-DIncludeTwoPunctures")
783 else:
784 raise Exception("Scenario " + args.scenario + " is now unknown")
785
786 peano4_project.output.makefile.add_CXX_flag("-DCCZ4EINSTEIN")
787
788 peano4_project.output.makefile.add_h_file("CCZ4.h")
789 peano4_project.output.makefile.add_cpp_file("CCZ4.cpp")
790 peano4_project.output.makefile.add_cpp_file(
791 "../../../../applications/exahype2/ccz4/InitialValues.cpp"
792 )
793 peano4_project.output.makefile.add_cpp_file(
794 "../../../../applications/exahype2/ccz4/CCZ4Kernels.cpp"
795 )
796
797 peano4_project.generate(throw_away_data_after_generation=False)
798 peano4_project.build(make_clean_first=True)
799
800 # Report the application information
801 userinfo.append(("the executable file name: " + exe, None))
802 userinfo.append(("output directory: " + path, None))
803 print("=========================================================")
804 if not args.add_tracer == 0:
805 userinfo.append(("tracer output file: " + args.path + "Tracer-test", None))
806 if len(userinfo) > 0:
807 print("The building information:")
808 for msg, exception in userinfo:
809 if exception is None:
810 print(msg)
811 else:
812 print(msg, "Exception: {}".format(exception))
813 print(intparams)
814 print(floatparams)
815 print("=========================================================")
__init__(self, name, patch_size, min_volume_h, max_volume_h, cfl, domain_r, KOSig)
get_user_action_set_includes(self)
We take this routine to add a few additional include statements.