DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
dbpp_HLLFlux1D.h
Go to the documentation of this file.
1#pragma once
2
3// C++ include
4#include <tuple>
5// SfxBase19 include
6#include "include/Sfx_CellFaceVariables.h"
7
8namespace dbpp
9{
17 class HLLFlux1D
18 {
19 public:
24 {
25 FL1 = 0,
26 FR1 = 1,
27 FL2 = 2,
28 FR2 = 3,
29 };
30
33 using ShockSpeed = std::pair<float64/*SL*/, float64/*SR*/>;
37 using PhysicalFlux = std::tuple<float64/*FL1*/, float64/*FR1*/, float64/*FL2*/, float64/*FR2*/>;
42 void setShockSpeed( const ShockSpeed& aShockSpeed) { m_shocSpeed = aShockSpeed; }
47 void setphysicalFlux( const PhysicalFlux& aPhyF) { m_physFlux = aPhyF; }
53 virtual std::pair<float64/**/, float64>
54 calculFF( const Sfx::cellFaceVariables& aCellFaceVar) const
55 {
56 // compute the HLL parameters
57// HLLparameters w_prm;
58// w_prm.computeHLLParametres(aUL, aUR, w_sectionFlow->B());
59
60 // // call flux function instead of calling the function below
61 // // this is the physical flux at left side
62 // const double w_physFL2 = w_stVen1D->flux( Sfx::StateVector(UL1, UL2)); //FL2
63 // const double w_physFR2 = w_stVen1D->flux( Sfx::StateVector(UR1, UR2)); //FR2
64 //}
65 // St-Venant flux term (conservative form) and not consider hydrostatic pressure
66// const double FL2 = HydroTerms::EvaluationF2_I_1D(UL1, UL2, w_secti->B());
67// const double FR2 = HydroTerms::EvaluationF2_I_1D(UR1, UR2, B);
68
69 // NOTE:
70 // We solving the Riemann problem, isn't?
71 // Might as well call the Riemann solver
72
73 double FF1{};
74 double FF2{};
75
76 //
77 // HLL Algorithm
78 //
79
80 // Calcul de Fi+1/2 (we are at cell face)
81 if (m_shocSpeed.first > 0.) //SL
82 {
83 FF1 = std::get<FL1>(m_physFlux); //FL1;
84 FF2 = std::get<FL2>(m_physFlux); //FL2;
85 }
86 else if (m_shocSpeed.second < 0.) //SR
87 {
88 FF1 = std::get<FR1>(m_physFlux); //FR1;
89 FF2 = std::get<FR2>(m_physFlux); //FR2;
90 }
91 else
92 {
93 // HLL flux
94 /* FF1[i] = (SR*FL1 - SL*FR1 + SL*SR*(UR1 - UL1)) / (SR - SL);
95 FF2[i] = (SR*FL2 - SL*FR2 + SL*SR*(UR2 - UL2)) / (SR - SL);*/
96 const auto [SL, SR] = m_shocSpeed;
97 const auto [FL1, FR1, FL2, FR2] = m_physFlux;
98
99 const auto& w_leftStateVar = aCellFaceVar.UL();
100 const auto& w_rightStateVar = aCellFaceVar.UR();
101
102 const auto UR1 = w_rightStateVar.A();
103 const auto UL1 = w_leftStateVar.A();
104
105 const auto UR2 = w_rightStateVar.Q();
106 const auto UL2 = w_leftStateVar.Q();
107
108 FF1 = (SR * FL1 - SL * FR1 + SL * SR * (UR1 - UL1)) / (SR - SL);
109 FF2 = (SR * FL2 - SL * FR2 + SL * SR * (UR2 - UL2)) / (SR - SL);
110 }
111
112 // debugging purpose
113 return std::pair{ FF1, FF2 }; // default for debugging purpose
114 }
115 private:
118 };
119}// End of namespace
"Model of" F_j +/- 1/2 numerical scheme at the cell interface. This class represents the HLL (Harten-...
Definition dbpp_HLLFlux1D.h:18
ShockSpeed m_shocSpeed
Definition dbpp_HLLFlux1D.h:116
std::tuple< float64, float64, float64, float64 > PhysicalFlux
Aliasephysical flux.
Definition dbpp_HLLFlux1D.h:37
void setphysicalFlux(const PhysicalFlux &aPhyF)
Set physical flux.
Definition dbpp_HLLFlux1D.h:47
virtual std::pair< float64, float64 > calculFF(const Sfx::cellFaceVariables &aCellFaceVar) const
Compute numerical flux at cell face.
Definition dbpp_HLLFlux1D.h:54
std::pair< float64, float64 > ShockSpeed
Aliase shock speed.
Definition dbpp_HLLFlux1D.h:33
eFluxComp
Flux component of state variables (cell face left/right)
Definition dbpp_HLLFlux1D.h:24
@ FL1
Definition dbpp_HLLFlux1D.h:25
@ FL2
Definition dbpp_HLLFlux1D.h:27
@ FR2
Definition dbpp_HLLFlux1D.h:28
@ FR1
Definition dbpp_HLLFlux1D.h:26
void setShockSpeed(const ShockSpeed &aShockSpeed)
Set shock speed.
Definition dbpp_HLLFlux1D.h:42
PhysicalFlux m_physFlux
Definition dbpp_HLLFlux1D.h:117
Definition DamBreakProb.h:15
double float64
Definition dbpp_LDeltaOperator.h:12