190 likes | 354 Views
Mathematical Modeling. Heat Exchange. 7. 이안준 , 이정훈 , 이지훈. Preliminary. What is a heat exchange ?. Problems. 1. Newton’s Law of Cooling. 2. Stefan’s Law of Radiation. Summary. Preliminary. What is heat exchange ?. Preliminary. 1. Newton’s Law of Cooling.
E N D
Mathematical Modeling Heat Exchange 7. 이안준, 이정훈, 이지훈
Preliminary What is a heat exchange ? • Problems 1. Newton’s Law of Cooling 2. Stefan’s Law of Radiation • Summary
Preliminary What is heat exchange ?
Preliminary 1. Newton’s Law of Cooling 2. Stefan’s Law of Radiation
Codes of Improved Euler’s method function z=z(n,t0,t1,y0) h=(t1-t0)/n; t(1)=t0; z(1)=y0; fori=1:n t(i+1)=t(i)+h; z(i+1)=z(i)+(h/2)*(nlc(t(i),z(i))+nlc(t(i),z(i)+h*nlc(t(i),z(i)))); end; IE=[t',z']; plot(t,z); title('Newtons Law of Cooling'); n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=ieuler(n,0,1,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end function y=nlc(t,x) y=70-x; n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=ieuler(n,0,2,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end
Codes of fourth order Runge-Kutta method function y=rk4(n,x0,x1,y0) h=(x1-x0)/n; x(1)=x0; y(1)=y0; fori=1:n x(i+1) = x(i) + h; k1 = h*f(x(i),y(i)); k2 = h*f(x(i)+h/2, y(i)+k1/2); k3 = h*f(x(i)+h/2, y(i)+k2/2); k4 = h*f(x(i)+h, y(i)+k3); y(i+1) = y(i) + (k1+2*k2+2*k3+k4)/6; end RK=[x', y']; plot(x,y); functionf=f(x,y) f=70-y; n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=rk4(n,0,1,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=rk4(n,0,2,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end
Codes of Improved Euler’s method function z=z(n,t0,t1,y0) h=(t1-t0)/n; t(1)=t0; z(1)=y0; fori=1:n t(i+1)=t(i)+h; z(i+1)=z(i)+(h/2)*(nlc(t(i),z(i))+nlc(t(i),z(i)+h*nlc(t(i),z(i)))); end; IE=[t',z']; plot(t,z); title('Newtons Law of Cooling'); n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=ieuler(n,0,1,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end function y=nlc(t,x) y=(40^(-4))*(70^(4)-x^(4)); n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=ieuler(n,0,2,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end
Codes of fourth order Runge-Kutta method function y=rk4(n,x0,x1,y0) h=(x1-x0)/n; x(1)=x0; y(1)=y0; fori=1:n x(i+1) = x(i) + h; k1 = h*f(x(i),y(i)); k2 = h*f(x(i)+h/2, y(i)+k1/2); k3 = h*f(x(i)+h/2, y(i)+k2/2); k4 = h*f(x(i)+h, y(i)+k3); y(i+1) = y(i) + (k1+2*k2+2*k3+k4)/6; end RK=[x', y']; plot(x,y); functionf=f(x,y) f=(40^(-4))*(70^(4)-y^(4)); n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=ieuler(n,0,1,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end n=1; e=1; tol=0.0001; U=ones(50,50); while e>=tol ans=ieuler(n,0,2,100); U(1:n+1,n+1)=ans'; e=abs(U(n+1,n+1)-U(n,n)); n=n+1; end