Acoustics - Large-amplitude Wave Motion in Air

Numerical methods and mathematical models of Elmer
Z.Losonc
Posts: 40
Joined: 21 Dec 2017, 16:05
Antispam: Yes

Acoustics - Large-amplitude Wave Motion in Air

Post by Z.Losonc »

Hi,

There is a solver called CompressibleNS, which is very briefly described as “Model 12 Large-amplitude wave motion in air” in ElmerModelsManual.pdf. Unlike in the Helmholtz solver, I don't see any possibility to define boundary conditions, nor excitation sources, except for a body force.

Am I missing something, or these features are really missing? A search for “CompressibleNS” in the “tests” folder didn't return any hits, so it looks like there is no sample project to demonstrate its usage either.

If the only excitation source that was intended for this solver is really a body force, then I suppose that would act like an oscillating acceleration acting on the whole fluid domain equally at the same time. Like shaking a closed container. Is this correct?

Is there any more explanation and/or sample project about this solver somewhere else?

The solver was also designed only for mediums that obey the ideal gas law. Would it be difficult to make a modified version to work with liquids as well? This could be very useful for large amplitude non-linear ultrasonics.

Zoltan
raback
Site Admin
Posts: 4801
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by raback »

Hi Zoltan

Dirichlet conditions are hanbled by the library so most modules should be able to take that as BC. What may be more severe shortcoming is the missing PML type of outlet condition.

Unfortunately this is not easily generalized to other material laws. The model is also computationally really heavy.

-Peter
Z.Losonc
Posts: 40
Joined: 21 Dec 2017, 16:05
Antispam: Yes

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by Z.Losonc »

Hi Peter,

In this first step approach I am not expecting a PML to be functional in the CompressibleNS solver; we didn't get that far yet. In fact, right now I would be satisfied even with having the only possible form of excitation to be the claimed body force. If only we could get even this setup to work.

We could try to simulate a completely closed tube, having acoustically hard walls with air inside. Let's shake this tube in x direction with a frequency of 343 Hz, and 1 N/kg body force. We can use the same mesh and start out using the same project that was posted as attachments in the 4th and 5th posts of this thread viewtopic.php?f=3&t=4916&start=0

I write all this in conditional tense, because I have tried to do that with no success. The model description in the ElmerModelsManual.pdf is simply not clear enough, and doesn't give sufficiently detailed information to make this possible.

Can you, or one of your developer colleagues show a sample sif file to demonstrate how this solver is used?

Otherwise we will have to put this idea of testing this solver on ice, because I have had a quite sufficient dose of frustration with Elmer already.

The reason for my interest in this solver is that very few open-source acoustic solvers deal with non-linear waves. At the same time there is demand for such solvers, even though the general public is not well informed about the (not very) new developments. People in general associate acoustics with the branch of science that deals with human hearing related waves, like loudspeakers, hearing aids, sirens etc. But acoustic waves can have 1e5 or even 1e6 times larger amplitudes in closed, pressurized resonators with properly designed shapes, than what humans could tolerate.

Such high amplitude waves can be utilized in acoustic compressors, for special treating of chemicals, for efficient power conversion etc. The major breakthrough in this field was made by Timothy S. Lucas in the early 1990-ies when he patented the process of Resonant Macrosonic Synthesis (patent: US 5,515,684), and demolished the earlier established scientific claim, that it is not possible to sustain acoustic waves in gas resonators with an amplitude greater than what the acoustic saturation allows. In straight tubes dispersion, caused by the non-linear nature of waves at high amplitudes, transform the harmonic waves into shock waves, and dissipate their power. Timothy's invention has overcome this barrier, and opened a whole new realm of possible innovative industrial applications.

The numerical simulation of such non-linear acoustics is done (mainly using custom written solvers) by different models, one of which is the Westervelt equation, and another is the compressible Navier-Stokes equation. I would like to check if this solver could be used for such a simulation, or perhaps the Helmholtz solver, by adding the non-linear term in the form of domain source to the right side of the equation.

Zoltan
Last edited by Z.Losonc on 05 Feb 2018, 20:27, edited 3 times in total.
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by mzenker »

Hi,

I am no acoustics expert, but I have the impression that you have advanced requirements to the acoustics solvers. If the existing solvers do not fit your needs, you are free to modify them or even write a new one. That is the beauty of Elmer being open source. ;)
You will find indications in the Solver Manual and in the Programmer's Tutorial. A look into the code of existing solvers can also help understanding how they work and how to use them. The Models Manual does not necessarily contain all features and keywords of each and every solver.

HTH,

Matthias
Z.Losonc
Posts: 40
Joined: 21 Dec 2017, 16:05
Antispam: Yes

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by Z.Losonc »

