CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2 > SU2 Shape Design

KeyError for OPT_OBJECTIVE option

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Nicoruiz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 10, 2020, 12:45
Default KeyError for OPT_OBJECTIVE option
  #1
New Member
 
Nicolas
Join Date: Mar 2020
Posts: 1
Rep Power: 0
Nicoruiz is on a distinguished road
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)
CONV_NUM_METHOD_ADJFLOW= ROE
%
% Monotonic Upwind Scheme for Conservation Laws (TVD) in the adjoint flow equations.
%           Required for 2nd order upwind schemes (NO, YES)
MUSCL_ADJFLOW= YES
%
% Slope limiter (NONE, VENKATAKRISHNAN, BARTH_JESPERSEN, VAN_ALBADA_EDGE,
%                SHARP_EDGES, WALL_DISTANCE)
SLOPE_LIMITER_ADJFLOW= NONE
%
% 2nd, and 4th order artificial dissipation coefficients
ADJ_JST_SENSOR_COEFF= ( 0.5, 0.02 )
%
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT)
TIME_DISCRE_ADJFLOW= EULER_IMPLICIT
%
% Relaxation coefficient
RELAXATION_FACTOR_ADJFLOW= 1.0
%
% Reduction factor of the CFL coefficient in the adjoint problem
CFL_REDUCTION_ADJFLOW= 0.8
%
% Limit value for the adjoint variable
LIMIT_ADJFLOW= 1E15
%
% Multigrid adjoint problem (NO, YES)
MG_ADJFLOW= NO
%
% 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.
OPT_GRADIENT_FACTOR= 1E-5
%
% 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
File Type: txt flow.txt (30.4 KB, 12 views)
aman_baig likes this.
Nicoruiz is offline   Reply With Quote

Old   March 20, 2020, 19:49
Default
  #2
New Member
 
Aman uz zaman Baig
Join Date: Nov 2015
Location: Cincinnati, US
Posts: 16
Rep Power: 10
aman_baig is on a distinguished road
I have an issue open on GitHub for the same reason. I am looking into it currently.
https://github.com/su2code/SU2/issues/889
aman_baig is offline   Reply With Quote

Old   April 21, 2020, 09:43
Default
  #3
New Member
 
MG
Join Date: Apr 2020
Posts: 1
Rep Power: 0
oklf is on a distinguished road
Hi,
I had the same problem, and I finally found what the issue was. See here.
oklf is offline   Reply With Quote

Old   March 4, 2021, 14:53
Default
  #4
Member
 
Umut Can
Join Date: Oct 2012
Posts: 42
Rep Power: 13
Umuteng is on a distinguished road
Were u able to solve?.I am having same problem for SURFACE_TOTAL_PRESSURE, could not solve it yet.
Umuteng is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Compression stoke is giving higher pressure than calculated nickjuana CFX 62 May 19, 2015 13:32
Low Mixing time Problem Mavier CFX 5 April 29, 2013 00:00
Constant velocity of the material Sas CFX 15 July 13, 2010 08:56
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 12:02


All times are GMT -4. The time now is 13:19.