Peano
Loading...
Searching...
No Matches
DirichletBoundaryConditions.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 Dirichlet boundary conditions: given a position x outside of the domain
12 and a time stamp t, write the prescribed solution Q there.
13
14 @code
15 virtual void dirichletBoundaryConditions(
16 const tarch::la::Vector<Dimensions, double>& x,
17 double t,
18 double* __restrict__ Q // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
19 );
20 @endcode
21
22 Different to the legacy boundaryConditions() (@see
23 python/exahype2/solvers/fv/SingleSweepAbstract.template.h), the term is
24 not handed the solution inside the domain, the face's normal or the
25 mesh size. It is parameterised through position and time only.
26
27 A Finite Volume scheme such as exahype2.api.fv.RusanovWithExplicitEuler
28 evaluates the term at the centres of the ghost volumes, i.e. of the
29 volumes of the halo layer which lie outside of the domain, and stores
30 the result in the face data its reconstruction reads from (@see
31 exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions). t is the
32 time stamp of the solution that the time step is about to advance.
33
34 A solver needs this term if and only if at least one axis of the domain
35 is not periodic (@see exahype2.api.Project.set_global_simulation_parameters()).
36 If all axes are periodic, the term is never invoked, and the time step
37 does not contain any boundary handling at all.
38
39 Only the non-stateless variant is supported at the moment, i.e. the
40 term has to be added with stateless=False.
41
42 """
43
44 SIGNATURE = (
45 "const tarch::la::Vector<Dimensions, double>& x, "
46 "double t, "
47 "double* __restrict__ Q"
48 )
49
50 NAME = "dirichletBoundaryConditions"
51
53 self,
54 implementation: str = None,
55 stateless: bool = False,
56 ):
57 """!
58
59 @param implementation: str
60 A C++ snippet that becomes dirichletBoundaryConditions()'s body,
61 or None (the default) to leave dirichletBoundaryConditions() pure
62 virtual for you to implement by hand.
63
64 @param stateless: bool
65 Has to be False at the moment, @see the class documentation.
66
67 """
68 super().__init__(
69 name=self.NAMENAME,
70 implementation=implementation,
71 stateless=stateless,
72 )
73
75 """!
76
77 DirichletBoundaryConditions-specific code generation
78
79 Reuses PDETerm.Generator as-is - DirichletBoundaryConditions.SIGNATURE
80 is picked up automatically. Declared explicitly for the same reason
81 as Flux.Generator.
82
83 """
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
Dirichlet boundary conditions: given a position x outside of the domain and a time stamp t,...