Peano
Loading...
Searching...
No Matches
VolumetricSource.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 algebraic, volume-distributed source term S(Q) of a hyperbolic PDE -
12 as opposed to PointSource, which contributes only at isolated points.
13
14 See python/exahype2/solvers/fv/riemann/kernels.py's sourceTerm(), which
15 is not normal-dependent (a volumetric source has no notion of a face
16 direction), so unlike Flux/MaxEigenvalue/MassMatrix/
17 NonconservativeProduct this term has no normal parameter to begin with.
18 It depends on the position x and the time stamp t only, i.e. neither on
19 the mesh size nor on the time step size. The signature matches
20 ::exahype2::fv::rusanov::VolumetricSourceFunctor:
21
22 @code
23 virtual void volumetricSource(
24 const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
25 const tarch::la::Vector<Dimensions, double>& x,
26 double t,
27 double* __restrict__ S // S[{{NUMBER_OF_UNKNOWNS}}]
28 );
29 @endcode
30
31 """
32
33 SIGNATURE = (
34 "const double* __restrict__ Q, "
35 "const tarch::la::Vector<Dimensions, double>& x, "
36 "double t, "
37 "double* __restrict__ S"
38 )
39
40 NAME = "volumetricSource"
41
43 self,
44 implementation: str = None,
45 stateless: bool = False,
46 ):
47 """!
48
49 implementation: str
50 A C++ snippet that becomes volumetricSource()'s body (the empty
51 string is a valid, generated no-op body), or None (the default)
52 to leave volumetricSource() pure virtual for you to implement by
53 hand. Don't add this term to a solver at all if the PDE has no
54 volumetric source contribution.
55
56 """
57 super().__init__(
58 name=self.NAMENAME,
59 implementation=implementation,
60 stateless=stateless,
61 )
62
64 """!
65
66 VolumetricSource-specific code generation
67
68 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
69 as-is - VolumetricSource.SIGNATURE is picked up automatically.
70 Declared explicitly (rather than left to be inherited implicitly)
71 for the same reason as Flux.Generator: the obvious place to add
72 volumetricSource-specific generation behaviour later, and so
73 volumetric_source_term.generator reports its type as
74 VolumetricSource.Generator rather than the more generic
75 PDETerm.Generator.
76
77 """
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
VolumetricSource-specific code generation.
The algebraic, volume-distributed source term S(Q) of a hyperbolic PDE - as opposed to PointSource,...
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes volumetricSource()'s body (the empty string is a valid...