Alsvinn  0.5.3
The fast FVM simulator with UQ support
Upwind.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "alsfvm/types.hpp"
3 
4 #include <algorithm>
6 #include <cmath>
7 namespace alsfvm {
8 namespace numflux {
9 namespace linear {
10 
13 class Upwind {
14 public:
19  static const std::string name;
20 
21  template<int direction>
22  __device__ __host__ inline static real computeFlux(const Equation& eq,
23  const typename Equation::AllVariables& left,
24  const typename Equation::AllVariables& right,
25  typename Equation::ConservedVariables& F) {
26 
27  typename Equation::ConservedVariables fluxLeft;
28  eq.template computePointFlux<direction>(left, fluxLeft);
29 
30 
31  F = fluxLeft;
32 
33  // This looks a bit weird, but it is OK. The basic principle is that AllVariables
34  // is both a conservedVariable and an extra variable, hence we need to pass
35  // it twice since this function expects both.
36  return fmax(eq.template computeWaveSpeed<direction>(left, left),
37  eq.template computeWaveSpeed<direction>(right, right));
38  }
39 };
40 } // namespace linear
41 } // namespace numflux
42 } // namespace alsfvm
Definition: Upwind.hpp:13
#define __host__
Definition: types.hpp:46
static const std::string name
name is "upwind"
Definition: Upwind.hpp:19
double real
Definition: types.hpp:65
Definition: Linear.hpp:33
Definition: AllVariables.hpp:24
__device__ static __host__ real computeFlux(const Equation &eq, const typename Equation::AllVariables &left, const typename Equation::AllVariables &right, typename Equation::ConservedVariables &F)
Definition: Upwind.hpp:22
#define __device__
Definition: types.hpp:45
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
Definition: ConservedVariables.hpp:26