Contrib potentialWaveFoam

From OpenFOAMWiki

Valid versions: OF version 14.png OF version 141.png OF version 15.png

1 Short description

A one-line solver that solves a wave equation, fvm::d2dt2(phi) == c * c *fvc::laplacian(phi).

2 Overview

potentialWaveFoam solves a linear wave equation

(1) \frac{\partial^2 \phi}{\partial t^2} = c^2  \nabla^2 \phi

where \phi is a scalar variable, t is time and c is the speed of wave propagation (group velocity). If we take \phi so that sound pressure p and acoustic particle velocity U satisfy

(2) p = \frac{1}{\rho} \frac{\partial \phi}{\partial t},

(3) U = -\nabla \phi,

where \rho is the medium density, the wave equation is considered to represent a linear sound propagation.

A boundary condition frequently used in linear acoustics is a normal acousic impedance boundary condition. The normal acoustic impedance Z_n is represented by sound pressure and the normal component of acoustic particle velocity U_n as

Z_n = \frac{p}{U_n}.

With substituting Eqs. (2) and (3), we obtain a convection equation of \phi

(4) \frac{\partial \phi}{\partial t} + V_n \frac{\partial \phi}{\partial n} = 0

with the convective velocity V_n represented by

V_n = \frac{Z_n}{\rho}.

For more detailed discussions, please have a look at reference [1].

3 Prerequisites

Python and funkySetFields are required to run the test case.

4 Package description and installation

4.1 Manifest

The package contains the following subdirectories:

    convectiveOutlet-YYYYMMDD/  a convection BC code
    potentialWaveFoam/          the main solver
    probeToAudio/               a postprocessing utility
    reverberationRoom/          a test case

4.2 Installation

Unpack the package under any suitable place under $WM_PROJECT_USER_DIR, e.g. $WM_PROJECT_USER_DIR/applications, go into the package directory and type ./Allrun.

cd $WM_PROJECT_USER_DIR/applications
tar -zxf potentialWaveFoam-YYYYMMDD.tar.gz
cd potentialWaveFoam-YYYYMMDD

These steps will install a library under $FOAM_USER_LIBBIN:

  • - a BC code that calculates Eq. (4). For detailed usage, please see README under convectiveOutlet-YYYYMMDD in the package. The BC code can also be used as a nonreflective outlet BC for incompressible CFDs. Please also consult the reference [2] and a discussion at a forum thread if you intend to do so.

and applications under $FOAM_USER_APPBIN:

  • potentialWaveFoam - the main solver that solves Eq. (1).
  • probeToAudio - a postprocessing utility that converts probed sound pressure at a point to 16-bit PCM .wav audio format. For detailed usage, please have a look at the utility page.

and finally, a test case will be run.

5 Test case

The test case with finer mesh, visualized with VisIt.

The geometry of the test case provided under the reverberationRoom subdirectory is based on a Type II reverberation room owned by Kobayasi Institute of Physical Research [3], one of the most active civil acoustic research institutes in Japan, included under their permission. The room is used for measurements of airborne sound insulation performance of building elements conforming to ISO 140-1/3. A dummy open window (represented by Z_n = \rho c), however, is placed as a tested material in order to make reverberation time shorter for saving computational time and diffusers and absorbers usually installed for measurements are all removed for simplicity. Thus the case is not meant to be a reproduction of a real measurement situation.

The problem solved is a propagation of a gaussian acoustic pulse placed at a point as an acoustic source. The walls other than the opening are assigned an acoustic impedance of 136791.7 kg/(m2 s) which is equivalent to the acoustic absorption factor \alpha = 0.01, given the relationship

\alpha = 1 - \left|\frac{Z_n/(\rho c) - 1}{Z_n/(\rho c) + 1}\right|^2.

The speed of sound c and the medium density \rho are assumed to be 343.7 m/s and 1.205 kg/m3 respectively.

The solver will be run twice, with all the settings except endTime are identical. A first run is for visualization of the initial propagation of the acoustic pulse until t = 0.03 s, whose result can be viewed by paraFoam as usual. Another run is for auralization of the impulse response until t = 3 s recorded at a point in the room. After the second run you will have an audible impulse response as p_1.wav under the case directory, which should be heard as a gradually decaying reverberation.

6 Cleanup

To cleanup the library/application build directories and the case directory, type


at the package directory.

7 Download

The package can be downloaded via Subversion by

svn co

8 References

[1] T. Oshima et al., Proceedings of Inter-Noise 2008, No. 287, 2008

[2] J. H. Ferziger and M. Peric. Computational Methods for Fluid Dynamics. Springer-Verlag (Berlin), 1996


9 History

7islands 08:22, 17 February 2009 (CET) (Takuya OSHIMA): Created this page.