Peano 4
Loading...
Searching...
No Matches
GlobalFixedTimeStep.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_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.FixedTimeSteppingCodeSnippets import FixedTimeSteppingCodeSnippets
18
19
21 def __init__(self,
22 name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, normalised_time_step_size,
23 flux=PDETerms.User_Defined_Implementation,
24 ncp=PDETerms.None_Implementation,
25 eigenvalues=PDETerms.User_Defined_Implementation,
26 boundary_conditions=PDETerms.User_Defined_Implementation,
27 refinement_criterion=PDETerms.Empty_Implementation,
28 initial_conditions=PDETerms.User_Defined_Implementation,
29 source_term=PDETerms.None_Implementation,
30 plot_grid_properties=False,
31 pde_terms_without_state=False, overlap=1
32 ):
33 """
34 time_step_size: Float
35 This is the normalised time step size w.r.t. the coarsest admissible h value. If
36 the code employs AMR on top of it and refines further, it will automatically
37 downscale the time step size accordingly. So hand in a valid time step size w.r.t.
38 to max_volume_h.
39 """
40 super(GlobalFixedTimeStep,self).__init__(name,
41 patch_size,
42 overlap,
43 unknowns,
44 auxiliary_variables,
45 min_volume_h,
46 max_volume_h,
47 plot_grid_properties,
48 pde_terms_without_state,
49 kernel_namespace="rusanov")
50 self._normalised_time_step_size = normalised_time_step_size
51
52 self._flux_implementation_flux_implementation = PDETerms.None_Implementation
53 self._ncp_implementation_ncp_implementation = PDETerms.None_Implementation
56
58
60#include "exahype2/fv/rusanov/rusanov.h"
61"""
62
64 flux=flux,
65 ncp=ncp,
66 eigenvalues=eigenvalues,
67 boundary_conditions=boundary_conditions,
68 refinement_criterion=refinement_criterion,
69 initial_conditions=initial_conditions,
70 source_term=source_term
71 )
72
73
75 flux = None,
76 ncp = None,
77 eigenvalues = None,
78 boundary_conditions = None,
79 refinement_criterion = None,
80 initial_conditions = None,
81 source_term = None,
82 memory_location = None,
83 use_split_loop = False,
84 additional_action_set_includes = "",
85 additional_user_includes = ""
86 ):
87 """
88 If you pass in User_Defined, then the generator will create C++ stubs
89 that you have to befill manually. If you pass in None_Implementation, it
90 will create nop, i.e., no implementation or defaults. Any other string
91 is copied 1:1 into the implementation. If you pass in None, then the
92 set value so far won't be overwritten.
93
94 Please note that not all options are supported by all solvers. You
95 cannot set ncp and fluxes for the ClawPack Riemann solvers, e.g.
96
97 This routine should be the very last invoked by the constructor.
98 """
99 if flux is not None: self._flux_implementation_flux_implementation = flux
100 if ncp is not None: self._ncp_implementation_ncp_implementation = ncp
101 if eigenvalues is not None: self._eigenvalues_implementation_eigenvalues_implementation = eigenvalues
102 if source_term is not None: self._source_term_implementation_source_term_implementation = source_term
103
104 self._compute_kernel_call_compute_kernel_call = create_compute_Riemann_kernel_for_Rusanov(
108 compute_max_eigenvalue_of_next_time_step = False,
109 solver_variant = SolverVariant.WithVirtualFunctions,
110 kernel_variant = KernelVariant.PatchWiseAoS
111 )
112
113 self._compute_kernel_call_stateless_compute_kernel_call_stateless = create_compute_Riemann_kernel_for_Rusanov(
117 compute_max_eigenvalue_of_next_time_step = False,
118 solver_variant = SolverVariant.Stateless,
119 kernel_variant = KernelVariant.PatchWiseAoS
120 )
121
122 solver_code_snippets = FixedTimeSteppingCodeSnippets(self._normalised_time_step_size,False)
123
125 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
127 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
128
129 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
130 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
131
134
135 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
136 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
137 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
138
139 super(GlobalFixedTimeStep,self).set_implementation(boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
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, normalised_time_step_size, 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)
time_step_size: Float This is the normalised time step size w.r.t.