Category Archives: Python

Room modes in 3D using sketchup and FEM

In this post, I'm examining the low frequency response of my living room. I'm going to compare it to a theoretical model obtained using FEM and see how much useful information FEM gives me.

I'm going to do the following:

  • Model the room using sketchup
  • Import it into python
  • Place the subwoofer in the corner
  • Calculate the response at the listening position using FEM
  • Measure the real response at the same position and compare it with the result of the model

The setup

My living room

My living room

My living room has two open doorways without a door, which means that the geometry will usually be like the one to the left (with all other doors closed). I was really curious as to what the effect of the two "chambers" (the entryway and the kitchen) have on the response of the room.

FEM

The mesh

The mesh

I divided the model into tetrahedrons using MeshPy, resulting in the figure you can see above. The mesh is quite coarse, but dense enough for the purpose. In addition, I used linear elements. The room modes took about a second to calculate once the mesh was done (with the meshing only taking a few seconds), which I found impressive.

I added a tiny amount of damping to the system and assumed that the boundaries were perfectly rigid.

The measurement

I recorded the signal in the middle of the room and applied the popular exponential sine sweep technique by Farina.

The results

The rigid assumption resulted in the resonant response being slightly "higher up" as compared to the measured one. Still, I find the correlation between the responses below 100 Hz fantastic. Apparently there are some details above 100 Hz which should be taken into account (probably furniture, and also less damping), but below 100 Hz there are a lot of similarities. Additionally, I'm thinking that the mesh with linear elements might not be dense enough for over 100 Hz. The speaker I used has a poor response below 50 Hz, so the sharp peaks there were regrettably not visible in the measurement. Note that I wasn't really measuring the response at 170 dB 🙂 .

plot

The modes

I tried a few different techniques to visualize the modes, and found it surprisingly difficult to get a nice looking result.

Using iso surfaces in mayavi resulted in a result I think looks decent. Here's the mode representing the peak you can see at about 50 Hz, with the surfaces showing constant pressure values. As you can see, the whole room is actively participating in the mode.

Mode at ~50 Hz

Mode at ~50 Hz

Another interesting mode is the lowest mode at ~20 Hz. It's far lower than one would estimate using just the rectangular part of the room (37 Hz). It's fascinating how the gradient of the pressure field goes from one chamber to the other.

Lowest mode at ~20 Hz

Lowest mode at ~20 Hz

Conclusion

The living room seems to be a prime example of a room where FEM gives very nice results. I would argue that there would be absolutely no point in trying to deduce the lowest modes from the rectangular dimensions of the room, when the real room modes are so specific to the whole geometry. This analysis is also really quick to do, so it doesn't add that much extra time to a project.

Vibration isolation of a plate

The topic of this blog post is one I started thinking of when a friend of mine presented the idea of whether the flexibility of a relatively thin concrete plate affects the response of a vibration-isolated foundation. In other words: should the behaviour of the plate in itself be taken into account in a situation like the one described here (without taking into account any possible other objects attached to the plate itself)?

Well, let's do some testing.

The setup

The dimensions of the plate

The dimensions of the plate (whoops, t should be 8 cm)

These are the dimensions of the plate. The vibration isolators are chosen to be 10cm x 10cm & have a uniform dynamic stiffness of E = 3 \mathrm{MPa} and a thickness of t = 2.5 \mathrm{cm}. The values I chose from concrete are \rho = 2.5 \mathrm{kg}/\mathrm{m}^3 and E = 27 \mathrm{GPa}.

A cool gif

Steady state response / sine sweep

Steady state response / sine sweep

What you're seeing above is basically the result of a sine sweep on a damped system, where a sinusoidal force is placed at 20% from the outer right corner of the plate. So, we have a point force with a constant amplitude and a specific frequency attempting to vibrate the plate.

Note that the deformations are waaaayy exaggarated throughout this post.

One can clearly see that the deformation gets smaller as the frequency increases. Thus, a smaller portion of the exciting force is transfered to the foundations. Also note that in the beginning, mostly one corner vibrates but as we approach the modes at ~36 Hz (the modes will be shown later in this post) the plate starts to pivot/swing around the middle axis. So we're moving from a mix of modes 1 and 2/3 towards modes 2/3.

Some theory

Starting from \mathbf{M}\ddot{x} + \mathbf{C}\dot x + \mathbf{K} x = \mathbf{f}, I solved the dynamic system (-\omega^2\mathbf{M}+{i\mkern1mu}\mathbf{C}+\mathbf{K})\mathbf{x}=\mathbf{f} describing the steady state solution with a sinusoidal excitation. I used python, and obtained the mass/stiffness matrices using finite element analysis. The eigenfrequencies are calculated using regular analysis (from \textbf{M}^{-1}\textbf{K}).

The Mindlin–Reissner plate theory with bilinear elements was used for the plate. Also, I used regular spring elements lumped at the nodes for the vibration isolation (vertical shear deformations of the isolators are not central at the lowest frequencies). For the damping matrix, I used rayleigh damping with nothing but the stiffness matrix-related term with a value of 0.0075. I applied the damping directly to the global system.

Only vertical movement is taken into account here.

The eigenmodes & resonant frequencies

Alright! What are the lowest frequencies the system will resonate on? Or, to put it another way, what are the lowest eigenmodes, and the corresponding eigenfrequencies? The lowest mode corresponds to the one obtained from the formula for a mass-spring systemf_0 = \frac{1}{2 \pi}\sqrt{\frac{k}{m}}, which in this case gives f_0 = 22.85 \mathrm{Hz}.

