289 self, name, patch_size, min_volume_h, max_volume_h, cfl, domain_r, KOSig
312 number_of_unknowns = sum(unknowns.values())
315#include "../CCZ4Kernels.h"
319 args.implementation ==
"fd4-rk1-adaptive"
320 or args.implementation ==
"fd4-rk1-adaptive-enclave"
328 patch_size=patch_size,
330 unknowns=number_of_unknowns,
331 auxiliary_variables=0,
332 min_meshcell_h=min_volume_h,
333 max_meshcell_h=max_volume_h,
334 time_step_relaxation=cfl,
336 reconstruction_with_rk=args.SO_flag,
343 args.implementation ==
"fd4-rk1-adaptive"
344 or args.implementation ==
"fd4-rk1-adaptive-enclave"
352 patch_size=patch_size,
354 unknowns=number_of_unknowns,
355 auxiliary_variables=0,
356 min_meshcell_h=min_volume_h,
357 max_meshcell_h=max_volume_h,
358 time_step_relaxation=cfl,
360 pde_terms_without_state=
True,
365 == exahype2.solvers.rkfd.fd4.GlobalFixedTimeStepWithEnclaveTasking
367 if args.implementation ==
"fd4-rk1-fixed":
374 patch_size=patch_size,
376 unknowns=number_of_unknowns,
377 auxiliary_variables=0,
378 min_meshcell_h=min_volume_h,
379 max_meshcell_h=max_volume_h,
380 normalised_time_step_size=0.01,
387 patch_size=patch_size,
388 unknowns=number_of_unknowns,
389 auxiliary_variables=0,
390 min_volume_h=min_volume_h,
391 max_volume_h=max_volume_h,
392 time_step_relaxation=cfl
400 self.set_implementation(
401 boundary_conditions=exahype2.solvers.PDETerms.User_Defined_Implementation,
402 ncp=exahype2.solvers.PDETerms.User_Defined_Implementation,
403 flux=exahype2.solvers.PDETerms.None_Implementation,
404 source_term=exahype2.solvers.PDETerms.User_Defined_Implementation,
405 refinement_criterion=exahype2.solvers.PDETerms.User_Defined_Implementation,
406 eigenvalues=exahype2.solvers.PDETerms.User_Defined_Implementation,
417 compute_max_eigenvalue_of_next_time_step=
True,
418 solver_variant=exahype2.solvers.rkfd.kernels.SolverVariant.Multicore,
419 kernel_variant=exahype2.solvers.rkfd.kernels.KernelVariant.BatchedAoSHeap,
420 KOSigma=self._KO_Sigma,
436 constexpr int itmax = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}} * {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
440 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}};
450 constexpr int itmax = {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}};
454 constexpr int itmax = {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}} * {{NUMBER_OF_VOLUMES_PER_AXIS}};
460 for (int i=0;i<itmax;i++)
462 applications::exahype2::ccz4::enforceCCZ4constraints( newQ+index );
463 index += {{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}};
476 We take this routine to add a few additional include statements.
488 if args.exe_name !=
"":
491 if not args.tra_name ==
"de":
492 exe +=
"_" + args.tra_name
494 [
"benchmarks",
"exahype2",
"ccz4"],
"ccz4", executable=exe
506 == exahype2.solvers.aderdg.NonFusedGenericRusanovFixedTimeStepSize
511 time_step_size = 0.001
512 except Exception
as e:
521 except Exception
as e:
523 msg =
"Warning: RKDG not supported on this machine"
525 userinfo.append((msg, e))
528 solver_name =
"ADERDG" + solver_name
530 solver_name =
"RKDG" + solver_name
532 solver_name = solver_name
539 print(
"No minimal mesh size chosen. Set it to max mesh size (regular grid)")
543 my_solver = exahype2.solvers.aderdg.NonFusedGenericRusanovFixedTimeStepSize(
548 exahype2.solvers.aderdg.Polynomials.Gauss_Legendre,
553 ncp=exahype2.solvers.PDETerms.User_Defined_Implementation,
554 sources=exahype2.solvers.PDETerms.User_Defined_Implementation,
566 userinfo.append((
"CFL ratio set as " + str(args.cfl),
None))
568 userinfo.append((
"The solver is " + args.implementation,
None))
574 if args.interpolation ==
"order-2":
575 my_solver.overlap = 2
577 if args.interpolation ==
"constant":
578 my_solver.interpolation =
"piecewise_constant"
579 print(
"Interpolation rule: piecewise_constant")
580 if args.interpolation ==
"linear-constant-extrap":
581 my_solver.interpolation =
"linear_with_constant_extrapolation"
582 print(
"Interpolation rule: linear constant extrapolation")
583 if args.interpolation ==
"linear-linear-extrap":
584 my_solver.interpolation =
"linear_with_linear_extrapolation"
585 print(
"Interpolation rule: linear extrapolation")
586 if args.interpolation ==
"linear-con-extrap-lin-normal-interp":
587 my_solver.interpolation = (
588 "linear_with_constant_extrapolation_and_linear_normal_interpolation"
591 "Interpolation rule: linear+constant extrapolation and linear normal interpolation"
594 if args.interpolation ==
"order-2":
595 my_solver.interpolation =
"linear"
597 tem_interp = [
"TP_constant",
"TP_linear_with_linear_extrap_normal_interp"]
598 tem_restrict = [
"TP_inject_normal_extrap",
"TP_average_normal_extrap"]
599 if "fd4-rk" in args.implementation:
600 if args.interpolation ==
"matrix":
601 exahype2.solvers.rkfd.fd4.switch_to_FD4_matrix_interpolation(my_solver)
602 elif args.interpolation ==
"second_order":
603 exahype2.solvers.rkfd.fd4.switch_to_FD4_second_order_interpolation(
606 elif args.interpolation ==
"third_order":
607 exahype2.solvers.rkfd.fd4.switch_to_FD4_third_order_interpolation(my_solver)
609 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_interpolation(
610 my_solver, tem_interp[1]
612 userinfo.append((
"FD4 Interpolation: " + tem_interp[1],
None))
614 if args.restriction ==
"matrix":
615 exahype2.solvers.rkfd.fd4.switch_to_FD4_matrix_restriction(my_solver)
616 elif args.restriction ==
"second_order":
617 exahype2.solvers.rkfd.fd4.switch_to_FD4_second_order_restriction(my_solver)
621 exahype2.solvers.rkfd.fd4.switch_to_FD4_tensor_product_restriction(
622 my_solver, tem_restrict[1]
624 userinfo.append((
"FD4 Restriction: " + tem_restrict[1],
None))
631 for k, v
in intparams.items():
632 intparams.update({k: eval(
"args.CCZ4{}".format(k))})
633 for k, v
in floatparams.items():
634 floatparams.update({k: eval(
"args.CCZ4{}".format(k))})
636 if args.SO_flag ==
True:
637 intparams.update({
"SO": 1})
639 if args.scenario ==
"two-punctures":
640 msg =
"Periodic BC deactivated because you pick Puncture scenario\nInitialize binary black holes"
642 periodic_boundary_conditions = [
False,
False,
False]
647 userinfo.append((msg,
None))
648 elif args.scenario ==
"single-puncture":
649 msg =
"Periodic BC deactivated because you pick Puncture scenario\nInitialize single black hole"
651 periodic_boundary_conditions = [
False,
False,
False]
652 intparams.update({
"swi": 0})
653 userinfo.append((msg,
None))
654 elif args.periodic_bc ==
True:
655 msg =
"Periodic BC set"
657 periodic_boundary_conditions = [
True,
True,
True]
658 userinfo.append((msg,
None))
660 msg =
"WARNING: Periodic BC deactivated by hand"
662 periodic_boundary_conditions = [
False,
False,
False]
663 userinfo.append((msg,
None))
667 if args.scenario ==
"gauge":
668 solverconstants +=
"static constexpr int Scenario=0; /* Gauge wave */ \n "
669 userinfo.append((
"picking gauge wave scenario",
None))
670 floatparams.update({
"sk": 0.0})
671 floatparams.update({
"bs": 0.0})
672 intparams.update({
"LapseType": 0})
673 elif (args.scenario ==
"two-punctures")
or (args.scenario ==
"single-puncture"):
674 solverconstants +=
"static constexpr int Scenario=2; /* Two-puncture */ \n"
675 userinfo.append((
"picking black hole scenario",
None))
677 raise Exception(
"Scenario " + args.scenario +
" is now unknown")
679 for k, v
in floatparams.items():
680 solverconstants +=
"static constexpr double {} = {};\n".format(
681 "CCZ4{}".format(k), v
683 for k, v
in intparams.items():
684 solverconstants +=
"static constexpr int {} = {};\n".format(
685 "CCZ4{}".format(k), v
687 my_solver.add_solver_constants(solverconstants)
689 project.add_solver(my_solver)
691 build_mode = modes[args.mode]
698 floatparams.update({
"domain_r": args.CCZ4domain_r})
699 dr = floatparams[
"domain_r"]
700 offset = [-dr, -dr, -dr]
701 domain_size = [2 * dr, 2 * dr, 2 * dr]
702 msg =
"domain set as " + str(offset) +
" and " + str(domain_size)
704 userinfo.append((msg,
None))
706 project.set_global_simulation_parameters(
711 args.plot_start_time,
713 periodic_boundary_conditions,
719 + str(args.plot_start_time)
720 +
", plot step size: "
721 + str(args.plot_step_size),
725 userinfo.append((
"Terminal time: " + str(args.end_time),
None))
727 project.set_Peano4_installation(
"../../../..", build_mode)
733 if not args.path ==
"./":
737 project.set_output_path(path)
738 probe_point = [-12, -12, 0.0]
739 project.add_plot_filter(probe_point, [24.0, 24.0, 0.01], 1)
744 project.set_load_balancing(
745 "toolbox::loadbalancing::strategies::SpreadOutHierarchically",
746 "(new ::exahype2::LoadBalancingConfiguration(0.95,1000,16))",
758 peano4_project = project.generate_Peano4_project(verbose=
True)
759 peano4_project.output.makefile.add_header_search_path(
760 "../../../../applications/exahype2/ccz4/"
764 args.scenario ==
"gauge"
765 or args.scenario ==
"linear"
766 or args.scenario ==
"dia_gauge"
767 or args.scenario ==
"flat"
770 elif args.scenario ==
"two-punctures" or args.scenario ==
"single-puncture":
771 peano4_project.output.makefile.add_linker_flag(
"-lm -lgsl -lgslcblas")
772 peano4_project.output.makefile.add_cpp_file(
773 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Utilities.cpp"
775 peano4_project.output.makefile.add_cpp_file(
776 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Parameters.cpp"
778 peano4_project.output.makefile.add_cpp_file(
779 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Logging.cpp"
781 peano4_project.output.makefile.add_cpp_file(
782 "../../../../applications/exahype2/ccz4/libtwopunctures/TwoPunctures.cpp"
784 peano4_project.output.makefile.add_cpp_file(
785 "../../../../applications/exahype2/ccz4/libtwopunctures/CoordTransf.cpp"
787 peano4_project.output.makefile.add_cpp_file(
788 "../../../../applications/exahype2/ccz4/libtwopunctures/Equations.cpp"
790 peano4_project.output.makefile.add_cpp_file(
791 "../../../../applications/exahype2/ccz4/libtwopunctures/FuncAndJacobian.cpp"
793 peano4_project.output.makefile.add_cpp_file(
794 "../../../../applications/exahype2/ccz4/libtwopunctures/Newton.cpp"
796 peano4_project.output.makefile.add_CXX_flag(
"-DIncludeTwoPunctures")
798 raise Exception(
"Scenario " + args.scenario +
" is now unknown")
800 peano4_project.output.makefile.add_CXX_flag(
"-DCCZ4EINSTEIN")
802 peano4_project.output.makefile.add_cpp_file(
803 "../../../../applications/exahype2/ccz4/InitialValues.cpp"
805 peano4_project.output.makefile.add_cpp_file(
806 "../../../../applications/exahype2/ccz4/CCZ4Kernels.cpp"
809 peano4_project.generate(throw_away_data_after_generation=
False)
810 peano4_project.build(make_clean_first=
True)
813 userinfo.append((
"the executable file name: " + exe,
None))
814 userinfo.append((
"output directory: " + path,
None))
815 print(
"=========================================================")
816 if not args.add_tracer == 0:
817 userinfo.append((
"tracer output file: " + args.path +
"Tracer-test",
None))
818 if len(userinfo) > 0:
819 print(
"The building information:")
820 for msg, exception
in userinfo:
821 if exception
is None:
824 print(msg,
"Exception: {}".format(exception))
827 print(
"=========================================================")