Alsvinn  0.5.3
The fast FVM simulator with UQ support
Godunov.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 
32 
33 class Godunov {
34 public:
38  static const std::string name;
39 
40  template<int direction>
41  __device__ __host__ inline static real computeFlux(const
46  using namespace equation::burgers;
47  ConservedVariables fluxLeft;
48  eq.computePointFlux<direction>(AllVariables(fmax(left.u, real(0.0))), fluxLeft);
49  ConservedVariables fluxRight;
50  eq.computePointFlux<direction>(AllVariables(fmin(right.u, real(0.0))),
51  fluxRight);
52 
53  F = ConservedVariables(fmax(fluxLeft.u, fluxRight.u));
54 
55  // This looks a bit weird, but it is OK. The basic principle is that AllVariables
56  // is both a conservedVariable and an extra variable, hence we need to pass
57  // it twice since this function expects both.
58  return fmax(eq.computeWaveSpeed<direction>(left, left),
59  eq.computeWaveSpeed<direction>(right, right));
60  }
61 };
62 } // namespace alsfvm
63 } // namespace numflux
64 } // namespace burgers
__device__ __host__ real computeWaveSpeed(const ConservedVariables &u, const ExtraVariables &v) const
Definition: Burgers.hpp:203
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: Godunov.hpp:41
Definition: Godunov.hpp:33
#define __device__
Definition: types.hpp:45
static const std::string name
name is "godunov"
Definition: Godunov.hpp:38
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