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

5 views (last 30 days)
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

Answers (1)

Susmit Kumar Mishra
Susmit Kumar Mishra on 14 May 2020
ig this LM(i,j)=D'*TRII;
should be LM(i,j)=TRII*D';

Categories

Find more on Computational Fluid Dynamics (CFD) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!