project_tbrom_on_mesh#

TwinModel.project_tbrom_on_mesh(rom_name, target_mesh, interpolate, named_selection=None)#

Project the field ROM data onto a targeted mesh, using the current states of the TwinModel. The returned PyVista DataSet object is automatically updated whenever the TwinModel is evaluated.

Parameters:
rom_namestr

Name of the TBROM considered to project the results.

target_mesh: pyvista.DataSet

PyVista DataSet object of the targeted mesh.

interpolate: bool

Flag to indicate whether the point cloud data are interpolated (True) or not (False) on the targeted mesh. Interpolation is recommended when point cloud data and mesh data are not ordered in the same way, and when the target mesh is different from the one used to generate the ROM. Interpolation is automatically enforced if the target mesh size (i.e. number of cells/points) is different from the point cloud size.

named_selection: str (optional)

Named selection from the ROM (i.e. subset of points cloud) that will be projected on the targeted mesh. The default is None, in which case the entire domain is considered.

Returns:
pyvista.DataSet

PyVista DataSet object of the targeted mesh with projected field ROM data.

Raises:
TwinModelError:

If TwinModel object has not been initialized. If rom_name is not included in the Twin’s list of TBROM If TBROM hasn’t its mode coefficients outputs connected to the twin’s outputs If target_mesh is not a valid grid dataset If name_selection is not included in the TBROM’s list of Named Selections If interpolate is True and no points file is available with the TBROM

TwinModelWarning:

If interpolate is False and the targeted mesh has a number of cells and points different from TBROM point cloud. In that case, interpolate is automatically switched to True.

Examples

>>> from pytwin import TwinModel
>>> import pyvista as pv
>>> # Instantiate a twin model, initialize it, and evaluate it step by step until you want to save its state
>>> model = TwinModel('model.twin')
>>> romname = model.tbrom_names[0]
>>> target_mesh = pv.read('mesh.vtk')
>>> rom_results_on_mesh = model.project_tbrom_on_mesh(romname, target_mesh)
>>> model.initialize_evaluation()