DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
dbpp_VS19WaveSimulator.h
Go to the documentation of this file.
1#pragma once
2
3// C++ include
4#include <fstream>
5// SfxBase19 library includes
6#include "include/Sfx_DefineTypes.h"
7#include "include/Sfx_WaveFunc.h"
8#include "include/Sfx_Simulator.h"
9#include "include/Sfx_Observer.h"
10// App include
12
13// forward declaration
14namespace Sfx{ class SfxTimePrm; }
15namespace dbpp { class Uh; }
16
17namespace dbpp
18{
22 class VS19WaveSimulator : public Sfx::Simulator,
23 virtual public Sfx::Observer,
24 public std::enable_shared_from_this<VS19WaveSimulator>
25 {
26 public:
28 using ListofSectionsFlow = std::shared_ptr<dbpp::ListSectionsFlow>;
29
34 {
35 SINE = 0,
36 STEP = 1
37 };
38
41 enum class eRiverBedType
42 {
43 FLAT = 0,
44 STEP = 1,
45 JUMP = 2,
46 RANDOM = 3
47 };
48 public:
54 VS19WaveSimulator( int32 aNbIterationsMax = 50, float64 aCFL = 0.600000000)
55 : m_nbIterationsMax{ aNbIterationsMax },
56 m_cfl{aCFL},
58 {}
59
62 void run() override final;
67 bool init() override final;
71 void unInitialize() override final {/*nothing to do*/ }
97 void update() override final;
102 std::valarray<float64> getH() const noexcept
103 {
104 return std::valarray<float64>(m_waveDepthProfile.data(), m_waveDepthProfile.size());
105 }
106
110 std::shared_ptr<VS19WaveSimulator> sharedPtrTo() { return shared_from_this(); }
111 private:
114 std::string m_activeAlgo;
115 std::string m_validationDir;
117 std::ofstream m_fileRes;
118 std::vector<float64> m_waveDepthProfile;
120
121 void setH(); // load H into lambda for efficiency
122 void saveResult( const Uh& aUh, const Sfx::SfxTimePrm& aTimeSimEnd);
123#if 0 // may be re-use some of them if it make sense
124 fieldptr m_lambda;
125 Sfx::SfxTimePrm m_tip;
126 wavfuncptr m_H;
127 wavfuncptr m_I;
128 emcil::ListSectFlow* m_ListSectFlow;
129 double m_CFL;
130 void setH();
131 std::string m_activeAlgo;
132 std::string m_validationDir;
133 bool m_saveResult2File;
134 unsigned int m_NumberIterationsMax;
135 double m_Phi1;
136 double m_Phi0;
137 double m_finalTime;
138 eIC m_IC;
139#endif
140 };
141} // End of namespace
std::shared_ptr< Sfx::WaveFunc > wavfuncptr
Definition SimulationConfig.h:45
std::shared_ptr< Sfx::scalarField1D > fieldptr
Definition SimulationConfig.h:26
Container of nodal variables.
Definition dbpp_Uh.h:21
VS19WaveSimulator(VS19WaveSimulator &&)=delete
Disable move construct.
VS19WaveSimulator(int32 aNbIterationsMax=50, float64 aCFL=0.600000000)
Ctor Wave Simulator.
Definition dbpp_VS19WaveSimulator.h:54
std::ofstream m_fileRes
Definition dbpp_VS19WaveSimulator.h:117
bool init() override final
Initialization of the simulator.
Definition dbpp_VS19WaveSimulator.cpp:166
void run() override final
Main loop of the simulation.
Definition dbpp_VS19WaveSimulator.cpp:33
std::valarray< float64 > getH() const noexcept
water depth at global nodal point
Definition dbpp_VS19WaveSimulator.h:102
int32 m_nbIterationsMax
Definition dbpp_VS19WaveSimulator.h:112
std::vector< float64 > m_waveDepthProfile
Definition dbpp_VS19WaveSimulator.h:118
void unInitialize() override final
clean-upof the simulator
Definition dbpp_VS19WaveSimulator.h:71
std::shared_ptr< dbpp::ListSectionsFlow > ListofSectionsFlow
Definition dbpp_VS19WaveSimulator.h:28
void update() override final
Observer method (H-profile at each time step)
Definition dbpp_VS19WaveSimulator.cpp:250
std::string m_validationDir
Definition dbpp_VS19WaveSimulator.h:115
eRiverBedType
Definition dbpp_VS19WaveSimulator.h:42
@ RANDOM
Definition dbpp_VS19WaveSimulator.h:46
@ JUMP
Definition dbpp_VS19WaveSimulator.h:45
@ FLAT
Definition dbpp_VS19WaveSimulator.h:43
eSurfaceWaveForm
Definition dbpp_VS19WaveSimulator.h:34
@ STEP
Definition dbpp_VS19WaveSimulator.h:36
@ SINE
Definition dbpp_VS19WaveSimulator.h:35
bool m_saveResult2File
Definition dbpp_VS19WaveSimulator.h:116
float64 m_cfl
Definition dbpp_VS19WaveSimulator.h:113
std::shared_ptr< VS19WaveSimulator > sharedPtrTo()
share the ownership of 'this' with all existing std::shared_ptr that refer to *this.
Definition dbpp_VS19WaveSimulator.h:110
VS19WaveSimulator & operator=(const VS19WaveSimulator &)=delete
Disable assign construct.
VS19WaveSimulator(const VS19WaveSimulator &)=delete
Disable copy construct.
std::string m_activeAlgo
Definition dbpp_VS19WaveSimulator.h:114
void saveResult(const Uh &aUh, const Sfx::SfxTimePrm &aTimeSimEnd)
Definition dbpp_VS19WaveSimulator.cpp:186
ListofSectionsFlow m_ListSectFlow
Definition dbpp_VS19WaveSimulator.h:119
Definition HydUtils.h:15
Definition DamBreakProb.h:15
double float64
Definition dbpp_LDeltaOperator.h:12