I am new to computational science and I am trying to wrap my head around how MMS works. I am solving the time independent Helmholtz equation as a simple test of the technique

so my starting equation is following with homogeneous boundary conditions on a line segment

$\Delta u +k^2u = F $

So I am supposed to take something that is sufficiently differentiable. So, following other people I pick the following for my 1D case

$ \bar{u} = \sin(\pi x)$

My new source term created from MMS would be

$G(x) = -\pi^2\sin(\pi x) + k^{2}\sin(\pi x) - F $

Now here is where I am stuck. I picked a u and now I have a new F. Somehow I am supposed to be able to verify my rate of convergence of my actual problem with this fictitious one. Are the points the same?

Any advice would be appreciated.

  • 1
    $\begingroup$ First of all, the non-homogeneous time-independent Helmholtz equation is: $$\nabla^{2} u + k^{2} u = F$$ Then if I assume your fabricated solution of $u = \sin(\pi x)$, I would have this for $F$ as: $$F = (k^{2} - \pi^{2}) \sin(\pi x)$$ Basically, if you have this equation: $$\frac{d^{2} u}{d x^{2}} + k^{2} u = (k^{2} - \pi^{2}) \sin(\pi x)$$ The analytical solution would be: $u = \sin(\pi x)$. $\endgroup$ – Alone Programmer Apr 23 at 19:46
  • $\begingroup$ @AloneProgrammer I had F as some arbitrary forcing function so how does that change your comment. Also I am not sure how this relates to my original problem. How does this new equation help me check convergence? $\endgroup$ – TheCodeNovice Apr 23 at 19:59
  • 1
    $\begingroup$ In your code to solve this Helmholtz equation, you put the right-hand side as $F = (k^{2}-\pi^{2})\sin(\pi x)$ then compare your numerical result with the analytical solution of $u = \sin(\pi x)$ to find the rate of convergence of your method with respect to mesh size. $\endgroup$ – Alone Programmer Apr 23 at 20:22
  • 1
    $\begingroup$ The point is that you cannot independently choose whatever solution and right hand side you have in the equation. You can only choose one, and then the other is determined. So if you pick a $\bar u$, then it follows from the equation what $F$ needs to be. $\endgroup$ – Wolfgang Bangerth Apr 23 at 22:29

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.