Peano
Loading...
Searching...
No Matches
GlobalAdaptiveTimeStepWithEnclaveTasking.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_compute_kernel_for_FD4
9
10from exahype2.solvers.rkfd.kernels import create_abstract_solver_declarations
11from exahype2.solvers.rkfd.kernels import create_abstract_solver_definitions
12from exahype2.solvers.rkfd.kernels import create_solver_declarations
13from exahype2.solvers.rkfd.kernels import create_solver_definitions
14#
15from exahype2.solvers.rkfd.kernels import SolverVariant
16from exahype2.solvers.rkfd.kernels import KernelVariant
17
18from exahype2.solvers.rkfd.AdaptiveTimeSteppingCodeSnippets import AdaptiveTimeSteppingCodeSnippets
19
20
21
23 def __init__(self,
24 name, patch_size, rk_order, unknowns, auxiliary_variables, min_meshcell_h, max_meshcell_h, time_step_relaxation,
25 reconstruction_with_rk=False,
26 flux=PDETerms.User_Defined_Implementation,
27 ncp=PDETerms.None_Implementation,
28 point_source=PDETerms.None_Implementation,
29 boundary_conditions=PDETerms.User_Defined_Implementation,
30 refinement_criterion=PDETerms.Empty_Implementation,
31 initial_conditions=PDETerms.User_Defined_Implementation,
32 source_term=PDETerms.None_Implementation,
33 eigenvalues=PDETerms.User_Defined_Implementation,
34 pde_terms_without_state: bool = False,
35 plot_grid_properties=False, KOSigma=8.0
36 ):
37 """!
38
39 Construct solver
40
41
42 time_step_relaxation: Float
43 Calibration factor of CFL condition. The Runge-Kutta order is multiplied
44 with this value following the formula for Cockburn-Shu damping. However,
45 also the actual polynomial order has to enter the chosen time step size
46 through an additional @f$ p^{-2} @f$ scaling. We expect the user to
47 incorporate such an additional scaling within time_step_relaxation.
48
49 """
50
51
52 if reconstruction_with_rk:
54 else:
56
57 super(GlobalAdaptiveTimeStepWithEnclaveTasking,self).__init__(name,
58 patch_size,
59 3, #overlap,
60 rk_order,
61 unknowns,
62 auxiliary_variables,
63 min_meshcell_h,
64 max_meshcell_h,
65 plot_grid_properties,
66 kernel_namespace="fd4",
67 pde_terms_without_state=pde_terms_without_state,
68 )
69
70 self._time_step_relaxation = time_step_relaxation
72
73 self._KO_Sigma = KOSigma
74
76 ncp=ncp,
77 eigenvalues=eigenvalues,
78 boundary_conditions=boundary_conditions,
79 refinement_criterion=refinement_criterion,
80 initial_conditions=initial_conditions,
81 source_term=source_term )
82
83
85 flux=None, ncp=None, source_term=None, eigenvalues=None,
86 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,
87 memory_location = None,
88 additional_action_set_includes = "",
89 additional_user_includes = "",
90 KOSigma = None
91 ):
92 """
93 If you pass in User_Defined, then the generator will create C++ stubs
94 that you have to befill manually. If you pass in None_Implementation, it
95 will create nop, i.e. no implementation or defaults. Any other string
96 is copied 1:1 into the implementation. If you pass in None, then the
97 set value so far won't be overwritten.
98
99 Please note that not all options are supported by all solvers.
100
101 This routine should be the very last invoked by the constructor.
102 """
103 super(GlobalAdaptiveTimeStepWithEnclaveTasking,self).set_implementation(
104 flux, ncp, source_term, eigenvalues,
105 boundary_conditions, refinement_criterion, initial_conditions, memory_location, additional_action_set_includes, additional_user_includes)
106
107 if not KOSigma==None: self._KO_Sigma = KOSigma
108
109 self._compute_kernel_call_compute_kernel_call = create_compute_kernel_for_FD4(
113 compute_max_eigenvalue_of_next_time_step = True,
114 solver_variant = SolverVariant.WithVirtualFunctions,
115 kernel_variant = KernelVariant.PatchWiseAoSHeap,
116 KOSigma = self._KO_Sigma
117 )
122 compute_max_eigenvalue_of_next_time_step = True,
123 solver_variant = SolverVariant.Stateless,
124 kernel_variant = KernelVariant.PatchWiseAoSHeap,
125 #solver_variant = SolverVariant.Multicore,
126 #kernel_variant = KernelVariant.BatchedAoSHeap,
127 KOSigma = self._KO_Sigma
128 )
133 compute_max_eigenvalue_of_next_time_step = True,
134 solver_variant = SolverVariant.AcceleratorWithExplicitCopy,
135 kernel_variant = KernelVariant.PatchWiseAoSHeap,
136 KOSigma = self._KO_Sigma
137 )
138
140
142 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
144 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
145
146 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
147 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
148
151
152 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
153 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
154 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
155
157
158
159 @property
161 return super(GlobalAdaptiveTimeStepWithEnclaveTasking, self).user_action_set_includes + """
162#include "exahype2/fd/fd4/FD4.h"
163"""
164
166 """!
167
168 Invoce superclass and then add one more field:
169
170 - RECONSTRUCTION_STAGES
171
172 """
173 super(GlobalAdaptiveTimeStepWithEnclaveTasking, self).add_entries_to_text_replacement_dictionary(d)
174 d["RECONSTRUCTION_STAGES"]=self._reconstruction_stages_reconstruction_stages
175
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.
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)
If you pass in User_Defined, then the generator will create C++ stubs that you have to befill manuall...
__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=False, plot_grid_properties=False, KOSigma=8.0)
Construct solver.
user_action_set_includes(self)
Add further includes to this property, if your action sets require some additional routines from othe...