how can i make code for implicit method for CFD application?

2 ビュー (過去 30 日間)
Hassan Saeed
Hassan Saeed 2015 年 12 月 19 日
回答済み: Susmit Kumar Mishra 2020 年 5 月 14 日
in fact, I have already created code for implicit method, but i have alots of issue on it, so please im looking for help and support for this point quick. My code
clear all
clc
format short
wallLegnth = 1;
dy = 0.05;
toataltime = 0.5;
dt = 0.01;
alpha = 0.1;
dis=0:dy:1;
yn = (wallLegnth/dy)+1;
tn = (toataltime/dt)+1;
alpha=0.1;
z=alpha*dt/(dy^2);
a=-z;
b=(2*z+1);
c=-z;
TRI=full(gallery('tridiag',yn-2,a,b,c));
TRII=inv(TRI);
% Initial condition
for j=2:1:yn-1;
LM(1,j)=100;
end
%Boundary condition
for j=1:1:tn;
LM(j,1)=300;
LM(j,yn)=300;
end
%solveing
for i=1:1:yn;
for j=1;tn-1;
if i==1;
D(i,j)= LM(i+1,j)+a*LM(i,j+1);
elseif 1<i<tn-2
D(i+1,j)=LM(i+1,j);
if i==tn-2
D(i-1,j)= LM(i+1,j)+a*LM(i+2,j+1);
end
end
end
end
for i=1:1:tn;
for j=2:1:yn-1;
LM(i,j)=D'*TRII;
end
end

回答 (1 件)

Susmit Kumar Mishra
Susmit Kumar Mishra 2020 年 5 月 14 日
ig this LM(i,j)=D'*TRII;
should be LM(i,j)=TRII*D';

カテゴリ

Help Center および File ExchangeComputational Fluid Dynamics (CFD) についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by