Re: Diffusion Model using NDSolve - Advice needed
- To: mathgroup at smc.vnet.net
- Subject: [mg99426] Re: Diffusion Model using NDSolve - Advice needed
- From: schochet123 <schochet123 at gmail.com>
- Date: Tue, 5 May 2009 06:01:30 -0400 (EDT)
- References: <gtnk8c$3pa$1@smc.vnet.net>
The standard solution to this problem is to map each of the slabs into some fixed domain and formulate the problem in that domain. For example, if you have slabs a[j]<x<a[j+1] for j=1, ,,,, n then the transformations T[j_][x_]=(x-a[j])/(a[j+1]-a[j]) map slab j into [0,1], and their inverses Tinv[j][y_]=a[j]+(a[j+1]-a[j])y map the domain [0,1] back to the slabs. Let u[j][x] denote the value of the solution u in slab j. Use the chain rule to calculate the equation satisfied by U[j][y_]=u[j][Tinv[j] [y]] and the boundary conditions, which now are all set at the boundaries y=0 and y=1 of the computational domain. After running sol=NDSolve[...] and obtaining solutions Unum[j][y_]=U[j] [y]/.sol[[1]] for j=1,...,n you can map the solutions back into the slabs and use Piecewise to combine them into a single solution u. Steve On May 4, 11:47 pm, gwhollywood <thedramat... at hotmail.com> wrote: > Hey all!! I will try and be really brief. If you think you may know how t= o help, but don't understand what I'm saying, please ask! I'm desperate for= advice. > > I want to use NDSolve to solve the 1-D Diffusion Equation for a "composit= e slab" with THREE LAYERS, each having an arbitrary thickness and diffusivi= ty. > > I can solve the problem easily using NDSolve for the case of a single lay= er. > > However I am having a lot of trouble figuring out how to specify the prob= lem for three layers. There should be a separate solution for each layer on= its respective part of the domain (the total thickness). > > There are six total boundary conditions. The most important are the four = that appear "within" the slab at the two interfaces. They require matching = of the flux (which is proportional to the gradient), and proportionality of= the concentrations (therefore the solution is not necessarily continuous a= t the interfaces). > > So it kinda ends up being a piecewise solution - one part valid for a cer= tain section of the composite slab - know what I mean??? > > I have tried entering all the equations (3 second order pde's, three init= ial conditions, six boundary conditions) in NDSolve but I immediately get t= he error that some of the boundary conditions specified are NOT at the edge= of domain (which is obviously true since they are specified within the lay= er). Hence one of the three solutions is only valid within its own section = of the slab. > > I am having an awful time trying to figure out how to pose this problem w= ithin Mathematica. I am fairly proficient with the program in general. > > Any thoughts??