Magneto-Elastic Topology Optimization
Overview
Magnetostrictive and magneto-active devices couple mechanics to a magnetic field. MagnetoElasticTopOpt minimizes the compliance of the coupled (u, ψ) system — elastic displacement plus magnetic scalar potential — so the optimized layout balances structural stiffness against magnetic flux. The coupling is set by the magnetostrictive matrix dm, with the material supplying the permeability.
using RasmahA magnetically-loaded cantilever
Clamp a bar, pull on the free end, and ground the magnetic potential at two nodes while the optimizer distributes the material.
E, ν = 1e3, 0.3
m = tetrahedralize_box(2.0, 0.5, 0.5, 8, 2, 2)
nn = size(m.nodes, 2)
fixed_u = Int[]
for i in 1:nn
m.nodes[1, i] ≈ 0.0 && append!(fixed_u, 3i - 2, 3i - 1, 3i)
end
loadnodes = [i for i in 1:nn if m.nodes[1, i] ≈ 2.0]
loads_u = zeros(3nn)
for i in loadnodes
loads_u[3i - 2] = 1.0 / length(loadnodes)
end
fixed_ψ = [1, nn ÷ 2]
gψ = zeros(2)
dm = zeros(3, 6); dm[3, 3] = 1e-9
x, hist = solve(MagnetoElasticTopOpt(), m, Material(youngs_modulus = E, poisson_ratio = ν, relative_permeability = 2.0);
fixed_u = fixed_u, loads_u = loads_u, fixed_ψ = fixed_ψ, gψ = gψ, dm = dm,
volfrac = 0.5, max_iter = 50)([0.9999979576263449, 0.9999769424183775, 0.001, 0.001, 0.9999769424183775, 0.9999979576263449, 0.9999991490109779, 0.001, 0.001, 0.001 … 0.9999979576263449, 0.9999979576263449, 0.001, 0.001, 0.7659939570076512, 0.9979008531161853, 0.999905134521323, 0.999905134521323, 0.9979008531161853, 0.7659939570076512], [0.06450621986415024, 0.06387562257155552, 0.06326072731336849, 0.06284919292683834, 0.06252380348581812, 0.061715566220100826, 0.06086043248152627, 0.05871027613411038, 0.055114195180603766, 0.04935148004369837 … 0.017888860666341454, 0.01808091753949092, 0.018341331557333175, 0.01867480004361572, 0.01897288504547333, 0.019110974090108382, 0.019234606226707987, 0.019375729638505784, 0.019530971534062472, 0.019690668193994423])
Verification — compliance drops
The coupled compliance must fall and the volume constraint be met:
println("compliance: ", round(hist[1]; digits = 3), " → ", round(hist[end]; digits = 3))
println("decreases: ", hist[end] < hist[1])
println("volume fraction ≈ 0.5: ", round(sum(x) / length(x); digits = 3))compliance: 0.065 → 0.02
decreases: true
volume fraction ≈ 0.5: 0.461
vtk(m; field = x, fieldname = "density (magneto-elastic)", edges = true)Next steps
- Magnetostatics — the magnetic forward solve.
- Electrostatics actuator — the electrostatic twin.
