topoptlab.design_analysis module
- topoptlab.design_analysis.gray_indicator(x: ndarray) ndarray[source]
Gray level indicator to measure discreteness of the designs as in Eq. 41 in
Sigmund, Ole. “Morphology-based black and white filters for topology optimization.” Structural and Multidisciplinary Optimization 33.4 (2007): 401-424.
For a design with all densities at 1/2 returns 1, if all densities either 1 or 0 it returns 0.
- Parameters:
x (np.ndarray shape (n) or shape (n,nmats)) – design variables.
- Returns:
indicator – intermediate density indicator.
- Return type:
np.ndarray of shape () or shape (nmats)
- topoptlab.design_analysis.lengthscale_violations(x: ndarray, r: float, nelx: int, nely: int, nelz: None | int = None) [<class 'numpy.ndarray'>, <class 'numpy.ndarray'>][source]
Visualize length scale violations as suggested in chapter 2.6 of
Sigmund, Ole. “On benchmarking and good scientific practise in topology optimization.” Structural and Multidisciplinary Optimization 65.11 (2022): 315.
Length scale violations are determined by creating a sphere of radius r and performing morphological closing and opening operations. For length scale violations in the void we perform
close(x) - x
while for length scale violation in solid material we do
x - open(x)
- Parameters:
x (np.ndarray shape (n)) – design variables.
r (float) – radius of sphere that determines length scale.
nelx (int) – number of elements in x direction.
nely (int) – number of elements in y direction.
nelz (int or None, optional) – number of elements in z direction. The default is None.
- Returns:
solidviolation (np.ndarray, shape (nely,nelx) or shape (nelz,nely,nelx)) – lengthscale violations in solid phase.
voidviolation (np.ndarray, shape (nely,nelx) or shape (nelz,nely,nelx)) – lengthscale violations in void phase.