optimus.postprocess.common

Module Contents

Classes

PostProcess

Functions

calculate_bounding_box(domains_grids, plane_axes)

Calculate the bounding box for a set of grids.

find_int_ext_points(domains_grids, points, verbose)

Identify the interior and exterior points w.r.t. each grid.

compute_pressure_fields(model, points, ...)

Calculate the scattered and total pressure fields for visualisation.

compute_pressure_boundary(grid, boundary_points, ...)

Calculate pressure for points near or at the boundary of a domain. When the solid

ppi_calculator(bounding_box, resolution)

To convert resolution to diagonal ppi

domain_edge(model, plane_axes, plane_offset)

Determine the points at the edges of the domains by computing the intersection of

array_to_imshow(field_array)

Convert a two-dimensional array to a format for imshow plots.

class optimus.postprocess.common.PostProcess(model, verbose=False)
abstract create_computational_grid(**kwargs)

Create the grid on which to calculate the pressure field. Needs to be overridden by specific source type.

Parameters
kwargsdict

Options to be specified for different types of postprocessing.

abstract compute_fields()

Calculate the pressure field in the specified locations.Needs to be overridden by specific source type.

print_parameters()

Display parameters used for visualisation.

optimus.postprocess.common.calculate_bounding_box(domains_grids, plane_axes)

Calculate the bounding box for a set of grids.

Parameters
domains_gridslist optimus.Grid

The grids of the subdomains.

plane_axestuple int

The two indices of the boundary plane. Possible values are 0,1,2 for x,y,z axes, respectively.

Returns
bounding_box: list float

Bounding box specifying the visualisation section on the plane_axis as a list: axis1_min, axis1_max, axis2_min, axis2_max

optimus.postprocess.common.find_int_ext_points(domains_grids, points, verbose)

Identify the interior and exterior points w.r.t. each grid.

Parameters
domains_gridslist optimus.Grid

The grids of the subdomains.

pointsnumpy.ndarray

The field points. The size of the array should be (3,N).

verboseboolean

Display the logs.

Returns
points_interiorlist numpy.ndarray

A list of numpy arrays of size (3,N), where element i of the list is an array of coordinates of the interior points for domain i, i=1,…,no_subdomains.

points_exteriornumpy.ndarray

An array of size (3,N) with visualisation points in the exterior domain

points_boundarylist numpy.ndarray

A list of arrays of size (3,N) with visualisation points at, or close to, grid boundaries.

index_interiorlist numpy.ndarray

A list of arrays of size (1,N) with boolean values, identifying the interior points for each domain.

index_exteriornumpy.ndarray

An array of size (1,N) with boolean values, identifying the exterior points.

index_boundarylist numpy.ndarray

A list of arrays of size (1,N) with boolean values, identifying the boundary points.

optimus.postprocess.common.compute_pressure_fields(model, points, points_exterior, index_exterior, points_interior, index_interior, points_boundary, index_boundary, verbose)

Calculate the scattered and total pressure fields for visualisation.

Parameters
modeloptimus.Model

A model object which has solution attributes already computed.

pointsnumpy.ndarray

An array of size (3,N) with the visualisation points.

points_exteriornumpy.ndarray

An array of size (3,N) with the visualisation points in the exterior domain.

index_exteriornumpy.ndarray

An array of size (1,N) with boolean values indentifying the exterior points.

points_interiorlist numpy.ndarray

A list of arrays of size (3,N), where element i of the list is an array of coordinates of the interior points for domain i, i=1,…,no_subdomains

index_interiorlist numpy.ndarray

A list of arrays of size (1,N) with boolean values indentifying the interior points.

points_boundarylist numpy.ndarray

A list of arrays of size (3,N), where element i of the list is an array of coordinates of the boundary points for domain i, i=1,…,no_subdomains

index_boundarylist numpy.ndarray

A list of boolean arrays of size (1,N), identifying the boundary points.

verbosebool

Display the logs.

Returns
total_fieldnumpy.ndarray

An array of size (1,N) with complex values of the total pressure field.

scattered_fieldnumpy.ndarray

An array of size (1,N) with complex values of the scatterd pressure field.

incident_exterior_fieldnumpy.ndarray

An array of size (1,N) with complex values of the incident pressure field in the exterior domain.

optimus.postprocess.common.compute_pressure_boundary(grid, boundary_points, dirichlet_solution)

Calculate pressure for points near or at the boundary of a domain. When the solid angle associated with a boundary vertex is below 0.1, it is assumed to lie on the boundary.

Parameters
gridbempp.api.Grid

The surface mesh of bempp.

boundary_pointsnumpy.ndarray

An array of size (3,N) with the coordinates of vertices on the domain boundary.

dirichlet_solutionnumpy.ndarray

An array of size (N,) with the Dirichlet component of the solution vector on the boundary.

Returns
total_boundary_pressurenumpy.ndarray

An array of size (N,) with complex values of the pressure field.

optimus.postprocess.common.ppi_calculator(bounding_box, resolution)

To convert resolution to diagonal ppi

Parameters
bounding_boxlist float

list of min and max of the 2D plane

resolutionlist float

list of number of points along each direction

Returns
resolutionfloat

resolution in ppi

optimus.postprocess.common.domain_edge(model, plane_axes, plane_offset)

Determine the points at the edges of the domains by computing the intersection of the grid triangular elements with planes of constant x, y or z. The intersection points are then sorted by proximity to one another.

Parameters
modeloptimus.Model

A model object which has solution attributes already computed.

plane_axeslist[int]

The axes of the plane.

plane_offsetfloat

Offset of the visualisation plane defined along the third axis.

Returns
domains_edge_pointslist[numpy.ndarray]

list of numpy arrays of coordinates of points on the edges

optimus.postprocess.common.array_to_imshow(field_array)

Convert a two-dimensional array to a format for imshow plots.

Parameters
field_arraynumpy.ndarray

The two-dimensional array with grid values.

Returns
field_imshownumpy.ndarray

The two-dimensional array for imshow plots.