1 Introduction

Topology optimization techniques enable designers to generate structures with superior mechanical performance. The complex designs created with topology optimization can, however, require intense postprocessing, which can undo the optimization gains. This can be prevented using constraints reflecting the real practice during the optimization process. Sectors such as the food processing, medical, and high-precision industry, have a design requirement in common for their structural components: they have to be cleanable. The cleanability of a component is directly related to its geometry, as well as the applied cleaning procedures.

One essential aspect of cleanability is to ensure that the cleaning fluid can leave the component. If cleaning fluid remains, dirt can be collected and the component is unfit for usage. Although active methods can be used (reorienting, vibrating, air flow, etc.), often passive methods are preferred. In this context, we focus on the requirement that cleaning fluids can leave the component by running off under gravity: the structure has to be drainable, which is illustrated in Fig. 1. Firstly, drainability entails that the inclination of surfaces should be such that fluids run off under gravity. This implies that upward facing surfaces must make a minimum angle with the horizontal: the runoff angle. Our partners have indicated that 10\(^\circ\) is a typical guideline for the runoff angle in the food processing industry (R Deckers, personal communication, 12 January, 2021). Secondly, the geometry should be such, that no pockets with stagnant fluids can exist. This way, fluids will be able to run down and leave the structure. Having a method that can ensure drainable designs, by respecting the two above aspects, would greatly improve the applicability of topology optimization in industries where cleanability is important.

Fig. 1
figure 1

A 2D static part in a fixed orientation is considered, with gravity acting downwards. Design a is not drainable, because of the pocket and the flat surface area prevent that the fluid (denoted in blue) will run down. Design b is drainable, implying that all fluid runs off

Within structural optimization, to the best knowledge of the authors, no research has been done on creating drainable structures. Yet, there is related research to consider. Firstly, there are approaches focusing on optimizing fluid flow through structures, see Alexandersen and Andreasen (2020) for an overview. Given the excessive computational effort requirement which is involved in simulating a fluid flow over a structure, a geometric approach, which typically involves modest computational costs, for evaluating drainability is more appealing. In the context of powder evacuation in additive manufacturing (AM), the outflow of material from a structure is also considered by Gaynor and Johnson (2020). This method ensures the existence of pathways to evacuate the powder from the structure, which can also be used to provide drainability. The aforementioned authors note that dealing with shallow angles, such as the runoff angles of interest here, is challenging.

Taking inspiration from the latter study, for drainability it is helpful to focus on controlling the void regions in the domain, since there the fluid can reside. In order to ensure that fluid can run off, every void region must be connected to a void region beneath it. The runoff angle defines the maximum horizontal offset. It is assumed that the fluid can always run off at the bottom (and optionally at the sides) of the design domain.

The requirements for drainability have some interesting similarities with those for overhang control used for AM. For a drainable design, void regions need to have sufficient drainage regions below, while for a printable design, solid regions need to have sufficient material below. And where drainability involves a minimum runoff angle, printability is linked to a critical overhang angle. Furthermore, while fluid can drain off at the bottom of the domain, this is also where the printing of solid material can start. These similarities are illustrated in Fig. 2. Therefore, works in the field of AM overhang control can also serve as inspiration.

Topology optimization approaches for overhang control have been extensively studied, and for a comprehensive overview the reader is referred to Liu et al. (2018). Two relevant categories of overhang control methods are: local boundary control and geometrical AM process modelling. The local boundary control methods constrain the angle between the surface normal and the build direction (Qian 2017; Allaire et al. 2017). These methods require additional care to prevent the creation of saw-tooth like structures. Therefore, the main inspiration for the proposed drainage approach comes from geometrical AM process modelling. Examples of these methods are presented in Gaynor and Guest (2016) and Langelaar (2016) with a layer-by-layer approach, or in van de Ven et al. (2018) with a front propagation approach.

For this research, the focus is on a density-based topology optimization approach, in a structured mesh setting. Furthermore, it is preferred to work with a filter instead of adding a constraint term to the objective function, to achieve strict enforcement of the drainability requirement. Therefore, the filter from Langelaar (2017) is taken as the main inspiration for our proposed drainage method, but we switch the focus to the void. Furthermore, an extra refinement is introduced to accommodate the shallow runoff angle requirements.

Fig. 2
figure 2

Comparison between designs for AM and drainage, where blue represents void and grey represents material. A printable design is determined by placement of the solid and the overhang angle (a). Similarly, a drainable design is determined by the void and the runoff angle (b)

This paper presents an approach that ensures drainable designs in 2D and 3D density-based topology optimization. A filter is proposed that converts a given blueprint design into a drainable design. The performance of this drainable design is subsequently evaluated and is optimized. The runoff angle is adjustable by using a refined grid in vertical direction. Draining always works in the direction of gravity, but this direction may not necessarily equal the vertical direction in the topology optimization domain. Therefore, a step is added to accommodate any orientation of the component with respect to gravity. Since the filter procedure adjusts the design variables to a drainable design in a separate procedure, the proposed method can be used in combination with other methods. As an example, the proposed drainage filter is combined with an AM filter.

