# Analytical Solution to the acoustic / scalar (Inhomogeneous) wave equation with source term

The acoustic wave equation in 2D is

$$\frac{\partial^2}{\partial t^2}p(x,z,t) = c(x,z)^2\left[\frac{\partial^2}{\partial x^2}p(x,z,t) + \frac{\partial^2}{\partial z^2}p(x,z,t)\right] + s(x,z,t) \enspace .$$

Can anyone please give an analytical solution to the above, not worrying about the boundary conditions (assuming infinite boundary)?

• $p$ is a scalar field ( pressure )
• $c$ is the velocity ( a scalar value ) , same everywhere in the domain.
• $s(x,z,t)$ or source function is at only one point in the domain ( at the center of the 2D / 3D domain).

An IPython snippet of this code for finite differences is

# it is the time step number.
# dt is the time step size.
# src is the source

f0 = 100.0    # dominant frequency of source (Hz)
T = 1.0 / f0  # dominant period
ist = 100     # shifting of source time function
src[it] = exp(-1.0 / T ** 2 * ((it - ist) * dt) ** 2)   # This is a Gaussian source
# Take the first derivative to finally define the source function.
src = np.diff(src) / dt


The green's function is a bit complicated for me.

How can it be re-defined / adapted for our case of finite differences , given this : https://en.wikipedia.org/wiki/Acoustic_wave_equation#Cartesian_coordinates

• It is not clear what is your question. Do you want an analytical solution or do you want to implement a finite difference solution? – nicoguaro Nov 24 '15 at 23:01
• On the other hand, you should always worry about boundary conditions, since those change the solution for your problem. – nicoguaro Nov 24 '15 at 23:02
• @nicoguaro I edited the question. There is no boundary, i.e., the domain is infinite. Thus, the analytical solution gets simplified. – user286333 Nov 24 '15 at 23:37
• Well, your edition add some things that I had removed. If you already said that it is in 2D why add 3D later? – nicoguaro Nov 24 '15 at 23:43
• I think I understand your question now. You want to find the analytical solution for the wave equation with a point source in the origin with a varying amplitude on time. This is not the place to ask that question then. Although, you can compute the Fourier transform of your amplitude function and compute the convolution with the Fundamental solution (Green Function)... that will give you what you want. – nicoguaro Nov 24 '15 at 23:58

I understand that you want to solve the differential equation

$$\nabla^2 u - \frac{1}{c^2}\frac{\partial^2 u}{\partial t^2} = f(t)\delta(\mathbf{r}) \enspace ,$$

for an unbounded domain, $\mathbf{r}$ is the position vector, and

$$f(t) = -\frac{2(t-t_0)}{T^2} e^{-\frac{\left( t-t_0\right)^2}{T^2}} \enspace ,$$

although, we don't need to write this function explicitly.

We compute then the Fourier transform of the equation, i.e.,

$$\nabla^2 u + k^2 u = \hat{f}(\omega)\delta(\mathbf{r}) \enspace ,$$

with $k^2 = \omega^2/c^2$, and $\hat{f}(\omega)$ the Fourier transform of $f(t)$ that reads

$$\hat{f}(\omega) = \frac{i\,\omega\,T\,{e}^{-\frac{{\omega}^{2}\,{T}^{2}}{4}-i\,\omega\,t0}}{\sqrt{2}} \enspace .$$

And, the solution to your problem looks like

$$u(t) = \frac{i}{4 \sqrt{2\pi}}\int_{-\infty}^{\infty} H_0^{(1)}(k|\mathbf{r}|) \hat{f} (\omega) e^{i\omega t} d\omega \enspace .$$

You should read about the solution for the Helmholtz equation, Fourier transform and Convolutions to understand the procedure.

You can make up as many solutions to this equation as you want using the Method of Manufactured Solutions (PDF). Is there a reason you're focused on this particular case only, or could you use any solution/forcing-function pair?

• Yes, I wish to focus on this particular case only. The reason is I wish to compare the analytical with the numerical. – user286333 Nov 24 '15 at 21:24
• @user286333, the modern way to do that is to make up a solution using the method I suggested and not constrain yourself to arbitrary forcing functions. Pick a hard, transcendental function as your solution, turn the crank, generate a forcing function, implement that, and compare! – Bill Barth Nov 24 '15 at 22:21
• My source function is already decided as I wrote in the code !! I just need the analytical solution , given this source function . @Bill Barth – user286333 Nov 24 '15 at 22:49
• I edited the question. I need the solution to this particular source function, because that is the problem statement. ( As you see in the code, it is the first derivative of a Gaussian). @Bill Barth – user286333 Nov 24 '15 at 23:42
• It appears OP is specifically asking for an analytical solution and not 'name of a method by which we can obtain analytical solutions', so to be honest (scicomp high-scorers can criticize me if they want), this answer should be directed more as a comment than as an answer to this question. I am saying this based on the standard and quality of answers on other stackexchange websites. – user5510 Nov 25 '15 at 19:42