Hi All, I am using gridap for topology optimization. I have defined function of optimization using MMA as below

```
using NLopt
function gf_p_optimize(p_init; r, β, η, TOL = 1e-4, fem_params)
##################### Optimize #################
opt = Opt(:LD_MMA, fem_params.np)
opt.lower_bounds = 0
opt.upper_bounds = 1
opt.ftol_rel = TOL
opt.max_objective = (p0, grad) -> gf_p(p0, grad; r, β, η, fem_params)
inequality_constraint!(opt, (p0, gradc) -> cf_p(p0, gradc; r, β, η, fem_params), 1e-8)
(g_opt, p_opt, ret) = optimize(opt, p_init)
@show numevals = opt.numevals # the number of function evaluations
return g_opt, p_opt
end
```

and i have defined a while loop which do the calculation including forward,backward, and topology optimization but it seems that it just run the optimization function once and do not care about tolerance. I have checked the code without while and it seems that it is working correctly and it take around 68 internal iteration for mma to get result but within the while loop it just do 1 internal iteration for mma.

```
mmax = 230
m=0
p_opt = fill(0.4, fem_params.np) # Initial guess
TOL = 1e-8
while m < mmax
m += 1
#forward solution
#backward solution
#topology optimization
g_opt = 0
g_opt, p_temp_opt = gf_p_optimize(p_opt; r, β, η, TOL, fem_params)
p_opt = p_temp_opt
#umpdate initial value
p0 = p_temp_opt
end
```

can you tell me how can i solve this issue? It also doesn’t work by setting m as 1. it just can do optimization when i delete external while loop.

thank you