The rest of the paper is organized as follows. Section 2 presents the drainage filter method. The optimization problem used for the numerical examples is described in Sect. 3. In Sect. 4, the performance of the drainage design method are demonstrated on two minimum compliance design problems. Finally, the findings are summarized and discussed in Sect. 5.

2 Method

The discussion in this section is focused on 2D for clarity, the steps required to extend to 3D will be indicated. Section 2.1 introduces the method for a runoff angle of 45 \(^\circ\). The filtering steps for runoff angle control, drainage direction control, and length scale control, are given in Sect. 2.2 till 2.4. The full filter procedure is given in Sect. 2.5.

2.1 Drainage filter

As stated in the Introduction, to facilitate the drainage of fluid, every void region should have some void region below where fluid can run off. Otherwise, either the void region should be transformed into solid so that no fluid can reside there, or a solid region below should be transformed into void so fluid can be drained. In our drainage filter \({\mathcal {D}}\), we follow the first strategy and the void region without void below in the blueprint design \({\mathbf {x}}\) is transformed into solid in the drainable design \(\hat{{\mathbf {x}}}\). This process is executed layer-by-layer, sweeping upwards through the domain. This will ensure that undrainable regions are banned from the design. The filter is defined on a regular Cartesian mesh, with the conventions shown in Fig. 3. For unstructured meshes, mapping on a structured field is possible (see e.g. Hoffarth et al. 2017; Langelaar 2018).

Fig. 3
figure 3

The used conventions for 2D, in which the three elements below element (ij) are the drain region for element (ij). It is assumed that the bottom of the domain is void, so the fluid can always run off here. For an extension from 2D to 3D, instead of using the 3 elements below, a drain region of 5 elements below element (ij) is used

In a continuous density variable setting, an element with blueprint density \(x_{(i,j)}\), fulfils the drainability requirement if at least one of the adjacent elements below is has a lower density. Therefore, the lowest density value of the elements in the drain region of element (ij), denoted with \(x_{(i,j)}^{dr}\), is to be found, which is done with a minimum operator. If this density \(x_{(i,j)}^{dr}\) is not lower than the density \(x_{(i,j)}\), the latter inherits the value of the former, for which a maximum operator is used. This procedure can be seen in Fig. 4. Note that this bears similarity with the AM filter of Langelaar (2017), but drainage requirements lead to a reversed ordering of the min and max operations.

Fig. 4
figure 4

The drainage filtering procedure, which changes the design layer-by-layer from bottom to top, using min and max operations

Because these steps can change element densities, which themselves are part of the drain region for the row above, this procedure should happen in a layer-by-layer fashion from bottom to top. The newly obtained drainage field \({\hat{\mathbf {x}}}\) densities are considered for the drainage region, rather than the blueprint densities \({\mathbf {x}}\):

$$\begin{aligned} \begin{aligned} x_{(i,j)}^{dr} =&\text {min}( {\hat{x}}_{(i-1,j-1)} , {\hat{x}}_{(i-1,j)} , {\hat{x}}_{(i-1,j+1)} ) \\ {\hat{x}}_{(i,j)} =&\text {max}( x_{(i,j)} , x_{(i,j)}^{dr} ) . \end{aligned} \end{aligned}$$
(1)

Because we are considering gradient based topology optimization, the min/max operations have to be replaced with a smooth operation. Material added on top of a structure to ensure drainability, does often not have the most favorable location for an optimization objective. But since it is required to ensure drainability, it should be prevented that the density becomes lower towards the top because of the accumulation of approximation errors. Therefore, it is preferred to over-approximate the density rather than to under-approximate. Appropriate approximation choices are the P-mean (\(P_{mean}\)) for the minimum, and the P-norm (\(P_{norm}\)) for the maximum:

$$\begin{aligned} \begin{aligned} P_{mean} (x) =&\left( \frac{1}{N} \sum ^{N}_{e=1}(x_{e})^{P_m} \right) ^{\frac{1}{P_{m}}} \\ P_{norm} (x,x^{dr})=&\left( x^{P_n} + (x^{dr})^{P_n} \right) ^{\frac{1}{P_n}}. \end{aligned} \end{aligned}$$
(2)

In here, N represents the number of elements in the drain region, i.e. 3 in 2D. The 3D implementation could have a drain region of either 5 or 9 elements, where the former is more conservative and ensures that the runoff angle cannot be violated. In this paper we therefore use 5 elements, namely all elements in the layer below that share one or more edges with the element on top. A negative \(P_m\) should be used to get the minimum. Written out, the approximations used for the drainage filter \({\mathcal {D}}\) are given by:

$$\begin{aligned} \begin{aligned}&x_{(i,j)}^{dr} = \left( \left( {\hat{x}}_{(i-1,j-1)}^{P_m} + {\hat{x}}_{(i-1,j)}^{P_m} + {\hat{x}}_{(i-1,j+1)}^{P_m} \right) / 3 \right) ^{1/P_m} \\&{\hat{x}}_{(i,j)} = \left( x_{(i,j)}^{P_n} + (x_{(i,j)}^{dr})^{P_n} \right) ^{1/P_n} . \end{aligned} \end{aligned}$$
(3)

