WorksPhysics and Astronomy
Hyperparameter-free minimum-lengthscale constraints for topology optimization
Abstract
The geometric constraints of Zhou et al. (2015) are a widely used technique in topology/freeform optimization to impose minimum lengthscales for manufacturability. However, its efficacy degrades as design binarization is increased, and it requires heuristic tuning of multiple hyperparameters. In this work, we derive analytical hyperparameters from first principles, depending only on the target lengthscale. We present results for both conic and PDE-based filtering schemes, showing that the latter is less robust due to the singularity of its underlying Green's function. To address this, we also introduce a double-filtering approach to obtain a well-behaved PDE-based filter. Combined with our derived hyperparameters, we obtain a straightforward strategy for enforcing lengthscales using geometric constraints, with minimal hyperparameter tuning. A key enabling factor is the recent subpixel-smooth projection (SSP) method (Hammond et al. 2025), which facilitates the rapidly-converging optimization of almost-everywhere binary designs. The effectiveness of our method is demonstrated for several photonics and heat-transfer inverse-design problems.
Introduction
For practical manufacturing purposes, designs generated via the topology optimization (TO) framework ([6] (Jensen and Sigmund 2011; Sigmund and Maute 2013)) (reviewed in § 2) must adhere to fabrication constraints; in particular, designs must typically comply with minimum linewidth and linespacing requirements. A popular technique in density-based TO for imposing these conditions is the geometric-constraints approach, introduced by Zhou et al. (2015) (reviewed in § 3). It consists of including two extra constraints into the TO problem: one that imposes a minimum lengthscale on the solid phase and another on the void phase. Both constraints are differentiable and inexpensive to compute, and thus well-suited for gradient-based optimization methods for large-scale nonlinear problems, such as the conservative convex separable approximation (CCSA) algorithm (Svanberg 2002). While this approach has proven successful in many works (Clausen et al. 2015b; Zhao et al. 2018; Wang et al. 2018; Giannini et al. 2020; Hammond et al. 2021, 2022b, 2023, 2022a; Ruan et al. 2022; Albrechtsen et al. 2022; Sang et al. 2022; Shang et al. 2023; Chen et al. 2024; Martinez de Aguirre Jokisch et al. [1]; Chen et al. [13]), it still has some unsatisfactory aspects. First, there is a delicate interplay between the binarization level of a design—controlled by a projection steepness hyperparameter , which is gradually increased during optimization—and the efficacy of the geometric constraints. The lengthscale of a design becomes meaningful only when the design is close to binary, hence the geometric constraints require a high to adequately impose minimum lengthscales. However, this presents a challenge, as standard binarization/projection schemes (Xu et al. 2010; Wang et al. 2011) suffer from ill-conditioning and slow convergence as binarization is increased (Hammond et al. 2025; Dunning and Wein 2025). Consequently, binarization must be limited by a heuristic choice of , hindering the effectiveness of the geometric constraints. Second, the constraints are controlled by several hyperparameters, and guidance on setting these hyperparameters is mostly empirical and subject to cumbersome problem-specific tuning. For example, to account for non-binary designs, the user must heuristically relax the geometric constraints by means of a threshold , which is gradually decreased during optimization (see § 3). Recently, Hammond et al. introduced a new binarization technique, the subpixel-smoothed projection (SSP) (Hammond et al. 2025) (§ 2), capable of optimizing an almost-everywhere binary design (differentiable at ) while simultaneously overcoming the issue of slow convergence. Given this new SSP development, can one now revisit the existing geometric constraints algorithm, to obtain a simplified approach with improved performance and minimal reliance on heuristic hyperparameter tuning?
In this paper, we show that the existing geometric constraint algorithm can be greatly simplified and accelerated in conjunction with SSP binarization. In particular, given a desired minimum lengthscale to be imposed on the design, we can now theoretically justify specific choices for all geometric constraint hyperparameters (including the filtering radius , the structural function decay rate , and the constraint threshold —see § 3 and Table 1), leading to a scheme that requires minimal hyperparameter tuning and straightforwardly achieves rapid convergence. Furthermore, our choice of hyperparameters leads to resolution-invariant constraints, which do not require further adjustment if resolution is increased. Initially, we focus on the case where a conic filtering scheme is used in the TO scheme (§ 4.1), but we also provide the analysis and recommended hyperparameters when a PDE filter (Lazarov and Sigmund 2011) is employed instead (§ 4.2 and Sec. B). While the PDE filter is convenient in unstructured meshes, we show that its singular Green’s function makes the geometric constraints much less robust in the presence of small features. To address this difficulty, we propose a simple solution: applying the PDE filter twice. This “bi-PDE” filter scheme is analyzed in § 4.2 and Sec. C.
| Geometric constraints variables | Conic filter | PDE filter | Bi-PDE filter | |
| target lengthscale | user-defined | (same) | (same) | |
| filter radius | (or ) | (same) | (same) | |
| decay rate | ||||
| constraint threshold | ||||
| correction-factor function | – | Eq. (50) | Eq. (65) | |
| solid/void-threshold functions | Eq. (9) | Eq. (45) | Eq. (64) | |
| Optimization aspect | Specification | Notes | ||
| Objective function | suggested scaling (§ 5) | |||
| Constraint function(s) | scaled by (§ 5) | |||
| Projection function | subpixel smoothed projection (SSP) | allows | ||
| Optimizer | CCSAQ | many alternatives, e.g. Ipopt | ||
| Strategy | See § 5 for details. | |||
| (i) Optimize an unconstrained design while ramping up to , until objective function is sufficiently low. | ||||
| (ii) Impose geometric constraints with recommended hyperparameters and ; optimize constrained design until some stopping criteria is met (e.g., constraints are feasible and obj. fun. is sufficiently low). | ||||
| (iii) In some instances, the imposed minimum lengthscales may be close to, but still less than, the desired target lengthscales. To further increase the imposed lengthscales, reduce and continue optimizing. |
Table 1. Summary of recommendations and hyperparameters for the conic, PDE, and Bi-PDE filters.
Our resulting TO algorithm (§ 5) consists of two stages: First, a design is optimized without imposing geometric constraints while rapidly increasing SSP’s up to . Then, when the objective function reaches a satisfactory value, the geometric constraints are imposed (at ) with hyperparameter values determined analytically from the desired lengthscale, and the design is evolved until the constraints become feasible and the objective function attains an acceptable value (typically, this requires fewer iterations than the initial unconstrained optimization). Because geometric constraints are only a proxy for the true fabrication constraints (Zhou et al. 2014; Zheng et al. 2023), and in any case the precise definition of “minimum lengthscale” for freeform geometries is inherently ambiguous (especially at the scale of the spatial discretization) (Chen et al. [12]), some a posteriori threshold tuning is occasionally still required to tweak the resulting geometry. To demonstrate the applicability of our approach, we present four photonics TO examples and one heat-transport TO example in § 6, all of them showing good agreement between the obtained and imposed lengthscales. Our strategy and selection of hyperparameters for the three filter cases (conic, PDE, and bi-PDE filters) is summarized in Table 1. Since the resulting algorithm is simply a streamlined version of an existing geometric-constraints method, we believe that it will be attractive to adopt for many applications of TO (in conjunction with SSP binarization), as well as raising new questions for future research (§ 8).
Several alternative approaches to impose minimum lengthscales on TO designs have been proposed. The two-phase Heaviside projection method (HPM) ([11] (Guest et al. 2004; Guest 2009b)) is able to impose minimum lengthscales on both solid and void phases—without additional constraints and with minimal hyperparameter tuning; however, the resulting designs are not fully binarized. Gray pixels values are penalized using, e.g., the solid isotropic material with penalization (SIMP) ([5]) or the rational material penalization (RAMP) ((Stolpe and Svanberg 2001)) methods, which may still leave some gray pixels that could affect the imposed lengthscales. Sigmund (2007) employs differentiable morphology-based filters—such as erosion, dilation, opening, and closing operators—in conjunction with the SIMP method to impose minimum lengthscales on one or two phases, but again, a resulting binary design is not guaranteed. A robust TO formulation was proposed by Wang et al. (2011), which accounts for over/underetch variability while enforcing a quasi-minimum lengthscale. This is achieved by performing a worst-case optimization across three designs—nominal, eroded, and dilated—obtained either by tuning a projection parameter (Qian and Sigmund 2013) or, alternatively, through morphological operations (Hammond et al. 2021). For the method to be valid, the three designs must share the same topology (in Hammond et al. (2021), this is enforced via geometric constraints). In Zhang et al. (2014), the structural skeleton of the physical design is extracted and minimum lengthscales are imposed on the solid phase by enforcing pixels within a neighborhood of the skeleton to be solid; however, they do not present exact constraint derivatives: their gradient computation neglects changes in the skeleton. Hägg and Wadbro (2018) show that designs possessing a minimum lengthscale in the solid (void) phase are morphologically open (closed). Based on this fact, the authors propose a modified SIMP method for minimum compliance problems using differentiable open and close operators (Svanberg and Svärd 2013) to impose minimum lengthscale on both phases. In Schubert et al. (2022), the authors introduce an always-feasible TO method that guarantees a binary and lengthscale-compliant design. The method uses a non-differentiable conditional generator of feasible designs in conjunction with a straight-through gradient estimator. The problem of designing a lengthscale-constrained TO design is then cast as an unconstrained stochastic gradient-optimization problem. In Li et al. (2023), a condition to obtain lengthscale-compliant designs is derived—which is somewhat analogous to the morphological condition given in Hägg and Wadbro (2018). From this, two differentiable constraints are proposed to enforce minimum lengthscales on both phases. These constraints introduce new hyperparameters into the TO problem; however, the authors provide a heuristic choice and a continuation scheme. In general, methods based on morphological filters require a regularization parameter to make these filters differentiable, and this parameter introduces a tradeoff between binarization and convergence rate analogous to , and may also require additional penalty terms to discourage grayscale regions. On the other hand, methods based on non-differentiable constraints or approximate gradients may limit the applicability of optimization algorithms.
TO overview
In this section we briefly review a general TO design problem. The goal is to find a material distribution in a design region , with or , parameterized by a latent density field at each point , such that an objective function is minimized. A typical formulation reads:
where is the objective function, is the system response and solution of , where models the physics of the problem and is parametrized by the latent density , and is the th constraint.
For a photonics TO problem, a common formulation reads:
where each electric-field response , , depends on a given angular frequency and/or current density , is the vacuum permeability, is the vacuum permittivity, and is the point-wise relative permittivity parametrized by the latent density .
A well-established strategy to parametrize the material distribution is the so-called three-density scheme (Sigmund and Maute 2013; Wang et al. 2011). First, to regularize the TO problem and prevent the occurrence of checkerboard patterns and mesh-dependent solutions ([8, 9]), a low-pass filter is applied to the latent density , resulting in the filtered density field . There are two widely employed alternatives for filtering.
For a photonics TO problem, a common formulation reads:
A first alternative is to use a conic filter of radius , given by
where the constant is chosen such that . The filtered field is then obtained as the convolution , where denotes 2D or 3D convolution, depending on the problem. A second alternative—convenient for unstructured meshes and finite-element discretizations—is to use a PDE filter approach (Lazarov and Sigmund 2011), where the filtered density is obtained as the solution of the following “modified Helmholtz” equation (essentially, an exponentially damped diffusion process):
with Neumann (or Dirichlet Lazarov et al. 2011; Qian and Sigmund 2013) boundary conditions, where plays a similar role as the conic filter radius. Despite its convenience, we have found that the PDE filter yields a filtered density with large spatial derivatives —which are attributed to the singularity and unbounded derivatives of the 2D Green’s function of the PDE—and this causes difficulties with the application of geometric constraints (see details in § 4.2). In this work we propose a third alternative—termed “bi-PDE” filtering—which simply involves applying the PDE filter twice in succession, resulting in a well-behaved filtered density that is better suited for the geometric constraints. Throughout the rest of the paper we focus our attention on the conic filter case; the particular analyses for the PDE and bi-PDE filter cases are given in § 4.2.
Once the filtered density is obtained, a projection function is applied to obtain a binary structure. This result in a projected density field , which determines the physical distribution of material or void in the design region. Typically, the following smooth tanh-projection (Xu et al. 2010; Wang et al. 2011) is employed:
where is the threshold (usually taken as ; values of greater than are projected towards one, lower values towards zero) and is the steepness hyperparameter ( corresponds to the identity mapping , whereas corresponds to a Heaviside step function ). During optimization is gradually increased from lower values—allowing smooth transitions of topologies—towards higher values to enforce binarization. Finally, the material relative permittivities, for a photonics TO problem, are linearly interpolated (Andkjær et al. [4]) employing the projected density as:
where and correspond to the relative permittivities of the void and solid region, respectively. Depending on the problem, other interpolating strategies might be employed, e.g., linearly interpolating the inverse of the permittivities (Wadbro and Engström 2015) or linearly interpolating the refraction indices (Christiansen et al. [16]).
Subpixel-smoothed projection
It has been noted that the tanh-projection (Eq. (5)) suffers from ill-conditioning as (Guest et al. 2011; Dunning and Wein 2025; Hammond et al. 2025). In the regime, the sensitivities of approach zero everywhere except at the interfaces where . At these interfaces (a set of measure zero), the sensitivities diverge. Furthermore, even for finite but large , the second derivatives of become large, resulting in an ill-conditioned Hessian that slows down optimization convergence ([7] (Nocedal and Wright 2006)). In practice, to overcome the slow convergence, the step size must be manually tuned during optimization to obtain good designs in reasonable time, and must be capped to a predefined maximum value (often around ), which leads to designs that are not fully binary. (Additional penalties may be used to enforce further binarization, but they come with their own hyperparameters ([13] (Jensen and Sigmund 2005; Hansen et al. 2024)).)
In this work, instead of using the tanh-projection as projection function, we employ the recently introduced subpixel-smoothed projection (SSP) technique (Hammond et al. 2025). SSP is an attractive drop-in alternative that: 1) overcomes the finite- slow convergence, 2) leads to a projection that is twice differentiable with bounded second derivatives, and 3) allows the optimization of almost-everywhere binary designs (binary except for a 1-pixel gray layer adjacent to interfaces). In brief, SSP consists of replacing Eq. (5) with a function , which remains twice differentiable even at —except at changes in topology, where it falls back to the tanh-projection—while being almost-everywhere binary. The key idea is that the inclusion of information provides knowledge of a local neighborhood of , not just a single point, allowing for a smooth dependence on the location of a nearby interface. To smoothly optimize changes in topology, one still optimizes at that increases in steps, but now can be increased much more rapidly, set to as soon as the topology stabilizes. In the present work, the lengthscale constraints are only imposed in this final epoch, using analytically derived hyperparameters (§ 4), allowing us to rely on almost-everywhere binarization without sacrificing optimization convergence rate. We refer the reader to Hammond et al. (2025) for more technical details on SSP.
Geometric constraints
Here, we review the geometric constraints introduced in Zhou et al. (2015), which impose a minimum lengthscales in both the solid and void regions. To impose a minimum target lengthscale on the solid region, the following constraint is employed:
where is the total number of pixels, is the solid structural function, is a threshold that depends on the fraction , and the constraint threshold is a small number. The solid structural function indicates the inflection region of the solid, given by , and decays to zero outside of this region. This is achieved with
where is a hyperparameter that determines the decay rate of outside of the inflection region. On the other hand, if a conic filter of radius is used, the solid threshold function is given by Qian and Sigmund (2013):
If a PDE or bi-PDE filter is used instead, the analytical expression of changes: see Eqs. (45) and (64), respectively. Analogously, to impose a minimum target lengthscale on the void region, the following constrained is imposed:
where is the void structural function, which identifies the inflection of the void, i.e., , and is given by
whereas, using a conic filter, the void threshold function reads (Qian and Sigmund 2013):
It is illustrative to qualitatively examine how the constraint value varies as the minimum lengthscale of the projected density changes. Consider the 2D example presented in Figure 1a, in which a latent density , consisting of a binary strip of width and length , is filtered with a conic filter of radius and then projected (using ), resulting in another binary strip of width and same length , where is the minimum lengthscale of the design. In Figure 1b we show the cross-sections of the densities , , and , alongside a (scaled and shifted) cross-section of the conic filter . In Figure 1c we show the value of the solid constraint , computed with Eq. (7), as a function of the physical width , for various target minimum lengthscales . Each target is denoted with a different color: vertical dashed lines indicate the (normalized) value of , whereas solid lines indicate the constraint value. In this example, we use the suggested hyperparameter values of and for the conic filter, shown in Table 1 and derived in § 4.1, to show the correct behavior of the geometric constraint. Examining the case, we observe that when the physical lengthscale falls below the target lengthscale (i.e., , indicating a lengthscale violation) the constraint attains an almost-constant value ( in this case). As approaches , decays rapidly and smoothly (note the log scale), and finally stabilizes at a small constant value ( in this case) when (i.e., the minimum lengthscale is satisfied). Ideally, when , the value of the constraint should equal the threshold (i.e., ) since determines the boundary between the allowed and excluded lengthscales. This is not the case here, however, due to numerical errors and other simplifications in our derivation (Sec. 4.1). Nevertheless, the true intersection has a small error less than . Thus, this choice of parameter is adequate for imposing a minimum lengthscale of , with some acceptable error. Importantly, a higher value of results in a sharper transition at , but it could also lead to numerical inaccuracies. Our relatively high value ensures a sharp transition while avoiding numerical inaccuracies, resulting in a robust constraint with respect to variations of in the same order of magnitude. Lastly, note that, for the same hyperparameters values, the constraint exhibits a similar behavior for other ratios of , approximately in the range —or equivalently, . On the other hand, higher ratios, such as , do not intersect with , whereas lower ratios become overly sensitive to variations of , and thus they are not adequate for imposing minimum lengthscales.
Figure 1. Simple 2D example. (a) Latent density consisting of a binary strip of width and length , which is filtered with a conic filter of radius (i.e., ), and then projected with (i.e., ), resulting in a binary strip of width and length . (b) Horizontal cross-section of , , . A scaled and shifted conic filter kernel is depicted as a black dashed line. (c) Value of the solid geometric constraint (Eq. (7)) as a function of the (normalized) physical width , for various (normalized) target lengthscales represented with different colors. The vertical dashed lines indicate the value of ; the solid lines indicate the constraint value. We used hyperparameters and (Table 1). The square design region of size was discretized with pixels, with and .
Hyperparameter derivations
In this section we derive appropriate values for the hyperparameters , and , in the limit of infinite resolution and full binarization (), using a first-principles analysis of stripe/slab geometries. (The quasi-empirical hyperparameter suggestions from previous works, which typically required problem-specific tuning, are summarized in more detail in the Supplementary Information.)
Conic filters
For simplicity, we focus our attention on the solid constraint of Eq. (7), which depends on the target lengthscale to be imposed. As a first requirement, the constraint must be resolution-invariant, i.e., for a fixed design , the value of must be (approximately) the same irrespective of the sampling resolution (at least in the limit of high enough resolution). and, in fact, the constraint must converge to a unique value at infinite resolution. A sufficient condition for this is that , , and do not depend on the resolution . As a result, the sum in the constraint can be seen as a Riemann sum, and thus the infinite-resolution constraint value is given by replacing the sum in with an integral, i.e., , where is the area/volume of the design region .
We now apply this idea to obtain a closed-form expression for in the limit of infinite resolution. Note that, if the projected density contains features whose minimum lengthscale is less than , then the constraint must be violated, i.e., . Conversely, if the minimum lengthscale is greater than , the constraint must be feasible, implying . Therefore, by continuity of , if the minimum lengthscale of is exactly , then . It follows that the value of , in the limit of infinite resolution, is given by evaluating when the projected density has a minimum lengthscale of . This results in a formula for involving the decay rate , the filter radius , and the imposed lengthscale (we eliminate the dependence by appropriately choosing and , see Eq. (19) below).
Following the same approach as Qian and Sigmund (2013); Trillet et al. (2021), we consider a simplified 1D setting where the latent density consists of a binary bump feature of width , given by
for , where rect is the rectangular function. The setting can be extended to 2D by considering a 2D binary strip instead, of width and length , as shown in Figure 1a, where a horizontal cross-section of the strip corresponds to the 1D latent density. The same applies to 3D, where we consider instead a binary slab of thickness , length and width also (for simplicity). The simplified setting is not general: in practice, the latent density does not have to be binary and its features can have a combination of different geometries, not necessarily stripes or slabs, and this alters the final expression for . Unfortunately, the geometric constraints apply, by construction, only to the simplified scenario, but in practice, they are also capable of imposing lengthscales on more general designs. Because of this, the final calculation of is not definitive; in some cases it might require some problem-dependent adjustments.
Continuing with the calculation of , we filter the 1D latent density using a 1D conic filter (Eq. (3)) of radius and normalization , yielding a filtered density , which is then projected with , resulting in a projected density consisting of a binary bump of width , as shown in Figure 1b. The closed-form expressions of , , and are given in Sec. A. Since is the minimum lengthscale of , we set the imposed lengthscale as . We still have the freedom of choosing the filter radius to any value, as long as (higher values are indistinguishable, see Eq. (9)), but it turns out that considering is sufficient; any other choice of with leads to essentially the same expression of (see Sec. A, where we derive analogous expression for for other choices of ; we also justify this in Sec. B).
The choice leads to according to Eqs. (33) and (34), and to , according to Eq. (9). Now, using the closed-form expressions of the filtered density , its gradient , and the projected density (refer to Sec. A), we compute the solid geometric constraint (Eq. (7)) in dimensions and in the limit of infinite resolution:
where the second line corresponds to the integral expression of , in the third line we performed the integration along the extra dimensions, yielding a factor of . We also replaced and changed variables expressing everything in terms of the (scalar) normalized variable , which yields the factor of in front of the integral and the factor in the exponential. It turns out that and depend on rather than on , which simplifies the computation. Moreover, we extended the limits of the integral to since we can always extend to zero outside of the design region. In the fourth line we computed the integral symbolically in terms of the error function and the normalized decay rate . Finally, in the last line we approximated and neglected the last term of the previous line, an approximation valid for large . This calculation suggests that an appropriate value for the threshold is given by Eq. (19), which depends on the filter radius , the normalized hyperparameter , and the dimension . Unfortunately, we see that an appropriate value of also depends on the total length of the features present in the design, which is specific to the problem and could potentially depend on the choice of radius . This underscores a limitation of the geometric constraints: the analytical choice of hyperparameters is problem-dependent. Nonetheless, we can still select appropriate hyperparameter values that perform well across a broad range of cases with minimal tuning.
We now briefly discuss an appropriate value for to then derive a value for . Notice that appears in the term of the structural function (Eq. (8)), indicating that has units of . From the closed-form 1D expression of (Sec. A), we have that is a Gaussian for . Thus, writing for a new variable , we see that has units of and corresponds to the length of the interval . Therefore, controls the width of the Gaussian term and, consequently, the width of the inflection region determined by (Eq. (8)). This width cannot be arbitrarily small nor large. In particular, cannot be much smaller than the pixel size ; otherwise the Gaussian would be too narrow to be accurately discretized. On the other hand, it is difficult to impose a precise lengthscale if the inflection region is too broad, as the imposed lengthscale become overly sensitive to . Ideally, should be fraction of , which, in turn, is of the order of a few pixels. It is advisable to set proportional to so that the threshold (Eq. (19)) depends linearly on and remains independent of . In our numerical experiments, we found that yields good results in most cases, a choice that corresponds to a decay rate of or . This value ensures a fast transition of the constraint at —as shown in Figure 1c—making the constraint robust to slight variations of . With this choice, and the reasonable estimates and , Eq. (19) yields (we mostly care about the order of magnitude of ; small variations do not affect the constraint, as discussed above).
PDE and bi-PDE filters
PDE-based filtering is popular for unstructured meshes; it requires, however, a different set of analytical hyperparameter values. Furthermore, as described below, special difficulties arise due to the singular Green’s function of the modified Helmholtz PDE (4). The mathematical details of the hyperparameter derivations are deferred to Sec. B, proceeding analogously to the conic filter case. The resulting hyperparameters are summarized in Table 1. Compared to the conic filter case, a different threshold function must be employed (Eq. (45)), and must be diminished, and includes a correction factor (Eq. (50)), for which .
Originally, we attempted to use the same value of as the conic filter case (), but it yielded poor results: in numerous instances, some small features were impossible to eliminate. This phenomenon is due to the presence of large singularity-induced spatial derivatives in the filtered density —particularly in the vicinity of small features. A similar phenomenon was also reported in Christiansen et al. [15]. The large spatial derivatives are attributed to the Green’s function of the modified Helmholtz PDE (Eq. (38)) with effective radius , which is singular and has unbounded derivatives at the origin, in 2D and higher dimensions. Since the filtered density can be written as , we see that inherits large derivatives, which are more prominent in the neighborhood of small features. (Indeed, for a small feature centered at , we have that the latent field is approximately proportional to a Dirac delta . Thus, , which exhibits large derivatives at .) The solid (and) void structural functions of Eq. (8), employs spatial derivative information of , weighted by the decay rate , to localize the inflection region where lengthscale violations occur. Thus, the presence of large spatial derivatives (or large numerical errors in their computation) in conjunction with a large value undermines the ability of the geometric constraints to detect small lengthscale violations. A simple workaround is to reduce the value: we have found that works well in our numerical examples. Unfortunately, a disadvantage of having a lower decay rate is that lengthscales imposed by the geometric constraint are more sensitive to variations in ; therefore, one may require additional fine-tuning of to impose the correct lengthscales.
To devise a more robust filtering approach to use with geometric constraints, we propose an alternative PDE filtering method—denoted “bi-PDE” filtering. Instead of applying the PDE filter with radius , we simply apply the PDE filter with radius twice in succession, where is a scaling factor that we adjust to make the effective radius of the bi-PDE filter similar to (see details in Sec. C and the chosen value of in Eq. (58)). With this, the filtered field is now , or equivalently, , where is the bi-PDE Green’s function (Eq. (57)), which is well-behaved, has bounded derivatives and is free of singularity. Consequently, the filtered field does not exhibit large spatial derivatives, rendering the bi-PDE filter more robust under geometric constraints. In contrast to the bi-PDE filter, previous double-filtering techniques ([15] (Clausen et al. 2015a)) perform a nonlinear projection in between the two filters, making their effect more difficult to analyze. (Computationally, the cost of topology optimization is usually dominated by the physical PDEs, not the filtering step. Moreover, if explicit sparse-matrix factors are employed, the same factorization of the modified Helmholtz PDE can simply be applied twice.)
We provide in Sec. C the details of the bi-PDE filter and the derivation of adequate hyperparameters. The resulting hyperparameters (see Table 1) are similar to the conic filter case, but is different (Eq. (64)) and includes a correction factor (Eq. (65)), for which .
Algorithm summary
In this section, we present our strategy to impose minimum lengthscales on a TO design by means of geometric constraints, in conjunction with SSP binarization and the analytically justified hyperparameter values from § 4.1.
Before starting the optimization, it is important to scale the objective function and constraints (e.g., using affine transformations) to an adequate range, which depends on the optimizer being used. Indeed, many optimization algorithms contain internal “dimensionful” parameters—such as initial step-sizes or trust-region radii or penalty strengths—that implicitly assume that all quantities are scaled to have magnitudes of order unity; thus, suboptimal performance is obtained for functions or parameters with inappropriate scalings. For instance, with the CCSA algorithm (Svanberg (2002)), Svanberg (Svanberg (2007)) suggests scaling the objective function to the range and inequality constraints such that . For Ipopt—another gradient-based optimizer for constrained large-scale optimization—the effect of scaling has also been studied (Wächter and Biegler (2006)); by default, it employs a conservative scaling method, in which the objective function and constraints are scaled at the starting point such that the norm of their gradient (in the infinity norm) do not exceed 100. We employ the recommended objective function scalings for the CCSAQ and Ipopt optimizers in all of our examples of § 6. Hereafter, references to the objective function will refer to the unscaled version, assuming that the scaling is handled internally. On the other hand, instead of enforcing the geometric constraints as , we normalize them as . We explored other constraint variations describing the same feasible set; however, none provided any advantage over the simple scaling (see Supplementary Information).
Our strategy to enforce a target minimum lengthscale on a TO design proceeds as follows. We have two main stages:
Unconstrained optimization: we set the filter radius to (other options are also viable, see discussion at the end of § 3) and optimize a starting design (random, in our case) without imposing geometric constraints. We employ SSP binarization, which allows us to rapidly increase the projection steepness across epochs, up to in the last epoch. As is typically the case in TO, the user is responsible for choosing an appropriate number of iterations, epochs, and -scheduling such that the resulting unconstrained design achieves a sufficiently good objective function value (OFV).
Constrained optimization: we maintain and impose geometric constraints with the suggested hyperparameter values given in Table 1. The resulting constrained design is optimized until a user-defined stopping criterion is met, which usually involves achieving both constraint feasibility and an acceptable OFV.
We have found that, upon successful termination, this strategy typically yields a constrained design that achieves a good OFV and complies with the minimum lengthscales imposed by the user, in a small number of iterations—usually converging in fewer iterations than the initial unconstrained optimization—and without requiring any hyperparameter tuning. There are two instances, however, where our strategy fails: when (i) the design fails to satisfy some external lengthscale requirement (such as a foundry design rule (Hammond et al. 2021)) even though the constraints are feasible, or when (ii) the optimization stalls in a local optimum, impeding further progress. Unfortunately, these cases require the user to rely on heuristic tuning of to obtain a satisfactory design. Regarding the first case, as discussed in § 1 and § 8, it is a known shortcoming that different definitions of lengthscale constraints do not always precisely agree—usually the discrepancy is a fraction of the filter radius. To address this, the user can either: impose much larger lengthscales compared to the desired lengthscale from the beginning, or heuristically decrease until the desired lengthscales are imposed, as done in our example of § 6.1. Regarding the second case, we found that temporarily imposing a higher threshold for a few iterations may help the optimizer escape local minima—say, imposing for 100 iterations and then until our stopping criteria is met. This approach, however, should be applied judiciously: the constraints are driven out of the feasible region each time is modified, requiring additional iterations to restore the constraints back to feasibility; consequently, repeated updates to could significantly increase the total number of iterations required for convergence.
Examples
Here, we apply our strategy devised in § 5 to five different TO inverse-design challenges—four from photonics and one from the heat-transfer literature. In particular, we consider three photonics inverse problems introduced in Schubert et al. (2022)—the design of a mode converter (§ 6.1), a beam splitter (§ 6.2), and a wavelength demultiplexer (§ 6.3)—which we simulate using the open-source 2D finite differences frequency domain solver (FDFD) Ceviche (Hughes et al. 2019) via the open-source invrs-gym package (Schubert 2024). In addition, we consider the problem of optimizing the resonance of a photonic cavity via the local density of states (LDOS) (Liang and Johnson 2013; Işiklar et al. 2022); specifically, we apply our strategy to the 2D cavity design problem defined in Chen et al. [12] (§ 6.4), which we simulate using Ceviche. Our last example deals with the optimization of the thermal conductivity tensor of a 2D periodic structure (§ 6.5), as studied in Romano and Johnson (2022), which we simulate using an in-house implementation of the finite-volume method (FVM) (Romano et al. 2025). In each example, the methodology is as follows:
Unconstrained optimization: we initialize the starting design as random, with the same starting design used for all the examples
within the same TO challenge. To optimize the unconstrained design we employ the quadratic approximate variation of the CCSA algorithm (CCSAQ) (Svanberg 2002), implemented in the open-source library NLopt (Johnson et al. 2014). The particular -scheduling used in each example is given in Sec. D.
Constrained optimization: we impose geometric constraints. To study if the choice of optimizer affects the performance of the geometric constraints, we employ both CCSAQ and Ipopt (Wächter and Biegler 2006) as optimizers. Each optimizer yields an independent constrained design that have the same unconstrained design as starting point.
Evaluation: We assess the performance of the geometric constraints on the final constrained designs, according to three evaluation metrics described below. The first two measure how far is the constrained design from meeting the desired lengthscales. The third metric is the number of iterations required for termination, with fewer iterations indicating faster convergence.
The evaluation metrics are as follows. First, we consider the solid and void minimum lengthscales—measured using the open-source package imageruler [12]—which are then compared against the imposed minimum lengthscale. Ideally, the measured lengthscales should be larger than or equal to the target lengthscale, though exact agreement is unlikely because imageruler employs a different definition of “lengthscale” based on (non-differentiable) morphological filters. Second, to quantitatively assess how far is a binary design from satisfying the imposed lengthscale constraints—in terms of how many pixels constitute a lengthscale violation—we introduce the solid violation metric , where is number of lengthscale-violating solid pixels and total number of pixels in . The void violation metric is defined analogously. We resort to the package imageruler to determine which solid (void) pixels constitute a lengthscale violation. Lastly, as a third metric we count the number of iterations, in the constrained optimization stage, required to achieve constraints feasibility and to attain an OFV sufficiently close to that of the unconstrained design; an efficient constraint would require a small number of iterations to achieve these conditions. Hence, we define our stopping criteria of the second stage as follows: letting and be the OFV of the unconstrained and constrained designs, respectively, which are assumed to be minimized, we optimize the constrained design until one of the following is satisfied: (i) both solid and void constraints are feasible and , or (ii) a defined maximum number of iterations (, in our case) is reached. The value 1.25 for the objective function ratio (OFR) ensures that the performance has not been significantly degraded due to the introduction of the geometric constraints. In some challenging problems (such as the cavity example of § 6.4 [12]), where the objective function is extremely sensitive to both the minimum feature size and small changes in geometry, achieving an OFR close to or less than 1.0 may require numerous iterations—or may even be impossible—when sufficiently large minimum lengthscales are enforced.
For each TO example we consider three target minimum lengthscales: small, medium (twice the small value), and large (twice the medium value); the small value is specific to each example. In some examples, using the default hyperparameters causes the optimization to become trapped in a local minimum. To address this, we gradually decreased to help the optimizer escape these local minima, as discussed in § 5; the affected examples are explicitly identified.
Importantly, we aggregate outer and inner iterations for both CCSAQ and Ipopt when reporting iterations. This explains why objective function histories may appear irregular and non-monotonic: in an inner iteration, the optimizer may take an aggressive step and subsequently backtrack by increasing some penalty. In Ipopt, the maximum iteration limit only affects the outer iterations; hence, some of the Ipopt examples may exceed the nominal maximum iteration count.
Mode converter
Following Schubert et al. (2022), we consider the problem of designing a 2D photonic mode-converter device that maximally converts the fundamental waveguide mode coming on the left (port 1) to the second order mode on the right (port 2), see Figure 2b. The design region is a square discretized with pixels (pixel size nm) coupled to fixed and semi-infinite input and output waveguides to the left and right, respectively, having 400 nm width. The solid and void materials correspond to silicon () and silicon oxide (), respectively. Given the incoming fundamental mode from port 1, the goal is to minimize backreflections into port 1 and maximize transmission of the second order mode into port 2, for six wavelengths: 1265, 1270, 1275, 1285, 1290, and 1295 nm. The precise definition of the objective function, which averages backreflection and transmission across all wavelengths, is given in Schubert et al. (2022).
Figure 2. Results for the mode converter example ( nm) with medium target lengthscales (), using the conic filter (with default hyperparameters , , and ), and the CCSAQ optimizer. (a) Objective function history and constraint history (maximum of solid and void constraint) of both the unconstrained and constrained design; the horizontal dashed lines indicate the objective function and constraint thresholds of our stopping criteria. (b) Resulting unconstrained design. (c) Resulting constrained design. In (b) and (c) we indicate the value (in pixels) of the target and measured minimum lengthscales, for both solid and void, which we illustrate with circles whose diameters align with the respective lengthscale. The orange and green dashed circles on the design indicate solid and void lengthscale violations, respectively.
Our results employing the conic filter are shown in Table 2. We observe that all small (4 pixels) and medium (8 pixels) cases achieve a satisfactory constrained design, in less than 21 iterations in all cases, except in the medium/Ipopt case, which requires 66 iterations. We show the objective function and constraint history of the medium/CCSAQ case in Figure 2, showing that the constraint value decays exponentially with the number of iterations. For the large (16 pixels) cases, the obtained lengthscales fall short of the desired lengthscale by at least 3 pixels; however, the violation metrics indicate that the number of lengthscale-violating pixels is actually small (). We conducted an additional experiment in which we continue evolving the constrained large/CCSAQ case with a decreases threshold of : the optimization took 15 extra iterations to meet our stopping criteria, and the resulting constrained design satisfied the minimum lengthscales. We had to decrease by four orders of magnitude because our large -parameter () renders the constraints relatively insensitive to values of within the same order of magnitude.
| Target length | Algorithm | Lengthscales (pix.) | Violations (%) | Results | |||
| Optimizer | Solid | Void | Iter. | Obj. fun. ratio | |||
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 2 | 0.13 | 0.054 | 100 | 1 (obj. = 9.87e-2) |
| Constrained: | CCSAQ | 4 | 5 | 0 | 0 | 21 | 1.14 |
| IPOPT | 4 | 6 | 0 | 0 | 19 | 1.02 | |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 1 | 0.21 | 0.49 | 93 | 1 (9.88e-2) |
| Constrained: | CCSAQ | 8 | 8 | 0 | 0 | 15 | 1.03 |
| IPOPT | 10 | 9 | 0 | 0 | 66 | 0.99 | |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 6 | 5 | 1.38 | 1.16 | 74 | 1 (1.01e-1) |
| Constrained: | CCSAQ | 15 | 13 | 0.039 | 0.059 | 16 | 1.19 |
| IPOPT | 15 | 17 | 0.0078 | 0 | 29 | 1.03 |
Table 2. Results using the conic filter for the mode converter example, using default hyperparameters , , and , where is the target lengthscale in physical units. Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red). The unconstrained and constrained designs presented in Figure 2 are marked in bold for reference.
Results using the PDE filter are shown in Table 3. Most constrained designs do not satisfy the imposed minimum lengthscales—at most, they are four pixels short. However, the violation metrics indicate that the number of lengthscale-violating pixels is relatively small (, ). The loss of precision of the geometric constraints could be attributable to the large spatial derivatives problems caused by singularities in the PDE filter (see Secs. B and 4.2). Even tuning the hyperparameter did not cure all violations. The number of iterations in all cases is small—less than 30—similar to the conic filter results.
| Target length | Algorithm | Lengthscales (pix.) | Violations (%) | Results | |||
| Optimizer | Solid | Void | Iter. | Obj. fun. ratio | |||
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 3 | 0.039 | 0.0078 | 80 | 1 (obj. = 9.86e-2) |
| Constrained: | CCSAQ | 2 | 2 | 0.0078 | 0.0078 | 15 | 1.06 |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 4 | 5 | 0.53 | 0.62 | 90 | 1 (9.86e-2) |
| Constrained: | CCSAQ | 7 | 10 | 0.0039 | 0 | 29 | 1.19 |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 7 | 3.28 | 4.07 | 85 | 1 (9.95e-2) |
| Constrained: | CCSAQ | 12 | 12 | 0.063 | 0.16 | 28 | 1.20 |
Table 3. Results using the PDE filter for the mode converter example, using default hyperparameters , , and , where is the target lengthscale in physical units. Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red).
Results using the bi-PDE filter are shown in Table 4. Here, most constrained designs comply with the imposed lengthscales—except for the large target lengthscale (16 pixels) case, but even in that case the violation metrics are small (, ). The number of iterations remains small—less than 40.
| Target length | Algorithm | Lengthscales (pix.) | Violations (%) | Results | |||
| Optimizer | Solid | Void | Iter. | Obj. fun. ratio | |||
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 5 | 0.0078 | 0 | 92 | 1 (obj. = ) |
| Constrained: | CCSAQ | 6 | 7 | 0 | 0 | 17 | 1.07 |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 4 | 3 | 0.10 | 0.20 | 80 | 1 () |
| Constrained: | CCSAQ | 8 | 9 | 0 | 0 | 17 | 1.11 |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 3 | 1.38 | 2.34 | 160 | 1 () |
| Constrained: | CCSAQ | 17 | 13 | 0 | 0.016 | 38 | 1.00 |
Table 4. Results using the Bi-PDE filter for the mode converter example, using default hyperparameters , , and . Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red).
Beam splitter
We consider the design of the 2D photonics beam splitter defined in Schubert et al. (2022). The device has four ports, ports 1 and 3 to the left and ports 2 and 3 to the right, connected to fixed and semi-infinite waveguides of 400 nm width, see Figure 3b. The design region, at the center, is a rectangle discretized with pixels (pixel size nm). An incoming fundamental mode into port 1 is divided equally in power into ports 2 and 3, while minimizing back-reflection into port 1 and transmission into port 4. Symmetry along the vertical and horizontal axis is imposed so that all ports have analogous behavior. The solid and void material permittivities, and the six considered wavelengths, are the same as the mode converter example of Sec. 6.1.
Figure 3. Results for the beam splitter example ( nm) with medium target lengthscales (), using the conic filter (with default hyperparameters , , and ), and the CCSAQ optimizer. (a) Objective function history and constraint history (maximum of solid and void constraint) of both the unconstrained and constrained design; the horizontal dashed lines indicate the objective function and constraint thresholds of our stopping criteria. (b) Resulting unconstrained design. (c) Resulting constrained design. In (b) and (c) we indicate the value (in pixels) of the target and measured minimum lengthscales, for both solid and void, which we illustrate with circles whose diameters align with the respective lengthscale. The orange and green dashed circles on the design indicate solid and void lengthscale violations, respectively.
The results obtained with the conic filter are shown in Table 5. The small (4 pixels) cases comply with the imposed lengthscales, but the CCSAQ and Ipopt optimizers exhibit a large difference of the required number of iterations—39 and 288, respectively. For the medium (8 pixels) cases, all constrained designs comply with the imposed lengthscale in less than 72 iterations. In the objective function and constraint history of the medium/CCSAQ case (Figure 3), we note that the geometric constraints become feasible exponentially fast—in less than 20 iterations—but then, the CCSAQ optimizer requires more iterations to recover the performance lost while driving the constraints to feasibility. The large
| Target length | Optimizer | Solid | Void | Iter. | Obj. fun. ratio | ||
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 2 | 0.18 | 0.038 | 180 | 1 (obj. = ) |
| Constrained: | CCSAQ | 4 | 5 | 0 | 0 | 39 | 1.19 |
| IPOPT | 4 | 5 | 0 | 0 | 288 | 0.8 | |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 5 | 3 | 0.33 | 0.0125 | 180 | 1 (4.19e-1) |
| Constrained: | CCSAQ | 9 | 11 | 0 | 0 | 72 | 1.02 |
| IPOPT | 9 | 9 | 0 | 0 | 50 | 0.64 | |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 6 | 1 | 2.43 | 0.63 | 200 | 1 (3.49e0) |
| Constrained: | CCSAQ1 | 11 | 14 | 0.38 | 6.3e-3 | 374 | 0.96 |
| IPOPT | 14 | 13 | 0.35 | 0.025 | 320 | 0.4 |
Table 5. Results using the conic filter for the beam splitter example, using default hyperparameters , , and , where is the target lengthscale in physical units. Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red). The unconstrained and constrained designs presented in Figure 3 are marked in bold for reference.
cases (16 pixels), on the other hand, do not comply with the target lengthscale—they fall short by five pixels, at most—whereas the violation metrics are small, but not negligible (). The iteration count is considerable: it takes 374 iterations at most to meet the stopping criteria. This suggests that the beam splitter becomes a challenging example when geometric constraints with large lengthscales are imposed. We conducted an additional experiment in which we continue optimizing the large/CCSAQ constrained design with : the resulting design has 16 and 15 pixels of solid and void lengthscales, respectively, with and , and it took 185 additional iterations to reach our stopping criteria.
Results using the PDE filter are shown in Table 6. Both the medium (8 pixels) and small (4 pixels) cases comply with the imposed target lengthscale, taking 76 and 15 iterations, respectively. For the large case (16 pixels), the void lengthscale falls short by four pixels—although is small. It reached the maximum 400 iterations: the objective function decreased so slowly that it could not reach our stopping criteria, as evidenced in the resulting OFR of . This slow convergence was also observed in the conic filter results.
| Target length | Optimizer | Solid | Void | Iter. | Obj. fun. ratio | ||
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 1 | 0.025 | 0.088 | 180 | 1 (obj. = ) |
| Constrained: | CCSAQ | 5 | 5 | 0 | 0 | 15 | 1.15 |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 4 | 3 | 0.11 | 0.075 | 180 | 1 (2.50e-1) |
| Constrained: | CCSAQ | 9 | 8 | 0 | 0 | 76 | 1.24 |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 4 | 5.67 | 2.55 | 200 | 1 (1.23e0) |
| Constrained: | CCSAQ1 | 20 | 12 | 0 | 0.025 | 400 | 41.94 |
Table 6. Results using the PDE filter for the beam splitter example, using default hyperparameters , , and . Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red).
Results using the bi-PDE filter are shown in Table 7. We observe similar results to those of the PDE filter. Notably, the medium and small cases take a few more iterations—133 and 57, respectively. Furthermore, for the large case the solid violation is much higher (); however, by the end of the 400 maximum iterations, it achieved a lower OFR of 3.24.
| Target length | Algorithm Optimizer | Lengthscales (pix.) Solid | Lengthscales (pix.) Void | Violations (%) | Violations (%) | Results Iter. | Results Obj. fun. ratio |
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 2 | 2 | 0.075 | 0.0125 | 180 | 1 (obj. = 0.21e-1) |
| Constrained: | CCSAQ | 5 | 5 | 0 | 0 | 57 | 1.25 |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 2 | 0.18 | 0.16 | 180 | 1 (3.21e-1) |
| Constrained: | CCSAQ | 9 | 7 | 0 | 0.044 | 133 | 1.04 |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 7 | 4 | 2.56 | 3.05 | 419 | 1 (1.61e0) |
| Constrained: | CCSAQ | 11 | 15 | 0.24 | 0.094 | 400 | 3.24 |
Table 7. Results using the Bi-PDE filter for the beam splitter example, using default hyperparameters , , and . Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red).
Wavelength demultiplexer
In this example we consider the design of the 2D photonic wavelength demultiplexer defined in Schubert et al. (2022). The design region is a square discretized with pixels (pixel size nm). The device is coupled to an input waveguide to the left (port 1) and two output waveguides to the right (port 2 and 3), of 400 nm width, see Figure 4b. Incoming excitations from port 1 are directed to port 2 for wavelengths 1265, 1270, and 1275 nm, and directed to port 3 for wavelengths 1285, 1290,
Figure 4. Results for the wavelength demultiplexer example ( nm) with medium target lengthscales (), using the conic filter (with default hyperparameters , , and ), and the CCSAQ optimizer. (a) Objective function history and constraint history (maximum of solid and void constraint) of both the unconstrained and constrained design; the horizontal dashed lines indicate the objective function and constraint thresholds of our stopping criteria. (b) Resulting unconstrained design. (c) Resulting constrained design. In (b) and (c) we indicate the value (in pixels) of the target and measured minimum lengthscales, for both solid and void, which we illustrate with circles whose diameters align with the respective lengthscale. The orange and green dashed circles on the design indicate solid and void lengthscale violations, respectively.
and 1295 nm. The solid and void materials correspond to silicon () and silicon oxide (), respectively.
The results using the conic filter are shown in Figure 4 and Table 8. All small (4 pixels) cases satisfy the imposed lengthscale. We note that CCSAQ required significantly fewer iterations than Ipopt—66 and 262, respectively—which was also observed in the beam-splitter example. The medium (8 pixels) cases require less than 124 iterations, but they fall short of the imposed lengthscale by at most two pixel. The violation metrics, however, show that the number of violating pixels is small (). Similar to the beam-splitter example, we observe in the constraint history (Figure 4a) that the constraints become feasible in less 20 iterations, but then CCSAQ takes an additional iterations to meet our stopping criteria. For the large (16 pixels) cases, all final designs fail to comply with the desired lengthscale
| Target length | Algorithm Optimizer | Lengthscales (pix.) Solid | Lengthscales (pix.) Void | Violations (%) | Violations (%) | Results Iter. | Results Obj. fun. ratio |
| Small: 4 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 1 | 0.11 | 0.059 | 267 | 1 (obj. = 1.97e-1) |
| Constrained: | CCSAQ | 4 | 4 | 0 | 0 | 66 | 1.20 |
| IPOPT | 4 | 4 | 0 | 0 | 262 | 1.01 | |
| Medium: 8 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 1 | 1.11 | 1.0 | 300 | 1 (1.97e-1) |
| Constrained: | CCSAQ | 7 | 6 | 0.013 | 0.016 | 92 | 1.21 |
| IPOPT | 8 | 7 | 0 | 0.00049 | 124 | 1.06 | |
| Large: 16 pix. | |||||||
| Unconstrained: | CCSAQ | 2 | 2 | 1.93 | 1.13 | 300 | 1 (2.35e-1) |
| Constrained: | CCSAQ | 11 | 13 | 0.037 | 0.009 | 78 | 1.24 |
| IPOPT | 14 | 15 | 0.013 | 0.016 | 56 | 0.88 |
Table 8. Results using the conic filter for the wavelength demultiplexer example, using default hyperparameters , , and , where is the target lengthscale in physical units. Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red). The unconstrained and constrained designs presented in Figure 4 are marked in bold for reference.
by at most four pixels; however, the violation metrics are small (, ), and our stopping criteria was met in a small number of iterations—less than 80. It is surprising that the wavelength demultiplexer requires significantly fewer iterations than the beam splitter (§ 6.2) for the same target lengthscale, despite its higher resolution and seemingly greater design complexity with many small features. We conducted an additional experiment in which we continue optimizing the large/CCSAQ constrained design with : the resulting design required 94 additional iterations to satisfy our stopping criteria and meets the imposed lengthscale of 16 pixels.
Cavity design
In this example, we consider the maximization of the local density of states (LDOS) of a 2D photonic cavity, corresponding to the power emitted by a point-dipole source. This TO problem is challenging due to its extreme sensitivity to the imposed minimum lengthscale and small geometric changes (Chen et al. [12])—especially for resonances with long lifetimes, corresponding to a high “quality factor” (Joannopoulos et al. (2008)). As a result, the optimization is ill-conditioned and “stiff”, causing many algorithms to converge slowly (Liang and Johnson (2013)). This challenge is thus useful for testing the geometric constraints performance.
In particular, we consider the cavity design problem defined in Chen et al. [12]. The goal is to maximize the LDOS produced by an unit electric dipole with in-plane electric field polarization, for a wavelength of m. The dipole is placed at the center of the design region, consisting of a square discretized with pixels (pixel size nm). The solid and void materials have permittivities and , respectively. The cavity is surrounded by void material with outgoing boundary conditions, implemented via perfectly matched layers (PML) (Taflove and Hagness (2005)). As done in Chen et al. [12], instead of directly maximizing the cavity LDOS, we equivalently minimize the
non-dimensionalized objective function:
where the cavity LDOS depends on the material distribution determined by , whereas the vacuum LDOS is numerically computed with the same discretization and everywhere. This objective function is more suitable for optimizing high- cavities, resulting in faster convergence (Liang and Johnson 2013). Due to the inherent slow convergence of this example, we increased the maximum number of iterations for the constrained optimization to .
In Figure 5, we show the objective function and constraint history of the medium/CCSAQ (6 pixels) case, using a conic filter. The slow convergence of the cavity LDOS optimization is evident during the unconstrained optimization: In the first iterations the objective function achieves a value of , but then it takes additional iterations to decrease by one order of magnitude, to a value of . When geometric constraints are imposed and the constrained optimization begins, the constraints achieve feasibility
Figure 5. Results for the cavity example ( nm) with medium target lengthscales (), using the conic filter (with default hyperparameters , , and ), and the CCSAQ optimizer. (a) Objective function history and constraint history (maximum of solid and void constraint) of both the unconstrained and constrained design; the horizontal dashed lines indicate the objective function and constraint thresholds of our stopping criteria. (b) Resulting unconstrained design. (c) Resulting constrained design. In (b) and (c) we indicate the value (in pixels) of the target and measured minimum lengthscales, for both solid and void, which we illustrate with circles whose diameters align with the respective lengthscale. The orange and green dashed circles on the design indicate solid and void lengthscale violations, respectively.
exponentially fast in only iteration; however, this fast decrease of the constraint comes at the expense of degrading the objective function, which increased by one order of magnitude to a value of . The CCSAQ optimizer then required additional iterations to decrease the objective function back to its unconstrained value and meet our stopping criteria. Although the constrained optimization required approximately the same number of iterations as the unconstrained case, we note that the inclusion of geometric constraints did not affect the convergence rate of the objective function, which remained similar to that of the unconstrained optimization.
Our results using the conic filter are shown in Table 9. For the small (3 pixels) target lengthscale, both the CCSAQ and Ipopt cases comply with the imposed lengthscale, but they require vastly different numbers of iterations—21 and 1745, respectively. For the medium (6 pixels) target, the CCSAQ case satisfies the imposed lengthscale, requiring 287 iterations to meet our stopping criteria. On the other hand, the Ipopt case reaches the maximum number of iterations without satisfying the geometric constraints and falls below the imposed solid target by 3 pixels; however, the solid violation is small (). For the large (12 pixels) target, the CCSAQ case requires 717 iterations but exhibits a small void lengthscale violation (), whereas the Ipopt case complies with the imposed lengthscale but reaches the maximum number of iterations without meeting our stopping criteria.
| Target length | Optimizer | Solid | Void | Iter. | Obj. fun. ratio | ||
| Small: 3 pix. | |||||||
| Unconstrained: | CCSAQ | 2 | 3 | 0.01 | 0 | 270 | 1 () |
| Constrained: | CCSAQ | 3 | 4 | 0 | 0 | 21 | 0.65 |
| IPOPT¹ | 4 | 3 | 0 | 0 | 1745 | 0.76 | |
| Medium: 6 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 1 | 0.11 | 0.03 | 270 | 1 (5.43e-5) |
| Constrained: | CCSAQ | 6 | 6 | 0 | 0 | 287 | 1.19 |
| IPOPT² | 3 | 7 | 0.0044 | 0 | 1261 | 0.53 | |
| Large: 12 pix. | |||||||
| Unconstrained: | CCSAQ | 3 | 10 | 0.008 | 0.021 | 270 | 1 (8.03e-5) |
| Constrained: | CCSAQ | 13 | 10 | 0 | 0.017 | 717 | 1.23 |
| IPOPT | 15 | 14 | 0 | 0 | 1338 | 0.49 |
Table 9. Results using the conic filter for the cavity example, using default hyperparameters , , and , where is the target lengthscale in physical units. Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red). The unconstrained and constrained designs presented in Figure 4 are marked in bold for reference.
Heat transfer
In this section, we apply our framework to optimize a 2D periodic thermal metamaterial with a prescribed effective thermal conductivity tensor, . The transport model is the standard heat-conduction equation
which we solve using the finite-volume method Gersborg-Hansen et al. 2006. The design region is a square of size divided into pixels, see Figure 6b. Details about the discretization of Eq. (21) can be found in Eq. (21) in Romano and Johnson (2022). The thermal metamaterial is composed of a solid and a void phase, the latter with negligible thermal conductivity. In Eq. (21), the local thermal conductivity is interpolated via
Figure 6. Results for the heat-transfer example with medium target lengthscales (), using the conic filter (with default hyperparameters , , and ), and the CCSAQ optimizer. (a) Objective function history and constraint history (maximum of solid and void constraint) of both the unconstrained and constrained design; the horizontal dashed lines indicate the objective function and constraint thresholds of our stopping criteria. (b) Resulting unconstrained design. (c) Resulting constrained design. In (b) and (c) we indicate the value (in pixels) of the target and measured minimum lengthscales, for both solid and void, which we illustrate with circles whose diameters align with the respective lengthscale. The orange and green dashed circles on the design indicate solid and void lengthscale violations, respectively.
where is the bulk thermal conductivity of the solid phase and is a regularization parameter. The goal is to find such that the effective thermal conductivity tensor approaches the desired one, which we set to
To reconstruct , we solve Eq. (21) for three different directions of applied temperature , with , , , and . For each direction , we compute the effective directional thermal conductivity , where is the vector of power collected along two orthogonal faces of the simulation domain. For example,
the component along is computed by
where is the heat flux. The three independent components , , and of the symmetric tensor are then obtained by solving the linear system , leading to , , and . Once is reconstructed, the objective function is computed as , where we used the Frobenius norm.
End-to-end differentiability is ensured by automatic differentiation, which is the engine behind
the thermal solver. The code has recently been validated against Ansys on three-dimensional structures (Romano et al. 2025), and is planned for public release in the near future. We note that the use of three different directions generalizes our previous approach (Romano and Johnson 2022), where only the diagonal components of were considered. In contrast, here, the third direction is used to enforce zero off-diagonal elements. In principle, a diagonal tensor for can also be achieved by enforcing symmetry. However, our approach allows for a wider range of optimal configurations, while also potentially enabling non-zero off-diagonal components.
Our results using the conic filter are shown in Figure 6. Only two final designs do not satisfy the imposed lengthscales; however, their number of lengthscale-violating pixels is small (, ). All examples meet our stopping conditions in less than 150 iterations. For the small case, Ipopt requires more than triple number of iterations compared to CCSAQ (141 and 43 iterations, respectively). For the medium and large cases, Ipopt only requires a few extra iterations compared to CCSAQ. In Figure 6 we present the objective function and constraint history of the medium/CCSAQ case, which exhibit rapid convergence.
Discussion
Our strategy is able to, either, impose the desired minimum lengthscale , or yield a design whose lengthscale falls slightly below the but with only a few lengthscale-violating pixels—as measured by and .
Usually, for small and medium target lengthscales, the geometric constraints successfully enforce the desired lengthscale, in a small number of iterations—typically, less than that of the unconstrained optimization—and without degrading the objective function value. On the other hand, the large target lengthscale cases are more challenging: often, lengthscales are not satisfied and it takes numerous iterations to meet our stopping criteria. A possible reason for this is that, since the perimeter of 2D features are longer for large target lengthscales, there are more pixels that can constitute a possible lengthscale violation, and thus it is more difficult to perfectly agree with lengthscale measuring tools. The resulting violation metrics, however, are small (often ), and we have shown that they can be further reduced, potentially to zero, by decreasing . A possible cause for the increased number of iterations is that larger lengthscales—which require a larger filter radius —have a slower convergence rate. Indeed, we observe that, for the same number of iterations, the unconstrained large-lengthscale designs attain a less-optimal objective function compared to unconstrained medium-lengthscale cases. Furthermore, it is usually the case that the optimizer cannot recover the same objective function value as the unconstrained design when sufficiently large lengthscales are imposed, thus leading to an increased number of iterations to meet our stopping conditions. We note that the constraints rapidly become feasible within a few iterations, which initially worsens the objective function value; a large number of subsequent iterations are then needed to restore its performance. Notably, when small or medium target lengthscales are imposed, the geometric constraints do not appear to degrade the convergence rate relative to the unconstrained case, as evidenced in the challenging cavity example shown in Figure 5a.
| Target length | Algorithm | Lengthscales (pix.) | Violations (%) | Results | |||
| Optimizer | Solid | Void | Iter. | Obj. fun. ratio | |||
| Small: 6 pix. | |||||||
| Unconstrained: | CCSAQ | 1 | 1 | 2.14 | 1.13 | 120 | 1 (obj. = ) |
| Constrained: | CCSAQ | 5 | 5 | 0.0044 | 0.018 | 43 | 1.17 |
| IPOPT | 7 | 6 | 0 | 0 | 141 | 0.95 | |
| Medium: 12 pix. | |||||||
| Unconstrained: | CCSAQ | 5 | 3 | 1.42 | 0.35 | 120 | 1 () |
| Constrained: | CCSAQ | 13 | 12 | 0 | 0 | 43 | 0.81 |
| IPOPT | 16 | 15 | 0 | 0 | 67 | 1.19 | |
| Large: 18 pix. | |||||||
| Unconstrained: | CCSAQ | 4 | 5 | 4.55 | 0.85 | 120 | 1 () |
| Constrained: | CCSAQ | 20 | 14 | 0 | 0.044 | 67 | 0.80 |
| IPOPT | 21 | 23 | 0 | 0 | 85 |
Table 10. Results using the conic filter for the heat-transfer example, using default hyperparameters , , and , where is the target lengthscale in physical units. Measured lengthscales that comply (do not comply) with the target lengthscale are indicated in green (red). The unconstrained and constrained designs presented in Figure 6 are marked in bold for reference.
Comparing the performance of the optimizers, we find that CCSAQ usually requires fewer iterations than Ipopt to meet our stopping criteria, which can be attributed to differences in their constrained optimization approaches. On one hand, when the starting point is infeasible, the CCSAQ implementation of the NLopt library (Johnson et al. 2014) employs an aggressive strategy that essentially disregards the objective function value and prioritize constraint feasibility instead, potentially leading to fewer iterations but also becoming more susceptible to converging to local minima. On the other hand, Ipopt employs a conservative
approach: by default, it allows some constraint infeasibility while prioritizing objective function improvement; this enhances robustness but could lead to a higher iteration count.
Regarding the conic, PDE, and bi-PDE filters, they exhibit similar performance. It is important to emphasize, however, that lengthscales imposed by geometric constraints become more sensitive to when the PDE filter is employed—as discussed in § 4.2; therefore, users might expect additional fine-tuning of to enforce strict minimum lengthscales. The conic and bi-PDE filters, on the other hand, do not encounter this issue, as their filter kernels are bounded.
Conclusions
In this work we provided a comprehensive analysis of the geometric constraints and the analytical derivation of adequate and resolution-invariant hyperparameters, for the case of full binarization () and infinite resolution. We proposed a simple but effective strategy to impose minimum lengthscales on a TO design via geometric constraints, based on our analytically derived hyperparameters and the use of subpixel-smooth projection (SSP), which allows the rapidly-converging optimization of almost-binary designs. We illustrated and evaluated the performance of our strategy using four photonics and one heat-transfer TO examples, each constrained by three distinct target lengthscales, while employing different combination of filters (conic, PDE, and bi-PDE) and optimizers (CCSAQ and Ipopt). We believe that our streamlined algorithm will be attractive to adopt in many TO applications. Lastly, we identified that the PDE filter poses difficulties to the geometric constraints due to its singular Green’s function. We proposed the bi-PDE filter scheme, which is a simple and attractive alternative that alleviates the aforementioned issues due to its well-behaved Green’s function.
There are many directions of future research. For example, one could apply a similar analysis (in the full-binarization and infinite-resolution limit) to other types of fabrication constraints, such as maximum lengthscales (Guest 2009a; Lazarov and Wang 2017; Carstensen and Guest [11]), minimum area and minimum enclosed area (Hammond et al. 2021), and connectivity (Li et al. 2016; Christiansen [14]). Another challenge is that the hyperparameter (Eq. (19)) has a weak dependence on the total volume of the small features due to the integrated nature of the constraint, which sometimes still requires manual tuning of . One possible way to eliminate this problem-dependence is to impose the constraints not just globally but locally. Although this would require thousands of additional pointwise constraints, the sparsity of their gradients could be exploited by efficient large-scale optimization algorithms (e.g., Wächter and Biegler 2006; Gill et al. 2005; Byrd et al. [10]). We must emphasize, however, that imposing an even-stricter minimum lengthscale may not necessarily improve the manufacturability of a design, because lengthscale constraints are generally approximations. The definition of a minimum lengthscale is inherently somewhat ambiguous for freeform geometries, especially at the scale of the discretization (Chen et al. [12]), so 1–2 pixel violations are not necessarily meaningful. More fundamentally, however, minimum lengthscales are generally only a proxy for the true manufacturing constraints of a process like lithography or 3D printing. In practice, additional calibration steps—such as proximity error correction (PEC)—are required to make TO designs manufacturable; nonetheless, these steps often produce output patterns that deviate from the original TO design, leading to reduced performance (Zhou et al. 2014).
One approach to improve fidelity is to incorporate an explicit model of the fabrication physics into the design framework (Zhou et al. 2014, 2017; Zheng et al. 2023), which has the drawback of requiring extensive theory and calibration for a particular manufacturing method.
Derivations: conic filters
Here we derive closed-form expressions of and for the simplified 1D setting presented in § 4.1, in the limit of infinite resolution and full binarization (). Consider a latent density that consists of a 1D binary bump of width , , for , as done in Eq. (13). For filtering, we employ the 1D conic filter (Eq. (3)) of radius and normalization , which can be written as
in terms of the triangular function . It is convenient to work with normalized units and . In the limit of infinite resolution, the filtered field is:
where in the last line we changed variables . From the last expression we see that depends on and rather than on and . Calculating this in closed-form yields a piecewise quadratic polynomial whose expression depends on . For the case we have:
and for the case :
The case is not of interest, since the geometric constraint can only impose lengthscales up to when employing the conic filter, but we show its expression here for completeness:
Now, the projected density is computed as a Heaviside projection (), that is , and it can be shown that it corresponds to a binary bump of width , . The (normalized) width can be computed in closed-form (by solving ) as a function of the (normalized) latent width (Qian and Sigmund 2013):
whereas the the inverse relation is:
In Sec. 4.1 we derived an asymptotic approximation of the threshold (Eq. (19)) for the case , where is the target lengthscale. We note, however, that this approximation also holds for cases . We can verify that the exact expression of for the case is:
whereas for it is:
where . All three Eqs. (35), (A12) and (18) have the same asymptotic approximation for large given in Eq. (19), as seen in Figure A1. In the discussion at the end of Sec. B we show that the value of is insensitive to the target lengthscale using an asymptotic calculation argument.
Figure A1. Comparison of the analytical (normalized) threshold as a function of the (normalized) decay rate , in 2D, using the conic filter, for the cases in blue (Eq. (18)), in orange (Eq. (35)}), and $\tilde{R}=2\ell_t$ in green (Eq. (A12)}), where is the target lengthscale. The asymptotic approximation from Eq. (19) is shown as a red dashed line.
Derivations: PDE filters
In this section we derive the closed-form expressions of the thresholds and , the filtered and projected densities, and the asymptotic value of the geometric constraint threshold , when the PDE filtering procedure (Lazarov and Sigmund 2011) is employed. Here, the filtered density is obtained by solving the following modified
Helmholtz PDE:
where the parameter plays a similar role as the filter radius of the conic filter. The resulting filtered density can be written in terms of the free-space Green’s function as the convolution , where
where is the modified Bessel function of the second kind of order zero, which satisfies as and as , and the normalization ensures that . The expression for has an additional contribution coming from the boundary of the design region—due to boundary conditions, usually chosen as homogeneous Neumann boundary conditions—that we can neglect due to the exponential decay of the free-space Green’s function.
We now consider the simplified 1D setting presented in § 4.1 and in Figure 1a, in which the latent density consists of a 1D binary bump of width : . This latent density is filtered using the 1D Green’s function of the PDE filter, , resulting in the filtered field:
where we employed normalized units and . Now, we compute the projected density as a Heaviside projection (), this is , which corresponds to a binary bump of width , , where the (normalized) width can be computed in closed-form (by solving ) as a function of the (normalized) latent width :
whereas the inverse relation is:
We now proceed to derive the thresholds and , which differ from the thresholds of the conic filter case given in Eqs. (9) and (12). To compute the threshold of the solid constraint (Qian and Sigmund (2013)), we assume that the physical lengthscale of the feature equals the target lengthscale to be imposed—this is —and then compute the maximum value of , which occurs at and is given by
where we employed Eq. (41). The threshold is then given by Eq. (44) but as a function of the physical width , this is , where is given in Eq. (43). This yields
Note that for the typical choice we have , which is slightly different from the value of the conic filter case (Eq. (9)). In Figure C2 we show a comparison between for the conic and PDE filter cases. An analogous calculation for the void threshold leads to ; explicitly,
Figure C2. Comparison of the threshold for the conic (Eq. (9)), PDE (Eq. (45)), and bi-PDE (Eq. (64)) filter cases, as a function of (normalized) target lengthscale .
Given the correct thresholds, we proceed to derive , where again we assume . Unlike the conic filter case, the expression for cannot be written in closed-form, such as the one given in Eq. (18); instead, we provide an asymptotic expression, similar to Eq. (19) of the conic filter case, derived as follows. The solid structural function of Eq. (8) indicates that the largest contribution of the constraint value comes from a neighborhood of , the point at which achieves its maximum value. Expanding (Eq. (41)) up to second order around this point yields
for , where we defined in the second line, and in the last line we replaced using Eq. (43) and defined the correction factor , given by
which will result relevant in the computation of .
The value of is given by the value of the geometric constraint when (see § 4.1). Starting from Eq. (17), we have
where in the second line we used normalized variables and , in the third line we approximated with its second-order expression around (Eq. (49)) and , which is valid if is large since then the most important contribution of the integral comes from a neighborhood around , and finally, we performed the integration in the last line. This yields the approximation
which is analogous to Eq. (19) for the conic filter case except for a correction factor , which is close to unity in the typical case since . Note that a similar asymptotic analysis could have been used to derive the expression for for the conic filter case in Eq. (19); it can be shown that this expression does not include a correction factor for , as seen from Eqs. (30) and (31)—this explains why, in the conic filter case, the threshold is insensitive to the target lengthscale .
As discussed in § 4.2, we have found that the decay rate works well in our numerical examples, which is similar to the value suggested in Yang et al. (2019). This choice—and the estimates and made in § 4.1—leads to according to Eq. (55).
Derivations: bi-PDE filters
As discussed in § 4.2, employing the PDE filter results in a filtered density that exhibits large spatial derivatives —caused by the singular PDE Green’s function—and this poses challenges to the geometric constraints as well as to robust optimization [15]. It is desirable to have a PDE filtering scheme that alleviates these issues; this requires a higher-order and rotationally symmetric PDE with a well-behaved Green’s function. Analytically, our proposed “bi-PDE” filtering scheme consists of obtaining the filtered density by solving the following fourth-order PDE:
This is the composition of two modified Helmholtz PDEs, where plays a similar role as the conic filter radius and is a dimensionless parameter used to adjust the spread of the Green’s function. Its Green’s function is given by Lazar et al. (2006):
where is the modified Bessel function of the second kind of order one. We note that it is more regular than the Green’s function of the PDE filter (Eq. (38)): it is finite at the origin—indeed, in the 2D case—and all its derivatives are bounded; thus, the spatial derivatives of are bounded as well. (As discussed in § 4.2, the convolution of two singular PDE Green’s functions leads to the smoother bi-PDE Green’s function.) We show a comparison between the conic, PDE and bi-PDE filters in Figure C3. The bi-PDE filter is the double application of the PDE filter of Sec. B with a different scaling. As such, in practice, the user may reuse existing PDE solver code by first solving
Figure C3. Comparison of the conic filter (Eq. (3)), the PDE filter (Eq. (38)), and the bi-PDE filter (Eq. (57)), as functions of radial distance , for and dimensions one and two. The 2D PDE filter exhibits a logarithmic singularity at the origin.
and then
where is an intermediate variable. In all of our examples we employed the value where
which we obtained numerically by minimizing the error over between the 2D Green’s function of Eq. (57) and the 2D conic filter of Eq. (3).
We now proceed to derive the thresholds and , and the geometric constraint threshold , as done in Sec. B. We consider the simplified 1D setting presented in § 4.1 and Figure 1a, in which the latent density is a 1D binary bump of width , , which is filtered using the 1D Green’s function of Eq. (57), resulting in the filtered field:
where we are using normalized units and . The projected density is computed as a Heaviside projection (), this is , resulting in a binary bump with width , . There is no closed-form expression for the (normalized) latent width as a function of the physical width —it can only be obtained numerically. We have found, however, that the equation for of the PDE filter (Eq. (43)) plus a Gaussian correction term is a good approximation when :
for and , where and , which we fitted numerically. This approximation has a maximum absolute error of over the range , compared to an exact numerical computation.
To compute the thresholds and and the correction factor , we expand to second order around :
hence,
Then,
and , where is the target lengthscale and is approximated with Eq. (60) for the case from Eq. (58). For the typical case we have and , which are similar to the conic filter case values. In Figure C2 we show a comparison between of the conic, PDE, and bi-PDE filters.
Following the same derivation of Sec. B, the asymptotic expression for the geometric constraint threshold is given in Eq. (55), with the correction factor given in Eq. (65). In all our numerical examples we employ the decay rate , the same as in the conic filter case, and the approximation , obtained with the asymptotic approximation of and the estimates and made in § 4.1.
Optimization details
In our examples of § 6, in the unconstrained optimization stage, we employed the CCSAQ algorithm to optimize the unconstrained designs. All examples in the same TO challenge (e.g., mode converter) share the same randomly initialized starting design. The filter radius was set equal to the target lengthscale of each example (). In tables D1 and D2, we show the -scheduling that we used during the unconstrained optimization for each TO challenge—which includes the number of epochs, number of iterations per epoch, and projection steepness parameter used in each epoch. For the cavity example of § 6.4, we employed 25 epochs—each with 10 iterations, with a starting that is multiplied by 1.2 in each epoch—and a final 26th epoch of 20 iterations with . Importantly, in the optimizer settings we set a relative tolerance of , which causes some examples to terminate their unconstrained optimization early, before reaching the prescribed number of iterations indicated in this section.
Supplementary Information
This work includes supplementary material.
Declarations
Conflict of interest
The authors declare that they have no conflict of interest.
Funding
This work was supported in part by the U.S. Army Research Office through the Institute for Soldier Nanotechnologies (Award No. W911NF-23-2-0121) and by the Simons Foundation through the Simons Collaboration on Extreme Wave Phenomena Based on Symmetries.
Ethics approval
The authors declare that there are no ethical issues involved in this research.
Consent to participate
The authors declare that they all consented to participate in this research.
Data availability
All data are included in the article and its supplementary materials.
Replication of results
Detailed descriptions of the simulations and computational methods are included to ensure reproducibility. The differentiable thermal solver employed in the heat-transfer example is planned for public release in the near future.
Author Contributions
Computational simulations and derivations were carried out by Rodrigo Arrieta. Giuseppe Romano was responsible for the numerical simulation of the heat-transfer example. Steven G. Johnson supervised the research. Rodrigo Arrieta prepared the initial draft of the manuscript. All authors contributed to manuscript revision and approved the final version.
References
Table D1 Continuation scheme of used in the unconstrained optimization stage, for the mode converter § 6.1, wavelength demultiplexer § 6.3, and heat-transfer problem § 6.5 examples.
| Example | Parameter | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Mode converter | 8 | 16 | 30 | ||||||
| No. of iter. | 20 | 20 | 20 | 100 | |||||
| Wavelength demultiplexer | 4 | 8 | 16 | 30 | 60 | 90 | |||
| No. of iter. | 25 | 25 | 25 | 25 | 50 | 50 | 100 | ||
| Heat-transfer problem | 8 | 16 | 32 | 64 | |||||
| No. of iter. | 30 | 30 | 30 | 30 |
Table D1. Continuation scheme of used in the unconstrained optimization stage, for the mode converter (Sec. 6.1), wavelength demultiplexer (Sec. 6.3), and heat-transfer problem (Sec. 6.5) examples.
Table D2 Continuation scheme of used in the unconstrained optimization stage, for the beam splitter example § 6.2.
| Beam splitter example | Parameter | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Default | 8 | 16 | 30 | 60 | |||||
| No. of iter. | 20 | 20 | 20 | 20 | 100 | ||||
| Conic and PDE filters, large lengthscale (16 pix.) | 8 | 16 | 30 | 60 | 120 | 240 | |||
| No. of iter. | 20 | 20 | 20 | 30 | 30 | 30 | 50 | ||
| PDE filter, medium lengthscale (8 pix.) | 8 | 16 | 30 | 60 | |||||
| No. of iter. | 20 | 20 | 20 | 20 | 200 | ||||
| Bi-PDE filter, large lengthscale (16 pix.) | 8 | 16 | 30 | 60 | 120 | 240 | |||
| No. of iter. | 20 | 20 | 30 | 50 | 50 | 50 | 200 |
Table D2. Continuation scheme of used in the unconstrained optimization stage, for the beam splitter example (Sec. 6.2).
References
- [1]Martinez de Aguirre Jokisch B, Christiansen RE, Sigmund O (2024a) Topology optimization framework for designing efficient thermo-optical phase shifters. J Opt Soc Am B 41(2):A18–A31. https://doi.org/10.1364/JOSAB.499979
- [4]Andkjær J, Johansen VE, Friis KS, Sigmund O (2014) Inverse design of nanostructured surfaces for color effects. JOSA B 31(1):164–174. https://doi.org/10.1364/JOSAB.31.000164, publisher: Optica Publishing Group
- [5]Bendsøe MP (1989) Optimal shape design as a material distribution problem. Structural optimization 1(4):193–202. https://doi.org/10.1007/BF01650949
- [6]Bendsøe MP, Kikuchi N (1988) Generating optimal topologies in structural design using a homogenization method. Computer Methods in Applied Mechanics and Engineering 71(2):197–224. https://doi.org/10.1016/0045-7825(88)90086-2
- [7]Bertsekas D (2016) Nonlinear programming. Athena Scientific
- [8]Bourdin B (2001) Filters in topology optimization. International Journal for Numerical Methods in Engineering 50(9):2143–2158. https://doi.org/10.1002/nme.116
- [9]Bruns TE, Tortorelli DA (2001) Topology optimization of non-linear elastic structures and compliant mechanisms. Computer Methods in Applied Mechanics and Engineering 190(26):3443–3459. https: //doi.org/10.1016/S0045-7825(00)00278-4
- [10]Byrd RH, Nocedal J, Waltz RA (2006) Knitro: An Integrated Package for Nonlinear Optimization, Springer US, Boston, MA, pp 35–59. https://doi.org/10.1007/0-387-30065-1_4
- [11]Carstensen JV, Guest JK (2018) Projection-based two-phase minimum and maximum length scale control in topology optimization. Structural and Multidisciplinary Optimization 58(5):1845–1860. https://doi.org/10.1007/s00158-018-2066-4
- [12]Chen M, Christiansen RE, Fan JA, Işıklar G, Jiang J, Johnson SG, Ma W, Miller OD, Oskooi A, Schubert MF, Wang F, Williamson IAD, Xue W, Zhou Y (2024) Validation and characterization of algorithms and software for photonics inverse design. Journal of the Optical Society of America B 41(2):A161. https://doi.org/10.1364/JOSAB.506412
- [13]Chen M, Chan KF, Hammond AM, Chan CH, Johnson SG (2025) Inverse design of 3d-printable metalenses with complementary dispersion for terahertz imaging. ACS Photonics https://doi.org/10.1021/acsphotonics.5c00366
- [14]Christiansen RE (2023) Inverse design of optical mode converters by topology optimization: tutorial. Journal of Optics 25(8):083501. https://doi.org/10.1088/2040-8986/accbdbd
- [15]Christiansen RE, Lazarov BS, Jensen JS, Sigmund O (2015) Creating geometrically robust designs for highly sensitive problems using topology optimization. Structural and Multidisciplinary Optimization 52(4):737–754. https://doi.org/10.1007/s00158-015-1265-5
- [16]Christiansen RE, Vester-Petersen J, Madsen SP, Sigmund O (2019) A non-linear material interpolation for design of metallic nano-particles using topology optimization. Computer Methods in Applied Mechanics and Engineering 343:23–39. https://doi.org/10.1016/j.cma.2018.08.034








