Mercurial > repos > public > sbplib
changeset 1030:78c75c95b7dd feature/advectionRV
Rename Rungekutta-Rv classes according to naming convention
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 11 Jan 2019 15:52:48 +0100 |
parents | dce08a74e0ad |
children | 2ef20d00b386 |
files | +rv/+time/RungekuttaExteriorRV.m +rv/+time/RungekuttaExteriorRv.m +rv/+time/RungekuttaInteriorRV.m +rv/+time/RungekuttaInteriorRv.m |
diffstat | 4 files changed, 120 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/+rv/+time/RungekuttaExteriorRV.m Fri Jan 11 15:47:10 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -classdef RungekuttaExteriorRV < time.Timestepper - properties - F % RHS of the ODE - k % Time step - t % Time point - v % Solution vector - n % Time level - coeffs % The coefficents used for the RK time integration - - % Properties related to the residual viscositys - RV % Residual Viscosity operator - viscosity % Viscosity vector - v_prev % Solution vector at previous time levels, used for the RV evaluation - DvDt % Function for computing the time deriative used for the RV evaluation - lowerBdfOrder % Orders of the approximation of the time deriative, used for the RV evaluation. - % dictates which accuracy the boot-strapping should start from. - upperBdfOrder % Orders of the approximation of the time deriative, used for the RV evaluation. - % Dictates the order of accuracy used once the boot-strapping is complete. - - % Convenience properties. Only for plotting - residual - dvdt - Df - end - methods - - function obj = RungekuttaExteriorRV(F, k, t0, v0, RV, DvDt, rkOrder) - obj.F = F; - obj.k = k; - obj.t = t0; - obj.v = v0; - obj.n = 0; - % Extract the coefficients for the specified rkOrder - % used for the RK updates from the Butcher tableua. - [s,a,b,c] = time.rk.butcherTableau(rkOrder); - obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); - - obj.RV = RV; - obj.DvDt = DvDt; - obj.dvdt = obj.DvDt(obj.v); - [obj.viscosity, obj.Df] = RV.evaluate(obj.v,obj.dvdt); - obj.residual = obj.dvdt + obj.Df; - end - - function [v, t] = getV(obj) - v = obj.v; - t = obj.t; - end - - function state = getState(obj) - state = struct('v', obj.v, 'residual', obj.residual, 'dvdt', obj.dvdt, 'Df', obj.Df, 'viscosity', obj.viscosity, 't', obj.t); - end - - function obj = step(obj) - obj.dvdt = obj.DvDt(obj.v); - [obj.viscosity, obj.Df] = obj.RV.evaluate(obj.v,obj.dvdt); - obj.residual = obj.dvdt + obj.Df; - - % Fix the viscosity of the RHS function F - F_visc = @(v,t) obj.F(v,t,obj.viscosity); - obj.v = time.rk.rungekutta(obj.v, obj.t, obj.k, F_visc, obj.coeffs); - obj.t = obj.t + obj.k; - obj.n = obj.n + 1; - end - end -end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+rv/+time/RungekuttaExteriorRv.m Fri Jan 11 15:52:48 2019 +0100 @@ -0,0 +1,66 @@ +classdef RungekuttaExteriorRv < time.Timestepper + properties + F % RHS of the ODE + k % Time step + t % Time point + v % Solution vector + n % Time level + coeffs % The coefficents used for the RK time integration + + % Properties related to the residual viscositys + RV % Residual Viscosity operator + viscosity % Viscosity vector + v_prev % Solution vector at previous time levels, used for the RV evaluation + DvDt % Function for computing the time deriative used for the RV evaluation + lowerBdfOrder % Orders of the approximation of the time deriative, used for the RV evaluation. + % dictates which accuracy the boot-strapping should start from. + upperBdfOrder % Orders of the approximation of the time deriative, used for the RV evaluation. + % Dictates the order of accuracy used once the boot-strapping is complete. + + % Convenience properties. Only for plotting + residual + dvdt + Df + end + methods + + function obj = RungekuttaExteriorRv(F, k, t0, v0, RV, DvDt, order) + obj.F = F; + obj.k = k; + obj.t = t0; + obj.v = v0; + obj.n = 0; + % Extract the coefficients for the specified order + % used for the RK updates from the Butcher tableua. + [s,a,b,c] = time.rk.butcherTableau(order); + obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); + + obj.RV = RV; + obj.DvDt = DvDt; + obj.dvdt = obj.DvDt(obj.v); + [obj.viscosity, obj.Df] = RV.evaluate(obj.v,obj.dvdt); + obj.residual = obj.dvdt + obj.Df; + end + + function [v, t] = getV(obj) + v = obj.v; + t = obj.t; + end + + function state = getState(obj) + state = struct('v', obj.v, 'residual', obj.residual, 'dvdt', obj.dvdt, 'Df', obj.Df, 'viscosity', obj.viscosity, 't', obj.t); + end + + function obj = step(obj) + obj.dvdt = obj.DvDt(obj.v); + [obj.viscosity, obj.Df] = obj.RV.evaluate(obj.v,obj.dvdt); + obj.residual = obj.dvdt + obj.Df; + + % Fix the viscosity of the RHS function F + F_visc = @(v,t) obj.F(v,t,obj.viscosity); + obj.v = time.rk.rungekutta(obj.v, obj.t, obj.k, F_visc, obj.coeffs); + obj.t = obj.t + obj.k; + obj.n = obj.n + 1; + end + end +end \ No newline at end of file
--- a/+rv/+time/RungekuttaInteriorRV.m Fri Jan 11 15:47:10 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -classdef RungekuttaInteriorRV < time.Timestepper - properties - F % RHS of the ODE - k % Time step - t % Time point - v % Solution vector - n % Time level - coeffs % The coefficents used for the RK time integration - RV % Residual Viscosity - viscosity % Viscosity vector - DvDt % Function for computing the time deriative used for the RV evaluation - - residual - dvdt - Df - end - - methods - function obj = RungekuttaInteriorRV(F, k, t0, v0, RV, DvDt, order) - obj.F = F; - obj.k = k; - obj.t = t0; - obj.v = v0; - obj.n = 0; - % Extract the coefficients for the specified order - % used for the RK updates from the Butcher tableua. - [s,a,b,c] = time.rk.butcherTableau(order); - obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); - obj.RV = RV; - obj.DvDt = DvDt; - obj.dvdt = obj.DvDt(obj.v); - [obj.viscosity, obj.Df] = obj.RV.evaluate(obj.v,obj.dvdt); - obj.residual = obj.dvdt + obj.Df; - end - - function [v, t] = getV(obj) - v = obj.v; - t = obj.t; - end - - function state = getState(obj) - state = struct('v', obj.v, 'residual', obj.residual, 'dvdt', obj.dvdt, 'Df', obj.Df, 'viscosity', obj.viscosity, 't', obj.t); - end - - function obj = step(obj) - obj.v = rv.time.rungekuttaRV(obj.v, obj.t, obj.k, obj.F, obj.RV, obj.DvDt, obj.coeffs); - obj.t = obj.t + obj.k; - obj.n = obj.n + 1; - obj.dvdt = obj.DvDt(obj.v); - [obj.viscosity, obj.Df] = obj.RV.evaluate(obj.v,obj.dvdt); - obj.residual = obj.dvdt + obj.Df; - end - end -end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+rv/+time/RungekuttaInteriorRv.m Fri Jan 11 15:52:48 2019 +0100 @@ -0,0 +1,54 @@ +classdef RungekuttaInteriorRv < time.Timestepper + properties + F % RHS of the ODE + k % Time step + t % Time point + v % Solution vector + n % Time level + coeffs % The coefficents used for the RK time integration + RV % Residual Viscosity + viscosity % Viscosity vector + DvDt % Function for computing the time deriative used for the RV evaluation + + residual + dvdt + Df + end + + methods + function obj = RungekuttaInteriorRv(F, k, t0, v0, RV, DvDt, order) + obj.F = F; + obj.k = k; + obj.t = t0; + obj.v = v0; + obj.n = 0; + % Extract the coefficients for the specified order + % used for the RK updates from the Butcher tableua. + [s,a,b,c] = time.rk.butcherTableau(order); + obj.coeffs = struct('s',s,'a',a,'b',b,'c',c); + obj.RV = RV; + obj.DvDt = DvDt; + obj.dvdt = obj.DvDt(obj.v); + [obj.viscosity, obj.Df] = obj.RV.evaluate(obj.v,obj.dvdt); + obj.residual = obj.dvdt + obj.Df; + end + + function [v, t] = getV(obj) + v = obj.v; + t = obj.t; + end + + function state = getState(obj) + state = struct('v', obj.v, 'residual', obj.residual, 'dvdt', obj.dvdt, 'Df', obj.Df, 'viscosity', obj.viscosity, 't', obj.t); + end + + function obj = step(obj) + obj.v = rv.time.rungekuttaRV(obj.v, obj.t, obj.k, obj.F, obj.RV, obj.DvDt, obj.coeffs); + obj.t = obj.t + obj.k; + obj.n = obj.n + 1; + obj.dvdt = obj.DvDt(obj.v); + [obj.viscosity, obj.Df] = obj.RV.evaluate(obj.v,obj.dvdt); + obj.residual = obj.dvdt + obj.Df; + end + end +end \ No newline at end of file