Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme Class Reference

#include <AdamsBashforthTimeIntegrationSchemes.h>

Inheritance diagram for Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme:
[legend]

Public Member Functions

 AdamsBashforthTimeIntegrationScheme (std::string variant, size_t order, std::vector< NekDouble > freeParams)
 
 ~AdamsBashforthTimeIntegrationScheme () override=default
 
- Public Member Functions inherited from Nektar::LibUtilities::TimeIntegrationSchemeGLM
LUE void InitializeSecondaryData (TimeIntegrationAlgorithmGLM *phase, NekDouble deltaT) const
 
- Public Member Functions inherited from Nektar::LibUtilities::TimeIntegrationScheme
LUE std::string GetFullName () const
 
LUE std::string GetName () const
 
LUE std::string GetVariant () const
 
LUE size_t GetOrder () const
 
LUE std::vector< NekDoubleGetFreeParams ()
 
LUE TimeIntegrationSchemeType GetIntegrationSchemeType ()
 
LUE NekDouble GetTimeStability () const
 
LUE size_t GetNumIntegrationPhases ()
 
LUE const TripleArrayGetSolutionVector () const
 Gets the solution vector of the ODE.
 
LUE TripleArrayUpdateSolutionVector ()
 
LUE void SetSolutionVector (const size_t Offset, const DoubleArray &y)
 Sets the solution vector of the ODE.
 
LUE void InitializeScheme (const NekDouble deltaT, ConstDoubleArray &y_0, const NekDouble time, const TimeIntegrationSchemeOperators &op)
 Explicit integration of an ODE.
 
LUE ConstDoubleArrayTimeIntegrate (const size_t timestep, const NekDouble delta_t)
 
LUE void print (std::ostream &os) const
 
LUE void printFull (std::ostream &os) const
 

Static Public Member Functions

static TimeIntegrationSchemeSharedPtr create (std::string variant, size_t order, std::vector< NekDouble > freeParams)
 
static LUE void SetupSchemeData (TimeIntegrationAlgorithmGLMSharedPtr &phase, size_t order)
 

Static Public Attributes

static std::string className
 

Protected Member Functions

LUE std::string v_GetName () const override
 
LUE NekDouble v_GetTimeStability () const override
 
- Protected Member Functions inherited from Nektar::LibUtilities::TimeIntegrationSchemeGLM
LUE std::string v_GetVariant () const override
 
LUE size_t v_GetOrder () const override
 
LUE std::vector< NekDoublev_GetFreeParams () const override
 
LUE TimeIntegrationSchemeType v_GetIntegrationSchemeType () const override
 
LUE size_t v_GetNumIntegrationPhases () const override
 
LUE const TripleArrayv_GetSolutionVector () const override
 
LUE TripleArrayv_UpdateSolutionVector () override
 
LUE void v_SetSolutionVector (const size_t Offset, const DoubleArray &y) override
 
LUE void v_InitializeScheme (const NekDouble deltaT, ConstDoubleArray &y_0, const NekDouble time, const TimeIntegrationSchemeOperators &op) override
 Worker method to initialize the integration scheme.
 
LUE ConstDoubleArrayv_TimeIntegrate (const size_t timestep, const NekDouble delta_t) override
 Worker method that actually does the time integration.
 
virtual LUE void v_InitializeSecondaryData (TimeIntegrationAlgorithmGLM *phase, NekDouble deltaT) const
 
LUE void v_print (std::ostream &os) const override
 Worker method to print details on the integration scheme.
 
LUE void v_printFull (std::ostream &os) const override
 
LUE TimeIntegrationSchemeGLM (std::string variant, size_t order, std::vector< NekDouble > freeParams)
 
 ~TimeIntegrationSchemeGLM () override
 
- Protected Member Functions inherited from Nektar::LibUtilities::TimeIntegrationScheme
virtual LUE std::string v_GetFullName () const
 
LUE TimeIntegrationScheme (std::string variant, size_t order, std::vector< NekDouble > freeParams)
 
LUE TimeIntegrationScheme (const TimeIntegrationScheme &in)=delete
 
