Peano
Loading...
Searching...
No Matches
MaxEigenvalue.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 maximum absolute eigenvalue of the flux Jacobian in a given
12 direction, i.e. the spectral radius used by Rusanov-type numerical
13 fluxes and by the CFL-driven admissible time step size.
14
15 See python/exahype2/solvers/fv/riemann/kernels.py's eigenvalues(), which
16 returns the full eigenvalue vector L rather than just its maximum - this
17 new API deliberately asks for the reduced quantity solvers actually
18 need for their numerical flux, and reduces the legacy signature the
19 same way Flux does:
20
21 @code
22 virtual void maxEigenvalue(
23 const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
24 const tarch::la::Vector<Dimensions, double>& x,
25 int normal,
26 double* __restrict__ lambdaMax // lambdaMax[1]
27 );
28 @endcode
29
30 """
31
32 SIGNATURE = (
33 "const double* __restrict__ Q, "
34 "const tarch::la::Vector<Dimensions, double>& x, "
35 "int normal, "
36 "double* __restrict__ lambdaMax"
37 )
38
39 NAME = "maxEigenvalue"
40
42 self,
43 implementation: str = None,
44 stateless: bool = False,
45 ):
46 """!
47
48 implementation: str
49 A C++ snippet that becomes maxEigenvalue()'s body (the empty
50 string is a valid, generated no-op body), or None (the default)
51 to leave maxEigenvalue() pure virtual for you to implement by
52 hand. Don't add this term to a solver at all if it needs no
53 eigenvalue estimate.
54
55 """
56 super().__init__(
57 name=self.NAMENAME,
58 implementation=implementation,
59 stateless=stateless,
60 )
61
63 """!
64
65 MaxEigenvalue-specific code generation
66
67 Reuses PDETerm.Generator's declaration/definition/GPU-offload logic
68 as-is - MaxEigenvalue.SIGNATURE is picked up automatically. Declared
69 explicitly (rather than left to be inherited implicitly) for the
70 same reason as Flux.Generator: the obvious place to add
71 maxEigenvalue-specific generation behaviour later, and so
72 max_eigenvalue_term.generator reports its type as
73 MaxEigenvalue.Generator rather than the more generic PDETerm.Generator.
74
75 """
MaxEigenvalue-specific code generation.
The maximum absolute eigenvalue of the flux Jacobian in a given direction, i.e.
__init__(self, str implementation=None, bool stateless=False)
implementation: str A C++ snippet that becomes maxEigenvalue()'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