# KeyError for OPT_OBJECTIVE option

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

March 10, 2020, 13:45
KeyError for OPT_OBJECTIVE option
#1
New Member

Nicolas
Join Date: Mar 2020
Posts: 1
Rep Power: 0
Hi everyone,

I am working on the shape optimization of a cooling channel using SU2 v.7.0.2.
The flow studied is a steady incompressible turbulent water flow.

For the optimization, I use a 3D FFD box for the design variables, and a weigthed sum for the objective function with the options SURFACE_TOTAL_PRESSURE and TOTAL_HEATFLUX.

Code:
```% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------%
%
% Convective numerical method (JST, LAX-FRIEDRICH, ROE)
%
% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations.
%           Required for 2nd order upwind schemes (NO, YES)
%
% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE,
%                SHARP_EDGES, WALL_DISTANCE)
%
% 2nd, and 4th order artificial dissipation coefficients
ADJ_JST_SENSOR_COEFF= ( 0.5, 0.02 )
%
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT)
%
% Relaxation coefficient
%
% Reduction factor of the CFL coefficient in the adjoint problem
%
% Limit value for the adjoint variable
%
% Multigrid adjoint problem (NO, YES)
%
% Objective function in gradient evaluation  (DRAG, LIFT, SIDEFORCE, MOMENT_X, MOMENT_Y, MOMENT_Z, EFFICIENCY, EQUIVALENT_AREA, NEARFIELD_PRESSURE, FORCE_X, FORCE_Y, FORCE_Z, THRUST, TORQUE, FREE_SURFACE, 						      TOTAL_HEATFLUX, MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE,  SURFACE_MASSFLOW)
% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order.
OBJECTIVE_FUNCTION = SURFACE_TOTAL_PRESSURE, TOTAL_HEATFLUX
%
% List of weighting values when using more than one OBJECTIVE_FUNCTION. Separate by commas and match with MARKER_MONITORING.
OBJECTIVE_WEIGHT= 0.5,0.5
%
% Marker(s) of the surface where the functional (Cd, Cl, etc.) will be evaluated
MARKER_MONITORING= (OUTLET, INTERFACE_WJ_HOUSING)
%
% Marker on which to track one-dimensionalized quantities
MARKER_ANALYZE  = (OUTLET)
%
% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX).
MARKER_ANALYZE_AVERAGE = AREA
%
%
%
% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------%
%
% Optimization objective function with scaling factor, separated by semicolons.
% To include quadratic penalty function: use OPT_CONSTRAINT option syntax within the OPT_OBJECTIVE list.
% ex= Objective * Scale
OPT_OBJECTIVE= SURFACE_TOTAL_PRESSURE; TOTAL_HEATFLUX
%
% Use combined objective within gradient evaluation: may reduce cost to compute gradients when using the adjoint formulation.
OPT_COMBINE_OBJECTIVE = YES
%
% Optimization constraint functions with scaling factors, separated by semicolons : ex= (Objective = Value ) * Scale, use '>','<','='
OPT_CONSTRAINT= NONE
%
% Factor to reduce the norm of the gradient (affects the objective function and gradient in the python scripts)
% In general, a norm of the gradient ~1E-6 is desired.
%
% Factor to relax or accelerate the optimizer convergence (affects the line search in SU2_DEF)
% In general, surface deformations of 0.01'' or 0.0001m are desirable
OPT_RELAX_FACTOR= 1E3
%
% Maximum number of iterations
OPT_ITERATIONS= 100
%
% Requested accuracy
OPT_ACCURACY= 1E-10
%
% Upper bound for each design variable
OPT_BOUND_UPPER= 1000
%
% Lower bound for each design variable
OPT_BOUND_LOWER= -1000
%
% Optimization design variables, separated by semicolons
DEFINITION_DV= ( 11, 1.0 | INTERFACE_WJ_HOUSING | BOX, 0, 0, 0, 1.0, 0.0, 0.0 ); ......```
But when I try to run the simulation using shape_optimization.py, I get the following error :
Code:
```Traceback (most recent call last):
File "/app/su2/7.0.2/bin/shape_optimization.py", line 166, in <module>
main()
File "/app/su2/7.0.2/bin/shape_optimization.py", line 98, in main
options.nzones      )
File "/app/su2/7.0.2/bin/shape_optimization.py", line 138, in shape_optimization
project = SU2.opt.Project(config,state)
File "/app/su2/7.0.2/bin/SU2/opt/project.py", line 129, in __init__
group = historyOutFields[this_obj]['GROUP']
KeyError: 'SURFACE_TOTAL_PRESSURE'```

I also have the same error with the files from the tutorial "Shape Design With Multiple Objectives and Penalty Functions" in which OPT_OBJECTIVE=SURFACE_TOTAL_PRESSURE*-1E-4; (DRAG = 0.05)*1E6.

It seems like SURFACE_TOTAL_PRESSURE and TOTAL_HEATFLUX are not defined for OPT_OBJECTIVE, because when I try with DRAG for instance, I don't have this error.

Does anyone have an idea on how to solve this problem ?

You can find my configuration file attached.

Thanks,
Nicolas.
Attached Files
 flow.txt (30.4 KB, 10 views)

 March 20, 2020, 20:49 #2 New Member   Aman uz zaman Baig Join Date: Nov 2015 Location: Cincinnati, US Posts: 16 Rep Power: 9 I have an issue open on GitHub for the same reason. I am looking into it currently. https://github.com/su2code/SU2/issues/889

 April 21, 2020, 10:43 #3 New Member   MG Join Date: Apr 2020 Posts: 1 Rep Power: 0 Hi, I had the same problem, and I finally found what the issue was. See here.

 March 4, 2021, 15:53 #4 Member   Umut Can Join Date: Oct 2012 Posts: 42 Rep Power: 12 Were u able to solve?.I am having same problem for SURFACE_TOTAL_PRESSURE, could not solve it yet.

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Mike_Tom CFX 6 September 29, 2016 02:27 nickjuana CFX 62 May 19, 2015 14:32 Mavier CFX 5 April 29, 2013 01:00 Sas CFX 15 July 13, 2010 09:56 Miguel Baritto CFX 4 August 31, 2006 13:02

All times are GMT -4. The time now is 17:00.

 Contact Us - CFD Online - Privacy Statement - Top