R.

White, Comsol Acoustics
Introduction, ©2012
Tutorial Created in Comsol 4.3 (2012)
R. White, Comsol Acoustics
Introduction, ©2012
Finite Element Analysis (FEA / FEM) –
Numerical Solution of Partial Differential Equations (PDEs).
1. PDE representing the physics.
2. Geometry on which to solve the problem.
3. Boundary conditions (for static or steady state problems) and initial
conditions (for transient problems).
O ÷ domain
I- boundary
(or oO)
Unknowns – e.g. u(x,y,z)
x
y
The Mathematical Problem:
Independent
Variables –
space and time
(x,y,z,t)
Dependent
Variables –
unknown field
(such as u)
R. White, Comsol Acoustics
Introduction, ©2012
Finite Element Analysis (FEA / FEM) –
Boundary Conditions. On each boundary you must specify either:
1) The dependent variable itself (e.g. u) – “Essential Boundary
Condition” or “Dirichlet Boundary Condition”
2) The derivative of the variable itself (e.g. du/dn) – “Natural Boundary
Condition” or “Neumann Boundary Condition”
3) The relationship between the dependent variable and its normal
derivative (e.g. du/dn=(1/z)·u)).
O ÷ domain
I- boundary
(or oO)
Unknowns – e.g. u(x,y,z,t)
x
y
The Mathematical Problem:
Independent
Variables –
space and time
(x,y,z,t)
Dependent
Variables –
unknown field
(such as u)
R. White, Comsol Acoustics
Introduction, ©2012
Finite Element Analysis (FEA / FEM) –
1) Discretization of the space into pieces (the elements) – this is called
the Mesh.
2) Choice of element type - shape (triangle, quadrilateral, etc.),
number of nodes (3, 4, 5, 8, etc.) and shape function (linear,
quadratic, etc.).
3) Choice of solver (direct, iterative, preconditioning).
4) Post-processing – looking at the solution in various ways.
The Finite Element Part:
The shape is
now “meshed”
with triangle
elements.
R. White, Comsol Acoustics
Introduction, ©2012
So, this is always the sequence for any FEA problem:
1. Decide on the representative physics (choose the PDE).
2. Define the geometry on which to solve the problem.
3. Set the “material properties”… that is, all the constants that appear
in the PDE.
4. Set the boundary conditions (for static or steady state problems)
and initial conditions (for transient problems).
5. Choose an element type and mesh the geometry.
6. Choose a solver and solve for the unknowns.
7. Post-process the results to find the information you want.

R. White, Comsol Acoustics
Introduction, ©2012
Finite Element Packages - Here are some of the common ones
R. White, Comsol Acoustics
Introduction, ©2012
Comsol Multiphysics
- More recent than Ansys,
Nastran, Abaqus.
- Integrates well with
Matlab (uses Matlab
syntax too).
- Focuses on
“Multiphysics” – coupling
different physics together
(e.g. acoustics and solid
mechanics).
- Highly flexible… allows
you to program in your
own differential equations
if they are not already
implemented.
R. White, Comsol Acoustics
Introduction, ©2012
1. Decide on the representative physics (choose the PDE).
COMSOL – Here we go!!
I will focus on acoustics as an application, but the steps are similar for other physics.
Choose how many dimensions to work in. Warning: 3D is
usually a large computational problem, avoid if at all
possible!! Make use of symmetries to get to 2D or 2D
axisymmetric.
Choose your type of physics.
You may select more than one
if you want coupling.
Tutorial Created in Comsol 4.3 (2012)
“Pressure Acoustics” is what we have been
doing in ME139 – this solves the Helmholtz
equation for the complex acoustic pressure.
Here you are choosing what kinds of solutions you want at the end of the study.
You can always add other kinds later.
R. White, Comsol Acoustics
Introduction, ©2012
• Frequency Domain : This is what
we have been doing for the most
part in ME139. The Helmholtz
equation … you are solving for
steady state pressure at a single
frequency.
• Eigenfrequency : This will allow
you to find the acoustic modes of a
domain. These are frequencies
and corresponding pressure fields
where the Helmholtz equation and
boundary conditions can be
satisfied with no external drive
(Homogeneous Solutions)

