fieldinterpmesh.py

class FieldInterpMesh(sim_data, components, elem_dims)[source]

Bases: FieldInterp

TODO

__init__(sim_data, components, elem_dims)[source]
Parameters:
  • sim_data (mh.SimData) – _description_

  • components (tuple[str,...]) – _description_

  • elem_dims (int) – _description_

interp_field(points, sample_times=None)[source]

_summary_

Parameters:
  • points (np.ndarray) – _description_

  • times (np.ndarray | None, optional) – _description_, by default None

Returns:

np.ndarray – _description_

sample_pyvista_grid(components, pyvista_interp, sim_time_steps, points, sample_times=None)[source]

Function for sampling (interpolating) a pyvista grid object containing simulated field data. The pyvista sample method uses VTK to perform the spatial interpolation using the element shape functions. If the sampling time steps are not the same as the simulation time then a linear interpolation over time is performed using numpy.

NOTE: sampling outside the mesh bounds of the sample returns a value of 0.

Parameters:
  • components (tuple[str,...]) – String keys for the components to be sampled in the pyvista grid object. Useful for only interpolating the field components of interest for speed and memory reduction.

  • pyvista_interp (pv.UnstructuredGrid) – Pyvista grid object containing the simulation mesh and the components of the physical field that will be sampled.

  • sim_time_steps (np.ndarray) – Simulation time steps corresponding to the fields in the pyvista grid object.

  • points (np.ndarray) – Coordinates of the points at which to sample the pyvista grid object. shape=(num_points,3) where the columns are the X, Y and Z coordinates of the sample points in simulation world coordintes.

  • sample_times (np.ndarray | None, optional) – Array of time steps at which to sample the pyvista grid. If None then no temporal interpolation is performed and the sample times are assumed to be the simulation time steps.

Returns:

np.ndarray – Array of sampled sensor measurements with shape=(num_sensors, num_field_components,num_time_steps).