6from .MatrixFreeMain
import MatrixFreeMain
13 Here we recreate a multigrid project, without using PETSc.
15 We keep some of the basic steps:
16 - _algorithm_step_create_grid
17 - _algorithm_step_enumerate_and_init_solution
18 - _algorithm_step_solve
19 - _algorithm_step_plot
21 The rest is yet to be fleshed out.
23 Now that we have multiple solvers in a project, we may not
24 want to use all of them for stopping criteria. Hence, we
25 have a second array for solvers which participate, but are
26 not asked if their stopping criteria have been reached.
31 The standard extensions that are used for Peano and ExaHyPE.
33 LibraryDebug =
"_debug"
35 LibraryTrace =
"_trace"
36 LibraryAsserts =
"_asserts"
37 LibraryStats =
"_stats"
43 executable = "peano4matrixfree",
45 abstract_overwrite=True,
49 Create a matrix project
85 domain_size = [1.0, 1.0],
86 plot_after_each_mesh_sweep =
False,
93 Set the load balancing scheme
95 @param load_balancer_name: string
96 Should be full-qualified name of the load balancer.
97 By default, I recommend to pass "toolbox::loadbalancing::RecursiveSubdivision"
99 @param load_balancer_arguments: string
100 If your load balancing requires parameters, add them
101 here. It is a string that will be copied into the C++ class instantiation.
102 Please add the brackets yourself, i.e. "(3,4,5)" is fine, but "3,4,5" is not.
103 The only exception is the empty parameter list. Here, you can/should simply
104 add the empty string.
113 Tell the project where to find Peano
115 Once we know where to find Peano, we can parse the configuration/makefile
116 there and know which compile parameters to use. We also know then where to
117 search for the static libraries.
119 @param src_path: string
120 Path (relative or absolute) to the src directory of Peano. This path
121 should hold both the headers (in subdirectories) and all the static
124 @param mode: peano4.output.CompileMode
134 Parse makefile of Peano to extract the configuration settings
136 We parse the configure script's/CMAKE outcome first via parse_configure_script_outcome().
137 After that, we set the dimension manually as well as the executable name and
138 the build mode. The values for these parameters step from set_Peano4_installation().
152 plot_after_each_mesh_sweep,
154 plotter_precision = 5,
158 Configure global simulation settings
160 @param offset: [Float]
163 should be lists with dimensions double entries.
172 if plotter_precision<=0:
173 raise Exception(
"Plotter precision has to be bigger than 0" )
186 Construct and return the Peano4 project, i.e. all the action sets et al that
187 you require to run this Peano4 application with PETSc.
205 self.
_project.output.readme.add_package_description(
"""
215 self.
dictionary[
"SOLVER_INSTANCES"] = [(x.typename(), x.instance_name())
for x
in self.
_solvers ]
216 self.
dictionary[
"AUX_SOLVER_INSTANCES"] = [(x.typename(), x.instance_name())
for x
in self.
_aux_solvers ]
222 templatefile_prefix = os.path.realpath(__file__).replace(
".pyc",
"" ).replace(
".py",
"" )
223 template_name = templatefile_prefix +
".SolverRepository.template"
225 template_name +
".h",
226 template_name +
".cpp",
229 self.
_project.subdirectory +
"repositories",
234 self.
_project.output.add( generated_repository_files )
235 self.
_project.output.makefile.add_h_file( self.
_project.subdirectory +
"repositories/SolverRepository.h", generated=
True )
236 self.
_project.output.makefile.add_cpp_file( self.
_project.subdirectory +
"repositories/SolverRepository.cpp", generated=
True )
243 Takes the solver and runs through the individual steps of the algorithm.
244 Per step, it tells the solver to inject its particular stuff to the
245 underlying observers.
247 The auxiliary flag allows us to distinguish the "main" solver from the
248 helpers. The rationale for this is that we only want to measure the
249 termination conditions for a subset of the solvers.
252 print(
"---------------------------------------")
253 print(
"Create data for solver " +solver._name )
254 print(
"---------------------------------------")
257 solver.add_to_Peano4_datamodel( self.
_project.datamodel, verbose=
False )
287 Export all the constrants of the project into a Configure.h file
289 We export ExaHyPE's constants. Besides the constants from ExaHyPE,
290 I also export some parameters from Peano onto the ExaHyPE constants
291 file. Therefore, it is important that you parse the configure output
292 before we export the constants.
305 self.
_project.constants.add_include(
"""#include <bitset>""")
306 self.
_project.constants.add_include(
"""#include "tarch/la/Vector.h" """)
307 self.
_project.constants.add_include(
"""#include "peano4/utils/Globals.h" """)
308 self.
_project.constants.export_const_with_type(
309 "DomainOffset", offset_string,
"tarch::la::Vector<Dimensions,double>"
311 self.
_project.constants.export_const_with_type(
312 "DomainSize", size_string,
"tarch::la::Vector<Dimensions,double>"
316 build_string =
"python3 "
320 self.
_project.constants.export_string(
"BuildInformation", build_string)
321 self.
_project.constants.export_string(
322 "ConfigureInformation", self.
_project.output.makefile.configure_call
325 self.
_project.output.readme.add_package_description(
328### Peano's multigrid extension
330This is yet to be written, and we need to have a paper on our work.
332 @article{Reinarz:2020:ExaHyPE,
333 title = {ExaHyPE: An engine for parallel dynamically adaptive simulations of wave problems},
334 journal = {Computer Physics Communications},
339 doi = {https://doi.org/10.1016/j.cpc.2020.107251},
340 url = {https://www.sciencedirect.com/science/article/pii/S001046552030076X},
341 author = {Anne Reinarz and Dominic E. Charrier and Michael Bader and Luke Bovard and Michael Dumbser and Kenneth Duru and Francesco Fambri and Alice-Agnes Gabriel and Jean-Matthieu Gallard and Sven K\"oppel and Lukas Krenz and Leonhard Rannabauer and Luciano Rezzolla and Philipp Samfass and Maurizio Tavelli and Tobias Weinzierl},
342 keywords = {Hyperbolic, PDE, ADER-DG, Finite volumes, AMR, MPI, TBB, MPI+X},
343 abstract = {ExaHyPE (An Exascale Hyperbolic PDE Engine) is a software engine for solving systems of first-order hyperbolic partial differential equations (PDEs). Hyperbolic PDEs are typically derived from the conservation laws of physics and are useful in a wide range of application areas. Applications powered by ExaHyPE can be run on a student's laptop, but are also able to exploit thousands of processor cores on state-of-the-art supercomputers. The engine is able to dynamically increase the accuracy of the simulation using adaptive mesh refinement where required. Due to the robustness and shock capturing abilities of ExaHyPE's numerical methods, users of the engine can simulate linear and non-linear hyperbolic PDEs with very high accuracy. Users can tailor the engine to their particular PDE by specifying evolved quantities, fluxes, and source terms. A complete simulation code for a new hyperbolic PDE can often be realised within a few hours - a task that, traditionally, can take weeks, months, often years for researchers starting from scratch. In this paper, we showcase ExaHyPE's workflow and capabilities through real-world scenarios from our two main application areas: seismology and astrophysics.
345 Program title: ExaHyPE-Engine Program Files doi: http://dx.doi.org/10.17632/6sz8h6hnpz.1 Licensing provisions: BSD 3-clause Programming languages: C++, Python, Fortran Nature of Problem: The ExaHyPE PDE engine offers robust algorithms to solve linear and non-linear hyperbolic systems of PDEs written in first order form. The systems may contain both conservative and non-conservative terms. Solution method: ExaHyPE employs the discontinuous Galerkin (DG) method combined with explicit one-step ADER (arbitrary high-order derivative) time-stepping. An a-posteriori limiting approach is applied to the ADER-DG solution, whereby spurious solutions are discarded and recomputed with a robust, patch-based finite volume scheme. ExaHyPE uses dynamical adaptive mesh refinement to enhance the accuracy of the solution around shock waves, complex geometries, and interesting features.
352 self.
_project.output.readme.add_entry(
353 i.create_readme_descriptor()
Here we recreate a multigrid project, without using PETSc.
set_global_simulation_parameters(self, dimensions, offset, domain_size, plot_after_each_mesh_sweep, max_iterations=100, plotter_precision=5)
Configure global simulation settings.
set_Peano4_installation(self, src_path, mode=peano4.output.CompileMode.Release)
Tell the project where to find Peano.
set_global_simulation_parameters(self, dimensions, offset, domain_size, plotter_precision=5)
offset and size should be lists with dimensions double entries.
algorithm_step_create_grid
__generate_solver_repository(self)
__export_constants(self)
Export all the constrants of the project into a Configure.h file.
__set_solver_repository_dict(self)
set_output_path(self, path)
generate_Peano4_project(self, verbose=False)
Build project.
__configure_makefile(self)
Parse makefile of Peano to extract the configuration settings.
set_load_balancing(self, load_balancer_name, load_balancer_arguments)
Set the load balancing scheme.
algorithm_step_init_solution
__init__(self, namespace, project_name, directory=".", executable="peano4matrixfree", subdirectory="", abstract_overwrite=True)
Create a matrix project.
add_solver(self, solver, auxiliary=False)
Add a new solver.
_plot_after_each_mesh_sweep
Represents a Peano 4 project.