/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/FV/limiter/van_albada_limiter.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/FV/limiter/van_albada_limiter.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
van_albada_limiter.hh
Go to the documentation of this file.
1#pragma once
2
4
5#include <algorithm>
6#include <cmath>
7
8namespace DiFfRG
9{
10 namespace def
11 {
44 {
45 public:
46 template <typename NumberType> static NumberType slope_limit(const NumberType &a, const NumberType &b)
47 {
48 // Strict TVD: vanish on sign disagreement, including either argument zero.
49 const auto ab = a * b;
50 if (ab <= NumberType(0)) return NumberType(0);
51
52 // ε_floor: defensive against the truly-zero-slope smooth-extremum case
53 // where a² + b² could be machine zero. Set far below any physical
54 // (du/h)² scale; ~1e-300 is safely below double's denormal range.
55 const NumberType eps_floor = NumberType(1e-300);
56
57 const auto a2 = a * a;
58 const auto b2 = b * b;
59 return (a * b2 + b * a2) / (a2 + b2 + eps_floor);
60 }
61 };
62 static_assert(HasSlopeLimiter<VanAlbadaLimiter>);
63
64 } // namespace def
65} // namespace DiFfRG
van Albada (1982) slope limiter — second-order TVD and C¹ in u.
Definition van_albada_limiter.hh:44
static NumberType slope_limit(const NumberType &a, const NumberType &b)
Definition van_albada_limiter.hh:46
Definition complex_math.hh:10