BaseSimulation#

class ansys.speos.core.simulation.BaseSimulation(project, name, description='', metadata=None, simulation_instance=None, job=None)#

Super Class for all simulations.

Parameters:
projectansys.speos.core.project.Project

Project in which simulation shall be created.

namestr

Name of the simulation.

descriptionstr

Description of the Simulation. By default, "".

metadataOptional[Mapping[str, str]]

Metadata of the feature. By default, {}.

simulation_instanceansys.api.speos.scene.v2.scene_pb2.Scene.SimulationInstance, optional

Simulation instance to provide if the feature does not have to be created from scratch By default, None, means that the feature is created from scratch by default.

jobansys.speos.core.kernel.job.ProtoJob, optional

Saved simulation job to restore, shared by reference. If omitted, a new local job is created.

Parameters:
  • project (BaseSimulation.__init__.project)

  • name (str)

  • description (str)

  • metadata (Optional[Mapping[str, str]])

  • simulation_instance (Optional[ansys.speos.core.kernel.scene.ProtoScene.SimulationInstance])

  • job (Optional[ansys.speos.core.kernel.job.ProtoJob])

Notes

This is a Super class, Do not instantiate this class yourself

Overview#

add_source_group

Add a source group to the simulation.

remove_source_group

Remove a source group from the simulation.

clear_source_groups

Remove all source groups from the simulation.

export

Export simulation.

set_texture_disabled

Disable texture handling.

set_texture_normalization_none

Use both the image texture and the texture mapping optical properties.

set_texture_normalization_color_from_texture

Set texture normalization to color-from-texture mode.

set_texture_normalization_color_from_bsdf

Set texture normalization to color-from-BSDF mode.

compute_CPU

Compute the simulation on CPU.

compute_GPU

Compute the simulation on GPU.

stop_computation

Stop the simulation computation.

get

Get dictionary corresponding to the project - read only.

commit

Save feature: send the local data to the speos server database.

reset

Reset feature: override local data by the one from the speos server database.

delete

Delete feature: delete data from the speos server database.

sensor_paths

Sensor paths.

source_paths

Source paths.

source_groups

Source groups assigned to the simulation.

geom_distance_tolerance

Geometry distance tolerance.

max_impact

Maximum number of impacts.

texture_normalization

Return Texture Normalization Type of the Simulation.

simulation_template_link

Link object for the simulation template in database.

job_link

Link object for the job in database.

result_list

List of results created after a simulation compute.

__str__

Return the string representation of the simulation.

Import detail#

from ansys.speos.core.simulation import BaseSimulation

Property detail#

property BaseSimulation.sensor_paths: List[str]#

Sensor paths.

This property gets or sets the sensor paths that the simulation will take into account.

Parameters:
sensor_pathsList[str]

The sensor paths.

Returns:
List[str]

The sensor paths.

property BaseSimulation.source_paths: List[str]#

Source paths.

This property gets or sets the source paths that the simulation will take into account.

Parameters:
source_pathsList[str]

The source paths.

Returns:
List[str]

The source paths.

property BaseSimulation.source_groups: List[BaseSimulation]#

Source groups assigned to the simulation.

Returns:
List[ansys.speos.core.simulation.BaseSimulation.SourceGroup]

Source groups bound to the simulation instance.

property BaseSimulation.geom_distance_tolerance: float#

Geometry distance tolerance.

This property gets or sets the geometry distance tolerance used by the virtual bsdf bench simulation.

Parameters:
valuefloat

Maximum distance in mm to consider two faces as tangent to assign. By default, 0.01

Returns:
float

Maximum distance in mm to consider two faces as tangent.

property BaseSimulation.max_impact: int#

Maximum number of impacts.

This property gets or sets the maximum number of impacts used by the virtual bsdf bench simulation.

Parameters:
valueint

The maximum number of impacts to assign. By default, 100.

Returns:
int

The maximum number of impacts.

property BaseSimulation.texture_normalization: ansys.speos.core.generic.parameters.TextureNormalizationTypes#

Return Texture Normalization Type of the Simulation.

Returns:
Union[TextureNormalizationTypes]

Provides clear text readable texture normalization applied during simulation.

Attribute detail#

Link object for the simulation template in database.

Link object for the job in database.

BaseSimulation.result_list = []#

List of results created after a simulation compute.

Method detail#

BaseSimulation.add_source_group(name, source_paths)#

Add a source group to the simulation.

Parameters:
namestr

Name of the source group.

source_pathsList[Union[str, BaseSource]]

Sources to add to the group. Each path must already belong to source_paths of the simulation.

Returns:
ansys.speos.core.simulation.BaseSimulation.SourceGroup

Added source group wrapper.

Raises:
ValueError

If one of the given source paths is not included in the simulation.

BaseSimulation.remove_source_group(name)#

Remove a source group from the simulation.

Parameters:
namestr

Name of the source group to remove.

Returns:
ansys.speos.core.simulation.BaseSimulation

Simulation feature.

Raises:
ValueError

If no source group with the provided name exists.

BaseSimulation.clear_source_groups()#

Remove all source groups from the simulation.

Returns:
ansys.speos.core.simulation.BaseSimulation

Simulation feature.

BaseSimulation.export(export_path)#

Export simulation.

Parameters:
export_path: Union[str, Path]

directory to export simulation to.

Returns:
None
BaseSimulation.set_texture_disabled()#

Disable texture handling.

BaseSimulation.set_texture_normalization_none()#

Use both the image texture and the texture mapping optical properties.

BaseSimulation.set_texture_normalization_color_from_texture()#

Set texture normalization to color-from-texture mode.

BaseSimulation.set_texture_normalization_color_from_bsdf()#

Set texture normalization to color-from-BSDF mode.

BaseSimulation.compute_CPU(threads_number=None, export_vtp=False)#

Compute the simulation on CPU.

Parameters:
threads_numberint, optional

The number of threads used. By default, None, means the number of processor available.

export_vtp: bool, optional

True to generate vtp from the simulation results.

Returns:
Union[tuple[list[Result], list[Path]], list[Result]]
List of simulation results or 2 lists of simulation results

and exported vtp results.

BaseSimulation.compute_GPU(export_vtp=False)#

Compute the simulation on GPU.

Parameters:
export_vtp: bool, optional

True to generate vtp from the simulation results.

Returns:
Union[tuple[list[Result], list[Path]], list[Result]]
List of simulation results or 2 lists of simulation results

and exported vtp results.

BaseSimulation.stop_computation()#

Stop the simulation computation.

BaseSimulation.get(key='')#

Get dictionary corresponding to the project - read only.

Parameters:
key: str
Returns:
str | dict

Dictionary of Simulation Feature

BaseSimulation.__str__()#

Return the string representation of the simulation.

BaseSimulation.commit()#

Save feature: send the local data to the speos server database.

Returns:
ansys.speos.core.simulation.BaseSimulation

Simulation feature.

BaseSimulation.reset()#

Reset feature: override local data by the one from the speos server database.

Returns:
ansys.speos.core.simulation.BaseSimulation

Simulation feature.

BaseSimulation.delete()#

Delete feature: delete data from the speos server database.

The local data are still available

Returns:
ansys.speos.core.simulation.BaseSimulation

Simulation feature.

Classes#

SourceSampling

Source sampling mode.

Weight

The Weight represents the ray energy.

SourceGroup

Source group for simulation source layering.