Alsvinn  0.5.3
The fast FVM simulator with UQ support
Roe.hpp
Go to the documentation of this file.
1 /* Copyright (c) 2018 ETH Zurich, Kjetil Olsen Lye
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #pragma once
18 #include <iostream>
19 
20 
21 #include <algorithm>
22 
23 namespace alsfvm {
24 namespace numflux {
25 namespace linear {
26 
29 class Roe {
30 public:
34  static const std::string name;
35 
36  template<int direction>
37  __device__ __host__ inline static real computeFlux(const
40  const equation::linear::AllVariables& right,
42  using namespace equation::linear;
43 
44 
45  ConservedVariables fluxLeft;
46  eq.computePointFlux<direction>(AllVariables(fmax(left.u, real(0.0))), fluxLeft);
47  F = fluxLeft;
48 
49  // This looks a bit weird, but it is OK. The basic principle is that AllVariables
50  // is both a conservedVariable and an extra variable, hence we need to pass
51  // it twice since this function expects both.
52  return fmax(eq.computeWaveSpeed<direction>(left, left),
53  eq.computeWaveSpeed<direction>(right, right));
54  }
55 };
56 } // namespace alsfvm
57 } // namespace numflux
58 } // namespace linear
#define __host__
Definition: types.hpp:46
real u
Definition: ConservedVariables.hpp:54
double real
Definition: types.hpp:65
__device__ static __host__ real computeFlux(const equation::linear::Linear &eq, const equation::linear::AllVariables &left, const equation::linear::AllVariables &right, equation::linear::ConservedVariables &F)
Definition: Roe.hpp:37
Definition: Linear.hpp:33
__device__ __host__ void computePointFlux(const AllVariables &u, ConservedVariables &F) const
Definition: Linear.hpp:159
Definition: AllVariables.hpp:24
__device__ __host__ real computeWaveSpeed(const ConservedVariables &u, const ExtraVariables &v) const
Definition: Linear.hpp:203
#define __device__
Definition: types.hpp:45
static const std::string name
name is "roe"
Definition: Roe.hpp:34
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
Definition: Roe.hpp:29
Definition: ConservedVariables.hpp:26