As simulation software gets more and more advanced and includes new functionality with each update, the users can often get by with never really thinking about the actual implementation of the physics and boundary conditions. As long as the user has what he or she needs, then there might not be much reason to look under the hood. But there are instances where it is very advantageous to understand the underlying mathematics in your simulation software package, and one such case is discussed here.

The weak form and its application in simulations have been described in several COMSOL Blog posts (__https://www.comsol.com/blogs/tag/weak-form/__), but here we will focus on the weak form from an industry point of view, and how it can be very advantageous to understand the formulation in at least some detail.

We will look at the particular example of a weak form boundary condition, but for weak form PDEs the process is very similar.

__Boundary Layer Impedance (BLI) Model__

In microacoustics there are many models to choose from. Some include the microacoustics effects in a standard acoustics domain with modified density and bulk modulus, some include microacoustics modified boundary conditions, and some require entirely different underlying PDEs than for standard acoustics. For the boundary layer impedance layer approach, we are modifying the boundary conditions. First, we need to bring our standard Helmholtz equation to a weak integral by multiplying it by a test function, and applying Green's first identity to arrive at the RHS.

We have a surface integral now to which we can relate the microacoustics BLI expression (see my previous __post__), and we get an expression that includes both a standard acoustic impedance

The latter integral has the viscous and thermal losses in them. And as these have only been implemented in the newest version (5.6) of COMSOL Multiphysics, it was necessary, but possible, in earlier versions to implement these yourself. We do not want to have the second order tangential derivative in the above equation and so the Green's first identity is applied again, but these details are left out.

All in all, we end up having two extra integral compared to standard acoustics; one related to the thermal losses and one for the viscous losses. And by knowing the COMSOL notation for test functions etc, we can add the two integrals via so-called Weak Contribution nodes:

Inside the two Weak Contributions are expressions that include the microacoustic effects via the BLI expressions, with some quite involved expressions like

*-(i/rho0/kv)*acpr.delta*dtang(p,x)*dtang(test(p),x)+dtang(p,y)*dtang(test(p),y)+dtang(p,z)*dtang(test(p),z)*

where the test function functionality and the tangential derivative operators in COMSOL have been used.

One has to be careful with sign and normal direction conventions, but in the end you end up with a very simple way of including microacoustics for cases, where the boundary layer is fairly thin compared to the geometry in question.

As mentioned, this BLI funtionality is already in-built in the newest version of COMSOL (albeit in a more elaborate version, where you can have moving boundaries and other additions), so why even go through all of this? Well, there are at least two answers: 1) By having done this yourself, you are completely on board with what COMSOL (or any other simulation software company) has done to implement this functionality, and probably more important 2) by being able to do this yourself, you don't have to wait for the software companies to implement this(!). Where this was implemented in 2020, I was using it years before in the industry, even with__ shape optimization__ put on top. That means that if a journal paper comes out today with a physics implementation that you see useful, you can spend some hours, or days, to implement it yourself, instead of having to wait years for it to be standard (if ever) in your prefered software package. So you can be years ahead of competitors in your industry, which again is worth a lot of time/money.

So I can only encourage anyone interest in the weak formulation to start reading up on the topic now to propel your skills to a whole new level, and iterate faster in the industry that you are currently in.