1d Unsteady

  • Uploaded by: JunedKazi
  • 0
  • 0
  • August 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 1d Unsteady as PDF for free.

More details

  • Words: 707
  • Pages: 5
%VJTI Phd_Mechanical %VIJAY DHADKE 169020009 %CFD 1D Unsteady clc; clear; n=input('number of grid points of control volume= '); L=input('Enter the length of bar='); K=input('Enter the value of thermal conductivity='); C=input('Enter the value of volumetric heat capacity ='); T_initial = input('Enter value of initial tenmperature (at Time=0) ='); T_b=input('Boundry temperature='); x=L/n; Time_initial = input ('Enter starting time = '); Time_final = input ('Enter final time = '); method = input('Explicit Method = 1 Crank-Nicolson Method = 2 Implicit Method = 3.... Method= '); y(1)=0; y(2)=x/2; for i=3:n+1; y(i)=y(i-1)+x; end for i=1:n+1 T(i)=T_initial; end T(n+2)=T_b; y(n+2)=L; aw(2)=2*K/x; ae(2)=K/x; aw(n+1)=K/x; ae(n+1)=2*K/x; for i=3:n; aw(i)=K/x; ae(i)=K/x; end if method==1 delT=C*(x^2)/(4*K); for i=1:delT:Time_final; Told=T; ap_old=C*x/delT; ap=ap_old; T(n+2)=0; for j=2:n+1; T(j)=((aw(j).*Told(j-1))+(ae(j).*Told(j+1))+((ap_old-aw(j)ae(j))*Told(j)))/ap; disp (T); end T(1)=T(2); end elseif method==2 delT=C*(x^2)/(2*K); for i=1:delT:Time_final; Told=T; ap_old=C*x/delT; a(1)=1; b(1)=0; c(1)=0; d(1)=-1;

for j=2:n+1 ap(j)=ap_old+(aw(j)/2)+(ae(j)/2); a(j)=ae(j)/2; b(j)=aw(j)/2; c(j)=-((b(j)*Told(j-1))+(a(j)*Told(j+1))+((ap_old-a(j)-b(j))*Told(j))); d(j)=-ap(j); end a(n+2)=0; b(n+2)=0; c(n+2)=T_b; d(n+2)=1; e(1)=d(1); f(1)=c(1); for j=2:(n+2); e(j)=d(j)-((a(j-1).*b(j))./e(j-1)); f(j)=(c(j)-((b(j).*f(j-1))./e(j-1))); end T(n+2)=f(n+2)./e(n+2); for j=(n+1):-1:1; T(j)=(f(j)-(a(j).*T(j+1)))./e(j); disp (T); end end elseif method==3; delT=input('suitable time interval='); for i=1:delT:Time_final; Told=T; ap_old=C*x/delT; a(1)=1; b(1)=0; c(1)=0; d(1)=-1; for j=2:n+1 ap(j)=ap_old+(aw(j))+(ae(j)); a(j)=ae(j); b(j)=aw(j); c(j)=-((ap_old)*Told(j)); d(j)=-ap(j); end a(n+2)=0; b(n+2)=0; c(n+2)=T_b; d(n+2)=1; e(1)=d(1); f(1)=c(1); for j=2:(n+2); e(j)=d(j)-((a(j-1).*b(j))./e(j-1)); f(j)=(c(j)-((b(j).*f(j-1))./e(j-1))); end T(n+2)=f(n+2)./e(n+2); for j=(n+1):-1:1; T(j)=(f(j)-(a(j).*T(j+1)))./e(j); disp (T); end end end

Output Explicit Output number of grid points of control volume= 5 Enter the length of bar=0.02 Enter the value of thermal conductivity=10 Enter the value of volumetric heat capacity =10^6 Enter value of initial tenmperature (at Time=0) =200 Boundry temperature=0 Enter starting time = 0 Enter final time = 2 Explicit Method = 1 Crank-Nicolson Method = 2 Implicit Method = 3.... Method= 1 200 200 200 200 200 200 0 200 200 200 200 200 200

0

200 200 200 200 200 200

0

200 200 200 200 200 200