Hi Matthias,

Your impression is partly right, and partly wrong. For the sake of clarity let me explain briefly the reason for my taking interest in Elmer, and posting on this forum.

The attached pdf document describes a project that somewhat resembles our aim and illustrates the subject in more detail. The document is titled: “A survey on open source codes for computational acoustics” by Takuya OSHIMA (Niigata University) and Takashi Ishizuka (Institute of Technology, Shimizu Corporation). The most important point of their project in which we are also interested is stated in red (they are looking for open source acoustic codes):
“As academic platforms to share model developments and cases”

For our purpose, I am looking for a FREE open source FEM/BEM simulator for acoustic analysis, that could serve as a common platform for the group of interested private individual researchers (and hobbyists) to share their findings and simulations with the group openly and legally. This supposed to be free also in the sense that no extra modules, services, documentation, and information need to be purchased to make the free code perform at least the expected basic functions. It would be also preferred to use only one single solver platform for all acoustic problems, instead of many different software. This way the users will have to learn only one platform, and won't need to waste their time on studying many different tools.

Not everybody in the group can handle the subject at academic levels, to directly deal with the differential equations, and not everybody can write code to solve such equations. Even those who could do these things are reluctant to get lost in grinding the tool, because we want to focus on the main subject at hand, which is solving acoustic problems (and not the development of numerical solvers, which serve only as means to an end).

The acoustic platform supposed to have all the necessary features (boundary conditions and signal sources) generally used for linear acoustics. This is the part where your impression is wrong, namely we don't have advanced requirements for the Helmholtz solver. Features like perfectly matched layer, BCs of symmetry, and periodic conditions are not advanced requirements, just like the requirement of a 4th wheel for a decent car is not a luxury feature, for which one supposed to pay an extra fee to get (or make one himself).

However, in some cases the group will surely need advanced solvers, which can not be expected from free open source platforms. The Westervelt solver, and the compressible Navier-Stokes solvers are such cases for example. Here you are right, these are advanced requirements, and this is also the reason why I would be quite satisfied if we could at least get the CompressibleNS to work as it is, having only one possible way of excitation, to shake a completely closed container. If this would work, then it could be a motivation to build on it, and add more features later when needed.

The main reason for starting the available free code evaluation process with Elmer is that it was advertised to have a GUI, which would be preferred by everybody, to at least resemble a commercial code. This turned out to be of little use, so this claimed advantage has been lost. At the second step approach we would be satisfied to write a sif file, if there would be proper, accurate, and detailed documentation about its practical implementations. When this also turned out to be lacking (at least for the acoustic modules), and the claimed forum “support” is also reluctant and of little help, the expectations were further reduced to the level of “OK then, we could figure it out ourselves by experimentation and deciphering the source code”. We are at this point right now, and your comment of:
mzenker wrote: I am no acoustics expert, but I have the impression that you have advanced requirements to the acoustics solvers. If the existing solvers do not fit your needs, you are free to modify them or even write a new one. That is the beauty of Elmer being open source. ;)
becomes relevant here. Now the originally perceived advantages of Elmer acoustics (compared to other open source codes) have evaporated, and we are considering the option to indeed learn the structure of the Elmer code, and attack the problem at the level of programming. But this would demand quite a bit of time and effort investment into Elmer, and it makes sense to first asses the feasibility and economy of doing it. The beauty of being open source is not the exclusive property of Elmer.

The purpose of this post is to ask you and the development team to sell us (explain) the idea why it would be more beneficial for us to write code for Elmer, instead of doing the same for other open source codes, that are as competitive (if not more) at this level, as Elmer is.

Here is an example argument: if we have to write our own code, then why would it be more advantageous to do it in Fortran 90 for Elmer, rather than writing it in the higher level language of Freefem++ that would require fewer lines of code, and easier PDE solutions for all imaginable situations? But Freefem++ is not the only other option. There are several such free open source platforms that have been developed for the numerical analysis of PDEs. GetDP especially in combination with the GUI wrapper of ONELAB is another similar option. Or even the FEM library of Deal.II could serve as a viable platform at this level. But there are many more such alternatives, which will not be listed here.

To repeat the key question again at the end: Why would you recommend us (or anybody else for that matter) to write code for Elmer, instead for other open source competitive platforms?

Zoltan
Attachments
ossSurvey20090310.pdf.7z
(878.62 KiB) Downloaded 352 times
Last edited by Z.Losonc on 13 Feb 2018, 16:33, edited 1 time in total.
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by mzenker »

Hi Zoltan,

