view +time/+rk/butcherTableauFromStr.m @ 990:1066bb31bc95 feature/timesteppers

Create class for butcher tableau
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 09 Jan 2019 09:09:15 +0100
parents a32856fc2ad2
children
line wrap: on
line source

% Returns the coefficients used in a RK method as defined by a Butcher Tableau.
%
% @param method - string specifying which Runge-Kutta method to be used.
% @return s - number of stages
% @return a - coefficents for intermediate stages
% @return b - weights for summing stages
% @return c - time step coefficents for intermediate stages
function [s,a,b,c] = butcherTableauFromStr(method)
    try
        bt = time.rk.ButcherTableau.(method);
    catch
        error('Runge-Kutta method %s is not implemented', method)
    end

    assert(bt.isExplicit());

    s = bt.nStages();
    a = bt.a(:,1:end-1);
    b = bt.b;
    c = bt.c;
end