DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
Testvs19_Nujic2StepsIntegrator.h
Go to the documentation of this file.
1
2#pragma once
3
4// BaseNumType includes
5#include "Sfx/Sfx_NodalValues.h"
6#include "Sfx/Sfx_FieldLattice.h"
7// SfxBase include
8#include "numeric/Sfx_TwoStepIntegrator.h"
9// Swe package includes
12// ...
13#include "Testvs19_RetRhsType.h"
14
15namespace Testvs19
16{
20 class Nujic2StepsIntegrator final : public Sfx::TwoStepIntegrator
21 {
23 using pairofield = std::pair<Sfx::FieldLattice, Sfx::FieldLattice>;
24
25 public:
31 Nujic2StepsIntegrator(const Sfx::FieldLattice& aU1, const Sfx::FieldLattice& aU2);
38 Nujic2StepsIntegrator( const Sfx::FieldLattice& aU1,
39 const Sfx::FieldLattice& aU2, Sfx::LDeltaOperator* aLdeltaOp);
40
41 //
42 // TwoStepIntegrator interface
43 //
44
48 void initialize() override final {};
52 void predictor() override final;
56 void corrector() override final;
62 RetRhsType* previousState() const override { return nullptr; /*RetRhsType{ m_midvlArrdU1, m_midvlArrdU1 }.asStdVector();*/ }
68 RetRhsType* currentState() const override
69 {
70 if (getStepType() == TwoStepIntegrator::eStepType::predictorStep)
71 {
72 return new RetRhsType{ m_midU1.values().asStdVector(), m_midU2.values().asStdVector() };
73 }
74 else
75 {
76 return new RetRhsType{ m_currU1.values().asStdVector(), m_currU2.values().asStdVector() };
77 }
78 }
79
84 {
85 // C++17 copy elison is mandatory??? use copy ctor to create field return type??
86 // return by value!
87 return std::make_pair(Sfx::FieldLattice{ m_currU1 }, Sfx::FieldLattice{ m_currU2 });
88 }
89 // C++17 mandatory copy Elision (materialize temporaries to xValue) no copy!!!!
90// RetRhsType::pairofstdvec midState() const { return RetRhsType { m_midvlArrdU1, m_midvlArrdU2 }.asStdVector(); }
91// RetRhsType::pairofstdvec curState() const { return RetRhsType { m_currvlArrU1, m_currvlArrU2 }.asStdVector(); }
92
93 //RetRhsType rhsmidState() const { return RetRhsType{ m_midU1State, m_midU2State }; }
94 //RetRhsType rhscurState() const { return RetRhsType{ m_curU1State, m_curU2State }; }
95
96 // this is simple, we want final state of the two-step algo
97 // Note sure about this one. I added this implementation in
98 // the first implementation of the NujicIntegrator.
99// virtual pairofield getCurrState() const override { return std::make_pair({ nullptr,nullptr }); }
100// virtual pairofield getPrevState() const override { return std::make_pair(nullptr, nullptr); }
101
107 void setInitialState( const Sfx::FieldLattice& aU1,
108 const Sfx::FieldLattice& aU2) override final;
114 {
115 m_upstreamNode = aBcNodes.first;
116 m_downstreamNode = aBcNodes.second;
117 }
118
122 void setBCValuesAtBothEnds( const std::pair<Sfx::Object*, Sfx::Object*>& aBcNodes) override final
123 {
124 m_upstreamNode = *static_cast<Sfx::Nodal_Value*>(aBcNodes.first);
125 m_downstreamNode = *static_cast<Sfx::Nodal_Value*>(aBcNodes.second);
126 }
127
130 void step();
131
132 private:
134 // Design Note
135 // i don't see why declaring a scalarField when we need a numerical array
136 // just make things more complicated (predictor/corrector) want to add
137 // values and with numerical array that support math operations its easier
138 Sfx::FieldLattice m_midU1;
139 Sfx::FieldLattice m_midU2;
140 Sfx::FieldLattice m_currU1;
141 Sfx::FieldLattice m_currU2;
142 Sfx::Nodal_Value m_upstreamNode;
143 Sfx::Nodal_Value m_downstreamNode;
144 };
145} // End of namespace
std::pair< Nodal_Value, Nodal_Value > pair_node
alias
Definition Sfx_ImposeBnd.h:27
Responsible to evaluate the spatial terms according to spatial discretization. The HOperator provides...
Definition Sfx_LDeltaOperator.h:34
void setBCValuesAtBothEnds(const std::pair< Sfx::Object *, Sfx::Object * > &aBcNodes) override final
set physical boundary
Definition Testvs19_Nujic2StepsIntegrator.h:122
void setBCAtBothEnds(const Sfx::EMcNeilBndCnd::pair_node &aBcNodes)
set physical boundary
Definition Testvs19_Nujic2StepsIntegrator.h:113
void corrector() override final
corrector step
Definition Testvs19_Nujic2StepsIntegrator.cpp:115
void predictor() override final
predictor step
Definition Testvs19_Nujic2StepsIntegrator.cpp:41
Sfx::FieldLattice m_midU2
Definition Testvs19_Nujic2StepsIntegrator.h:139
Sfx::FieldLattice m_currU1
Definition Testvs19_Nujic2StepsIntegrator.h:140
Sfx::FieldLattice m_midU1
Definition Testvs19_Nujic2StepsIntegrator.h:138
void step()
time stepping algorithm
Definition Testvs19_Nujic2StepsIntegrator.cpp:186
Nujic2StepsIntegrator(const Sfx::FieldLattice &aU1, const Sfx::FieldLattice &aU2)
ctor from field lattice values
Definition Testvs19_Nujic2StepsIntegrator.cpp:17
RetRhsType * currentState() const override
Getter.
Definition Testvs19_Nujic2StepsIntegrator.h:68
RetRhsType * previousState() const override
Getter.
Definition Testvs19_Nujic2StepsIntegrator.h:62
pairofield getFinalSolution() const noexcept
Getter.
Definition Testvs19_Nujic2StepsIntegrator.h:83
Sfx::Nodal_Value m_downstreamNode
Definition Testvs19_Nujic2StepsIntegrator.h:143
Sfx::LDeltaOperator * m_deltaOp
Definition Testvs19_Nujic2StepsIntegrator.h:133
Sfx::Nodal_Value m_upstreamNode
Definition Testvs19_Nujic2StepsIntegrator.h:142
void setInitialState(const Sfx::FieldLattice &aU1, const Sfx::FieldLattice &aU2) override final
set initial condition
Definition Testvs19_Nujic2StepsIntegrator.cpp:180
Sfx::FieldLattice m_currU2
Definition Testvs19_Nujic2StepsIntegrator.h:141
std::pair< Sfx::FieldLattice, Sfx::FieldLattice > pairofield
Definition Testvs19_Nujic2StepsIntegrator.h:23
void initialize() override final
set inital state of the integrator
Definition Testvs19_Nujic2StepsIntegrator.h:48
Wrapper data type used as RHS (right-hand-side) return structure.
Definition Testvs19_RetRhsType.h:14
Definition Testvs19_BaseRhsPhysicsAlgorithm.cpp:19