36 #ifndef NEKTAR_LIB_UTILITIES_FOUNDATIONS_TIMEINTEGRATIONSCHEME_H
37 #define NEKTAR_LIB_UTILITIES_FOUNDATIONS_TIMEINTEGRATIONSCHEME_H
47 namespace LibUtilities
50 class TimeIntegrationScheme;
101 "NoTimeIntegrationMethod",
102 "AdamsBashforthOrder1",
103 "AdamsBashforthOrder2",
104 "AdamsBashforthOrder3",
105 "AdamsMoultonOrder1",
106 "AdamsMoultonOrder2",
109 "ClassicalRungeKutta4",
110 "RungeKutta2_ModifiedEuler",
111 "RungeKutta2_ImprovedEuler",
144 "NoTimeIntegrationSchemeType",
146 "DiagonallyImplicit",
159 typedef const Array<OneD, const Array<OneD, NekDouble> >
InArrayType;
162 typedef boost::function< void (InArrayType&, OutArrayType&, const NekDouble) >
FunctorType1;
163 typedef boost::function< void (InArrayType&, OutArrayType&, const NekDouble, const NekDouble) >
FunctorType2;
177 template<
typename FuncPo
interT,
typename ObjectPo
interT>
180 m_functors1[0] = boost::bind(func, obj, _1, _2, _3);
183 template<
typename FuncPo
interT,
typename ObjectPo
interT>
186 m_functors1[1] = boost::bind(func, obj, _1, _2, _3);
189 template<
typename FuncPo
interT,
typename ObjectPo
interT>
192 m_functors1[2] = boost::bind(func, obj, _1, _2, _3);
195 template<
typename FuncPo
interT,
typename ObjectPo
interT>
198 m_functors1[3] = boost::bind(func, obj, _1, _2, _3);
201 template<
typename FuncPo
interT,
typename ObjectPo
interT>
204 m_functors2[0] = boost::bind(func, obj, _1, _2, _3, _4);
212 ASSERTL1(!(
m_functors1[0].empty()),
"OdeRhs should be defined for this time integration scheme");
220 ASSERTL1(!(
m_functors1[1].empty()),
"OdeExplicitRhs should be defined for this time integration scheme");
228 ASSERTL1(!(
m_functors1[2].empty()),
"OdeImplictRhs should be defined for this time integration scheme");
236 ASSERTL1(!(
m_functors1[3].empty()),
"Projection operation should be defined for this time integration scheme");
245 ASSERTL1(!(
m_functors2[0].empty()),
"ImplicitSolve should be defined for this time integration scheme");
303 return (*
this == *y);
308 return (!(*
this == y));
313 return (!(*
this == *y));
346 typedef NekManager<TimeIntegrationSchemeKey,
347 TimeIntegrationScheme,
360 typedef Array<OneD, Array<OneD, Array<OneD, NekDouble> > >
TripleArray;
365 typedef boost::function< void (ConstDoubleArray&, DoubleArray&, const NekDouble) >
FunctorType1;
366 typedef boost::function< void (ConstDoubleArray&, DoubleArray&, const NekDouble, const NekDouble) >
FunctorType2;
389 inline NekDouble A(
const unsigned int i,
const unsigned int j)
const
394 inline NekDouble B(
const unsigned int i,
const unsigned int j)
const
399 inline NekDouble U(
const unsigned int i,
const unsigned int j)
const
404 inline NekDouble V(
const unsigned int i,
const unsigned int j)
const
529 Array<OneD, Array<TwoD,NekDouble> >
m_A;
530 Array<OneD, Array<TwoD,NekDouble> >
m_B;
531 Array<TwoD,NekDouble>
m_U;
532 Array<TwoD,NekDouble>
m_V;
565 const Array<
OneD,
const Array<TwoD, NekDouble> >&
A,
566 const Array<
OneD,
const Array<TwoD, NekDouble> >&
B,
567 const Array<TwoD, const NekDouble>&
U,
568 const Array<TwoD, const NekDouble>&
V)
const;
580 return y[0].num_elements();
585 return y[0][0].num_elements();
596 const Array<
OneD,
const Array<TwoD, NekDouble> >&
B,
597 const Array<TwoD, const NekDouble>&
U,
598 const Array<TwoD, const NekDouble>&
V)
const;
601 const Array<
OneD,
const Array<TwoD, NekDouble> >&
B,
602 const Array<TwoD, const NekDouble>&
U,
603 const Array<TwoD, const NekDouble>&
V)
const;
616 typedef Array<OneD, Array<OneD, Array<OneD, NekDouble> > >
TripleArray;
627 const Array<OneD, NekDouble>& t);
630 unsigned int npoints);
640 return m_scheme->GetIntegrationSchemeKey();
645 return m_scheme->GetIntegrationMethod();
702 return m_scheme->GetNmultiStepValues();
709 return m_scheme->GetNmultiStepDerivs();
716 return m_scheme->GetTimeLevelOffset();
723 int nMultiStepVals =
m_scheme->GetNmultiStepValues();
726 for(
int i = 0; i < nMultiStepVals; i++)
728 if( timeLevelOffset == offsetvec[i] )
733 ASSERTL1(
false,
"The solution vector of this scheme does not contain a value at the requested time-level");
741 int nMultiStepVals =
m_scheme->GetNmultiStepValues();
745 for(
int i = nMultiStepVals; i < size; i++)
747 if( timeLevelOffset == offsetvec[i] )
752 ASSERTL1(
false,
"The solution vector of this scheme does not contain a derivative at the requested time-level");
760 int nMultiStepVals =
m_scheme->GetNmultiStepValues();
763 for(
int i = 0; i < nMultiStepVals; i++)
765 if( timeLevelOffset == offsetvec[i] )
770 ASSERTL1(
false,
"The solution vector of this scheme does not contain a value at the requested time-level");
779 int nMultiStepVals =
m_scheme->GetNmultiStepValues();
782 for(
int i = 0; i < nMultiStepVals; i++)
784 if( timeLevelOffset == offsetvec[i] )
798 int nMultiStepVals =
m_scheme->GetNmultiStepValues();
802 for(
int i = nMultiStepVals; i < size; i++)
804 if( timeLevelOffset == offsetvec[i] )
824 int nMultiStepVals =
m_scheme->GetNmultiStepValues();
826 for(i = (nMultiStepVals-1); i > 0; i--)
831 for(i = (size-1); i > nMultiStepVals; i--)
841 Array<OneD,NekDouble>
m_t;
854 #endif //NEKTAR_LIB_UTILITIES_FOUNDATIONS_TIMEINTEGRATIONSCHEME_H