Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Gidon Lucian Bauer
MATLAB
Commits
8ac78b3c
Commit
8ac78b3c
authored
Mar 19, 2021
by
Gidon Lucian Bauer
🏳
Browse files
Limiter
parent
e3a370c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
mathe5/klausurvorbereitung/limiter.m
0 → 100644
View file @
8ac78b3c
close all; clear; clc;
theta = linspace(-4, 4, 1000);
fig = figure(1);
fig.WindowState = 'maximized';
hold on;
plot(theta, superbee(theta), 'DisplayName', 'superbee');
plot(theta, minmod(theta), 'DisplayName', 'minmod');
plot(theta, vanLeer(theta), 'DisplayName', 'van Leer');
plot(theta, cslimiter(theta), 'DisplayName', 'Čada-Schmidtmann');
title('Limiter functions');
xlabel('\theta');
ylabel('\phi');
legend;
hold off;
function phi = t3(theta)
phi = (2 + theta) / 3;
end
function phi = cslimiter(theta)
phi = zeros(size(theta));
for i = 1:length(theta)
phi(i) = max(0, min(t3(theta(i)), max(-theta(i), min(2*theta(i), min(t3(theta(i)), 1.5)))));
end
end
function phi = superbee(theta)
phi = zeros(size(theta));
for i = 1:length(theta)
phi(i) = max(0, max(min(1, 2*theta(i)), min(2, theta(i))));
end
end
function phi = minmod(theta)
phi = zeros(size(theta));
for i = 1:length(theta)
phi(i) = max(0, min(1, theta(i)));
end
end
function phi = vanLeer(theta)
phi = zeros(size(theta));
for i = 1:length(theta)
phi(i) = (theta(i) + abs(theta(i))) / (1 + theta(i));
end
end
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment