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 #include <algorithm>
21 
22 namespace alsfvm {
23 namespace numflux {
24 namespace burgers {
25 
29 
30 class Roe {
31 public:
35  static const std::string name;
36 
37  template<int direction>
38  __device__ __host__ inline static real computeFlux(const
43  using namespace equation::burgers;
44 
45  if (left.u >= -right.u) {
46  ConservedVariables fluxLeft;
47  eq.computePointFlux<direction>(AllVariables(fmax(left.u, real(0.0))), fluxLeft);
48  F = fluxLeft;
49  } else {
50  ConservedVariables fluxRight;
51  eq.computePointFlux<direction>(AllVariables(fmin(right.u, real(0.0))),
52  fluxRight);
53  F = fluxRight;
54  }
55 
56  // This looks a bit weird, but it is OK. The basic principle is that AllVariables
57  // is both a conservedVariable and an extra variable, hence we need to pass
58  // it twice since this function expects both.
59  return fmax(eq.computeWaveSpeed<direction>(left, left),
60  eq.computeWaveSpeed<direction>(right, right));
61  }
62 };
63 } // namespace alsfvm
64 } // namespace numflux
65 } // namespace burgers
__device__ __host__ real computeWaveSpeed(const ConservedVariables &u, const ExtraVariables &v) const
Definition: Burgers.hpp:203
static const std::string name
name is "Roe"
Definition: Roe.hpp:35
Definition: ConservedVariables.hpp:26
#define __host__
Definition: types.hpp:46
double real
Definition: types.hpp:65
__device__ static __host__ real computeFlux(const equation::burgers::Burgers &eq, const equation::burgers::AllVariables &left, const equation::burgers::AllVariables &right, equation::burgers::ConservedVariables &F)
Definition: Roe.hpp:38
#define __device__
Definition: types.hpp:45
Definition: Roe.hpp:30
Definition: Burgers.hpp:33
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
real u
Definition: ConservedVariables.hpp:54
__device__ __host__ void computePointFlux(const AllVariables &u, ConservedVariables &F) const
Definition: Burgers.hpp:159
Definition: AllVariables.hpp:24