2d simulation of acoustic wave propagation

Numerical methods and mathematical models of Elmer
panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

Hi mika,

By 'pressure wave 1' and 'pressure wave 2' I mostly mean Real and Imaginary part of pressure, so then I can visualize different things like absolute value etc. So then, what does 'pressure wave' represent in the .vtu file? The absolute value of pressure?

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

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

mika wrote: 14 Jan 2020, 17:49 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.
Still struggling to get my results matched with Comsol. Maybe MUMPS will solve my problem. Do you know how to build it with Elmer?
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: 2d simulation of acoustic wave propagation

Post by raback »

Hi

Note that if the field is saved as a vector then Paraview will by default show its "Magnitude" as colour. You can always choose by its components. Then "X" would refer to Real component and "Y" to Imaginary. The selection is just right from the pull-down bar where you chose the "Pressure Wave".

Paraview does not, as far as I know, have any special support for complex fields. Hence the choice to save the complex fields as two-component vector fields.

Note that MUMPS will not help you here unless the problem was convergence of linear system.

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

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

My system definitely doesn't converge for 40kHz with ILUn, only with ILUT. And when it does, most solutions I get are completely different than the ones I get from Comsol and Matlab. So, I'm wondering if there are any mistakes in my code or I just can't deal with the fact that conditioners in Elmer are weak for frequencies that high.
panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

Another thing I'm curious to know is why my results for a specific set of phases, that create a pressure focus in the center between the arrays of transducers, match Comsol pretty well (see img '40kHz_center.png'). Same happens if I put zero phase to all transducers (see '40kHz_zero_phase.png'). However, for a focus anywhere else in the space between the arrays my results are nowhere near to what they are supposed to be (see '40kHz_random.png). Here is the code snippet for adding phases to the boundary surface of each transducer:

EDIT: This is the correct code

Code: Select all

Boundary Condition 1
	Target Boundaries(1) = 2
	Name = "TD1"
$ p0 = 1.0
$ k = 1.0
	Pressure Wave 1 = Variable Coordinate
		Real MATC "p0*cos(k*tx(1) + phases(0))"
	Pressure Wave 2 =  Variable Coordinate
		Real MATC "p0*sin(k*tx(1) + phases(0))"
End
Where phases is an array of 32 different phases in rad. So phases(0) corresponds to the first transducer on bottom left position, phases(1) to second etc. I've used ILUT for this one.
Attachments
40kHz_zero_phase.png
40kHz_zero_phase.png (413.76 KiB) Viewed 3769 times
40kHz_random.png
40kHz_random.png (506.71 KiB) Viewed 3769 times
40kHz_center.png
40kHz_center.png (527.46 KiB) Viewed 3769 times
Last edited by panosvar on 21 Jan 2020, 19:32, edited 1 time in total.
panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

Anyone?
mika
Posts: 230
Joined: 15 Sep 2009, 07:44

Re: 2d simulation of acoustic wave propagation

Post by mika »

Are you sure about the coordinate dependence in the MATC expression? When the dependence is on the coordinate variable, the following correspondence holds (note that the first index is 0): tx(0) = x, tx(1) = y and tx(2) = z. Now you define the dependence on the z-coordinate which is zero everywhere, since the simulation is in 2D.

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

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

I posted an old block of code, now re-edited the previous post. Indeed, I pass only the x(1)'s in my code. So, this is correct I think. The thing that I'm not sure though, is how I input the phases in the pressure equation. It just doesn't make sense that my simulation is ok for zero phases and phases that create a pressure focus in the center of my structure, but for other combinations of phases it's not even close to Comsol.
panosvar
Posts: 74
Joined: 29 Oct 2019, 16:02
Antispam: Yes

Re: 2d simulation of acoustic wave propagation

Post by panosvar »

From what I've seen in my Comsol simulation, it uses MUMPS solver. Is there anyway I can install this alongside Elmer?
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: 2d simulation of acoustic wave propagation

Post by kevinarden »

You can install the virtual machine for elmer and its included, or use linux and it is included.

Elmer VM and Windows builds, www.nic.funet.fi/pub/sci/physics/elmer/bin/

otherwise you might have to use winmumps if you are on windows.
Post Reply