Peano
Loading...
Searching...
No Matches
GlobalAdaptiveTimeStep.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from exahype2.solvers.PDETerms import PDETerms
4from exahype2.solvers.fv.SingleSweep import SingleSweep
5
6import jinja2
7
8from .kernels import create_compute_Riemann_kernel_for_MusclHancock
9from .kernels import create_abstract_solver_declarations
10from .kernels import create_abstract_solver_definitions
11from .kernels import create_solver_declarations
12from .kernels import create_solver_definitions
13
14from exahype2.solvers.fv.AdaptiveTimeSteppingCodeSnippets import AdaptiveTimeSteppingCodeSnippets
15
16from .kernels import SolverVariant
17from .kernels import RiemannKernelVariant
18
19
21 def __init__(self,
22 name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, time_step_relaxation,
23 flux=PDETerms.User_Defined_Implementation,
24 ncp=None,
25 eigenvalues=PDETerms.User_Defined_Implementation,
26 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,source_term=None,
27 plot_grid_properties=False, overlap=1, kernel_namespace="musclhancock"
28 ):
29 super(GlobalAdaptiveTimeStep,self).__init__(name, patch_size, overlap, unknowns, auxiliary_variables, min_volume_h, max_volume_h, plot_grid_properties, kernel_namespace="musclhancock")
30
31 self._time_step_relaxation = time_step_relaxation
32
33 self._flux_implementation_flux_implementation = PDETerms.None_Implementation
34 self._ncp_implementation_ncp_implementation = PDETerms.None_Implementation
37
39
41 ncp=ncp,
42 eigenvalues=eigenvalues,
43 boundary_conditions=boundary_conditions,
44 refinement_criterion=refinement_criterion,
45 initial_conditions=initial_conditions,
46 source_term=source_term )
47
48
50 flux=None,ncp=None,
51 eigenvalues=None,
52 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,source_term=None,
53 memory_location = None,
54 use_split_loop = False,
55 additional_action_set_includes = "",
56 additional_user_includes = ""
57 ):
58 """
59 If you pass in User_Defined, then the generator will create C++ stubs
60 that you have to befill manually. If you pass in None_Implementation, it
61 will create nop, i.e. no implementation or defaults. Any other string
62 is copied 1:1 into the implementation. If you pass in None, then the
63 set value so far won't be overwritten.
64
65 Please note that not all options are supported by all solvers.
66
67 This routine should be the very last invoked by the constructor.
68 """
69 if flux is not None: self._flux_implementation_flux_implementation = flux
70 if ncp is not None: self._ncp_implementation_ncp_implementation = ncp
71 if eigenvalues is not None: self._eigenvalues_implementation_eigenvalues_implementation = eigenvalues
72 if source_term is not None: self._source_term_implementation_source_term_implementation = source_term
73
74 self._compute_kernel_call_compute_kernel_call = create_compute_Riemann_kernel_for_MusclHancock(
76 compute_max_eigenvalue_of_next_time_step=True,
77 solver_variant = SolverVariant.WithVirtualFunctions,
78 riemann_kernel_variant = RiemannKernelVariant.PatchWiseAoSHeap
79 )
80
82
84 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
86 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
87
90
91 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
92 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
93
94 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
95 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
96 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
97
98 super(GlobalAdaptiveTimeStep,self).set_implementation(boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
99
100
101 @property
103 return super(GlobalAdaptiveTimeStep, self).user_action_set_includes + """
104#include "exahype2/fv/musclhancock/MusclHancock.h"
105"""
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
Probably the simplest solver you could think off.
set_implementation(self, boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, memory_location=None, use_split_loop=False, additional_action_set_includes="", additional_user_includes="")
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
__init__(self, name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, time_step_relaxation, flux=PDETerms.User_Defined_Implementation, ncp=None, eigenvalues=PDETerms.User_Defined_Implementation, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, plot_grid_properties=False, overlap=1, kernel_namespace="musclhancock")
Instantiate a generic FV scheme with an overlap of 1.
user_action_set_includes(self)
Add further includes to this property, if your action sets require some additional routines from othe...