From: Torsten Hennig on 25 May 2010 22:40 > Hello everybody. > I am programming a .m-file that computes the > temperature distribution in a cylinder that consists > of 4 layers each one having different specific heat > capacities / densities / thermal conductivities. The > inner temperature is constant, whereas the outer wall > is giving heat via conduction to the environment. > However when I let the programm to give me the values > for t=> infinity, I dont get the correkt values like > in the steady-state-model :S any help would be > appreciated. Here is the m.file: > > function pdex2 > m = 1; > x = linspace(0.295,0.655,40); > t = linspace(0,8e+7,40); > sol = pdepe(m,@pdex2pde,@pdex2ic,@pdex2bc,x,t); > u = sol(:,:,1); > > surf(x,t,u) > title('Numerical solution computed with 40 mesh > points.') > xlabel('Distance x') > ylabel('Time t') > > figure > plot(x,u(end,:),'r') > title('Solution at t = oo') > xlabel('Distance x') > ylabel('u(x,oo)') > > % > ------------------------------------------------------ > -------- > function [c,f,s] = pdex2pde(x,t,u,DuDx) > ri=0.295; lambdai2=1.685; rocpi2=1600000; > r2=0.395; lambda23=0.176; rocp23=800000; > r3=0.520; lambda34=0.13; rocp34=400000; > r4=0.645; lambda4w=52; rocp4w=7850000; > rw=0.655; > > lambda=stepfun(x,ri)*lambdai2+stepfun(x,r2)*(lambda23- > lambdai2)+stepfun(x,r3)*(lambda34-lambda23)+stepfun(x, > r4)*(lambda4w-lambda34); > rocp=stepfun(x,ri)*rocpi2+stepfun(x,r2)*(rocp23-rocpi2 > )+stepfun(x,r3)*(rocp34-rocp23)+stepfun(x,r4)*(rocp4w- > rocp34); > > c = rocp; > f = DuDx.*lambda; > s = 0; > > % > ------------------------------------------------------ > -------- > function u0 = pdex2ic(x) > u0 = 400; > % > ------------------------------------------------------ > -------- > > function [pl,ql,pr,qr] = pdex2bc(xl,ul,xr,ur,t) > pl = ul-400; > ql = 0; > pr = (ur-20)*10/52; > qr = 1; > > > > THANKS ALOT FOR ANY HELP pdepe is not the suitable tool to solve layer problems because it does not take into account the interface conditions T+ = T- ; lambda+*(dT/dn)+ = lambda-*(dT/dn)- (continuity of temperature and heat flux) Best wishes Torsten.
|
Pages: 1 Prev: preallocating space for a structure? Next: error while booting the target pc |