1
$\begingroup$

enter image description here I am trying to simulate the unsteady pollutant concentration along the reactor by solving the 2nd order PDE below with the stated BC and IC. which method is appropriate to solve convection-diffusion-reaction equation (unsteady state) using MATLAB. I solved the steady state using the function pdepe. Note: I have no knowledge of finite volume/element methods to solving PDE's. I can't seem to recognize why the upwind scheme and second order central difference were used to discretize the convection and diffusion terms respectively. However,I have some knowledge about finite difference methods. Any sources I could read to help better my understand in order to handle the problem

% solve Ct=DCzz-vxCx

clear all

% parameters

D=9.1e-10; % Diffusion Coefficient for phenol in wastewater

vx=(0.05/10/3600)/(0.01*30*0.01)

% Domain and step

Lx=60

Lz=0.01

Nx=100

Nz=100

Nt=1000

dx=Lx/(Nx-1)

dz=Lz/(Nz-1)

% Satisfy Courant Number

C=0.05

ux=1

uz=1

dt=C/((ux/dx)+(uz/dx))

% Field Variables

Cn=ones(Nz,Nx)

x=linspace(0,Lx,Nx)

z=linspace(0,Lz,Nz)

[X,Z]=meshgrid(x,z)

% Initial conditions

Cn(:,:)=1

t=0

% loop

for n=1:Nt

Cc=Cn

for i=2:Nx-1
    for j=2:Nz-1
        Cn(j,i)=Cc(j,i)+(D*dt/(dz*dz))(Cc(j+1,i)-2*Cc(j,i)+Cc(j-1,i))-(vx*dt/dx)(Cc(j,i)-Cc(j,i-1))
    end
end

% Boundary conditions

Cn(1,:)=1

Cn(end,:)=1

Cn(:,1)=1

Cn(:, end)=Cn(:, end-1)

% Visualize

mesh(x,z,Cn); axis[0 Lx 0 Lz 0 Lz 0 1]

pause(0.01)

end

enter image description here

$\endgroup$
  • $\begingroup$ What is $z$ and what is $x$? $\endgroup$ – Maxim Umansky Jun 6 at 4:23
  • $\begingroup$ z-height of reactor x-length of reactor $\endgroup$ – Abmon98 Jun 6 at 4:24
  • $\begingroup$ And what is x? What is the geometry in x,z coordinates? Rectangular domain? It seems like we'd need more boundary conditions: boundary conditions on both zmin and zmax boundaries, and one on either xmin or xmax boundary. $\endgroup$ – Maxim Umansky Jun 6 at 4:26
  • $\begingroup$ Flat plate (rectangle), I am trying to find the appropriate dimensions that would satisfy the following condition (the pollutant in water degrades to 5 % of its initial value) at the outlet of the reactor. So I chose initially that my dimensions for x and z would be 60 m and 0.01 m respectively. $\endgroup$ – Abmon98 Jun 6 at 4:30
  • $\begingroup$ I don't think we have enough boundary conditions here, you need to set some BC on either xmin or xmax boundaries. Anyway, what have you tried with your finite-difference method? $\endgroup$ – Maxim Umansky Jun 6 at 4:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.