changeset 1011:e0560bc4fb7d feature/advectionRV

Add todo:s for time stepping with RV
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 15 Nov 2018 13:49:11 -0800
parents f753bada1a46
children 1e437c9e5132
files +time/+rk/butcherTableau.m +time/RungekuttaRV.m
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
diff -r f753bada1a46 -r e0560bc4fb7d +time/+rk/butcherTableau.m
--- a/+time/+rk/butcherTableau.m	Wed Nov 07 10:03:35 2018 -0800
+++ b/+time/+rk/butcherTableau.m	Thu Nov 15 13:49:11 2018 -0800
@@ -1,5 +1,5 @@
 function [s,a,b,c] = butcherTableau(order)
-
+% TODO: Change order from a double to string.
 switch order
   
     case 3
@@ -19,6 +19,15 @@
         a(4,1) = 0; a(4,2) = 0; a(4,3) = 1;
         b = [1/6 1/3 1/3 1/6];
         c = [0, 1/2, 1/2, 1];
+    % case 4-3/8
+    %     % 3/8 RK4 (Kuttas method). Lower truncation error, more flops
+    %     s = 4;
+    %     a = zeros(s,s-1);
+    %     a(2,1) = 1/3; 
+    %     a(3,1) = -1/3; a(3,2) = 1;
+    %     a(4,1) = 1; a(4,2) = -1; a(4,3) = 1;
+    %     b = [1/8 3/8 3/8 1/8];
+    %     c = [0, 1/3, 2/3, 1];
     case 6
         % Runge-Kutta 6 from Alshina07 
         s = 7;
diff -r f753bada1a46 -r e0560bc4fb7d +time/RungekuttaRV.m
--- a/+time/RungekuttaRV.m	Wed Nov 07 10:03:35 2018 -0800
+++ b/+time/RungekuttaRV.m	Thu Nov 15 13:49:11 2018 -0800
@@ -37,6 +37,13 @@
             obj.v = time.rk.rungekuttaRV(obj.v, obj.t, obj.k, obj.F, obj.RV, obj.coeffs);
             obj.t = obj.t + obj.k;
             obj.n = obj.n + 1;
+            % TBD: Add option for updating the residual inside or outside? Decide on best way to do it?
+            % v_prev = obj.v;
+            % F = @(v,t)obj.F(v,t,obj.RV.getViscosity());
+            % obj.v = time.rk.rungekutta(obj.v, obj.t, obj.k, F, obj.coeffs);
+            % obj.RV.update(obj.v,v_prev,obj.k);
+            % obj.t = obj.t + obj.k;
+            % obj.n = obj.n + 1;
         end
     end