All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Objective : To solve 1D linear wave equation by time marching method in finite difference using matlab. Observing how the equation diffuses and Analyzing results . 1D linear Wave equation : ∂u∂t=c⋅∂u∂x Method : Explicit form …
Aadil Shaikh
updated on 19 Feb 2020
Objective : To solve 1D linear wave equation by time marching method in finite difference using matlab. Observing how the equation diffuses and Analyzing results .
1D linear Wave equation : ∂u∂t=c⋅∂u∂x
Method : Explicit form , using first order forward differencing for time derivative , and 1st oer backward differencing for the space term in the eqn .
Program :
%% 1-D Linear eqn model by time marching method of (Finite difference Method )
% Code by Aadil Shaikh
close all
clear all
clc
%% Specifying parameters
L = 1; % domain length
n = input('Enter number (n) : '); % Numbers
nx = linspace(0,L,n); % Number of steps in grid
T = 0.4 ;
c = 1; % velocity
dt = 1e-2; % time step
dx = nx(2)-nx(1); % width of space
nt = T/dt; % number of steps in time
u = zeros(1,n); % preallocating space
%% define start and end points for square vave
for i = 1:n
if ((0.1<=nx(i))&&(nx(i)<=0.3))
u(i) = 2;
else
u(i) = 1;
end
end
uold = u;
u_initial = u;
%%
for k = 1:nt
%space loop
for i = 2:n
u(i) = uold(i) - (c*dt/dx)*(uold(i)-uold(i-1));
end
%update old velocities
uold = u;
end
%% plotting the velocities
figure(1)
hold all
plot(nx,u_initial,'r','linewidth',1)
plot(nx,u,'-o','linewidth',.5)
axis([0 1.2 0.8 2])
title({['1-D Linear Convection at C = 1 & n = ',num2str(n) ];['time \it = ',num2str(dt*k)]})
xlabel('Grid Co-ordinate (x) \rightarrow')
ylabel('Velocity (u) \rightarrow')
Plot :
n = 20 :
The red square wave is the initial velocity profile .
The blue wave is the final velocity wave profile at time 0.4 seconds and at Space steps number 20
n = 40
The red square wave is the initial velocity profile .
The blue wave is the final velocity wave profile at time 0.4 seconds and at Space steps number 40
n = 80
The red square wave is the initial velocity profile .
The blue wave is the final velocity wave profile at time 0.4 seconds and at Space steps number 80
n = 160
The red square wave is the initial velocity profile .
The blue wave is the final velocity wave profile at time 0.4 seconds and at Space steps number 160 . we can see that wave is distorted and feels like an error . A result cant be obtained from such a wave .
Explanation of plot behaviour :
------------------------------------- THE END ------------------------------------------------
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...
Flow over a Throttle body - Using CONVERGE CFD
I. Introduction: In this Project, A Steady & Transient state simulation is done of a Flow through an Elbow joint consisting of a throttle valve. The steady state case is solved with the Throttle valve fully open until convergence is reached. While the Transient case is ran with the throttle valve rotating i.e…
18 Sep 2020 08:29 PM IST
Literature review – RANS Derivation and analysis
Introduction: The Reynolds-averaged Navier–Stokes equations (or RANS equations) are time-averaged equations of motion for fluid flow. The idea behind the equations is Reynolds decomposition, whereby an instantaneous quantity is decomposed into its time-averaged and fluctuating quantities,…
18 Sep 2020 08:28 PM IST
C.H.T Analysis on a Graphic card using ANSYS FLUENT
I. Introduction : In this project, A steady state conjugate heat transfer analysis on a Graphic card model is done. Graphic card has become an everyday used object and a very importat part of any computer system, laptops etc. This product is mass produced daily in millions and has made computers exceptionally efficient.…
18 Sep 2020 08:23 PM IST
Aerodynamics : Flow around the Ahmed Body using ANSYS FLUENT
I. Introduction : Automotive aerodynamics comprises of the study of aerodynamics of road vehicles. Its main goals are reducing drag, minimizing noise emission, improving fuel economy, preventing undesired lift forces and minimising other causes of aerodynamic instability at high speeds. Also, in order to maintain…
18 Sep 2020 08:21 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.