Ejemplo n.º 1
0
 public FLS_Timestepper_AB(FourierLevSetControl Control, double[] currentState, DelComputeChangerate _DelCompChange, DelEvolveFourier _DelEvolveFourier, int ABorder)
     : base(Control, currentState, _DelCompChange, _DelEvolveFourier)
 {
     ABsc_chain = new ABSchemeCoeff[ABorder];
     for (int i = 0; i < ABorder; i++)
     {
         ABsc_chain[i] = ABSchemeCoeff.AB(i + 1);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// returns the coefficients for a AdamsBashforth scheme of order <paramref name="order"/>.
        /// </summary>
        /// <param name="order"></param>
        static public ABSchemeCoeff AB(int order)
        {
            ABSchemeCoeff ABsc = new ABSchemeCoeff();

            switch (order)
            {
            case 1: {
                ABsc.coeffs = new double[] { 1.0 };
                break;
            }

            case 2: {
                ABsc.coeffs = new double[] { 3.0 / 2.0, -1.0 / 2.0 };
                break;
            }

            case 3: {
                ABsc.coeffs = new double[] { 23.0 / 12.0, -4.0 / 3.0, 5.0 / 12.0 };
                break;
            }

            case 4: {
                ABsc.coeffs = new double[] { 55.0 / 24.0, -59.0 / 24.0, 37.0 / 24.0, -3.0 / 8.0 };
                break;
            }

            default:
                throw new NotImplementedException("AB scheme of order " + order + " is not supported.");
            }

            if (Math.Abs(ABsc.coeffs.Sum() - 1.0) > 1.0e-10)
            {
                throw new ApplicationException();
            }

            return(ABsc);
        }