Peano 4
Loading...
Searching...
No Matches
generalisedOsherSolomon.cpph
Go to the documentation of this file.
1
14// included in ../../Kernels.h
15
16#include <algorithm>
17#include <cassert>
18#include <cmath>
19#include <cstring>
20
24
25namespace kernels {
26namespace aderdg {
27namespace generic {
28namespace c {
29
39template <bool useNCP, bool useFlux, int numQuadPoints, typename SolverType>
41 SolverType& solver,
42 double* const FL,
43 double* const FR,
44 const double* const QL,
45 const double* const QR,
46 const double t,
47 const double dt,
48 const int direction) {
49 constexpr int numberOfVariables = SolverType::NumberOfVariables;
50 constexpr int numberOfParameters = SolverType::NumberOfParameters;
51 constexpr int numberOfData = numberOfVariables+numberOfParameters;
52 constexpr int order = SolverType::Order;
53 constexpr int basisSize = order+1;
54
55 // Compute the average variables and parameters from the left and the right
56 double QavL[numberOfData] = {0.0};
57 double QavR[numberOfData] = {0.0};
58 kernels::riemannsolvers::util::averageRiemannInputs<basisSize,numberOfData>(
59 QL,SolverType::weights,QavL);
60 kernels::riemannsolvers::util::averageRiemannInputs<basisSize,numberOfData>(
61 QR,SolverType::weights,QavR);
62
63 double osherMatrix[numberOfVariables][numberOfVariables] = {0.0}; // fill with zeroes
64 double osherNCP[numberOfVariables] = {0.0}; // fill with zeroes
65
67 useFlux,numberOfVariables,numberOfParameters,numQuadPoints,SolverType>(
68 solver,QavL,QavR,direction,osherMatrix,osherNCP);
69
70 // compute fluxes (and fluctuations for non-conservative PDEs)
71 idx3 idx_FLR(basisSize, basisSize, numberOfVariables);
72 idx3 idx_QLR(basisSize, basisSize, numberOfData);
73
74 for (int i = 0; i < basisSize; i++) {
75 for (int j = 0; j < basisSize; j++) {
76 // skip parameters
77 for (int k = 0; k < numberOfVariables; k++) {
78 if(useFlux) {
79 FL[idx_FLR(i, j, k)] = 0.5 * (FR[idx_FLR(i, j, k)] + FL[idx_FLR(i, j, k)]);
80 for (int a = 0; a < numberOfVariables; a++) {
81 FL[idx_FLR(i, j, k)] -= 0.5 * osherMatrix[k][a] * (QR[idx_QLR(i, j, a)] - QL[idx_QLR(i, j, a)]);
82 }
83 }
84 if(useNCP) {
85 FR[idx_FLR(i, j, k)] = FL[idx_FLR(i, j, k)] - 0.5 * osherNCP[k];
86 FL[idx_FLR(i, j, k)] = FL[idx_FLR(i, j, k)] + 0.5 * osherNCP[k];
87 } else {
88 FR[idx_FLR(i, j, k)] = FL[idx_FLR(i, j, k)];
89 }
90 }
91 }
92 }
93}
94
95} // namespace c
96} // namespace generic
97} // namespace aderdg
98} // namespace kernels
And from this we can write down f$ nabla phi_i nabla phi_i dx but since we are constructing matrix let s investigate the f$ j
we integrate over each cell and then take the sum across each of the cells We also consider the terms that enter the f$ k
-with-ExaHyPE2-benchmark
void generalisedOsherSolomon(SolverType &solver, double *const FL, double *const FR, const double *const QL, const double *const QR, const double t, const double dt, const int direction)
We implement a very simple Rusanov scheme with scalar dissipation (smax*Id).
double computeOsherMatrix(SolverType &solver, const double *const qL, const double *const qR, const int direction, double(&osherMatrix)[numberOfVariables][numberOfVariables], double(&osherNCP)[numberOfVariables])
Computes ingredients for the generalised Osher Solomon flux [1,2].
This file is part of the ExaHyPE project.