Common partial differential equations of computational hydraulics 55
end
if r1<0
fr=0;
elseif r1>0 && r1<=1
fr=2*r1;
else
fr=2;
end
akr=sc/2*(1-sc)*(f3(n3+1)-f3(n3))*fr;
akl=sc/2*(1-sc)*(f3(n3)-f3(n3-1))*fr;
f3n(n3)=f3(n3)-sc*(f3(n3)-f3(n3-1))-(akr-akl);
end
% Renewal of the f3 values;
for n3=1:mx
f3(n3)=f3n(n3);
end
% Boundary conditions;
f3(1)=f3n(1); f3(mx)=f3n(mx);
f3p=f3(1:n3);
end
plot(1:n1,f1p,'r','Linewidth',1.5)
hold on
plot(1:n2,f2p,'g','Linewidth',1.5)
plot(1:n3,f3p,'b','Linewidth',1.5)
xlabel('Distance x'),ylabel('function f(x)')
axis([70,130,-0.1,1.1])
legend('f1:Godunov','f2:Fromm','f3:TVD')
text(110,0.7,'After time = mt*Dt')
PROBLEM 3.3
Solve the same problem by making the following suggested changes while
keeping the rest of the data constant:
1. Change the celerity to 2.5 m/s and comment on the results.
2. Develop a computer code for the Euler finite difference scheme
(Equation 3.34). Plot the data.
3. Change the boundary conditions from constant to sinusoidal, with
amplitude equal to 1 and a period of 40 s.
4. Write the Godunov scheme in the form of Equation 3.37, and separately plot the hyperbolic and parabolic parts of the equation (second
and third terms, respectively, in the right-hand side of the equation).
5. Develop a computer code for the Lax finite difference scheme
(Equation 3.44). Plot the data.
Compare the solution data obtained by running the modifications, derive
conclusions and discuss the significance of the various FD schemes involved
in the phenomenon of pure advection.
Précédent

- 68/302

Suivant