Re: Diffusion Model using NDSolve - Advice needed

*To*: mathgroup at smc.vnet.net*Subject*: [mg99411] Re: [mg99385] Diffusion Model using NDSolve - Advice needed*From*: "Ingolf Dahl" <f9aid at chalmers.se>*Date*: Tue, 5 May 2009 05:41:36 -0400 (EDT)*Organization*: University of Gothenburg*References*: <200905041002.GAA22759@smc.vnet.net>*Reply-to*: <ingolf.dahl at physics.gu.se>

Without seeing your problem in detail, the answers will be a bit diffuse... Say, that you are trying to find a solution g[y,t] with boundaries where y is y0, y1, y2 or y3. One trick could be to merge the boundary conditions with the differential equation by writing D[g[y, t], t] = Which[y==y0, boundary0, y==y1, boundary1, y==y2, boundary2, y==y3, boundary3, True, differentialexpression] if it is possible to rewrite your problem in this way with appropriate expressions for boundary0 to boundary3 and for differentialexpression. If you find that your problem is such that the time derivatives could become infinite at the boundaries, with g[y,t] adapting to the demands infinitely fast, you should try to modify the equations in such a way that you obtain a small but finite reaction time. You also have to check carefully any solutions that you manage to obtain. Sometimes NDSolve will miss discontinuities in the boundary conditions and give wrong solutions. Check also the option Method -> "MethodOfLines", see tutorial/NDSolvePDE#1699661144. This tutorial contains a lot of examples of different cases. Good luck! Ingolf Dahl ingolf.dahl at telia.com -----Original Message----- From: gwhollywood [mailto:thedramatica at hotmail.com] Sent: den 4 maj 2009 12:02 To: mathgroup at smc.vnet.net Subject: [mg99411] [mg99385] Diffusion Model using NDSolve - Advice needed Hey all!! I will try and be really brief. If you think you may know how to 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 "composite slab" with THREE LAYERS, each having an arbitrary thickness and diffusivity. I can solve the problem easily using NDSolve for the case of a single layer. However I am having a lot of trouble figuring out how to specify the problem 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 at the interfaces). So it kinda ends up being a piecewise solution - one part valid for a certain section of the composite slab - know what I mean??? I have tried entering all the equations (3 second order pde's, three initial conditions, six boundary conditions) in NDSolve but I immediately get the 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 layer). 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 within Mathematica. I am fairly proficient with the program in general. Any thoughts??

**References**:**Diffusion Model using NDSolve - Advice needed***From:*gwhollywood <thedramatica@hotmail.com>