Assume sufficient decay and differentiability to justify integration by parts and exchange of integrals; Schwartz functions are one convenient class. With the stated Fourier transform convention, integrate first in :The boundary contribution vanishes under the decay assumption. The Fourier transform of a derivative consequently turns constant-coefficient spatial differential operators into multipliers. Repeating it gives , so the heat equation becomes an independent temporal ordinary differential equation at each wavevector.
Apply the Fourier transform of a derivative twice in each spatial coordinate, and commute the time derivative with the spatial Fourier transform. For the Laplacian,ThusThe minus sign is essential: positive thermal diffusivity damps short spatial scales rather than amplifying them. The zero Fourier mode is unchanged in the absence of a source.
Let be the Fourier transform of the initial temperature. Solving the scalar linear ordinary differential equation givesRecover using the Fourier inversion theorem, with inverse factor for this two-dimensional convention. Equivalently, take the convolution of the initial data with the two-dimensional heat kernel. On a periodic square, the same exponential applies to each discrete Fourier mode, with and .
- Constant thermal diffusivity makes the Fourier spectral method diagonal: each Fourier mode can be evolved by its exact exponential multiplier.
- The smooth initial Gaussian function has rapidly decaying Fourier coefficients, so a moderate grid resolves it well. The Fast Fourier transform provides an efficient change between the spatial grid and those coefficients.
- A discrete Fourier transform describes a periodically repeated array. Opposite edges are identified by periodic boundary conditions; this is a periodically continued plate model, rather than a plate with prescribed cold or insulated edges.
- The initial hot spot is far from those edges. Over the stated short interval its width remains much smaller than the side length, so the periodic images have negligible influence near the centre. At sufficiently long times, periodic diffusion tends to the conserved spatial mean.
For consistency with the supplied wavenumbers, use an FFT grid on a periodic interval: , , and similarly for . In MATLAB, replace the endpoint-inclusive coordinate definitions by
x = (0:nx-1)*Lx/nx; and y = (0:ny-1)*Ly/ny;. The supplied linspace arrays instead have spacing while the Fourier multipliers assume . Including both copies of the periodic endpoint creates a grid inconsistency, separate from high-frequency aliasing.- Lines 1–7 set the grid dimensions, domain lengths, thermal diffusivity and time interval. The elapsed time is .
- Lines 9–10 supply coordinates, subject to the periodic-grid correction above. Lines 16–17 sample the initial Gaussian function.
- Lines 11–14 construct the discrete Fourier transform frequency order and . Negative frequencies occupy the second half of each array. This is the discrete version of replacing each spatial derivative by multiplication by .
- Line 20 computes the two-dimensional Fast Fourier transform. Lines 22–24 multiply every mode by at every step, implementing the modal solution derived above.
- Line 26 performs the inverse discrete Fourier transform. Taking the real part removes tiny imaginary roundoff errors; conjugate symmetry of the exact transformed real data already guarantees a real result.
- Lines 28–42 display the initial and final arrays. A common colour scale is needed to compare their peak temperatures; independent automatic colour scales can hide the decrease in amplitude.
For this linear homogeneous problem, the exponential update is exact for the retained modes, apart from roundoff error. It is not a forward Euler method step and does not require the explicit finite-difference diffusion stability restriction. Sampling, periodic modelling and spatial resolution still matter.
Diffusion smooths and broadens the hot spot while conserving its integral. For an isolated two-dimensional initial profile , the Gaussian hot spot under diffusion isHere and , giving a width parameter of and a peak of in the initial temperature units. The periodic-grid calculation agrees to displayed precision because the periodic copies are far away. Running the endpoint-inclusive listing as written instead gives a sampled initial peak near and final peak near ; the difference is consistent with the coordinate-grid issue, rather than a different diffusion law.
Increasing positive thermal diffusivity at fixed time produces a wider, lower peak. Each nonconstant Fourier mode decays faster, while the spatial mean of a periodic heat equation remains fixed. The profiles approach a uniform mean at long times under these periodic boundary conditions.
Aliasing occurs because a sampled grid cannot distinguish certain different continuous Fourier modes. With spacing , modes and agree at every sample point. Frequencies above the Nyquist frequency can therefore be misidentified as lower frequencies, changing the resolved spectrum and its subsequent diffusion rate.
For the corrected grid, and the maximum resolved angular wavenumber is approximately . The initial Gaussian function has spectral envelope proportional to . At that one-coordinate cutoff the factor is about , so the omitted high-frequency tail is tiny. Its continuation mismatch at the distant edges is also tiny. Significant aliasing is not expected for this resolved, smooth initial condition.
The linear constant-coefficient heat equation only damps existing modes; it does not generate higher frequencies through nonlinear products. An unresolved narrow peak, a sharp edge or a nonlinear source would require a separate resolution assessment. The duplicated-endpoint grid issue described above should not be diagnosed as high-frequency folding.
A spatially uniform source changes only the zero Fourier mode. Its exact integrated increment over a time step beginning at isThe unnormalised two-dimensional discrete Fourier transform stores a constant field as in element This replacement uses the original variable names and MATLAB indexing. The uniform forcing of a periodic heat equation is integrated exactly in time here. No source multiplier is applied to the other modes, and the zero-mode homogeneous multiplier equals one. Adding only
(1,1).[ref]fft2 documentation by MathWorks. The forward defining sum has no normalization; the linked inverse definition includes the factor .
Keep the existing homogeneous exponential multiplication and add this source increment to that element:for i = 1:nt
t = (i-1)*dt;
u_hat = u_hat .* exp(-alpha*K2*dt);
dq = exp(-t/10) - exp(-(t+dt)/10);
u_hat(1,1) = u_hat(1,1) + nx*ny*dq;
enddq to the unnormalised coefficient would underestimate the physical temperature increment by the factor .The uniform source adds a background without changing the spatial gradients relative to the unforced solution:At the offset is . On the corrected grid the central peak is therefore about , and regions far from the hot spot are near . The hot spot's broadening is unchanged; the source is spatially uniform. The spatial mean of a periodic heat equation rises by the same amount, tending to a total increment of one temperature unit as .
Articles by others on the same topic
There are currently no matching articles.