The used aggregation parameters are taken as: \(P_{m}=-40\) and \(P_n = 40\). For elements at the sides of the domain, a ‘ghost element’ is added to represent the outside of the domain. If this is given a density of 0, it implies that fluids can run off at this side of the domain. Furthermore, the blueprint design in the top row of the domain can not be transformed into a drainable design, because this row is not a drainage region itself for the region above the domain. Therefore is should be prevented that this is a solid region, e.g. with a local volume constraint. Finally, if computational overflow occurs because the input of the approximation functions is too small, this can be resolved by introducing a small offset on the input values.

No full derivation of the sensitivity analysis is presented here, as it proceeds along the same lines as described in Langelaar (2017). Only the order of the min/max operations and the used approximation functions differ, which will be given here. The sensitivities from a performance criterion f in row i can be calculated with:

$$\begin{aligned} \frac{\partial f}{\partial {\mathbf {x}}_i} = \varvec{\lambda }_{i}^{T} \frac{\partial P_{norm,i}}{\partial {\mathbf {x}}_{i}}, \end{aligned}$$
(4)

in which \(\varvec{\lambda }\) is the multiplier vector, which is computed with the multiplier vector from the row above:

$$\begin{aligned} \varvec{\lambda }_{i}^{T} = \left( \frac{\partial f}{\partial {\hat{\mathbf {x}}}_{i}} + \varvec{\lambda }_{i+1}^{T} \frac{\partial P_{norm,i+1}}{\partial \hat{{\mathbf {x}}}_{i}} \right) \frac{\partial P_{norm,i} }{\partial {\mathbf {x}}_i}. \end{aligned}$$
(5)

The derivatives of \(P_{norm}\) and \(P_{mean}\) are as follows:

$$\begin{aligned} \begin{aligned}&\frac{\partial P_{norm} (x,x^{dr}) }{\partial x} = \left( x^{P_n} + (x^{dr})^{P_n} \right) ^{\frac{1}{P_n}-1} x^{P_n-1} \\&\frac{\partial P_{norm} (x,x^{dr}) }{\partial x^{dr} } = \left( x^{P} + (x^{dr})^{P_n} \right) ^{\frac{1}{P_n}-1} (x^{dr})^{P_n-1} \\&\frac{\partial P_{norm}}{\partial {\hat{x}}} = \frac{\partial P_{norm} }{\partial x^{dr} } \frac{\partial P_{mean} }{\partial {\hat{x}} } \\&\frac{\partial P_{mean} ({\hat{x}}_{1},{\hat{x}}_{2},{\hat{x}}_{3}) }{\partial {\hat{x}} } = \frac{1}{N} \left( \frac{1}{N} \sum ^{N}_{e=1}(x_{e})^{P_m} \right) ^{\frac{1}{P_m}-1} x^{P_m-1}. \end{aligned} \end{aligned}$$
(6)

In here, i and j are left out for readability. Note that the sensitivities are calculated in a layer-by-layer manner from top to bottom, with the topmost multipliers equal to zero.

2.2 Runoff angle control

For the method described in Sect. 2.1, the runoff angle can be calculated with \(\phi = \text {atan}(\frac{l_{y}}{l_{x}})\), where \(l_{x}\) and \(l_{y}\) represent the element size. For a structured grid with \(l_{y}=l_{x}\), this results in a runoff angle of 45 \(^\circ\). The runoff angle can become smaller if \(l_{y}<l_{x}\).

In the proposed method a smaller runoff angle is obtained by projecting the values of original grid on a grid refined in the drainage direction. The drainage filter is applied on this refined grid, after which the drainable design is projected back to the original grid. This procedure is shown in Fig. 5. It is important to note that the refined grid is only used for creating the drainable design with the filter and not for the finite element analysis, so no remeshing is performed.

Fig. 5
figure 5

Grid refinement procedure for shallow runoff angles. In this example the runoff angle is tan\(^{-1}\)(1/3) = 18 \(^\circ\)

We choose the refined grid to have size \(l_{y,r} = \frac{l_{y}}{n}\), in which refinement factor n is an integer, so that n refined cells fit exactly in one element of the original grid. Thus, a refinement of \(n=5\) gives a runoff angle of 11 \(^\circ\), which suffices for common drainability requirements in industry.

For the forward projection \({\mathcal {R}}_{f}\), from original to refined grid, all refined cells inherit their value from the original grid. For the backward projection \({\mathcal {R}}_{b}\), from the refined to the original grid, the original elements densities are set to the average value of the corresponding refined elements. For an original grid \({\mathbf {x}}_{o}\) and refined grid \({\mathbf {x}}_{r}\), these operations can be described as follows:

$$\begin{aligned} \begin{aligned} x_{r} =&{\mathcal {R}}_{f} (x_{o}) = x_{o} \quad \text {for} \quad \varOmega (x_{r}) \subseteq \varOmega (x_{o}) \\ x_{o} =&{\mathcal {R}}_{b} (x_{r}) = \sum ^{n}_{i=1} x_{r(i)} / n \quad \text {for} \quad \varOmega (x_{r}) \subseteq \varOmega (x_{o}), \end{aligned} \end{aligned}$$
(7)

