get_tbrom_output_field_on_mesh#
- TwinModel.get_tbrom_output_field_on_mesh(rom_name)#
Return the TBROM output field projected on the target mesh, as a PyVista DataSet object or a dictionary of PyVista DataSet objects (one per named selection). The resulting field is based on current states of the TwinModel and is automatically updated whenever the TwinModel is evaluated.
Note
pytwin.TwinModel.project_tbrom_on_mesh()must be called before this method.- Parameters:
- rom_name
str Name of the ROM. To get a list of available ROMs, see the
pytwin.TwinModel.tbrom_namesattribute.
- rom_name
- Returns:
pyvista.DataSetIf
pytwin.TwinModel.project_tbrom_on_mesh()was previously called without a named selection, returns the PyVista DataSet of the full-domain projection.dict[str,pyvista.DataSet]If
pytwin.TwinModel.project_tbrom_on_mesh()was previously called with named selections (once or multiple times), returns a dictionary mapping each projected named selection name to its PyVista DataSet.
- Raises:
- TwinModelError:
If
TwinModelobject does not include any TBROMs. If the provided ROM name is not available. Ifpytwin.TwinModel.project_tbrom_on_mesh()has not been called yet for this TBROM. If TBROM hasn’t its mode coefficients outputs connected to the twin’s outputs.
Examples
>>> from pytwin import TwinModel >>> import pyvista as pv >>> # Example 1 - Full-domain projection (no named selection) >>> model = TwinModel(model_filepath='path_to_twin_model_with_TBROM_in_it.twin') >>> model.initialize_evaluation() >>> romname = model.tbrom_names[0] >>> target_mesh = pv.read('mesh.vtk') >>> model.project_tbrom_on_mesh(romname, target_mesh, interpolate=True) >>> rom_results_on_mesh = model.get_tbrom_output_field_on_mesh(romname) >>> # rom_results_on_mesh is a pyvista.DataSet >>> # Example 2 - Named-selection projection >>> model = TwinModel(model_filepath='path_to_twin_model_with_TBROM_in_it.twin') >>> model.initialize_evaluation() >>> romname = model.tbrom_names[0] >>> nslist = model.get_named_selections(romname) >>> target_mesh = pv.read('mesh.vtk') >>> for ns in nslist: >>> model.project_tbrom_on_mesh(romname, target_mesh, interpolate=True, named_selection=ns) >>> rom_results_on_mesh = model.get_tbrom_output_field_on_mesh(romname) >>> # rom_results_on_mesh is a dict: {ns_name: pyvista.DataSet}