forked from wme7/Aero-matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup.m
33 lines (27 loc) · 1.05 KB
/
backup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% initialize variables
u_eq = zeros(1,nx);
u = zeros(1,nx);
% (this part can, and should be done in parallel!)
for i = 1:nv
% load subcase
switch f_case
case{1} % Relaxation Scheme
u_eq(:) = f_eq(i,:);
u(:) = f(i,:);
case{2} % Euler Limit
u_eq(:) = f_eq(i,:);
u(:) = f_eq(i,:);
end
% Compute TVD Fluxes
[F_left,F_right] = Upwindflux1d(u,a(i,:));
% Compute next time step
u_next = u - dtdx*(F_right - F_left) ...
+ (dt/r_time)*(u_eq-u);
% BC
u_next(1) = u_next(2);
u_next(nx) = u_next(nx-1);
% UPDATE info
u = u_next;
% Going back to f
f(i,:) = u(:);
end