## Simple Pipe Acoustics - the very basics

Numerical methods and mathematical models of Elmer
JoeD
Posts: 10
Joined: 30 Jun 2017, 10:47
Antispam: Yes

### Simple Pipe Acoustics - the very basics

Dear Elmer Community,

First of all thanks to all who have created, published, and support this software. It has got an unbeatable advantage, which is being open source; special thanks for that.

I am a beginner Elmer user and have some newbie questions, first relating to acoustics. I hope that this thread will also help other newbies later to get up to speed, and figure things out.

The presented test case attempts to simulate the sound propagation within a 1 m long pipe of 0.1 m diameter filled with air, having acoustically hard walls. The input and output openings are matched boundaries to avoid reflections. At the input we have an incident plane wave of p0=100 Pa amplitude.

I have tried several combinations of boundary conditions, but don’t seem to be able to get the expected results (which comes forth with no headache in Comsol). The closest solution to the expected is obtained when the input is defined using the effective value of the pressure peff=70.71 as:
pressure Wave 1 (real part): 70.71068
pressure Wave 2 (imag part): 0

and the output impedance to be identical with the speed of sound c as:
real part of impedance: 343
imag part of impedance: 0

With such setup we get the complex pressure amplitude results:
p1_0=70.71
p2_0=70.6308

The instantaneous pressure is calculated according to formula (9.3) in the ElemerModelsManual.pdf:
p=p1_0*cos(om*t)-p2_0*sin(om*t).

When this result is plotted in excel, the p0 amplitude within the pipe is indeed 100 Pa as expected, but its phase is shifted by 45 degrees compared to the input pin=100*cos(om*t).

There is quite a bit of confusion here, because in order to avoid reflections at the output we supposed to create there a matched impedance BC which according to my understanding is rho*c=1.205*343. But if I use that in Elmer, then the results are worse than in this simulation using z=c. Therefore it is not clear whether there are any reflections or not and why. If z=c is the correct setting then why is that? Why not z=rho*c (which is the correct setting in Comsol)?

Let’s assume for now that z=c setting is the one to be used as matched boundary. Then that means there should not be any reflected waves and the p as calculated above must be the unaltered input wave that propagates from left to right on x axis having the original amplitude of 100 Pa. But then I don’t understand why is it shifted 45 degrees to the left relative to the expected pin?

In order to illustrate the input and result wave pattern relationships the attached excel document plots all components:
p1-amplitude of Elmer result complex pressure real part
p2-amplitude of Elmer result complex pressure imaginary part
ps-sum of the two complex pressures which represents the instantaneous pressure p
pR-the original input signal propagating from left to right
pL-the required reflected wave (in order to obtain the Elmer result ps from pR input) that propagates from right to left back from the output
The x axis is in om*t degrees in reverse order, because it represents the spatial propagation when the phase angle decreases in the direction of propagation.

Is it correct that the input pressure should be an effective pressure and not its amplitude?
The project folder has been also attached in a zip file for those willing to take a look at it.

If anyone could clarify what I am doing wrong, and how to obtain the expected result, I would be thankful.

Joe
Attachments
Complex pressure visualization 1.xls
C V T - P.zip

raback
Posts: 3670
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Simple Pipe Acoustics - the very basics

Hi

The initial implementation of Elmer assumes that density is constant and eliminates that. Hence also impedance is divided. If there are multiple densities they should nowadays be used.

Comsol probably uses internally always 2nd order elements. That should be considered when comparing. Cannot comment about the 45 degs.

Elmer has been used in the design of the acoustics in some mobile phones many years back and has been tested for some standard test cases.

-Peter

JoeD
Posts: 10
Joined: 30 Jun 2017, 10:47
Antispam: Yes

### Re: Simple Pipe Acoustics - the very basics

Thanks Peter for your input. I have nothing against leaving out density form impedance, as long as I know that it is correct to use it that way. Unfortunately I have not seen that clearly stated in the manual (or I have missed it), that is the reason for the confusion.

Is it also correct to use effective pressure values at the input instead of amplitudes?

Well, the major problem was the unexplained phase shift. In some applications the phase relationships are extremely important, like for example the analysis of two wave guides coupled by a hole, or when designing directional couplers. Therefore, I have to find the solution to this problem, or otherwise Elmer can not be used in these cases.

If anybody finds the solution, please chime in.
Thanks.

Joe

JoeD
Posts: 10
Joined: 30 Jun 2017, 10:47
Antispam: Yes

### Re: Simple Pipe Acoustics - the very basics

There is a mathematical rule that says:
p1*cos(om*t)+p2*sin(om*t)=p0*sin(om*t+phi)=p0*cos(pi/2-om*t-phi)= p0*cos(om*t+phi-pi/2)
p0=sqrt(p1^2+p2^2)
tan(phi)=p1/p2

If we want the phase shift of the sum p to be identical with the input signal of pin*cos(om*t) which is 0, then phi-pi/2 must be equal 0. With other words phi=pi/2, or p2=0 & p1>0.

Since the imaginary component of the pressure in the Elmer results must be zero (which it is not), this leads me to the conclusion that the results and solution is incorrect. The only proper solution would be if we would get p2_0=0, and p1_0=100 (or if the output results must be also interpreted as effective values like the input then p1_eff=70.71).

