Peano 4
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.fv.EnclaveTasking import EnclaveTasking
5
6import jinja2
7
8from .kernels import create_compute_Riemann_kernel_for_Rusanov
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 .kernels import SolverVariant
15from .kernels import KernelVariant
16
17from exahype2.solvers.fv.AdaptiveTimeSteppingCodeSnippets import AdaptiveTimeSteppingCodeSnippets
18
19from .kernels import SolverVariant
20
21
23 def __init__(self,
24 name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, time_step_relaxation,
25 flux=PDETerms.User_Defined_Implementation,
26 ncp=PDETerms.None_Implementation,
27 eigenvalues=PDETerms.User_Defined_Implementation,
28 boundary_conditions=PDETerms.User_Defined_Implementation,
29 refinement_criterion=PDETerms.Empty_Implementation,
30 initial_conditions=PDETerms.User_Defined_Implementation,
31 source_term=PDETerms.None_Implementation,
32 plot_grid_properties=False,
33 pde_terms_without_state=False, overlap=1
34 ):
35 super(GlobalAdaptiveTimeStepWithEnclaveTasking,self).__init__(name,
36 patch_size,
37 overlap,
38 unknowns,
39 auxiliary_variables,
40 min_volume_h,
41 max_volume_h,
42 plot_grid_properties,
43 pde_terms_without_state,
44 kernel_namespace="rusanov")
45 self._time_step_relaxation = time_step_relaxation
46
47 self._flux_implementation_flux_implementation = PDETerms.None_Implementation
48 self._ncp_implementation_ncp_implementation = PDETerms.None_Implementation
51
53
55 ncp=ncp,
56 eigenvalues=eigenvalues,
57 boundary_conditions=boundary_conditions,
58 refinement_criterion=refinement_criterion,
59 initial_conditions=initial_conditions,
60 source_term=source_term)
61
62
64 flux=None,ncp=None,
65 eigenvalues=None,
66 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,source_term=None,
67 memory_location = None,
68 use_split_loop = False,
69 additional_action_set_includes = "",
70 additional_user_includes = ""
71 ):
72 """
73 If you pass in User_Defined, then the generator will create C++ stubs
74 that you have to befill manually. If you pass in None_Implementation, it
75 will create nop, i.e., no implementation or defaults. Any other string
76 is copied 1:1 into the implementation. If you pass in None, then the
77 set value so far won't be overwritten.
78
79 Please note that not all options are supported by all solvers. You
80 cannot set ncp and fluxes for the ClawPack Riemann solvers, e.g.
81
82 This routine should be the very last invoked by the constructor.
83 """
84 if flux is not None: self._flux_implementation_flux_implementation = flux
85 if ncp is not None: self._ncp_implementation_ncp_implementation = ncp
86 if eigenvalues is not None: self._eigenvalues_implementation_eigenvalues_implementation = eigenvalues
87 if source_term is not None: self._source_term_implementation_source_term_implementation = source_term
88
89 self._compute_kernel_call_compute_kernel_call = create_compute_Riemann_kernel_for_Rusanov(
93 compute_max_eigenvalue_of_next_time_step = True,
94 solver_variant = SolverVariant.WithVirtualFunctions,
95 kernel_variant = KernelVariant.PatchWiseAoS
96 )
97
98 self._compute_kernel_call_stateless_compute_kernel_call_stateless = create_compute_Riemann_kernel_for_Rusanov(
102 compute_max_eigenvalue_of_next_time_step = True,
103 solver_variant = SolverVariant.Stateless,
104 kernel_variant = KernelVariant.PatchWiseAoS
105 )
106
111 compute_max_eigenvalue_of_next_time_step = True,
112 solver_variant = SolverVariant.Stateless,
113 kernel_variant = KernelVariant.PatchWiseAoS
114 )
115
120 compute_max_eigenvalue_of_next_time_step = True,
121 solver_variant = SolverVariant.Accelerator,
122 kernel_variant = KernelVariant.PatchWiseAoS
123 )
124
126
128 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
130 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
131
134
135 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
136 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
137
138 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
139 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
140 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
141
142 super(GlobalAdaptiveTimeStepWithEnclaveTasking,self).set_implementation(boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
143
144
146 super(GlobalAdaptiveTimeStepWithEnclaveTasking,self).create_data_structures()
148
149
150 @property
152 return super(GlobalAdaptiveTimeStepWithEnclaveTasking, self).user_action_set_includes + """
153#include "exahype2/fv/rusanov/rusanov.h"
154"""
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
Enclave tasking variant of the Finite Volume scheme.
_optimise_patch_storage_for_global_time_stepping(self)
Make storage and loading more restrictive such that enclave data are not held in-between primary and ...
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...
create_data_structures(self)
This routine does not really add new data, but it heavily tailors when data are stored,...
user_action_set_includes(self)
Add further includes to this property, if your action sets require some additional routines from othe...
__init__(self, name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, time_step_relaxation, flux=PDETerms.User_Defined_Implementation, ncp=PDETerms.None_Implementation, eigenvalues=PDETerms.User_Defined_Implementation, boundary_conditions=PDETerms.User_Defined_Implementation, refinement_criterion=PDETerms.Empty_Implementation, initial_conditions=PDETerms.User_Defined_Implementation, source_term=PDETerms.None_Implementation, plot_grid_properties=False, pde_terms_without_state=False, overlap=1)
Not so nice.
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...