virtual ~TimeIntegrationScheme ()=default
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::LibUtilities::TimeIntegrationSchemeGLM
TimeIntegrationAlgorithmGLMVector m_integration_phases
 
TimeIntegrationSolutionGLMSharedPtr m_solVector
 

Detailed Description

Definition at line 55 of file AdamsBashforthTimeIntegrationSchemes.h.

Constructor & Destructor Documentation

◆ AdamsBashforthTimeIntegrationScheme()

Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::AdamsBashforthTimeIntegrationScheme ( std::string  variant,
size_t  order,
std::vector< NekDouble freeParams 
)
inline

Definition at line 58 of file AdamsBashforthTimeIntegrationSchemes.h.

60 : TimeIntegrationSchemeGLM(variant, order, freeParams)
61 {
62 // Currently up to 4th order is implemented.
63 ASSERTL1(1 <= order && order <= 4,
64 "AdamsBashforth Time integration scheme bad order (1-4): " +
65 std::to_string(order));
66
68
69 for (size_t n = 0; n < order; ++n)
70 {
72 new TimeIntegrationAlgorithmGLM(this));
73 }
74
75 // Next to last phase
76 if (order > 1)
77 {
79 m_integration_phases[order - 2], order - 1);
80 }
81
82 // Last phase
84 m_integration_phases[order - 1], order);
85
86 // Initial phases
87 switch (order)
88 {
89 case 1:
90 // No intial phases.
91 break;
92
93 case 2:
94 // Intial phase set above
95 break;
96
97 case 3:
98 // Order 2
100 m_integration_phases[0], "", 2, std::vector<NekDouble>());
101 break;
102
103 case 4:
104 // SSP Order 3
106 m_integration_phases[0], "SSP", 3,
107 std::vector<NekDouble>());
108 // SSP Order 3
110 m_integration_phases[1], "SSP", 3,
111 std::vector<NekDouble>());
112 break;
113
114 default:
115 ASSERTL1(false,
116 "AdamsBashforth Time integration scheme bad order: " +
117 std::to_string(order));
118 }
119 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, size_t order)
static LUE void SetupSchemeData(TimeIntegrationAlgorithmGLMSharedPtr &phase, std::string variant, size_t order, std::vector< NekDouble > freeParams)
LUE TimeIntegrationSchemeGLM(std::string variant, size_t order, std::vector< NekDouble > freeParams)
std::shared_ptr< TimeIntegrationAlgorithmGLM > TimeIntegrationAlgorithmGLMSharedPtr
std::vector< TimeIntegrationAlgorithmGLMSharedPtr > TimeIntegrationAlgorithmGLMVector

References ASSERTL1, Nektar::LibUtilities::TimeIntegrationSchemeGLM::m_integration_phases, SetupSchemeData(), and Nektar::LibUtilities::RungeKuttaTimeIntegrationScheme::SetupSchemeData().

◆ ~AdamsBashforthTimeIntegrationScheme()

Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::~AdamsBashforthTimeIntegrationScheme ( )
overridedefault

Member Function Documentation

◆ create()

static TimeIntegrationSchemeSharedPtr Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::create ( std::string  variant,
size_t  order,
std::vector< NekDouble freeParams 
)
inlinestatic

Definition at line 123 of file AdamsBashforthTimeIntegrationSchemes.h.

125 {
126 TimeIntegrationSchemeSharedPtr p = MemoryManager<
127 AdamsBashforthTimeIntegrationScheme>::AllocateSharedPtr(variant,
128 order,
129 freeParams);
130
131 return p;
132 }
AdamsBashforthTimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr
std::vector< double > p(NPUPPER)

◆ SetupSchemeData()

static LUE void Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::SetupSchemeData ( TimeIntegrationAlgorithmGLMSharedPtr phase,
size_t  order 
)
inlinestatic

Definition at line 136 of file AdamsBashforthTimeIntegrationSchemes.h.

