view +rv/+time/RungekuttaInteriorRV.m @ 1016:4b42999874c0 feature/advectionRV

Add lower level for boot-strapping to RungeKuttaExteriorRV - Add a lower level to RungeKuttaExteriorRV for which bootstrapping starts, e.g start bootstrapping from time level 3 using a 3rd order BDF - Clean up ResidualViscosity
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 07 Dec 2018 13:11:53 +0100
parents 1e437c9e5132
children 2d7c1333bd6c
line wrap: on
line source

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
    end

    methods
        function obj = RungekuttaInteriorRV(F, k, t0, v0, RV, order)
            obj.F = F;
            obj.k = k;
            obj.t = t0;
            obj.v = v0;
            obj.n = 0;
            obj.RV = RV;
            % 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);
        end

        function [v, t] = getV(obj)
            v = obj.v;
            t = obj.t;
        end

        function state = getState(obj)
            [residual, u_t, grad_f] = obj.RV.getResidual();
            state = struct('v', obj.v, 'residual', residual, 'u_t', u_t, 'grad_f', grad_f, 'viscosity', obj.RV.getViscosity(), 't', obj.t);
        end

        function obj = step(obj)
            obj.v = rv.time.rungekuttaRV(obj.v, obj.t, obj.k, obj.F, obj.RV, obj.coeffs);
            obj.t = obj.t + obj.k;
            obj.n = obj.n + 1;
        end
    end
end