Poisson equation using FFTW with rectanguar domain

天大地大妈咪最大 提交于 2019-12-08 19:15:40

In the Fourier space, the frequencies k_x and k_y must depend on the size of the domain. As the domain is rectangular, it becomes a matter of importance.

Try :

double invL1s=1.0/(L1*L1);
double invL2s=1.0/(L2*L2);
...
        if(2*i<N1){
            fact=((double)i*i)*invL1s;
        }else{
            fact=((double)(N1-i)*(N1-i))*invL1s;
        }
        if(2*j<N2){
            fact+=((double)j*j)*invL2s;
        }else{
            fact+=((double)(N2-j)*(N2-j))*invL2s;
        }

The output should be closer to the expected one (except for a scale factor).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!