xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

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

資源簡介

計算流體力學當中對一維歐拉激波管問題的upwind迎風格式數值算法matlab代碼

資源截圖

代碼片段和文件信息

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

%初始時刻的值,密度(rho)、速度(u)、壓強(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);%非正特征值對應的矩陣A-
????????????A2?=?U2A_sgn(Up?j?1);?%非負特征值對應的矩陣A+????A=A1?+?A2
????????????U(?:?j)?=?Up(?:?j)?-??r?*?(A1*(Up(?:?j+1)-Up(?:?j))...
????????????????+A2*(Up(:j)-Up(:j-1)));%一階迎風格式
????????????Un(1ji)=U(1j);Un(2ji)=U(2j);Un(3ji)=U(3j);
???????????
????????end
????????Un(:maxni)=U(:maxn);
????end
??%0.14S之后的參數值?
????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(‘長度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(‘長度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(‘長度x‘);
??????ylabel(‘壓力p‘);
????
??????subplot(514)%質量流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(‘長度x‘);
??????ylabel(‘質量流m‘);
????
??????subplot(515)%能量E
??????plot(xE0‘b--‘)
??????hold?on
??????plot(xE‘ro--‘)
??????set(gca‘XLim‘[a?b])
??????hold?off
??????xl

評論

共有 條評論