開発版ドキュメント · 0.2.3 30c2f8ba · 入門例の検証対象 0.2.3 · 版情報 · 既知の制限

gwexpy.interop.meshio_#

Interoperate with meshio unstructured-mesh field data.


Interoperability with meshio for unstructured-mesh field data.

meshio reads 40+ mesh formats (XDMF, VTK/VTU, Gmsh, Abaqus, COMSOL, …) into a uniform meshio.Mesh object with points, cells, point_data and cell_data.

Since GWexpy's ScalarField requires a regular grid, this module interpolates unstructured mesh data to a regular grid using scipy.interpolate.griddata.

参照

nschloe/meshio

Functions

from_fenics_vtk(cls, filepath, *[, ...])

Read a VTK/VTU file via meshio and convert to ScalarField.

from_fenics_xdmf(cls, filepath, *[, ...])

Read a dolfinx XDMF file via meshio and convert to ScalarField.

from_meshio(cls, mesh, *[, field_name, ...])

Convert a meshio.Mesh to a GWexpy ScalarField or VectorField.

gwexpy.interop.meshio_.from_meshio(cls: type, mesh: Any, *, field_name: str | None = None, grid_resolution: float, method: str = 'linear', axis0: ndarray | None = None, axis0_domain: Literal['time', 'frequency'] = 'time', unit: Any | None = None) ScalarField | VectorField#

Convert a meshio.Mesh to a GWexpy ScalarField or VectorField.

The unstructured mesh data is interpolated onto a regular grid using scipy.interpolate.griddata.

パラメータ:
  • cls (type) -- ScalarField or VectorField.

  • mesh (meshio.Mesh) -- Input mesh object.

  • field_name (str, optional) -- Key in point_data or cell_data to use. Defaults to the first available field.

  • grid_resolution (float) -- Spacing of the output regular grid (mandatory).

  • method ({"linear", "nearest"}, default "linear") -- Interpolation method.

  • axis0 (ndarray, optional) -- Values for axis0 (e.g. time steps). Default: singleton [0].

  • axis0_domain ({"time", "frequency"}, default "time") -- Physical domain of axis0.

  • unit (str or astropy unit, optional) -- Unit of the field values.

戻り値の型:

ScalarField or VectorField

メモ

Only point_data is supported for interpolation. If the mesh contains only cell_data and no point_data, a ValueError is raised. To use cell data, first convert it to point data (e.g. meshio's cell_data_to_point_data utility).

gwexpy.interop.meshio_.from_fenics_xdmf(cls: type, filepath: str | Path, *, field_name: str | None = None, grid_resolution: float, method: str = 'linear', unit: Any | None = None) ScalarField | VectorField#

Read a dolfinx XDMF file via meshio and convert to ScalarField.

パラメータ:
  • cls (type) -- ScalarField or VectorField.

  • filepath (str or Path) -- Path to the .xdmf file.

  • field_name (str, optional) -- Field name in the XDMF data.

  • grid_resolution (float) -- Regular grid spacing (mandatory).

  • method ({"linear", "nearest"}, default "linear") -- Interpolation method.

  • unit (str or astropy unit, optional) -- Physical unit of the field values.

戻り値の型:

ScalarField or VectorField

gwexpy.interop.meshio_.from_fenics_vtk(cls: type, filepath: str | Path, *, field_name: str | None = None, grid_resolution: float, method: str = 'linear', unit: Any | None = None) ScalarField | VectorField#

Read a VTK/VTU file via meshio and convert to ScalarField.

パラメータ:
  • cls (type) -- ScalarField or VectorField.

  • filepath (str or Path) -- Path to a .vtk or .vtu file.

  • field_name (str, optional) -- Field name in the VTK point/cell data.

  • grid_resolution (float) -- Regular grid spacing (mandatory).

  • method ({"linear", "nearest"}, default "linear") -- Interpolation method.

  • unit (str or astropy unit, optional) -- Physical unit of the field values.

戻り値の型:

ScalarField or VectorField