2d simulation of acoustic wave propagation
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 donothing BC (the default BC which is equivalent to giving Wave Flux i = 0, i=1,2) should be applied.
 Mika
 Mika

 Posts: 471
 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.
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:
which should be the right way to do it.
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
 Attachments

 units.PNG (2.07 KiB) Viewed 158 times
Re: 2d simulation of acoustic wave propagation
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).mika wrote: ↑14 Jan 2020, 12:39The 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 donothing BC (the default BC which is equivalent to giving Wave Flux i = 0, i=1,2) should be applied.
 Mika
 Attachments

 finer_mesh.PNG
 (168.98 KiB) Not downloaded yet
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'
EDIT: Also, I still get only 'pressure wave' in my vtu file (in ParaView), instead of 'pressure wave 1' & 'pressure wave 2'
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
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
Re: 2d simulation of acoustic wave propagation
So, does it mean I can't trust the results I get with ILUT?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.
You mean, you get both 'pressure wave 1' and 'pressure wave 2' in ParaView? Can you send me a screenshot?

 Posts: 471
 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.
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.
Re: 2d simulation of acoustic wave propagation
What I did say was that Paraview shows me a vectorvalued variable "Pressure Wave" whose Xcomponent and Ycomponent 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 floatingpoint computations. The only relevant question for the preconditioner is whether it's effective (makes the convergence fast to the desired stopping condition).
 Mika
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 floatingpoint 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
 (265.68 KiB) Not downloaded yet