in which \(\varOmega\) represents the (sub)cell volume. Finally, note that for a more specific pick in runoff angles, it would also be possible to do projection on a grid in which the refined cell is not exactly fitted with integer n in an original cell.

2.3 Drainage direction control

Structural components can have any orientation while being used. However, the gravity that induces the drainage always works downwards. This motivates the need to ensure drainability from multiple specified orientations. This is achieved with a projection on another grid, similar to the approach used for the runoff angle. First, the values of the original grid are projected with a rotation on another grid, which we call the rotation grid. The drainage filter, that creates a design for straight downward drain orientation, is applied on this rotated design field. Finally, the values of the drainable design are projected back to the original grid. This procedure is shown in Fig. 6.

Fig. 6
figure 6

Rotation procedure for drainage in variable orientations, shown for a rotation 15 \(^\circ\). The elements that are not covered by the original grid are represented in blue

In our application, the rotational projection is performed around the center point of the original mesh. The cell size of the rotation grid is the same as the original grid, but the amount of cells is increased to fully cover all elements of the original grid. The projection is done with a density filter operation with an integrated coordinate transformation. For an original density field \({\mathbf {x}}_{o}\) and a mapped field \({\mathbf {x}}_{m}\), the forward mapping filter \({\mathcal {M}}_{f}\) and backward mapping filter \({\mathcal {M}}_{b}\) are defined as follows:

$$\begin{aligned} \begin{aligned} x_{m} =&{\mathcal {M}}_{f} (x_{o}) = \frac{ \sum _{o \in N_{m,o} } x_{o} w({\mathbf {c}}_{o},{\mathbf {c}}_{m}) }{ \sum _{o \in N_{m,o} } w({\mathbf {c}}_{o},{\mathbf {c}}_{m}) } \\ x_{o} =&{\mathcal {M}}_{b} (x_{m}) = \frac{ \sum _{m \in N_{o,m} } x_{m} w({\mathbf {c}}_{m},{\mathbf {c}}_{o}) }{ \sum _{m \in N_{o,m} } w({\mathbf {c}}_{m},{\mathbf {c}}_{o}) }, \end{aligned} \end{aligned}$$
(8)

where \(N_{m,o}\) is the neighborhood set of elements within the filter domain for element m, and \(w({\mathbf {c}}_{o},{\mathbf {c}}_{m})\) is the linear weight function between two cells with central coordinates \({\mathbf {c}}_o\) and \({\mathbf {c}}_m\):

$$\begin{aligned} w({\mathbf {c}}_{m},{\mathbf {c}}_{o}) = R_{m} - \Vert M({\mathbf {c}}_{m}) - {\mathbf {c}}_{o} \Vert , \end{aligned}$$
(9)

with \(R_{m}\) the specified filter radius, and where the coordinates of \({\mathbf {c}}_m\) are first rotated by rotation matrix M. The filter radius \(R_{m}\) is picked as small as possible, but big enough to ensure that all elements in the rotation grid that are covered by the original grid have an input. Limited additional smoothing of the design is induced, as is demonstrated in the numerical examples (Sect. 4). The elements in the rotation grid that are not covered by the original grid get assigned a value of 0, which represents drainable space.

2.4 Length scale control

Small sinkholes can be created inside the structure, sometimes only the size of one element. In particular in 2D with large runoff angle this was observed. According to the model the fluid can run off through these sinkholes, however for practical usage a minimum length scale on the void is required. The robust method (Sigmund 2009; Wang et al. 2011; Lazarov et al. 2016) creates a length scale on both the solid and the fluid, and is summarized here.

First, the structural domain density field \({\mathbf {x}}\) is filtered using the standard density filter \({\mathcal {F}}\) (Bourdin 2001; Bruns and Tortorelli 2001), given by:

$$\begin{aligned} {\tilde{x}} = {\mathcal {F}} (x) = \frac{ \sum _{l \in N_{k,l} } x_{l} w({\mathbf {c}}_{l},{\mathbf {c}}_{k}) }{ \sum _{l \in N_{k,l} } w({\mathbf {c}}_{l},{\mathbf {c}}_{k}) } , \end{aligned}$$
(10)

where \(N_{k,l}\) is the neighborhood set of elements within the filter domain for element k, and \(w({\mathbf {c}}_{l},{\mathbf {c}}_{k})\) is the linear weight function between two elements k and l:

$$\begin{aligned} w({\mathbf {c}}_{l},{\mathbf {c}}_{k}) = R - \Vert {\mathbf {c}}_{l} - {\mathbf {c}}_{k} \Vert , \end{aligned}$$
(11)

with R the specified filter radius. \({\mathbf {c}}_{k}\) and \({\mathbf {c}}_{l}\) contain the central coordinates of the design elements k and l respectively. Next, a smooth Heaviside projection \({\mathcal {H}}\) is used:

