comparison +rv/+time/RungekuttaRvMultiStage.m @ 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 d3bde8a23e08
children
comparison
equal deleted inserted replaced
1174:b96b1245a77d 1176:ebec2b86f539
1 classdef RungekuttaRvMultiStage < time.Timestepper 1 classdef RungekuttaRvMultiStage < time.Timestepper
2 properties 2 properties
3 F % RHS of the ODE 3 F % RHS of the ODE
4 F_unstable % RHS of the unstabalized ODE 4 F_unstable % RHS of the unstabilized ODE
5 k % Time step 5 k % Time step
6 t % Time point 6 t % Time point
7 v % Solution vector 7 v % Solution vector
8 n % Time level 8 n % Time level
9 rkScheme % The particular RK scheme used for time integration 9 rkScheme % The particular RK scheme used for time integration
50 end 50 end
51 51
52 % Advances the solution vector one time step using the Runge-Kutta method given by 52 % Advances the solution vector one time step using the Runge-Kutta method given by
53 % obj.coeffs, using a fixed residual viscosity for the Runge-Kutta substeps 53 % obj.coeffs, using a fixed residual viscosity for the Runge-Kutta substeps
54 function obj = step(obj) 54 function obj = step(obj)
55 m = length(obj.viscosity); 55
56 % Advance solution by unstabilized scheme
56 obj.v_unstable = obj.rkScheme(obj.v, obj.t, obj.k, obj.F_unstable); 57 obj.v_unstable = obj.rkScheme(obj.v, obj.t, obj.k, obj.F_unstable);
58 % Compute viscosity for current time level based on unstable solution (from next time level)
59 % and the current solution.
57 obj.viscosity = obj.RV.evaluateViscosity(obj.v, obj.DvDt(obj.v_unstable)); 60 obj.viscosity = obj.RV.evaluateViscosity(obj.v, obj.DvDt(obj.v_unstable));
58 % Fix the viscosity of the stabilized RHS 61 % Fix the viscosity of the stabilized RHS
62 m = length(obj.viscosity);
59 F_stable = @(v,t) obj.F(v,t,spdiags(obj.viscosity,0,m,m)); 63 F_stable = @(v,t) obj.F(v,t,spdiags(obj.viscosity,0,m,m));
64 % Advance solutiont to next time level by stabilized scheme.
60 obj.v = obj.rkScheme(obj.v, obj.t, obj.k, F_stable); 65 obj.v = obj.rkScheme(obj.v, obj.t, obj.k, F_stable);
61 obj.t = obj.t + obj.k; 66 obj.t = obj.t + obj.k;
62 obj.n = obj.n + 1; 67 obj.n = obj.n + 1;
63 end 68 end
64 end 69 end