GeneralFlowEnvironment#
- class acoular.environments.GeneralFlowEnvironment
Bases:
EnvironmentAn acoustic environment with a generic flow field.
This class provides the facilities to calculate the travel time (distances) between grid point locations and microphone locations in a generic flow field with non-uniform velocities that depend on the location. The algorithm for the calculation uses a ray-tracing approach that bases on rays cast from every microphone position in multiple directions and traced backwards in time. The result is interpolated within a tetrahedal grid spanned between these rays.
See also
scipy.interpolate.LinearNDInterpolatorPiecewise linear interpolator in N > 1 dimensions.
Examples
>>> import numpy as np >>> import acoular as ac >>> >>> # Instantiate the flow field >>> flow_field = ac.OpenJet(v0=10.0, D=0.4, l=3.121) >>> >>> # Create an instance of GeneralFlowEnvironment >>> environment = ac.GeneralFlowEnvironment( ... ff=flow_field, # Use the custom flow field ... N=300, # Number of rays ... Om=np.pi, # Maximum solid angle ... )
- ff = Instance(FlowField, desc='flow field')
The flow field object describing the velocity field, which must be an instance of
FlowField.
- N = Int(200, desc='number of rays per Om')
The number of rays used per solid angle \(\Omega\). Defaults to
200.
- Om = Float(np.pi, desc='maximum solid angle')
The maximum solid angle (in steradians) used in the ray-tracing algorithm. Default is
numpy.pi.
- digest = Property( …
A unique identifier based on the environment properties. (read-only)
- idict = Dict
A dictionary for storing precomputed interpolators to optimize repeated calculations. (internal use)
- get_interpolator(roi, x0)
Generate an interpolator for ray travel times based on a region of interest.
This method computes the ray trajectories starting from a given microphone position (
x0) through a region of interest (roi). The rays’ paths are integrated numerically using a system of differential equations, and the resulting points are used to construct a convex hull. A linear interpolator is then created to estimate travel times for arbitrary points within the region.- Parameters:
- roi
numpy.ndarrayoffloats Array representing the region of interest (ROI), where each column corresponds to a point in the 3D space \((x, y, z)\), shape (3, M).
- x0
numpy.ndarrayoffloats Array representing the location of the microphone in 3D Cartesian coordinates, shape (3,).
- roi
- Returns:
scipy.interpolate.LinearNDInterpolatorobjectA linear interpolator object for estimating travel times for 3D positions within the computed ray trajectories.