Peano
Loading...
Searching...
No Matches
NonconservativeProduct.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 __future__ import annotations
4
5from .PDETerm import PDETerm
6
7
9 """!
10
11 The non-conservative product B(Q) applied to a jump deltaQ in a given
12 direction, i.e. BTimesDeltaQ = B(Q) * deltaQ
13
14 The signature matches ::exahype2::fv::rusanov::NonconservativeProductFunctor,
15 i.e. what the Rusanov kernels hand over:
16
17 @code
18 virtual void nonconservativeProduct(
19 const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
20 const double* __restrict__ deltaQ, // deltaQ[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
21 const tarch::la::Vector<Dimensions, double>& x,
22 const tarch::la::Vector<Dimensions, double>& volumeSize,
23 double t,
24 double dt,
25 int normal,
26 double* __restrict__ BTimesDeltaQ // BTimesDeltaQ[{{NUMBER_OF_UNKNOWNS}}]
27 );
28 @endcode
29
30 The kernels evaluate the term on each face of a volume: Q is the average
31 of the two adjacent volumes, deltaQ the difference right minus left (or
32 top minus bottom, ...) along normal. Both include the auxiliary
33 variables, so a term can use the jump of a material parameter, e.g. of
34 a bathymetry. The output only holds unknowns entries.
35
36 The size of the volume is called volumeSize rather than h - as it is in
37 the legacy API - as h frequently is the name of an unknown, e.g. the
38 water height of the shallow water equations.
39
40 """
41
42 SIGNATURE = (
43 "const double* __restrict__ Q, "
44 "const double* __restrict__ deltaQ, "
45 "const tarch::la::Vector<Dimensions, double>& x, "
46 "const tarch::la::Vector<Dimensions, double>& volumeSize, "
47 "double t, "
48 "double dt, "
49 "int normal, "
50 "double* __restrict__ BTimesDeltaQ"
51 )
52
53 NAME = "nonconservativeProduct"
54
56 self,
57 implementation: str = None,
58 stateless: bool = False,
59 ):
60 """!
61
62 implementation: str
63 A C++ snippet that becomes nonconservativeProduct()'s body (the
64 empty string is a valid, generated no-op body), or None (the
65 default) to leave nonconservativeProduct() pure virtual for you to
66 implement by hand. Don't add this term to a solver at all if the
67 PDE has no non-conservative contribution.
68
69 """
70 super().__init__(
71 name=self.NAMENAME,
72 implementation=implementation,
73 stateless=stateless,
74 )
75
77 """!
78
79 NonconservativeProduct-specific code generation
80
81 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
82 as-is - NonconservativeProduct.SIGNATURE is picked up automatically.
83 Declared explicitly (rather than left to be inherited implicitly)
84 for the same reason as Flux.Generator: the obvious place to add
85 nonconservativeProduct-specific generation behaviour later, and so
86 ncp_term.generator reports its type as
87 NonconservativeProduct.Generator rather than the more generic
88 PDETerm.Generator.
89
90 """
The non-conservative product B(Q) applied to a jump deltaQ in a given direction, i....
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes nonconservativeProduct()'s body (the empty string is a...
Turns a PDETerm into the C++ text for its generated method: exactly one method - the static,...
Definition PDETerm.py:85
Represents one named, point-wise PDE operator that a solver exposes for the user to implement: a C++ ...
Definition PDETerm.py:6