I think there is a slight mistake in the theory part.. Pardon me if its not. If the diffusion coefficient D, is considered D= gamma then the equation matches with the one done in matlab but if D= (gamma/h) is considered, there seems to be error which comes out during the upwind scheme calculation.
Hi Tanmay, thank you for the vedios. I have benefited from your lecture. Please, can you give us an example of solving 2D unsteady convection diffusion problem with Matlab?
Hello Mr. Tanmay! Thank you for the explanation, I am currently working on a heat exchanger problem that uses 2 dimension convection-diffusion. I notice from your video that you already input the boundary condition of the first and final properties. In my case, I want to see the cooling capacity of my heat exchanger so I want to find the final properties (in my case temperature) of the system. Can I use the central differencing method for that or do I need to use another method? Thank you!
Dear Tanmay, I am amazed this your tutorial video. However, could you also explain how to discretize the 2D r-z Steady State "Axis Symmetry" Diffusion and Convection case by FVM? That would be greatly appreciated. Best regards, Yu-Chi
Hello Tanmay, First of all, thank you for doing this lecture series. 06:33 you have mentioned that there is a reason for defining Peclet no. based on grid spacing('h')...could you please explain why? ...Did I miss somewhere if you have explained it later?
Hi, thank you for the information! Right now I am trying to simulate the carbonation in concrete column, but I don't have any clue how to set the boundary condition
Hello Tanmay! Really good lectures! :D I have a doubt regarding the coding. I seem to getting different trends for both Central Differencing and Upwind schemes. I have attached the code used. Kindly have a look into it. %% Defining the problem domain n_points=101; dom_length=1; h=dom_length/(n_points-1); x=0:h:dom_length; y=0:h:dom_length; %% Initialising the problem T(1,1:n_points)=1; T(1:n_points,1)=1; T_new(1,1:n_points)=1; T_new(1:n_points,1)=1; rho=1; u=1; v=1; gamma=0.01; Pe=rho*u*h/gamma % %% Upwind Scheme error=1; iterations=0; while error>1e-7 for i=2:n_points-1 for j=2:n_points-1 a_E=gamma; a_W=gamma + rho*u*h; a_N=gamma; a_S=gamma + rho*v*h; a_P= rho*u*h + rho*v*h + gamma + gamma + gamma + gamma; T_new(i,j)=(a_E*T(i+1,j)+a_W*T(i-1,j)+a_N*T(i,j-1)+a_S*T(i,j+1))/a_P; end iterations=iterations+1; error=0; for i=2:n_points-1 for j=2:n_points-1 error=error+abs(T(i,j)-T_new(i,j)); end end T=T_new; end end %% Plotting x_dom=((1:n_points)-1).*h; y_dom=1-((1:n_points)-1).*h; [X,Y]=meshgrid(x_dom,y_dom); contourf(X,Y,T,50); colorbar %% Centerline temperature figure; plot(1-y,T(:,(n_points+1)/2), '--o')
Hi sir While solving the convection diffusion equation, what should we initialize the 2nd value with? From my understanding quick scheme requires 2 terms before and 1 next term, we need to initialize the 2nd term too and then iterate from 3rd right Could you help me with this?
Hi Tanmay, thank you for your video.It's very helpful for me! I have a question:why a_E=gamma-rho*u*h/2 without delta x? In the previous video, you said D=gamma/delta x?
I have a doubt about indexing according to matlab 9:14 it will be (i, j+1) and 9:17 (I,j-1) { i th row and j+1 and j-1 column} and south as (i+1,j) north as (i-1,j) is the above thing correct
Correct. Indexing in MATLAB and Cartesian system are not consistent. Therefore, the notes contain a slightly different indexing as that of code, apologies for that.
Hello sir, I am trying to solve a 1D transient heat conduction problem with convection boundary conditions but I am unable to obtain the temperature profile as there is error in the looping of the temperatures. Request you to kindly provide some guidance in this regards and help me with the matlab code for this particular problem
Sir I am facing a problem with Quick scheme. In this scheme we need to insert the i-2 th term(NN for face n when v0) which is causing problem in computation as the compuation is done for i=2:n-1 . Can you suggest me how to rectify the problem?
hello dear friend i need upwind - lax wendroff and mac cormack matlab code for 2d advection equation,. how can i get that? and boundry condition is not important plz help me
@@TanmayAgrawal7 Nonstandard Finite Difference Schemes given by Ronald E. Mickens Definition. A nonstandard finite difference scheme is any discrete representation of a system of differential equations that is constructed based on the below rules. Rule 1. The orders of the discrete derivatives should be equal to the orders of the corresponding derivatives appearing in the differential equations. Rule 2. Discrete representations for derivatives must, in general, have nontrivial denominator functions. Rule 3. Nonlinear terms should, in general, be replaced by nonlocal discrete represent. Rule 4. Special conditions that hold for either the differential equation and/or its solutions should also hold for the difference equation model and/or its solutions.
I'm not aware of these, but if they are applicable to CFD problems and satisfies basic principles e.g. conservativeness, they should be valid. You can try, is what I can recommend.
@@TanmayAgrawal7 Thanks for the reply. Yes, the meshgrid command is okay. In fact everything works fine when I set my domain as a unit length in both x and y directions and discretize it in equal number of points in both directions (just like the way u hv shown). Great video series bdw. But the problem comes when I try to discetize the domain with different number of nodes in x and y directions. e.g instead of 51×51 nodes... Say I want the same domain to be 51×101 nodes. Then it's not working. It says : "Error using contourf: The size of X must match the size of z or the number of columns of z".....
T_new(i,j)=(a_E*T(i+1,j)+a_W*T(i-1,j)+a_N*T(i,j-1)+a_S*T(i,j+1))/a_p; you have taken a_N*T(i,j-1) but it should be (i,j+1) and in south a_S*T(i,j-1). i have big confusion on this please reply
In fact, Tanmay writes this way because MATLAB considers as positivethe downward direction. You are correct, but, in MATLAB, the matrix index starts at (1,1) and goes positive in the 'x' to right and in the 'y' to downward, so , it is better to follow this shape.
Dear Sir! I hope that you are doing well. I am doing simulation of polymer heating i injection moulding machine. I have a problem in the simulation. When I keep velocity positive, the simulation is perfect but if i keep it negative, the simulation is very strange. I am using forward difference method. Can I have a meeting with you some time?. I would be grateful. Thanks and Regards Sincerely Abid Shah
Hello Tanmay, Thank you for your videos and they are very helpful:) But Now I also have some questions..Can I have your email? I want to send the questions with pictures so that I can better explain the questions and you can better understand. Thank you again! Kind regards, Shangya
I think there is a slight mistake in the theory part.. Pardon me if its not. If the diffusion coefficient D, is considered D= gamma then the equation matches with the one done in matlab but if D= (gamma/h) is considered, there seems to be error which comes out during the upwind scheme calculation.
Thanks for your explanation, it's very understandable and helpful. if you can continue uploading new videos, it will be good news
Hi Tanmay, thank you for the vedios. I have benefited from your lecture. Please, can you give us an example of solving 2D unsteady convection diffusion problem with Matlab?
Hi Tanmay, do you have any videos on using a hybrid differencing scheme?
Hello Mr. Tanmay!
Thank you for the explanation, I am currently working on a heat exchanger problem that uses 2 dimension convection-diffusion. I notice from your video that you already input the boundary condition of the first and final properties.
In my case, I want to see the cooling capacity of my heat exchanger so I want to find the final properties (in my case temperature) of the system. Can I use the central differencing method for that or do I need to use another method?
Thank you!
Dear Tanmay,
I am amazed this your tutorial video. However, could you also explain how to discretize the 2D r-z Steady State "Axis Symmetry" Diffusion and Convection case by FVM?
That would be greatly appreciated.
Best regards,
Yu-Chi
Hello Tanmay,
First of all, thank you for doing this lecture series.
06:33 you have mentioned that there is a reason for defining Peclet no. based on grid spacing('h')...could you please explain why? ...Did I miss somewhere if you have explained it later?
12:40
@@fawazbukhtmajmader4860 but there he is just changing the value of gamma and not the grid spacing!
Hi, thank you for the information!
Right now I am trying to simulate the carbonation in concrete column, but I don't have any clue how to set the boundary condition
What does the physical process demands?
also are we taking the assumption that ue=uw and vn=vs. because when we calculate the a_p the coefficient get cancelled out
Hello Tanmay!
Really good lectures! :D
I have a doubt regarding the coding. I seem to getting different trends for both Central Differencing and Upwind schemes. I have attached the code used. Kindly have a look into it.
%% Defining the problem domain
n_points=101;
dom_length=1;
h=dom_length/(n_points-1);
x=0:h:dom_length;
y=0:h:dom_length;
%% Initialising the problem
T(1,1:n_points)=1;
T(1:n_points,1)=1;
T_new(1,1:n_points)=1;
T_new(1:n_points,1)=1;
rho=1;
u=1;
v=1;
gamma=0.01;
Pe=rho*u*h/gamma %
%% Upwind Scheme
error=1;
iterations=0;
while error>1e-7
for i=2:n_points-1
for j=2:n_points-1
a_E=gamma;
a_W=gamma + rho*u*h;
a_N=gamma;
a_S=gamma + rho*v*h;
a_P= rho*u*h + rho*v*h + gamma + gamma + gamma + gamma;
T_new(i,j)=(a_E*T(i+1,j)+a_W*T(i-1,j)+a_N*T(i,j-1)+a_S*T(i,j+1))/a_P;
end
iterations=iterations+1;
error=0;
for i=2:n_points-1
for j=2:n_points-1
error=error+abs(T(i,j)-T_new(i,j));
end
end
T=T_new;
end
end
%% Plotting
x_dom=((1:n_points)-1).*h;
y_dom=1-((1:n_points)-1).*h;
[X,Y]=meshgrid(x_dom,y_dom);
contourf(X,Y,T,50);
colorbar
%% Centerline temperature
figure;
plot(1-y,T(:,(n_points+1)/2), '--o')
Hi Tanmay. Great speech, thank you !!
Can I have a two-dimensional Quick Scheme code?
Hello, thanks for watching. I don't think I have a 2D QUICK scheme code. But if you are facing bugs, please contact me.
hello can you explain the code for the QUICK scheme, please?
Hi sir
While solving the convection diffusion equation, what should we initialize the 2nd value with? From my understanding quick scheme requires 2 terms before and 1 next term, we need to initialize the 2nd term too and then iterate from 3rd right
Could you help me with this?
Hi Tanmay, thank you for your video.It's very helpful for me! I have a question:why a_E=gamma-rho*u*h/2 without delta x? In the previous video, you said D=gamma/delta x?
I have the same question.
I have a doubt about indexing according to matlab
9:14 it will be (i, j+1) and 9:17 (I,j-1) { i th row and j+1 and j-1 column} and
south as (i+1,j)
north as (i-1,j)
is the above thing correct
Correct. Indexing in MATLAB and Cartesian system are not consistent. Therefore, the notes contain a slightly different indexing as that of code, apologies for that.
please can you prepare a code on shooting method both linear and non linear together with rk4
which parameter of the code is the thermal conductivity ?
Hello sir, I am trying to solve a 1D transient heat conduction problem with convection boundary conditions but I am unable to obtain the temperature profile as there is error in the looping of the temperatures. Request you to kindly provide some guidance in this regards and help me with the matlab code for this particular problem
Sir I am facing a problem with Quick scheme. In this scheme we need to insert the i-2 th term(NN for face n when v0) which is causing problem in computation as the compuation is done for i=2:n-1 . Can you suggest me how to rectify the problem?
Glad that you worked it out.
hello dear friend
i need upwind - lax wendroff and mac cormack matlab code for 2d advection equation,. how can i get that? and boundry condition is not important plz help me
I have a doubt related to the central differencing scheme. Can you pls share your number so that I can ask?
in the while loop, we should write gamma/h while calculating a_E, a_W, a_N, a_S and a_P am I right or missed something about theory ?
Instead of divide 'gamma' for 'h', Tamnay multiplies this 'h' into 'rho*u ' , resulting in: 'gamma + rho*u*h ' == 'gamma/h + rho*u'
Can we solve this 2D Convection Diffusion by Non Standard finite difference method using Matlab
Non standard such as?
@@TanmayAgrawal7 Nonstandard Finite Difference Schemes
given by Ronald E. Mickens
Definition. A nonstandard finite difference scheme is any discrete representation of a system of differential equations that is constructed based on the
below rules.
Rule 1. The orders of the discrete derivatives should be equal to the orders
of the corresponding derivatives appearing in the differential equations.
Rule 2. Discrete representations for derivatives must, in general, have nontrivial denominator functions.
Rule 3. Nonlinear terms should, in general, be replaced by nonlocal discrete represent.
Rule 4. Special conditions that hold for either the differential equation
and/or its solutions should also hold for the difference equation model
and/or its solutions.
I'm not aware of these, but if they are applicable to CFD problems and satisfies basic principles e.g. conservativeness, they should be valid. You can try, is what I can recommend.
The contourf command works very well for a square domain(n_points = m_points) but what can I use for a rectangular domain plot in MATLAB? Please help.
It should be for a rectangular grid as well. Can you please let me know what's going wrong? Is your meshgrid command correctly executed?
@@TanmayAgrawal7
Thanks for the reply.
Yes, the meshgrid command is okay. In fact everything works fine when I set my domain as a unit length in both x and y directions and discretize it in equal number of points in both directions (just like the way u hv shown). Great video series bdw.
But the problem comes when I try to discetize the domain with different number of nodes in x and y directions.
e.g instead of 51×51 nodes... Say I want the same domain to be 51×101 nodes. Then it's not working. It says :
"Error using contourf:
The size of X must match the size of z or the number of columns of z".....
Can you email your code to tanmayagrawal7@gmail.com?
@@TanmayAgrawal7 Done.
T_new(i,j)=(a_E*T(i+1,j)+a_W*T(i-1,j)+a_N*T(i,j-1)+a_S*T(i,j+1))/a_p;
you have taken a_N*T(i,j-1) but it should be (i,j+1) and in south a_S*T(i,j-1).
i have big confusion on this please reply
In fact, Tanmay writes this way because MATLAB considers as positivethe downward direction. You are correct, but, in MATLAB, the matrix index starts at (1,1) and goes positive in the 'x' to right and in the 'y' to downward, so , it is better to follow this shape.
Dear Sir!
I hope that you are doing well.
I am doing simulation of polymer heating i injection moulding machine.
I have a problem in the simulation. When I keep velocity positive, the simulation is perfect but if i keep it negative, the simulation is very strange. I am using forward difference method.
Can I have a meeting with you some time?. I would be grateful.
Thanks and Regards
Sincerely
Abid Shah
Hello Tanmay,
Thank you for your videos and they are very helpful:)
But Now I also have some questions..Can I have your email? I want to send the questions with pictures so that I can better explain the questions and you can better understand. Thank you again!
Kind regards,
Shangya
Please email me on tanmayagrawal7@gmail.com
thank you Tanmay Agrawal, can you send this code matlab by gmail .??
drive.google.com/folderview?id=1Hhoh8U2CsbPa4bTT8Vnlg3dM5G6KnUZ3
You can access it here.
@@TanmayAgrawal7 Thank you very much