All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Objective:- 1. Assume that the domain length is L = 1m 2. The initial velocity profile is a step function. It is equal to 2m/s between x= 0.1 and 0.3 and 1m/s everywhere else 3. Use first order forward differencing for the time derivative 4. Use first order backward/rearward differencing for the space term. 5. Time step…
Mohammad Saifuddin
updated on 08 Aug 2019
Objective:-
1. Assume that the domain length is L = 1m
2. The initial velocity profile is a step function. It is equal to 2m/s between x= 0.1 and 0.3 and 1m/s everywhere else
3. Use first order forward differencing for the time derivative
4. Use first order backward/rearward differencing for the space term.
5. Time step and number of grid points should be variables in your calculation
6. C = 1
7. Set time step = 0.01
8. For C = 1 and for time = 0.4seconds compare the original and final velocity profiles.
9. Make the comparison for n=20,40,80 and 160.
Software used:- MATLAB
Solution:-
Matlab code for solving 1D linear convection equation
clear all
close all
clc
L = 1 % Domain lenght in meter
n = 20 % no. of grid points
c = 1 %linear convection velocity
x = linspace(0,L,n) % mesh
dx = x(2) - x(1)
dt = 0.01 % time step
time = 0.4 % total time in seconds
nt = time/dt % total no. of time steps
%start point for square wave
x_start = 0.1
n_start = round((x_start/dx) + 1) % finding the integer value of the node for x_start
%stop point for square wave
x_stop = 0.3
n_stop = round((x_stop/dx) + 1) % finding the integer value of the node for x_stop
u = ones(L,n)
u(:,n_start:n_stop) = 2
u_initial = u
uold = u
ct = 1
%time loop
for k = 1:nt
% space loop
for i = 2:n
u(i) = uold(i) - (c*(dt/dx))*(uold(i) - uold(i-1)); % solving linear convection equation
end
%update old velocities
uold = u
%plotting the velocities
plot(x,u_initial,'r','linewidth',1) % original velocity profile
hold on
plot(x,u,'b') % final velocity profile
xlabel('x aixs')
ylabel('velocity')
pause(0.03)
M(ct) = getframe(gcf); % function used to capture all the generate frames in the loop
ct = ct+1;
end
% Creating movie to visualize convection
movie(M)
convection_video = VideoWriter('convection_n=20.avi', 'Uncompressed AVI');
open(convection_video)
writeVideo(convection_video,M)
close(convection_video)
Report:
The above programe was executed at four different values of number of grid points, n=20, 40,80,160. This generated four graphs for linear convection and four videos were also generated.
Conclusion:-
Animation of linear convection:-
for n=20
for n=40
for n=80
for n=160
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
External Aerodynamics of a Mercedes Truck After Performing Surface Wrapping in STAR-CCM+
Surface Wrapping Surface wrapping is a method of extracting the desired surface with the desired volume of interest to perform CFD analysis. Surface wrapping does not incorporate all the minor details of the inside of the geometry, it only takes the outer detail of the geometry. When the CAD file contains a lot…
16 Feb 2020 02:12 PM IST
External flow Analysis of Ahmed body and Comparing the Numerical and Experimental data in STAR-CCM+.
Objective: Create the Ahmed Body slant for both 250 and 350 Run Steady-state implicit coupled flow simulation Use the turbulence models K-OmegsSST and k-epsilon Validate the velocity profile along the Ahmed body at different points with the experimental data. Calculate the cd and cl using the different turbulence.…
16 Feb 2020 01:45 PM IST
External flow analysis of NACA 0012 airfoil for different values of angle of attack in STAR - CCM+
NACA The NACA airfoils are airfoil shapes for aircraft wings developed by the National Advisory Committee for Aeronautics (NACA). The shape of the NACA airfoils is described using a series of digits following the word "NACA". The parameters in the numerical code can be entered into equations to precisely generate the cross-section…
29 Jan 2020 04:34 AM IST
Transient state analysis of Rayleigh Taylor instability in ANSYS FLUENT.
Objective Discuss some practical CFD models that have been based on the mathematical analysis of Rayleigh Taylor waves. And explain how these mathematical models have been adapted for CFD calculations. Perform the Rayleigh Taylor instability simulation for 3 different mesh sizes with the base mesh being 0.5 mm. Compare…
15 Jan 2020 09:52 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.