If I am missing something, or made a mistake, please let me know.
Any idea how to get p2_0=0, and p1_0=100 result?

Joe

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

### Re: Simple Pipe Acoustics - the very basics

Hi,

It seems to me that Elmer produces results which are in agreement with what is specified in the sif file while I don't understand how they are interpreted to be incorrect. The instantaneous pressure p(x,t) reproduced from the complex-valued Elmer solution P(x) is a function of place x and time t so that

p(x,t) = Re[P(x)] cos(w t) - Im[P(x)] sin(w t)

Setting the source BC as

Pressure Wave 1 = 70.71
Pressure Wave 2 = 0

is expected to produce a wave of amplitude 70.71. If I solve the case with Elmer and then take the place x to be a point on the end where the source is given, the Elmer solution at the end appears to behave as

p(x,t) = Re[P(x)] cos(w t) = 70.71 cos(w t)

since Im[P(x)] = 0 and Re[P(x)] = 70.71 are correctly set by Elmer.

Best regards,
Mika

JoeD
Posts: 10
Joined: 30 Jun 2017, 10:47
Antispam: Yes

### Re: Simple Pipe Acoustics - the very basics

Hi Mika,

Thanks for your comment. You wrote “I don't understand how they [the Elmer results] are interpreted to be incorrect.”

It is quite simple; please download the Elemer project folder C V T - P.zip file from the attachment of the first post, unzip it, and run the simulation. You will see that for an input:
pressure Wave 1 (real part): 70.71068
pressure Wave 2 (imag part): 0

You will get a result:
p1_0=70.71 (real part)
p2_0=70.6308 (imaginary part)

As you can see Im[p(x)] in the Elmer solution is NOT equal to zero. Im[p(x)]=p2_0=70.6308.
If you want to calculate the instantaneous pressure at the input where x=0 then it can be done with the quoted formula p=p1_0*cos(om*t)-p2_0*sin(om*t).

At x=0; t=0; p=70.71 and you would think that this is the amplitude of the wave, but that is not correct, it is not the amplitude, but it is just an instantaneous pressure at t=0, x=0. We want to know the amplitude of the wave that propagates in the guide, and also its phase.

At x=0; t=-pi/(4*om); the phase angle is om*t=-pi/4; and the instantaneous pressure is:
p= p1_0*cos(-pi/4)-p2_0*sin(-pi/4).
p= p1_0* 0.7071-p2_0* (-0.7071)
p= 70.71 * 0.7071+70.6308* 0.7071
p=99.94207968 which is close to100

This is the amplitude of the wave, and the phase angle is -45 degrees. We want a100 Pa amplitude with a phase angle of zero (not -45 degrees). The only way to get that is to have p2_0=0, but Elmer does not give this expected (and only accurate) result.

If you want to visualize the amplitude and relative positions of the wave components along the x axis, please download the Complex pressure visualization 1.xls file from the first post and view it in excel.

Best regards,
Joe

Organ_Mark
Posts: 5
Joined: 26 Oct 2017, 22:59
Antispam: Yes

### Re: Simple Pipe Acoustics - the very basics

Hello JoeD and thank you for starting this thread. I found it because I also I interested in using Elmer for acoustics. I read through the discussion you had with mika. And I ran your files myself. I got results that I expected however you did not get reults you expected. If you are still at a quandary about the problem, please let me know and I will try to post more details.

Thank you for posting your example. It will help me do my project.

Mark

JoeD
Posts: 10
Joined: 30 Jun 2017, 10:47
Antispam: Yes

### Re: Simple Pipe Acoustics - the very basics

Hi Organ_Mark,

After a long inactivity on this thread I have lost interest in following it, which is why I reply with so much delay. But I am still very much interested in getting the solver to give the expected results.

If you have found the solution to the described problem, then by all means please post it here and explain it in detail.

Best regards,
Joe

raback
Posts: 3670
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Simple Pipe Acoustics - the very basics

Hi

Indeed the solution for the Helmholtz equation could in principle be purely real valued. However, the minute you request impedance boundary conditions, i.e. eq. (10.2) in Elmer Models Manual you bind together the real and imaginary components. The only solution for which the impedance condition would not have a complex component is all zero. Hence the system must have both components present everywhere.

-Peter

JoeD
Posts: 10
Joined: 30 Jun 2017, 10:47
Antispam: Yes

### Re: Simple Pipe Acoustics - the very basics

Thanks Peter for confirming my conclusions that the solver gives wrong results.

Now that we are sure about this fact, the next step would be to contact the people who coded the solver and ask them to kindly fix the bug. I don't know who needs to be contacted. Perhaps if you Peter know them, could you please convey our humble requests to give this issue some attention?

I was thinking about taking a look at the source code myself and try to fix it, but I am not familiar with the programming language and it would take too much time and effort to learn it just for this case. It is much more economical and productive if the people who wrote the code could do the debugging (with much less effort).

If this issue gets resolved then I can create several test cases/tutorials, compare the results with commercial software, and publish the projects to help other beginners as well. There is very little documentation and few published projects in Elmer acoustics. I could contribute in this regard, but only if the programmers get the solver to work properly.

Joe