 Hello, I'm Simon Benjamin and this is lecture 6 in my course on Fourier series Fourier transforms and partial differential equations So we will be going further into the territory of how to solve these partial differential equations Last time we met the diffusion equation and this time We're going to be thinking about how to use Fourier series to solve pretty general diffusion problems couple of examples we'll especially look at our Diffusion of one matter system into another when we start with a stack of what might be metal plates for example and They're heated up so that the material can start to the plates can start to melt into one another and then To switch over to a heat problem We'll consider a bar of some material that is linking together a hot reservoir So that's a region that's permanently hot and won't run out of heat energy and a cold reservoir Which similarly is permanently at a different temperature. What in that case? Will be the dynamics of the flow of heat inside the bar and then if there's time We'll say a word about how to use Fourier transforms to level up our abilities even further so I'll start by looking at where we left off last time actually Where we had left off is that we found that if we have a diffusion equation that looks like this and Then we propose that a solution to this equation which has to match our initial conditions But then if it follows the diffusion equation it correctly Describes how things will change in both space and time from then onwards If such a solution were just a product of a space like part and a timeline part if the variables were separated in this way Which is very very constraining but still if that were the case and we concluded that the space like part of the the x function is just in general a sign and cause combination and the time like part is in general just a decaying exponential then we multiply those two things together to get our general to get our solution under that special constraint That it is a product of two things I suppose I should say that a completely general solution Should also have a constant on so we can add Well, I've already used K. Haven't I? Yes, so just for a shift I'm just using the letter s because it makes me think of a shift So sure I can add in a constant because if I feed that into my partial differential equation It will go to zero on both sides So we could we could model any kind of initial situation where we had some kind of sinusoidal distribution and there was an Overall shift so something like this that I'm sketching here Yeah, we could handle that and then this would be s But what you know, that's not going to come up. That's not powerful at all We do know what would happen next by the way, which is that the shift will stay there But the part that's made of sign and cause as time runs on Then it will become a smaller and smaller because this time factor will become e to the minus some number times t will therefore become a smaller and smaller multiplier and This oscillatory bit will die and already we can pause and say, okay this is this fits into our idea of a steady state which would be the shift just that constant and A transient part a part that eventually goes away to zero and that would be the whole sine cos bit But you know, it's not great because that that is very very specific, but we noted that We had one more extremely Powerful card up our sleeves and the ace of our sleeves, which was that it's just tidy up some of this highlighting our equation here That our diffusion equation or equivalently our heat diffusion equation same maths is a linear equation And the great thing about linear differential equations is that if you found one solution and Then you find a different solution You can add them up to make a third solution and you can keep on doing that So if you found four different solutions, you could add them all up and they would still be a solution So what does that mean? Well, if we look through what we did we made up this constant K as part of our analysis. We said well, we'll figure that out later The boundary conditions will tell me what K. I want It's just some constant. It doesn't affect any constant will satisfy the Equation, but then that means that I could consider two different solutions that go with different values of the constant Let's write down what that would look like So here we are just the same equation written out twice The only thing is that I've used subscript one for the first solution that I've written out and There's a subscript on our K constant So of course, it must be the same everywhere it appears So this is all K subscript one and I've just put a subscript on our overall shift as well So that's the first solution But we can as long as we keep the mathematical form the same we can change the constant So now here's our second solution it uses a different number K2 that appears throughout and I've just put a subscript two on the shift as well See that actually I missed it off here So that is K2 the important point is the constant must be the same within one of these solutions But then we can write down a whole second solution with a different constant and we can keep on doing this now That means that in general our solution. So let's call it solution total maybe Can be way more general than any one of these on its own in fact It can be just a sum over say some index i is equal to 1 As many as we like we could even have an infinite number of solutions that we add together of these kind of things Each of which on its own is Separable, but the whole thing is no longer separable You can't write the whole thing as just a product of some pure function of space at times by some function of time But we can write the individual solutions that it's made out of that way By the way, it's clear that we don't really need to keep on adding on different constants once we've got one free overall shift constant Then We've we've already got as much as we're gonna get out of that right it doesn't help to keep on saying Oh, you can shift it by another amount another amount So we only need one of those and if we think about it a bit actually we can see We don't even have to write it even once because if we choose the constant K If we choose one of our K's to be equal to zero what would that do it would in fact If we had K is equal to zero. Let's see what it does. It means that Our e to the minus KT would just be e to the zero, which is one so that term would just disappear We'd have sine of zero times X sine of zero disappears We'd have cos of zero which is just one and so if we do put K as equal to zero We just get a constant that doesn't change in space or time. So actually by saying that our Solutions are of this general form. We don't even really need to write that shift in there if we want We'd still capture it within the framework now What kind of initial condition can we now match given that we we realized we can write our solutions in this very general language so Well, we just need to see what this looks like if we set time to equal to zero But if time is equal to if time is equal to zero then these exponential terms just become one in that case So then we have That's our total solution at time T is equal to zero is equal to a sum. Yes, but let's write out specifically what we get We get And he saw actually something I should have I think would have been clearer Let me go up and make it absolutely clear that these constants a and b Of course, they can be different and they will in general be different in our different solutions So not only the constant K Which was the interesting one as it gets in there into the sine function and the exponential But also the constants and be that are just saying how much sine and cos we want they can also be different in each case So let's now write down what we're saying we can say at time t equals zero when the exponentials disappear What we've got is a I a subscript I of cos K I X There a I and K I can be whatever we want plus the I of sine X That is just a Fourier series, right? If we choose as we just said we could choose one of our case to be zero In fact, that's more general than a Fourier series because when we think about a Fourier series We only allow the signs and causes to have a frequency that differs by an integer multiple of the lowest frequency Here we're giving ourselves anything at all So this certainly contains everything that every Fourier series that we've ever played with every Fourier series that we could create is Already contract contained within this framework Well, that's pretty good We're saying we can now deal with any initial condition Which is some distribution of heat or some distribution of matter that can be described by a Fourier series Now certainly that includes any periodic distribution So we could consider as something that's periodic over a large region and then ask how That periodic function changes But if as we'll see I think in the second example, it doesn't even need to be periodic If you remember we argued that if we have a function that's only defined from one point to another like a guitar string Only really being defined from the first point that the string is anchored to the guitar to the second point and the string Just doesn't exist beyond those limits we can turn that into a periodic function just by copy paste and so We're going to be able to tackle Pretty much anything It's only a question of choosing the right tool for the job And we'll see later on that sometimes the right tool is to go one step further and use Fourier transform But no need to think about that yet. We're already seeing we've got an enormous power now to tackle problems of a hugely diverse range We are powerful. Okay, so with that Flexing out of the way, let's let's do something. Oh, actually, let's let's just pause one more moment. So We can see that what we're going to want to do is consider a problem that has some kind of initial condition We're going to want to use our Fourier series skills to write down a Fourier series that describes that initial condition and That will have pinned down for us What we want these a and b and k coefficients to be or what these constants are But then of course what we really want is how things evolve forward in time and all we need to do then is Take our Fourier series to put as it were to put time back into the story and find out what happens next We just need to Have the same sum that we will have worked out for our initial condition But then we just need to put that time multiplier back in So we take our sum we bracket it up and we times by e to the minus d k squared T where crucially this must be the same k for each term So as we sum over this infinite sum of solutions of simple solutions Whatever the k value in each case that corresponded to our sine or cars or both Then they must be multiplied by an e to the minus d k i squared the same k So we will have a whole series of e to the minus d k squared t Terms one for each of those k constants we've chosen to use. Let's see it in action I want to consider a stack of material. Let me sketch it Wow, I really went to town on that figure It's got shading and everything. It's probably more than it needs to be honest Let's call the the vertical direction here x Now I want to assume that these sheets are Large in the other in the horizontal direction So the sheets let's call them infinite or let's say that we're focusing on a region in the middle of our stack of sheets Such that the consequences of the fact that the sheet does eventually and are not affecting For over the times that we're interested in are not affecting what's going on in the middle So much more so than in my sketch suggests. I want these to be a wide narrow Sheets of material and I want the separation of my the thickness of my plates to be a and also a for the Orange ones, so that's a now before doing this I'm going to think I want to solve two problems at once because that's efficient So let's think of a completely different scenario, which would have the same mathematics We could go all the way to considering a heat-based scenario But I'll stick with at least matter diffusing, but we'll consider Um a pipeline. Let me draw this. So let me draw it for you So here's the second one. I there's another diagram that I probably spent a bit longer drawing than I need to What I'm trying to capture here is a pipeline That uh goes in the x direction And our pipe is full of gas, which I've colored here in purple And there are taps valves That are sealing each section of pipe away from the next So it's a series of sections of pipe that are joined together with valves And each section is length a long just like the thickness in our stack of metal now in the pipe section Maybe each each section is a kilometer long And in our stack maybe each layer is only two millimeters thick So they're radically different scales and of course our stack is a series of two dimensional layers That we're just saying are infinite in that direction Our pipeline is certainly not infinite in width instead It's so narrow that we can say like when we were deriving the diffusion equation That the density of gas across the width of the pipe is going to be basically the same There'll be no variation in density across the width because that's not very great But along the length of the pipe there can be and um so that's it essentially I think these two problems are nice to think about because they're so different looking but they actually have the same maths The the reason that we made the the sheets in our stack problem infinitely large is again to say that we We don't need to think about any variation across that sheet because the edges of the edges of it are essentially infinitely far away So the same thing is going to be happening everywhere And that's a different way to not have to think about variation in the other spatial direction So have a think about it for a bit if it's helpful, but we'll see that Mathematically these are going to be the same thing and if I say that the density of some atom That's able to move around inside our stack of metal sheets doesn't have to be metal stack of materials is also Alternating with the same phi one phi two Initial condition. So the blue ones will say have density. I don't know uh phi one and the orange ones have density Phi two at the beginning of the problem Then we can write down The same initial conditions for both these stories and it really doesn't matter which one we want to think that we're solving We'll be solving them both simultaneously. So let's do that So there we are there are the equations familiar sort of thing to what we've looked at before The bottom line here just constrains us to say that the function is periodic So we're not going to it's periodic with period two a So we're not going to have to say what happens outside of a range of for example naught to two a if we specify that range We've specified the function everywhere because we've said it's periodic and in that range We just either have the uh, let's say or I can we could think of it. How do I want it? Maybe the lower density Phi one or the higher density phi two. These are just two constants that describe how we start out So now let's plot what we're talking about So there we are I've tidied tidied it up a bit and there we have a plot of our Density function at time two equals zero whether it's the gas or whether it's the migrating species of atoms in our metal stack Uh, oh and you need to put on the uh That whoa I need to put on that. This is a two a And three a and so on and x can go negative as well because we're assuming that it's an infinitely long pipe Or and I don't know if I make this clear, but my stack. It isn't four layers. It goes on I just can't keep drawing them much as I enjoy drawing them. I can't keep drawing them indefinitely So it's an infinite stack Meaning practically speaking a very large stack where again we can think about what's going on in the middle of it And not have to worry about boundaries So there we are the question is what happens next according to the diffusion equation It might be nice to pause now and just guess what happens next So what do you think if I were to put a second curve a second? Trace onto this diagram, which represented How the material looks the density of the material at some later time t Um, what would it look like? Let's let's in fact sketch on our guess So I remind you one more time You can either think about what will happen in the pipe if we open these valves and again just for simplicity We assume that the valve just um instantly at time t equals zero opens and now the pipe is just an open pipe So, you know, realistically the valve is no doubt a constriction and it's a little bit more complex But we're just assuming there's essentially a division Between the sections of the pipe and that division is removed instantly at time t equals zero Now there it is at time t equals zero written out twice, but what will the time infinity limit look like? Well, we're assuming that our Pipe doesn't have any leaks Or equivalently that our stack of material doesn't allow the migrant species of atom to actually just escape into the atmosphere So it means that the amount of stuff is constrained. It's conserved So if all that can happen is our material Redistributes itself, but doesn't disappear doesn't vanish or get created That tells us something about what we must see in the Um infinite time limit It tells us that it must have just Smoothed out to the same total amount of quantity total amount of material And so what we should be drawing is a line just like This which i'm trying to put right down the middle although my ipad doesn't want me to so Can I adjust it slightly maybe That's supposed to be right down the middle and I hope you can see without me needing to argue For this being the case that if I were to integrate then the area under the line I've just drawn is the same as the area Under the original line. We only ever have to think about one period of the system We only ever have to think about let's say zero to two a or if we like minus a to a that's equally good And we can see that these two things are the same. So that's going to be the infinite time limit. What about at some finite time later What should we expect that our Our distribution looks like well, here's what I would expect I would expect that near the boundaries We've seen a lot of migration a lot of diffusion but in the middle of the regions that The furthest points from the boundary. That's where things have changed the least because material in our pipe Let's say our pipe case It takes a while for anything from the high density regions to get all the way into the middle region of one of the low Density um sections and similarly with our stack. So what I think we should see At a suitable time later is we might see things look pretty similar to how they were before in the middle of each region but there's a sort of a a Softening of the boundaries very considerable soft softening um And so I think that's what will happen at fairly early times I guess I don't need to keep drawing this um, and then at later times, I think even in the middle of our regions um The diffusion will have had its effect and we will start to see the amplitude of that oscillation dropping down until eventually we get Our flat line. That's my prediction. Uh, let's see what the maths tells us So what we need to do is describe this initial condition as a Fourier series. Fortunately, that's easy because we've already done it This is the square wave the one that we wrote down was a little bit different it uh We wrote down the first lecture. We wrote down one that um went from a zero to one as I recall Let me draw out the the one of I'll pick one of the Fourier series from the first lecture or so And uh, draw it and we'll compare it to what we the job we now have to do And I think I'll I'll erase this this I'll keep a record of of the of the prediction of what things will happen and we'll see if it comes comes true Okay, I picked a uh sign. Uh, oh, I haven't quite finished writing in fact. I picked a Fourier series that we have looked at And there we are it has a factor four over pi in front. This is a Fourier series that goes um from plus one to minus one And it it's initially plus one Until from naught to pi and then it flips to minus one and so its period is two pi Okay, so we we we have that solution already We've worked that one out in the past all we need to do then to describe the our density variation at time t equals zero Is to figure out how to translate the function? That is drawn here in black into the one in purple. So what do we need to do? We need it to go between Phi one and Phi two instead of plus one and minus one We need it to I looks like I'm going to need to turn it upside down in the sense that as I've written it here Phi two is is greater than Phi one. All right And so that's going to be fairly straightforward. Let's start. Let's start building it up So how do we relate our make a bit of room here? a bit perhaps how do we relate our density at time t equals zero to this function Well, as we were just saying we need to scale it now the The Fourier series that we know oscillates around zero The thing we want oscillates around the average of those two points, right? So it oscillates around this mark here, which is clearly Phi two plus Phi one over two the average of them So we can give ourselves that constant for starters Phi one plus Phi two over two And then all we need to do is add on or in fact, we'll subtract because we want it to go down and up our Function but now we have to scale it So instead of going from instead of having a range of two from plus one to minus one We want it to have a range of Phi two finite minus Phi one. So what does that mean? That means we should have this I think f of something and the only thing that we have left to do Is to figure out what we should be feeding into our function f of x instead of x Let's just check that. However, I've got those coefficients. Correct A bit of brackets around that if I want so I just need to ask what happens when f is plus one or minus one Well, I can see here that if f is um plus one, which is its initial region here Then I'm going to get just Phi one which is what I want and then when f is Minus one, then I'm going to get Phi Two which is exactly what I'm after so that that seems all correct The only question left then is how to properly Scale the frequency of my function, but we've already talked about that in the past What we need to do to adjust a Fourier series from period to pi Is to substitute in a two pi over l. So let's just write out what we're saying. So I'll move up a little bit now make a little Space or in fact just raise that and rewrite it So what was what I'm saying is this should work if we feed in two pi over l times x instead of just regular x and so why does that work? Let's remember why it works if we think that our x variable changes by By l then we're going to divide by l and times by two pi So what our function f actually sees is something changing by two pi and yes Its period is two pi so that will work the new thing the scaled function Will have period l but by the way, uh, we it wasn't we weren't calling it l We were actually calling it to a a complete cycle of our density function is Two a so let me replace that to a And can erase that so that I think is my time t equals zero Function where f of x is or let me just write the whole thing out actually. So let's uh, let's let's say what we're saying That's uh, it's completely clear There we are I've just written it out again, but the substituting in our Fourier series I was able to tidy up a few things for example We have four over pi and that gets timesed by a half here So that's going to be a two over pi and also I brought the minus sign inside to make now this term phi one minus phi two And I notice also there's a nice cancellation of two factors There that's it. We've written our Initial distribution of density as a Fourier series Now because of the arguments we've just made we're in a position to simply write down the answer We don't need to go back to the differential equation and start feeding things in We already showed that sine and cos like solutions were legitimate And we discovered that a sine at the solution of the form sine k x needs to have a Needs to be multiplied by e to the minus k squared dt in order to make it a legitimate solution for general time So all we need to do is plug that in So let me write out for you again now the complete solution There we are. I've just written it out again. I've just about had room I've simply copy pasted the line above and added in the time factor noting that this Quantity here is what in our previous analysis. We were calling constant k And we know that whatever that thing is it must appear up here as k squared And so I've just substituted that in that's where that comes from And that must be The solution to our diffusion equation as a full function of time So what can we do with that? Well, I'd like to try it out and the way I'm going to try it out Is by putting it into mathematical and then just letting time run forwards and at that point We'll see if my prediction which was probably similar to your prediction I guess as to how things diffuse turns out to be correct. So I'll do that now Now here we are. Let's fix our plot range because otherwise We're going to be looking at mathematical just choosing how to plot things zero to 2.2 So we get there we are So just to make sure this is right if I set time back to zero I'm going to get my there's my Oscillating Initial condition it has these little overshoots which was the The Gibbs phenomenon that we've already discussed that we need to concern ourselves with or that they are interesting And now we run forward time a bit There's obviously a Fast diffusing process. Let I wanted actually to go a little bit earlier than that. So let me choose I'll reduce my diffusion coefficient a bit So it's still too fast. So let's do that. Yes, that's what I was looking for So now we're looking at a very early moment in the diffusion process We're seeing that the gas or if you like the species of itinerant atom in our stack of material Has started to migrate across the borders, but within the middle of each region. It's still purely at the original concentrations And so now as we sort of clock through let's consider that time has gone twice as much time has gone past And it's continuing to soften. Let's go out to four times as much time Now it's starting even the middle of the regions has been reached Let's go out to eight times as much and now we can see The concentration is starting to even out even in the middle of the regions. And if we go out to We've already been there, but let's go out to this. Let's go out further to this Value. Oh, and now Mathematica is starting to grumble because it's having to calculate things It doesn't like but it's still giving us a plot we can use and we see what looks like a pretty much pure Sinusoidal function that's now oscillating between limits that are somewhat less than two and one And let's go out further even though Mathematica will keep complaining it can clearly do it Let's go out to a longer time and we see that now all we have left is something that looks again like a pure Sinusoidal function with a reducing amplitude Is that what we expected? I think it is can we understand why that's happening? Let's flip back over to our notes and see So it looks like our function is correct Why is it that it becomes after a certain amount of time? To the to the eye at least just a pure so it's sinusoidal Oscillation well Of course, it's because each of our different sine terms in our Fourier series Is multiplied by this time like term that down sit down as time as time goes on it becomes a smaller and smaller number, but crucially Whatever our value of k is whatever our frequency is in here That quantity gets squared When it's multiplied by time. So that's a very strong amplification If we imagine that we typed in a is equal to pi So in other words, we had just got a two pi period for simplicity Then we can see that sine of x would have the the basic exponential but sine of three x which is the next term along would Have nine times as strong a term up there in the exponential dampening it down and the very next term which is Five x would have 25 up there So the amount of suppression that we get from our time factor is very aggressively ramping up Depending on the frequency of our sine term So what we should expect is that as time becomes finite the higher terms in our Fourier series are annihilated And pretty rapidly we only have a couple of terms and then soon enough really only the first term is worth mentioning because Even the second term even the sine Term where n is equal to three is hugely suppressed compared to the first term Good And of course even the first term is becoming suppressed Which is why soon enough we end up with something that looks a lot like just our constant So it makes intuitive sense And that is our full solution. We now can solve those kind of problems if you Had some materials that you wanted to blend into one another by heating them up Then you would be able to predict that process with a model like this Okay, time for a fresh problem that will test us in different ways So what I would like to do is to consider a problem that has a more interesting steady state And for that I'm going to need thermal reservoirs now What is a reservoir a reservoir when we talk about it in these kind of problems? Is a source of material or source of heat or a sink as in a place that the material goes to for Either matter or energy that it doesn't change its own properties however much Matter or energy it gives out or takes in so it's a huge What we're usually picture is that it's a huge Storage medium where the small amounts of energy or matter that are moving around in the problems We're looking at to have no measurable effect. It's a drop in the ocean If you like the ocean is like the ultimate example I suppose pour a cup of water in that's a big deal for the cup the cup has now become empty We could modeling the poor model the pouring process the sea. There's no, you know, it makes no measurable difference. Okay So Um Here's here's the scenario. I'm interested in I want to think about a tank a water tank that has been divided into two halves Let me draw it. Okay. Here's the scenario. So we have a tank It's actually divided into two chambers by a wall of let's say metal down the middle And that wall is the thing I'm interested in I'm interested in how the temperature varies across that central dividing sheet And so I can let me just move things around a little bit. I can say that x is equal to zero is the left hand side of that wall and x is equal to D Is the right hand side of that wall now on the left is a huge body of fluid That's at some temperature theta a and on the right is a huge body of fluid Which is a temperature b in general these are different and in fact what we'll consider Is that before time t is equal to zero? So in the past compared to the problem that we're interested in these temperatures were the same and in fact The left chamber the left one was at temperature b so they were both at temperature theta b but as At time greater or equal to zero then the left Is indeed at this temperature theta a and the right Is a temperature theta b so there's some kind of abrupt change to our reservoir that we're we have no control over it's just happened and So what we could imagine is that both sides of this tank were full of hot water And then instantaneously at time t equals zero cold water was flushed into the left hand side And now we start the stopwatch and we say what will happen to that Dividing sheet in the middle. What does it look like the heat distribution across it? Well, we can start to write down some things about it at time t equals zero The across the width of our Dividing sheet of metal So for the full range of x and we see that here's a problem by the way that Our temperature distribution is not defined for s is less than x is less than zero or for x is greater than d It's a finite range problem. So that's one of the more advanced ingredients that I wanted to put in So we have if we're using theta for our temperature distribution We would say that at t equals zero The temperature distribution is going to be just equal to that hotter value because until that moment Our partition wall had the same temperature on either side of it. So it would have been in thermal equilibrium with both those reservoirs And I'll say that's for x is greater than zero and less than or equal to d now I want to also constrain the temperature of the very If you want to think of it in terms of atoms or we're not modeling atoms But the very last sheet of atoms the very last layer that's on the right I'm going to say is always at temperature theta b because it's in direct contact There's nothing in between its direct contact with the fluid That is that temperature theta b. So I will write down that x is equal to d for any time So I'll just leave t as a general variable We are going to be at that hotter temperature But I'm also going to say that By similar logic x is equal to zero For any time and by any time I mean any time greater than zero. We're not exploring what happened before then Then I'm going to be at the lower temperature That's because we flushed in the cold water at that moment We can imagine that it has instantaneously cooled down as it were the first layer of atoms that's in contact with this cold water So what we have is a temperature across the thickness of the divider that's at t equals zero uniformly at the higher temperature except for You know infinitesimally the last layer it drops down to the cold of temperature And those end points are going to be the same forever. So we can draw it out And we'll be asking first the question What will happen as time goes to a very long time time as it goes to infinity, but let's draw it There we are. I've sketched it out now. I've in order that we can see what's going on. I've put a a slight gradient on this Region of the plot that's close to x equals zero But we understand it's actually basically vertical because at any finite non-zero value of x we've jumped up to the Higher temperature theta b and then that's constant across the thickness of the sheet Until we get out to x is equal to d and after that it's not defined There we are. So those two points I've drawn in with the the dots they are absolutely fixed for all time They can never vary because they are the the the points where our sheet is in direct contact with the reservoirs And they don't vary so the question is what will this look like as we go to the long time limit Well in the long time limit the steady state there's no longer any change to the distribution What is the simplest solution we could find and then we'll test it out? Well, I think the simplest let me change color to pink. Let's say would be that's given that we have to have those endpoints That um, uh, we must have a temperature difference across this Sheet of metal the easiest proposal would be that it's a straight line. Do you agree? So, um, as we move through the material The temperature decreases and decreases until it reaches the temperature of the upper reservoir. What would that solution look like? That would be that uh, we would be seeing that x as t goes to infinity theta of That is equal to well Just a line a straight line that extract that extrapolates between those two points. Let me write it down I hope you agree with me that that's that's what we want Because when x is equal to zero we get theta a And when x is equal to d We get theta b and it's just a linearly increasing function So that must be the proposed formula question is does that satisfy the diffusion equation? Because even the steady state must still satisfy the diffusion equation Well, the diffusion equation. What was it? Let's remind ourselves There it is. We alpha is just some constant. What happens when we feed in our steady state solution there? Well, the differentials on either side of our equation will certainly get rid of that constant The scale factor will be fine that will just cancel from both sides So the question is what's left? Well, the d by d t that partial derivative will regard the x as a constant and give zero The d by dx will not but it's a second different. It's a second derivative So the first time it will take x to 1 and the second derivative will again give zero So the equation will be satisfied in that it will just both sides will just give zero in the steady state That that sounds right. So that's our steady state solution found Now if we if we remember What if we can write down a steady state then we can focus our attention on The extra ingredient the thing that disappears as time goes to infinity the transient part of the solution So what we need to ask is what what do we need to add to the steady state in order to produce the time t equals zero how do we in other words get from our Pink line the steady state to our initial condition, which is the orange line that will be our transient in its initial form So that's what we need to understand. So to be clear I'm saying that the general solution Which is for all time and all space is equal to a part that's the steady state And it's just a function of x and that's what we've just written down above And a part that is the transience so I could write tr perhaps And that is going to be varying with both time and space And if I want to find out what the transient is at first Then I need to think what is that At t equals zero And I just look at that diagram and I think what do I need to what what I need to put in To get from the pink line to the orange line. Well, it's a step like function That is large at x equals zero and goes down to zero at x equals d Let me just write a proposal and we'll check it works Okay, so you think x equals well, let's say near x equals zero be careful about this We'll have The difference between the two temperatures. So that will just buff up theta a to reach theta b and then As x increases towards d and reaches d that shift It becomes zero. So that must be correct except we need to be careful at exactly the x equals zero point So let me just Move up. I don't think we need to look at the diagram anymore So we'll say that this is true for um x is strictly greater than zero And less than or equal to d but um this transient is equal to zero for x equals zero Itself and and by the way at x equals d but but there we hardly need to say it because it's already captured by the line above Hmm. All right. So now let's draw that function, which is just the transient and see what that looks like There we are that I reckon is the missing uh, that is the component that will turn our Steady state into our initial condition And you I think you can just uh take a stare at that and see if you agree with me I can put both of them next to each other just so we can see There we are just leave that up for a moment so that we can confirm by eye that this looks sensible It's what we want by the way. I should write on that the point here is the difference between the two temperatures And now I'll erase the second one and we can get on with the analysis So our challenge is to use a Fourier series to create this Um and then together with our steady state that we already know satisfies the diffusion equation When we add in the correct Fourier series that will describe our time t equals zero Uh situation and because we'll be using signs and causes with the right time exponential component Uh, we will then have described the entire problem for all positive time. We'll have sorted it out How can we use a Fourier series to build this function? It is a function that's only defined in a finite region And uh, we are going to want to extend It to make it into a periodic function and then we can create a Fourier series The question is how best to do that? Let me show you Uh, what looks like a promising route and then we'll spot what's wrong with it Okay, what's wrong with that? Why shouldn't I extend my function like that? Hmm. Well, it's breaking my rule of thumb that I don't want there to be uh a discontinuity at, uh The point where I extend my function on now that kind of needs to be a discontinuity in the x equals zero region Because it's already a discontinuity. I'm already abruptly jumping Down to zero, but that doesn't need to be the case over here Um, that's that discontinuity is on me from having extended my function in that way But that was just a rule of thumb don't create discontinuities What will actually happen if we build this we certainly could create a Fourier series like this? And then uh, we would have a proposed solution It would satisfy the diffusion equation. So it would all look legit But what would happen as we run forward in time? Well, um, what would happen is that uh, of course the terms in our Fourier series, uh, which uh, You know, depending on how we structure it at signs and pauses They would have those of course time damping terms and so they would gradually be attenuated away We want our transient function to vanish to zero at infinite time Because we're going to add it to the steady state and the steady state already describes what the infinite time situation is so the transient has to go away This won't go away. Why not? Because the Fourier series that can create this function that we've drawn here Would actually have a constant and the constant would be equal to that it would be theta b minus theta a over 2 And the reason is that a Fourier series apart from the constant is just made of signs and causes And they so to speak spend as much time above the axis as below So they can't create a thing which lives permanently Above the x-axis or has even an average above the x-axis We want to get above the x-axis as we clearly do here because our function apart from just touching it spends its whole time Above the x-axis will need to add a constant and what's wrong with that If we add a constant into our Fourier series the It won't be killed off by our exponential terms because a constant as we said earlier is like having a Spatial frequency k of equal to zero that would give them cause a kx becomes just one just a constant But the e to the minus k squared d term would then just be e to the zero, which is one It wouldn't decay away with time we so this thing Written as a Fourier series and then when we add in the time terms would decay down to this line here Um, and that's not what we want. We need it to decay to zero. So that's that specifically what would go wrong Uh, we've broken our rule. What can we draw that doesn't break our rule and that will in fact decay to zero I want therefore a function that spends as much time above as above the axis as below. Let me draw that for you There we are that is the functions that is the function that I do want to use What you can see I've done is I've squished the horizontal scale in what I've drawn so that I can fit onto my screen a function which has twice as long before the period repeats so Uh What you can see is that the whole region that uh, where where where our function is defined is just this this region here And then uh, we carry on going down Before we've reached twice the distance 2d and then we complete a cycle Now this function still has a discontinuity where it needs to have a discontinuity at x is equal to zero It's just line that up but it uh Doesn't have a discontinuity at x is equal to d. Let me just finish labeling so you can see that's how everything lines up So that's theta b that of course is zero Okay, that's that's what I will recommend that I think it's going to work It will now that transient once we put in the time functions will decay to zero Which is what we want and so the previous proposal Satisfied our time would have satisfied our time t equals zero boundary condition Would have satisfied our diffusion equation would not have satisfied our t as infinity limit This one will satisfy all of them and therefore must be the correct answer All we need to do then is to write down a Fourier series for that function Now this is called uh, sometimes called a sawtooth Wave and it is one of the ones that it is an exercise to have derived in the problem sheets To go with the first part of this course. So I will not derive it here But I will just write down the answer. It's going to look very similar to some other Fourier series. We've seen Okay, this Fourier series that I've just written down It has period 2 pi which we would need to adjust and it goes from plus 1 To uh minus 1 that's its range And we would so we need to adjust those two things, but then we've we've got the Fourier series We need by the way it looks I'm uh, it looks very similar to the Fourier series for the square wave. What's the difference We're not just summing over the odd terms this time We have the even terms as well and that makes all the difference and changes the shape of the resulting function profoundly Okay, so, uh, let me now make that conversion Uh, I'll just write it down and then we'll we'll see we'll see that it's correct There we are I've just uh multiplied it by the correct vector to scale the amplitude and adjusted the periodicity with our usual trick Of type of writing in inserting 2 pi over l l being the period and in this case That period is 2d which allows us to cancel out a 2 above and below like that That is now the correct Fourier series and as before that allows us to now write down the time dependent version of the transient We can we can this was for t equals 0. We can now write it down for general t. Let me make some room for that and write it out There we are The same thing of course But now we pick up our time factor which multiplies each of the corresponding terms And there the quantity that in general we've called k appears as k squared as it must So that is our general solution It has to be our general solution for the transient or and we uh erased type t equals 0 because that's now for general time And that means we can write down our full solution. We just have to add in the steady state So it's quite a big expression, but then it's a it's a complicated problem Let me write it out and then we'll quickly check that it it seems sensible in mathematical There we are It's a long expression, but not really a very complicated one. We can understand what's going on piece by piece There was our steady state and this is the transient that we just arrived above This should be it. I'll type that in and we can try it out now What should we expect? Let's go back all the way to our initial Drawing here. We said let's get our tank in view. We said look The orange line here is the temperature inside that metal wall at time t equals 0 and the pink line Is what we expect at infinite time. What should we expect at a small finite time? What would you expect? We're going to see for After after a little bit of diffusion has happened. What would be the first thing to change? I wonder what you reckon it is. I think It has a is a while since I've done this I might be wrong I think that what we would expect after a little bit of time has passed is not much change over most of this But the initial change will all be Near the abrupt change in temperature, right? So essentially we'll have heat leaving our sheet near the cold reservoir And then over time, of course, we would expect it to soften out more And we get something more like that. That's my prediction. Let's see Just before I nip over the mathematical. I'm sorry. I do need to fix a tiny area here The symbol isn't D because we're not using doing a matter diffusion problem. The symbol is alpha. So that is a very Makes no difference to the maths, of course, but it is important to insert the right thing So because we're using the heat equation our convention that we introduced was to have the Coefficient that says how rapidly heat propagates was alpha. So I'll use that in the mathematical Okay, here it is the gigantic function that we derived is going to work I typed it all in I've used the same symbols that we used in our derivation So up there. We're just defining the function The only thing is it doesn't go out to infinity. It goes out to maximum term 59 that I just arbitrarily chose Just a big long Fourier series And then I made up some numbers. I said the higher temperature is 300 degrees. The lower temperature is 200 degrees The width of our sheet is one one unit You can imagine that to be one centimeter if you like and then I typed in a number for our that our thermal diffusion So that's everything we need to actually plot it I'm going to plot it from zero out to just slightly higher than the High temperature and what we should see when I put in That the time is zero is we should see that we are able to get our initial condition And there we are that looks pretty good Remember that We're targeting 300 degrees. Yeah, that looks right And we see that at x is equal to zero it jumps abruptly down It passes through 200 degrees, which is indeed what it should be at exactly x is equal to zero And then it heads on further down, but that's fine because it does that for negative x where our function isn't defined Mm-hmm. That looks good. It's got all the properties we want So now we can indeed allow a little bit of time to go past and see what How the thing evolves. Let's try a tiny bit of time. See if that does anything at all all right, so A bit like in the example we saw before Let's actually have mainly had the effect of getting rid of those annoying Gibbs phenomenon style ripples That's a very small amount of time that has passed Still we can see what's happening, which is that we're rounding off that sharp transition. Let's go for 10 times longer And now sure we see that Inside most of the width of our sheet. We indeed have still the high temperature. It's definitely now There's there's a significant loss of heat energy into the cold reservoir. Let's increase it some more to five And now, you know, so that's just more of the same. Let's go up to 10 more the same let's go up to half a time, you know, half a second Now Mathematica is having to deal with some very small quantities. I have Googled how to make it that not do that If I can spell the word quiet Which there we go that should generate it without that. Yeah, so There we are. That's now a large amount of time in that Um, the temperature has started to change throughout Pretty much the entire width. Let's let's go even higher to let's say two time units. He is two And now it's getting very close to our long-term solution Our steady state and if we go out to five we'll pretty much have got it So now it's just a straight line that goes from the cold temperature to the hot So that all works excellent. We solved really quite a complicated problem Including uh, reservoirs and a non-trivial steady-state distribution And we're able now to to understand exactly how that happens And that might be important in some kind of modeling problem because we may have a situation where components are heating and cooling And there might be a maximum rate of heating and cooling that a particular part of the component can tolerate And we need to be able to model it so we can see that we now have that ability Let's go back to the notes Okay, so our gigantic function we derived for this Reservoir problem has worked. We verified it in Mathematica It has all the properties we want it matches all the limits. It is the solution And so we've in this lecture been able to look at two problems Uh three if you count the fact that the first one could be thought of either as a gas pipeline or a stack of materials um That have shown us how we can use the fact that We could have solved our diff fusion equation for with a particular case of a product of a Time and space function and the space part was a cos or a sign Suddenly because of Fourier series that allowed us to have enormous power to define any kind really of initial condition We wanted Not quite any kind the one thing we haven't thought about Is what if our initial condition is not periodic and is not between two finite points? So we can't make it periodic What if our initial condition is a function defined everywhere and we would like to see how that evolves forward in time? Well in that case we would need to use the Fourier transform That's that's the right bit of kit for that job. But to see a nice example of that I think we can leave that until the next lecture That's enough for now. So um, I hope that that has persuaded you that The Fourier series technique gives us the power to tackle some pretty meaty problems And that's going to keep on being the case as we finish talking about diffusion And move into waves and think about things like A vibrating guitar string, but that's for the future. Thanks for listening