visualdynamics.demo.shapes¶
shapes
¶
Three shapes that are not extrusions, for trying the meshers on.
A shaft with an oil hole drilled through it at an angle, a wye pipe
fitting, and a V-block with two banks of angled bores meeting a crank
bore. None can be swept along an axis, so Bricks meshes each on a grid
fitted to its shape (core.hexmesh) and Tets from its signed distance
(core.tetmesh). Each is built from the recipe alone, blocks and
cylinders and their booleans, in inches:
from visualdynamics.demo import shapes
project = shapes.v_block()
found = shapes.mesh(project, 'hexes') # or 'tetras'
print(found['count'], found['quality'], found['volume_error'])
A shape is meshed, unless a size is given, at the size Detect Element
Size gives for the element type (core.hexmesh.suggested_size: the
smallest radius over five for bricks fitted to the shape, over three
for tetrahedra). report meshes a shape both ways and gives the
numbers the guide's table shows: the size, the element count, the worst element (the
scaled Jacobian of a brick, the radius ratio of a tetrahedron, 1 for a
perfect element and 0 for a flat one), how many are under 0.3, the
mesh's volume against the recipe's, and the seconds taken.
Run it directly to print the three:
python3 -m visualdynamics.demo.shapes
Functions:
| Name | Description |
|---|---|
shaft |
A 2 in shaft, 6 in long along X, with a 0.6 in oil hole drilled |
wye |
A wye fitting: a 2 in run 6 in long along X with a 1.5 in branch |
v_block |
A 6 x 5 x 3 in block with a 1.2 in crank bore along X and two |
recipe_volume |
The parts' volume by sampling their recipe, in the geometry's |
mesh_volume |
The solid elements' volume, integrated as the solver integrates |
mesh |
Mesh the project's one geometry's parts into |
report |
Both meshes of the shape |
Classes¶
Functions:¶
shaft
¶
shaft() -> Project
A 2 in shaft, 6 in long along X, with a 0.6 in oil hole drilled through its middle at 30 degrees to its axis.
Source code in src/visualdynamics/demo/shapes.py
wye
¶
wye() -> Project
A wye fitting: a 2 in run 6 in long along X with a 1.5 in branch leaving it at 45 degrees, both bored, the walls 0.3 in.
Source code in src/visualdynamics/demo/shapes.py
v_block
¶
v_block() -> Project
A 6 x 5 x 3 in block with a 1.2 in crank bore along X and two banks of three 1 in bores at 45 degrees from vertical, each bank's bores running from the crank bore out through the top face.
Source code in src/visualdynamics/demo/shapes.py
recipe_volume
¶
The parts' volume by sampling their recipe, in the geometry's length unit cubed: random points over the parts' extent, the share inside. Within about 0.1 percent at two million points.
Source code in src/visualdynamics/demo/shapes.py
mesh_volume
¶
The solid elements' volume, integrated as the solver integrates them: exact for bricks, and for tetrahedra straight or curved.
Source code in src/visualdynamics/demo/shapes.py
mesh
¶
mesh(project: Project, elements: str, size: float | None = None) -> dict
Mesh the project's one geometry's parts into elements, 'hexes'
or 'tetras', at size in inches (by default the size Detect
Element Size gives for the element type), and measure the result.
Returns:
| Type | Description |
|---|---|
dict
|
'size', in inches; 'count', the elements; 'quality', the worst element's scaled Jacobian (bricks) or radius ratio (tets); 'poor', how many are under 0.3; 'volume', the mesh's, and 'recipe_volume', the recipe's, in cubic inches; 'volume_error', the mesh's less the recipe's as a share of the recipe's; 'seconds'; and 'method', which mesher ran. A mesh refused (bricks that fold at the size) is recorded with 'method' 'refused', the reason in 'refusal' and a count of 0. |
Source code in src/visualdynamics/demo/shapes.py
report
¶
Both meshes of the shape name ('shaft', 'wye' or 'v_block') at
size in inches (each at its detected size by default): {'hexes':
..., 'tetras': ...}, each as mesh gives it, each on a fresh
build.