You are on page 1of 8

ADVECTION DIFFUSION MODEL USING MATLAB

Clava Ginting
15111003
Faculty of Earth Science and Technology, Institute Technology of Bandung, Bandung, Indonesia
c.forclava@yahoo.com
The purpose of this assignment is to monitor how dissolved substance in a certain channel on a certain time. The type of
the substance divided into 2 assumption. The First one is if the substance is not continuous, the other one is if the
substance constantly there (continuous). The advection formulae can be approximated mathematically by Explicit
Upstream and Central differential.
The problem on this assignment is:
The Case
Length of channel = 3000 m
Polutant concentration = 50 ppm
Current velocity in the channel = 0.5 m/s
Source of pollutant is located at 500 m from upstream
Task #1
Calculate the pollutant concentration change in time and space along the channel for 200 seconds and grid spacing ()
of 20 m, using the following numerical scheme:
a. Explicit difference

Task #2
The same as Task #1 but make the source is continuously produce pollutant of 50 ppm, and have increment 0.0001 per
sec:
a. Explicit difference
The result is shown in graph on grid 20, 26, 47 showing the concentration through time and at 1s, 600s and, 1200s
showing the concentration at whole stream.

Definition:
Advection is transfer of heat or matter by the flow of fluid, especially horizontally in the atmosphere or sea.
Diffusion is the spreading of something more widely.
In a channel, Diffusion and Advection is responsible for distributing concentration throughout channel. The Diffusion
and Advection is modelled by a Equation.
The government equation of Diffusion and Advection is

Through Explicit Discretization the formula is obtained:

This case is done by using this Flowchart:

(a)
(b)
Figure 1. Flow Chart of: (a). Discontinuous substance advection (b). Continuous substance advection

Thus, from the flowchart the Matlab is created:


Matlab Script for Explicit Formulae:
Continuous Substance with increement
clear all;
clc;
% Initial
L=3000;
dx=20;
u=0.5;
t=1200;
dt=0.5;
df=50
q=0.001

Parameters

%Boundary Condition
nmax=L/dx;
mmax=t/dt;
%Initial condition (Matrix)
for i=1:nmax
F(i,1)=0;
end
%Initial condition (Substance)
F(26,1)=50;
%Formulae
for k=2:mmax;
%Syarat Konsentrasi
F(26,k)=50+q*(k-1);
for h=2:nmax-1;
F(h,k)=F(h,k-1)*(1-(abs(u)*dt/dx)-2*df*dt/(dx)^2)+F(h-1,k1)*((dt/(2*dx))*(u+abs(u))+(df*dt/(dx)^2))+F(h+1,k-1)*((dt/2*dx)*(abs(u)-u)+((df*dt)/(dx)^2));
end
%Boundary Condition for Looping
F(h,k-1)=F(2,k-1);
F(nmax,k-1)=F(nmax-1,k-1);
%Syarat Konsentrasi
F(26,k)=50+q*(k-1)/2;
end

t= [1 600 1200]
for o=1:3
figure
plot(F(:,t(o)))
%axis([0 mmax 0 50])
title({['Konsentrasi pada ',num2str(t(1,o)),'s'];})
xlabel('Channel dalam Meter')
ylabel('Konsentrasi dalam ppm')
end
y= [20 26 76]
for o=1:3
figure
plot(F(y(o),:))
%axis([0 nmax 0 50])
title({['Konsentrasi pada Jarak',num2str((y(1,o)*dx-dx)),'m']; })
xlabel('Saat t per 200 sekon (dt/t s)')
ylabel('Konsentrasi dalam ppm')
end

(b).Disontinuous Substance
clear all;
Discontinuous Substance
clear all;
clc;
% Initial
L=3000;
dx=20;
u=0.5;
t=1200;
dt=0.5;
df=50
q=0.001

Parameters

%Boundary Condition
nmax=L/dx;
mmax=t/dt;
%Initial condition (Matrix)
for i=1:nmax
F(i,1)=0;
end
%Initial condition (Substance)
F(26,1)=50;
%Formulae
for k=2:mmax;
%Syarat Konsentrasi
F(26,k)=50+q*(k-1);
for h=2:nmax-1;
F(h,k)=F(h,k-1)*(1-(abs(u)*dt/dx)-2*df*dt/(dx)^2)+F(h-1,k1)*((dt/(2*dx))*(u+abs(u))+(df*dt/(dx)^2))+F(h+1,k-1)*((dt/2*dx)*(abs(u)-u)+((df*dt)/(dx)^2));
end
%Boundary Condition for Looping
F(h,k-1)=F(2,k-1);
F(nmax,k-1)=F(nmax-1,k-1);
%Syarat Konsentrasi
F(26,k)=50+q*(k-1)/2;
end

t= [1 600 1200]
for o=1:3
figure
plot(F(:,t(o)))
%axis([0 mmax 0 50])
title({['Konsentrasi pada ',num2str(t(1,o)),'s'];})
xlabel('Channel dalam Meter')
ylabel('Konsentrasi dalam ppm')
end
y= [20 26 76]
for o=1:3
figure
plot(F(y(o),:))
%axis([0 nmax 0 50])
title({['Konsentrasi pada Jarak',num2str((y(1,o)*dx-dx)),'m'];})
xlabel('Saat tiap 0.5 t sekon (dt/t s)')
ylabel('Konsentrasi dalam ppm')
end

The Result of the Matlab Scripts are plotted on Graph:


(a)
Continuous problem with increement

(b)

Discontinuous Problem

Analysis
Diffusion make the pollutant may move toward the left side (opposite direction with current) which is impossible from
the advection. Although if the pollutant not continuously produced the pollutant will eventually moving to the right. It
seen from figure on the 20th grid seen at the whole time, at the first time there is an increment pollutant concentration
that sign there is a moving pollutant towards the 20th grid. But at the certain time the graph show a turning point. It
shows the pollutant is degrading. From the actual plot we may see that the pollutant will eventually move in same
direction with current again. However if the pollutant constantly produce (in this case it also have an increment over
time), the diffusion made that it is possible to a channel can fully polluted even the part on the opposite direction with
current. However the speed of pollutant moving towards the left (opposite to the current) not as fast as the towards the
lower channel one (in same direction with current).

You might also like