DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
Sfx_StVenant1DEquations.h
Go to the documentation of this file.
1
2#pragma once
3
4// C++ includes
5#include <iostream>
6#include <cstdlib>
7// numeric
8#include <valarray>
9// SfxBase19 includes
10#include "include/Sfx_SCL.h"
11#include "include/Sfx_UniversalConstants.h"
12// App includes
13//#include "../SfxBase/Sfx_StVenant1DTerms.h"
14//#include "../include/Swe_SectionGeometryHandler.h"
16
17namespace Sfx {
18 class StateVectorField;
19}
20namespace dbpp { class Uh; }
21
22namespace Sfx
23{
24 // 'Model of'
25 // Conservative form of the St-Venant Equation in
26 // One-dimension. We have two equations for the conservative
27 // variables (mass and momentum).
28
35 class StVenant1D : public Sfx::SCLEquation
36 {
37 public:
38 using valar64 = std::valarray<float64>;
39 public:
44 StVenant1D( eFluxType aFtype = eFluxType::incomplete)
45 : m_FluxType{ aFtype },
46 m_useFriction{false}
47 {}
48
53 SCLEquation* Clone() override { return new StVenant1D(*this); }
54
61 float64 flux( const Sfx::StateVector& aState,
62 const eFluxType aFluxT = eFluxType::incomplete) override final;
69 std::valarray<float64> flux( const Sfx::StateVectorField& aState,
70 const eFluxType aFluxT = eFluxType::incomplete);
77 std::valarray<float64> flux(const dbpp::Uh& aGblNval,
78 const eFluxType aFluxT = eFluxType::incomplete);
85 float64 flux(const Sfx::StateVector& aState, const dbpp::SectionFlow& aSect);
90 std::string name() const override final { return std::string{ "StVenant1DNoFriction" }; }
95 bool hasSourceTerm() const override final { return true; }
100 //bool useCompleteFlux() const override final { return false; }; convective and pressure (f=f_c+f_p)
101
106 uint32 getNumberOfEquations() const override final { return 2; }
111 uint32 getDimension() const override final { return 1; }
116 eFluxType getFluxType() const noexcept { return m_FluxType;}
121 bool useFriction() const noexcept { return m_useFriction;}
122
123//protected:
124 // not accessible from client side
125 // noncopyable
126 //StVenant1D(const StVenant1D& aOther) = default;
127 //StVenant1D& operator= (const StVenant1D& aOther) = default;
128
129 private:
130 eFluxType m_FluxType;
132#if 0
133 // St-Venant flux without the pressure term
134 inline float64 EvaluationFlux_I_1D( const Sfx::StateVector & aState)
135 {
136 // u^2*h (without pressure term)
137 return (aState.Q()*aState.Q())/aState.A();
138 }
139 //inline float64 EvaluationFlux_I_1D( const SectFlow& aSect)
140 //{
141 // Sfx::StateVector w_sectVec = aSect.getStateVector();
142
143 // // u^2*h (without pressure term)
144 // return (w_sectVec.Q()*w_sectVec.Q())/w_sectVec.A();
145 //}
146
147 // St-Venant flux with the pressure term (total flux)
148 inline float64 EvaluationFlux_C_1D( const Sfx::StateVector & aState,
149 float64 B = 1.) // section width
150 {
151 // Flux including: u^2*h + gh^2/2 (with pressure term)
152 return EvaluationFlux_I_1D(aState) +
153 Sfx::cGravity<double>*HydrostaticPressure(aState.A());
154 }
155 //inline float64 EvaluationFlux_C_1D( const SectFlow& aSect)
156 //{
157 // // Flux including: u^2*h + gh^2/2 (with pressure term)
158 // return EvaluationFlux_I_1D(aSect) +
159 // Sfx::cGravity<double>*HydrostaticPressure(aSect);
160 //}
161
162 // Hydrostatic pressure (gh^2/2.), (B = section width)
163 inline float64 HydrostaticPressure( const float64 aArea, float64 B = 1.)
164 {
165 return (aArea*aArea)/2.*B;
166 }
167 //inline float64 HydrostaticPressure( const SectFlow& aSect)
168 //{
169 // Sfx::StateVector w_sectVec = aSect.getStateVector();
170 // const float64 w_sectWidth = SectionGeometryHandler::computeWidth(aSect);
171 // return (w_sectVec.A()*w_sectVec.A())/2.*w_sectWidth;
172 //}
173#endif //0
181 valar64 EvaluationFlux_I_1D( const valar64& U1, const valar64& U2, float64 B = 1.)
182 {
183 return (U2 * U2) / U1;
184 }
185
192 {
193 return ((A * A) / (2. * B));
194 }
195
202 valar64 EvaluationFlux_C_1D( const valar64& U1, const valar64& U2, float64 B = 1.)
203 {
204 return EvaluationFlux_I_1D(U1, U2) + Sfx::cGravity<float64>*CalculTermePressionHydrostatique1D(U1, B);
205 }
206 };
207} // End of namespace
std::valarray< float64 > valar64
Definition Sfx_StVenant1DEquations.h:38
bool m_useFriction
Definition Sfx_StVenant1DEquations.h:131
uint32 getDimension() const override final
System dimension.
Definition Sfx_StVenant1DEquations.h:111
float64 flux(const Sfx::StateVector &aState, const eFluxType aFluxT=eFluxType::incomplete) override final
convective flux function
Definition Sfx_StVenant1DEquations.cpp:10
uint32 getNumberOfEquations() const override final
implement the physical flux
Definition Sfx_StVenant1DEquations.h:106
StVenant1D(eFluxType aFtype=eFluxType::incomplete)
default ctor (convective by default)
Definition Sfx_StVenant1DEquations.h:44
eFluxType getFluxType() const noexcept
physical flux type
Definition Sfx_StVenant1DEquations.h:116
SCLEquation * Clone() override
Clone type.
Definition Sfx_StVenant1DEquations.h:53
bool hasSourceTerm() const override final
use term sucg friction and bed slope
Definition Sfx_StVenant1DEquations.h:95
valar64 EvaluationFlux_I_1D(const valar64 &U1, const valar64 &U2, float64 B=1.)
Evaluate convective flux (incomplete)
Definition Sfx_StVenant1DEquations.h:181
valar64 EvaluationFlux_C_1D(const valar64 &U1, const valar64 &U2, float64 B=1.)
Evaluate convective flux and pressure (complete)
Definition Sfx_StVenant1DEquations.h:202
valar64 CalculTermePressionHydrostatique1D(const valar64 &A, float64 B=1.)
Hydrostatic pressure.
Definition Sfx_StVenant1DEquations.h:191
bool useFriction() const noexcept
return false by default
Definition Sfx_StVenant1DEquations.h:121
std::string name() const override final
name description
Definition Sfx_StVenant1DEquations.h:90
eFluxType m_FluxType
Definition Sfx_StVenant1DEquations.h:130
Cross-sectional flow (2-dimensional).
Definition dbpp_SectionFlow.h:16
Container of nodal variables.
Definition dbpp_Uh.h:21
Definition HydUtils.h:15
Definition DamBreakProb.h:15