this would require a longer comment than I have the time to write right now. I might add it later today. But I will just try to give some brief elements of what I think about it.
First, to avoid misunderstandings, I am not part of the Elmer development team.
As I see it, Elmer's strength is its multiphysics capability. You can couple every set of solvers, at least in principle, and add you own if you need. That is why I chose to use Elmer almost ten years ago, since I do coupled electro-thermal simluations from time to time. In the field of multiphysics, I did not find another open source code which was comparable at the time. I did not search further since then, so the situation may have changed.
Another point: Elmer's computational power is (at least) comparable to commercial codes like Comsol or ANSYS in quite some fields.
Now I cannot judge how well Elmer performs in the field of acoustics. My feeling is that acoustics was not Elmer's main focus so far, but I may be wrong.
As far as the GUI is concerned, it has its weaknesses. But again, I do not know other open source multiphysics FEM codes which have a better one. And the GUI is configurable - you can build an interface for a solver just by creating or editing an xml file. Not every solver has such an xml file, and the existing ones may not contain all existing keywords for the solvers. But if you need it, you can change that rather easily.
As I wrote in another thread, I may come up with a tool that might become an alternative or complement to ElmerGUI, using the codebase of the Elmer plugin for Salomé. But since I do not have much time to spend on that project (which I do in my spare time), I cannot predict when this will be usable for the public.
But I still think that ElmerGUI is not that bad that it can be declared unusable. You can load a mesh, select solvers, declare boundary conditions, body forces, and initial conditions, configure material parameters, do solver settings, run the solver and launch a postprocessor. You can do a complete simulation without needing to write a single line of code or use the command line.
As far as sif file writing is concerned, there is quite some documentation available, above all the Models Manual, the Solver Manual, and the tutorials (including those without ElmerGUI). There are also many examples in the tests directory of the source distribution. And you can take a sif file written by ElmerGUI as starting point. There is some learning curve of course, but writing a sif file is not that hard and you cannot say that it is undocumented.
I think that there are many open source codes that are far less documented that Elmer. The Elmer documentation may not be complete for all solvers, but it is rather extensive.
As far as the forum support is concerned, I think that again it is better than for many other open source tools. Here you normally get an answer within a day. It may not always be fully satisfactory. But you have to be fair - this is not a commercial support, nobody gets paid to do it.

All that being said, if you have found a code that is better suited for acoustics and has a better support, documentation, and GUI than Elmer, you are free to use it for your project. By curiosity, I would be interested to know which one it is...

Hmmm, I initially wanted to reply just briefly... ;)

So this is my two cents. Someone from the Elmer team might provide a more complete answer.

Matthias
raback
Site Admin
Posts: 4801
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by raback »

Hi Zoltan,

I'll address this shortly. I think Matthias as a long time Elmer user nailed quite well the situation. The small core development team at CSC (Finland) is unfortunately not lucky enough to be able to pursue the development as purely altruistic project following the user feedback. It would be great if the user interface was better. Unfortunately there is no one paying for us to do it. The library functionality and different modules are typically pushed forward by some joined research projects, or sometimes even paid by industry. For example, it is not a big secret that the acoustic modules were part of collaboration with Nokia Mobile Phones and after the demise of that activity some modules were added to the open source publication.

I would fully agree that if you're a C++/python wizard it would make sense to choose a library that uses that language. Compared to some choices (e.g. freefem++, fenix) the implementation of your own equation does indeed require more coding in Elmer. We don't have the ability to directly write the weak form that looks almost like a mathematical equation. However, many equations already exist. The level of complexity needed for minor modification, or user defined function, for example, is not too hard. For non-coders it may be even easier than some C++ exercises. I have also had complements from some C++ wizards that Elmer library is actually quite user friendly. Few tens of lines of code for fully generic advection-diffusion-reaction equation ready to utilize a wide selection of element types and to go massively parallel is not too bad. We also try to be rather stable. There are hundreds of consistency tests and we value highly backward compatibility. Hence, if you build your own workflows they are more or less guaranteed to work also in the future. This may not always be the case with more academically rooted packages.

Also there are great open source packages coming from industry, for example Code Aster and Code Saturne from EDF that embrace stability even more. If you want to have extreme verification you will be happy to know that they follow strict processes in order to compute things related to the nuclear industry. However, if you want to have some modifications made to such codes that may be rather hard. In Elmer we are open to contributions from the community. Communities may even have their own fully independent "sandbox" that uses Elmer library (Elmer/ICE).

