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

조회 수: 5 (최근 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 CenterFile Exchange에서 Computational Fluid Dynamics (CFD)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by