Benchmarks
The benchmark bank runs HyperShape on fixed problems with every method that applies and reports every run in one fixed table, so that methods, discretisations and versions can be compared on the same footing. It lives in the folder validation/ of the repository, outside the package: the cases are scripts written with the public API, and the shared helpers (validation/common/) are scripts included by them, not part of HyperShape. The Validation page discusses each case against its reference; this page describes the bank, its table and the rule for comparing methods, and collects the tables of the cases that exist today.
Running the bank
julia --project=validation -e 'using Pkg; Pkg.instantiate()'
julia --project=validation -t 4 validation/run_all.jl # every case, about 51 min
julia --project=validation -t 4 validation/run_all.jl mbb_top88 bridge_takezawa # some of themrun_all.jl runs each case script in its own Julia process (with the threads of the calling one), keeps its output in results/<case>.log and joins the tables of the cases into results/report.csv and results/report.md. Each script can also be run alone (julia --project=validation -t 4 validation/<case>.jl); it prints its own table and then writes its rows of the fixed table to results/<case>.csv and results/<case>.md. The folder is validation/results (not versioned) or ENV["HYPERSHAPE_RESULTS"]. A case fails when its script stops with an error or one of its checks does not hold (the script exits with code 1); run_all.jl reports it, still runs the others and exits with code 1. Times are measured after runs on small meshes that compile every variant of the case, with the machine free (one run at a time, load average checked before); the tables carry the machine, the threads, the Julia version and the commit (+dirty when the tree had changes).
The table
One row per run. A reference (a port of another code, a code run in Octave, a published value) has its own row, first, with the measures of its design when its design is available, and "–" for what it does not have.
| column | meaning |
|---|---|
| case, variant | the problem and its mesh; the design variables, the method and the options that are not the defaults |
| J | the objective of the method on its final design (result.objective; the cases use scale = 1.0) |
| J_bin | the objective of the final design read as 0/1 per cell, with the same mesh, loads and supports and the material law E = Emin + (1 − Emin) χ (plain Gridap, binary_evaluator): solid where the cell mean of the physical field is at least ½, or, in the comparisons between methods and between meshes (the MBB beam with every method, the mesh study, Kim et al.), solid on the cells with the largest cell means up to the target volume (volume_threshold: the threshold ½ gives each method a different volume) |
| ref, vs ref | the reference value of the case and the deviation from it, with the column it is compared with (J or J_bin) |
| V | the volume fraction that the constraint sees (vf · (1 + g), from the history of the constraint volume, a Volume(…; max_fraction = vf) with its default scale) |
| V_bin | the fraction of solid cells of the 0/1 design (the target volume when the volume is kept; the short tables give the fraction with the threshold ½ too) |
| grey | Sigmund's measure of grey of the cell means, mean of 4χ(1 − χ) (0 for a 0/1 design; with a level set and Ersatz() it only sees the cut cells) |
| perimeter | of the 0/1 design, in domain units: the interior faces between a solid and a void cell times their length (an area in 3D). A staircase measure: comparable between methods on the same mesh; under refinement it tends to the ℓ¹ length of the boundary, not to the Euclidean one |
| holes | interior holes of the 0/1 design: connected components (by faces) of void cells that do not touch the boundary of the domain; in 3D, closed cavities. In the older cases specks of one or two grey cells count as holes; in the MBB beam with every method and the mesh study a hole counts when its area is at least π(rmin/2)² (the same physical size on every mesh) |
| iterations | accepted iterations, with the status and the reason of the stop |
| solves | solves of the state, of the adjoint, of the filter (forward and transpose) and of the method's own step, summed over the history (forward/adjoint/filter/step_solves): the step of reaction–diffusion solves with its diffusion operator (one per iteration, one per implicit substep of the double well, none with the explicit scheme); a density method has none (0) |
| time | seconds of solve!, without compilation |
| time ÷ state solves | the time divided by the number of state solves: the cost of the method per state solve on that mesh and machine, with everything else included (filter, the step of reaction–diffusion, the evaluations of the volume, monitors such as the binary compliance of levelset88). It is not the time of one solve: the solves column counts each kind, the time of each kind is not measured |
Comparing designs
The objective that a method optimises is not comparable between methods: SIMP with a filter keeps grey material, a level set with Ersatz() has cut cells, a density of reaction–diffusion has a diffuse interface. The common measure is J_bin, the same problem evaluated with the design read as 0/1 per cell. The tolerances of the bank are:
- against another code with the same discretisation and formulation (a published value of it, a port or a reference driver): J within 1 %. Cases: the MBB with the cell mean and OC as top88 against Fig. 4 of Andreassen et al. (2011), the PDE filter (+0.00 %); SiMPL with the sensitivity of the authors' code against their tables 1 and 2 (+0.00 %); the volume-to-point problem with the cell mean and OC as top88 against the reference driver in Octave (−0.0002 %);
- against a published value obtained with another discretisation or formulation: J within 5 % (SiMPL with the exact sensitivity and OC: −0.40 % to −0.99 %). The bridge of Takezawa et al. uses 3 %, the tolerance decided for the double well (the default reproduces 23.3 within 2.6 %);
- between methods of HyperShape on the same mesh, and against another code or method run on the same mesh (top88.m with its convolution density filter,
ft = 2, against the Helmholtz filter withr = rmin/(2√3); levelset88):J_binwithin 5 %. On the MBB beam with every method the reference is the run of density SiMPL with a P0 design (the method whose published values the bank reproduces; one run rather than the median, so that adding a method does not move the reference). Between density and reaction–diffusion methods this rule is a sanity check, not a comparison of optima: their regularisations (the filter radiusrminagainst the diffusionτ) are different and not calibrated against each other, so the methods solve different regularised problems (the level set withτ = 2e-4is allowed more perimeter and ends with more members). The tables give the perimeter of the 0/1 design next to J andJ_bin; - under refinement, with the lengths (filter radius, τ), loads and volume in domain units on h, h/2 and h/4, every design read as 0/1 keeping the volume and evaluated on the common finest mesh h/4 (exact prolongation: the meshes are nested), so that the difference is that of the designs and not that of the discretisation of the state: between h/2 and h/4,
J_binwithin 1 %, the same number of holes (of a physical minimum area) and the iterations within ± 25 %. The fraction of cells that change phase is given with it.
Each script checks its own rule and exits with code 1 when it does not hold (the 3D cantilever and the mesh study of the double well have no reference value: their checks are consistency, symmetry, convergence and volume, and J in the measured intervals). The mesh study records the outcome of its rule for each method as a result (the reaction–diffusion level set does not meet it, see the mesh study) and exits with code 1 only when an outcome changes.
J_bin is the objective of the problem evaluated on the 0/1 design, whatever it is: the compliance, the thermal compliance, or the mean displacement of the output port of the inverter (negative, minimised: the sign is kept and the deviations are relative to the reference, so +1 % is a mechanism 1 % better). In conduction with a high contrast J_bin of a sharp-interface design is sensitive to the mesh where the whole flux goes through a narrow neck (the sink of the trident H3): half a cut cell of conductor more or less there changes J by a few percent.
The void stiffness Emin is that of each reference where there is one (1e-9 for top88 and for Kim et al., whose 1e-3 Pa is 5e-15 of their E₀; 1e-6 for SiMPL; 1e-4 for levelset88; 1e-5 for the double well); the benchmarks with physical parameters use 1e-3, a void at which the six methods, the level set with Ersatz() included, behave well; the volume-to-point problem has a second conductor, k0 = 1e-2, a parameter of the problem. J_bin depends on it (the void carries a little load), so values are compared within a table only.
Cases
The cases that exist today, with their rows of the fixed table and their figures, by family:
- Compliance: the MBB beam against top88 (Andreassen et al. 2011), against SiMPL and against Kim et al. (2020); the 3D cantilever; the bridge of Takezawa et al. (2010) and the cantilever with the double well; the cantilever of levelset88; the MBB beam with every method.
- Mesh study: the MBB beam, the cantilever and the heat problem H0 on h, h/2 and h/4.
- Unstructured meshes: the MBB beam of the mesh study on Delaunay triangles of Gmsh and their red refinements beside the Cartesian runs of the same levels (an informative example: a table and figures).
- Compliant mechanisms: the force inverter with every method.
- Heat conduction: a flux on the boundary (H0 of GridapTopOpt and the trident H3) and the volume-to-point problem (Bejan 1997) against a reference driver in Octave.
The discussion of each case against its reference is on the Validation page. The SVG figures of the designs beside their reference (mbb_top88_<mesh>.svg, otomori_levelset88.svg, mbb_methods.svg, mbb_kim2020.svg, mesh_study_<problem>.svg, mbb_unstructured.svg, mbb_unstructured_mesh.svg, inverter.svg, inverter_mesh.svg, heat_flux.svg, heat_trident.svg, heat_vtp.svg, heat_vtp_mesh.svg) are written to the results folder.