- #1

irycio

- 97

- 1

Hello everyone and greetings from my internship!

It's weekend and I'm struggling with my numerical solution of a 1+1 wave equation.

Now, since I'm eventually going to simulate a black hole ( :D ) I need a one-side open grid - using advection equation as my boundary condition on the end of my grid I succceeded. M.y solution looks exactly (as far as my accuracy goes) as the analytical one if I assume that the initial condition is a gaussian wave packet moving towards +infinity.

Now, for the left side BC I was first using the simplest one - demanding that the function is equal to 0. Obviously it worked fine for the gaussian packet centered around,say 0.5, so that it was visible on my grid.

And this is where my trouble began. I than wanted to center my wave packet at 0, so that only half of it is on the grid. Now, using the same BC I ended up getting a half of a Gaussian wave packet moving towards infinity. Not a success, definitely. I than tried using absorbing BCs also at 0, as to simulate the grid infinite in both directions. I got the same result, maybe with some more random noise.

Eventually, I tried using cosine function (cos(r-t), time derivative appropriate) as my initial value. In this case I keep getting exactly same rubbish.

And hence my question is: what are the proper boundary conditions as to get the results I expect to get? Obviously, when I explicitly wrote, that f(0,t)=-sin(t), I got the proper animation, but I believe that's not the right way.

Now, to visualise what I tried to describe, there are some animations I created, which show the rubbish I keep receiving.

1. f(0,t)=0 BC

2. absorbing BCs on both sides

3. f(0,t)=sin(-t)

Big thanks in advance for all the answers. Suggestions of introductory textbooks to FDM are highly welcome as well.

It's weekend and I'm struggling with my numerical solution of a 1+1 wave equation.

Now, since I'm eventually going to simulate a black hole ( :D ) I need a one-side open grid - using advection equation as my boundary condition on the end of my grid I succceeded. M.y solution looks exactly (as far as my accuracy goes) as the analytical one if I assume that the initial condition is a gaussian wave packet moving towards +infinity.

Now, for the left side BC I was first using the simplest one - demanding that the function is equal to 0. Obviously it worked fine for the gaussian packet centered around,say 0.5, so that it was visible on my grid.

And this is where my trouble began. I than wanted to center my wave packet at 0, so that only half of it is on the grid. Now, using the same BC I ended up getting a half of a Gaussian wave packet moving towards infinity. Not a success, definitely. I than tried using absorbing BCs also at 0, as to simulate the grid infinite in both directions. I got the same result, maybe with some more random noise.

Eventually, I tried using cosine function (cos(r-t), time derivative appropriate) as my initial value. In this case I keep getting exactly same rubbish.

And hence my question is: what are the proper boundary conditions as to get the results I expect to get? Obviously, when I explicitly wrote, that f(0,t)=-sin(t), I got the proper animation, but I believe that's not the right way.

Now, to visualise what I tried to describe, there are some animations I created, which show the rubbish I keep receiving.

1. f(0,t)=0 BC

2. absorbing BCs on both sides

3. f(0,t)=sin(-t)

Big thanks in advance for all the answers. Suggestions of introductory textbooks to FDM are highly welcome as well.

Last edited by a moderator: