You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using su2's single point optimization for a while.
Now, I want to process a multipoint optimization with constraints.
The problem I encountered is that, if I set OPT_CONSTRAINT=NONE or a flow based constraint function(e.g. MULTIPOINT_MOMENT_Z), the optimization goes well.
But if the geometry based constraint is given to OPT_CONSTRAINT(e.g. OPT_CONSTRAINT=( AIRFOIL_THICKNESS>0)*0.001 like single point problem ), the error will occur as below.
The cfg file is based on inv_NACA0012_multipoint.cfg that is from TestCase.
I have no idea what the problem is. I can't find the answer anywhere else.
The error message is as follows:
Traceback (most recent call last):
File "/home/star/su2/bin/shape_optimization.py", line 183, in
main()
File "/home/star/su2/bin/shape_optimization.py", line 92, in main
shape_optimization( options.filename ,
File "/home/star/su2/bin/shape_optimization.py", line 159, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its,accu)
File "/home/star/su2/bin/SU2/opt/scipy_tools.py", line 120, in scipy_slsqp
outputs = fmin_slsqp( x0 = x0 ,
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_slsqp_py.py", line 206, in fmin_slsqp
res = _minimize_slsqp(func, x0, args, jac=fprime, bounds=bounds,
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_slsqp_py.py", line 374, in _minimize_slsqp
sf = _prepare_scalar_function(func, x, jac=jac, args=args, epsilon=eps,
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_optimize.py", line 263, in _prepare_scalar_function
sf = ScalarFunction(fun, x0, args, grad, hess,
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 158, in init
self._update_fun()
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 251, in _update_fun
self._update_fun_impl()
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 155, in update_fun
self.f = fun_wrapped(self.x)
File "/usr/local/python/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py", line 137, in fun_wrapped
fx = fun(np.copy(x), *args)
File "/home/star/su2/bin/SU2/opt/scipy_tools.py", line 383, in obj_f
obj_list = project.obj_f(x)
File "/home/star/su2/bin/SU2/opt/project.py", line 237, in obj_f
return self._eval(konfig, func,dvs)
File "/home/star/su2/bin/SU2/opt/project.py", line 206, in _eval
vals = design._eval(func,*args)
File "/home/star/su2/bin/SU2/eval/design.py", line 147, in _eval
vals = eval_func(*inputs)
File "/home/star/su2/bin/SU2/eval/design.py", line 244, in obj_f
func += su2func(this_obj,config,state) * sign * scale * global_factor
File "/home/star/su2/bin/SU2/eval/functions.py", line 100, in function
multipoint( config, state )
File "/home/star/su2/bin/SU2/eval/functions.py", line 675, in multipoint
func[i+1] = aerodynamics(konfig,ztate)
File "/home/star/su2/bin/SU2/eval/functions.py", line 313, in aerodynamics
funcs[key] = state['FUNCTIONS'][key]
KeyError: 'AIRFOIL_AREA
The cfg file is as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SU2 configuration file %
% Case description: Transonic inviscid optimization of a NACA0012 airfoil %
% Author: Indiana Stokes %
% Institution: %
% Date: 2017.07.03 %
% File Version 7.3.1 "Blackbird" %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
%
% Physical governing equations (EULER, NAVIER_STOKES,
% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY,
% POISSON_EQUATION)
SOLVER= EULER
%
% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT)
MATH_PROBLEM= DIRECT
%
% Restart solution (NO, YES)
RESTART_SOL= YES
%
% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
%
% Mach number (non-dimensional, based on the free-stream values)
MACH_NUMBER= 0.8
%
% Angle of attack (degrees)
AOA= 1.25
%
% Free-stream pressure (101325.0 N/m^2 by default, only Euler flows)
FREESTREAM_PRESSURE= 101325.0
%
% Free-stream temperature (288.15 K by default)
FREESTREAM_TEMPERATURE= 288.15
%
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
%
% Reference origin for moment computation
REF_ORIGIN_MOMENT_X = 0.25
REF_ORIGIN_MOMENT_Y = 0.00
REF_ORIGIN_MOMENT_Z = 0.00
%
% Reference length for pitching, rolling, and yawing non-dimensional moment
REF_LENGTH= 1.0
%
% Reference area for force coefficients (0 implies automatic calculation)
REF_AREA= 1.0
%
% Flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE,
% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE)
REF_DIMENSIONALIZATION= FREESTREAM_PRESS_EQ_ONE
%
% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------%
%
% Marker of the Euler boundary (0 = no marker)
MARKER_EULER= ( airfoil )
%
% Marker of the far field (0 = no marker)
MARKER_FAR= ( farfield )
%
% ------------------------ SURFACES IDENTIFICATION ----------------------------%
%
% Marker of the surface which is going to be plotted or designed
MARKER_PLOTTING= ( airfoil )
%
% Marker of the surface where the functional (Cd, Cl, etc.) will be evaluated
MARKER_MONITORING= ( airfoil )
%
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
%
% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES)
NUM_METHOD_GRAD= GREEN_GAUSS
%
% Courant-Friedrichs-Lewy condition of the finest grid
CFL_NUMBER= 5.0
%
% Adaptive CFL number (NO, YES)
CFL_ADAPT= NO
%
% Parameters of the adaptive CFL number (factor down, factor up, CFL min value,
% CFL max value )
CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 )
%
% Runge-Kutta alpha coefficients
RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 )
%
% Number of total iterations
ITER= 100
%
% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
%
% Linear solver for the implicit (or discrete adjoint) formulation (LU_SGS,
% SYM_GAUSS_SEIDEL, BCGSTAB, GMRES)
LINEAR_SOLVER= FGMRES
%
% Preconditioner of the Krylov linear solver (NONE, JACOBI, LINELET, LUSGS)
LINEAR_SOLVER_PREC= LU_SGS
%
% Min error of the linear solver for the implicit formulation
LINEAR_SOLVER_ERROR= 1E-4
%
% Max number of iterations of the linear solver for the implicit formulation
LINEAR_SOLVER_ITER= 2
%
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
%
% Multi-Grid Levels (0 = no multi-grid)
MGLEVEL= 0
%
% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE)
MGCYCLE= V_CYCLE
%
% Multi-Grid PreSmoothing Level
MG_PRE_SMOOTH= ( 1, 2, 3, 3 )
%
% Multi-Grid PostSmoothing Level
MG_POST_SMOOTH= ( 0, 0, 0, 0 )
%
% Jacobi implicit smoothing of the correction
MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 )
%
% Damping factor for the residual restriction
MG_DAMP_RESTRICTION= 1.0
%
% Damping factor for the correction prolongation
MG_DAMP_PROLONGATION= 1.0
%
% --------------------- FLOW NUMERICAL METHOD DEFINITION ----------------------%
% Convective numerical method (JST, LAX-FRIEDRICH, ROE-1ST_ORDER,
% ROE-2ND_ORDER)
CONV_NUM_METHOD_FLOW= JST
%
% 2nd and 4th order artificial dissipation coefficients
JST_SENSOR_COEFF= ( 0.5, 0.02 )
%
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT)
TIME_DISCRE_FLOW= EULER_IMPLICIT
%
% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------%
% Adjoint problem boundary condition (DRAG, LIFT, SIDEFORCE, MOMENT_X,
% MOMENT_Y, MOMENT_Z, EFFICIENCY,
% EQUIVALENT_AREA, NEARFIELD_PRESSURE,
% FORCE_X, FORCE_Y, FORCE_Z, THRUST,
% TORQUE, FREE_SURFACE)
OBJECTIVE_FUNCTION= DRAG
%
% Convective numerical method (JST, LAX-FRIEDRICH, ROE-1ST_ORDER,
% ROE-2ND_ORDER)
CONV_NUM_METHOD_ADJFLOW= JST
%
% 2nd, and 4th order artificial dissipation coefficients
ADJ_JST_SENSOR_COEFF= ( 0.0, 0.02 )
%
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT)
TIME_DISCRE_ADJFLOW= EULER_IMPLICIT
%
% Reduction factor of the CFL coefficient in the adjoint problem
CFL_REDUCTION_ADJFLOW= 0.8
%
% ----------------------- GEOMETRY EVALUATION PARAMETERS ----------------------%
%
% Marker(s) of the surface where geometrical based function will be evaluated
GEO_MARKER= ( airfoil )
%
% Description of the geometry to be analyzed (AIRFOIL, WING, FUSELAGE)
GEO_DESCRIPTION= AIRFOIL
%
% Geometrical evaluation mode (FUNCTION, GRADIENT)
GEO_MODE= FUNCTION
%
% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------%
%
% Kind of deformation (FFD_SETTING, HICKS_HENNE, HICKS_HENNE_NORMAL, PARABOLIC,
% HICKS_HENNE_SHOCK, NACA_4DIGITS, DISPLACEMENT, ROTATION,
% FFD_CONTROL_POINT, FFD_DIHEDRAL_ANGLE, FFD_TWIST_ANGLE,
% FFD_ROTATION)
DV_KIND= HICKS_HENNE
%
% Marker of the surface in which we are going apply the shape deformation
DV_MARKER= ( airfoil )
%
% Parameters of the shape deformation
% - HICKS_HENNE_FAMILY ( Lower(0)/Upper(1) side, x_Loc )
% - NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit )
% - PARABOLIC ( 1st digit, 2nd and 3rd digit )
% - DISPLACEMENT ( x_Disp, y_Disp, z_Disp )
% - ROTATION ( x_Orig, y_Orig, z_Orig, x_End, y_End, z_End )
DV_PARAM= ( 1, 0.5 )
%
% Value of the shape deformation deformation
DV_VALUE= 1.0
%
% ------------------------ GRID DEFORMATION PARAMETERS ------------------------%
%
% Number of smoothing iterations for FEA mesh deformation
DEFORM_LINEAR_SOLVER_ITER= 500
%
% Number of nonlinear deformation iterations (surface deformation increments)
DEFORM_NONLINEAR_ITER= 1
%
% Print the residuals during mesh deformation to the console (YES, NO)
DEFORM_CONSOLE_OUTPUT= YES
%
% Minimum residual criteria for the linear solver convergence of grid deformation
DEFORM_LINEAR_SOLVER_ERROR= 1E-14
%
% Type of element stiffness imposed for FEA mesh deformation (INVERSE_VOLUME,
% WALL_DISTANCE, CONSTANT_STIFFNESS)
DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME
%
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
%
% Min value of the residual (log10 of the residual)
CONV_RESIDUAL_MINVAL= -13
%
% Start Cauchy criteria at iteration number
CONV_STARTITER= 10
%
% Number of elements to apply the criteria
CONV_CAUCHY_ELEMS= 100
%
% Epsilon to control the series convergence
CONV_CAUCHY_EPS= 1E-6
%
%
%
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
%
% Mesh input file
MESH_FILENAME= mesh_NACA0012_inv.su2
%
% Mesh input file format (SU2, CGNS, NETCDF_ASCII)
MESH_FORMAT= SU2
%
% Mesh output file
MESH_OUT_FILENAME= mesh_out.su2
%
% Restart flow input file
SOLUTION_FILENAME= solution_flow.dat
%
% Restart adjoint input file
SOLUTION_ADJ_FILENAME= solution_adj.dat
%
TABULAR_FORMAT= CSV
%
% Output file convergence history (w/o extension)
CONV_FILENAME= history
%
% Output file restart flow
RESTART_FILENAME= restart_flow.dat
%
% Output file restart adjoint
RESTART_ADJ_FILENAME= restart_adj.dat
%
% Output file flow (w/o extension) variables
VOLUME_FILENAME= flow
%
% Output file adjoint (w/o extension) variables
VOLUME_ADJ_FILENAME= adjoint
%
% Output Objective function gradient (using continuous adjoint)
GRAD_OBJFUNC_FILENAME= of_grad.dat
%
% Output file surface flow coefficient (w/o extension)
SURFACE_FILENAME= surface_flow
%
% Output file surface adjoint coefficient (w/o extension)
SURFACE_ADJ_FILENAME= surface_adjoint
%
% Writing solution file frequency
OUTPUT_WRT_FREQ= 250
%
%
% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------%
%
% Available flow based objective functions or constraint functions
% DRAG, LIFT, SIDEFORCE, EFFICIENCY, BUFFET,
% FORCE_X, FORCE_Y, FORCE_Z,
% MOMENT_X, MOMENT_Y, MOMENT_Z,
% THRUST, TORQUE, FIGURE_OF_MERIT,
% EQUIVALENT_AREA, NEARFIELD_PRESSURE,
% TOTAL_HEATFLUX, MAXIMUM_HEATFLUX,
% INVERSE_DESIGN_PRESSURE, INVERSE_DESIGN_HEATFLUX,
% SURFACE_TOTAL_PRESSURE, SURFACE_MASSFLOW
% SURFACE_STATIC_PRESSURE, SURFACE_MACH
%
% Available geometrical based objective functions or constraint functions
% AIRFOIL_AREA, AIRFOIL_THICKNESS, AIRFOIL_CHORD, AIRFOIL_TOC, AIRFOIL_AOA,
% WING_VOLUME, WING_MIN_THICKNESS, WING_MAX_THICKNESS, WING_MAX_CHORD, WING_MIN_TOC, WING_MAX_TWIST, WING_MAX_CURVATURE, WING_MAX_DIHEDRAL
% STATION#_WIDTH, STATION#_AREA, STATION#_THICKNESS, STATION#_CHORD, STATION#_TOC,
% STATION#TWIST (where # is the index of the station defined in GEO_LOCATION_STATIONS)
%
% Available design variables
% 2D Design variables
% FFD_CONTROL_POINT_2D ( 19, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, x_Mov, y_Mov )
% FFD_CAMBER_2D ( 20, Scale | Mark. List | FFD_BoxTag, i_Ind )
% FFD_THICKNESS_2D ( 21, Scale | Mark. List | FFD_BoxTag, i_Ind )
% FFD_TWIST_2D ( 22, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig )
% HICKS_HENNE ( 30, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc )
% ANGLE_OF_ATTACK ( 101, Scale | Mark. List | 1.0 )
%
% 3D Design variables
% FFD_CONTROL_POINT ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov )
% FFD_NACELLE ( 12, Scale | Mark. List | FFD_BoxTag, rho_Ind, theta_Ind, phi_Ind, rho_Mov, phi_Mov )
% FFD_GULL ( 13, Scale | Mark. List | FFD_BoxTag, j_Ind )
% FFD_CAMBER ( 14, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind )
% FFD_TWIST ( 15, Scale | Mark. List | FFD_BoxTag, j_Ind, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End )
% FFD_THICKNESS ( 16, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind )
% FFD_ROTATION ( 18, Scale | Mark. List | FFD_BoxTag, x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn )
% FFD_ANGLE_OF_ATTACK ( 24, Scale | Mark. List | FFD_BoxTag, 1.0 )
%
% Global design variables
% TRANSLATION ( 1, Scale | Mark. List | x_Disp, y_Disp, z_Disp )
% ROTATION ( 2, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn )
%
% Definition of multipoint design problems, this option should be combined with the
% the prefix MULTIPOINT in the objective function or constraint (e.g. MULTIPOINT_DRAG, MULTIPOINT_LIFT, etc.)
MULTIPOINT_WEIGHT= (0.25, 0.5, 0.25)
MULTIPOINT_MACH_NUMBER= (0.79, 0.8, 0.81)
%MULTIPOINT_AOA= (1.25, 1.25, 1.25)
%MULTIPOINT_SIDESLIP_ANGLE= (0.0, 0.0, 0.0)
%MULTIPOINT_REYNOLDS_NUMBER= (1E6, 1E6, 1E6)
%MULTIPOINT_TARGET_CL= (0.8, 0.8, 0.8)
%MULTIPOINT_FREESTREAM_PRESSURE= (101325.0, 101325.0, 101325.0)
%MULTIPOINT_FREESTREAM_TEMPERATURE= (288.15, 288.15, 288.15)
%
% Optimization objective function with scaling factor
% ex= Objective * Scale
OPT_OBJECTIVE= MULTIPOINT_DRAG * 0.001
%
% Optimization constraint functions with scaling factors, separated by semicolons
% ex= (Objective = Value ) * Scale, use '>','<','='
%
%OPT_CONSTRAINT=NONE
%everything is well
%
%OPT_OBJECTIVE=(MULTIPOINT MOMENT_Z>0)*0.001
%everything is well
%
OPT_CONSTRAINT= (AIRFOIL_THICKNESS>0)*0.001
%Error will occur%
%
% Maximum number of optimizer iterations
OPT_ITERATIONS= 100
%
% Requested accuracy
OPT_ACCURACY= 1E-6
%
% Upper bound for each design variable
OPT_BOUND_UPPER= 1E6
%
% Lower bound for each design variable
OPT_BOUND_LOWER= -1E6
%
% Optimization design variables, separated by semicolons
DEFINITION_DV= ( 30, 1.0 | airfoil | 0, 0.05 ); ( 30, 1.0 | airfoil | 0, 0.10 ); ( 30, 1.0 | airfoil | 0, 0.15 ); ( 30, 1.0 | airfoil | 0, 0.20 ); ( 30, 1.0 | airfoil | 0, 0.25 ); ( 30, 1.0 | airfoil | 0, 0.30 ); ( 30, 1.0 | airfoil | 0, 0.35 ); ( 30, 1.0 | airfoil | 0, 0.40 ); ( 30, 1.0 | airfoil | 0, 0.45 ); ( 30, 1.0 | airfoil | 0, 0.50 ); ( 30, 1.0 | airfoil | 0, 0.55 ); ( 30, 1.0 | airfoil | 0, 0.60 ); ( 30, 1.0 | airfoil | 0, 0.65 ); ( 30, 1.0 | airfoil | 0, 0.70 ); ( 30, 1.0 | airfoil | 0, 0.75 ); ( 30, 1.0 | airfoil | 0, 0.80 ); ( 30, 1.0 | airfoil | 0, 0.85 ); ( 30, 1.0 | airfoil | 0, 0.90 ); ( 30, 1.0 | airfoil | 0, 0.95 ); ( 30, 1.0 | airfoil | 1, 0.05 ); ( 30, 1.0 | airfoil | 1, 0.10 ); ( 30, 1.0 | airfoil | 1, 0.15 ); ( 30, 1.0 | airfoil | 1, 0.20 ); ( 30, 1.0 | airfoil | 1, 0.25 ); ( 30, 1.0 | airfoil | 1, 0.30 ); ( 30, 1.0 | airfoil | 1, 0.35 ); ( 30, 1.0 | airfoil | 1, 0.40 ); ( 30, 1.0 | airfoil | 1, 0.45 ); ( 30, 1.0 | airfoil | 1, 0.50 ); ( 30, 1.0 | airfoil | 1, 0.55 ); ( 30, 1.0 | airfoil | 1, 0.60 ); ( 30, 1.0 | airfoil | 1, 0.65 ); ( 30, 1.0 | airfoil | 1, 0.70 ); ( 30, 1.0 | airfoil | 1, 0.75 ); ( 30, 1.0 | airfoil | 1, 0.80 ); ( 30, 1.0 | airfoil | 1, 0.85 ); ( 30, 1.0 | airfoil | 1, 0.90 ); ( 30, 1.0 | airfoil | 1, 0.95 )
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've been using su2's single point optimization for a while.
Now, I want to process a multipoint optimization with constraints.
The problem I encountered is that, if I set OPT_CONSTRAINT=NONE or a flow based constraint function(e.g. MULTIPOINT_MOMENT_Z), the optimization goes well.
But if the geometry based constraint is given to OPT_CONSTRAINT(e.g. OPT_CONSTRAINT=( AIRFOIL_THICKNESS>0)*0.001 like single point problem ), the error will occur as below.
The cfg file is based on inv_NACA0012_multipoint.cfg that is from TestCase.
I have no idea what the problem is. I can't find the answer anywhere else.
The error message is as follows:
The cfg file is as follows:
Beta Was this translation helpful? Give feedback.
All reactions