Nektar++
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
 
- 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. More...
 
LUE TripleArrayUpdateSolutionVector ()
 
LUE void SetSolutionVector (const size_t Offset, const DoubleArray &y)
 Sets the solution vector of the ODE. More...
 
LUE void InitializeScheme (const NekDouble deltaT, ConstDoubleArray &y_0, const NekDouble time, const TimeIntegrationSchemeOperators &op)
 Explicit integration of an ODE. More...
 
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. More...
 
LUE ConstDoubleArrayv_TimeIntegrate (const size_t timestep, const NekDouble delta_t) override
 Worker method that actually does the time integration. More...
 
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. More...
 
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
 
virtual LUE std::string v_GetName () const =0
 
virtual LUE std::string v_GetVariant () const =0
 
virtual LUE size_t v_GetOrder () const =0
 
virtual LUE std::vector< NekDoublev_GetFreeParams () const =0
 
virtual LUE TimeIntegrationSchemeType v_GetIntegrationSchemeType () const =0
 
virtual LUE NekDouble v_GetTimeStability () const =0
 
virtual LUE size_t v_GetNumIntegrationPhases () const =0
 
virtual LUE const TripleArrayv_GetSolutionVector () const =0
 
virtual LUE TripleArrayv_UpdateSolutionVector ()=0
 
virtual LUE void v_SetSolutionVector (const size_t Offset, const DoubleArray &y)=0
 
virtual LUE void v_InitializeScheme (const NekDouble deltaT, ConstDoubleArray &y_0, const NekDouble time, const TimeIntegrationSchemeOperators &op)=0
 
virtual LUE ConstDoubleArrayv_TimeIntegrate (const size_t timestep, const NekDouble delta_t)=0
 
virtual LUE void v_print (std::ostream &os) const =0
 
virtual LUE void v_printFull (std::ostream &os) const =0
 
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 57 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 60 of file AdamsBashforthTimeIntegrationSchemes.h.

62 : TimeIntegrationSchemeGLM(variant, order, freeParams)
63 {
64 // Currently up to 4th order is implemented.
65 ASSERTL1(1 <= order && order <= 4,
66 "AdamsBashforth Time integration scheme bad order (1-4): " +
67 std::to_string(order));
68
70
71 for (size_t n = 0; n < order; ++n)
72 {
74 new TimeIntegrationAlgorithmGLM(this));
75 }
76
77 // Next to last phase
78 if (order > 1)
79 {
81 m_integration_phases[order - 2], order - 1);
82 }
83
84 // Last phase
86 m_integration_phases[order - 1], order);
87
88 // Initial phases
89 switch (order)
90 {
91 case 1:
92 // No intial phases.
93 break;
94
95 case 2:
96 // Intial phase set above
97 break;
98
99 case 3:
100 // Order 2
102 m_integration_phases[0], "", 2, std::vector<NekDouble>());
103 break;
104
105 case 4:
106 // SSP Order 3
108 m_integration_phases[0], "SSP", 3,
109 std::vector<NekDouble>());
110 // SSP Order 3
112 m_integration_phases[1], "SSP", 3,
113 std::vector<NekDouble>());
114 break;
115
116 default:
117 ASSERTL1(false,
118 "AdamsBashforth Time integration scheme bad order: " +
119 std::to_string(order));
120 }
121 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
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)
TimeIntegrationAlgorithmGLMVector m_integration_phases
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 ( )
inlineoverride

Definition at line 123 of file AdamsBashforthTimeIntegrationSchemes.h.

124 {
125 }

Member Function Documentation

◆ create()

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

Definition at line 127 of file AdamsBashforthTimeIntegrationSchemes.h.

129 {
130 TimeIntegrationSchemeSharedPtr p = MemoryManager<
131 AdamsBashforthTimeIntegrationScheme>::AllocateSharedPtr(variant,
132 order,
133 freeParams);
134
135 return p;
136 }
AdamsBashforthTimeIntegrationScheme(std::string variant, size_t order, std::vector< NekDouble > freeParams)
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr

References CellMLToNektar.cellml_metadata::p.

◆ SetupSchemeData()

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

Definition at line 140 of file AdamsBashforthTimeIntegrationSchemes.h.

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

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 219 of file AdamsBashforthTimeIntegrationSchemes.h.

220 {
221 return std::string("AdamsBashforth");
222 }

◆ v_GetTimeStability()

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

Implements Nektar::LibUtilities::TimeIntegrationScheme.

Definition at line 224 of file AdamsBashforthTimeIntegrationSchemes.h.

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

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

Member Data Documentation

◆ className

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

Definition at line 138 of file AdamsBashforthTimeIntegrationSchemes.h.