I'm solving the 3D Diffusion equation $$u_t=k(u_{xx}+u_{yy}+u_{zz})$$

in MATLAB using Fourier techniques. I assume a 3D Fourier expansion $(e^{-ipx},e^{-imy},e^{-imz})$of the solution.

Physical space: $u(x,y,z,t)$. Fourier Space: $c(m,n,p,t)$.

Substitution and differentiation result in: $$c(m,n,p)^{N+1}-c(m,n,p)^{N} = -\frac{k\Delta T}{2} (p^2+m^2+n^2)(c(m,n,p)^{N+1}+c(m,n,p)^{N})$$ after applying a Crank-Nicolson scheme.

I'm using fftn() and ifftn() to forward my coefficients in time and bring them back to physical space. However I achieve universal decay from the initial condition to zero with no heat flux in any direction, for all time. Typical time step: 0.00001. Typical k=0.005.

Is the problem with my application of fftn() or the stability of my finite-difference?

Edit: I've taken an initial condition of $50 \sin(2x)$. I merely took the boundaries of that initial condition and imposed them as the boundary conditions for all time. No good I'm guessing?

Edit 2: I forgot the wavenumber squared on the rhs. Thanks James!

  • 1
    $\begingroup$ What are your boundary conditions? if $u(x,y,z,t)=0$ everywhere on your boundaries, $0$ is the steady state solution. $\endgroup$ – Bill Barth Jan 22 '16 at 14:41
  • $\begingroup$ Shouldn't you be multiplying c(m,n,p) by the wavenumber squared on the r.h.s. because of the second derivative? $\endgroup$ – James Jan 23 '16 at 1:51

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.