Gowdy solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
numMethods/methodOfLines.h
Go to the documentation of this file.
00001 /**
00002  *  @file      methodOfLines.h
00003  *  @brief     Descriptors for various methods of lines (MoL).
00004  *  @author    Mikica Kocic
00005  *  @copyright GNU General Public License (GPLv3).
00006  */
00007 
00008 /////////////////////////////////////////////////////////////////////////////////////////
00009 /** @defgroup g11 Numerical Methods                                                    */
00010 /////////////////////////////////////////////////////////////////////////////////////////
00011                                                                                    /*@{*/
00012 /** Interface used for MoL integration that prepares and finalizes integration steps.
00013   */
00014 class IntegFace
00015 {
00016     friend class MoLIntegrator;
00017 
00018     /** Calculate the dependent variables from the prime state variables
00019      *  which are needed for the integration.
00020      */
00021     virtual void integStep_Prepare( Int m ) = 0;
00022 
00023     /** Perform the additional steps after each integration step.
00024      */
00025     virtual void integStep_Finalize( Int mNext, Int mPrev ) = 0;
00026 
00027     /** Checkpoint handler (e.g., checking for eventual NaNs).
00028      */
00029     virtual bool integStep_CheckForNaNs( Int m, Int nFrom, Int nTo ) = 0;
00030 
00031     /** Prepare the right-hand side of the evolution equations.
00032      */
00033     virtual void integStep_CalcEvolutionRHS( Int m ) = 0;
00034 
00035     /** Fix the state variables at the left boundary.
00036      */
00037     virtual void applyLeftBoundaryCondition( Int m ) = 0;
00038 
00039     /** Fix the state variables at the right boundary.
00040      */
00041     virtual void applyRightBoundaryCondition( Int m ) = 0;
00042 };
00043 
00044 /** @struct MoLDescriptor
00045  *  A method of lines (MoL) descriptor.
00046  *
00047  *  <pre>
00048  *       partial_t Y = L[Y],  </pre>
00049  *
00050  *  using the following algorithm:
00051  *  <pre>
00052  *      Y^{(0)}   = Y^{m},
00053  *      Y^{(i+1)} = Sum_{j=0}^{i} ( alpha_{ij} Y^{(j)} ) +            <- integStep_MoL
00054  *                  Delta t beta_i L[Y^{(i)}],   for i = 0, ..., N-1, <- integStep_MoLInit
00055  *      Y^{m+1}   = Y^{(N)}.    </pre>
00056  *
00057  *  The variables `Y^{(i)}`, `i = 0, ..., N`, are intermediate.
00058  *
00059  *  The method is completely specified by `N`, and arrays alpha and beta
00060  *  in the structure MoLDescriptor.
00061  *
00062  *  @see <a href="http://cactuscode.org/documentation/thorns/CactusBase-MoL.pdf">
00063  *       Method of Lines - Cactus Code</a>
00064  *
00065  */
00066 struct MoLDescriptor
00067 {
00068     const char* name;  //!< A MoL evolution method name
00069     int N;             //!< Number of intermediate steps (N <= 8)
00070     Real alpha[8][8];  //!< Alpha coefficients
00071     Real beta[8];      //!< Beta coefficients
00072 };
00073 
00074 // Time evolution methods provided by MoL
00075 
00076 MoLDescriptor ICN2 = //!< Iterative Crank-Nicolson, 2-iterations
00077 {
00078     "Iterative Crank-Nicolson", 2,
00079     { {  1., 0. },
00080       {  0., 1. } },
00081     { 1./2., 1. }
00082 };
00083 
00084 MoLDescriptor ICN3 = //!< Iterative Crank-Nicolson, 3-iterations
00085 {
00086     "Iterative Crank-Nicolson", 3,
00087     { {  1., 0., 0. },
00088       {  0., 1., 0. },
00089       {  0., 0., 1. } },
00090     { 1./2., 1./2., 1. }
00091 };
00092 
00093 MoLDescriptor RK1 = //!< Runge-Kutta, 1st order (the Euler method)
00094 {
00095     "Runge-Kutta", 1,
00096     { { 1. } },
00097     { 1. }
00098 };
00099 
00100 MoLDescriptor RK2 = //!< Runge-Kutta, 2nd order
00101 {
00102     "Runge-Kutta", 2,
00103     { {     1.,    0. },
00104       {  1./2., 1./2. } },
00105     { 1., 1./2. }
00106 };
00107 
00108 MoLDescriptor RK3 = //!< Runge-Kutta, 3rd order
00109 {
00110     "Runge-Kutta", 3,
00111     { {     1.,    0.,    0. },
00112       {  3./4., 1./4.,    0. },
00113       {  1./3.,    0., 2./3. } },
00114     { 1., 1./4., 2./3. }
00115 };
00116 
00117 MoLDescriptor RK4 = //!< Runge-Kutta, 4th order
00118 {
00119     "Runge-Kutta", 4,
00120     { {     1.,    0.,    0.,    0. },
00121       {     1.,    0.,    0.,    0. },
00122       {     1.,    0.,    0.,    0. },
00123       { -1./3., 1./3., 2./3., 1./3. } },
00124     { 1./2., 1./2., 1., 1./6. }
00125 };
00126                                                                                    /*@}*/
00127 /////////////////////////////////////////////////////////////////////////////////////////