Mercurial > repos > public > sbplib
annotate +rv/+time/RungekuttaExteriorRvBdf.m @ 1145:1f0f2276e678 feature/advectionRV
closing branch. Changes merged to feature/rv
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 05 Aug 2019 10:51:33 +0200 |
parents | 2ef20d00b386 |
children | 010bb2677230 |
rev | line source |
---|---|
1029
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 classdef RungekuttaExteriorRvBdf < time.Timestepper |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
2 properties |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
3 F % RHS of the ODE |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
4 k % Time step |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
5 t % Time point |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
6 v % Solution vector |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
7 n % Time level |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
8 coeffs % The coefficents used for the RK time integration |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
9 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
10 % Properties related to the residual viscositys |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
11 RV % Residual Viscosity operator |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
12 v_prev % Solution vector at previous time levels, used for the RV evaluation |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
13 DvDt % Function for computing the time deriative used for the RV evaluation |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
14 lowerBdfOrder % Orders of the approximation of the time deriative, used for the RV evaluation. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
15 % dictates which accuracy the boot-strapping should start from. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
16 upperBdfOrder % Orders of the approximation of the time deriative, used for the RV evaluation. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
17 % Dictates the order of accuracy used once the boot-strapping is complete. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
18 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
19 % Convenience properties. Only for plotting |
1031
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
20 viscosity % Total viscosity |
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
21 residualViscosity % Residual viscosity |
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
22 firstOrderViscosity % first order viscosity |
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
23 dvdt % Evaluated time derivative in residual |
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
24 Df % Evaluated flux in residual |
1029
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
25 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
26 methods |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
27 function obj = RungekuttaExteriorRvBdf(F, k, t0, v0, RV, rkOrder, bdfOrders) |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
28 obj.F = F; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
29 obj.k = k; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
30 obj.t = t0; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
31 obj.v = v0; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
32 obj.n = 0; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
33 % Extract the coefficients for the specified rkOrder |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
34 % used for the RK updates from the Butcher tableua. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
35 [s,a,b,c] = time.rk.butcherTableau(rkOrder); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
36 obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
37 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
38 obj.RV = RV; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
39 % TBD: Decide on if the initialization of the previous stages used by |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
40 % the BDF should be done here, or if it should be checked for each |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
41 % step taken. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
42 % If it is moved here, then multiple branching stages can be removed in step() |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
43 % but this will effectively result in a plotted simulation starting from n = upperBdfOrder. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
44 % In addition, the properties lowerBdfOrder and upperBdfOrder can be removed. |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
45 obj.lowerBdfOrder = bdfOrders.lowerBdfOrder; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
46 obj.upperBdfOrder = bdfOrders.upperBdfOrder; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
47 assert((obj.lowerBdfOrder >= 1) && (obj.upperBdfOrder <= 6)); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
48 obj.v_prev = []; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
49 obj.DvDt = rv.time.BdfDerivative(); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
50 obj.viscosity = zeros(size(v0)); |
1031
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
51 obj.firstOrderViscosity = zeros(size(v0)); |
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
52 obj.residualViscosity = zeros(size(v0)); |
1029
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
53 obj.dvdt = zeros(size(v0)); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
54 obj.Df = zeros(size(v0)); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
55 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
56 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
57 function [v, t] = getV(obj) |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
58 v = obj.v; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
59 t = obj.t; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
60 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
61 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
62 function state = getState(obj) |
1031
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
63 state = struct('v', obj.v, 'dvdt', obj.dvdt, 'Df', obj.Df, 'viscosity', obj.viscosity, 'residualViscosity', obj.residualViscosity, 'firstOrderViscosity', obj.firstOrderViscosity, 't', obj.t); |
1029
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
64 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
65 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
66 function obj = step(obj) |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
67 % Store current time level and update v_prev |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
68 numStoredStages = size(obj.v_prev,2); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
69 if (numStoredStages < obj.upperBdfOrder) |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
70 obj.v_prev = [obj.v, obj.v_prev]; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
71 numStoredStages = numStoredStages+1; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
72 else |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
73 obj.v_prev(:,2:end) = obj.v_prev(:,1:end-1); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
74 obj.v_prev(:,1) = obj.v; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
75 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
76 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
77 % Fix the viscosity of the RHS function F |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
78 F_visc = @(v,t) obj.F(v,t,obj.viscosity); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
79 obj.v = time.rk.rungekutta(obj.v, obj.t, obj.k, F_visc, obj.coeffs); |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
80 obj.t = obj.t + obj.k; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
81 obj.n = obj.n + 1; |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
82 |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
83 %Calculate dvdt and evaluate RV for the new time level |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
84 if ((numStoredStages >= obj.lowerBdfOrder) && (numStoredStages <= obj.upperBdfOrder)) |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
85 obj.dvdt = obj.DvDt.evaluate(obj.v, obj.v_prev, obj.k); |
1031
2ef20d00b386
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1029
diff
changeset
|
86 [obj.viscosity, obj.Df, obj.firstOrderViscosity, obj.residualViscosity] = obj.RV.evaluate(obj.v,obj.dvdt); |
1029
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
87 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
88 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
89 end |
dce08a74e0ad
Create a separate class of RungekuttaExteriorRV which uses BDFs for computing the time derivative. Remove BDFs from RungekuttaExteriorRV
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
90 end |