Mercurial > repos > public > sbplib
changeset 1174:b96b1245a77d feature/rv
Update variable names and comments in RungekuttaRvMultiGrid
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 28 Jun 2019 13:33:49 +0200 |
parents | dde29b865244 |
children | ebec2b86f539 |
files | +rv/+time/RungekuttaRvMultiGrid.m |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/+rv/+time/RungekuttaRvMultiGrid.m Fri Jun 28 13:24:45 2019 +0200 +++ b/+rv/+time/RungekuttaRvMultiGrid.m Fri Jun 28 13:33:49 2019 +0200 @@ -9,7 +9,7 @@ rkScheme % The particular RK scheme used for time integration RV % Residual Viscosity operator DvDt % Function for computing the time deriative used for the RV evaluation - v_unstable + v_coarse viscosity end methods @@ -34,7 +34,7 @@ obj.RV = RV; obj.DvDt = DvDt; - obj.v_unstable = 0*v0; + obj.v_coarse = 0*v0; obj.viscosity = 0*v0; end @@ -44,20 +44,23 @@ end function state = getState(obj) - dvdt = obj.DvDt(obj.v_unstable); + dvdt = obj.DvDt(obj.v_coarse); [viscosity, Df, firstOrderViscosity, residualViscosity] = obj.RV.evaluate(obj.v, dvdt); state = struct('v', obj.v, 'dvdt', dvdt, 'Df', Df, 'viscosity', obj.viscosity, 'residualViscosity', residualViscosity, 'firstOrderViscosity', firstOrderViscosity, 't', obj.t); end % 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) + function obj = step(obj) + % Fix the viscosity of the stabilized RHS m = length(obj.viscosity); - obj.v_unstable = obj.rkScheme(obj.v, obj.t, obj.k, obj.F_coarse); - obj.viscosity = obj.RV.evaluateViscosity(obj.v, obj.DvDt(obj.v_unstable)); - % Fix the viscosity of the stabilized RHS F_stable = @(v,t) obj.F(v,t,spdiags(obj.viscosity,0,m,m)); + % Advance solution on unstabilized coarse mesh based on current solution + obj.v_coarse = obj.rkScheme(obj.v, obj.t, obj.k, obj.F_coarse); + % Advance solution on on stabilized mesh based on current viscosity obj.v = obj.rkScheme(obj.v, obj.t, obj.k, F_stable); + % Compute viscosity for the next time time level using the advanced solution + obj.viscosity = obj.RV.evaluateViscosity(obj.v, obj.DvDt(obj.v_coarse)); obj.t = obj.t + obj.k; obj.n = obj.n + 1; end