## 2d simulation of acoustic wave propagation

Numerical methods and mathematical models of Elmer
mika
Posts: 157
Joined: 15 Sep 2009, 07:44

### Re: 2d simulation of acoustic wave propagation

The characteristic length of the domain seems to be ~ 0.2 m while the frequency is set to be f = 40 kHz. For air this gives the wavelength lambda = c/f = 343/40000 m = 8.6 mm. At least the mesh is too coarse to capture tens of waves propagating in the domain. Lowering the frequency starts to give more sensible looking results. In addition, for hard walls the do-nothing BC (the default BC which is equivalent to giving Wave Flux i = 0, i=1,2) should be applied.

-- Mika

kevinarden
Posts: 642
Joined: 25 Jan 2019, 01:28
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

I also believe Comsol use a 2nd order element internally even though it looks like a linear mesh.

panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

Hi kevinarden,

It's true that it doesn't converge for frequencies higher than 10kHz. However, I tried to create a finer mesh in Salome and now it is even worse. I'm suspecting that the problem underlies in length units Elmer gets as input. As you can see in the picture above it scales it in SI, even though 168 should be 168mm, that's why I'm scaling it by doing this:

Code: Select all

``Coordinate Scaling = Real 0.001``
which should be the right way to do it.
Attachments
units.PNG (2.07 KiB) Viewed 379 times

panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

mika wrote:
14 Jan 2020, 12:39
The characteristic length of the domain seems to be ~ 0.2 m while the frequency is set to be f = 40 kHz. For air this gives the wavelength lambda = c/f = 343/40000 m = 8.6 mm. At least the mesh is too coarse to capture tens of waves propagating in the domain. Lowering the frequency starts to give more sensible looking results. In addition, for hard walls the do-nothing BC (the default BC which is equivalent to giving Wave Flux i = 0, i=1,2) should be applied.

-- Mika
My initial intend was indeed to have ~ 0.2 m between top and bottom. And I understand why making a finer mesh should solve the problem, and that's what I did. My mesh right now looks like the picture below, however it's still not converging. It's important to point out, that the same simulation is confirmed both in Comsol, Matlab and in real world (an actual device has been implemented performing exactly the same principle). I'm just trying to reproduce it in Elmer for several reasons (one of them is that Elmer is open source).
Attachments
finer_mesh.PNG

panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

It seems that my system converged in 40kHz only by using the ILUT preconditioner. Could you explain why this happened? Also, what are the differences between different ILUs and does one ILU produce a "better" result than another? (maybe that's a stupid question I don't know)

EDIT: Also, I still get only 'pressure wave' in my vtu file (in ParaView), instead of 'pressure wave 1' & 'pressure wave 2'

mika
Posts: 157
Joined: 15 Sep 2009, 07:44

### Re: 2d simulation of acoustic wave propagation

The standard iterative solvers for the Helmholtz problem at a high wavenumber are generally known to be ineffective unless a special preconditioner is devised. Perhaps the Comsol result was based on a direct solver. You might also try the same approach and use a direct (MUMPS) solver, if installed, to avoid struggling with preconditioners.

In principle ILUn with n increasing is likely to produce a solution for a smaller number of iterations. With ILUT the quality of preconditioner is controlled by the solver parameter Linear System ILUT Tolerance (a smaller value is expected to decrease the number of iterations).

Your sif gives the solution components for me. I'm afraid I cannot help in this.

-- Mika

panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

The standard iterative solvers for the Helmholtz problem at a high wavenumber are generally known to be ineffective unless a special preconditioner is devised. Perhaps the Comsol result was based on a direct solver. You might also try the same approach and use a direct (MUMPS) solver, if installed, to avoid struggling with preconditioners.
So, does it mean I can't trust the results I get with ILUT?
mika wrote:
14 Jan 2020, 17:49
Your sif gives the solution components for me. I'm afraid I cannot help in this.
You mean, you get both 'pressure wave 1' and 'pressure wave 2' in ParaView? Can you send me a screenshot?

kevinarden
Posts: 642
Joined: 25 Jan 2019, 01:28
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

They only way I have seen pwave2 is to use the fluxsolvers, I also changed it to direct instead of iterative and it does run faster.
pwave2.PNG
test.sif

panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

### Re: 2d simulation of acoustic wave propagation

I ran several simulations with Helmholtz equation (in 3d meshes though), with the same approach, and always got pressure wave 1 & 2. That's why it seems weird to me.

mika
Posts: 157
Joined: 15 Sep 2009, 07:44

### Re: 2d simulation of acoustic wave propagation

What I did say was that Paraview shows me a vector-valued variable "Pressure Wave" whose X-component and Y-component correspond to "Pressure Wave 1" and "Pressure Wave 2" referenced in the sif file. So I get neither "Pressure Wave 1" nor "Pressure Wave 2" directly. If one necessarily needs these names, one should be more specific in the sif file how the names in the vtu output are created. For example one may write a new solver section as

Solver 2
Equation = "result output"
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = "demo"
Vtu Format = Logical True
Save Geometry IDs = True
Show Variables = True
Scalar Field 1 = Pressure Wave 1
Scalar Field 2 = Pressure Wave 2
End

After changing Active Solvers list and running I can see the scalar variables "Pressure Wave 1" and "Pressure Wave 2". A screenshot of this is attached.

Basically the number of accurate digits in the iterated solution may be controlled by the keyword Linear System Convergence Tolerance, although there is a limit due to errors in floating-point computations. The only relevant question for the preconditioner is whether it's effective (makes the convergence fast to the desired stopping condition).

-- Mika
Attachments
demo.png