pymoto.DensityFilter
- class pymoto.DensityFilter(*args, nonpadding=None, **kwargs)
Standard density filter for a structured mesh in topology optimization
The filtered densities are calculated as
\(y_i = \sum_j \frac{H_{ij}}{s_i}x_j\),
where \(H_{ij}=\max \left( r - \sqrt{ (x_j - x_i)^2 + (y_j - y_i)^2 + (z_j - z_i)^2 } , 0 \right)\),
and \(s_i=\sum_j H_{ij}\).
- Input Signal:
x: The unfiltered field \(\mathbf{x}\)
- Output Signal:
y: Filtered field \(\mathbf{y}\)
- Parameters:
domain (
pymoto.VoxelDomain) – The finite element domain- Keyword Arguments:
radius (float or int) – The filtering radius (in absolute units of elements)
nonpadding (numpy.array[int]) – An array with indices at places where \(s_i = \max(\mathbf{s}) \: \forall\: i \notin \mathcal{N}\). For a density filter this mimics having values of
0outside of the domain, thus emulating padding of the boundaries.
References
Bruns & Tortorelli (2001). Topology optimization of non-linear elastic structures and compliant mechanisms. Computer Methods in Applied Mechanics and Engineering, 190(26–27), 3443–3459. doi: 10.1016/S0045-7825(00)00278-4
Bourdain (2001). Filters in topology optimization. International Journal for Numerical Methods in Engineering, 50, 2143-2158. doi: 10.1002/nme.116
- __init__(*args, nonpadding=None, **kwargs)
Initialize abstract base-class for linear filters
- Parameters:
nonpadding (numpy.array[int], optional) – An array with indices at places where \(s_i = \max(\mathbf{s}) \: \forall\: i \notin \mathcal{N}\). For a density filter this mimics having values of 0 outside of the domain, thus emulating padding of the boundaries.
Methods
__init__(*args[, nonpadding])Initialize abstract base-class for linear filters
connect(sig_in[, sig_out])Connect without automatic adding to a function network
get_input_sensitivities([as_list])get_input_states([as_list])get_output_sensitivities([as_list])get_output_states([as_list])reset()Reset the state of the sensitivities (they are set to zero or to None)
response()Calculate the response from sig_in and output this to sig_out
Calculate sensitivities using backpropagation
Attributes
Get the number of input signals
Get the number of output signals
- connect(sig_in: Signal | Iterable[Signal], sig_out: Signal | Iterable[Signal] = None)
Connect without automatic adding to a function network
- get_input_sensitivities(as_list=False)
- get_input_states(as_list=False)
- get_output_sensitivities(as_list=False)
- get_output_states(as_list=False)
- property n_in: int
Get the number of input signals
- property n_out: int
Get the number of output signals
Note: Cannot be used in the initial __call__()
- reset()
Reset the state of the sensitivities (they are set to zero or to None)
- response()
Calculate the response from sig_in and output this to sig_out
- sensitivity()
Calculate sensitivities using backpropagation
Based on the sensitivity we get from sig_out, reverse the process and output the new sensitivities to sig_in
- sig_in: List = None
- sig_out: List = None