No video

Solving The 1D & 2D Heat Equation Numerically in Python || FDM Simulation - Python Tutorial #4

  Рет қаралды 22,902

Younes Lab

Younes Lab

Күн бұрын

Пікірлер: 30
@nonato7853
@nonato7853 8 ай бұрын
Incrível, mano! Recentemente fiz um trabalho sobre a equação de calor e seu vídeo me deu uma nova perspectiva do que eu havia feito. Parabéns!
@saamirjassim2108
@saamirjassim2108 8 ай бұрын
Stability of solution also accuracy comparing with another solutions .. Thanks alot .
@YounesLab
@YounesLab 7 ай бұрын
This might be the subject of the next video, Thank you for you suggestion!
@vikonja121
@vikonja121 8 ай бұрын
As straightforward as this solution is, I believe it needs to be mentioned: this approach is extremely inefficient. It has time complexity O(N^2), which renders the method practically useless when applied to models/systems with a large number of cells (which ultimately is what one will have when doing serious work). A much more efficient code can be made by adjusting to use scipy's sparse module and solvers for sparce matrices. A good video nonetheless, if you want to get a preview of how the finite-difference method works ;) just mentioning a relevant computational aspect
@jawadmansoor2456
@jawadmansoor2456 7 ай бұрын
Using a pre built library/code will render a math video useless. I, like many others, have come here to learn math not a fancy python library. Good work younes!
@vikonja121
@vikonja121 7 ай бұрын
No need for the cheeky answer, I was just trying to mention the info for people who are more interested in the performance aspect and are maybe looking for such implementations. @@jawadmansoor2456
@ssrini2002
@ssrini2002 5 ай бұрын
Could you recommend a video that uses that library please?
@vikonja121
@vikonja121 4 ай бұрын
@@ssrini2002 I couldn't find any videos actually, there are a couple of websites with code examples, just google "python diffusion sparse matrix" and you'll find them quickly. Although, seeing as there's no videos about this, I might make one myself :)
@YounesLab
@YounesLab 4 ай бұрын
Thank you for your comment @vikinja121 and for the clarification
@v4dl45
@v4dl45 9 ай бұрын
Awesome tutorial! I recommend you use libraries like manim for 3d visualizations as well!
@omaramdyaze
@omaramdyaze 9 ай бұрын
keep going bro , we need more solving physics problem using python , I hope if you have a vid about heat diffusion resolution for rectangular section fins and temperature profiles and thanks in advance bro
@YounesLab
@YounesLab 9 ай бұрын
I will be sure to make these in the future, thank you for your feedback!
@charlesaugustosantosdocarm4121
@charlesaugustosantosdocarm4121 Ай бұрын
Wonderful! Tank you!
@EdwardHe-jr9vg
@EdwardHe-jr9vg 2 ай бұрын
Hi! It's very awesome video and very straight forward! A quick question, do you know if there's any chance to speed up the process with cuda?
@YounesLab
@YounesLab Ай бұрын
Thank you for your feedback ^^ Personally I am not that familiar with cuda (though this surely is motivating me to make a video about it 🤔) However there are several techniques you can use drastically improuve the speed (method I discoreved after making the video) * writing the main calculations as a function, then using numba's jit to optimize the computation (by chacing it, ...) * Important note: since the result of each iteration is more or less dependent on the one before, parallezing will most likely not work, however one trick you can use is to vectorize the code by, instead of writing it in form of a loop, you replace it by some sort of linear system of equations A*T = b, which will be way faster since it uses linear algebra to find the solution (using numpy)
@oskarmakala
@oskarmakala 3 ай бұрын
Could anyone explain why is it necessary to use a copy of array u in the scheme equation? I know that it gives slightly different results if we just rewrite u array in each loop, thanks
@YounesLab
@YounesLab 3 ай бұрын
Hello! We use a separate copy of the array `u` because it represents the temperature distribution at a specific time, `t`. When we discretize our equation in time and space, we get: u[t+1, i] = (dt * a / dx^2) * (u[t, i-1] - 2 * u[t, i] + u[t, i+1]) + u[t, i] In this equation, `u[t, ...]` represents the temperature distribution at time `t`. By updating `u` using a while loop, we ensure that the computation of the distribution at all nodes is accurate for time `t`. If we don't use a copy of `u`, we end up computing the solution at `t+1` using a mixture of data from both `t` and `t+1`. For example, without a copy, `u` is updated dynamically, and when computing each node [i], the left node [i-1] is used from time `t+1` while the right node [i+1] is still from time `t`. This leads to: u[t+1, i] = (dt * a / dx^2) * (u[t+1, i-1] - 2 * u[t, i] + u[t, i+1]) + u[t, i] This does not conform to the established numerical scheme. I hope this clarifies why it's necessary to use a copy of the array `u` in the scheme equation. Let me know if you have any other questions! :)
@RameezRaja-qc9fi
@RameezRaja-qc9fi 9 ай бұрын
Please make more videos of coding on heat transfer and fluid mechanics. Thank you very much!
@feweir
@feweir Ай бұрын
where do you take all formulas, for example that for get dd_ux and dd_uy ^
@YounesLab
@YounesLab Ай бұрын
The formulas represent an approximation of derivative via a method called "the finite difference method" often called FDM, this method represent a simple but powerfull technique for solving differential equation related problems (especially flow/heat problems) If you want to learn more about it I suggest you to watch another video I made (part 1) kzfaq.info/get/bejne/kNuodL2pzNvaXWQ.html
@madly1nl0v3
@madly1nl0v3 11 ай бұрын
Thank you for this tutorial. Please show me how to plot 3D graph of Riemann Zeta function where we can see the pole at s = 1 + j0, and trivial as well as nontrivial zeroes; the vertical axis shows the magnitude of the output and the color codes the phase angle. Thank you very much beforehand.
@YounesLab
@YounesLab 11 ай бұрын
Thank you for your Comment. Very Interesting function and Idea, I will look forward into making it.
@nick45be
@nick45be 6 ай бұрын
in line 52 (5:49) it says "IndentationError: unexpected indent" after having copied and pasted the code from your github
@YounesLab
@YounesLab 6 ай бұрын
If you are getting an "IndentationError: unexpected indent" this means there is a problem with the indentation (tabbing) of the line, make sure to delete the tabs and manually re do it.
@hakankosebas2085
@hakankosebas2085 2 ай бұрын
could you do code of "Tutorial: How to simulate the wave equation" video by Nils Berglung
@YounesLab
@YounesLab Ай бұрын
Great suggestion thank you ^^' ! I will plan on doing this video about the wave equation it will be an interessting subject (in a couple of weeks)
@hakankosebas2085
@hakankosebas2085 Ай бұрын
@@YounesLab thanks
@johnkevinpadro7819
@johnkevinpadro7819 7 ай бұрын
What software do you use @Younes
@YounesLab
@YounesLab 7 ай бұрын
If you mean for making the simulation i only used Visual Studio Code (for python IDLE)
@KrishnaGupta-pn8ee
@KrishnaGupta-pn8ee 9 ай бұрын
Bro kindly make more videos in hindi
Monte Carlo Simulation in Python in Python || Approximating π !
21:55
How to Solve Differential Equations in PYTHON
23:37
Mr. P Solver
Рет қаралды 101 М.
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 32 МЛН
Prank vs Prank #shorts
00:28
Mr DegrEE
Рет қаралды 10 МЛН
17 - How to write an Eulerian fluid simulator with 200 lines of code.
12:05
Ten Minute Physics
Рет қаралды 293 М.
Easy PINNS with DeepXDE: HEAT Simulation with Deep Neural Networks
11:24
Coding Adventure: Simulating Fluids
47:52
Sebastian Lague
Рет қаралды 1,8 МЛН
Solve the heat equation PDE using the Implicit method in Python
24:11
Shameel Abdulla
Рет қаралды 24 М.
Python - Heat Conduction 1D - Tutorial #1
21:03
pythonforengineers
Рет қаралды 31 М.
Finite Differences
8:35
Numerical Analysis by Julian Roth
Рет қаралды 63 М.
Finite Element Method in FEniCS: 1D Transient Heat Diffusion in detail
53:06
Machine Learning & Simulation
Рет қаралды 10 М.
A Simple Solution for Really Hard Problems: Monte Carlo Simulation
5:58