optimus.postprocess

Submodules

Package Contents

Classes

VisualisePlane

VisualisePlaneAndBoundary

VisualiseCloudPoints

Functions

plot_pressure_field(postprocess_obj[, field, unit, ...])

2D contour plotting of the real part and the magnitude of the pressure field.

export_to_file(model, post_process, global_parameters)

Export the simulation results into a file.

import_from_file(file_name)

Import the saved data from a file.

class optimus.postprocess.VisualisePlane(model, verbose=False)

Bases: optimus.postprocess.common.PostProcess

create_computational_grid(resolution=(141, 141), plane_axes=(0, 1), plane_offset=0.0, bounding_box=None)

Create a planar grid to compute the pressure fields.

Parameters
resolutionlist[int], tuple[int]

Number of points along the two axes.

plane_axeslist[int], tuple[int]

The indices of the axes for the visualisation plane. Possible values are 0,1,2 denoting the x,y,z axes, respectively. Default: (0, 1).

plane_offsetfloat

Offset of the visualisation plane defined along the third axis. Default: 0.

bounding_boxlist[float], tuple[float]

Bounding box specifying the visualisation section along the plane’s axes: [axis1_min, axis1_max, axis2_min, axis2_max]

compute_fields()

Calculate the scattered and total pressure fields in the planar grid.

class optimus.postprocess.VisualisePlaneAndBoundary(model, verbose=False)

Bases: optimus.postprocess.common.PostProcess

create_computational_grid(resolution=(141, 141), plane_axes=(0, 1), plane_offset=0.0, bounding_box=None)

Create a planar grid to compute the pressure fields.

Parameters
resolutionlist[int], tuple[int]

Number of points along the two axes.

plane_axeslist[int], tuple[int]

The indices of the axes for the visualisation plane. Possible values are 0,1,2 denoting the x,y,z axes, respectively. Default: (0, 1).

plane_offsetfloat

Offset of the visualisation plane defined along the third axis. Default: 0.

bounding_boxlist[float], tuple[float]

Bounding box specifying the visualisation section along the plane’s axes: [axis1_min, axis1_max, axis2_min, axis2_max]

compute_fields(file_name='planar_and_surface')

Calculate the scattered and total pressure fields in the planar grid created. Export the field values to gmsh files.

Parameters
file_namestr

The name for the output file. The results are saved as GMSH files. GMSH should be used for visualisation.

class optimus.postprocess.VisualiseCloudPoints(model, verbose=False)

Bases: optimus.postprocess.common.PostProcess

create_computational_grid(points)

Create a point cloud to compute the pressure fields.

Parameters
points: numpy.ndarray

Array of size (3,N) with points on which to calculate the pressure field.

compute_fields()

Calculate the scattered and total pressure fields in the postprocess grid.

optimus.postprocess.plot_pressure_field(postprocess_obj, field='total', unit='Pa', display_edges=True, clim=None, file_name=None)

2D contour plotting of the real part and the magnitude of the pressure field.

Parameters
postprocess_objoptimus.postprocess.PostProcess

Optimus postprocess object that includes the visualisation pressure fields

fieldstring

The pressure field to be plotted. The options are:

  1. total, total_field, or total_pressure;

  2. scattered, scattered_pressure, or scattered_field.

  3. incident, incident_pressure, or incident_field.

unitstring

The pressure unit for the plot, where the data is assumed to be in Pa. The options are: Pa, kPa, MPa and GPa.

display_edgesboolean

Display domains edges, i.e. domains and plane interfaces.

climtuple (float, int)

The color limits: (clim_min, clim_max). Must be of the same units as pressure fields.

file_nameNone, str

The file name to export the figure, if specified. The labels ‘real’ and ‘abs’ are prepended.

Returns
fig_p_real, fig_p_totmatplotlib.Figure

Contour plots of the real and absolute value of the pressure field.

optimus.postprocess.export_to_file(model, post_process, global_parameters, file_name='optimus_exported_data', file_format='db')

Export the simulation results into a file.

Parameters
modeloptimus.model.Model

An instance of the optimus model object.

post_processoptimus.postprocess.PostProcess

An instance of the optimus postprocess object.

global_parametersAny

The global parameters of the simulation.

file_namestr

The export path and the file name in one string.

file_formatstr

‘mat’: to save ONLY the post_process results into a MATLAB file. ‘db’: (default) to save all the attributes of global parameters, source parameters, post processor and pickable objects of the model.

optimus.postprocess.import_from_file(file_name)

Import the saved data from a file.

Parameters
file_namestr

This string includes the file name (with path) and the file extension in one string. The supported extensions are ‘mat’ and ‘db’.

Returns
imported_datadict

A dictionary of different objects imported from the data file.