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 the unknowns. If the solver has auxiliary variables, a pointer to
28 each set follows right behind Q (@ref exahype2.api.AuxiliaryVariables).
29 The solver that owns a set receives a non-const pointer and initialises the set
30 here, as this term has to set up everything a fresh degree of freedom
31 needs. Solvers which share a set receive a const pointer.
32
33 """
34
35 SIGNATURE = (
36 "const tarch::la::Vector<Dimensions, double>& x, "
37 "double* __restrict__ Q"
38 )
39
40 NAME = "initPointWisely"
41
43 self,
44 implementation: str = None,
45 stateless: bool = False,
46 ):
47 """!
48
49 implementation: str
50 A C++ snippet that becomes initPointWisely()'s body (the empty
51 string is a valid, generated no-op body, though a no-op initial
52 condition leaves Q uninitialised), or None (the default) to leave
53 initPointWisely() pure virtual for you to implement by hand.
54
55 A grid construction such as exahype2.api.fv.SetupSimulationOverRegularGrid
56 validates that the solver it is attached to has this term
57 registered before it does anything else, since it relies on it to
58 fill in the initial condition.
59
60 """
61 super().__init__(
62 name=self.NAME,
63 implementation=implementation,
64 stateless=stateless,
65 )
66
68 """!
69
70 InitPointWisely-specific code generation
71
72 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
73 as-is - InitPointWisely.SIGNATURE is picked up automatically.
74 Declared explicitly (rather than left to be inherited implicitly)
75 for the same reason as Flux.Generator: the obvious place to add
76 initPointWisely-specific generation behaviour later, and so
77 init_point_wisely_term.generator reports its type as
78 InitPointWisely.Generator rather than the more generic
79 PDETerm.Generator.
80
81 """
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