Interactions
Interaction definitions.
Connectors
- class onscale.Connector(connector_type: None | ConnectorType | str = ConnectorType.GENERAL, guide: Node | None = None, follower: Node | None = None, coord_system: CoordinateSystem | None = None, const_offset: bool | None = None, restrain_x: bool | None = None, restrain_y: bool | None = None, restrain_z: bool | None = None, restrain_x_rot: bool | None = None, restrain_y_rot: bool | None = None, restrain_z_rot: bool | None = None, alias: str | None = None)
A connector element to constrain relative degrees-of-freedom between two bodies or a body and a point mass
- Examples:
>>> import onscale as on >>> >>> with on.Simulation("Static Solve") as sim: ... geom = on.CadFile("I_Beam_1.step") ... rb = on.Body(body_type="rigid", ref_point=[0, 0, 0]) ... pm = on.PointMass(mass=42, location=[1, 1, 1]) ... c1 = on.Connector(connector_type=on.ConnectorType.BALL, ... guide=pm, follower=rb)
- Parameters:
connector_type –
Optional connector type. This can either be represented as a string such as
"Ball"
or an enum such ason.ConnectorType.BALL
Ball - constrains all relative translations (X, Y, Z constrained)
Fastened - constrains all relative translations and rotations (X, Y, Z, RX, RY, RZ constrained)
Link - constant distance between connections
Beam - constant distance and constant orientation between connections
Planar - two translations and one rotation available (eg. Z, RX, RY constrained)
Slider - one translation available (eg. X, Y, RX, RY, RZ constrained)
Revolute - constant distance between connections and RX available
Cylindrical - allows translation along and rotation about one axis(eg. X, Y, RX, RY constrained)
Pinslot - allows translation along one axis and rotation about another (eg. Y, Z, RX, RY constrained)
Parallel - allows translation along any axis and rotation about axis normal to parallel plane (eg. RX, RY constrained)
Tangent - non-separating slider tangent to a specified surface (not yet supported)
General - any combination of X, Y, Z, RX, RY, RZ can be constrained
Defaults to “General”
guide – Body or point mass at one end of the connector, which controls the degrees-of-freedom of the connector
follower – Body or point mass at the other end of the connector, whose degrees-of-freedom are controlled by the guide
coord_system – The coordinate system in which the restraints are enforced
restrain_x – If true, will restrain translation along the X-axis
restrain_y – If true, will restrain translation along the Y-axis
restrain_z – If true, will restrain translation along the Z-axis
restrain_x_rot – If true, will restrain rotation about the X-axis
restrain_y_rot – If true, will restrain rotation about the Y-axis
restrain_z_rot – If true, will restrain rotation about the Z-axis
const_offset – If true, will maintain constant distance
alias – Optional alias for this node
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Spring Models
Spring model definitions
- class onscale.spring_models.SpringModel(alias: str | None = None)
- Parameters:
alias – Optional alias for this node
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Elastic
- class onscale.spring_models.Elastic(stiffness_x: float | str | Var | Function | None = None, stiffness_y: float | str | Var | Function | None = None, stiffness_z: float | str | Var | Function | None = None, stiffness_x_rot: float | str | Var | Function | None = None, stiffness_y_rot: float | str | Var | Function | None = None, stiffness_z_rot: float | str | Var | Function | None = None, damping_x: float | str | Var | Function | None = None, damping_y: float | str | Var | Function | None = None, damping_z: float | str | Var | Function | None = None, damping_x_rot: float | str | Var | Function | None = None, damping_y_rot: float | str | Var | Function | None = None, damping_z_rot: float | str | Var | Function | None = None, alias: str | None = None)
Definition of elastic spring behavior, which consists of stiffnesses and dampings along the axial directions
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... spring_model = on.spring_models.Elastic(stiffness_x=0.21, ... stiffness_y=0.33, ... stiffness_z=0.54, ... stiffness_x_rot=0.41, ... stiffness_y_rot=0.52, ... stiffness_z_rot=0.0, ... damping_x=0.2, ... damping_y=0.3, ... damping_z=0.14, ... damping_x_rot=0.1, ... damping_y_rot=0.0, ... damping_z_rot=0.0, ... alias="my_elastic_model")
- Parameters:
stiffness_x – Stiffness in x
stiffness_y – Stiffness in y
stiffness_z – Stiffness in z
stiffness_x_rot – Stiffness about x
stiffness_y_rot – Stiffness about y
stiffness_z_rot – Stiffness about z
damping_x – Damping in x
damping_y – Damping in y
damping_z – Damping in z
damping_x_rot – Damping about x
damping_y_rot – Damping about y
damping_z_rot – Damping about z
- property bounds_types: Dict[str, BoundsType]
For specifying which fields need to be verified :return: a k,v map of fields names to coefficient types
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Springs
- class onscale.Spring(spring_model: Node | None = None, guide: Node | None = None, follower: Node | None = None, coord_system: CoordinateSystem | None = None, alias: str | None = None)
A spring element to define behavior (such as elastic stiffness) between two bodies or a body and a point mass such that relative motion between them creates forces acting at the connection points
- Examples:
>>> import onscale as on >>> >>> with on.Simulation("Static Solve") as sim: ... geom = on.CadFile("I_Beam_1.step") ... rb = on.Body(body_type="rigid", ref_point=[0, 0, 0]) ... pm = on.PointMass(mass=42, location=[1, 1, 1]) ... spring_model = on.spring_models.Elastic(stiffness_x=0.21, ... stiffness_y_rot=0.52, ... damping_z=0.14, ... alias="my_elastic_model") ... s1 = on.Spring(spring_model=spring_model, guide=pm, follower=rb, ... alias='my_spring')
- Parameters:
spring_model – The spring model to use to define behavior
guide – Body or point mass at one end of the spring, which controls the degrees-of-freedom of the spring
follower – Body or point mass at the other end of the spring, whose degrees-of-freedom are controlled by the guide
coord_system – The coordinate system in which the restraints are enforced
alias – Optional alias for this node
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Contact
- class onscale.interactions.Contact(bonded: bool | None = None, enforce_contact: bool | None = None, method: ContactMethod | None = None, interaction_type: None | str | InteractionType = None, thermally_insulated: bool | None = None, thermal_resistance: float | str | Var | Function | None = None, side_a: SelectionSet | None = None, side_b: SelectionSet | None = None, guide: str | Guide | None = None, tolerance: float | str | Var | Function | None = None, alias: str | None = None)
Contact interaction definitions between touching faces.
Examples
>>> import onscale as on >>> >>> with on.Simulation("Static Solve") as sim: ... geom = on.CadFile("I_Beam_1.step") ... ... # sliding contact with explicitly created selection sets ... selection_set_1 = on.SelectionSet() ... selection_set_1 >> geom.parts[0].faces[0] ... selection_set_2 = on.SelectionSet() ... selection_set_2 >> geom.parts[1].faces[0] ... contact_method = on.interactions.contact_methods.PenaltyMethod() ... guide = on.interactions.Guide.SIDE_A ... sliding_contact = on.interactions.Contact(bonded=False, enforce_contact=True, side_a=selection_set_1, side_b=selection_set_2, method=contact_method, guide=guide) ... ... # sliding contact with implicitly created selection sets ... sliding_contact2 = on.interactions.Contact(bonded=False, enforce_contact=True, method=contact_method, guide=guide) ... sliding_contact2.side_a >> geom.parts[2].faces[3] ... sliding_contact2.side_b >> geom.parts[3].faces[1] ... ... # bonded contact ... selection_set_3 = on.SelectionSet() ... selection_set_3 >> geom.parts[5].faces[2] ... selection_set_4 = on.SelectionSet() ... selection_set_4 >> geom.parts[6].faces[2] ... glue = on.interactions.Contact(bonded=True, enforce_contact=False, side_a=selection_set_3, side_b=selection_set_4, thermally_insulated=False, thermal_resistance=0.4, tolerance=0.0002)
Construct a Contact.
- Parameters:
bonded – Boolean specifying if the faces should be bonded (aka glued) together or in sliding contact. Defaults to False.
enforce_contact – Boolean specifying if contact should be enforced (penetration should be disallowed) Defaults to False (meaning penetration will be allowed) Only applicable if bonded=False.
method – Can be either on.interactions.contact_methods.PenaltyMethod or AugmentedLagrangian
interaction_type – Either “node_to_surface” or “surface_to_surface”
thermally_insulated – Boolean specifying if the bonded contact (glued) interface is thermally insulated.
thermal_resistance – The thermal resistance across the bonded contact (glue) interface. Only applicable if thermally_insulated=False.
side_a – One side of the contact pair. Must be a SelectionSet type. (A SelectionSet will be created by default if one isn’t provided)
side_b – The other side of the contact pair. Must be a SelectionSet type (A SelectionSet will be created by default if one isn’t provided)
guide – Either “side_a” or “side_b” - the selected side will act as the guide in the contact interaction
tolerance – Tolerance value for the solver to use for bonded contact. Will override the solver default. This is not used for sliding contact.
alias – Optional alias for this node
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.