Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Build an assembly from cuboids

Use axis-aligned cuboid components to represent enclosures, fins, plates, and channels in your simulation request.

The Python snippets below use a finned heatsink to illustrate how to define individual parts and generate repeated ones. Adapt the dimensions, material properties, and layout to your assembly.

Define individual components

Give every component a unique tag and add it once to cuboid_components. Components may share a face, but their volumes must not overlap.

If several parts share material properties, use a helper function to keep their definitions consistent. For example, this helper creates conducting cuboids and is used to define a heatsink base:

def conducting_cuboid(tag, origin, size, conductivity, power=0.0):
    """Describe one conducting cuboid using aluminum density and heat capacity."""
    return {
        "tag": tag,
        "bbox": {"origin": origin, "size": size},
        "thermal_model": {
            "conducting": {
                "conductivity": conductivity,
                "density": 2700.0,
                "specific_heat_capacity": 900.0,
                "power": power,
            }
        },
    }


base = conducting_cuboid(
    "heatsink-base",
    origin=[0.02, 0.01, 0.005],
    size=[0.08, 0.06, 0.004],
    conductivity=180.0,
)

Use matching face coordinates where conducting parts should be thermally connected. Leave gaps where fluid passages are needed.

Generate repeated components

Use a loop for repeated parts such as fins, ribs, or supports. Make their count, spacing, and starting position parameters so you can change the layout consistently.

In this example, the loop generates a row of fins and combines them with the base in cuboid_components:

def fins(count, first_y, pitch):
    """Space identical fins along y, with their bottoms touching the base's top face."""
    return [
        conducting_cuboid(
            tag=f"heatsink-fin-{index + 1}",
            origin=[0.02, first_y + index * pitch, 0.009],
            size=[0.08, 0.002, 0.025],
            conductivity=180.0,
        )
        for index in range(count)
    ]


# Center the 51 mm-wide fin array on the 60 mm base, leaving 4.5 mm at each end.
request["cuboid_components"] = [base, *fins(count=8, first_y=0.0145, pitch=0.007)]

Include all fixed and generated parts in cuboid_components, retaining any other components in your request. Check the extent of each array against the domain and surrounding parts. Reject parameter combinations that cause overlaps or close required passages.

The plot below shows the example assembly made from the cuboid snippets above: one base and eight fins.

An orange heatsink assembled from one rectangular base cuboid and eight parallel fin cuboids, with open channels between the fins.
Eight 2 mm thick fins sit on a 4 mm thick base. The fins are spaced 7 mm center to center, leaving 5 mm channels.

See also