Home › Forums › CFD foundation course: Forum › Any Course About FVM with Matlab

Any Course About FVM with Matlab
Posted by secxdxeren on July 10, 2023 at 11:43 amHi
I Try do learn CFD with matlab.
Do you have any resource for that and Could you share any matlab code for 1D , SS, heat transfer for any input( change n, iteration, funcktion)
Thanks
secxdxeren replied 11 months, 2 weeks ago 2 Members · 4 Replies 
4 Replies

Hi,
Please enroll in the CFD Foundation course on the platform. You have all details with FVM and Matlab there.
Regards

Thanks for answer Sir Sandeep Mouvanal
I finished that course and I’m trying to resolve the assigned assignments.
Any chance to help with this question?
I create matlab code thatclc
clear
T=zeros(1,5);
ae=zeros(5,1);
aw=zeros(5,1);
Sp=zeros(5,1);
Su=zeros(5,1);
ap=zeros(5,1);
TA=100;
TB=500;
k=1000;
A=0.01;
dx=0.5/5;
resultTable = table();for i=1:5
if (i==1)
aw=0;
ae(i)=k*A/dx;
Sp(i)=2*k*A/dx;
Su(i)=TA*2*k*A/dx;
ap(i)=aw(i)+ae(i)Sp(i);
else if (i==5)
aw(i)=k*A/dx;
ae(i)=0;
Sp(i)=2*k*A/dx;
Su(i)=TB*2*k*A/dx;
ap(i)=aw(i)+ae(i)Sp(i);
else
aw(i)=k*A/dx;
ae(i)=k*A/dx;
ap(i)=aw(i)+ae(i);
end
end
resultTable = [resultTable; table(aw(i), ae(i), Sp(i), Su(i), ap(i))];end
resultTable.Properties.VariableNames = {‘aw’, ‘ae’, ‘Sp’, ‘Su’, ‘ap’};
disp(resultTable);% when calculate T value, it dont calculate it depend on variable (T2 T3 T4)
for i=1:5
if (i==1)
T(i)=(T(i+1)*ae(i)+Su(i))/ap(i);
else if (i==5)
T(i)=(T(i1)*ae(i)+Su(i))/ap(i);
else
T(i)=(aw(i)*T(i1)+ae(i)+T(i+1))/ap(i);
end
end
endWhen code calculate T values for example T(1)= Su(i))/ap(i) and code Take T2 zero, therefore I take error (every coefficients are true), could u have any code to disegn it. For example I want to find T1=T2+T3 ,T2=T3+T4 …… then solve with solve commend. Morever if you have any code to solve with gause etc can u add to redisgn it.
Thanks

clc clear T=zeros(1,5); ae=zeros(5,1); aw=zeros(5,1); Sp=zeros(5,1); Su=zeros(5,1); ap=zeros(5,1); TA=100; TB=500; k=1000; A=0.01; dx=0.5/5; resultTable = table(); for i=1:5 if (i==1) aw=0; ae(i)=k*A/dx; Sp(i)=2*k*A/dx; Su(i)=TA*2*k*A/dx; ap(i)=aw(i)+ae(i)Sp(i); else if (i==5) aw(i)=k*A/dx; ae(i)=0; Sp(i)=2*k*A/dx; Su(i)=TB*2*k*A/dx; ap(i)=aw(i)+ae(i)Sp(i); else aw(i)=k*A/dx; ae(i)=k*A/dx; ap(i)=aw(i)+ae(i); end end resultTable = [resultTable; table(aw(i), ae(i), Sp(i), Su(i), ap(i))]; end resultTable.Properties.VariableNames = {'aw', 'ae', 'Sp', 'Su', 'ap'}; disp(resultTable); for i=1:5 if (i==1) T(i)=(T(i+1)*ae(i)+Su(i))/ap(i); else if (i==5) T(i)=(T(i1)*ae(i)+Su(i))/ap(i); else T(i)=(aw(i)*T(i1)+ae(i)+T(i+1))/ap(i); end end end
Log in to reply.