# Difference between revisions of "OpenPSTD v1.0 overview"

## What can you model with openPSTD v1.0?

openPSTD v1.0 provides a visual user interface that enables to compute sound propagation in a 2D geometry. With openPSTD v1.0, the 2D geometry, bounded by edges that (partly) absorb the sound waves, can be drawn in Blender. Sources of sound and receiver positions can freely be chosen within the geometry. Sound propagation is computed in openPSTD v1.0 by numerically solving the linearised Euler equations, i.e. the partial differential equations that describe sound propagation in fluid flow in the time domain. The outcome of openPSTD v1.0 is a visualisation of sound propagation, by a 2D animation and by the impulse responses at the position(s) of the receiver(s). As openPSTD is an open source software, we highly encourage contributions to the code as to this wiki.

## Geometry, medium and boundaries

Subdomain modelling with openPSTD.

A geometry in openPSTD must be constructed out of a subsequent arrangement of rectangles (subdomains). The interface, at which the boundaries of two adjacent subdomains coincide, does not necessarily have to match the full length of both subdomain boundaries. Hence, subdomains can have multiple neighbors at a domain boundary and hence local refinement does not necessarily propagate throughout the entire topology. The density and speed of sound of the propagation medium can be defined in the openPSTD settings. A restriction of the method is the minimum dimension of the subdomains, which is equal to the Grid spacing multiplied by the Window size (see openPSTD v1.0 settings). Once the geometry has been constructed, the acoustic absorption coefficient at the edges needs to be defined. The defined absorption coefficient corresponds to a real valued normalized surface impedance according to

$Z = \frac{-\sqrt{1-\alpha}+1}{\sqrt{1-\alpha}-1}$

The absorption coefficients are frequency independent. The default setting in openPSTD is that boundary reflection are independent on the angle of incidence. A locally reacting boundary can also be chosen, see openPSTD v1.0 settings. The reflection coefficient then becomes, in approximation (see van Renterghem et al. 2013).

$R = \frac{Z\cos{\theta}-1}{Z\cos{\theta}+1}$

with θ the angle of sound incidence relative to the normal to the interface.

$p(x,z,t=0) = e^{-\beta|\mathbf{x}-\mathbf{x}_s|^2}$
with $\beta = 3e^{-6c^2/ \Delta^2}$, Δ the grid spacing in metres, c the adiabatic speed of sound, $\mathbf{x}=[x,z]$ the 2D coordinate vector and Failed to parse (unknown function\math): \mathbf{x}_s<\math> the source position. The centre(s) of the Gaussian shape(s) thus corresponds to the defined centre(s) of the sources. Although receiver positions might not correspond to a position in the mesh, spectral interpolation allows to compute the response of the source(s) in the constructed geometry at an arbitrary location in the space. == Mesh == [[File:mesh_label.jpg|thumb|right|500px|]] [[File:mesh.jpg|thumb|right|200px|Schematic representation of acoustic pressure and velocity positions.]] In openPSTD v1.0, the geometry is discretised by an orthogonal equidistant grid, with '''Grid spacing''' in metres equal to the spacing of the grid points. Pressure grid positions are staggered by a half grid spacing with acoustic velocity grid positions, and the velocity position are located at the edges of a subdomain: horizontal velocity components are located at a vertical edge and vertical velocity components are located at an horizontal edge. When a geometry is drawn, a grid is created. If a dimension of a drawn subdomain does not correspond to an integer multiple of the '''Grid spacing''', the subdomain is extended such that its size (in the respective direction) becomes an integer multiple of the '''Grid spacing'''. . == Solver == [[File:mesh_window.jpg|thumb|right|300px|Schematic representation of windowing the solution at the pressure positions for computing spatial derivatives in subdomain 2.]] Wave propagation in the openPSTD software is implemented according to the extended Fourier PSTD method as presented in [http://scitation.aip.org/content/asa/journal/jasa/128/4/10.1121/1.3474234 Hornikx ''et al.'' 2010]. With this numerical method, the linearized Euler equations (LEE) are solved, which allow a detailed computation of sound propagation in moving inhomogeneous media and return the linear acoustic equations for a non-moving homogeneous propagation medium. In PSTD, the spatial derivatives arising in the LEE are computed in the wavenumber domain. This implies that a spatial Fourier transform is applied to the acoustic variables, and after an operation in the wavenumber domain, an inverse Fourier transform returns the derivatives. This way of computing spatial derivatives leads to an accurate solution requiring only 2 spatial points per wavelength. In openPSTD v1.0, the total domain is decomposed into subdomains. The advantage of this decomposition is a higher geometrical flexibility, a lower computational complexity, it promotes object orienting programming and a parallel computational architecture. The computation of the horizontal spatial derivatives in a subdomain at the pressure positions is schematically depicted in the accompanied Figure. Three subdomains are needed to compute these derivatives. Prior to computing the derivatives, the variable values are multiplied by a window function. The accuracy of this technique is reported in [http://www.sciencedirect.com/science/article/pii/S0021999112001568 Hornikx ''et al.'' 2012], and increases with an increasing length of the decay of the single sided windows. Behind every edge, a boundary subdomain is included in openPSTD v1.0. This subdomain is not visible in the graphical interface in Blender. The waves propagate in the boundary subdomains and are absorbed by a perfectly matched layer (PML), see [http://scitation.aip.org/content/asa/journal/jasa/128/4/10.1121/1.3474234 Hornikx ''et al.'' 2010]. == Results == Computed results can be accessed in two ways. First, the 2D pressure field can be viewed as a function of time. This offers the possibility to interpret sound propagation in a qualitative way. The second possibility is to export the computed impulse responses at the receiver positions for further post processing. The broad band impulse responses can then be processed to frequency domain results and octave band values can be obtained.