> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ntop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Topology Optimization

> [card] [FE Model, Design Objective, Constraints, Integer, Scalar, Scalar, Scalar Field, Integer, Scalar, Scalar Field, Scalar Field](#fe-model-design-objective-constraints-integer-scalar-scalar-scalar-field-integer-scalar-scalar-field-scalar-field)

> [card] [FE Model, Design Objective, Constraints, Integer, Scalar, Scalar, Scalar Field, Integer, Scalar, Scalar Field, Scalar Field, 1.1.0](#fe-model-design-objective-constraints-integer-scalar-scalar-scalar-field-integer-scalar-scalar-field-scalar-field-110)

***

## About this Block

The Topology Optimization (TopOpt) block performs a numerical design operation that determines the optimal shape of a part within the bounds of a Design Space, based on a set of objectives and constraints. The block allows the user to design geometries that best achieve the desired objective(s) while considering complex and multivariate loading conditions and design constraints. nTop’s TopOpt algorithm uses the Solid Isotropic Material with Penalization (SIMP) method.

Topology optimization setup involves choosing Objectives and Constraints for your optimization. The objective is a list of one or more Design Responses that you will be minimizing or maximizing in the optimization. Design Responses are just a way of describing the resulting object. These may include what fraction of the original design space the part takes up (Volume Fraction), or under given loading conditions, how stiff it is (compliance), or how much Stress or Displacement it exhibits. The optimization Objective must be paired with Constraints that give rules to the Optimization. Without Constraints, the optimization will probably result in a part that completely fills in the design space, or a completely empty part. Constraints can include upper or lower limits on other Design Responses, or Geometric Constraints, such as Symmetry, Overhang Angle, and others. The logic of a TopOpt process is outlined below.

![Top Opt Diagram](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopOptDiagram.png)

The TopOpt process works by assigning a value between 0 and 1 to all of the elements of a 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 a design space, far away from any applied load, is usually given a density value close to 0, because placing material there does not contribute to the objective of the optimization. On the other hand, elements close to the loaded faces are given a density value close to 1, because having material there is likely necessary to support the load. As a rule, loaded elements  are always given a TopOpt density of 1.

The Topology Optimization block takes in an FE Model, an Objective, a Constraints list, and a series of values that control the TopOpt algorithm. The FE Model contains a mesh and material properties that define the Design Space, or which is the volume where the final part can occupy after the optimization. The algorithmic controls for TopOpt are explained below.

* Max iteration - TopOpt is an iterative process that updates the topology until the objective is reached and the constraints are satisfied. If the process is taking a long time, the user can set a maximum limit to the number of iterations attempted. This input allows you to limit the max computation time expended on the TopOpt process.

* Min objective Change - The objective function is a quantified measure of how well the topology is achieving its objective(s). When the relative change between iterations of the objective function falls below this number, the TopOpt will be considered complete (as long as the constraints are satisfied). Decreasing this number will result in a more accurate TopOpt, but longer computation time.

* Min density change - This input is a convergence threshold, like described above, but for the relative change of the elements TopOpt density from one iteration to the next. Decreasing this number will result in a more accurate TopOpt, but longer computation time.

* Boundary penalty - This input controls how the TopOpt deals with setting density values at the edges of the design space. The 1 option sets the TopOpt density to 0 along the edges of the design space. The material will be completely restricted on the boundary where no loads or constraints have been applied. This option works well if you set up your design space to have a buffer zone of nodes on the outside of the space where you know that no material will be filled in. In some cases, you may anticipate that your part will end up including elements on the outer edge of the design space. This is likely true if you are doing TopOpt on a coarse mesh. The 0 option defines TopOpt densities at the design space edges such that the gradient (the spatial derivatives in x,y,z) will be zero. This allows you to have non-zero TopOpt densities at edges. No penalization is enforced on the boundary in this case. The overall recommendation is to use a small enough mesh size so that the 1 option can be used and density can be 0 at the edges, but if needed, option 0 provides an alternative. The image below shows how results can change between different Filter Boundary options.

![Boundary Penalty](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopOptBoundaryPenalty.png)

* Save increment - This input controls the amount of data stored and accessible after the topology optimization completes. The number can be increased to lower the file size of a completed TopOpt file. The default value of 1 will save results for all increments, whereas a result of 0 will save only the first and last increment. For any value, N, greater than 1, it will save results for every N increments. Note: The last iteration will always be saved.

* Filter size - This optional input specifies a minimum feature size that will be present in your TopOpt result. Note that it can accept a field input, meaning you can choose a spatially-variant scalar field as your minimum feature size. If this optional input is left blank, we assume a default value of 2 times the average element size.

* Initial density - This optional input can take in a scalar field of TopOpt density values (from 0 to 1), which will provide the initial guess at the TopOpt result before the process begins. When left blank, the TopOpt densities are set to 0.5 at all elements.

After completion of TopOpt processing, a window pops up in the Viewport with several options for visualizing the results.

The Thresholded Elements option in the TopOpt viewing window allows the user to 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.

![Thresholded Elements](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopOptThresholdElements.gif)

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

![Iso-contour View](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopOptIsoContours.gif)

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

![Iteration Slider](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopOptIterations.gif)

Within the TopOpt block’s information panel, there are two properties available: the number of iterations before completion of the TopOpt process, and a scalar field representing the TopOpt density results.

Under the Display tab, there are plots showing how numerical measurements of the design’s Objective and Constraint(s) changed over the iterations of the process.

![Plots](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopOptPlots.png)

The TopOpt block can be converted into an Implicit Body using the **Implicit Body from Topology Optimization** block.

## Example File

Download Example: [Topology Optimization](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopologyOptimization.ntop)

*This file set ups a Topology Optimization block for a rectangular block fixed on its side and loaded on top.*

![Topology Optimization](https://storage.googleapis.com/files-learn/static/ExtendedBlockDocs/TopologyOptimization.jpg)

***

## FE Model, Design Objective, Constraints, Integer, Scalar, Scalar, Scalar Field, Integer, Scalar, Scalar Field, Scalar Field

Perform a density-based topology optimization of an FE Model using the Solid Isotropic Material with Penalization (SIMP) method.

### Inputs

| Name | Type | Description |
| - | - | - |
| Model | [FE Model](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/fe-model.md) | The finite element model that defines the design space. |
| Objective | [Design Objective](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/design-objective.md) | The objective function for the optimization process. |
| Constraints | [Design Constraint List](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/design-constraint.md) | The constraints to satisfy during the optimization process. |
| Max iterations | [Integer](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/integer.md) | The maximum number of iterations allowed during the optimization process. |
| Min objective change | [Scalar](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar.md) | The minimum relative change in the objective function between consecutive iterations to consider the optimization process converged. Constraints must be satisfied in addition to this criteria. |
| Min density change | [Scalar](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar.md) | The minimum relative change in element density between consecutive iterations to consider the optimization process converged. The process will terminate when the largest relative change is below this threshold and all constraints are satisfied. |
| Boundary penalty | [Scalar Field](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar-field.md) | Field to penalize material formation near the boundary of the design space. If 0, no penalization is enforced on the boundary. If 1, material will be completely restricted on the boundary where no loads or constraints have been applied. |
| Save increment | [Integer](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/integer.md) | Controls the amount of data that is accessible after the optimization is complete. A value of 0 will only save the first and last iteration, a value of 1 will save every iteration, and values N greater than 1 will save every N iterations. Note that this input has significant impact on the file size and runtime of the optimization process. |
| Move limit | [Scalar](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar.md) | A scalar value between 0 and 1, which sets the maximum update to the design variables per iteration as a percentage of the design variable range:  Max variable update  = Move limit \* (Variable upper bound - Variable lower bound). A smaller value may increase stability at the cost of a reduced convergence rate. If left unspecified, an internal heuristic is used to determine an appropriate value for the given problem setup. |
| Filter size | [Scalar Field](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar-field.md) | A constant or spatially-varying length measure that is used to ensure mesh-independency, remove checkerboard artifacts, and to indirectly control the minimum feature size. If not specified a default will be estimated based on the model size. |
| Initial density | [Scalar Field](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar-field.md) | Option to specify initial density field. If not specified, it will be set to satisfy the desired volume constraint if it exists, otherwise it is set to 0.5. |

### Outputs

| Type |
| - |
| [Topology Optimization Result](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/topology-optimization-result.md) |

***

## FE Model, Design Objective, Constraints, Integer, Scalar, Scalar, Scalar Field, Integer, Scalar, Scalar Field, Scalar Field, 1.1.0

Perform a density-based topology optimization of an FE Model using the Solid Isotropic Material with Penalization (SIMP) method.

### Inputs

| Name | Type | Description |
| - | - | - |
| Model | [FE Model](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/fe-model.md) | The finite element model that defines the design space. |
| Objective | [Design Objective](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/design-objective.md) | The objective function for the optimization process. |
| Constraints | [Design Constraint List](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/design-constraint.md) | The constraints to satisfy during the optimization process. |
| Max iterations | [Integer](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/integer.md) | The maximum number of iterations allowed during the optimization process. |
| Min objective change | [Scalar](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar.md) | The minimum relative change in the objective function between consecutive iterations to consider the optimization process converged. Constraints must be satisfied in addition to this criteria. |
| Min density change | [Scalar](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar.md) | The minimum relative change in element density between consecutive iterations to consider the optimization process converged. The process will terminate when the largest relative change is below this threshold and all constraints are satisfied. |
| Boundary penalty | [Scalar Field](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar-field.md) | Field to penalize material formation near the boundary of the design space. If 0, no penalization is enforced on the boundary. If 1, material will be completely restricted on the boundary where no loads or constraints have been applied. |
| Save increment | [Integer](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/integer.md) | Controls the amount of data that is accessible after the optimization is complete. A value of 0 will only save the first and last iteration, a value of 1 will save every iteration, and values N greater than 1 will save every N iterations. Note that this input has significant impact on the file size and runtime of the optimization process. |
| Move limit | [Scalar](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar.md) | A scalar value between 0 and 1, which sets the maximum update to the design variables per iteration as a percentage of the design variable range:  Max variable update  = Move limit \* (Variable upper bound - Variable lower bound). A smaller value may increase stability at the cost of a reduced convergence rate. If left unspecified, an internal heuristic is used to determine an appropriate value for the given problem setup. |
| Filter size | [Scalar Field](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar-field.md) | A constant or spatially-varying length measure that is used to ensure mesh-independency, remove checkerboard artifacts, and to indirectly control the minimum feature size. If not specified a default will be estimated based on the model size. |
| Initial density | [Scalar Field](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/scalar-field.md) | Option to specify initial density field. If not specified, it will be set to satisfy the desired volume constraint if it exists, otherwise it is set to 0.5. |

### Outputs

| Type |
| - |
| [Topology Optimization Result](https://docs.ntop.com/Product-Documentation/ntop/block-documentation/types/topology-optimization-result.md) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.