1. Decide on the representative physics (choose the PDE) : Choose
Type of “Study”.
R. White, Comsol Acoustics
Introduction, ©2012
1. Decide on the representative physics (choose the PDE). Complete. At this point
I have chosen my PDE and number of spatial dimensions. For pressure acoustics,
my PDE is the Hemholtz equation … but I can allow µ
0
and c to vary in space if
desired.
Remember, since I have chosen “Pressure Acoustics”, I have selected time-
harmonic acoustics… time-harmonic means single frequency… we are assuming
time dependence e
jet.
The pressure I solve for will be the complex pressure,
2
2
0 p p
c
e
| |
V + =
|
\ .
2
0 0
1 1
0 p p
c
e
µ µ
| |
| | | |
| |
V· V + =
|
| |
|
|
\ .
\ . \ .
\ .
Constant
density
( , , ) p x y z Solved for in Comsol
{ }
10
( , , , ) Re ( , , )
1
( , , ) ( , , )
2
( , , )
( , , ) 20log
j t
rms
rms
ref
p x y z t p x y z e
p x y z p x y z
p x y z
SPL x y z
p
e
= ·
=
| |
=
|
|
\ .
Can be easily computed
in post processing using
post processing tools
inside Comsol.
R. White, Comsol Acoustics
Introduction, ©2012
Comsol 4.3 Graphical User Interface
Model tree shows all
parts of the model …
geometry, boundary
conditions, materials,
types of study to run,
results. Right click
on things to interact.
Geometry and various
results plots will be
shown in the main
Graphics window.
Various useful tools,
depending on what you
have selected in the
model tree.
Tools related to
zooming, viewing,
saving graphics objects.
R. White, Comsol Acoustics
Introduction, ©2012
2. Define the geometry on which to solve the problem.
Draw the geometry of the acoustic domain (the
domain over which you want to solve the PDE)
by right clicking on geometry and using various
tools (tools also appear in the toolbar at the top
when geometry is selected in the model tree).

If you select some objects in the graphics
window then Boolean tools (like subtract,
intersect, union) will also appear under
geometry.
Default units are mks units (SI units).
You can change units by selecting the
(root) object in the model tree (the
very very top object).
If you change or delete geometry
objects, sometimes you may need
to ask Comsol to Build All the
geometry again to get it to refresh.
For complicated
geometry you
may choose to
import it from a
CAD program.
R. White, Comsol Acoustics
Introduction, ©2012
2. Define the geometry on which to solve the problem.
Objects appear in here.
Here are all the geometry
objects I defined.
Edit them by clicking and/or right
clicking them in the model tree.
Drawing tools.
For axisymmetric, the
axis of symmetry will
be r=0 and be drawn as
a line in the graphics
window.
R. White, Comsol Acoustics
Introduction, ©2012
3. Set the “material properties”… that is, all the constants that appear in the PDE.
For pressure acoustics, all that matters is µ
0
and c. (And frequency… although
that is set under “Study | Frequency Domain”, not under materials.)
Under
“materials”
select “open
material
browser” or “+
material”.
Find the material you want in the
browser, or create your own material
with “+ Material”.
After you find it, right click and
“Add Material to Model”
For pressure acoustics, the only
properties that matter are density and
speed of sound.
If you did a coupled thermal problem
these could be functions of
temperature … etc … or you can just
enter them as constants.
R. White, Comsol Acoustics
Introduction, ©2012
3. Set the “material properties”… that is, all the constants that appear in the PDE.
Once the materials you want are
added, assign them to whichever
geometric objects you want to have
those properties.
Also set up frequency for the
problem … I am thinking of this as
a global material property … it
appears as a constant in the
Helmholtz equation.
R. White, Comsol Acoustics
Introduction, ©2012
4. Set up the boundary conditions.
Right click on the “Pressure
Acoustics” physics in the model to
bring up options for boundary
conditions for this physics.
We have a lot of choices… for each
kind of boundary condition you will
want to add it to the model, and
then apply it to the boundaries you
want it applied to.
R. White, Comsol Acoustics
Introduction, ©2012
4. Set the boundary conditions
Choices of boundary conditions (pressure acoustics mode):
1. Sound Hard Boundary – Neumann condition; dp/dn = 0 (normal velocity = 0)
2. Sound Soft Boundary – Dirichlet condition; p = 0 (pressure release)
3. Pressure – Dirichlet condition; p=p
0
(sets acoustic pressure amplitude… remember,
everything is oscillating as e
jwt
)
4. Normal Acceleration – Neumann condition since Euler says dp/dn=-µ
0
a
n
(sets
normal acceleration amplitude… remember, everything is oscillating as e
jwt
)
5. Impedance Condition – set normal specific acoustic impedance z
n
at the boundary
(z
n
=p/u
n
→ (dp/dn)=-µ
0
je·p/z
n
). This is how you could approximate an absorbing
panel or something like that … set z
n
to get the desired NRC.
6. Radiation Condition – set a boundary that will not reflect normally incident plane
waves or cylindrical waves or spherical waves…. This is how you try to
approximate an infinite space; only perfect if the incident wave is a perfect plane
wave (or cylindrical/spherical wave). You can include a source term in this
condition to send in a wave at the boundary. A preferred method is to use a
“Perfectly Matched Layer” … but radiation condition should be sufficient for
our purposes.

For pressure acoustics mode, we will be solving for the complex pressure p. You
can therefore use complex numbers for any of your pressure or velocity boundary
conditions; these specify magnitude and phase.
R. White, Comsol Acoustics
Introduction, ©2012
4. Set the boundary conditions.
Note that boundary conditions can be functions of space …
use Matlab syntax … so here I have set a
n
= 1 mm/s
2
for
r<0.1 meters, but zero for r>0.1 meters. Remember the
Matlab expression r<0.1 evaluates to 1 when true, 0 when
false. The names of the spatial coordinate variables can
be found by clicking on the Model.
Select the part of the boundary you
want to apply that condition to and
add it to the boundary selection.
R. White, Comsol Acoustics
Introduction, ©2012
4. Set the boundary conditions
Notes on Radiation Condition:
- You want to use this if you are thinking of your problem extending off to infinity,
but you don’t want to mesh the problem.
- If you are working in axisymmetric 2D mode or 3D mode you will have
additional choices at the boundary to match spherical and cylindrical waves.
- If you work on our research license (which includes the acoustics module), you
have another choice for boundary conditions to simulate infinite spaces… the
Perfectly Matched Layer “PML”.
Notes on Symmetry:
• If you are working in one of the axisymmetric modes, you will have a boundary
as an axis of symmetry; the solution is revolved about the axis.

