1
function [g1, sigma] = GENERIC_rk4(t0,h,g0, face, Nf, verts, Nv)
2
% D Rufat, February 16, 2005
3
% Fourth order fixed time step Runge-Kutta scheme to advance motion in
7
%-------------import source distributions----------------%
8
global sigma_x; global sigma_y; global sigma_w;
9
global sigma_s1; global sigma_s2; global sigma_s3;
10
%--------------------------------------------------------%
13
[s_0, sdot_0] = GENERIC_shape_var(t0);
14
[s_1, sdot_1] = GENERIC_shape_var(t0+h/2);
15
[s_2, sdot_2] = GENERIC_shape_var(t0+h);
18
A0 = eval([MODE '_connection(s_0, sdot_0, face, Nf, verts, Nv)']);
19
A1 = eval([MODE '_connection(s_1, sdot_1, face, Nf, verts, Nv)']);
20
A2 = eval([MODE '_connection(s_2, sdot_2, face, Nf, verts, Nv)']);
22
K1 = GENERIC_vel_fun(A0,g0);
23
K2 = GENERIC_vel_fun(A1,g0 + h*K1/2);
24
K3 = GENERIC_vel_fun(A1,g0 + h*K2/2);
25
K4 = GENERIC_vel_fun(A2,g0 + h*K3);
27
g1 = g0 + h*(K1+2*K2+2*K3+K4)/6;
28
sigma = sigma_x*A2(1) + sigma_y*A2(2) + sigma_w*A2(3) + ...
29
sigma_s1*sdot_2(1) + sigma_s2*sdot_2(2) + sigma_s3*sdot_2(3);
b'\\ No newline at end of file'