I've been reading from a book to implement a similar simulation and was still very confused however your explanation of the stability criteria was flawless and has answered three questions in one go. Thank you very much for uploading.
Great video with clear explanation! Regarding the slide "Fixing the finite-Difference Equation (1 of 2)", I think the equation in the first solution should be interpreted as forward FD instead of backward FD. For the FD approximation at present time t, the forward difference scheme involves derivatives at future time t + delta t and present time t.
By linear algebra, I am talking about matrices, matrix multiplication and division, eigen-value problems, etc. FDTD can just use big for loops that loop through every point on the grid to update their values, and then do that over and over again. Most say FDTD scales linearly, meaning if you double the size of the problem you only double the number of computations. That is not completely true. It is true that for one iteration you double the number of computations, but you will also have to double the number of iteration because waves are travelling twice as far and you need to run the simulation for longer.
If you enjoy time-domain, there is a whole class on that method for electromagnetics. empossible.net/academics/emp5304/ If you are a complete beginner and willing to pay some money, there is an online class that is great if you are just starting out. empossible.thinkific.com/courses/1D-FDTD
Hello, it was a great video! I have only a question. When trying to obtain the thermal diffusivity using the given function, I got values higher than 1 which I believe are not very realistic. I'm using values in meters for a bar of 0.10 m and a dx = 0.005 m. Any ideas on what I'm doing wrong? Or is the formula limited to certain conditions?
A good video, but I believe the utilized heat equation requires that the thermal conductivity is constant throughout the rod. This does not seem to be noted in the discussion.
That was likely what was done in your college class to make it solvable by hand. However, when solved numerically, the properties of the rod may be inhomogeneous.
@@empossible1577 I think there was a miscommunication here. I was talking about how the 1D heat equation is written: ut=1/cp d/dx (k ux) where c is the specific heat capacity, p the density, and k the thermal conductivity. ut and ux are the partial derivatives wrt time and position. This is what I meant by requiring that the thermal conductivity is constant. Otherwise it cannot be pulled out of the derivative.
Hi CEM team! following this (and other) UA-cam videos I have extended the FDM Heat transfer approximation to calculate the temperature profile in a multilayer wall with T boundary conditions on the left (-5ºC) and right (20ºC) ends. I have set three layers of the same thickness and initial T=-5ºC, with very different thermal diffusivities which makes them update their temperature profile at very different rates, as expected. HOWEVER in the final steady state, the FDM approximation seems to converge to a completely straight temperature profile accross the multilayer wall, no matter the different alpha parameters. Please look at the animation here: guillermoluijk.com/misc/heat_transfer_multi.gif The code cannot be simpler, the FDM update equation is done using R vector capabilities so the implementation is very visual and straightforward: T[indices]=T[indices] + val[indices]*(T[indices+1] - 2*T[indices] + T[indices-1]) Is it correct to obtain such a flat profile accross the multilayer all or I'm missing something? Best regards and thanks for your educative videos. Complete R code: # Heat Transfer Equation (FDM approximation) n=24 # number of cells N=90000 # number of iterations L=0.1 # 0.1 m wall thickness dx=L/n # 0.01 m dt=0.05 # 0.1 s alpha0=0.0001 # m2/s alpha1=0.000001 # m2/s alpha2=0.00001 # m2/s T0=-5 # initial T in the wall Tleft=-5 # left end boundary T Tright=20 # right end boundary T T=matrix(T0, nrow=1, ncol=n) T[1]=Tleft T[n]=Tright indices=which(col(T)!=1 & col(T)!=n) # array positions excluding both ends x=seq(from=dx/2, to=L-dx/2, length.out=n) # position array SPLIT1=9 # layer1|layer2 boundary SPLIT2=17 # layer2|layer3 boundary alpha=matrix(alpha0, nrow=1, ncol=n) alpha[SPLIT1:SPLIT2]=alpha1 alpha[SPLIT2:n]=alpha2 val=alpha*dt/dx^2 for (j in 0:N) { plot(x, T, type='l', col='red', lwd=2, xlim=c(0,L), ylim=c(min(Tleft,Tright), max(Tleft,Tright)), ylab='T (ºC)', main=paste0('Iteration: ', j, '/',N, ', t=', round(j*dt), 's')) # Iterate T in vector notation T[indices]=T[indices]+ val[indices]*(T[indices+1] - 2*T[indices] + T[indices-1]) # delta T }
Unfortunately, I am not a thermal expert, but in my limited experience a linear temperature profile at the end is the correct answer. The thermal coefficient really only affects the manner in which the temperature profile evolves into the linear profile.
@@empossible1577 Thanks for your response. I found the solution: the basic equation is only valid for a single layer surrounded by boundary conditions, it is unable to generate a discontinuity in the first derivative. For multilayer heat transfer a bit more elaborated equation is needed (averaging the conductivity in the border): guillermoluijk.com/misc/ecuaciones_singlemultilayer.png With that equation the multilayer problem is solved!: guillermoluijk.com/misc/heat_transfer_multi.gif
I saw you provided an updated function for multi-layer FDTD Heat transfer, would you be willing to share your reference for that or a link to your own works if publicly available. I have been looking into having heat transfer through multiple solids in contact with one another however understood it was more involved than changing the thermal diffusivity specially. I would expect it means for stability you assume the least favorable diffusivity value and allow it to dictate spacial_step/time_step. I have seen a similar equation for non-linear heat conduction which would allow a gradual build up to a different material property as opposed to a very sudden material boundary change. If you could point me in the right direction I would really appreciate it thanks
I've been reading from a book to implement a similar simulation and was
still very confused
however your explanation of the stability criteria was flawless and has
answered three questions in one go. Thank you very much for uploading.
Great to hear! Thank you!
Great video with clear explanation! Regarding the slide "Fixing the finite-Difference Equation (1 of 2)", I think the equation in the first solution should be interpreted as forward FD instead of backward FD. For the FD approximation at present time t, the forward difference scheme involves derivatives at future time t + delta t and present time t.
LOL. How crazy is this? I did get it backwards. Thank you!
@@empossible1577 It is indeed confusing!
Great video. Can you pls comment on two things. What do you mean by FDTD may not use a linear algebra and why do non T domain scales exponentially?
By linear algebra, I am talking about matrices, matrix multiplication and division, eigen-value problems, etc. FDTD can just use big for loops that loop through every point on the grid to update their values, and then do that over and over again.
Most say FDTD scales linearly, meaning if you double the size of the problem you only double the number of computations. That is not completely true. It is true that for one iteration you double the number of computations, but you will also have to double the number of iteration because waves are travelling twice as far and you need to run the simulation for longer.
This is really helpful. Can't wait to start doing simulation.
If you enjoy time-domain, there is a whole class on that method for electromagnetics.
empossible.net/academics/emp5304/
If you are a complete beginner and willing to pay some money, there is an online class that is great if you are just starting out.
empossible.thinkific.com/courses/1D-FDTD
Fantastic video!
This really informative. I was just doing the simulation based on this
Awesome!
Hello, it was a great video! I have only a question. When trying to obtain the thermal diffusivity using the given function, I got values higher than 1 which I believe are not very realistic. I'm using values in meters for a bar of 0.10 m and a dx = 0.005 m. Any ideas on what I'm doing wrong? Or is the formula limited to certain conditions?
thanks for the amazing course.
I am glad the videos are helping you! Here is a link to the official course website:
empossible.net/academics/emp4301_5301/
A good video, but I believe the utilized heat equation requires that the thermal conductivity is constant throughout the rod. This does not seem to be noted in the discussion.
That was likely what was done in your college class to make it solvable by hand. However, when solved numerically, the properties of the rod may be inhomogeneous.
@@empossible1577 I think there was a miscommunication here. I was talking about how the 1D heat equation is written:
ut=1/cp d/dx (k ux)
where c is the specific heat capacity, p the density, and k the thermal conductivity. ut and ux are the partial derivatives wrt time and position.
This is what I meant by requiring that the thermal conductivity is constant. Otherwise it cannot be pulled out of the derivative.
@@NGHutchin Let me do some homework on this. Thank you for pointing this out. If I have made a mistake, I will correct it as soon as I can.
Hi CEM team! following this (and other) UA-cam videos I have extended the FDM Heat transfer approximation to calculate the temperature profile in a multilayer wall with T boundary conditions on the left (-5ºC) and right (20ºC) ends.
I have set three layers of the same thickness and initial T=-5ºC, with very different thermal diffusivities which makes them update their temperature profile at very different rates, as expected.
HOWEVER in the final steady state, the FDM approximation seems to converge to a completely straight temperature profile accross the multilayer wall, no matter the different alpha parameters. Please look at the animation here:
guillermoluijk.com/misc/heat_transfer_multi.gif
The code cannot be simpler, the FDM update equation is done using R vector capabilities so the implementation is very visual and straightforward:
T[indices]=T[indices] + val[indices]*(T[indices+1] - 2*T[indices] + T[indices-1])
Is it correct to obtain such a flat profile accross the multilayer all or I'm missing something?
Best regards and thanks for your educative videos.
Complete R code:
# Heat Transfer Equation (FDM approximation)
n=24 # number of cells
N=90000 # number of iterations
L=0.1 # 0.1 m wall thickness
dx=L/n # 0.01 m
dt=0.05 # 0.1 s
alpha0=0.0001 # m2/s
alpha1=0.000001 # m2/s
alpha2=0.00001 # m2/s
T0=-5 # initial T in the wall
Tleft=-5 # left end boundary T
Tright=20 # right end boundary T
T=matrix(T0, nrow=1, ncol=n)
T[1]=Tleft
T[n]=Tright
indices=which(col(T)!=1 & col(T)!=n) # array positions excluding both ends
x=seq(from=dx/2, to=L-dx/2, length.out=n) # position array
SPLIT1=9 # layer1|layer2 boundary
SPLIT2=17 # layer2|layer3 boundary
alpha=matrix(alpha0, nrow=1, ncol=n)
alpha[SPLIT1:SPLIT2]=alpha1
alpha[SPLIT2:n]=alpha2
val=alpha*dt/dx^2
for (j in 0:N) {
plot(x, T, type='l', col='red', lwd=2,
xlim=c(0,L), ylim=c(min(Tleft,Tright), max(Tleft,Tright)),
ylab='T (ºC)',
main=paste0('Iteration: ', j, '/',N, ', t=', round(j*dt), 's'))
# Iterate T in vector notation
T[indices]=T[indices]+
val[indices]*(T[indices+1] - 2*T[indices] + T[indices-1]) # delta T
}
Unfortunately, I am not a thermal expert, but in my limited experience a linear temperature profile at the end is the correct answer. The thermal coefficient really only affects the manner in which the temperature profile evolves into the linear profile.
@@empossible1577 Thanks for your response. I found the solution: the basic equation is only valid for a single layer surrounded by boundary conditions, it is unable to generate a discontinuity in the first derivative. For multilayer heat transfer a bit more elaborated equation is needed (averaging the conductivity in the border):
guillermoluijk.com/misc/ecuaciones_singlemultilayer.png
With that equation the multilayer problem is solved!:
guillermoluijk.com/misc/heat_transfer_multi.gif
@@gluijk Thank you!
I saw you provided an updated function for multi-layer FDTD Heat transfer, would you be willing to share your reference for that or a link to your own works if publicly available. I have been looking into having heat transfer through multiple solids in contact with one another however understood it was more involved than changing the thermal diffusivity specially. I would expect it means for stability you assume the least favorable diffusivity value and allow it to dictate spacial_step/time_step. I have seen a similar equation for non-linear heat conduction which would allow a gradual build up to a different material property as opposed to a very sudden material boundary change. If you could point me in the right direction I would really appreciate it thanks