changeset 1176:ebec2b86f539 feature/rv

Update comments for RungekuttaRvMultiStage/Grid
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 28 Jun 2019 13:50:04 +0200
parents b96b1245a77d
children 270611e08398
files +rv/+time/RungekuttaRvMultiGrid.m +rv/+time/RungekuttaRvMultiStage.m
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r b96b1245a77d -r ebec2b86f539 +rv/+time/RungekuttaRvMultiGrid.m
--- a/+rv/+time/RungekuttaRvMultiGrid.m	Fri Jun 28 13:33:49 2019 +0200
+++ b/+rv/+time/RungekuttaRvMultiGrid.m	Fri Jun 28 13:50:04 2019 +0200
@@ -1,7 +1,7 @@
 classdef RungekuttaRvMultiGrid < time.Timestepper
     properties
-        F           % RHS of the ODE
-        F_coarse  % RHS of the unstabalized ODE
+        F         % RHS of the ODE
+        F_coarse  % RHS of the untabilized coarse grid ODE
         k       % Time step
         t       % Time point
         v       % Solution vector
diff -r b96b1245a77d -r ebec2b86f539 +rv/+time/RungekuttaRvMultiStage.m
--- a/+rv/+time/RungekuttaRvMultiStage.m	Fri Jun 28 13:33:49 2019 +0200
+++ b/+rv/+time/RungekuttaRvMultiStage.m	Fri Jun 28 13:50:04 2019 +0200
@@ -1,7 +1,7 @@
 classdef RungekuttaRvMultiStage < time.Timestepper
     properties
         F           % RHS of the ODE
-        F_unstable  % RHS of the unstabalized ODE
+        F_unstable  % RHS of the unstabilized ODE
         k       % Time step
         t       % Time point
         v       % Solution vector
@@ -52,11 +52,16 @@
         % Advances the solution vector one time step using the Runge-Kutta method given by
         % obj.coeffs, using a fixed residual viscosity for the Runge-Kutta substeps
         function obj = step(obj)            
-            m = length(obj.viscosity);
+            
+            % Advance solution by unstabilized scheme
             obj.v_unstable = obj.rkScheme(obj.v, obj.t, obj.k, obj.F_unstable);
+            % Compute viscosity for current time level based on unstable solution (from next time level)
+            % and the current solution.
             obj.viscosity = obj.RV.evaluateViscosity(obj.v, obj.DvDt(obj.v_unstable));
             % Fix the viscosity of the stabilized RHS
+            m = length(obj.viscosity);
             F_stable = @(v,t) obj.F(v,t,spdiags(obj.viscosity,0,m,m));
+            % Advance solutiont to next time level by stabilized scheme.
             obj.v = obj.rkScheme(obj.v, obj.t, obj.k, F_stable);
             obj.t = obj.t + obj.k;
             obj.n = obj.n + 1;