Mode 1 @ 22 Hz

Mode 1 @ 22 Hz

Mode 2 @ 36 Hz

Mode 2 @ 36 Hz

Mode 3 @ 37 Hz

Mode 3 @ 37 Hz

Mode 4 @ 188 Hz

Mode 4 @ 188 Hz

Mode 5 @ 201 Hz

Mode 5 @ 201 Hz

The response of the system

How well does this system perform? What are the effects of these modes?

First, let's try placing the force in the absolute middle. This would be the ideal case, when we can be sure that everything works as well as it can. Let's also, to begin with, consider an undamped system. Note that concrete in itself definitely has some structural damping, so the response is by no means correct here:

Centered force, no damping

Centered force, no damping

Alright! We can see a sharp peak at around mode 4. Mode 5 isn't visible, as the force in the absolute middle has no way of waking it up. Note that we're examining an undamped system here, so this is something which would happen if the concrete in itself wouldn't dissipate energy at vibrations around ~200 Hz (which it in reality does).

Ok then! What happens if we add some damping to the system? Let's also apply the same kind of damping to the isolating pads.

Center force, with damping

Center force, with damping

Suddenly we can see that the mode at around 188 Hz vanishes completely. This is because the type of damping we added affects higher frequencies quite a bit. I chose a coefficient which very roughly should correspond to the damping behaviour of concrete, but I did not do any thorough research here so please note that the resonance could in reality very well be somewhere between the two previous figures. Still, the results seem to very strongly indicate that the mode at around 188 Hz shouldn't be visible in a situation like the one described here.

Ok then! Let's try moving the force a bit. Let's move it so it's 20% from both sides. First, let's examine the case without damping. What does the response look like now?

Noncentric force, no damping

Noncentric force, no damping

Apparently the force is situated in such a place that mode 4 isn't really excited. Instead, we can see that mode 5 is clearly visible.

Once again, let's see what happens when we add some damping.

Noncentric force, with damping

Noncentric force, with damping

We can see that only the three first modes seem to affect the result. Still, I'd say that it's really important to notice that the first three modes actually affect the result quite a bit. This is also clearly visible in the animated gif at the beginning of the post.

Conclusion

The modes of the plate in itself are very central when the structure in itself doesn't have strong damping characteristics. This would be the case if the plate was made of steel, for example. If the plate is made of homogenous concrete (no rebar is taken into account here), the results strongly indicate that only the modes where the structure can be assumed to act as a rigid body seem to affect the result.

Thus, in a case like the one above, it should be enough to consider the plate as a perfectly rigid structure. Still, the results strongly indicate that if the excitation isn't perfectly centered, other modes than the lowest one can have a strong effect on the performance of the isolating system. Also, if there is reason to suspect that the modes of the plate in itself aren't damped, it might be useful to examine them as part of the system.

Simulating cymatics

Due to popular demand I put the source for the script I used here up to github: https://github.com/kai5z/Chladni-patterns

I was browsing around youtube when I stumbled upon this nice video on Chladni patterns (there are quite a few there). Here's the video, it's apparently part of some demonstration for students:

Cymatics

Sound propagates in solids, similarly as to how it does in air. If we were to slow down the plate in the video above, we would see it vibrating at the frequency of the sound you can hear being played (check another post of mine).

Just as is the case in air, standing waves can form in solids. In solids, the details are quite different, but the basic principle holds. When a standing wave forms, there are locations where the amplitudes of the vibrations have their maximum values, and locations where the amplitudes of the vibrations are very close to zero.

Here's a gif with exaggerated deformations to illustrate how the circular pattern you can see in the beginning of the video forms:

Chladni pattern formation

Chladni pattern formation

Imagine placing a lot of small particles on the surface in the image. The particles would be tossed around, until they finally find a resting place close to the red circle. This is how all of the patterns are formed, but the way the plate vibrates varies with frequency.

Simulating cymatics

The experiment setup is very clearly defined; a rectangular steel plate is clamped in the middle. This makes for a perfect case to test out some finite element analysis of plate structures!

I used steel as the material of choice for the simulation and Reissner-Mindlin bilinear plate elements, with a lumped mass matrix. I programmed the simulation using Python. By tweaking around with the material properties and dimensions, I managed to roughly match the frequencies to the experiment from the first video. I think it's really cool how the simulation matches the patterns you can see in the video (up until a point where it's apparent that there are some asymmetries in the setup).

I made a gif out of the video too, just for the hell of it.

You might have noticed that there are a whole lot of patterns there, which aren't visible in the video. The standing waves which create the patterns form much more strongly when the frequency is closer to the modal frequencies of the plate (when the plate resonates). The following plot roughly shows these resonant frequencies. The y-axis doesn't really mean anything significant here, so just pay attention to the peaks. Also, damping hasn't been taking into account here, making the peaks unrealistically sharp. When the excitation frequency is close to one of those peaks, Chladni patterns should be clearly visible.

mag

Discussion

The frequencies these patterns form on depends completely on the material properties and dimensions of the plate, if we assume that the basic setup is the same (a rectangular plate is clamped at the middle). There are a lot of structures which can be analysed in a similar way (albeit with a more complex analysis for applicable results): floors, windows, doors, the list goes on and on. In this case, the results were very consistent with the video as the physical problem was very clearly defined.