openPSTD
2.0
Open source simulation for sound propagation in urban environments
|
The Kernel is responsible for the scientific computions in openPSTD. More...
Classes | |
class | Boundary |
Models a boundary between two domains. More... | |
class | Domain |
A representation of one rectangular scene unit. More... | |
class | DomainConf |
Interface representation of the domain. More... | |
class | DomainConfEdge |
Interface values for boundaries of domains. More... | |
struct | EdgeParameters |
The impedance parameter and locally reaction switch for a boundary. More... | |
struct | FieldLValues |
The spatial derivatives of the pressure and velocity in x and y direction. More... | |
struct | FieldValues |
The observed state variables. More... | |
class | GPUMultiThreadSolver |
Solver that both utilized multiple cores and the GPU. More... | |
class | GPUSingleThreadSolver |
Solver that performs the computational intensive parts on a GPU. More... | |
class | KernelCallback |
Callback interface for communication with the CLI or the GUI. More... | |
class | KernelInterface |
The kernel API. More... | |
class | MockKernel |
Fake kernel useful for testing the interaction between kernel and CLI or GUI. More... | |
class | MultiThreadSolver |
Solver that exploits the multiple CPU cores of a machine. More... | |
struct | PMLArrays |
The arrays used for attenuating the pressure and velocities at the boundaries of the domain. More... | |
class | Point |
The points of the grid, represented by 2D integer vectors. More... | |
class | PSTDConfiguration |
Representation of the scene configuration. More... | |
class | PSTDKernel |
The API with methods that run the simulation from a PSTDFile. More... | |
class | PSTDKernelNotConfiguredException |
class | PSTDSettings |
A collection of parameters and settings for the simulation. More... | |
class | Receiver |
Measure pressure values on a fixed location in the scene. More... | |
struct | RhoArray |
Struct with arrays containing the reflection and transmission coefficients of the pressure and the velocity. More... | |
class | Scene |
Collection of the rectangular domains. More... | |
class | SimulationMetadata |
Data not obtained in running openPSTD but necessary for representing the information. More... | |
class | SingleThreadSolver |
Default singlethreaded solver. More... | |
class | Solver |
Component that computes the state variables of the scene for consecutive time steps. More... | |
class | Speaker |
Locations and amplitude of initial sound pressure. More... | |
class | WisdomCache |
Storage of the accumulated wisdom in the simulation. More... | |
Typedefs | |
using | PSTD_FRAME_UNIT = float |
using | PSTD_FRAME = std::vector< PSTD_FRAME_UNIT > |
using | PSTD_FRAME_PTR = std::shared_ptr< PSTD_FRAME > |
Enumerations | |
enum | CalcDirection { X = 0, Y = 1 } |
Helper enums - used to distinguish horizontal boundaries from vertical boundaries. | |
enum | CalculationType { PRESSURE, VELOCITY } |
Helper enums - used to distinguish pressure computations from velocity computations. | |
enum | Direction { LEFT, RIGHT, TOP, BOTTOM } |
Enum representing directions among domains. | |
enum | CALLBACKSTATUS { STARTING, RUNNING, FINISHED } |
The status of the kernel when the callback is called. | |
enum | PSTD_DOMAIN_SIDE { PSTD_DOMAIN_SIDE_TOP = 1, PSTD_DOMAIN_SIDE_BOTTOM = 2, PSTD_DOMAIN_SIDE_LEFT = 4, PSTD_DOMAIN_SIDE_RIGHT = 8, PSTD_DOMAIN_SIDE_ALL = 8 + 4 + 2 + 1, PSTD_DOMAIN_SIDE_NONE = 0 } |
Enums for the domain boundary representation in the interface. | |
Functions | |
ostream & | operator<< (ostream &str, Domain const &v) |
std::ostream & | operator<< (std::ostream &str, Domain const &v) |
Point | operator+ (Point a, Point b) |
Point | operator- (Point a, Point b) |
std::ostream & | operator<< (std::ostream &str, Point const &v) |
String representation for points. More... | |
RhoArray | get_rho_array (const float rho1, const float rho_self, const float rho2) |
Computes and return reflection and transmission matrices for pressure and velocity based on density of a domain and 2 opposite neighbours in any direction. More... | |
int | next_2_power (float n) |
Computes the smallest power of 2 larger or equal to n if n positive, and 1 otherwise. More... | |
int | next_2_power (int n) |
float | get_grid_spacing (PSTDSettings cnf) |
Computes the largest grid spacing possible based on the speed of the medium and the maximum frequency Throws an exception if no compatible grid size can be found. More... | |
Direction | get_opposite (Direction direction) |
Return the opposite direction of the provided direction. More... | |
CalcDirection | get_orthogonal (CalcDirection direction) |
Get the direction orthogonal to the provided calculation direction. More... | |
CalcDirection | direction_to_calc_direction (Direction direction) |
Obtain corresponding Calculation Direction Axis from direction. More... | |
Eigen::ArrayXXf | spatderp3 (Eigen::ArrayXXf p1, Eigen::ArrayXXf p2, Eigen::ArrayXXf p3, Eigen::ArrayXcf derfact, RhoArray rho_array, Eigen::ArrayXf window, int wlen, CalculationType ct, CalcDirection direct, fftwf_plan plan, fftwf_plan plan_inv) |
Version of spatderp3 that takes cached plans as input. More... | |
Eigen::ArrayXXf | spatderp3 (Eigen::ArrayXXf p1, Eigen::ArrayXXf p2, Eigen::ArrayXXf p3, Eigen::ArrayXcf derfact, RhoArray rho_array, Eigen::ArrayXf window, int wlen, CalculationType ct, CalcDirection direct) |
Function computing the spatial derivatives of the domains. More... | |
Eigen::ArrayXf | get_window_coefficients (int window_size, int patch_error) |
Gives a two-sided array of window coefficients for a given window size and patch error. More... | |
void | debug (std::string msg) |
bool | is_approx (float a, float b) |
Perform a numerical check whether a approximately equals b. More... | |
template<typename T > | |
std::vector< T > | arange (T start, T stop, T step=1) |
Helper function equivalent to numpy.arange() | |
ostream & | operator<< (ostream &str, Scene const &v) |
std::ostream & | operator<< (std::ostream &str, Scene const &v) |
ostream & | operator<< (ostream &str, WisdomCache const &v) |
std::ostream & | operator<< (std::ostream &str, WisdomCache const &v) |
Variables | |
const float | EPSILON = 1E-5 |
Small positive number to facilitate division and other numerical computations. | |
const std::vector< Direction > | all_directions |
Convenience vectors. More... | |
const std::vector< CalcDirection > | all_calc_directions = {CalcDirection::X, CalcDirection::Y} |
const std::vector< CalculationType > | all_calculation_types |
const std::vector< float > | rk_coefficients |
Coefficients for a six stage RK time integration. More... | |
The Kernel is responsible for the scientific computions in openPSTD.
The Kernel consists of the functions used in the PSTD method, as well as the representations of the computational domain.
CalcDirection OpenPSTD::Kernel::direction_to_calc_direction | ( | Direction | direction | ) |
Obtain corresponding Calculation Direction Axis from direction.
direction | Direction Enum |
float OpenPSTD::Kernel::get_grid_spacing | ( | PSTDSettings | cnf | ) |
Computes the largest grid spacing possible based on the speed of the medium and the maximum frequency Throws an exception if no compatible grid size can be found.
cnf | config object containing the properties of the geometry |
Return the opposite direction of the provided direction.
direction | Direction enum |
CalcDirection OpenPSTD::Kernel::get_orthogonal | ( | CalcDirection | direction | ) |
Get the direction orthogonal to the provided calculation direction.
direction | Calculation direction enum |
RhoArray OpenPSTD::Kernel::get_rho_array | ( | const float | rho1, |
const float | rho_self, | ||
const float | rho2 | ||
) |
Computes and return reflection and transmission matrices for pressure and velocity based on density of a domain and 2 opposite neighbours in any direction.
rho1 | density of first neighbour |
rho2 | density of domain |
rho | density of opposite neighbour return struct containing pressure and velocity matrix (4x2) |
Eigen::ArrayXf OpenPSTD::Kernel::get_window_coefficients | ( | int | window_size, |
int | patch_error | ||
) |
Gives a two-sided array of window coefficients for a given window size and patch error.
window_size | length of the window |
patch_error | given patch error |
bool OpenPSTD::Kernel::is_approx | ( | float | a, |
float | b | ||
) |
Perform a numerical check whether a approximately equals b.
Returns
a | float |
b | float |
int OpenPSTD::Kernel::next_2_power | ( | float | n | ) |
Computes the smallest power of 2 larger or equal to n if n positive, and 1 otherwise.
n |
Points with negative entries are well defined.
std::ostream & OpenPSTD::Kernel::operator<< | ( | std::ostream & | str, |
Point const & | v | ||
) |
String representation for points.
Eigen::ArrayXXf OpenPSTD::Kernel::spatderp3 | ( | Eigen::ArrayXXf | p1, |
Eigen::ArrayXXf | p2, | ||
Eigen::ArrayXXf | p3, | ||
Eigen::ArrayXcf | derfact, | ||
RhoArray | rho_array, | ||
Eigen::ArrayXf | window, | ||
int | wlen, | ||
CalculationType | ct, | ||
CalcDirection | direct, | ||
fftwf_plan | plan, | ||
fftwf_plan | plan_inv | ||
) |
Version of spatderp3 that takes cached plans as input.
Eigen::ArrayXXf OpenPSTD::Kernel::spatderp3 | ( | Eigen::ArrayXXf | p1, |
Eigen::ArrayXXf | p2, | ||
Eigen::ArrayXXf | p3, | ||
Eigen::ArrayXcf | derfact, | ||
RhoArray | rho_array, | ||
Eigen::ArrayXf | window, | ||
int | wlen, | ||
CalculationType | ct, | ||
CalcDirection | direct | ||
) |
Function computing the spatial derivatives of the domains.
The domain for which the derivative is being computed is p2. p1 and p3 are its neighbours. *
//TODO (remove the warning on the next line when everything is ported) WARNING - order in Python code: (p2,derfact,Wlength,A,Ns2,N1,N2,Rmatrix,p1,p3,var,direct) order in the C++ code: (p1,p2,p3,derfact,Rmatrix,window,wlen,var_index,direct) var_index=var and N1, N2 and Ns2 are derived from other inputs
p1 | variable matrix subdomain 1 |
p2 | variable matrix subdomain 2 |
p3 | variable matrix subdomain 3 |
fft_length | |
derfact | factor to compute derivative in wavenumber domain |
Rmatrix | matrix of reflection coefficients |
var_index | variable index: 0 for pressure, 1,2,3, for respectively x, z and y (in 3rd dimension) velocity |
direct | direction for computation of derivative |
const std::vector<CalculationType> OpenPSTD::Kernel::all_calculation_types |
const std::vector<Direction> OpenPSTD::Kernel::all_directions |
Convenience vectors.
const std::vector<float> OpenPSTD::Kernel::rk_coefficients |
Coefficients for a six stage RK time integration.