Peano
Loading...
Searching...
No Matches
GlobalAdaptiveTimeStepInExaGRyPEWithEnclaveTasking.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.rkfd.SeparateSweepsWithEnclaveTasking import SeparateSweepsWithEnclaveTasking
5
6import jinja2
7
8from .kernels import create_FD4InExaGRyPE_kernel_definitions_3d
9from .kernels import create_DeriCalInExaGRyPE_kernel_definitions_3d
10from .kernels import create_compute_kernel_for_FD4InExaGRyPE_DSL
11from .kernels import create_derivative_calculation_kernel_for_FD4InExaGRyPE_DSL
12
13from exahype2.solvers.rkfd.kernels import create_abstract_solver_declarations
14from exahype2.solvers.rkfd.kernels import create_abstract_solver_definitions
15from exahype2.solvers.rkfd.kernels import create_solver_declarations
16from exahype2.solvers.rkfd.kernels import create_solver_definitions
17#
18from exahype2.solvers.rkfd.kernels import SolverVariant
19from exahype2.solvers.rkfd.kernels import KernelVariant
20
21from exahype2.solvers.rkfd.AdaptiveTimeSteppingCodeSnippets import AdaptiveTimeSteppingCodeSnippets
22
23
24
26 def __init__(self,
27 name, patch_size, rk_order, unknowns, auxiliary_variables, min_meshcell_h, max_meshcell_h, time_step_relaxation,
28 reconstruction_with_rk=False,
29 flux=PDETerms.User_Defined_Implementation,
30 ncp=PDETerms.None_Implementation,
31 point_source=PDETerms.None_Implementation,
32 boundary_conditions=PDETerms.User_Defined_Implementation,
33 refinement_criterion=PDETerms.Empty_Implementation,
34 initial_conditions=PDETerms.User_Defined_Implementation,
35 source_term=PDETerms.None_Implementation,
36 eigenvalues=PDETerms.User_Defined_Implementation,
37 pde_terms_without_state: bool = True,
38 plot_grid_properties=False, KOSigma=8.0
39 ):
40 """!
41
42 Construct solver
43
44
45 time_step_relaxation: Float
46 Calibration factor of CFL condition. The Runge-Kutta order is multiplied
47 with this value following the formula for Cockburn-Shu damping. However,
48 also the actual polynomial order has to enter the chosen time step size
49 through an additional @f$ p^{-2} @f$ scaling. We expect the user to
50 incorporate such an additional scaling within time_step_relaxation.
51
52 """
53
54
55 if reconstruction_with_rk:
57 else:
59
60 super(GlobalAdaptiveTimeStepInExaGRyPEWithEnclaveTasking,self).__init__(name,
61 patch_size,
62 3, #overlap,
63 rk_order,
64 unknowns,
65 auxiliary_variables,
66 min_meshcell_h,
67 max_meshcell_h,
68 plot_grid_properties,
69 kernel_namespace="fd4",
70 pde_terms_without_state=pde_terms_without_state,
71 )
72
73 self._time_step_relaxation = time_step_relaxation
75
76 self._KO_Sigma = KOSigma
77
79 ncp=ncp,
80 eigenvalues=eigenvalues,
81 boundary_conditions=boundary_conditions,
82 refinement_criterion=refinement_criterion,
83 initial_conditions=initial_conditions,
84 source_term=source_term )
85
86
88 flux=None, ncp=None, source_term=None, eigenvalues=None,
89 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,
90 memory_location = None,
91 additional_action_set_includes = "",
92 additional_user_includes = "",
93 KOSigma = None,
94 reconstruction_with_rk= False
95 ):
96 """
97 If you pass in User_Defined, then the generator will create C++ stubs
98 that you have to befill manually. If you pass in None_Implementation, it
99 will create nop, i.e. no implementation or defaults. Any other string
100 is copied 1:1 into the implementation. If you pass in None, then the
101 set value so far won't be overwritten.
102
103 Please note that not all options are supported by all solvers.
104
105 This routine should be the very last invoked by the constructor.
106 """
107 super(GlobalAdaptiveTimeStepInExaGRyPEWithEnclaveTasking,self).set_implementation(
108 flux, ncp, source_term, eigenvalues,
109 boundary_conditions, refinement_criterion, initial_conditions, memory_location, additional_action_set_includes, additional_user_includes)
110
111 if not KOSigma==None: self._KO_Sigma = KOSigma
112
113 create_FD4InExaGRyPE_kernel_definitions_3d()
114
115 self._compute_kernel_call_compute_kernel_call = create_compute_kernel_for_FD4InExaGRyPE_DSL(
119 compute_max_eigenvalue_of_next_time_step = True,
120 solver_variant = SolverVariant.WithVirtualFunctions,
121 kernel_variant = KernelVariant.PatchWiseAoSHeap,
122 KOSigma = self._KO_Sigma,
123 SecondOrder = reconstruction_with_rk
124 )
125 self._fused_compute_kernel_call_cpu_fused_compute_kernel_call_cpu = create_compute_kernel_for_FD4InExaGRyPE_DSL(
129 compute_max_eigenvalue_of_next_time_step = True,
130 solver_variant = SolverVariant.Stateless,
131 kernel_variant = KernelVariant.PatchWiseAoSHeap,
132 KOSigma = self._KO_Sigma,
133 SecondOrder = reconstruction_with_rk
134 )
135 self._fused_compute_kernel_call_gpu_fused_compute_kernel_call_gpu = create_compute_kernel_for_FD4InExaGRyPE_DSL(
139 compute_max_eigenvalue_of_next_time_step = True,
140 solver_variant = SolverVariant.AcceleratorWithExplicitCopy,
141 kernel_variant = KernelVariant.PatchWiseAoSHeap,
142 KOSigma = self._KO_Sigma,
143 SecondOrder = reconstruction_with_rk
144 )
145
146 if reconstruction_with_rk:
147 create_DeriCalInExaGRyPE_kernel_definitions_3d()
148
149 self._reconstruction_kernel_call_reconstruction_kernel_call=create_derivative_calculation_kernel_for_FD4InExaGRyPE_DSL(
150 solver_variant = SolverVariant.WithVirtualFunctions,
151 kernel_variant = KernelVariant.PatchWiseAoSHeap,
152 SecondOrder = reconstruction_with_rk)
153 self._primary_variables_indices_primary_variables_indices = "int primaryVarsIndices[25]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 53, 54};"
154 self._auxiliary_variables_indices_auxiliary_variables_indices = "int auxiliaryVarsIndices[34]={23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55,56,57,58}; "
155
157
159 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
161 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
162
163 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
164 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
165
168
169 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
170 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
171 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
172
174
175
176 @property
178 tem = super(GlobalAdaptiveTimeStepInExaGRyPEWithEnclaveTasking, self).user_action_set_includes + """
179#include "kernels/FD4InExaGRyPE.h"
180"""
182 tem = tem + """
183#include "kernels/DeriCallInExaGRyPE.h"
184"""
185
186 return tem
187
189 """!
190
191 Invoce superclass and then add one more field:
192
193 - RECONSTRUCTION_STAGES
194
195 """
196 super(GlobalAdaptiveTimeStepInExaGRyPEWithEnclaveTasking, self).add_entries_to_text_replacement_dictionary(d)
197 d["RECONSTRUCTION_STAGES"]=self._reconstruction_stages_reconstruction_stages
198
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
Enclave variant of the solver where we still run through mesh once per Runge-Kutta sweep.
create_action_sets(self)
Call superclass routine and then reconfigure the update cell call.
set_implementation(self, flux, ncp, source_term, eigenvalues, boundary_conditions, refinement_criterion, initial_conditions, memory_location, 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...
create_action_sets(self)
Call superclass routine and then reconfigure the update cell call.
__init__(self, name, patch_size, rk_order, unknowns, auxiliary_variables, min_meshcell_h, max_meshcell_h, time_step_relaxation, reconstruction_with_rk=False, flux=PDETerms.User_Defined_Implementation, ncp=PDETerms.None_Implementation, point_source=PDETerms.None_Implementation, boundary_conditions=PDETerms.User_Defined_Implementation, refinement_criterion=PDETerms.Empty_Implementation, initial_conditions=PDETerms.User_Defined_Implementation, source_term=PDETerms.None_Implementation, eigenvalues=PDETerms.User_Defined_Implementation, bool pde_terms_without_state=True, plot_grid_properties=False, KOSigma=8.0)
Construct solver.
set_implementation(self, flux=None, ncp=None, source_term=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, memory_location=None, additional_action_set_includes="", additional_user_includes="", KOSigma=None, reconstruction_with_rk=False)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
user_action_set_includes(self)
Add further includes to this property, if your action sets require some additional routines from othe...