# Problem setting up constrained optimization

 Register Blogs Members List Search Today's Posts Mark Forums Read

July 5, 2021, 04:22
Problem setting up constrained optimization
#1
New Member

Join Date: Dec 2019
Posts: 2
Rep Power: 0
Hi,

I have trouble defining an optimization problem. The idea is to maximize the heat transfer on a surface while minimizing the pressure at the inlet.

I tried to setup a constraint in this way:

Code:
```MARKER_MONITORING = ( INFLOW, TRANSITION )
MARKER_ANALYZE = ( INFLOW )

OBJECTIVE_FUNCTION= TOTAL_HEATFLUX
OBJECTIVE_WEIGHT = -1.0

OPT_OBJECTIVE=  TOTAL_HEATFLUX*-1
OPT_CONSTRAINT= (  SURFACE_STATIC_PRESSURE < 720 ) * 0.015```
The optimization runs and the first deformation is correct: I can improve the objective (heat flux increases) and the pressure is still below the constraint. The following iteration, however, the deformation is much less than the 1st one, basically the same geometry as the original mesh, and then the optimizer stops "successfully".

I am clearly doing something wrong, but I don't understand what.

The design tutorial has this to say about the constraints:

Quote:
 Note that this is only compatible with aerodynamic functions, although geometry-based functions can also be included in the OPT_CONSTRAINT setting.
Is the surface pressure an aerodynamic function? Or only lift/drag/pitch are supported?

Also, the parameters OBJECTIVE_FUNCTION and OBJECTIVE_WEIGHT are overwritten when doing the optimization via shape_optimization.py, correct?

I am also trying to do the same optimization using penalty function, which is setup like this:

Code:
`OPT_OBJECTIVE= (SURFACE_STATIC_PRESSURE < 720)*0.1 ; TOTAL_HEATFLUX*-1`
Here I have the opposite problem: the deformation keeps increasing even tough the constraint on the pressure is not met.

Any ideas are welcome!

Last edited by wJhP; July 5, 2021 at 06:04.

 July 9, 2021, 12:33 #2 New Member   Join Date: Dec 2019 Posts: 2 Rep Power: 0 For future reference: the optimization with the penalty function runs correctly when the penalty scaling is negative: Code: `OPT_OBJECTIVE= (SURFACE_STATIC_PRESSURE < 720)*-0.1 ; TOTAL_HEATFLUX*-1`