Hello Tanmay Sir! @ 34:48 As we are integrating over the control volume in finite volume method, shouldn't we write 'dV' instead of 'dx' ? and after integrating 'Area' term would be established ?
Since this is 1D case, dV is equivalent to dx with an overarching assumption of dy and dz being treated as unity. Perhaps, I should have emphasized it during the lecture, thank you!
Nice lecture! Correct me if I am wrong: Advection is technically the heat transfer by motion of fluid while diffusion is because of concentration gradient. The convection is the combination of these two. However, this is not explicitly mentioned in most books.
It's really helpful sir But I have a doubt, why not we are using another for loop for time. How this code giving solution at every time step....? Can you please explain me.?
clear all; close all; clc; %% Defining the mesh n_points = 31; dom_size = 1; h = dom_size/(n_points-1); dt = 0.0001; alpha = dt/(h*h); %% Initialising the problem y(n_points, n_points) = 0; y(1,:) = 1; y_new(n_points, n_points)= 0; y_new(1,:) = 1; error_mag = 1; error_req = 1e-6; iterations = 0; %Tracking the error magnitude error_track = 0; %% Calculations while error_mag > error_req for i = 2:(n_points-1) for j = 2:(n_points-1) y_new(i,j) = y(i,j) + alpha.*(y(i-1,j)+y(i+1,j)+y(i,j-1)+y(i,j+1)-4*y(i,j)); y_transient(iterations+1,1:n_points,1:n_points) = y_new; end end iterations = iterations +1; % Calculation of error magnitude error_mag = 0; for i = 2:(n_points-1) for j = 2:(n_points-1) error_mag = error_mag + abs(y(i,j)-y_new(i,j)); error_track(iterations) = error_mag; end end if rem(iterations, 100) == 0 %나머지연산 mod와 유사하나 mod는 floor(x)함수를 사용해 x보다 작은 정수 중 가장 큰수를 참조하나, rem은 fix(x)함수를 사용하며 x의 절대값보다 작은 정수중 가장 큰수를 참조 iterations %커멘더(명령창)에서 모니터링 할 수 있게 하는 부분이다. 100단위로~ 명령창에서 이터레이션과 에러의 크기를 볼 수 있다. error_mag end % Assigning ne to be old y = y_new; 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,y, 12) colorbar % plot the error with time figure; time = dt.*(1:iterations); plot(time, error_track) %% Concept of subplots figure; subplot(2,1,1) plot(time, error_track) subplot(2,1,2) contourf(X,Y,y,12) colorbar %% Plotting a particular timestep timestep_selected = 100; x_dom = ((1:n_points)-1).*h; y_dom = 1-((1:n_points)-1).*h; [X,Y] = meshgrid(x_dom,y_dom); y_timestep = y_transient(timestep_selected, :, :); y_timestep = reshape(y_timestep, [n_points,n_points]); % y_transient는 3차원이 대응된 값을 y_timestep 2차원으로 축소 contourf(X,Y,y_timestep, 12) colorbar title(['Time = ' num2str(timestep_selected*dt) 's']) %% Animation after every N timesteps N = 100; timestep_array = 1:N:iterations; figure; for i = 1:length(timestep_array) timestep_selected = timestep_array(i); y_timestep = y_transient(timestep_selected, :, :); y_timestep = reshape(y_timestep, [n_points, n_points]); contourf(X,Y,y_timestep, 12) colorbar title(['Time = ' num2str(timestep_selected*dt) 's']) pause(0.25); %애니메이션을 위해 퓨징 end
@@nikitajangid2289 If you are a student, you can contact your institute (library and your teachers) , if they provide free MATLAB license for students, and once u get a account with MATLAB license , you dont even need to download the MATLAB software , u can use MATLAB online in your browser.
your work is helping us so much to do better in MS in fluid dynamic in USA.
Thank you tanmay.
Thanks!
I enjoyed your lecture... The way you explain I like it... Thank you for sharing the knowledge with the scientific community
Hello Tanmay Sir!
@ 34:48
As we are integrating over the control volume in finite volume method, shouldn't we write 'dV' instead of 'dx' ? and after integrating 'Area' term would be established ?
Since this is 1D case, dV is equivalent to dx with an overarching assumption of dy and dz being treated as unity. Perhaps, I should have emphasized it during the lecture, thank you!
thank you for reliable lecture
Great content sir... Waiting for next...
Great video man, can't thank you enough
I submitted this Assignment last week, same concept with different values
Keep up the good work, man. I look forward to your videos
your video is teachable as a usual, 10Q so much. please, could you make a video on "compact FD" method
Thanks for suggestion, I will try to organise some content.
Great job!
Thanks!
may I know how to code the "y_transient" so I can save every time step?
thank you
Nice lecture!
Correct me if I am wrong: Advection is technically the heat transfer by motion of fluid while diffusion is because of concentration gradient. The convection is the combination of these two. However, this is not explicitly mentioned in most books.
Yes, a lot of textbooks, specially on CFD, interchangeably use advection and convection.
Your work is very nice please it is good if you work on fractional order convection-diffusion PDE
Nice explanation
It's really helpful sir
But I have a doubt, why not we are using another for loop for time.
How this code giving solution at every time step....? Can you please explain me.?
Technically, we are not solving unsteady case here if I remember correctly. Iteration here is not equivalent to timestep.
@@TanmayAgrawal7 thanks for clearing my doubt.
sir could you plz share this script
clear all;
close all;
clc;
%% Defining the mesh
n_points = 31;
dom_size = 1;
h = dom_size/(n_points-1);
dt = 0.0001;
alpha = dt/(h*h);
%% Initialising the problem
y(n_points, n_points) = 0;
y(1,:) = 1;
y_new(n_points, n_points)= 0;
y_new(1,:) = 1;
error_mag = 1;
error_req = 1e-6;
iterations = 0;
%Tracking the error magnitude
error_track = 0;
%% Calculations
while error_mag > error_req
for i = 2:(n_points-1)
for j = 2:(n_points-1)
y_new(i,j) = y(i,j) + alpha.*(y(i-1,j)+y(i+1,j)+y(i,j-1)+y(i,j+1)-4*y(i,j));
y_transient(iterations+1,1:n_points,1:n_points) = y_new;
end
end
iterations = iterations +1;
% Calculation of error magnitude
error_mag = 0;
for i = 2:(n_points-1)
for j = 2:(n_points-1)
error_mag = error_mag + abs(y(i,j)-y_new(i,j));
error_track(iterations) = error_mag;
end
end
if rem(iterations, 100) == 0 %나머지연산 mod와 유사하나 mod는 floor(x)함수를 사용해 x보다 작은 정수 중 가장 큰수를 참조하나, rem은 fix(x)함수를 사용하며 x의 절대값보다 작은 정수중 가장 큰수를 참조
iterations %커멘더(명령창)에서 모니터링 할 수 있게 하는 부분이다. 100단위로~ 명령창에서 이터레이션과 에러의 크기를 볼 수 있다.
error_mag
end
% Assigning ne to be old
y = y_new;
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,y, 12)
colorbar
% plot the error with time
figure;
time = dt.*(1:iterations);
plot(time, error_track)
%% Concept of subplots
figure;
subplot(2,1,1)
plot(time, error_track)
subplot(2,1,2)
contourf(X,Y,y,12)
colorbar
%% Plotting a particular timestep
timestep_selected = 100;
x_dom = ((1:n_points)-1).*h;
y_dom = 1-((1:n_points)-1).*h;
[X,Y] = meshgrid(x_dom,y_dom);
y_timestep = y_transient(timestep_selected, :, :);
y_timestep = reshape(y_timestep, [n_points,n_points]); % y_transient는 3차원이 대응된 값을 y_timestep 2차원으로 축소
contourf(X,Y,y_timestep, 12)
colorbar
title(['Time = ' num2str(timestep_selected*dt) 's'])
%% Animation after every N timesteps
N = 100;
timestep_array = 1:N:iterations;
figure;
for i = 1:length(timestep_array)
timestep_selected = timestep_array(i);
y_timestep = y_transient(timestep_selected, :, :);
y_timestep = reshape(y_timestep, [n_points, n_points]);
contourf(X,Y,y_timestep, 12)
colorbar
title(['Time = ' num2str(timestep_selected*dt) 's'])
pause(0.25); %애니메이션을 위해 퓨징
end
How can I access MATLAB for free?
I believe you can use the trial version for 30 days.
@@TanmayAgrawal7 yes I have already used it.
@@nikitajangid2289 If you are a student, you can contact your institute (library and your teachers) , if they provide free MATLAB license for students, and once u get a account with MATLAB license , you dont even need to download the MATLAB software , u can use MATLAB online in your browser.
PLEASE LECTURE I WANT TO MEET YOU !
WHOULD YOU MIND IF YOU HELP ME ON MATLAB!
Please send me an email: tanmayagrawal7@gmail.com