Mercurial > repos > public > sbplib
comparison +rv/+time/BdfDerivative.m @ 1016:4b42999874c0 feature/advectionRV
Add lower level for boot-strapping to RungeKuttaExteriorRV
- Add a lower level to RungeKuttaExteriorRV for which bootstrapping starts, e.g start bootstrapping from time level 3 using a 3rd order BDF
- Clean up ResidualViscosity
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 07 Dec 2018 13:11:53 +0100 |
parents | +rv/+time/BDFDerivative.m@e547794a9407 |
children | 010bb2677230 |
comparison
equal
deleted
inserted
replaced
1015:9b7fcd5e4480 | 1016:4b42999874c0 |
---|---|
1 classdef BdfDerivative < handle | |
2 properties | |
3 coefficients | |
4 end | |
5 methods %TBD: Decide if the BDF order should be passed in construction | |
6 % and only a row of coefficients stored based on the order. | |
7 % There would still be an implicit dependancy on the number | |
8 % of vectors in v_prev and elements in coefficients. | |
9 % In addition, dt could be stored, but this would be | |
10 % inflexible if different step sizes are employed. | |
11 function obj = BdfDerivative() | |
12 obj.coefficients = obj.getBdfCoefficients(); | |
13 end | |
14 % Add asserts here? | |
15 function DvDt = evaluate(obj, v, v_prev, dt) | |
16 order = size(v_prev,2); | |
17 DvDt = (obj.coefficients(order,1)*v - sum(obj.coefficients(order,2:order+1).*v_prev,2))/dt; | |
18 end | |
19 end | |
20 methods(Static) | |
21 function c = getBdfCoefficients() | |
22 c = zeros(6,7); | |
23 c(1,1) = 1; c(1,2) = 1; | |
24 c(2,1) = 3/2; c(2,2) = 4/2; c(2,3) = -1/2; | |
25 c(3,1) = 11/6; c(3,2) = 18/6; c(3,3) = -9/6; c(3,4) = 2/6; | |
26 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; | |
27 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; | |
28 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; | |
29 end | |
30 end | |
31 end |