12mode = peano4.api.output.CompileMode.RELEASE
19 size = [1.0, 1.0, 1.0]
20 offset = [0.0, 0.0, 0.0]
29lid_driven_cavity_velocity = 1.0
31my_project = exahype2.Project(
32 namespace = [
"applications",
"exahype2",
"CompressibleNavierStokes"],
33 project_name =
"CompressibleNavierStokesApplication",
35 executable=
"compressible-navier-stokes-" + str(dimensions) +
"d"
38my_solver = exahype2.solvers.fv.rusanov.GlobalAdaptiveTimeStep(
39 name =
"NavierStokesSolver",
40 patch_size = patch_size,
41 unknowns = dimensions + 3,
42 auxiliary_variables = dimensions**2+dimensions,
43 max_volume_h = cell_size,
44 min_volume_h = cell_size * 3.0**(-amr_levels),
45 time_step_relaxation = 0.5,
50 my_solver.plot_description =
"rho, u, v, e, dudx, dudy, dvdx, dvdy"
52 my_solver.plot_description =
"rho, u, v, w, e, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz"
54my_solver.set_implementation(
55 ncp = exahype2.solvers.PDETerms.User_Defined_Implementation,
56 flux = exahype2.solvers.PDETerms.User_Defined_Implementation,
57 eigenvalues = exahype2.solvers.PDETerms.User_Defined_Implementation,
59 refinement_criterion = exahype2.solvers.PDETerms.User_Defined_Implementation
62my_solver._preprocess_reconstructed_patch =
"""
63 NavierStokesSolver::extrapolateHalo(oldQWithHalo);
64 NavierStokesSolver::calculateDerivatives(oldQWithHalo);
67my_solver.add_solver_constants(
"static constexpr double Gamma = {};".format(gamma))
68my_solver.add_solver_constants(
"static constexpr double Viscosity = {};".format(fluid_viscosity))
69my_solver.add_solver_constants(
"static constexpr double PrandtlNumber = {};".format(prandtl_number))
70my_solver.add_solver_constants(
"static constexpr double c_p = {};".format(c_p))
71my_solver.add_solver_constants(
"static constexpr double R = {};".format(R))
72my_solver.add_solver_constants(
"static constexpr double IgnitionTemperature = {};".format(T_ign))
73my_solver.add_solver_constants(
"static constexpr double Timescale = {};".format(tau))
74my_solver.add_solver_constants(
"static constexpr double LidDrivenCavityVelocity = {};".format(lid_driven_cavity_velocity))
75my_solver.add_solver_constants(
"static constexpr double DomainSize[] = {%s};" % str(size).strip(
'[]'))
76my_solver.add_solver_constants(
"static constexpr double DomainOffset[] = {%s};" % str(offset).strip(
'[]'))
78my_project.add_solver(my_solver)
80my_project.set_global_simulation_parameters(
81 dimensions = dimensions,
84 min_end_time = end_time,
85 max_end_time = end_time,
86 first_plot_time_stamp = 0.0,
87 time_in_between_plots = plot_interval,
88 periodic_BC = [
False,
False,
False]
91my_project.set_output_path(
"solution")
92if not os.path.exists(
"solution"):
93 os.makedirs(
"solution")
95my_project.set_load_balancing(
"toolbox::loadbalancing::strategies::SpreadOutHierarchically",
"new ::exahype2::LoadBalancingConfiguration(0.98)")
96my_project.set_Peano4_installation(
"../../../", mode )
97my_project = my_project.generate_Peano4_project(verbose=
True)
98my_project.set_fenv_handler(
"FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW")
99my_project.output.makefile.add_h_file(
"NavierStokesSolver.h", generated=
False )
100my_project.output.makefile.add_cpp_file(
"NavierStokesSolver.cpp", generated=
False )
101my_project.build(make_clean_first=
True, throw_away_data_after_build=
True)
103print(
"Executable is 'compressible-navier-stokes-<dimensions>d'")
104print(
"Clean object files via 'make clean'")
105print(
"Recompile the generated code via 'make -j'")
106print(
"Remove all generated code via 'make distclean'")
107print(
"Regenerate all code by running 'python3 compressible-navier-stokes.py' again")
108print(
"Convert any output via python3 ../../../python/peano4/visualisation/render.py solution/solution-NavierStokesSolver.peano-patch-file")
109print(
"Then you can open the generated .pvd file in a tool of your choice (e.g., ParaView)")