|
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++. | |
| include_implementation_into_header (str directory, str file_name) | |
| Make a generated kernel header pull in the template definitions. | |
| 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 148 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, nor on the Runge-Kutta scheme (the weights and the number of estimates enter at the call site), so several solvers within one project can share it. Each of them calls this routine, but only the first call generates the file: The DSLHyPE translation appends to existing files, i.e. a second generation would define the function template twice.
| 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 67 of file LinearCombination.py.
References include_implementation_into_header().

| exahype2.api.rungekutta.LinearCombination.include_implementation_into_header | ( | str | directory, |
| str | file_name ) |
Make a generated kernel header pull in the template definitions.
The translation of a DSLHyPE function yields the declaration in file_name.h and the definition of the function template in file_name.cpph, which itself includes the header. We therefore guard the header and let it include the definitions at its end.
| directory | str Directory of the kernels. |
| file_name | str Name of the kernel without suffix. |
Definition at line 124 of file LinearCombination.py.
Referenced by generate_linear_combination_kernel().

| "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 38 of file LinearCombination.py.
References exahype2.Float.
| str exahype2.api.rungekutta.LinearCombination.LINEAR_COMBINATION_KERNEL_FILE = "rungekutta_linear_combination" |
Definition at line 64 of file LinearCombination.py.
| str exahype2.api.rungekutta.LinearCombination.LINEAR_COMBINATION_KERNEL_NAME = "linearCombinationOfRungeKuttaEstimates" |
Definition at line 63 of file LinearCombination.py.