Software Architecture

From OpenPSTD
Jump to: navigation, search

Contents

Overview

The plugin is divided in two sections the UI and the Kernel. The UI is shown to the user in the blender interface as a plugin. The UI will call a process that runs the kernel.

UI

UML class diagram of the UI

UML class diagram of the plugin part

Kernel

UML class diagram of the kernel

UML class diagram of the kernel part

Dependencies

For the kernel code to run, apart from the builtin Python libraries, it requires

  • Python files in directory kernel and subdirectories
  • Configuration file pstd.cfg in directory kernel/core
  • Scene description file in .json format
  • Python library numpy
  • Python library matplotlib (if one desires to output images)

File: pstd.py

This class is responsible for the simulation of openPSTD. It is either run stand-alone or invoked by the Blender application. The class interprets the geometry and configurations and initializes the computations.

Usage

For more information how to use the stand-alone application, see Command line simulations.

Structure

When this class is invoked, it starts by parsing flags (either passed from blender or command line). It loads the scene description file and parses the speaker and receiver positions. A Scene object is created, which divides the scene into rectangular domains separated by boundaries.

The information from the scene description file is augmented with information from the configuration file pstd.cfg. This file contains computation settings for openPSTD that are not directly related to the scene. More information regarding the configuration file can be found in OpenPSTD_v1.0_settings.

After the scene initialization is complete, this class starts a numerical solver which runs the simulation for the duration specified in the configuration. Spatial computations are performed using the pseudo-spectral time method, while a 6-stage Runge-Kutta method is used for computing the evolution of the sound in time. For details on the solver implementation, see the related paper of Krijnen et al. 2014. For more information on the pseudo-spectral time domain method, see Hornikx et al. 2012.

When the simulation is finished, the output (image files in .png format or arrays as binary data) can be examined in the directory specified in the scene description file.

PSTDSolver

This class is responsible for the scientific calculations executed in openPSTD. It is invoked by the main file pstd.py. This class comprises the main loop of the simulation. At every time step, it checks which domains needs to be updated and calculates the new values for the acoustic velocity and pressure. The acoustic velocities and pressure are updated and if desired, the data is written to the disk.

Domain

This class represent a part of the geometry. Domains are the building blocks of a Scene; rectangular spaces with a position and size. A domain is assumed to homogeneously consist of one material (and have a corresponding sound speed). In order to model an open domain, a domain can be surrounded with PML-domains, thus negating sound wave reflections. Structure When the simulation is being executed, propagation velocities and pressures are stored in the Domain class. The class has utilities to compute the sound propagation at the next time step, see if computation is necessary (which might not be in case of PML-domains) and has information about neighbouring domains.

Boundary

This class represents the boundary between two adjacent domains in a scene geometry. Every Boundary has an orientation (either horizontal or vertical) and at most two connected domains.

Scene

This class represents a scene; the geometry in which the sound propagation takes place. A Scene consists of a collection of Domains and Boundaries, speakers and receivers. A Scene holds information on how the Domains are connected and where the speakers and receivers are located. It also has various convenience methods to execute computations and actions for all domains or boundaries at once.

Receiver

This class represents an 'observer' located in a Scene that perceives the sound waves in the scene. A Receiver has a fixed location within the domain at which the sound pressure is measured at every step in time.

Data writer

This class is responsible for writing the data to disk. It interprets the directory for dumping data from the scene description file and stores image files graphing the sound pressure and binary data files containing arrays with sound velocity and pressure at each time frame. Options exist for sampling the data so that the write operations consume less time and disk space.

Communication and control between layers