$$\begin{aligned} {\bar{x}} = {\mathcal {H}} ( {\mathcal {F}} (x)) = \frac{ \text {tanh}(\beta \eta ) + \text {tanh}(\beta ({\tilde{x}}-\eta ) ) }{ \text {tanh}(\beta \eta ) + \text {tanh}(\beta (1-\eta ) ) } , \end{aligned}$$
(12)

where \(\eta\) is the threshold value, and \(\beta\) the steepness of the projection. Using three threshold values results in eroded, blueprint, and dilated designs, with corresponding subscripts e,b,d, and threshold values \(\eta _{e}< \eta _{b} < \eta _{d}\). The offset parameter \(\Delta \eta\) is used to obtain the erode and dilate threshold values: \(\eta _{e} = \eta _{b} - \Delta \eta\) and \(\eta _{d} = \eta _{b} + \Delta \eta\). By basing the optimization on the worst case performance of the three designs, robustness against boundary variations is achieved.

This added robustness might result in a bigger length scale than initially intended for the structure. However in general, robustness is in line with creating designs for cleanability, which requires avoiding tiny design features. The relationship between the parameters and the imposed length scale is explained in Trillet et al. (2021). Finally, note that the robust filter step is mostly needed for problems where material is scarce or drainage solutions are limited, which is often the case in 2D, especially for high run-off angles. In these cases, the robust formulation helps to prevent designs in which the optimizer exploits intermediate densities. In more realistic cases, i.e. 3D and with lower runoff angles, this is not required as the optimizer has more freedom to create a drainable design. Therefore, in 3D applications only the density filter \({\mathcal {F}}\) is used and the Heaviside filter step \({\mathcal {H}}\) can be left out.

2.5 Full filter procedure

All the steps in the drainage filter procedure are shown in Fig. 7. Only the drainage filter \({\mathcal {D}}\) is essential, all other filters are optional and depend on the specific problem requirements. Refinement filter \({\mathcal {R}}\) is needed for runoff angles smaller than 45 \(^\circ\), which holds for most practical cases. Rotation filter \({\mathcal {M}}\) is needed for drainage orientations other than straight downwards. Heaviside filter \({\mathcal {H}}\) in combination with the robustness offset is effective in preventing small sinkholes, which may otherwise occur for complex problems. This step is done before the drainage filter to achieve a bigger variance in the input variables of the smooth min/max approximations. This also means that the subsequent steps are done for all of the eroded, blueprint, and dilated designs.

Fig. 7
figure 7

Schematic representation of the full drainage filter procedure, where the filter on the left results in the design on the right. Only the drainage filter \({\mathcal {D}}\) is essential

3 Optimization formulation

The optimization problem is formulated based on the design variable field \({\mathbf {x}}\). The drainable density field \(\hat{{\mathbf {x}}}\) is obtained by performing the drainage filter steps on design field \({\mathbf {x}}\), as outlined above and shown in Fig. 7. As the focus is on the demonstration of the performance of the drainability filter, numerical examples will involve minimum compliance problems with a global volume constraint, defined as:

$$\begin{aligned} \begin{aligned} \underset{{\mathbf {x}}}{\text {minimize}} : \quad&C(\hat{{\mathbf {x}}}) = {\mathbf {u}}^{T} {\mathbf {K}}(\hat{{\mathbf {x}}}) {\mathbf {u}} \\ \text {subject to}: \quad&{\mathbf {K}}(\hat{{\mathbf {x}}}){\mathbf {u}} - {\mathbf {p}} = {\mathbf {0}} \\&\frac{V(\hat{{\mathbf {x}}})}{V^{*}} - 1 \le 0 \\&0 \le x_{i} \le 1 \quad \text {for} \quad i = 1 ... N_{el} , \end{aligned} \end{aligned}$$
(13)

in which \({\mathbf {K}}(\mathbf {{\hat{x}}})\) is the stiffness matrix, \({\mathbf {p}}\) are the nodal loads, and \({\mathbf {u}}\) are the the resulting nodal displacements. \(V(\hat{{\mathbf {x}}})\) is the volume of the current design, and \(V^{*}\) is the maximum allowed volume. \(N_{el}\) is the number of elements in the domain.

As stated in Sect. 2.5, for minimum length scale control the robust approach will be used in the several problems. The simplified robust optimization formulation (Lazarov et al. 2016) is used, which utilizes only the eroded and the dilated design in the optimization problem, and which is given by:

$$\begin{aligned} \begin{aligned} \underset{{\mathbf {x}}}{\text {minimize}} : \quad&C(\hat{{\mathbf {x}}}) = {\mathbf {u}}_{e}^{T} {\mathbf {K}}_{e}(\hat{{\mathbf {x}}}) {\mathbf {u}}_{e} \\ \text {subject to}: \quad&{\mathbf {K}}_{e}(\hat{{\mathbf {x}}}){\mathbf {u}}_{e} - {\mathbf {p}} = {\mathbf {0}} \\&\frac{V_{d}(\hat{{\mathbf {x}}})}{V^{*}} - 1 \le 0 \\&0 \le x_{i} \le 1 \quad \text {for} \quad i = 1 ... N_{el} . \end{aligned} \end{aligned}$$
(14)

