Peano
Loading...
Searching...
No Matches
InitPointWisely.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 Point-wise initial condition: given the physical position of a single
12 degree of freedom, write its initial Q there.
13
14 Unlike the legacy, cell-wise initialCondition() (handed a whole mesh
15 cell's centre and extent plus gridIsConstructed, and expected to fill an
16 entire patch itself - see python/exahype2/solvers/rkfd/*.template.h),
17 this term is evaluated once per degree of freedom, exactly like Flux and
18 MaxEigenvalue are:
19
20 @code
21 virtual void initPointWisely(
22 const tarch::la::Vector<Dimensions, double>& x,
23 double* __restrict__ Q // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
24 );
25 @endcode
26
27 Q holds unknowns+auxiliary_variables entries - the whole state, not just
28 the hyperbolic unknowns Flux/MaxEigenvalue work with - since this term
29 has to set up everything a fresh degree of freedom needs, not just
30 contribute to an already-existing state.
31
32 """
33
34 SIGNATURE = (
35 "const tarch::la::Vector<Dimensions, double>& x, "
36 "double* __restrict__ Q"
37 )
38
39 NAME = "initPointWisely"
40
42 self,
43 implementation: str = None,
44 stateless: bool = False,
45 ):
46 """!
47
48 implementation: str
49 A C++ snippet that becomes initPointWisely()'s body (the empty
50 string is a valid, generated no-op body, though a no-op initial
51 condition leaves Q uninitialised), or None (the default) to leave
52 initPointWisely() pure virtual for you to implement by hand.
53
54 A grid construction such as exahype2.api.fv.SetupSimulationOverRegularGrid
55 validates that the solver it is attached to has this term
56 registered before it does anything else, since it relies on it to
57 fill in the initial condition.
58
59 """
60 super().__init__(
61 name=self.NAMENAME,
62 implementation=implementation,
63 stateless=stateless,
64 )
65
67 """!
68
69 InitPointWisely-specific code generation
70
71 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
72 as-is - InitPointWisely.SIGNATURE is picked up automatically.
73 Declared explicitly (rather than left to be inherited implicitly)
74 for the same reason as Flux.Generator: the obvious place to add
75 initPointWisely-specific generation behaviour later, and so
76 init_point_wisely_term.generator reports its type as
77 InitPointWisely.Generator rather than the more generic
78 PDETerm.Generator.
79
80 """
InitPointWisely-specific code generation.
Point-wise initial condition: given the physical position of a single degree of freedom,...
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes initPointWisely()'s body (the empty string is a valid,...
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