%
%  2D swift-hoh with ETD -- set-up -- djm, 26 jan 2007
%

%  initial plots
SwiftH_rhs(uF,time);  SwiftH_plt

%  rk3 initialization
RHS1 = SwiftH_rhs(uF,time);
uA   = ch.*uF + c1rk.*RHS1;
RHS2 = SwiftH_rhs(uA,time);
uB   = c0.*uF + c2rk.*(2*RHS2-RHS1);
RHS3 = SwiftH_rhs(uB,time);
uF   = c0.*uF + c3rk.*RHS1 + 2*c4rk.*RHS2 + c5rk.*RHS3;

rhstemp = RHS1;

RHS1 = SwiftH_rhs(uF,time);
uA   = ch.*uF + c1rk.*RHS1;
RHS2 = SwiftH_rhs(uA,time);
uB   = c0.*uF + c2rk.*(2*RHS2-RHS1);
RHS3 = SwiftH_rhs(uB,time);
uF   = c0.*uF + c3rk.*RHS1 + 2*c4rk.*RHS2 + c5rk.*RHS3;

time = time + 2*dt;  js = 3;
RHS3 = rhstemp;  RHS2 = RHS1;

clear rhstemp uA uB c1rk c2rk c3rk c4rk c5rk

%  ab3 loop
for j0=1:Nc
    for j1 = js:Nt
        time = time + dt;

        RHS1 = SwiftH_rhs(uF,time);
        uF   = c0.*uF + c1ab.*RHS1 + c2ab.*RHS2 + c3ab.*RHS3;

        RHS3 = RHS2;  RHS2 = RHS1;
    end

    %  some plots
    SwiftH_plt
    js = 1;
end