## STUDY ON 1-D CONVECTION DISTRIBUTION FOR DIFFERENT TIME-STEPS

DESCRIPTION:

In this code, we are going to compare the results of the 1D convection distribution equation describing the velocity for a range of time-step values. As a result, we will be getting the plots on the final velocity profile on time marching and computational time for each value of timestep.

MAIN CODE:

clear all
close all
clc

%inputs
c = 1;
dt = [1e-4,1e-3,1e-2,1e-1];
l = 1;
%n = grid points
n = 80;
x = linspace(0,l,n);
dx = x(2)-x(1);

%xstart = 0.1
% xend = 0.2

ct = 1;
for i = 1:n
if x(i) >= 0.1 && x(i)<=0.3
ustart(ct) = i;
ct = ct+1;
end
end

%initial vel = 1
u = ones(1,n);
u(ustart(1:end)) = 2;

uold = u;
tic
s1 = convfunc(n,u,uold,c,dt(1),dx)
t1 = toc;

tic
s2 = convfunc(n,u,uold,c,dt(2),dx)
t2 = toc;

tic
s3 = convfunc(n,u,uold,c,dt(3),dx)
t3 = toc;

tic
s4 = convfunc(n,u,uold,c,dt(4),dx)
t4 = toc;

figure(1)
plot(x,s1,'linewidth',1,'color','b','LineStyle','- -')
grid on
hold on
plot(x,s2,'linewidth',1,'color','r')
plot(x,s3,'linewidth',1,'color','y')
plot(x,s4,'linewidth',1,'color','g')
legend('1e-4','1e-3','1e-2','1e-1')
axis([0,2,1,2])
title('1D-convection')
xlabel('space - x','FontWeight','b')
ylabel('velocity - u','FontWeight','b')

figure(2)
time = [t1,t2,t3,t4]
bar(time)
title('PROCESS TIME FOR dt VALUES')
xlabel('dt')
ylabel('time')
somenames = {'1e-4','1e-3','1e-2','1e-1'}
set(gca,'xticklabels',somenames)


FUNCTION:

function s = convfunc(n,u,uold,c,dt,dx)

%dt*tstep = time;
time = 0.4;
tstep = time/dt;

%time marching
for r = 1:tstep

%space marching
for i = 2 : n

u(i) = uold(i) - ((c*dt/dx)*(uold(i) - uold(i-1)));

end

%update velocity field
uold = u;

end

s = u;
end

PLOTS:

1. FINAL VELOCITY PROFILE:

2. COMPUTATIONAL TIME:

RESULTS:

We can observe that with the increase in time-step, the computational time increases. But, we can observe particularly for 1e-1 timestep, due to the blowup issue, there is a increase in the process time than 1e-2 and it depends on the system also.

### Mixing tee project Yokesh R · 2019-08-22 06:06:22

Case-1:       CASE-2:           CASE-3:         Read more

### DETERMINATION AND STUDY OF EIGEN VALUE AND SPECTRAL RADIUS BY ITERATIVE METHODS Yokesh R · 2019-05-29 14:50:23

MAIN CODE: clear all close all clc A=[5 1 2 ; -3 9 4; 1 2 -7]; B=[10 ;-14; 33]; u = [0 1 2; 0 0 4; 0 0 0]; l = [0 0 0; -3 0 0; 1 2 0]; di = [5 0 0; 0 9 0; 0 0 -7]; mag = [0.25,0.5,0.75,1,1.5,2]; for i = 1 : length(mag) d = di*mag(i); Read more

### STUDY ON BEHAVIOR OF ITERATIVE TECHNIQUES FOR TWO DIMENSIONAL CONDUCTION DISTRIBUTION Yokesh R · 2019-05-25 10:39:05

DESCRIPTION: In this code, we are going to solve the two dimesnional convection equation defining a temperture distribution. The equation can be solved by 2 methods. 1. Implicit method 2. Explicit method In explicit method, we will be solving the equation sequencial Read more

### TAYLOR TABLE MODELLING FOR FOURTH-ORDER-APPROXIMATION OF SECOND ORDER DERIVATIVE Yokesh R · 2019-05-23 13:49:10

DESCRIPTION: Using the central and skewed scheme methods initially, we have to develop the Taylor table, which should be converted into a matrix and solved for the constants. These constants help in solving the second order differential equation. Finally, the error res Read more

### DISCRETIZATION OF FIRST ORDER DERIVATIVE USING FIRST, SECOND AND FOURTH ORDER APPX Yokesh R · 2019-05-22 11:24:56

DESCRIPTION:      In this code, we are going to discretize the function for the first-order derivative using first, second and fourth order approximation techniques and studying the error bounced by every method by a bar chart.   CODE: clear all Read more

### DISCRETIZATION OF A FIRST ORDER DERIVATIVE USING A RANGE OF dx TERMS Yokesh R · 2019-05-22 10:39:19

DESCRIPTION:      Here in this code, we are using a range of dx terms for discretizing the first order derivative and studying the results of the dx vs error plot  CODE: clear all close all clc x = pi/3; dx = linspace(pi/4,pi/4000,30); %y Read more

### BALANCING AND STUDYING EFFECTS OF A CHEMICAL COMBUSTION EQUATION IN MATLAB Yokesh R · 2019-05-22 09:27:29

STOICHIOMETRIC COMBUSTION   DESCRIPTION:   Stoichiometric combustion defines the ideal combustion that needs to take place for a given chemical equation. This is actually the general form of equation for alkanes. The general form might differ for e Read more