Here \({\mathbf {K}}_{e}\) and \({\mathbf {u}}_{e}\) come from the eroded realization, while \(V_{d}\) comes from the dilated realization. To ensure that the optimized design meets the target volume fraction for the blueprint design \(V_{b}^{\text {target}}\), the volume continuation scheme presented in Wang et al. (2011) is used. Thus, the allowed volume fraction \(V^{*}\) is updated every 20th iteration as \(V^{*} = \frac{ V_{d}(\hat{{\mathbf {x}}}) }{ {V}_{b}(\hat{{\mathbf {x}}}) } V_{b}^{\text {target}}\), where \(V_{b}(\hat{{\mathbf {x}}})\) refers to the blueprint volume fraction. A \(\beta\) continuation is performed every 15 iterations, initially by increasing the value with 1.0, and after this is higher than 7 the value is multiplied with 1.2.

Classical isoparametric elements are used, with 4-node quadrilateral elements with bilinear shape functions in 2D, and 8-node hexahedral elements with trilinear shape functions in 3D. The modified solid isotropic material with penalization (SIMP) interpolation scheme (Sigmund 2007) is used for the mapping in each Element i between the drainable density and the Young’s modulus, i.e.:

$$\begin{aligned} E({\hat{x}}_{i}) = E_{\text {min}} + ({\hat{x}}_{i})^{p} (E_{\text {max}} - E_{\text {min}}). \end{aligned}$$
(15)

In here, \(E_{\text {min}}\) and \(E_{\text {max}}\) are the lower and upper bounds of the Young’s modulus, for which the used values are \(10^{-9}\) and 1.0, respectively. A Poissons ratio of \(\nu = 0.3\) is used. The penalization power p is 3.0. Note that the SIMP penalty is useful for eliminating big areas of intermediate densities, but it cannot suppress the intermediate density used for the subelement slope on top of the structure (Fig. 5).

The 2D problem is solved by the 88 line MATLAB code (Andreassen et al. 2011) augmented with the MMA optimizer of Svanberg (1987). The 3D problem is implemented as an extension to the open-source framework for large-scale topology optimization (Aage et al. 2015) based on PETSc, with the MMA implementation of Aage and Lazarov (2013). Unless mentioned otherwise, all cases have been run for 250 iterations with default optimizer settings. This ensured sufficient convergence of the designs. A full overview of the used parameters is given in Table 1.

Table 1 Summary of used parameters

4 Numerical examples

To illustrate the performance and characteristics of the drainage filter, the method will be subjected to several tests. First, in Sect. 4.1 the method is tested in 2D to most clearly illustrate its behaviour. Second, a simple 3D case is used in Sect. 4.2. Third, the method is tested in 3D in combination with other constraints and methods to address more complex use cases in Sect. 4.3.

4.1 2D case

First, the performance is tested in 2D for a cantilever beam problem. The load and boundary conditions can be seen in Fig. 8. The locations of the loading and clamped area are placed more inwards in the domain, so there the fluid have space on the side to run off, while the structure is not cut off by the domain for any drainage direction. In addition, sufficient space is provided in the top region of the design domain, which is needed with large run-off angles. The discretization is 150 \(\times\) 150 elements, the filter radius is 4.5 elements. The robust method was used, in which robust threshold offset \(\Delta \eta\) is 0.075, and the Heaviside \(\beta\) is incremented from 1 till 12.

Fig. 8
figure 8

Load and boundary conditions for the 2D problem. The load is applied 15% from the right edge, and 40% from the bottom. The fully clamped region is located 15% from the left edge, 40% from the bottom, and has a width of 2% and a height of 40%

The results of the 2D tests are presented in Fig. 9. It can be seen that the structure created without the drainage filter contains horizontal areas on the top surface as well as internal voids. This does not meet the criteria of a drainable design. Drainable structures are created by using the drainage filter, as shown in Fig. 9b–f. Drainability is often obtained by creating a triangular ‘roof’ on top of the cantilever beam. The fluid can run off on either side of this roof. The filter also bans internal voids from the designs. For a 45 \(^\circ\) runoff angle, much material is needed to create the roof, at the expense of the lower part of the structure and the compliance performance. Yet, a drainable design is ensured by the strict enforcement of the drainability requirement of the filter. Towards the top of the structure, the elements remain fully solid, which confirms the effectiveness of the applied smooth min/max operators from Sect. 2.1. For an 11 \(^\circ\) runoff angle (i.e. \(n=5\)), the impact of the drainage requirement is less severe and the structure is allowed to look more similar to the reference design, which is beneficial for the compliance. The smooth slope of the runoff angle has to be represented on a discretized field, which at the surface leads to a gradual increase of the density for every n elements sidewards. In Fig. 9d it can be seen that the filter also works for lower volume fractions, which is usually harder to solve because the structure has to comply with the drainability constraint while there are only limited material resources. Finally, in Fig. 9e and f the structure can be seen for when a different drainage orientation is enforced, more specific a 150 \(^\circ\) and 270 \(^\circ\) angle respectively. An 18 \(^\circ\) runoff angle is used, to make the ‘roof’ clearly visible, which can now be recognized at the right-bottom and left-side of the structure, respectively. It is visible that the extra filter step does add a blur to the edges of the structure. One could add an extra final Heaviside to mitigate this effect.

