Commit 0f789684 authored by Gidon Lucian Bauer's avatar Gidon Lucian Bauer 🏳
Browse files

---

parent 1fbf8747
%% multidimensional Finite Volume method %% 3D Finite Volume method
function [U] = FVM_3D(u0, flux, f, xspan, tspan, N) function [U] = FVM_3D(u0, flux, f, xspan, tspan, N)
U = zeros(N, N, 3); % NxNx3 U = zeros(N, N, 3); % NxNx3
dx = (xspan(2) - xspan(1)) / N; dx = (xspan(2) - xspan(1)) / N;
dt = (tspan(2) - tspan(1)) / N; dt = (tspan(2) - tspan(1)) / N;
U(:, 1, :) = u0; U(:, 1, :) = u0;
......
...@@ -3,9 +3,9 @@ function [F] = HLL_flux(func, ul, ur) ...@@ -3,9 +3,9 @@ function [F] = HLL_flux(func, ul, ur)
al = min_eig(func, ul, ur); al = min_eig(func, ul, ur);
ar = max_eig(func, ul, ur); ar = max_eig(func, ul, ur);
if (0 <= al) if (al >= 0)
F = func(ul); F = func(ul);
elseif ((al <= 0) && (0 <= ar)) elseif ((al <= 0) && (ar >= 0))
F = (ar * func(ul) - al * func(ur) + al * ar * (ur - ul)) / (ar - al); F = (ar * func(ul) - al * func(ur) + al * ar * (ur - ul)) / (ar - al);
else else
F = func(ur); F = func(ur);
......
%% Set 3D inititial conditions with discontinuity at x = 0.5 %% Set 3D inititial conditions with discontinuity at x = 0.5
% Note: this ul and ur contains [rho, v, p], while all other u further in
% this programm will contain [rho, v, E]
function [u0] = init_cond(ul, ur, N) function [u0] = init_cond(ul, ur, N)
u0 = zeros(N,3); u0 = zeros(N,3);
......
...@@ -14,4 +14,5 @@ function [jac] = jacobi(func, u, h) ...@@ -14,4 +14,5 @@ function [jac] = jacobi(func, u, h)
jac(i,j) = (f_plus_h(i) - f_minus_h(i)) / (2*h); jac(i,j) = (f_plus_h(i) - f_minus_h(i)) / (2*h);
end end
end end
% disp(jac);
end end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment