Getting started with OpenPSTD v1.1

From OpenPSTD
Revision as of 19:52, 22 January 2016 by Louis (Talk | contribs)

Jump to: navigation, search


Installing openPSTD v1.1

  • Install Blender:
  • Download the OpenPSTD Blender add-on from
  • Now run Blender and from the [File] menu select [User Preferences] or click [Ctrl]+[Alt]+[U] to bring it up.
  • Navigate to the [Addons] section and press the [Install from File...] button at the bottom of the window.
  • Using the file selection prompt that shows up select the downloaded archive

Enabling GPU Acceleration (optional)

GPU acceleration is available for computers that have a GPU which supports either CUDA or OpenCL. The GPU acceleration in openPSTD v1.1 requires either PyOpenCL or PyCUDA and the PyFFT library. PyFFT is incompatible with Python 3, which is shipped with Blender. In order to make use of GPU acceleration, a Python 2 installation has to be present.

Please go through the following steps to be able to make use of GPU acceleration with openPSTD:

  • Install either a CUDA or an OpenCL driver.
    • Check if CUDA is available for your card. If not, OpenCL drivers are generally available from the GPU vendor.
  • Install Python 2 if it is not yet on your system. Install numpy, matplotlib, PyFFT and PyOpenCL/PyCUDA. If your default Python is set to a Python 3 installation, make sure you install the modules in your Python 2 installation.
  • Import the openPSTD plugin as described above if you have not done it yet.
  • Locate openPSTD.txt in your Blender config folder. This can be found by entering bpy.utils.user_resource('CONFIG') in a Blender Python console. The default locations are:
    • Linux: ~/.config/blender/[version]/config/
    • OSX: ~/Library/Application Support/Blender/2.75/config/
    • Windows: C:\Documents and Settings\{username}\AppData\Roaming\Blender Foundation\Blender\2.75\config\
  • Change the path behind python_path = to the full path of your Python 2 installation. On Linux and OSX, this is usually /usr/bin/python. On Windows, this is usually C:\Python27\python.exe.
  • Restart Blender. If everything is installed correctly, the Enable GPU Acceleration option now works.

Warning: openPSTD fails when Enable GPU Acceleration is checked but not all modules are installed correctly. If no output is produced, check if all needed modules are available and the Python 2 path is correctly entered in the config file.

Pre-processing your calculcation

Creating a single domain

  • Start Blender
  • In order to begin modelling the scene clear all objects that appear in the default scene
    • First deselect everything by pressing the [De(select) all] item from the [Select] menu
    • Click the same item again to select everything
    • Now click the [Delete...] item from the [Object] menu
Alternatively with the mouse over the 3D view area, press [A] [A] [X] [Enter]
The Blender user interface relies heavily on keyboard shortcuts to allow for efficient modelling.
Whenever a key is pressed make sure the mouse is over the relevant area. In this case the large 3D view.
Most operations in Blender triggered by the key strokes are also available from the menu items.
  • Navigate to a viewpoint from above by selecting [Top] from the [View] menu (in the lower left corner of your screen)
Currently OpenPSTD only supports two dimensional scenes and this viewpoint is strongly recommended.
  • Create a planar mesh by activating [Plane] from the [Add] > [Mesh] menu.
Alternatively bring up the same menu by clicking [Shift] + [A]
  • Switch to metric display units by clicking on the [Scene] button, the third icon on the button strip, and selecting [Metric] (see picture below)
  • Bring up the properties panel by clicking [View] > [Properties]
  • Move your plane to the origin of the coordinate system by entering the location (x,y,z)=(1,1,0) in the [Location] part of the [Properties] toolbar
  • You can change the dimensions of your plane with the [Dimensions] part of the [Properties] toolbar
  • Another way of changing the dimensions of your rectangle is the following. Edit the selected planar mesh by switching from the Object mode to the entering Edit mode
Alternatively click the [Tab] button to switch between Object mode and Edit mode
  • Now, you can change the dimensions of your plane as follows:
    • Enter Edge select mode by clicking the appropriate button on the toolbar
    • Select the rightmost edge (for moving this edge in particular) by clicking it with the *right* mouse button
    • Move the selected edge by *left* clicking the red arrow and typing (for example) 8 into the X field that appears on the left

Creating multiple domains

You can model your geometry by creating more subdomains as follows

  • Select the leftmost edge of your rectangle and press the [E] button ad press [X] [7] [-] [Enter] to copy that edge 7 meters to the left
Notice how the extrude operation is different from the move operation
  • Now select the topleft edge
  • Extrude that selected edge 7 meters by pressing the [E] [Y] [7] [Enter]
  • Now select the two bottom edges by selecting the first and pressing [Shift] while selecting the second
  • Move them down 5 meters by pressing [E] [Y] [5] [-] [Enter]

So far, subdomains that connect have equal dimensions in (at least) one direction. This is not a restriction in openPSTD, and different subdomain dimensions can be obtained as follows:

  • In the Edit mode (press [Tab] to switch from the Object mode to the Edit mode if you are not in the Edit mode yet), press the [Face select] icon on the toolbar below the geometry screen. Then, click the *right* mouse button when the pointer is on the upper subdomain. Thereafter click [y] and [Enter].
  • Now, click [Edge select] on the lower toolbar and select the left edge of the uppermost subdomain. Enlarge it by clicking with the *left* mouse button on the horizontal arrow (the x-axis), enter -1 in the x-vector menu of the left toolbar en press [Enter]. The upper subdomain now is wider than the lower subdomain.

Assigning source(s) and receiver(s)

  • In the Object mode, press [Shift] + [A] and add an acoustic source (speaker) to the scene
Note how the newly created object is positioned where the cursor is located
  • The location of the speaker can be set by using the [Location] part of the [Properties] toolbar
  • Add a receiver by using the same menu and define the location by altering the [Location] part of the [Properties] toolbar
Blender does not have a dedicated object to designate as a receiver position, therefore Empty objects are used in OpenPSTD
A receiver can be created by any subtype of an Empty object

Assigning boundary conditions

  • You first need to activate the openPSTD add-on
    • Press [Ctrl] + [Alt] + [U] to bring up the User Preferences window
    • Under [Addons] search for openPSTD and enable it using the checkbox on the right
  • On the buttonstrip on the right highlight the first item again
Note how an OpenPSTD section has been added by enabled the addon
The panel can be made wider by dragging the border to the left
  • The OpenPSTD add-on is now enabled
  • You can assign an acoustic absorption value to all outer boundaries of the modelled geometry. In the Edit mode, click [Edge select] on the lower toolbar and select an outer edge of your geometry.
  • In the openPSTD menu, you can change the acoustic absorption coefficient by changing the value of [Absorption]. This can either be done by pressing the (left or right) arrows, or by manually entering the value in the box and ending with [Enter].
  • To assign the same coefficient to multiple edges, multiple edges can be selected by pressing [Shift] and selecting those edges.
  • To assign locally reacting conditions to a boundary, the [Local] box should be ticked upon selecting one or multiple edges.

openPSTD settings

OpenPSTD settings give multiple options, like density of air, sound speed in air and grid spacing, that apply to the whole geometry, i.e. are not related to a specific part of the geometry. All these settings can be adjusted prior to started a calculation with openPSTD. An important condition to enable a calculation is that the dimension of a subdomain should be larger than the product of the [Grid spacing] and [Window size].

Processing your calculation

  • To start the PSTD calculation, press the [Simulate with OpenPSTD] button
Notice how after a while areas for the subdomains appear
Notice how the light gray area in the bottom area starts to grow over time. This represents the time steps for which a simulation result has been processed.
Common causes for Errors:
* The smallest domain is smaller than the window length (window size multiplied by grid spacing). Decrease the window size, choose a smaller grid spacing or enlarge the offending domain.
* The planar mesh object is not selected before pressing the button. Make sure to select it.
* The mesh is not orthogonal. In that case, it might help in the Edit mode, to select [A] en press [W] and select [Remove doubles]. This operation connects geometrical coinciding points (that were not connected before)
  • Switch to textured viewport shading to have the sound pressure levels visually display in the 3D view
  • Drag around within the light grey area timeline area and notice how the visualisation of sound pressure levels updates accordingly
  • Stop the simulation by pressing the [stop the current openPSTD visualisation] or wait until the calculation terminates by reaching its maximum numbers of time samples.

Post-processing your calculation

  • A geometry with openPSTD settings and calculation results (in the form of the 2D visualisation frames and recorded responses at receiver positions, can be saved by the [File] [Save As] commands.
  • To post-process recorded impulse responses in for example Python of MATLAB. first select the Empty object designated as the receiver
Notice how a depiction of the empulse response is drawn at the timeline area
  • Use the rightmost button below that area to export the impulse response as a .bin file.
  • Another option in openPSTD is to create an animation from the calculated results. For this purpose, press the [Bake openPSD simulation] button.
  • Then, in the [Output] menu below the [openPSTD Settings] menu, select the output folder and file name. Also, select the desired movie extension in the file format (PNG is the default extension, but this should be altered as this returns a series of images instead of a movie).
  • Finally, in the [Render] menu above the [openPSTD Settings] menu, press Animation.

Test run and results

To verify your openPSTD version has properly been installed and calculations are carried out as envisaged, calculations can be made for the test configuration in the figure a) below. It represents a noise barrier scene, where a wide screen is obstructing the direct propagation path between source and receiver. A reference configuration is also constructed to compute the effect of the barrier relative to a configuration without barrier (excess attenuation). Calculations are executed with 20 PML cells and a window length of 16 cells. Figure b) below shows the time responses at the receiver position, for a standard CPU calculation, a calculation with GPU 32 bit enabled and a calculation with GPU 64 bit enabled. Figure c) shows the points per wavelength (ppl) excess attenuation results. These are computed as:

EA = 20\log_{10}\left(\frac{|P_{screen}|}{|P_{screenref}|} \right)


P_{screen} = \mathcal{F}\left(p_{screen}(t)\right)
P_{screenref} = \mathcal{F}\left(p_{screenref}(t)\right)

the Fourier transforms of the recorded time signals. The Fourier transforms are operated to a discretisation of fs=13600 samples in the transformed domain, i.e. the time recorded signals are zero padded up to fs samples. The configurations in .blend format, the .wav files of the recordings and the computed time and ppl plots can be found here.

  • a) Test run configuration with ground surface and wide screen acoustically rigid.
  • b) Time responses of test run.
  • c) Points per wavelength plot of test run.

<< OpenPSTD v1.0 settings