Peano
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_MusclHancock
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 RiemannKernelVariant
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=None,
25 eigenvalues=PDETerms.User_Defined_Implementation,
26 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,source_term=None,
27 plot_grid_properties=False, overlap=1, kernel_namespace="musclhancock"
28 ):
29 """
30
31 time_step_size: Float
32 This is the normalised time step size w.r.t. the coarsest admissible h value. If
33 the code employs AMR on top of it and refines further, it will automatically
34 downscale the time step size accordingly. So hand in a valid time step size w.r.t.
35 to max_volume_h.
36
37 """
38 super(GlobalFixedTimeStep,self).__init__(name, patch_size, overlap, unknowns, auxiliary_variables, min_volume_h, max_volume_h, plot_grid_properties, kernel_namespace="musclhancock")
39
40 self._normalised_time_step_size = normalised_time_step_size
41
42 self._flux_implementation_flux_implementation = PDETerms.None_Implementation
43 self._ncp_implementation_ncp_implementation = PDETerms.None_Implementation
46
48#include "exahype2/fv/musclhancock/MusclHancock.h"
49"""
50
52 ncp=ncp,
53 eigenvalues=eigenvalues,
54 boundary_conditions=boundary_conditions,
55 refinement_criterion=refinement_criterion,
56 initial_conditions=initial_conditions,
57 source_term=source_term )
58
59
61 flux=None,ncp=None,
62 eigenvalues=None,
63 boundary_conditions=None,refinement_criterion=None,initial_conditions=None,source_term=None,
64 memory_location = None,
65 use_split_loop = False,
66 additional_action_set_includes = "",
67 additional_user_includes = ""
68 ):
69 """
70 If you pass in User_Defined, then the generator will create C++ stubs
71 that you have to befill manually. If you pass in None_Implementation, it
72 will create nop, i.e. no implementation or defaults. Any other string
73 is copied 1:1 into the implementation. If you pass in None, then the
74 set value so far won't be overwritten.
75
76 Please note that not all options are supported by all solvers.
77
78 This routine should be the very last invoked by the constructor.
79 """
80 if flux is not None: self._flux_implementation_flux_implementation = flux
81 if ncp is not None: self._ncp_implementation_ncp_implementation = ncp
82 if eigenvalues is not None: self._eigenvalues_implementation_eigenvalues_implementation = eigenvalues
83 if source_term is not None: self._source_term_implementation_source_term_implementation = source_term
84
85 self._compute_kernel_call_compute_kernel_call = create_compute_Riemann_kernel_for_MusclHancock(
87 compute_max_eigenvalue_of_next_time_step=False,
88 solver_variant = SolverVariant.WithVirtualFunctions,
89 riemann_kernel_variant = RiemannKernelVariant.PatchWiseAoSHeap
90 )
91
92 solver_code_snippets = FixedTimeSteppingCodeSnippets(self._normalised_time_step_size,False)
93
95 self._abstract_solver_user_declarations_abstract_solver_user_declarations += solver_code_snippets.create_abstract_solver_user_declarations()
97 self._abstract_solver_user_definitions_abstract_solver_user_definitions += solver_code_snippets.create_abstract_solver_user_definitions()
98
99 self._compute_time_step_size_compute_time_step_size = solver_code_snippets.create_compute_time_step_size()
100 self._compute_new_time_step_size_compute_new_time_step_size = solver_code_snippets.create_compute_new_time_step_size()
101
104
105 self._start_time_step_implementation_start_time_step_implementation = solver_code_snippets.create_start_time_step_implementation()
106 self._finish_time_step_implementation_finish_time_step_implementation = solver_code_snippets.create_finish_time_step_implementation()
107 self._constructor_implementation_constructor_implementation = solver_code_snippets.create_abstract_solver_constructor_statements()
108
109 super(GlobalFixedTimeStep,self).set_implementation(boundary_conditions, refinement_criterion, initial_conditions, memory_location, use_split_loop, additional_action_set_includes, additional_user_includes)
110
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...
__init__(self, name, patch_size, unknowns, auxiliary_variables, min_volume_h, max_volume_h, normalised_time_step_size, flux=PDETerms.User_Defined_Implementation, ncp=None, eigenvalues=PDETerms.User_Defined_Implementation, boundary_conditions=None, refinement_criterion=None, initial_conditions=None, source_term=None, plot_grid_properties=False, overlap=1, kernel_namespace="musclhancock")
time_step_size: Float This is the normalised time step size w.r.t.
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...