topoptlab.output_designs module
- topoptlab.output_designs.export_stl(filename: str, nelx: int, nely: int, xPhys: ndarray, volfrac: float) None[source]
Export design to a stl file for 3D printing.
- Parameters:
filename (str) – filename without “.vtk” ending.
nelx (int) – number of elements in x direction.
nely (int) – number of elements in y direction.
xPhys (np.ndarray) – densities used to scale the material properties.
volfrac (float, optional) – volume fraction. If not None, then also a thresholded designed is stored. The default is None.
- Return type:
None.
- topoptlab.output_designs.export_vtk(filename: str, nelx: int, nely: int, xPhys: ndarray, nelz: None | int, x: None | ndarray = None, u: None | ndarray = None, f: None | ndarray = None, u_bw: None | ndarray = None, f_bw: None | ndarray = None, xTilde: None | ndarray = None, elem_size: None | float | ndarray = None, volfrac: None | float = None, stress_vm: None | float | ndarray = None, vectors: None | ndarray = None) None[source]
Export design to a vtk file for visualisation e. g. with Paraview.
- Parameters:
filename (str) – filename without “.vtk” ending.
nelx (int) – number of elements in x direction.
nely (int) – number of elements in y direction.
xPhys (np.ndarray) – densities used to scale the material properties.
nelz (int) – number of elements in z direction.
x (np.ndarray, optional) – interemdiary densities as (usually) returned by the optimizer.
u (np.ndarray, optional) – field variable (displacements, temperature) which is usually the left hand side of the generic matrix problem Ku=f. The default is None.
f (np.ndarray, optional) – flow variable (forces, heat sources/sinks) which is usually the right hand side of the generic matrix problem Ku=f
u_bw (np.ndarray, optional) – field variable of the final black/white design. The default is None.
f_bw (np.ndarray, optional) – flow variable of the final black/white design. The default is None.
xTilde (np.ndarray, optional) – interemdiary densities by the density filter. So far they only occur if Haeviside projections are used. The default is None.
elem_size (np.ndarray, float) – element size.
volfrac (float, optional) – volume fraction. If not None, then also a thresholded designed is stored. The default is None.
stress_vm (np.ndarray, optional) – von Mises stress.
vectors (np.ndarray) – vectors [cos(theta)cos(phi); sin(theta)cos(phi); -sin(phi)] used to show the orientation arrow field in Paraview.
- Return type:
None.
- topoptlab.output_designs.threshold(xPhys: ndarray, volfrac: float) ndarray[source]
Threshold grey scale design to black and white design.
- Parameters:
xPhys (np.array, shape (nel)) – element densities for topology optimization used for scaling the material properties.
volfrac (float) – volume fraction.
- Returns:
xPhys – thresholded element densities for topology optimization used for scaling the material properties.
- Return type:
np.array, shape (nel)