In this tutorial, you will learn how to modify the original 3d topology optimization program(top3d) to solve multiple load cases problem.
In order to solve a multiple load cases problem, as shown below, a few changes need to be made. Initial design

[expand title="Step.1: Define Loading Conditions" expanded="true" tag="h5"]
First, the loading conditions (line 12) are changed correspondingly:

[matlab firstline="12"]
il = [nelx nelx]; jl = [0 nely]; kl = [nelz/2 nelz/2];
[/matlab]

Also the force vector (line 22) and displacement vector (line 23) become more than one column:

[matlab firstline="22"]
F = sparse(loaddof,[1 2],[-1 1],ndof,2);
U = zeros(ndof,2);
[/matlab]

[/expand]

[expand title="Step.2: Define Objective Functions" expanded="true" tag="h5"]
The objective function is now the sum of different load cases

eq

where $latex M$ is the number of load cases.

Then lines 74-76 are substituted with lines

[matlab firstline="74"]
c = 0.;
dc = zeros(nely,nelx,nelz);
for i = 1:size(F,2)
Ue = U(:,i);
ce = reshape(sum((Ue(edofMat)*KE).Ue(edofMat),2),[nely,nelx,nelz]);
c = c + sum(sum(sum((Emin+xPhys.^penal
(E0-Emin)).ce)));
dc = dc - penal
(E0-Emin)*xPhys.^(penal-1).*ce;
end
[/matlab]

[/expand]

[expand title="Step.3: Run program" expanded="true" tag="h5"]
This example is promoted by the line

[matlab light="true"]
top3d(60,60,4,0.4,3.0,1.5)
[/matlab]

You will have similar result like this

Multiple load cases