Mercurial > repos > public > sbplib
view +rv/+time/BdfDerivative.m @ 1152:010bb2677230 feature/rv
Clean up in +rv/+time. Make the time stepping more efficient by not storing unnessecary properties in the RK-RV time steppers
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 05 Mar 2019 10:53:34 +0100 |
parents | 4b42999874c0 |
children | a4c00628a39d |
line wrap: on
line source
classdef BdfDerivative < handle properties coefficients end methods function obj = BdfDerivative() obj.coefficients = obj.getBdfCoefficients(); end function DvDt = evaluate(obj, v, v_prev, dt) order = size(v_prev,2); DvDt = (obj.coefficients(order,1)*v - sum(obj.coefficients(order,2:order+1).*v_prev,2))/dt; end end methods(Static) function c = getBdfCoefficients() c = zeros(6,7); c(1,1) = 1; c(1,2) = 1; c(2,1) = 3/2; c(2,2) = 4/2; c(2,3) = -1/2; c(3,1) = 11/6; c(3,2) = 18/6; c(3,3) = -9/6; c(3,4) = 2/6; c(4,1) = 25/12; c(4,2) = 48/12; c(4,3) = -36/12; c(4,4) = 16/12; c(4,5) = -3/12; c(5,1) = 137/60; c(5,2) = 300/60; c(5,3) = -300/60; c(5,4) = 200/60; c(5,5) = -75/60; c(5,6) = 12/60; c(6,1) = 147/60; c(6,2) = 360/60; c(6,3) = -450/60; c(6,4) = 400/60; c(6,5) = -225/60; c(6,6) = 72/60; c(6,7) = -10/60; end end end