• If you are working in Cartesian coordinates and have a symmetric system, you
can model only part of it (this can save a lot of computation time)… often the
symmetry boundary will act like a rigid wall; the derivative of pressure will be
zero on the symmetry boundary.
R. White, Comsol Acoustics
Introduction, ©2012
4. Set the boundary conditions
Notes on Sources
- One way to create an acoustic source is to use an acceleration boundary condition which will
produce sound through the vibration of the boundary. You could set this to be a small
boundary and set up its normal acceleration to get a desired simple source strength, or make
a baffled piston, etc.

- Another way to create an acoustic source is to send in a plane wave from a plane wave
radiation boundary condition, or an incoming spherical wave from a spherical radiation
condition … it is as if a source at infinity where sending in these incoming plane or incoming
spherical waves, which will then superimpose with whatever you get from reflections,
defraction, and refraction with your geometry.

- A third way to create an acoustic source is to add a point source from under the “pressure
acoustics|points” menu. A “volume flow source” has a strength Q in m
3
/s that is exactly the
way we have been doing simple sources. Note that if you put this point source right on top of
a hard boundary you will get an image source … so strength will double to 2Q.

- A final way to create an acoustic source is to add a monopole distribution. You will see this
under the options when you right click on the “Pressure Acoustics” item in the model tree.
The monopole source will be applied over a volume … it is as if that volume is packed with
monopole sources with the source strength that you set. The Comsol monopole distribution
strength Q is in units of 1/s
2
… so the Comsol monopole strength is volume acceleration/unit
volume = volume velocity/(je)/unit volume. This has been checked.
R. White, Comsol Acoustics
Introduction, ©2012
5. Choose an element type and mesh the geometry.
Right click on Mesh1 and
select a type of mesh (Free
Triangular, etc). You can
modify how the mesh is
layed out by adding size,
scale, and distribution
controls.
Keep in mind: 1. You need at least 5 elements per wavelength… ì=c/f, so as your
frequency goes up, you will need more elements! 2. If there are places in the model
where you expect complex behavior, use a denser mesh in that region.
IT IS CRITICAL TO HAVE A DENSE ENOUGH MESH. IF YOU DON’T HAVE
MULTIPLE ELEMENTS PER WAVELENGTH YOUR SOLUTION WILL NOT BE
CONVERGED … IT WILL NOT BE A GOOD APPROXIMATION TO THE PDE
SOLUTION!! THE PROBLEM WILL STILL RUN BUT YOUR RESULTS WILL BE
BAD.
It would be a good idea to do a simple convergence study. After solving, make
the mesh finer, re-solve, and make sure the solution didn’t change much.
R. White, Comsol Acoustics
Introduction, ©2012
6. Choose a solver and solve for the unknowns.
Finally, go to Study and select “Compute”. You can change the type of
solver under the various steps (in our case there is only one step … a
Frequency Domain pressure acoustics step). There are a variety of
direct (full matrix inversion) and iterative solvers.
Direct solvers tend to be more robust (they are most likely to converge)
but require more memory.
This is a large topic … which solvers are best … for a linear pressure
acoustics problem it should not be bad, most solvers should work. I
think.
Just make sure you mesh is fine enough to represent the wavelength of
sound at the frequency you are working at !!
Parametric sweeps are useful … especially in pressure acoustics you
might want to solve the same geometry for a range of frequencies … set
up a frequency range under “Frequency Domain” and you will get a
series of solutions at different frequencies. Just remember to keep your
mesh fine enough to represent the short wavelengths at high
frequencies!!
R. White, Comsol Acoustics
Introduction, 11/1/10
7. Post-process the results to find the information you want.
Please remember… just because you get
pretty colors does not mean the solution
is correct! Be careful, please, when you
are building the device which is supposed
to save my life.
There are lots of things you can plot
… these are all derived from the
solution for the complex pressure,
which is all it solved for. Once it has
that it can compute velocity,
intensity, SPL, etc. just as we have
been doing.
Keep in mind … “instantaneous” quanities are the real part…
the pressure or intensity or whatever at t=0 … this can go
positive and negative. Total or magnitude are the magnitudes
of the oscillating quantities and RMS is RMS.
R. White, Comsol Acoustics
Introduction, ©2012
WHENEVER YOU USE A NEW FEA
SOLVER, SOLVE A PROBLEM YOU
KNOW THE SOLUTION TO FIRST, TO
MAKE SURE YOU ARE USING IT
CORRECTLY!!!!!!!!!!

Sign up to vote on this title
UsefulNot useful