Fig. 9
figure 9

Results of 2D cantilever beam problem. The arrow indicates drainage direction other than downwards

The history of the objective for the experiments in Fig. 9a and c, i.e. cases without and with a representative drainability requirement, is plotted in Fig. 10. The history plot shows that the convergence is mostly smooth, except for some jumps at the continuation of the Heaviside \(\beta\) parameter. The rate of convergence without and with drainage filter is comparable. When using unrealistic high run-off angles (e.g. 45 \(^\circ\)) a stronger design restriction is imposed, and convergence can be slower than in the reference case.

Fig. 10
figure 10

Evolution of the objective function for the cases depicted in Fig. 9a and c

A final study with the 2D problem concerns the influence of the runoff angle on the compliance. In Fig. 11 the compliance is plotted for different runoff angles, ranging from 45 \(^\circ\) (\(n=1\)) down to 8 \(^\circ\) (\(n=7\)). As seen before, high runoff angles lead to drastic design changes and therefore significant increases in compliance. In contrast, for runoff angles between 18 \(^\circ\) and 8 \(^\circ\), the compliance only changes 3% at an increase of 8% compared to the reference design. Such angles are more representative for realistic drainability requirements, and only a minor impact on component performance is observed.

Fig. 11
figure 11

The compliance for different runoff angles, for 20% volume, and \(C_{ref}\) taken from Fig. 9a

4.2 3D case

Secondly, the drainage filter is investigated in 3D, also for a cantilever beam problem. The orientation of the load is such that the largest area has to be made drainable, as this poses the biggest challenge for the method. The boundary conditions can be seen in Fig. 12. The clamped nodes and loaded nodes are 10% from the domain edges in y-direction, to leave space for the fluid to run off within the domain, without any boundary effects. The problem is solved on a mesh of 192 \(\times\) 144 \(\times\) 96 elements, for a volume fraction of 10%, and a filter radius of 3 elements, and the drainage orientation is in the z-direction. No robust method was used, and also no Heaviside filter.

Fig. 12
figure 12

Boundary conditions for the 3D cantilever beam problem. The problem has dimensions L\(_{x}\)=1.5, L\(_{y}\)=2, and L\(_{z}\)=1. The load is applied in x-direction at: \(x\in\)[0.73,0.77], \(y\in\)[0.19,0.21], and \(z\in\)[0.39,0.41]. The fully clamped part is located at: \(x\in\)[0.375,1.125], \(y\in\)[1,60,1.80], and \(z\in\)[0.2,0.6]

Different runoff angles where tested for this problem. The results of the 3D tests can be seen in Fig. 13. It can be seen in Fig. 13a that if no drainage filter is employed, the design that is created is not drainable. Not all upward facing surface areas have a minimum runoff angle, and there is a pocket in the middle where fluid could reside. By using the drainage filter, the structure becomes drainable, as seen in Fig. 13b and c for runoff angles of 45 \(^\circ\) and 11 \(^\circ\) respectively. Material is added on top to create a ‘ridge’, outer parts of the structure are lowered, and sink holes appear in the middle of the structure, allowing for fluid drainage. For an 11 \(^\circ\) runoff angle, these changes in the design are relatively small, because in this 3D case there are multiple options where the fluid can be send off to. This results in only a small increase in the compliance of the structure, and a much smaller increase than seen for the 2D case.

The smooth isovolume projections in Fig. 13e and f give a representation of the realization of the final design. This shows that no flat areas are present on the structure. The top of the ridge of the structure is the only area with a runoff angle smaller than 10 \(^\circ\). The other upward facing surfaces that are part of the ridge are between 10 \(^\circ\) and 20 \(^\circ\). Finally, some mesh dependency can be seen, which is caused by using 5 elements below for the drainage region. This assumes that fluid can only run off in line with the mesh and drainage in the not orthogonal directions has to happen through a combination of these four directions. It can be seen that the surfaces that are not in line with the mesh can have a slightly higher runoff angle than the surfaces that are in line with the mesh.

Fig. 13
figure 13

Results of the 3D cantilever beam problem. ad is projected with an element 0.5 density threshold value. For e, f The cell data has been projected to point data, after which an isovolume with threshold 0.5 is created

4.3 3D cases with extra constraints

Thirdly, the performance of the drainage filter is tested, while more practical constraints are added to the problem. Case A is a problem where a loading is located more upward in the design domain, which means that not a ‘roof’ or ridge can just be built on top of the structure. For this, the MBB load case is used, for which the boundary conditions are shown in Fig. 14. It is important to prevent material from being all in the top row of the domain. This was done by adding 4 rows to the top of the domain, and setting a local volume constraint for this area, taken into account the effect of the density filter radius. The material here is highly penalized with \(\frac{V_{\text {top}}}{10^{-6}} - 1 \le 0\), so the elements here should become void. The problem is solved on a mesh of 192 \(\times\) 64 \(\times\) 68 elements, for a volume fraction of 28.2% (which is equal to 30% for the relevant domain volume), and a filter radius of 3 elements. No robust method was used, and also no Heaviside filter.

