I am currently trying to solve the 3D Poisson equation with a Chebyshev discretisation in the $z$ direction (from -1 to 1) and Fourier in the $x$ and $y$ (from $-\pi$ to $\pi$)

I have taken the code into a point where I think it is working but am not totally sure it is outputting the correct result. Does anyone know of any tests that I could use to either confirm it is working or reveal a mistake in it?, e.g., any initial conditions I could insert to make sure the correct result is being obtained.

Thanks for any help!


It is so trivial to pick a solution on a box domain for the Laplace equation. Just pick a function, say $\bar u(x,y,z)=x^2y^2\sin(z)$ (chosen in a way so that it isn't in your ansatz space), then compute $f=-\Delta \bar u$ and solve the Laplace equation $$ -\Delta u = f. $$ Of course, your numerical solution should converge to $\bar u$. If you can't deal with nonzero boundary conditions, choose some other $\bar u$ that satisfies the boundary conditions you can deal with.

This technique is called the "method of manufactured solutions". Here is another description of it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.