---
# System prepended metadata

title: '***Computational Hydraulics***'
tags: [HW4.1]

---

---
tags: HW4.1
---
# ***Computational Hydraulics***
## **Group 01:** N88071053 洪豪男 N88091011 黃彥鈞
## **HW4.1:** Please use some MatLab code (51 data points) to confirm that Mindmod limister flows the lower boundary of the TVD area and Superbee limiter describe the upper boundary.

* **minmod** – symmetric (Roe, 1986)

$\quad\quad\phi_{mm}(r)=max[0,min(1,r)] ;\lim\limits_{r\rightarrow\infty}\phi_{mm}(r)=1$

* **superbee** – symmetric (Roe, 1986)

$\quad\quad\phi_{sb}(r)=max[0,min(2r,1),min(r,2)] ;\lim\limits_{r\rightarrow\infty}\phi_{sb}(r)=2$


* **remark** $r=\dfrac{u_{j}-u_{j-1}}{u_{j+1}-u_{j}}$

```
% initial condition
r=linspace(0,4,51);
phim=zeros(1,length(r));
phis=zeros(1,length(r));

phim(1)=0;
phis(1)=0;

% calculus
for ii=2:length(r)
    a=[0 min(1,r(ii))];
    b=[0 min(2*r(ii),1) min(r(ii),2)];
    phim(ii)=max(a);
    phis(ii)=max(b);
end

% plot diagram
pic01=plot([0 2.2],[0 2.2],...
'k-',[0 1.1],[0 2.2],'k-',[0 3],...
[1 1],'k-',[0 1],[2 2],'k--',[1 3],[2 2],'k-');
set(pic01,'linewidth',1);
hold on
pic02=plot(r,phim,'r-',r,phis,'b-');
set(pic02,'linewidth',1.2);
title('Admissible limiter region for second-order TVD schemes');
legend(pic02,'Minmod limiter','Superbee limiter');
str={'\phi = 2r','\phi = r','\phi = 2','\phi = 1'};
pos=[1.3 2.3 3.1 3.1;2.3 2.2 2.15 1.15];
text(pos(1,:),pos(2,:),str,'FontSize',12);
xlabel('r');
ylabel('\phi (r)');
grid on
axis([0 4 0 3]);
```
![](https://i.imgur.com/KIn7pJ9.png)

* Upper figure shows that Mindmod limister flows the lower boundary of the TVD area and Superbee limiter describe the upper boundary.