Fig. 14
figure 14

Boundary conditions for the 3D MBB problem. The problem has dimensions L\(_{x}\)=1, L\(_{y}\)=3, and L\(_{z}\)=1.0625, where the top 0.0625 is involved in the local volume constraint. There is a symmetry boundary condition at the \(x=0\) plane, with a line load on top. The simply supported part is located at: \(x\in\)[0,1], \(y\in\)[2.98,3.0], and \(z\in\)[0,0.02]

Case B applies a drainage filter in one orientation in combination with a second drainage filter in another orientation. This can ensure the drainability of a component without fixed orientation. The same 3D cantilever beam problem is used, as previously shown in Fig. 12, again with a mesh of 192 \(\times\) 144 \(\times\) 96 elements, for a volume fraction of 15%, and a filter radius of 3 elements. No robust method was used. The drainage direction of the first filter is 10 \(^\circ\) around the y-axis, the drainage direction of the second filter is 170 \(^\circ\) around the y-axis. To make the effect more visible, a refinement of 3 is used, which gives a runoff angle of 18 \(^\circ\).

Case C applies the drainage filter in combination with an AM filter. The AM filter method described in Langelaar (2017) is used. The same mesh as for Case B is used, only the volume fraction is increased to 25% to allow the structure to connect to the baseplate. Again, a refinement of 3 is used.

Fig. 15
figure 15

Results of Case A, the 3D MBB problem, with a local volume constraint at the top of the domain, and with an element 0.5 density threshold projection

The results of Case A, the 3D MBB problem, can be seen in Fig. 15. Without drainage filter, material forms a flat surface at the top of the allowed domain. Applying the drainage filter makes the design drainable, while again obeying the local volume constraint. The top of the structure still looks like a ridge, but this ridge does not enter the constrained area. In addition, it is visible that the fluid can run off of the structure on the sides of the domain.

Fig. 16
figure 16

Results of Case B, the 3D cantilever beam problem, with two drainage filters in different orientations, obtained by 0.5 density threshold projection

Fig. 17
figure 17

Results of Case C, the 3D cantilever beam problem, with one drainage filter and one AM filter, obtained by 0.5 density threshold projection

The results of Case B, the 3D beam problem with multiple drainage filters, are presented in Fig. 16. It can be seen that the ‘ridge’ is not in the middle anymore but skewed towards one side. Another ‘ridge’ is created at the bottom of the structure, so the fluid would also run off from this side. Regarding Case C, in Fig. 17 it can be seen that the structure is both printable and drainable. The challenge for this case is that one filter results in material being added at the bottom, while the other filter results in material being added on top. Yet, both design requirements are fulfilled. This shows that the drainage filter can work well in combination with other complex filters.

5 Conclusion

A new filter for density-based topology optimization is proposed that guarantees drainability of a structure through its geometrical design. In a layerwise process, a given blueprint design is transformed into a drainable design, which decreases the need for postprocessing. To the authors’ knowledge, it is the first filter to address cleanability, and specifically drainability, of designs generated by topology optimization.

The proposed method has several benefits. First, the method performs well in creating drainable designs. Fluids are ensured to run off the obtained structures, because the drainability definition embedded in the filter eliminates all undrainable regions. The filter is robust, and also works for problems where less material is available.

Second, the refinement method succeeds in handling shallow runoff angles, which is important for the performance of the components. This can help to create components for which the final geometry is only slightly changed compared to the optimized component without drainability considerations. Consequently, the increase in compliance remains minor. Similarly, the rotation filter adds to the applicability of the filter by ensuring that components can be drainable in any chosen orientation relative to the gravity direction.

Third, the proposed layer-by-layer filter is a simple method, which is is easy to implement. The filter itself and the handling of the sensitivities only consist of simple low-cost operations, so that the computational cost of both the filter and its sensitivity analysis is small compared to the finite element analysis. The filter works stand-alone without the need to adjust other parts of the topology optimization code. To facilitate its use and further developments, a 2D implementation is provided with this paper. Combining it with an overhang filter was successfully demonstrated.

However, the proposed method also has a few limitations. First, the used definition of drainability might be too strict for some applications, as closed internal voids are banned from the filtered design. Second, the 2D version of the drainage method often requires the robust formulation, which is needed to prevent small sinkholes. Thirdly, the discrete grid refinement procedure, allows only for some specific runoff angles. Finally, some mesh dependency exists in the 3D implementation where drainage regions of 5 elements are considered. But since the proposed method builds on a discrete overhang filter, these limitations if necessary can likely be resolved by taking inspiration from a mesh-independent overhang scheme (e.g. van de Ven et al. 2018)

Drainability is an important aspect of design for cleanability, certainly not the only one. Additional requirements for hygienic design are the topic of future investigations. This is expected to introduce the benefits of topology optimization to new application domains in e.g. biomedical, food processing, and space industries.