Meshes

Mesh object definitions.

Pre-generated Mesh Files

class onscale.meshes.MeshFile(path: str)

Use a pre-generated mesh file.

Only one mesh file may exist in a simulation.

Examples

>>> import onscale as on
>>>
>>> with on.Simulation('My Sim') as sim:
...     on.meshes.MeshFile('my_generated_mesh.msh')
Parameters:

path – Name of mesh file to use.

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

Refinement

class onscale.meshes.MeshRefinement(scale_factor: float | str | Var | Function | None = None, extent_radius: float | str | Var | Function | None = None, alias: str | None = None)

Use a refinement node for general mesh refinement

Example for point refinement:
>>> import onscale as on
>>>
>>> with on.Simulation("Static Solve") as sim:
...     geom = on.ParametricCad(["I_Beam_1.step", "I_Beam_2.step"])
...     point = on.Point(0,0,0)
...     refinement = on.meshes.MeshRefinement( scale_factor=0.2, extent_radius=0.05, alias="refine1" )
...     refinement >> point
Parameters:
  • scale_factor – Refinement relative to the parent mesh

  • extent_radius – Radius distance around a point up to which the refinement should extend. Only applicable for point refinements.

  • 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.

Structure Mesh Configurations

StructuredMesh

class onscale.meshes.StructuredMesh(alias: str | None = None)

Base class for StructuredMesh Meshes

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     geom = on.CadFile("swing_arm.step")
...     mesh1 = on.meshes.StructuredMesh(alias='mesh1')
...     mesh1.set('elements_per_wavelength', 15)
...     mesh1 >> geom.parts[0:5]
Parameters:

alias – Optional alias for this node

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

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.

StructuredVeryCoarse

class onscale.meshes.StructuredVeryCoarse(alias: str | None = None)

Class to define Structured Mesh with Very Coarse resolution

The grid defined will have an element size that will allow 4 elements along the shortest side of the domain

Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

StructuredCoarse

class onscale.meshes.StructuredCoarse(alias: str | None = None)

Class to define Structured Mesh with Coarse resolution

The grid defined will have an element size that will allow 10 elements along the shortest side of the domain

Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

StructuredMedium

class onscale.meshes.StructuredMedium(alias: str | None = None)

Class to define Structured Mesh with Medium resolution

The grid defined will have an element size that will allow 50 elements along the shortest side of the domain

Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

StructuredFine

class onscale.meshes.StructuredFine(alias: str | None = None)

Class to define Structured Mesh with Fine resolution

The grid defined will have an element size that that will allow 100 elements along the shortest side of the domain

Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

StructuredVeryFine

class onscale.meshes.StructuredVeryFine(alias: str | None = None)

Class to define Structured Mesh with Very Fine resolution

The grid defined will have an element size that will allow 200 elements along the shortest side of the domain

Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

Unstructured Mesh Configurations

class onscale.meshes.UnstructuredMesh(alias: str | None = None)

Base class for Unstructured Meshes

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     geom = on.CadFile("swing_arm.step")
...     mesh1 = on.meshes.UnstructuredMesh(alias='mesh1')
...     mesh1.set('min_h', 0.5)
...     mesh1.set('subdomains_forcing', 1)
...     mesh1.set('mesh_scale_factor', 0.5)
...     mesh1 >> geom.parts[0:5]
Parameters:

alias – Optional alias for this node

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

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.

Fluid Mesh Configurations

FluidVeryCoarse

FluidCoarse

FluidMedium

FluidFine

FluidVeryFine

Basic Mesh Configurations

BasicVeryCoarse

class onscale.meshes.BasicVeryCoarse

Very coarse quality solid mesh.

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     on.meshes.BasicVeryCoarse()
Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

BasicCoarse

class onscale.meshes.BasicCoarse

Coarse quality solid mesh.

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     on.meshes.BasicCoarse()
Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

BasicMedium

class onscale.meshes.BasicMedium

Medium quality solid mesh.

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     on.meshes.BasicMedium()
Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

BasicFine

class onscale.meshes.BasicFine

Fine quality solid mesh.

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     on.meshes.BasicFine()
Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.

BasicVeryFine

class onscale.meshes.BasicVeryFine

Very fine quality solid mesh.

Examples

>>> import onscale as on
>>> with on.Simulation("Static Solve") as sim:
...     on.meshes.BasicVeryFine()
Parameters:

alias – Optional alias for this node

add_mesh_options() MeshOptions

virtual function to be overriden by the inherited class

apply(other: Node)

Apply this mesh to a geometry

Parameters:

other – A geometry object.

Returns:

Applied mesh object.

static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node

Construct this node from serialized dictionary data

set(property_name: str, value: Any)

Modify a property of this mesh by name.

Parameters:
  • option – The advanced mesh option name to override.

  • value – The new value to update.

Returns:

self

to_json() str

Convert this node into JSON representation

property uuid: str

Get the UUID associated with this node.