Hello, Thank you for the video. Could you please tell how you write text, formulas and graph in notebook at the begining of the video or make tutorial how to do it?
Is it possible to share your code, mine stuck at some places, also implicit and Crank Nicolson are same but you made separate videos of it? Can you please differentiate between explicit, implicit and Crank Nicolson methods?
Hello. I have asked the same fella a question with no response till today. What if the initial condition is different value as boundary condition. Take for example your initial condition function to be np.cos(pi*x), which gives 1 at 0. what would we take in solving?
Then your boundary condition should be 1 at t=0 as well for the problem to be properly defined. The example I show here is for a simple case of constant boundary condition (infinite source or sink). This is called essential boundary conditions. You could also have natural boundary condition such as an end node with convective heat loss.
hi i tried to adapt it in order to solve my own problem, the thing is everything goes right when i have a curve made out of 5 points, but when i change the h step, it starts diverging, cansomeone help me pls? if not it's no problem but i just wanted a smoother curve
The ratio of step size in the x direction (h) and in time (k) is important for stability. I didn't mention it clearly in the video. For stability you need to satisfy (1-2*factor)>=0. And the factor is k/h^2. So if you change h, you need to change k to make sure you satisfy the inequality equation mentioned above.
If it is non-homogenous, then the derivation will change. And the additional terms should show up in your index equation T[i,j]. If the boundary conditions are time-dependent, then they must be placed inside the first loop (index j for time) to be recalculated every iteration.
Everything goes wrong when you change boundary condition to non zero value boundary value at left goes replaced by initial condition. Is this right or wrong.
I think your boundary conditions and initial conditions need to be compatible. You can have non-zero boundary conditions at t=0. But then your initial conditions should reflect the same at x=0, and x=L.
Sines are the solution for periodic condition T(0,t)=T(L,t)=0 For non-zero boundary condition that are periodic, your function should be a constant plus a sine function. If you choose T(0,t)=T(L,t)=2 Then your initial function should be 2 + sin(x*pi\L) for example
This usually means you are trying to fit a list of values into a position that only takes one value. Remember that the loop is only calculating one value at a time, and placing it in the T matrix. Debug your code by printing the calculated value. Make sure it is not a list of values.