Peano
Loading...
Searching...
No Matches
kernels.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
3import exahype2
4
6from exahype2.solvers.rkdg.actionsets.ProjectLinearCombinationOfEstimatesOntoFaces import compute_number_of_face_projection_quantities
7
8def create_Riemann_solver_call(polynomial_basis,
9 face_projections: FaceProjections):
10 """
11 number_of_face_projections: Integer
12 How many quantities are to be projected onto the face. If you pass in one,
13 this means that only the left and right values are projected onto the face.
14 If you pass in two, we store the values plus the projections of the
15 derivative along the normal per face.
16 """
17
18 if isinstance( polynomial_basis, exahype2.solvers.GaussLegendreBasis) and face_projections==FaceProjections.Solution:
19 return """solveRiemannProblem_pointwise_in_situ(
20 [&](
21 const double * __restrict__ Q,
22 const tarch::la::Vector<Dimensions,double>& x,
23 double t,
24 double dt,
25 int normal,
26 double * __restrict__ F
27 )->void {
28 {% if FLUX_IMPLEMENTATION!="<none>" %}
29 repositories::{{SOLVER_INSTANCE}}.flux(Q,x,t,dt,normal,F);
30 {% endif %}
31 }, //flux
32 [&](
33 const double * __restrict__ Q,
34 const double * __restrict__ deltaQ,
35 const tarch::la::Vector<Dimensions,double>& x,
36 double t,
37 double dt,
38 int normal,
39 double * __restrict__ F
40 ) -> void {
41 {% if NCP_IMPLEMENTATION!="<none>" %}
42 repositories::{{SOLVER_INSTANCE}}.nonconservativeProduct(Q, deltaQ, x, t, dt, normal, F);
43 {% endif %}
44 }, //ncp
45 [&](
46 const double * __restrict__ Q,
47 const tarch::la::Vector<Dimensions,double>& x,
48 double t,
49 double dt,
50 int normal
51 ) -> double {
52 return repositories::{{SOLVER_INSTANCE}}.maxEigenvalue(Q, x, t, dt, normal);
53 }, // maxEigenvalue
54 marker.x(),
55 marker.h(),
56 timeStamp,
57 timeStepSize,
58 {{ORDER}},
59 {{NUMBER_OF_UNKNOWNS}},
60 {{NUMBER_OF_AUXILIARY_VARIABLES}},
61 marker.getSelectedFaceNumber(),
62 repositories::{{SOLVER_INSTANCE}}.QuadraturePoints1d,
63 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
64 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
65 fineGridFace{{UNKNOWN_IDENTIFIER}}EstimateProjection.value,
66 fineGridFace{{UNKNOWN_IDENTIFIER}}RiemannSolution.value
67 );
68"""
69 elif isinstance( polynomial_basis, exahype2.solvers.GaussLegendreBasis) and number_of_face_projections==2:
70 return """solveRiemannProblem_pointwise_in_situ_with_gradient_projection(
71 [&](
72 const double * __restrict__ Q,
73 const tarch::la::Vector<Dimensions,double>& x,
74 double t,
75 double dt,
76 int normal,
77 double * __restrict__ F
78 )->void {
79 {% if FLUX_IMPLEMENTATION!="<none>" %}
80 repositories::{{SOLVER_INSTANCE}}.flux(Q,x,t,dt,normal,F);
81 {% endif %}
82 }, //flux
83 [&](
84 const double * __restrict__ Q,
85 const double * __restrict__ deltaQ,
86 const tarch::la::Vector<Dimensions,double>& x,
87 double t,
88 double dt,
89 int normal,
90 double * __restrict__ F
91 ) -> void {
92 {% if NCP_IMPLEMENTATION!="<none>" %}
93 repositories::{{SOLVER_INSTANCE}}.nonconservativeProduct(Q, deltaQ, x, t, dt, normal, F);
94 {% endif %}
95 }, //ncp
96 [&](
97 const double * __restrict__ Q,
98 const tarch::la::Vector<Dimensions,double>& x,
99 double t,
100 double dt,
101 int normal
102 ) -> double {
103 return repositories::{{SOLVER_INSTANCE}}.maxEigenvalue(Q, x, t, dt, normal);
104 }, // maxEigenvalue
105 marker.x(),
106 marker.h(),
107 timeStamp,
108 timeStepSize,
109 {{ORDER}},
110 {{NUMBER_OF_UNKNOWNS}},
111 {{NUMBER_OF_AUXILIARY_VARIABLES}},
112 marker.getSelectedFaceNumber(),
113 repositories::{{SOLVER_INSTANCE}}.QuadraturePoints1d,
114 {{ "true" if FLUX_IMPLEMENTATION!="<none>" else "false" }}, //useFlux
115 {{ "true" if NCP_IMPLEMENTATION!="<none>" else "false" }}, //useNCP
116 fineGridFace{{UNKNOWN_IDENTIFIER}}EstimateProjection.value,
117 fineGridFace{{UNKNOWN_IDENTIFIER}}RiemannSolution.value
118 );
119"""
120 else:
121 assert False, "not implemented"
122 return "#not implemented"
The Gauss-Legendre Basis is by construction the only basis which yields diagonal mass matrices.
create_Riemann_solver_call(polynomial_basis, FaceProjections face_projections)
number_of_face_projections: Integer How many quantities are to be projected onto the face.
Definition kernels.py:9