|
Peano
|
Functions | |
| "void" | linearCombinationOfRungeKuttaEstimates ("double**" solution, "double**" estimates, "double**" output, "const double*" weights, "double" timeStepSize) |
| DSLHyPE kernel for the linear combinations of Runge-Kutta. | |
| generate_linear_combination_kernel (namespace, output_directory) | |
| Translate linearCombinationOfRungeKuttaEstimates() into C++. | |
| create_linear_combination_call (namespace, number_of_dofs, unknowns, auxiliary_variables, weights, solution, estimates, output, time_step_size) | |
| C++ code which invokes the kernel from generate_linear_combination_kernel() | |
Variables | |
| str | LINEAR_COMBINATION_KERNEL_NAME = "linearCombinationOfRungeKuttaEstimates" |
| str | LINEAR_COMBINATION_KERNEL_FILE = "rungekutta_linear_combination" |
| exahype2.api.rungekutta.LinearCombination.create_linear_combination_call | ( | namespace, | |
| number_of_dofs, | |||
| unknowns, | |||
| auxiliary_variables, | |||
| weights, | |||
| solution, | |||
| estimates, | |||
| output, | |||
| time_step_size | |||
| ) |
C++ code which invokes the kernel from generate_linear_combination_kernel()
The code is a block of its own. It sets up the arrays of pointers the kernel expects and stores the weights as compile-time constants.
Only the stages with a non-zero weight enter the kernel call. This is not an optimisation only: The estimates of the stages which a combination does not need may be uninitialised, e.g. the estimates of the later stages before the first time step has completed. Multiplying them with zero would still yield NaN if they hold NaN. If all weights are zero, the code copies the solution into the output.
| namespace | [str] Namespace of the kernel, see generate_linear_combination_kernel(). |
| number_of_dofs | int Degrees of freedom per cell. |
| unknowns | int Number of unknowns per degree of freedom. |
| auxiliary_variables | int Number of auxiliary variables per degree of freedom. |
| weights | [float] One weight per Runge-Kutta stage, e.g. a row of exahype2.api.rungekutta.ButcherTableau.weight_matrix(). |
| solution | str C++ expression for the pointer to the input data. |
| estimates | str C++ expression for the pointer to the estimates of all stages. They are stored one after the other, each with number_of_dofs*unknowns entries. |
| output | str C++ expression for the pointer to the output data. May equal solution. |
| time_step_size | str C++ expression for the time step size. |
Definition at line 109 of file LinearCombination.py.
| exahype2.api.rungekutta.LinearCombination.generate_linear_combination_kernel | ( | namespace, | |
| output_directory | |||
| ) |
Translate linearCombinationOfRungeKuttaEstimates() into C++.
The kernel ends up in kernels/rungekutta_linear_combination.h in the output directory. It is a function template over NumberOfDoFs, NumberOfUnknowns, NumberOfAuxiliaryVariables and NumberOfEstimates within namespace. It does not depend on any solver, so several solvers within one project can share it: Each of them generates the very same file.
| namespace | [str] Namespace of the generated function template, usually the Peano project's namespace. |
| output_directory | str Directory the kernels/ subdirectory is created in, usually the Peano project's directory. |
Definition at line 65 of file LinearCombination.py.
| "void" exahype2.api.rungekutta.LinearCombination.linearCombinationOfRungeKuttaEstimates | ( | "double**" | solution, |
| "double**" | estimates, | ||
| "double**" | output, | ||
| "const double*" | weights, | ||
| "double" | timeStepSize | ||
| ) |
DSLHyPE kernel for the linear combinations of Runge-Kutta.
The function below is never executed as Python. DSLHyPE parses its source (exahype2.api.dslhype.Parser) and translates it into a C++ function template (see generate_linear_combination_kernel()). It refers to symbols the parser sets rather than Python imports:
The kernel computes
\( Q_{out} = Q_{in} + \Delta t \sum _{j} w_j K_j \)
per degree of freedom. The auxiliary variables are copied from the input. It does not know anything about the layout of the degrees of freedom in space: it requires only that each cell holds NumberOfDoFs degrees of freedom with the unknowns followed by the auxiliary variables per degree of freedom (AoS), and that the estimates hold the unknowns only. Finite Differences and DG schemes alike can hence use it.
Each DataBlock's last dimension is the one DSLHyPE realises through an array of pointers. For the estimates, it enumerates the NumberOfEstimates estimates which enter the sum, i.e. estimates[j] points to the j-th of them, and weights[j] is its weight. For the input and the output, it is of size one. Input and output may point to the same array.
This kernel replaces the legacy computeLinearCombination() and computeFinalLinearCombination() of exahype2.solvers.rkfd.fd4, which took the weights from the solver and assumed a three-dimensional patch.
Definition at line 36 of file LinearCombination.py.
References exahype2.Float.
| str exahype2.api.rungekutta.LinearCombination.LINEAR_COMBINATION_KERNEL_FILE = "rungekutta_linear_combination" |
Definition at line 62 of file LinearCombination.py.
| str exahype2.api.rungekutta.LinearCombination.LINEAR_COMBINATION_KERNEL_NAME = "linearCombinationOfRungeKuttaEstimates" |
Definition at line 61 of file LinearCombination.py.