2
$\begingroup$

This question already has an answer here:

I would like to numerically simulate a wave (let's say in a string) with different boundary conditions:

  1. Fixed endpoints
  2. Periodic
  3. Boundless

$\varphi(x, t)$ is the value of the wave (vertical position of the string) at pixel $x$ captured by a 1-D array phi. For fixed endpoints, I simply pad my array with a zero on the left and one on the right (for numerical differentiation purposes). For the periodic boundary, I pad the left side with the last element (phi[-1] in Python syntax) and I pad the right side with the first element (phi[+1]).

How do I handle the boundless case so a pulse would just travel without reflection similar to the figure below? What is the common term for this type of boundary? (I do not want to sufficiently increase the number of pixels to solve this problem).

Wave propagation without reflection

$\endgroup$

marked as duplicate by tpg2114, Jon Custer, GiorgioP, stafusa, ZeroTheHero Mar 6 at 2:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ What you ask for is called PML for perfectly matched layer, but I never succeeded to implementit it in my case because I have to accommodate evanescent waves and standard methods fail in such case. $\endgroup$ – Jhor Mar 5 at 11:30
  • $\begingroup$ @lemon It's not the Neumann condition -- that will also generate a wave reflection. See the "soft boundary condition" on this page $\endgroup$ – tpg2114 Mar 5 at 11:40
  • 1
    $\begingroup$ Side note @Miladiouss -- did you take this image from this website? Because the author explicitly states the images can't be used other places without permission. If so, please find another source that has a usable license. $\endgroup$ – tpg2114 Mar 5 at 11:45
  • $\begingroup$ @tpg2114, I'll replace the image. $\endgroup$ – Miladiouss Mar 5 at 12:01
  • $\begingroup$ Can't you just compute the movement of the last element as if it were connected to another one, without computing the movement of this next element ? I assume you are solving the wave equation in time domain ? $\endgroup$ – David Mar 5 at 12:52
0
$\begingroup$

You are looking for outflow boundary conditions. The constraint in this case is that the derivative is constant: $$ \frac {\partial u}{\partial n}=0 $$ where $n$ is the normal direction of the surface (e.g., $x$). This is also probably more commonly known as the Neumann boundary condition.

In numerical language, this would be akin to using phi[N]=phi[N-1].

$\endgroup$
  • $\begingroup$ The Neumann condition is reflective for this case (and for compressible Navier-Stokes as well -- low-Mach preconditioning relaxes the reflectivity though). A wave will move back into the domain, not perfectly exit the domain as desired. $\endgroup$ – tpg2114 Mar 5 at 17:48
  • $\begingroup$ You would know more than I on that; all the CFD I worked on was "simple" MHD & never needed to worry about BCs (bc I kept the domain large enough to never worry about it). $\endgroup$ – Kyle Kanos Mar 5 at 17:53
  • $\begingroup$ The curse of working on internal flows... boundary conditions are a major PITA. $\endgroup$ – tpg2114 Mar 5 at 17:55
  • $\begingroup$ This seems to reflect as well. Unless I'm doing something wrong. I just set phi[-1] = phi[-2] before updating for each step. $\endgroup$ – Miladiouss Mar 5 at 21:24
  • $\begingroup$ @Miladiouss I imagine it depends on your stencil also. Could need to be phi[N]=2*phi[N-1]-phi[N-2], for example, if you have higher orders. $\endgroup$ – Kyle Kanos Mar 5 at 21:36
0
$\begingroup$

One picture is worth 1000 words. Consider a simple example. For the wave equation $u_{tt}=u_{xx}$, initial and boundary conditions are given:

$u(0,x)=0,u_t(0,x)=0,u(t,0)=f(t),u_t(t,2)+u_x(t,2)=0$

$f(t)=0,t\le 0.01$ or $t\ge1.01$, $f(t)=\sin {t}, 0.01<t<1.01$

To solve this problem we use Method Of Lines. The solution on a coarse grid is shown in the animation.

fig1

We give an explanation. We write the wave equation in the form

$v=u_t+u_x, v_t-v_x=0$

The general solution of the first equation for $v=0$ is $u=f(x-t)$ - wave moving to the right.The general solution of the second equation is $v=g(x+t)$ -wave moving to the left. So that the wave does not reflect from the right border, the condition should be set on the right border $v=u_t+u_x=0$.

How to implement this conditions in the numerical method? The answer depends on the method.

$\endgroup$
  • $\begingroup$ I don't see how this answers the question. Also, please investigate the cases environment in LaTeX. $\endgroup$ – Kyle Kanos Mar 5 at 16:49
  • $\begingroup$ @KyleKanos You do not see that this is a wave without reflection or do not understand the boundary conditions for a wave without reflection? $\endgroup$ – Alex Trounev Mar 5 at 17:10
  • $\begingroup$ No, I don't see how your contrived example gives a general solution to the issue OP has. $\endgroup$ – Kyle Kanos Mar 5 at 17:26
  • $\begingroup$ @KyleKanos This example exactly matches what Miladiouss asks. $\endgroup$ – Alex Trounev Mar 5 at 17:34
  • $\begingroup$ I disagree. You show an animation that shows an outflow boundary, but don't mention how it's implemented (which is what OP is asking for). $\endgroup$ – Kyle Kanos Mar 5 at 17:36

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