• 大小: 1KB
    文件类型: .m
    金币: 2
    下载: 1 次
    发布日期: 2021-05-13
  • 语言: Matlab
  • 标签:

资源简介

Lax格式激波管模拟,matlab语言,适合计算流体力学入门。

资源截图

代码片段和文件信息

clear
xmax=10;
dx=xmax/10000;
x=0:dx:xmax;
M=length(x);
timemax=0.0045;
dt=1e-6;
gama=1.4;R=287;
for i=1:M
    T(i)=300;
    u0(i)=0;
end
for i=1:5000
    p0(i)=1e6;
    rho0(i)=p0(i)/(R*T(i));
    E0(i)=R*T(i)/(gama-1)+0.5*u0(i)^2;
    H0(i)=gama*R*T(i)/(gama-1)+0.5*u0(i)^2;
end
for i=5001:M
    p0(i)=1e5;
    rho0(i)=p0(i)/(R*T(i));
    E0(i)=R*T(i)/(gama-1)+0.5*u0(i)^2;
    H0(i)=gama*R*T(i)/(gama-1)+0.5*u0(i)^2;
end
time=0;
while time    time=time+dt;
    for i=2:M-1
        rho(i)=0.5*(rho0(i+1)+rho0(i-1))-(rho0(i+1)*u0(i+1)-rho0(i-1)*u0(i-1))*dt/(2*dx);%连续性方程
        U(i)=0.5*(rho0(i+1)*u0(i+1)+rho0(i-1)*u0(i-1))-(rho0(i+1)*u0(i+1)^2+p0(i+1)-rho0(i-1)*u0(i

评论

共有 条评论