138 {
139 // clang-format off
140 constexpr NekDouble coefficients[5][4] =
141 { { 0., 0., 0., 0. },
142 // 1st Order
143 { 1., 0., 0., 0. },
144 // 2nd Order
145 { 3./ 2., -1./ 2., 0., 0. },
146 // 3rd Order
147 { 23./12., -16./12., 5./12., 0. },
148 // 4th Order
149 { 55./24., -59./24., 37./24., -9./24.} };
150 // clang-format on
151
152 phase->m_schemeType = eExplicit;
153 phase->m_order = order;
154 phase->m_name =
155 std::string("AdamsBashforthOrder" + std::to_string(phase->m_order));
156
157 phase->m_numsteps = phase->m_order;
158 phase->m_numstages = 1;
159
160 phase->m_A = Array<OneD, Array<TwoD, NekDouble>>(1);
161 phase->m_B = Array<OneD, Array<TwoD, NekDouble>>(1);
162
163 phase->m_A[0] =
164 Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numstages, 0.0);
165 phase->m_B[0] =
166 Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numstages, 0.0);
167 phase->m_U =
168 Array<TwoD, NekDouble>(phase->m_numstages, phase->m_numsteps, 0.0);
169 phase->m_V =
170 Array<TwoD, NekDouble>(phase->m_numsteps, phase->m_numsteps, 0.0);
171
172 // Coefficients
173
174 // B Coefficient for first row first column
175 phase->m_B[0][0][0] = coefficients[phase->m_order][0];
176
177 // B evaluation value shuffling second row first column
178 if (phase->m_order > 1)
179 {
180 phase->m_B[0][1][0] = 1.0;
181 }
182
183 // U Curent time step evaluation first row first column
184 phase->m_U[0][0] = 1.0;
185 phase->m_V[0][0] = 1.0;
186
187 // V Coefficients for first row additional columns
188 for (size_t n = 1; n < phase->m_order; ++n)
189 {
190 phase->m_V[0][n] = coefficients[phase->m_order][n];
191 }
192
193 // V evaluation value shuffling row n column n-1
194 for (size_t n = 2; n < phase->m_order; ++n)
195 {
196 phase->m_V[n][n - 1] = 1.0;
197 }
198
199 phase->m_numMultiStepValues = 1;
200 phase->m_numMultiStepImplicitDerivs = 0;
201 phase->m_numMultiStepExplicitDerivs = phase->m_order - 1;
202 phase->m_timeLevelOffset = Array<OneD, size_t>(phase->m_numsteps);
203 phase->m_timeLevelOffset[0] = 0;
204
205 // For order > 1 derivatives are needed.
206 for (size_t n = 1; n < phase->m_order; ++n)
207 {
208 phase->m_timeLevelOffset[n] = n;
209 }
210
211 phase->CheckAndVerify();
212 }
@ eExplicit
Formally explicit scheme.

References Nektar::LibUtilities::eExplicit.

Referenced by AdamsBashforthTimeIntegrationScheme().

◆ v_GetName()

LUE std::string Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::v_GetName ( ) const
inlineoverrideprotectedvirtual

Implements Nektar::LibUtilities::TimeIntegrationScheme.

Definition at line 215 of file AdamsBashforthTimeIntegrationSchemes.h.

216 {
217 return std::string("AdamsBashforth");
218 }

◆ v_GetTimeStability()

LUE NekDouble Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::v_GetTimeStability ( ) const
inlineoverrideprotectedvirtual

Implements Nektar::LibUtilities::TimeIntegrationScheme.

Definition at line 220 of file AdamsBashforthTimeIntegrationSchemes.h.

221 {
222 if (GetOrder() == 1)
223 {
224 return 2.0;
225 }
226 else if (GetOrder() == 2)
227 {
228 return 1.0;
229 }
230 else if (GetOrder() == 3)
231 {
232 return 0.545454545454545;
233 }
234 else if (GetOrder() == 4)
235 {
236 return 0.3;
237 }
238 else
239 {
240 return 2.0;
241 }
242 }

References Nektar::LibUtilities::TimeIntegrationScheme::GetOrder().

Member Data Documentation

◆ className

std::string Nektar::LibUtilities::AdamsBashforthTimeIntegrationScheme::className
static

Definition at line 134 of file AdamsBashforthTimeIntegrationSchemes.h.