Peano 4
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.rkdg.SeparateSweeps import SeparateSweeps
5
6from exahype2.solvers.rkdg.kernels import create_abstract_solver_declarations
7from exahype2.solvers.rkdg.kernels import create_abstract_solver_definitions
8from exahype2.solvers.rkdg.kernels import create_solver_declarations
9from exahype2.solvers.rkdg.kernels import create_solver_definitions
10
11from exahype2.solvers.rkdg.kernels import SolverVariant
12
13from exahype2.solvers.rkdg.kernels import create_volumetric_solver_call
14from exahype2.solvers.rkdg.kernels import create_add_solver_contributions_call
15from exahype2.solvers.rkdg.kernels import create_multiply_with_inverted_mass_matrix_call
16from exahype2.solvers.rkdg.rusanov.kernels import create_Riemann_solver_call
17
18from exahype2.solvers.rkdg.AdaptiveTimeSteppingCodeSnippets import AdaptiveTimeSteppingCodeSnippets
19
20
22 def __init__(self,
23 name,
24 rk_order,
25 polynomials,
26 face_projections,
27 unknowns,
28 auxiliary_variables,
29 min_cell_h,
30 max_cell_h,
31 time_step_relaxation,
32 flux=PDETerms.User_Defined_Implementation,
33 eigenvalues=PDETerms.User_Defined_Implementation,
34 ncp=PDETerms.None_Implementation,
35 point_source=PDETerms.None_Implementation,
36 boundary_conditions=PDETerms.User_Defined_Implementation,
37 refinement_criterion=PDETerms.Empty_Implementation,
38 initial_conditions=PDETerms.User_Defined_Implementation,
39 source_term=PDETerms.None_Implementation,
40 plot_grid_properties=False,
41 pde_terms_without_state=False,
42 ):
43 super(GlobalAdaptiveTimeStep,self).__init__(name, rk_order, polynomials, face_projections, unknowns, auxiliary_variables, min_cell_h, max_cell_h, plot_grid_properties, pde_terms_without_state)
44
45 self._time_step_relaxation = time_step_relaxation
47
49 self._volumetric_compute_kernel_call_volumetric_compute_kernel_call = create_volumetric_solver_call(self._basis, SolverVariant.WithVirtualFunctions)
50 self._volumetric_compute_kernel_call_stateless_volumetric_compute_kernel_call_stateless = create_volumetric_solver_call(self._basis, SolverVariant.Stateless)
51 self._Riemann_compute_kernel_call_Riemann_compute_kernel_call = create_Riemann_solver_call(self._basis, face_projections)
52 # TODO: self._Riemann_compute_kernel_call_stateless =
53 self._add_solver_contributions_call_add_solver_contributions_call = create_add_solver_contributions_call(self._basis)
54 self._multiply_with_inverted_mass_matrix_call_multiply_with_inverted_mass_matrix_call = create_multiply_with_inverted_mass_matrix_call(self._basis)
55
56 self.set_implementationset_implementation(boundary_conditions=boundary_conditions,
57 refinement_criterion=refinement_criterion,
58 initial_conditions=initial_conditions,
59 additional_action_set_includes="",
60 additional_user_includes="",
61 flux=flux,
62 eigenvalues=eigenvalues,
63 ncp=ncp,
64 source_term=source_term,
65 point_source=point_source
66 )
67
68
70 flux=None,
71 ncp=None,
72 eigenvalues=None,
73 boundary_conditions=None,
74 refinement_criterion=None,
75 initial_conditions=None,
76 source_term=None,
77 point_source=None,
78 additional_action_set_includes = "",
79 additional_user_includes = ""
80 ):
81 """
82 If you pass in User_Defined, then the generator will create C++ stubs
83 that you have to befill manually. If you pass in None_Implementation, it
84 will create nop, i.e., no implementation or defaults. Any other string
85 is copied 1:1 into the implementation. If you pass in None, then the
86 set value so far won't be overwritten.
87
88 Please note that not all options are supported by all solvers. You
89 cannot set ncp and fluxes for the ClawPack Riemann solvers, e.g.
90
91 This routine should be the very last invoked by the constructor.
92 """
93 super(GlobalAdaptiveTimeStep,self).set_implementation(boundary_conditions=boundary_conditions,
94 refinement_criterion=refinement_criterion,
95 initial_conditions=initial_conditions,
96 additional_action_set_includes=additional_action_set_includes,
97 additional_user_includes=additional_user_includes,
98 flux=flux,
99 ncp=ncp,
100 eigenvalues=eigenvalues,
101 source_term=source_term,
102 point_source=point_source
103 )
104
106
108 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
110 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
111
114
115 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
116 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
117
118 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
119 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
120 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
121
122
123 @property
125 return super(GlobalAdaptiveTimeStep, self).user_action_set_includes + """
126#include "exahype2/dg/rusanov/Rusanov.h"
127"""
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, point_source=None, 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...
Probably the simplest solver you could think off.
set_implementation(self, flux=None, ncp=None, eigenvalues=None, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, point_source=None, 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, rk_order, polynomials, face_projections, unknowns, auxiliary_variables, min_cell_h, max_cell_h, time_step_relaxation, flux=PDETerms.User_Defined_Implementation, eigenvalues=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, plot_grid_properties=False, pde_terms_without_state=False)
The super call invokes the creation of the data sets, where the guards have to be known already.
user_action_set_includes(self)
Add further includes to this property, if your action sets require some additional routines from othe...