How to run a topology optimization


Learn how to run a topology optimization.


What is Topology Optimization? Topology Optimization (TopOpt) is a numerical design operation that determines the optimal shape of a part based on a set of objectives and constraints. TopOpt allows the user to design geometries that best achieve the desired objective while considering complex and multivariate design constraints.

This workflow and the attached file demonstrate how to use TopOpt to design a lightweight bracket with minimal structural compliance. The workflow includes the setup of an FE model with boundary conditions, the definition of TopOpt constraints and objectives, and the post-processing of TopOpt results to create a final part design.


1. Create the Design Space from a CAD part

    • Import your Base CAD part. Your starting part needs lots of excess material to enable the TopOpt to run. The TopOpt works subtractively and not additively. Therefore, it needs extra material to run properly. In this example, we have a rectangular prism with three holes.
    • Create the following variables from the CAD file:
      • The entire design space
      • The two outside hole faces, named the restrained faces
      • The center hole face, named the loaded face
      • All three holes, named the Interfaces


2. Define Material Properties

Follow this article to create material. In this example, we want an Isotropic Elastic Property with Young's modulus of 2.1 e+11 and a Poisson's Ratio of 0.33


3. Create an FE Volume Mesh

Follow this article to create an FE Volume Mesh from the Design Space. 

The steps used in this example are:

    • Add a Mesh from CAD Body block and insert the Design Region
    • Add a Remesh block and insert the Mesh from CAD Body block
      • Set the Edge Length to 3 mm
    • Add a Volume Mesh block and insert the Remesh block
      • Set the Edge Length to 3 mm and the Shape to Triangles
    • Add an FE Volume Mesh block and insert the Volume Mesh


4. Create an FE Model

Follow this article to create an FE Model using the Material and FE Mesh from the steps above. 



5. Add Boundary Conditions

Use this article for reference when creating Boundary Conditions. 

In this example, we want a Force acting on the middle face and a Displacement Restraint acting on the two outer faces. 

Displacement Restraint:

    • Add a FE Face Boundary block (allows you to select multiple faces easily)
      • Input the Restrained Faces from Step 1. 
    • Add a Displacement Restraint block
      • Input the FE Face Boundary block



    • Add an FE Boundary by Floodfill block
      • Set the Origin to be within the center hole
      • Set the Entity to Nodes
    • Add a Force block
      • Input the FE Boundary by Floodfill block
      • Set the Vector to (0, 1000, 0) N



6. Define the Objective

The TopOpt objective is what property, or 'design response,' we hope to minimize or maximize within our part. nTop supports several design responses, including structural compliance, volume fraction, displacement, and stress. Use the Optimization Objective block to specify the design response(s). In this example, the objective is to minimize structural compliance.

    • Add a Structural Compliance Response block
      • Insert the Displacement Restraint and the Force block from the last step
    • Add an Optimization Objective block
      • Set the goal to Minimize
      • Insert the Structural Compliance Response into the Design Response List



7. Define the Constraint

TopOpt also requires constraints to be provided by the user. An underconstrained TopOpt process will simply fill in or remove all volume from the design region because those results lead to the actual minimization or maximization of the design response. Therefore, TopOpt procedures must be properly constrained in order to achieve meaningful results. 

The most commonly used constraint simply applies a minimum or maximum bound to a design response, such as compliance, volume fraction, displacement, or stress.

This TopOpt example is constrained such that the volume fraction of the final part is less than 0.2. In other words, the resulting optimized part will have a targeted volume of 20% of the whole design space. Notice that the volume fraction cutoff in the Design Response Constraint block is made into a variable for easy adjustment.

    • Add an Optimization Constraint List block
      • Insert a Design Response Constraint block
        • Insert a Volume Fraction Response block into the Response input
        • Set the value to 0.2 
          • Optional: Right-click on the Value input to create a variable to quickly change the Volume Fraction



8. Run the Topology Optimization

    • Add a Topology Optimization block,
      • Insert the FE Model
      • Insert the Objective
      • Insert the Constraints

The rest of the inputs can be left as default for this example. More information on these settings can be found in the block’s information panel and in this article. After completion of TopOpt processing, a window pops up in the Viewport with several options for visualizing the results.


The TopOpt process works by assigning a value between 0 and 1 to all of the elements of the mesh, where higher values are assigned to elements that most effectively contribute to the objective of the optimization. These values are referred to as the TopOpt density.

For example, an element in the bottom corner of the design space, far away from the applied load, is given a density value close to 0 because placing material here does not contribute to the goal of minimizing structural compliance. On the other hand, elements close to the loaded center hole are given a density value close to 1 because having material there is necessary to support the load.

The Thresholded Elements option in the TopOpt viewing window lets the user see what density values have been assigned to all elements in the design space. Use the Threshold slider to only view elements with a value higher than the specified threshold.


The Iso-contour view shows a single surface interpolated from all elements with TopOpt density values close to the specified threshold.


The Iteration slider allows you to see the evolution of the TopOpt throughout the optimization iterations.



10. TopOpt Post-Processing

Once you have inspected your TopOpt results and found an acceptable threshold value we can convert the results into an Implicit.

    • Add an Implicit Body from Topology Optimization Results block
      • Input the Topology Optimization block 
      • Set the Threshold value to 0.5 (it may be different depending on your preference)
  • The raw TopOpt output has artifacts on its surface from the mesh that can be removed using the Smoothen Body block. The surface artifacts are roughly the size of the FE mesh size, so to capture and remove them, a smoothening grid size of half the mesh size is used in the Smoothen Body block. This is done using a Divide block.
    • Add a Smoothen Body block
      • Input a Divide block into the Grid Size
        • Set Operand A to the Edge Length (3 mm)
        • Set Operand B to 2



11. Consolidate the Part

The topology-optimized volume is now ready to be recombined with the interfaces of the original CAD geometry. This step will look different depending on your part. If you are following along, do this:

    • Add an Implicit Body from CAD Body block
      • Insert the Interfaces (all three CAD faces from Step 1)
    • Add a Thicken Body block
      • Insert the Implicit Body from CAD Body block
      • Set the Thickness to 2 mm
    • Add a Boolean Union block
      • Delete the auto-generated list and input the Thicken Body block


    • Add a Boolean Union block
      • Input the Smoothened TopOpt and the Interface Bodies
      • Set the Blend radius to 2 mm (to keep the transitions between bodies congruent)


Lastly, perform a Boolean Intersect operation with your part and the original CAD body to ensure that the interfaces of the original design space are preserved.

    • Add a Boolean Intersect block
      • Input the TopOpt and Interfaces boolean union
      • Input an Implicit  Body from CAD Body block
        • Input the Design Space


And that’s it! You’ve successfully performed a Topology Optimization

Are you still having issues? Contact the support team, and we’ll be happy to help!

Download the Example file:

More on this topic:


 mesh boundary body topopt smoothen how to design fe topology model optimization objective constraint condition threshold space process HUD penalty post iso contour 
Was this article helpful?