LifeV
TimeAdvanceBDFVariableStep.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  * @file
29  * @brief File containing a class for an easy handling of different order time
30  * discretizations/extrapolations BDF based
31  *
32  * @author Alessandro Veneziani <ale@mathcs.emory.edu>
33  * @author Christophe Prud'homme <christophe.prudhomme@epfl.ch>
34  * @author C. Winkelmann
35  * @author Mauro Perego
36  * @author Umberto Villa <uvilla@emory.edu>
37  *
38  * @contributor Claudia Colciago
39  * @mantainer Claudia Colciago
40  */
41 
42 
43 #ifndef _BDF_VARIABLE_TIMESTEP_H
44 #define _BDF_VARIABLE_TIMESTEP_H
45 
46 #include <lifev/core/LifeV.hpp>
47 #include <lifev/core/array/VectorEpetra.hpp>
48 
49 namespace LifeV
50 {
51 const UInt bdfMaxOrder = 6;
53 
54 
55 //!TimeAdvanceBDFVariableStep - Backward differencing formula time discretization with non-uniform time step
56 /*!
57 
58  A differential equation of the form
59 
60  \f$ M u' = A u + f \f$
61 
62  is discretized in time as
63 
64  \f$ M p'(t_{k+1}) = A u_{k+1} + f_{k+1} \f$
65 
66  where p denotes the polynomial of order n in t that interpolates
67  \f$ (t_i,u_i) \f$ for i = k-n+1,...,k+1.
68 
69  The approximative time derivative \f$ p'(t_{k+1}) \f$ is a linear
70  combination of state vectors \f$ u_i \f$:
71 
72  \f$ p'(t_{k+1}) = \frac{1}{\Delta t} (\alpha_0 u_{k+1} - \sum_{i=0}^n \alpha_i u_{k+1-i} )\f$
73 
74  Thus we have
75 
76  \f$ \frac{\alpha_0}{\Delta t} M u_{k+1} = A u_{k+1} + f + M \bar{p} \f$
77 
78  with
79 
80  \f$ \bar{p} = \frac{1}{\Delta t} \sum_{i=1}^n \alpha_i u_{k+1-i} \f$
81 
82  This class stores the n last state vectors in order to be able to
83  calculate \f$ \bar{p} \f$. It also provides \f$ \alpha_i \f$
84  and can extrapolate the the new state from the n last states with a
85  polynomial of order n-1:
86 
87  \f$ u_{k+1} \approx \sum_{i=0}^{n-1} \beta_i u_{k-i} \f$
88 
89  The class allows to change the time-steps, recomputing the coefficients.
90  to change \f$ \Delta t \f$ at each time-step,
91  use shift_right(uCurrent, timeStepNew) instead of shift_right(uCurrent).
92 
93  Other methods that could be helpful while adapting in time are:
94  set_deltat, store_unk and restore_unk
95 */
96 template< typename FEVectorType = VectorEpetra >
98 {
99 public:
100 
101  //! @name Public Types
102  //@{
104  typedef FEVectorType feVector_Type;
107  //@}
108 
109 
110  //! @name Constructor & Destructor
111  //@{
112 
113  //! Empty constructor
115 
116  //!Destructor
118  //@}
119 
120  //! @name Methods
121  //@{
122 
123  //!Setup the TimeAdvanceBDFVariableStep with order n
124  /*!
125  @param order order of the BDF
126  */
127  void setup ( const UInt order );
128 
129  //! Initialize all the entries of the unknown vector to be derived with the
130  //! vector u0 (duplicated if startup=0)
131  /*!
132  If startup = 0, it initializes all the entries of the unknown vectors with a given function
133  The array of initial conditions needed by the selected BDF is
134  initialized as follows: _unk=[ u0(t0), u0(t0-dt), u0(t0-2*dt), ...]
135  When startUp = true, only M_unknown[0] is initialized (with u0).
136  At the first step, class Bfd computes the coefficients of BDF1,
137  at the second step, the coefficient of BDF2, and so on,
138  until it reaches the wanted method.
139  Second order of accuracy is obtained using this procedure to startup BDF2.
140  Using the startup procedure with BDF3, the accuracy order is limited to the second order;
141  anyway it is better to use the startup procedure instead of taking u_{-2} = u_{-1} = u_0.
142 
143  @param u0 initial condition vector
144  @param timeStep time step
145  @param startup
146  */
147  void setInitialCondition ( feVector_Type u0, Real const timeStep, bool startup = 0 );
148 
149  //! Initialize all the entries of the unknown vector to be derived with a
150  //! set of vectors u0s
151  /*!
152  @param u0s initial condition vectors
153  @param timeStep time step
154  */
155  void setInitialCondition ( std::vector<feVector_Type> u0s, Real const timeStep );
156 
157  //!Initialize all the entries of the unknonwn vectors with a given function
158  /*!
159  The array of initial conditions needed by the selected BDF is
160  initialized as follows: M_unknown=[ u0Function(t0),
161  u0Function(t0-dt), u0Function(t0-2*dt), ...]
162  For the space dependence of the initial conditions we need informations
163  on:
164  @param u0Function the function we want to interpolate
165  @param u0Vector corrected mapped vector, it contains the u0Function(t0) in output
166  @param feSpace finite element space
167  @param t0 initial time (t0) and the
168  @param timeStep time step (for solutions before the initial instant)
169 
170  Based on the NavierStokesHandler::initialize by M. Fernandez
171  */
172  template<typename FunctionType, typename FESpaceType>
173  void setInitialCondition ( const FunctionType& u0Function, feVector_Type& u0Vector, FESpaceType& feSpace,
174  Real t0, Real timeStep );
175 
176  //! Returns the right hand side \f$ \bar{p} \f$ of the time derivative
177  //! formula divided by dt
178  /*!
179  @return a feVector_Type, by default feVector_Type = VectorEpetra
180  */
181 
183 
184  //! Returns the right hand side \f$ \bar{p} \f$ of the time derivative
185  //! formula divided by timeStep (backward compatibility version, will be discontinued)
186  /*!
187  @param timeStep time step, 1 by default
188  @return a feVector_Type, by default feVector_Type = VectorEpetra
189  */
190  feVector_Type rhsContributionTimeStep ( Real timeStep = 1 ) const;
191 
192  //! Compute the polynomial extrapolation approximation of order n-1 of
193  //! u^{n+1} defined by the n stored state vectors
195 
196  //! Update the vectors of the previous time steps by shifting on the right
197  //! the old values.
198  /*!
199  @param uCurrent current (new) value of the state vector
200  */
201  void shiftRight ( feVector_Type const& uCurrent );
202 
203  //! Update the vectors of the previous time steps by shifting on the right
204  //! the old values.
205  /*!
206  Set the the new time step and shift right the old time steps.
207  @param uCurrent current (new) value of the state vector
208  @param timeStepNew new value of the time step
209  */
210  void shiftRight ( feVector_Type const& uCurrent, Real timeStepNew );
211 
212  //! Save the current vector M_unknowns and the current vector M_timeStep
213  void storeSolution();
214 
215  //! Restore the vector M_unknowns and the vector M_timeStep with the ones saved with store_unk()
216  void restoreSolution();
217 
218  //! It is equivalent to do : storeSolution() + setTimeStep()
219  /*!
220  @param timeStep new time step
221  */
222  void restoreSolution ( Real timeStep );
223 
224  //! Show informations about the BDF
225  void showMe() const;
226 
227  //@}
228 
229  //! @name Set Methods
230  //@{
231  //! Replace the current time-step with timeStep and computes the coefficients a_i and beta_i as functions of M_timeStep.
232  /*!
233  @param timeStep time step
234  */
235  void setTimeStep ( Real timeStep );
236 
237  //@}
238 
239 
240  //! @name Get Methods
241  //@{
242  //! Return the i-th coefficient of the time derivative alpha_i
243  /*!
244  @param i index of the coefficient
245  */
246  const Real& coefficientDerivative ( UInt i ) const;
247 
248  //! Return the i-th coefficient of the time derivative alpha_i divided by dt
249  /*!
250  @param i index of the coefficient
251  */
253 
254  //! Return the i-th coefficient of the time extrapolation beta_i
255  /*!
256  @param i index of the coefficient
257  */
258  const Real& coefficientExtrapolation ( UInt i ) const;
259 
260  //! Return the vector of the time steps, ordered starting from the most recent one.
262  {
263  return M_timeStep;
264  }
265 
266  //! Return a vector with the last n state vectors
268  {
269  return M_unknowns;
270  }
271 
273  {
274  return M_unknownsBack;
275  }
276 
277  //@}
278 
279 private:
280 
281  //! Private methods
282  //@{
283  //! Computes the coefficients a_i and beta_i as functions of _M_delta_t.
284  /*!
285  Arbitrary order, variable time step BDF coefficients.
286  Reference: Comincioli pag. 618-619
287  Matlab implementation:
288  function [alpha0, alpha, beta] = compute_coef(dts, order)
289  assert( (length(dts) == order) );
290  rho = dts(1)./cumsum(dts);
291 
292  alpha0 = sum(rho);
293  alpha = zeros(order,1);
294  beta = zeros(order,1);
295 
296  for j = 1:order
297  ind = setdiff([1:order],j);
298  beta(j) = 1/prod(1-rho(ind)/rho(j));
299  alpha(j) = rho(j)*beta(j);
300  end
301 
302  end
303  */
304  void computeCoefficient();
305 
306  //@}
307 
308  //! Order of the BDF derivative/extrapolation: the time-derivative
309  //! coefficients vector has size n+1, the extrapolation vector has size n
311 
312  //! Coefficients \f$ \alpha_i \f$ of the time bdf discretization
314 
315  //! Coefficients \f$ \beta_i \f$ of the extrapolation
317 
318  //! container_Type \f$ \delta_t \f$ of time intervals
321 
322  //! Last n state vectors
325 
326 };
327 
328 // ===================================================
329 // Constructors & Destructor
330 // ===================================================
331 template<typename FEVectorType>
333  :
334  M_order ( 0 ),
335  M_alpha ( M_order + 1 ),
336  M_beta ( M_order ),
337  M_timeStep ( ScalarVector ( M_order, 1. ) )
338 {}
339 
340 
341 template<typename FEVectorType>
343 {}
344 
345 // ===================================================
346 // Methods
347 // ===================================================
348 template<typename FEVectorType>
349 void TimeAdvanceBDFVariableStep<FEVectorType>::setup ( const UInt order )
350 {
351  M_order = order;
352  M_alpha.resize ( M_order + 1 );
353  M_beta.resize ( M_order );
354  M_timeStep = ScalarVector ( M_order, 1. );
355 
356  if ( order <= 0 || order > bdfMaxOrder )
357  {
358  std::ostringstream errorMessage;
359  errorMessage << "Error: wrong BDF order\n"
360  << " you want to use BDF order " << order << "\n"
361  << " we support BDF order from 1 to " << bdfMaxOrder << "\n";
362  throw std::invalid_argument ( errorMessage.str() );
363  }
365  M_unknowns.reserve ( order );
366 }
367 
368 
369 template<typename FEVectorType>
370 void TimeAdvanceBDFVariableStep<FEVectorType>::setInitialCondition ( feVector_Type u0, Real const timeStep, bool startup )
371 {
372  M_unknowns.resize ( 0 );
373  for ( UInt i = 0; i < M_order; i++ )
374  {
375  feVectorPtr_Type feVectorPtr ( new feVector_Type ( u0 ) );
376  M_unknowns.push_back ( feVectorPtr );
377  M_timeStep[ i ] = timeStep;
378  }
379 
380  if ( startup )
381  {
382  for ( UInt i = 1; i < M_order; i++ )
383  {
384  M_timeStep[ i ] = 1e20;
385  }
386  }
387 
389 
390  return ;
391 }
392 
393 
394 template<typename FEVectorType>
395 void TimeAdvanceBDFVariableStep<FEVectorType>::setInitialCondition ( std::vector<feVector_Type> u0s, Real const timeStep )
396 {
397  UInt n0 ( u0s.size() );
398  // Check if u0s has the right dimensions
399  ASSERT ( n0 >= M_order, "Initial data are not enough for the selected BDF" );
400 
401  M_unknowns.resize (0);
402  for ( UInt i = 0; i < M_order; i++ )
403  {
404  feVectorPtr_Type tmp ( new feVector_Type ( u0s[ i ] ) );
405  M_unknowns.push_back ( tmp );
406  M_timeStep[ i ] = timeStep;
407  }
408 
409  computeCoefficient();
410 
411  // if n0>n, only the first n inital data will be considered
412  if ( n0 > M_order )
413  {
414  std::cout << "The initial data set is larger than needed by the BDF."
415  << std::endl;
416  std::cout << "Only the first " << M_order << " data will be considered. "
417  << std::endl;
418  }
419 
420  return ;
421 }
422 
423 
424 template<typename FEVectorType>
425 template<typename FunctionType, typename FESpaceType>
426 void TimeAdvanceBDFVariableStep<FEVectorType>::setInitialCondition ( const FunctionType& u0Function, feVector_Type& u0Vector,
427  FESpaceType& feSpace, Real t0, Real timeStep )
428 {
429  M_unknowns.resize ( 0 );
430 
431  for ( UInt i = 0 ; i < M_order; ++i )
432  {
433  feVectorPtr_Type tmp ( new feVector_Type ( u0Vector ) );
434  M_unknowns.push_back ( tmp );
435  feSpace.interpolate ( static_cast<typename FESpaceType::function_Type> ( u0Function ), *M_unknowns[ i ], t0 - i * timeStep );
436  M_timeStep[ i ] = timeStep;
437  }
438  u0Vector = *M_unknowns[ 0 ];
439 
441 
442  return ;
443 }
444 
445 
446 template<typename FEVectorType>
447 typename TimeAdvanceBDFVariableStep<FEVectorType>::feVector_Type
449 {
450  feVector_Type uTimeDerivative ( *M_unknowns[ 0 ] );
451  uTimeDerivative *= M_alpha[ 1 ] / M_timeStep[ 0 ];
452 
453  for ( UInt i = 1; i < M_order; ++i )
454  {
455  uTimeDerivative += ( M_alpha[ i + 1 ] / M_timeStep[ 0 ] ) * *M_unknowns[ i ];
456  }
457 
458  return uTimeDerivative;
459 }
460 
461 
462 template<typename FEVectorType>
463 typename TimeAdvanceBDFVariableStep<FEVectorType>::feVector_Type
464 TimeAdvanceBDFVariableStep<FEVectorType>::rhsContributionTimeStep ( Real timeStep ) const
465 {
466  feVector_Type uTimeDerivative ( *M_unknowns[ 0 ] );
467  uTimeDerivative *= M_alpha[ 1 ] / timeStep;
468 
469  for ( UInt i = 1; i < M_order; ++i )
470  {
471  uTimeDerivative += ( M_alpha[ i + 1 ] / timeStep ) * *M_unknowns[ i ];
472  }
473 
474  return uTimeDerivative;
475 }
476 
477 
478 template<typename FEVectorType>
479 typename TimeAdvanceBDFVariableStep<FEVectorType>::feVector_Type
481 {
482  feVector_Type uExtrapolated ( *M_unknowns[ 0 ] );
483  uExtrapolated *= M_beta[ 0 ];
484 
485  for ( UInt i = 1; i < M_order; ++i )
486  {
487  uExtrapolated += M_beta[ i ] * *M_unknowns[ i ];
488  }
489 
490  return uExtrapolated;
491 }
492 
493 
494 template<typename FEVectorType>
495 void
496 TimeAdvanceBDFVariableStep<FEVectorType>::shiftRight ( feVector_Type const& uCurrent )
497 {
498  typedef typename feVectorPtrContainer_Type::iterator bdfContainerIterator_Type;
499  bdfContainerIterator_Type it = M_unknowns.end() - 1;
500  bdfContainerIterator_Type itMinusOne = M_unknowns.end() - 1;
501  bdfContainerIterator_Type itBegin = M_unknowns.begin();
502 
503  for ( ; it != itBegin; --it )
504  {
505  itMinusOne--;
506  *it = *itMinusOne;
507  }
508  feVectorPtr_Type tmp ( new feVector_Type ( uCurrent ) );
509  *itBegin = tmp;
510 
511  for ( UInt i = M_order - 1; i > 0; i-- )
512  {
513  M_timeStep[ i ] = M_timeStep[ i - 1 ];
514  }
515 
517 }
518 
519 template<typename FEVectorType>
520 void
521 TimeAdvanceBDFVariableStep<FEVectorType>::shiftRight ( feVector_Type const& uCurrent, Real timeStepNew )
522 {
523 
524  typedef typename feVectorPtrContainer_Type::iterator bdfContainerIterator_Type;
525  bdfContainerIterator_Type it = M_unknowns.end() - 1;
526  bdfContainerIterator_Type itMinusOne = M_unknowns.end() - 1;
527  bdfContainerIterator_Type itBegin = M_unknowns.begin();
528 
529  for ( ; it != itBegin; --it )
530  {
531  itMinusOne--;
532  *it = *itMinusOne;
533  }
534 
535  feVectorPtr_Type tmp ( new feVector_Type ( uCurrent ) );
536  *itBegin = tmp;
537 
538  for ( UInt i = M_order - 1; i > 0; i-- )
539  {
540  M_timeStep[ i ] = M_timeStep[ i - 1 ];
541  }
542  M_timeStep[ 0 ] = timeStepNew;
543 
545 }
546 
547 template<typename FEVectorType>
549 {
550  typedef typename feVectorPtrContainer_Type::iterator bdfContainerIterator_Type;
551 
552  M_unknownsBack.resize ( 0 );
553  for (bdfContainerIterator_Type it = M_unknowns.begin(); it < M_unknowns.end(); ++it)
554  {
555  M_unknownsBack.push_back ( new feVectorPtr_Type ( **it ) );
556  }
557 
559 }
560 
561 
562 template<typename FEVectorType>
564 {
565  typedef typename feVectorPtrContainer_Type::iterator bdfContainerIterator_Type;
566 
567  M_unknowns.resize ( 0 );
568  for ( bdfContainerIterator_Type it = M_unknownsBack.begin(); it < M_unknownsBack.end(); ++it )
569  {
570  M_unknowns.push_back ( new feVectorPtr_Type ( **it ) );
571  }
572 
573 
575 
577 }
578 
579 template<typename FEVectorType>
580 void TimeAdvanceBDFVariableStep<FEVectorType>::restoreSolution ( Real timeStep )
581 {
582  typedef typename feVectorPtrContainer_Type::iterator bdfContainerIterator_Type;
583 
584  M_unknowns.resize ( 0 );
585  for ( bdfContainerIterator_Type it = M_unknownsBack.begin(); it < M_unknownsBack.end(); ++it )
586  {
587  M_unknowns.push_back ( new feVectorPtr_Type ( **it ) );
588  }
589 
591  M_timeStep[ 0 ] = timeStep;
592 
594 }
595 
596 template<typename FEVectorType>
597 void
598 TimeAdvanceBDFVariableStep<FEVectorType>::showMe() const
599 {
600  std::cout << "*** BDF Time discretization of order " << M_order << " ***"
601  << std::endl;
602  std::cout << " Coefficients: " << std::endl;
603  for ( UInt i = 0; i < M_order + 1; ++i )
604  std::cout << " alpha(" << i << ") = " << M_alpha[ i ]
605  << std::endl;
606  for ( UInt i = 0; i < M_order; ++i )
607  std::cout << " beta (" << i << ") = " << M_beta[ i ]
608  << std::endl;
609 
610  return ;
611 }
612 
613 // ===================================================
614 //Set Methods
615 // ===================================================
616 template<typename FEVectorType>
617 void TimeAdvanceBDFVariableStep<FEVectorType>::setTimeStep ( Real timeStep )
618 {
619  M_timeStep[ 0 ] = timeStep;
621 }
622 
623 // ===================================================
624 // Get Methods
625 // ===================================================
626 template<typename FEVectorType>
627 const Real&
629 {
630  // Pay attention: i is c-based indexed
631  ASSERT ( i < M_order + 1,
632  "Error in specification of the time derivative coefficient for the BDF formula (out of range error)" );
633  return M_alpha[ i ];
634 }
635 
636 
637 template<typename FEVectorType>
638 Real
640 {
641  // Pay attention: i is c-based indexed
642  ASSERT ( i < M_order + 1,
643  "Error in specification of the time derivative coefficient for the BDF formula (out of range error)" );
644  return M_alpha[ i ] / M_timeStep[ 0 ];
645 }
646 
647 
648 template<typename FEVectorType>
649 const Real&
651 {
652  // Pay attention: i is c-based indexed
653  ASSERT ( i < M_order,
654  "Error in specification of the time derivative coefficient for the BDF formula (out of range error)" );
655  return M_beta[ i ];
656 }
657 
658 // ===================================================
659 // Private Methods
660 // ===================================================
661 template<typename FEVectorType>
663 {
664  container_Type rho ( ScalarVector ( M_order, M_timeStep[ 0 ] ) );
665 
666  container_Type cumulativeSumTimeStep ( M_order );
667  std::partial_sum ( M_timeStep.begin(), M_timeStep.end(), cumulativeSumTimeStep.begin() );
668 
669  std::transform ( rho.begin(), rho.end(), cumulativeSumTimeStep.begin(),
670  rho.begin(), std::divides<double>() );
671 
672  M_alpha[ 0 ] = boost::numeric::ublas::sum ( rho );
673 
674  for ( UInt j = 0; j < M_order; ++j )
675  {
676  Real tmp ( 1.0 );
677 
678  if ( rho[j] != 0 ) //rho[j] may be 0 with the start-up procedure
679  {
680  for ( UInt kk = 0; kk < M_order; ++kk )
681  {
682  if ( kk != j )
683  {
684  tmp *= ( 1 - rho[ kk ] / rho[ j ] );
685  }
686  }
687  M_alpha[ j + 1 ] = rho[ j ] / tmp;
688  M_beta[ j ] = 1. / tmp;
689  }
690  else //we don't have enough initial data to start a higher order BDF.
691  {
692  M_alpha[ j + 1 ] = 0;
693  M_beta[ j ] = 0;
694  }
695  }
696 }
697 
698 } //Namespace LifeV
699 
700 #endif /*_BDF_VARIABLE_TIMESTEP_H*/
void shiftRight(feVector_Type const &uCurrent, Real timeStepNew)
Update the vectors of the previous time steps by shifting on the right the old values.
feVector_Type extrapolateSolution() const
Compute the polynomial extrapolation approximation of order n-1 of u^{n+1} defined by the n stored st...
void restoreSolution()
Restore the vector M_unknowns and the vector M_timeStep with the ones saved with store_unk() ...
void setInitialCondition(std::vector< feVector_Type > u0s, Real const timeStep)
Initialize all the entries of the unknown vector to be derived with a set of vectors u0s...
void setup(const UInt order)
Setup the TimeAdvanceBDFVariableStep with order n.
void storeSolution()
Save the current vector M_unknowns and the current vector M_timeStep.
UInt M_order
Order of the BDF derivative/extrapolation: the time-derivative coefficients vector has size n+1...
container_Type M_beta
Coefficients of the extrapolation.
const feVectorPtrContainer_Type & stateVectorBack() const
std::vector< feVectorPtr_Type > feVectorPtrContainer_Type
void setTimeStep(Real timeStep)
Replace the current time-step with timeStep and computes the coefficients a_i and beta_i as functions...
Real coefficientDerivativeOverTimeStep(UInt i) const
Return the i-th coefficient of the time derivative alpha_i divided by dt.
void restoreSolution(Real timeStep)
It is equivalent to do : storeSolution() + setTimeStep()
container_Type M_timeStep
container_Type of time intervals
TimeAdvanceBDFVariableStep - Backward differencing formula time discretization with non-uniform time ...
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
const Real & coefficientExtrapolation(UInt i) const
Return the i-th coefficient of the time extrapolation beta_i.
feVectorPtrContainer_Type M_unknowns
Last n state vectors.
void showMe() const
Show informations about the BDF.
const feVectorPtrContainer_Type & stateVector() const
Return a vector with the last n state vectors.
double Real
Generic real data.
Definition: LifeV.hpp:175
feVector_Type rhsContributionTimeStep(Real timeStep=1) const
Returns the right hand side of the time derivative formula divided by timeStep (backward compatibili...
container_Type M_alpha
Coefficients of the time bdf discretization.
const container_Type & timeStepVector() const
Return the vector of the time steps, ordered starting from the most recent one.
const UInt bdfMaxOrder
void setInitialCondition(feVector_Type u0, Real const timeStep, bool startup=0)
Initialize all the entries of the unknown vector to be derived with the vector u0 (duplicated if star...
boost::numeric::ublas::vector< Real > ScalarVector
const Real & coefficientDerivative(UInt i) const
Return the i-th coefficient of the time derivative alpha_i.
std::shared_ptr< feVector_Type > feVectorPtr_Type
void shiftRight(feVector_Type const &uCurrent)
Update the vectors of the previous time steps by shifting on the right the old values.
feVector_Type rhsContribution() const
Returns the right hand side of the time derivative formula divided by dt.
void setInitialCondition(const FunctionType &u0Function, feVector_Type &u0Vector, FESpaceType &feSpace, Real t0, Real timeStep)
Initialize all the entries of the unknonwn vectors with a given function.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191