# A Pseudospectral method using FFT to solve diff equation

Tags:
1. Sep 20, 2016

### John_Blacktower

Hello everyone, i'm trying to solve by FFT a convection diffusion eqaution on a 3 D box with an slit condition on z-axix and periodic conditions on x and y axis.
∂C/∂t=D∇[2]C-v⋅∇C (1)
v=vx + vy + vz
i have solved the velocity of fluid, i mean a really know what is the velocity of flow field.
But when i try to solve the eq. (1) i don't see the effect of the convection therm on my solution, this mean in the solution i only get a result like a pure diffusion problem. probably i have a wrong discretization scheme for convective term. but i dont nkow.

now i show you what its my procedure:

1.
i perform a cranck nicholson scheme for eq. (1):
C[k+1]-1/2*DΔt(∇[2]C)[k +1]=C[k] +(1/2*DΔt(∇[2]C)-v⋅∇C)[2] (2)

2. Then i transform the convective term (a nonlinear term)
v⋅∇C=∇⋅(Cv)-C∇⋅v; ∇⋅v=0
∇⋅(Cv)→∇.ff=Cv

3. i apply FFT for the terms on x and y axis on eq. (2)
C'[k+1]-1/2*DΔt(-k[2]C'+d[2]C'/dz[2])[k +1]=C'[k] +(1/2*DΔt(-k[2]+d[2]C'/dx[2])-(-ik*f' + df'z/dz))[2] (3)
where; k=norm(k); k=k1 +k2; f'= f'x + f'y; C'=∫C(x,y,z)exp(-i*(k)⋅(r))dxdy; r=x + y.
f'x=∫C(x,y,z)vx(x,y,z)exp(-i*(k)⋅(r))dxdy
f'y=∫C(x,y,z)vy(x,y,z)exp(-i*(k)⋅(r))dxdy
f'z=∫C(x,y,z)vz(x,y,z)exp(-i*(k)⋅(r))dxdy

4. then i apply a finite difference discretization on z axis
Ci'[k+1]-1/2*DΔt(-k[2]C'i+(C'i+1-2C'i+C'i-1)/(Δz*Δz))[k +1]=C'[k] +(1/2*DΔt((-k[2]C'i+(C'i+1-2C'i+C'i-1)/(Δz*Δz))-(-ik1*f'xi -ik2*f'yi + (f'zi-f'zi-1)/Δz))[2] (5)

5. then on matriz notation i have:
A[k+1]⋅b[k+1]=A[k]⋅b0[k] - bfx[k] - bfy[k]- C[k]⋅bfz[k] (6)

i have been solved but the solution is very similar to pure diffusion problem.