## FFT setting the boundary conditions

### Remember to vote up questions/answers you find interesting or helpful (requires 15 reputation points)

I am using the FFT method to solve the two dimensional PDE on a $2\pi\times 2\pi$ square. I have boundary conditions that $u(x,0,t)=0$ and $u(x,2\pi,t)=0$. How do I go about setting these boundaries? I can't just expand in different basis functions because of the way my fft function works.

Thanks in advance.

-

Sounds like a job for the discrete sine transform. Any reference on FFT should include something on how to get a canned FFT routine to do DST. Alternatively, you might want to look at FFTW. – J. M. Oct 29 2010 at 15:04

## 1 Answer

If you don't mind wasting some resources, extend the $y$ coordinate to the interval $[0,4\pi]$. Then only look at solutions that are odd (anti-symmetric) under the flip $y\mapsto 4\pi-y$. In particular, if your PDE has source terms, they have to be anti-symmetrically mirrored from the $[0,2\pi]$ to the $[2\pi,4\pi]$ half of the extended interval. When restricted to $y\in[0,2\pi]$ a periodic solution on the extended interval will satisfy the desired boundary conditions.

-

This is essentially what a discrete sine transform does, only with less waste of space due to the exploitation of the antisymmetry. – J. M. Oct 31 2010 at 10:32
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 9, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.91043621301651, "perplexity_flag": "middle"}