91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .m
    金幣: 2
    下載: 4 次
    發(fā)布日期: 2021-06-02
  • 語(yǔ)言: Matlab
  • 標(biāo)簽: upwind格式??matlab??

資源簡(jiǎn)介

計(jì)算流體力學(xué)當(dāng)中對(duì)一維歐拉激波管問題的upwind迎風(fēng)格式數(shù)值算法matlab代碼

資源截圖

代碼片段和文件信息

%常數(shù)參數(shù)
gamma?=?1.4;
CFL?=?0.5;
Time?=?0.4;??????%時(shí)間
a?=?0;???????????%橫坐標(biāo)范圍
b?=?1;
r=0.1;????????????%網(wǎng)格比
dx?=?0.005;????????%距離間隔
dt?=?dx*r;?????????
x?=?a:dx:b;
t?=?linspace(0Time39);
maxn?=?(b-a)/dx+1;
nc?=?2:maxn-1;

%初始時(shí)刻的值,密度(rho)、速度(u)、壓強(qiáng)(p)、能量(E)
rho0?=?1.*(x<0.5)+0.125.*(x>=0.5);
u0?=?0.*(x<0.5)+0.*(x>=0.5);
p0?=?1.*(x<0.5)+0.1.*(x>=0.5);
m0?=?u0.*rho0;
E0?=?p0./((gamma-1).*rho0)+u0.^2/2;
w0?=?[rho0;?m0;?E0];
f0?=?[u0.*w0(1:)?;?u0.*w0(2:)?;u0.*w0(3:)]?+?[u0-u0?;?p0?;?p0.*u0];
U0=[rho0?;u0?;p0];

????U?=?U0;
????for?i?=?1:Time/dt
????????Up?=?U;
????????Un(1:1)=Up(11);Un(2:1)=Up(21);Un(3:1)=Up(31);
????????for?j?=?2:maxn-1
????????????A1?=?U2A_sgn(Up?j?-1);%非正特征值對(duì)應(yīng)的矩陣A-
????????????A2?=?U2A_sgn(Up?j?1);?%非負(fù)特征值對(duì)應(yīng)的矩陣A+????A=A1?+?A2
????????????U(?:?j)?=?Up(?:?j)?-??r?*?(A1*(Up(?:?j+1)-Up(?:?j))...
????????????????+A2*(Up(:j)-Up(:j-1)));%一階迎風(fēng)格式
????????????Un(1ji)=U(1j);Un(2ji)=U(2j);Un(3ji)=U(3j);
???????????
????????end
????????Un(:maxni)=U(:maxn);
????end
??%0.14S之后的參數(shù)值?
????rho?=?U(1:);
????u?=?U(2:);
????p?=?U(3:);
????m?=?rho.*u;
????E?=?p/(gamma-1)+0.5*rho.*u.^2;
?
????%畫圖
????figure(1);
??????subplot(511)%密度rho
??????plot(xrho0‘b-‘)
??????hold?on
??????plot(xrho‘ro--‘)
??????set(gca‘YLim‘[-0.2?1.2])
??????set(gca‘XLim‘[a?b])
??????%set(gca?‘YTick‘?[0?1])
??????hold?off
??????title([‘dx=‘num2str(dx)‘??CFL=‘num2str(CFL)‘?t=‘num2str(Time)]);
??????xlabel(‘長(zhǎng)度x‘);
??????ylabel(‘密度rho‘);
?????
??????subplot(512)%速度u
??????plot(xu0‘b-‘)
??????hold?on
??????plot(xu‘ro--‘)
??????set(gca‘YLim‘[-0.2?1.2])
??????set(gca‘XLim‘[a?b])
??????%set(gca?‘YTick‘?[0?1])
??????hold?off
??????xlabel(‘長(zhǎng)度x‘);
??????ylabel(‘速度u‘);
??????
??????subplot(513)%壓力p
??????plot(xp0‘b-‘)
??????hold?on
??????plot(xp‘ro--‘)
??????set(gca‘YLim‘[-0.2?1.2])
??????set(gca‘XLim‘[a?b])
??????%set(gca?‘YTick‘?[0?1])
??????hold?off
??????xlabel(‘長(zhǎng)度x‘);
??????ylabel(‘壓力p‘);
????
??????subplot(514)%質(zhì)量流m
??????plot(xm0‘b-‘)
??????hold?on
??????plot(xm‘ro--‘)
??????set(gca‘YLim‘[-0.5?2.5])
??????set(gca‘XLim‘[a?b])
??????%set(gca?‘YTick‘?[0?1])
??????hold?off
??????xlabel(‘長(zhǎng)度x‘);
??????ylabel(‘質(zhì)量流m‘);
????
??????subplot(515)%能量E
??????plot(xE0‘b--‘)
??????hold?on
??????plot(xE‘ro--‘)
??????set(gca‘XLim‘[a?b])
??????hold?off
??????xl

評(píng)論

共有 條評(píng)論