|
Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
|
This example demonstrates a simple test case for the Method of Moving Asymptotes (MMA) as implemented in NEKO-TOP. The problem is a 1D cantilever beam, discretized into multiple elements, where the design variable is the beam height h at each element. The objective is to maximize stiffness (minimize tip deflection) while minimizing beam weight and enforcing stress constraints. The number of design variables (1D beam elements) matches the number of Gauss–Lobatto–Legendre (GLL) points in the 3D spectral element mesh provided in the box.nmsh file from the examples repository. This creates a one-to-one mapping between the GLL points in the spectral element mesh and the 1D beam elements. This setup allows to use the Neko’s mesh partitioning for parallel execution: when running on multiple MPI nodes, Neko distributes the GLL points across nodes, which directly translates to distributing the 1D beam elements in the parallel system.
In the driver.f90 file, the beam is divided into n elements, each of length $L_e$. The design variable is the height $h(k)$ of element $k$.
Note: Each element has one design variable, corresponding to its height.
L = 2.0 m and width b = 0.02 m.ρ = 7800 kg/m³, Young’s modulus E = 210 GPa.P = 1000 N.h ∈ [h_min = 0.005 m, h_max = 0.05 m]. Moment of inertia (the beam is assumed to be rectangular with depth b and hight h): \[ I(k) = \frac{b \cdot h(k)^3}{12} \]
u_tip_max = 0.25 m).σ ≤ σ_max = 250 MPa.The optimization variable \( x(k) \) is normalized between 0 and 1. The physical element height \( h(k) \) is obtained by linear projection:
\[ h(k) = h_{\min} + x(k) \cdot (h_{\max} - h_{\min}) \]
For a cantilever beam under a point load \( P \) at the free end, the tip deflection \( u_\text{tip} \) is computed analytically as:
\[ u_\text{tip} = \sum_{k=1}^{n} \frac{\Delta_k}{E \cdot I(k)} \]
with
\[ \Delta_k = \frac{(L_\text{total} - x_{k-1})^3 - (L_\text{total} - x_k)^3}{3} \]
and
\[ x_k = k \cdot L_e \]
where \( x_k \) is the end coordinate of element k.
The sensitivity of the tip deflection with respect to the element height \( h(k) \) is computed analytically as:
\[ \frac{\partial J}{\partial h(k)} = - \frac{\Delta_k \cdot 3 b h(k)^2}{12 \cdot E \cdot I(k)^2} = - \frac{\Delta_k \cdot 3}{E \cdot b \cdot h(k)^4} \]
In terms of the normalized variable \( x(k) \):
\[ \frac{\partial J}{\partial x(k)} = \frac{\partial J}{\partial h(k)} \cdot (h_{\max} - h_{\min}) \]
The stress constraint ensures that the maximum bending stress in each element does not exceed the allowable limit:
\[ \sigma_e = \frac{M_e \cdot c_e}{I_e} \leq \sigma_\text{max}(k) \]
where:
eThe constraint function used in MMA is:
\[ g_\sigma(k) = \frac{\sigma_e}{\sigma_\text{max}(k)} - 1 \leq 0 \]
The sensitivity of the stress constraint with respect to the element height \( h(k) \) is:
\[ \frac{\partial g_\sigma}{\partial h(k)} = \frac{\partial}{\partial h(k)} \left( \frac{M_e \cdot c_e}{I_e \cdot \sigma_\text{max}(k)} - 1 \right) = \frac{M_e}{\sigma_\text{max}(k)} \left( \frac{1}{2 I_e} - \frac{c_e \cdot 3 b h(k)^2 / 12}{I_e^2} \right) \]
In terms of the normalized variable \( x(k) \):
\[ \frac{\partial g_\sigma}{\partial x(k)} = \frac{\partial g_\sigma}{\partial h(k)} \cdot (h_{\max} - h_{\min}) \]
Minimize:
\[ f(\mathbf{x}) = w_1 \cdot \frac{u_{\text{tip}}(\mathbf{x})}{u_{\text{tip}}^{\max}} + w_2 \cdot \frac{m(\mathbf{x})}{m_{\max}} \]
Subject to:
\[ g_j(\mathbf{x}) = \frac{\sigma_j(\mathbf{x})}{\sigma_{\max}} - 1 \le 0, \quad j = 1, \dots, N_\text{constraints} \]
\[ 0 \le x_i \le 1, \quad i = 1, \dots, N_\text{elements} \]
Where:
j-th constraint location.driver.f90 using num_constraints = 10 as default.driver.f90 using call deflectioninit_from_components("tip_deflection", des, 1.0_rp) and call beamweightinit_from_components("beamweight", des, 1.0_rp) with 1.0_rp as the default weight for both objectives.example_problem.f90: driver.f90 file: num_constraint_partitions sections, and then the num_constraints constraints are distributed evenly across the first elements of each section.