Ways to define domains in *.msh files

Dear community,

i am interested to simulate acoustical radiation from a horn.

I can model the horn (based on formulas / in a parametrical manner) and the membrane independently and covert it form point clouds to a mesh (*.stl) using meshlab.

In the following example a speaker was modeled with the parametrical gmsh interface and certain areas were defined with certain “domain indices”. Those indices are used later in the code to define the sources.
At the same time on the whole grid (membrane and horn) the function spaces get defined:
spaceP = bempp.api.function_space(grid, “P”, 1)
spaceU = bempp.api.function_space(grid, “DP”, 0, segments=[2])

bempp-acoustic-tutorials/tutorials at main · mscroggs/bempp-acoustic-tutorials · GitHub → Example 5 and the geo/mesh files file

I can not use this gmshgeometry interface because of the special form i want to simulate. Merging the two meshes manually in gmsh is not working reliably. GMSH is changing indices by its self and some parts of the mesh “vanish” for no reason sometimes. Aditionally, I want to create an “automated” simulation chain in python, so no manual “merging” is allowed.

My questions:

  1. Can i import the two meshes individually and merge them in python / bempp enviroment?
  2. Can i afterwards assign the finction spaces to multiple meshes including the boundary conditions?
  3. Do the membrane and horn need to be connected (numerically), meaning the membrane-cirmumference points are exactly the same as the horn entry circumference points?
  4. Less elegant / unified → Is there a way to merge the meshes with a command line command with meshio/gmsh or bempp?

From the gmsh, meshio or bempp documentation i can not find any hint on how to do this efficiently but at the same time i do not think that my requirement is so special, that the framework can not handle this. So any help is highly appreciated :slight_smile:

Thanks a lot!

Tobi

Sorry, forgot to upload the impressions from the horn and membrane (sitting in the middle of the horn).

For anyone out there having the same problem:
There is a function doing that for you →

grid_h = bempp.api.import_grid(‘test\Horn.msh’)
grid_m = bempp.api.import_grid(‘test\Memb.msh’)

grid = bempp.api.grid.grid.union([grid_h, grid_m], [1,2])

Help on function union in module bempp.api.grid.grid:

union(grids, domain_indices=None, swapped_normals=None)
Return the union of a given list of grids.

Parameters
----------
grids: list
    A list of grid objects.
domain_indices : list
    Attach a list of domain indices to the new
    grid such that grid[j] received the domain
    index domain_indices[j]
swapped_normals : list of boolean
    A list of the form [False, True, ...],
    that specifies for each grid if the normals
    should be swapped (True) or not (False). This
    is helpful if one grid is defined to be inside
    another grid.

This method returns a new grid object, which is
the union of the input grid objects.
2 Likes

Thanks for sharing your findings. Do you have any results that you can share with regards to this experiment? Appreciated!

Hi SpeetPeet,

yes, i did implement a few different horn shapes and played around a little bit.

What i found so far:

  1. When using a volume “behind” the driver (as it is the case in every speaker and in the example) even when closed there is a problem when resonances occur inside that volume. Usually those cases are managed by CHIEF points as far as i know, but those are not implemented here. I decided to go for a very tiny volume so no resonances can occur.
  2. Results seem reasonable, computing times as well
  3. With point 1) there is always the “back of the horn” exposed, because it is only a thin shell. I expect influences here.

This is one of the results the beam pattern in horizontal and vertical plane of an eliptical JMLC horn with 1.5kHz and 1kHz cutoff frequency.

grafik

In the next steps i will manufacture some horns and measure them to learn more about the performance :slight_smile:
Kind regards, Tobi

Hi Tobi!

Those are some nice results. Compliments on your work! I like the radiation and normalized radiation “spinorama” plots in both planes.

I’ve got experience in simulating horns in ABEC, however looking into transferring to BEMPP as ABEC does not allow for easy automation nor customisation. I can share some of our experiments and builds in case your interested.

Would you mind sharing (parts of) your code of your experiments?

Cheers!

Piet