0

200 200 200 200 200 100

0

200 200 200 200 200 100

0

200 200 200 200 200 100

0

200 200 200 200 200 100

0

200 200 200 200 175 100

0

200 200 200 200 175 75

0

200 200 200 200 175 75

0

200 200 200 200 175 75

0

200.0000 200.0000 200.0000 193.7500 175.0000 75.0000

0

200.0000 200.0000 200.0000 193.7500 156.2500 75.0000

0

200.0000 200.0000 200.0000 193.7500 156.2500 62.5000

0

Crank-Nicolson Method number of grid points of control volume= 5 Enter the length of bar=0.02 Enter the value of thermal conductivity=10 Enter the value of volumetric heat capacity =10^6 Enter value of initial tenmperature (at Time=0) =200 Boundry temperature=0 Enter starting time = 0 Enter final time = 2 Explicit Method = 1 Crank-Nicolson Method = 2 Implicit Method = 3.... Method= 2 200.0000 200.0000 200.0000 200.0000 200.0000 82.8427 0 200.0000 200.0000 200.0000 200.0000 179.8989 82.8427

0

200.0000 200.0000 200.0000 196.5507 179.8989 82.8427

0

200.0000 200.0000 199.4053 196.5507 179.8989 82.8427

0

200.0000 199.8811 199.4053 196.5507 179.8989 82.8427

0

199.8811 199.8811 199.4053 196.5507 179.8989 82.8427

0

199.8811 199.8811 199.4053 196.5507 179.8989 58.5785

0

199.8811 199.8811 199.4053 196.5507 147.3077 58.5785

0

199.8811 199.8811 199.4053 186.0766 147.3077 58.5785

0

199.8811 199.8811 196.7463 186.0766 147.3077 58.5785

0

199.8811 199.1590 196.7463 186.0766 147.3077 58.5785

0

199.1590 199.1590 196.7463 186.0766 147.3077 58.5785

0

Implicit Method number of grid points of control volume= 5 Enter the length of bar=0.02 Enter the value of thermal conductivity=10

Enter the value of volumetric heat capacity =10^6 Enter value of initial tenmperature (at Time=0) =200 Boundry temperature=0 Enter starting time = 0 Enter final time = 2 Explicit Method = 1 Crank-Nicolson Method = 2 Implicit Method = 3.... Method= 3 suitable time interval=0.5 200.0000 200.0000 200.0000 200.0000 200.0000 133.3333 0 200.0000 200.0000 200.0000 200.0000 186.6665 133.3333

0

200.0000 200.0000 200.0000 197.3325 186.6665 133.3333

0

200.0000 200.0000 199.4624 197.3325 186.6665 133.3333

0

200.0000 199.8720 199.4624 197.3325 186.6665 133.3333

0

199.8720 199.8720 199.4624 197.3325 186.6665 133.3333

0

199.8720 199.8720 199.4624 197.3325 186.6665 96.2961

0

199.8720 199.8720 199.4624 197.3325 170.3692 96.2961

0

199.8720 199.8720 199.4624 192.2910 170.3692 96.2961

0

199.8720 199.8720 198.0800 192.2910 170.3692 96.2961

0

199.8720 199.4453 198.0800 192.2910 170.3692 96.2961

0

199.4453 199.4453 198.0800 192.2910 170.3692 96.2961

0

199.4453 199.4453 198.0800 192.2910 170.3692 74.6905

0

199.4453 199.4453 198.0800 192.2910 154.9338 74.6905

0

199.4453 199.4453 198.0800 185.7840 154.9338 74.6905

0

199.4453 199.4453 195.8116 185.7840 154.9338 74.6905

0

199.4453 198.5801 195.8116 185.7840 154.9338 74.6905

0

198.5801 198.5801 195.8116 185.7840 154.9338 74.6905

0

Related Documents

1d Unsteady
August 2019 23
1d
May 2020 32
1d
April 2020 18
1d
October 2019 25
Unsteady Flow
October 2019 13
1d Zombievillage
June 2020 3

More Documents from "Susie Cambria"

1d Unsteady
August 2019 23