I would think that Elmer is rather good in how well it handles different physical equations as modules. This is the reason that the same code can be used a wide variety of problems. Elmer is certainly not among the most advanced codes for structures, or even for fluids, but it may be very good choice for fluid-structure-interaction. Currently the strongest communities are in computational glaciology and computational electromagnetics. Certainly there is a good starting point also for acoustics. Prior to this the acoustics community just hasn't been too active. It is the community that really takes the code to the next level. We at CSC embrace all application areas but our time is mainly spent with those that have active project portfolio. Probably many of your complaints could be resolved quite quickly if this was in focus.

-Peter
Z.Losonc
Posts: 40
Joined: 21 Dec 2017, 16:05
Antispam: Yes

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by Z.Losonc »

Hi,

Thanks for your opinions. Peter's input was close to what I was expecting from him, but Matthias wrote an outright commercial. Matthias, you might indeed not be part of the Elmer development team, but you obviously have a very strong interest in the spotless reputation of Elmer (which is confirmed by many of your other posts as well). ;-)
Therefore, it is meaningless to continue this subject, so I will just leave it as it is.

Let's return instead to the original subject of this thread. After lots of fiddling, trial & error, finally I have succeeded to get the CompressibleNS solver to work. However, the results look to me unrealistic. The physical parameters of air were used in the sif file, but the speed of wave propagation is weird. It is not being set by the “Sound Speed = 343” input parameter as it is done for the Helmholtz solver, but apparently it depends very strongly on the “Bulk Viscosity”. This would not be a problem so far; the entered physical parameters determine the speed of wave propagation. But when this viscosity is increased, the speed of sound rises, and vice-versa. If this bulk viscosity is set to 0.635, which supposed to be valid at 50% relative humidity in air, then the speed of sound is too small, about 18 m/s. Using the bulk viscosity value of 944, which corresponds to 0% R.H. the speed of sound seems to be around 2800 m/s, which is unrealistically huge.

Here are the material properties:

Code: Select all

Material 1
  Name = "Air (room temperature)"
  Heat expansion Coefficient = Real 3.43e-3
  Heat Conductivity = Real 0.0257
  Equilibrium Density = Real 1.205
  Equilibrium Temperature = Real 293.0
  Specific Heat = Real 0.718
  Specific Heat Ratio = Real 1.401
  Viscosity = Real 1.81e-5
!  Bulk Viscosity = Real 944
  Bulk Viscosity = Real 0.635
!  Bulk Viscosity = Real 1.4e-5
End
Does anybody have any idea what might be wrong?

Zoltan
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by mzenker »

Hi Zoltan,
Z.Losonc wrote:... Matthias wrote an outright commercial. Matthias, you might indeed not be part of the Elmer development team, but you obviously have a very strong interest in the spotless reputation of Elmer (which is confirmed by many of your other posts as well). ;-)
Therefore, it is meaningless to continue this subject, so I will just leave it as it is.
well, I did not mean to write a commercial, I just pointed out that IMO Elmer is not as bad as you perceive it, and that I would be curious to know which open source software you would prefer over Elmer in terms of documentation, GUI and support.
It may also be a question of personal taste... ;)
Z.Losonc wrote: ... If this bulk viscosity is set to 0.635, which supposed to be valid at 50% relative humidity in air, then the speed of sound is too small, about 18 m/s. Using the bulk viscosity value of 944, which corresponds to 0% R.H. the speed of sound seems to be around 2800 m/s, which is unrealistically huge.
...
Does anybody have any idea what might be wrong?
I suppose that, given your expertise in acoustics, you are sure of the bulk viscosity values you use. But I am surprised nevertheless that it varies by a factor of ~1000 when humidity goes from 0 to 50%...

Matthias
Z.Losonc
Posts: 40
Joined: 21 Dec 2017, 16:05
Antispam: Yes

Re: Acoustics - Large-amplitude Wave Motion in Air

Post by Z.Losonc »

Hi Matthias,
mzenker wrote: I suppose that, given your expertise in acoustics, you are sure of the bulk viscosity values you use. But I am surprised nevertheless that it varies by a factor of ~1000 when humidity goes from 0 to 50%...
I am not that very sure about the accuracy of these values either, because I have never actually measured it myself. So we have to take the word of those who did that, or derived analytical equations for this parameter. When I have first sought these values, found it weird how difficult it was to find the data online. As if this would be an extremely obscure information, intentionally buried. Anyway, here is a reference from which the mentioned parameter was used (Volume Viscosity = Bulk Viscosity = Second Coefficient of Viscosity = Dilatational Viscosity):

“Variational Approach to the Volume Viscosity of Fluids” by Allan J. Zuckerwar

For numerical values see page 047101-8 in the attached document. If you know of a better, more reliable source of this parameter, please let me know.

Zoltan
Attachments
Volume or Bulk Viscosity of Air.pdf
(180.82 KiB) Downloaded 322 times
Post Reply