Re: heat equation through different media/problem with constant flux

*To*: mathgroup at smc.vnet.net*Subject*: [mg87837] Re: heat equation through different media/problem with constant flux*From*: dh <dh at metrohm.ch>*Date*: Fri, 18 Apr 2008 02:41:07 -0400 (EDT)*References*: <fu6mi8$nnm$1@smc.vnet.net>

Hi Luigi, unfortunately your code is not readable and you do not specify what your problem is. Not knowig more I have to guess and my bet, considering the error message, is, that the media properties change abruptly. If so, try to model a softer change.Here is an example with hard change: k[x_]=Piecewise[{{1,x<1},{2,x<2},{2,x<3}}]; xend=3; f=T/.NDSolve[{D[T[x,t],t]==k[x] D[T[x,t],{x,2}],T[x,0]==1,T[0,t]==1+Sin[t],T[xend,t]==1},T,{t,0,7},{x,0,xend}][[1]]; Plot3D[f[x,t],{t,0,7},{x,0,xend}] and the same with soft change: k[x_]=Piecewise[{{1,x<1},{1+(x-1),x<2},{2,x<3}}]; xend=3; f=T/.NDSolve[{D[T[x,t],t]==k[x] D[T[x,t],{x,2}],T[x,0]==1,T[0,t]==1+Sin[t],T[xend,t]==1},T,{t,0,7},{x,0,xend}][[1]]; Plot3D[f[x,t],{t,0,7},{x,0,xend}] hope this helps, Daniel Luigi B wrote: > Dear All, > I am trying to solve the heat conduction problem in a sequence of > three media with different properties. For that I am using NDSolve > with my own grid. The code (without the 'tedious' definition of the > time dependent boundary conditions) is: > > \!\(NDSolve[{$B"_(B\_t u[x, > t] == alfa[x]*$B"_(B\_{x, 2}u[x, t], u[ > x, 0] == TavSInt[0] + \(TavRInt[0] - TavSInt[0]\)\/L* > x, u[0, t] == TavSInt[ > t], \([L, t]\) == TavRInt[ > t]}, u, {x, 0, L}, {t, 0, tmax}, MaxSteps -> 50000, Method - >> \ > {"\<MethodOfLines\>", \ "\<SpatialDiscretization\>" -> {\ \ > "\<TensorProductGrid\>", "\<Coordinates\>" -> {mygrid}}}]\) > > > However, i still do not get a satisfactory result. Probably because I > am not including the condition that at the interface between two media > the heat flux is constant. How can I do this? > > Thanks > Luigi >