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

Problem with running tutorial "Constrained Optimal Shape Design of a Fixed Wing"

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2016, 03:16
Question Problem with running tutorial "Constrained Optimal Shape Design of a Fixed Wing"
  #1
New Member
 
JAMES
Join Date: Dec 2016
Posts: 21
Rep Power: 9
yugang881 is on a distinguished road
Hi:
I'm now studying SU2 and try to run sample described in the tutorial "Constrained Optimal Shape Design of a Fixed Wing". When i run the "shape_optimization.py -f inv_ONERAM6_adv.cfg -n 8" in the terminal, after a few times, it shows "SU2 process returned error '1'", and the traceback is as follows:
------------------------------------------------------------------------------------------------------
File "/home/yg/su2/bin/shape_optimization.py", line 157, in <module>
main()
File "/home/yg/su2/bin/shape_optimization.py", line 101, in main
options.quiet )
File "/home/yg/su2/bin/shape_optimization.py", line 140, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its,accu)
File "/home/yg/su2/bin/SU2/opt/scipy_tools.py", line 138, in scipy_slsqp
epsilon = eps )
File "/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.py", line 206, in fmin_slsqp
constraints=cons, **opts)
File "/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.py", line 394, in _minimize_slsqp
for con in cons['ineq']])
File "/home/yg/su2/bin/SU2/opt/scipy_tools.py", line 245, in con_dcieq
dcons = project.con_dcieq(x)
File "/home/yg/su2/bin/SU2/opt/project.py", line 240, in con_dcieq
return self._eval(konfig, func,dvs)
File "/home/yg/su2/bin/SU2/opt/project.py", line 184, in _eval
vals = design._eval(func,*args)
File "/home/yg/su2/bin/SU2/eval/design.py", line 144, in _eval
vals = eval_func(*inputs)
File "/home/yg/su2/bin/SU2/eval/design.py", line 509, in con_dcieq
grad = su2grad(this_con,grad_method,config,state)
File "/home/yg/su2/bin/SU2/eval/gradients.py", line 123, in gradient
grads = geometry( func_name, config, state )
File "/home/yg/su2/bin/SU2/eval/gradients.py", line 709, in geometry
info = su2run.geometry(config)
File "/home/yg/su2/bin/SU2/run/geometry.py", line 95, in geometry
SU2_GEO(konfig)
File "/home/yg/su2/bin/SU2/run/interface.py", line 213, in GEO
run_command( the_Command )
File "/home/yg/su2/bin/SU2/run/interface.py", line 297, in run_command
raise exception , message
SU2.EvaluationFailure: Path = /home/yg/su2/bin/DESIGNS/DSN_001/GEOMETRY/,
Command = mpirun -n 8 /home/yg/su2/bin/SU2_GEO config_GEO.cfg
SU2 process returned error '1'
-----------------------------------------------------------------------------------------------------------
the configure file is the same as website. And when i checked the GEOMETRY file, it shows :
------------------------- Exit Success (SU2_GEO) ------------------------

OBJECTIVE_FUNCTION: invalid option value MAX_THICKNESS_SEC1. Check current SU2 options in config_template.cfg.
-----------------------------------------------------------------------------------------
I think it is problem of the MAX_THICKNESS_SEC1 constraint cost this problem.But how could i fix it ? And it is all the same as the tutorial, it would don't have this problem.
Does anyone kindly show me the way to fix it? Thanks in advance and for you kindly attention.
yugang881 is offline   Reply With Quote

Old   December 16, 2016, 03:51
Default
  #2
hlk
Senior Member
 
Heather Kline
Join Date: Jun 2013
Posts: 309
Rep Power: 13
hlk is on a distinguished road
Quote:
Originally Posted by yugang881 View Post
Hi:
I'm now studying SU2 and try to run sample described in the tutorial "Constrained Optimal Shape Design of a Fixed Wing". When i run the "shape_optimization.py -f inv_ONERAM6_adv.cfg -n 8" in the terminal, after a few times, it shows "SU2 process returned error '1'", and the traceback is as follows:
------------------------------------------------------------------------------------------------------
File "/home/yg/su2/bin/shape_optimization.py", line 157, in <module>
main()
File "/home/yg/su2/bin/shape_optimization.py", line 101, in main
options.quiet )
File "/home/yg/su2/bin/shape_optimization.py", line 140, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its,accu)
File "/home/yg/su2/bin/SU2/opt/scipy_tools.py", line 138, in scipy_slsqp
epsilon = eps )
File "/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.py", line 206, in fmin_slsqp
constraints=cons, **opts)
File "/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.py", line 394, in _minimize_slsqp
for con in cons['ineq']])
File "/home/yg/su2/bin/SU2/opt/scipy_tools.py", line 245, in con_dcieq
dcons = project.con_dcieq(x)
File "/home/yg/su2/bin/SU2/opt/project.py", line 240, in con_dcieq
return self._eval(konfig, func,dvs)
File "/home/yg/su2/bin/SU2/opt/project.py", line 184, in _eval
vals = design._eval(func,*args)
File "/home/yg/su2/bin/SU2/eval/design.py", line 144, in _eval
vals = eval_func(*inputs)
File "/home/yg/su2/bin/SU2/eval/design.py", line 509, in con_dcieq
grad = su2grad(this_con,grad_method,config,state)
File "/home/yg/su2/bin/SU2/eval/gradients.py", line 123, in gradient
grads = geometry( func_name, config, state )
File "/home/yg/su2/bin/SU2/eval/gradients.py", line 709, in geometry
info = su2run.geometry(config)
File "/home/yg/su2/bin/SU2/run/geometry.py", line 95, in geometry
SU2_GEO(konfig)
File "/home/yg/su2/bin/SU2/run/interface.py", line 213, in GEO
run_command( the_Command )
File "/home/yg/su2/bin/SU2/run/interface.py", line 297, in run_command
raise exception , message
SU2.EvaluationFailure: Path = /home/yg/su2/bin/DESIGNS/DSN_001/GEOMETRY/,
Command = mpirun -n 8 /home/yg/su2/bin/SU2_GEO config_GEO.cfg
SU2 process returned error '1'
-----------------------------------------------------------------------------------------------------------
the configure file is the same as website. And when i checked the GEOMETRY file, it shows :
------------------------- Exit Success (SU2_GEO) ------------------------

OBJECTIVE_FUNCTION: invalid option value MAX_THICKNESS_SEC1. Check current SU2 options in config_template.cfg.
-----------------------------------------------------------------------------------------
I think it is problem of the MAX_THICKNESS_SEC1 constraint cost this problem.But how could i fix it ? And it is all the same as the tutorial, it would don't have this problem.
Does anyone kindly show me the way to fix it? Thanks in advance and for you kindly attention.
First, if you have not already done so, I suggest setting up your environment variables as suggested in the installation instructions such that you can run from another directory, rather than using the bin/ directory.

I was able to reproduce this error only by changing the configuration file to use MAX_THICKNESS_SEC1 as the OPT_OBJECTIVE selection - it worked fine when this was a constraint.

At first glance, it looks like this is a current limitation, that the maximum section thickness can be used as a constraint, but not as an objective. Possibly this may be introduced in a later version of the code. If you would like a developer to look into that, you can introduce this as an issue on github, and if you are interested you are welcome to take on making the necessary modifications yourself as well.
hlk is offline   Reply With Quote

Old   December 18, 2016, 07:05
Default
  #3
New Member
 
JAMES
Join Date: Dec 2016
Posts: 21
Rep Power: 9
yugang881 is on a distinguished road
Quote:
Originally Posted by hlk View Post
First, if you have not already done so, I suggest setting up your environment variables as suggested in the installation instructions such that you can run from another directory, rather than using the bin/ directory.

I was able to reproduce this error only by changing the configuration file to use MAX_THICKNESS_SEC1 as the OPT_OBJECTIVE selection - it worked fine when this was a constraint.

At first glance, it looks like this is a current limitation, that the maximum section thickness can be used as a constraint, but not as an objective. Possibly this may be introduced in a later version of the code. If you would like a developer to look into that, you can introduce this as an issue on github, and if you are interested you are welcome to take on making the necessary modifications yourself as well.
-----------------------------------------------------------------------------
Thanks for you kindly reply. I tried the run in another directory but it still occurs the same problem. The MAX_THICKNESS_SEC1 i used is the same as the tutorial sample as below:
--------------------------------------------------------------------
% Optimization constraint functions with scaling factors, separated by semicolons
% ex= (Objective = Value ) * Scale, use '>','<','='
OPT_CONSTRAINT= (LIFT > 0.2864) * 0.1; (MAX_THICKNESS_SEC1 > 0.0570) * 0.1; (MAX_THICKNESS_SEC2 > 0.0513) * 0.1; (MAX_THICKNESS_SEC3 > 0.0457) * 0.1; (MAX_THICKNESS_SEC4 > 0.0399) * 0.1; (MAX_THICKNESS_SEC5 > 0.0343) * 0.1
%
------------------------------------------------------------------------
Because i am a newer in using SU2. I'm really confused now. It would be great thanks if you kindly show me the way to fix this problem. And also could you plz show me where can i find the variable MAX_THICKNESS_SEC1 defined in the source?
yugang881 is offline   Reply With Quote

Old   December 18, 2016, 16:52
Default
  #4
hlk
Senior Member
 
Heather Kline
Join Date: Jun 2013
Posts: 309
Rep Power: 13
hlk is on a distinguished road
What is in the option 'OPT_OBJECTIVE'?
It should not effect the shape_optimization.py script, but if 'OBJECTIVE_FUNCTION' is also in your config file, what option is used?

What code version are you using?

The options are defined in Common/include/option_structure.hpp and Common/src/config_structure.cpp.

Some options are interpreted by the python scripts using functions defined in SU2_PY/SU2/io/tools.py and other scripts in that directory.
hlk is offline   Reply With Quote

Old   December 18, 2016, 22:46
Default
  #5
New Member
 
JAMES
Join Date: Dec 2016
Posts: 21
Rep Power: 9
yugang881 is on a distinguished road
Quote:
Originally Posted by hlk View Post
What is in the option 'OPT_OBJECTIVE'?
It should not effect the shape_optimization.py script, but if 'OBJECTIVE_FUNCTION' is also in your config file, what option is used?

What code version are you using?

The options are defined in Common/include/option_structure.hpp and Common/src/config_structure.cpp.

Some options are interpreted by the python scripts using functions defined in SU2_PY/SU2/io/tools.py and other scripts in that directory.
Dear Mr. hlk:
Thanks for you kindly and promotion reply. The version i am using is SU2 4.3.0. The Objective_function is as below mentioned in the .cfg file's Optimal shape design definition part:
-------------------------------------------
% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------%
% Available flow based objective functions or constraint functions
% DRAG, LIFT, SIDEFORCE, EFFICIENCY,
% FORCE_X, FORCE_Y, FORCE_Z,
% MOMENT_X, MOMENT_Y, MOMENT_Z,
% THRUST, TORQUE, FIGURE_OF_MERIT,
% EQUIVALENT_AREA, NEARFIELD_PRESSURE,
% FREE_SURFACE
%
% Available geometrical based objective functions or constraint functions
% MAX_THICKNESS, 1/4_THICKNESS, 1/2_THICKNESS, 3/4_THICKNESS, AREA, AOA, CHORD,
% MAX_THICKNESS_SEC1, MAX_THICKNESS_SEC2, MAX_THICKNESS_SEC3, MAX_THICKNESS_SEC4, MAX_THICKNESS_SEC5,
% 1/4_THICKNESS_SEC1, 1/4_THICKNESS_SEC2, 1/4_THICKNESS_SEC3, 1/4_THICKNESS_SEC4, 1/4_THICKNESS_SEC5,
% 1/2_THICKNESS_SEC1, 1/2_THICKNESS_SEC2, 1/2_THICKNESS_SEC3, 1/2_THICKNESS_SEC4, 1/2_THICKNESS_SEC5,
% 3/4_THICKNESS_SEC1, 3/4_THICKNESS_SEC2, 3/4_THICKNESS_SEC3, 3/4_THICKNESS_SEC4, 3/4_THICKNESS_SEC5,
% AREA_SEC1, AREA_SEC2, AREA_SEC3, AREA_SEC4, AREA_SEC5,
% AOA_SEC1, AOA_SEC2, AOA_SEC3, AOA_SEC4, AOA_SEC5,
% CHORD_SEC1, CHORD_SEC2, CHORD_SEC3, CHORD_SEC4, CHORD_SEC5
%
% Available design variables
% HICKS_HENNE ( 1, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc )
% COSINE_BUMP ( 2, Scale | Mark. List | Lower(0)/Upper(1) side, x_Loc, x_Size )
% SPHERICAL ( 3, Scale | Mark. List | ControlPoint_Index, Theta_Disp, R_Disp )
% NACA_4DIGITS ( 4, Scale | Mark. List | 1st digit, 2nd digit, 3rd and 4th digit )
% DISPLACEMENT ( 5, Scale | Mark. List | x_Disp, y_Disp, z_Disp )
% ROTATION ( 6, Scale | Mark. List | x_Axis, y_Axis, z_Axis, x_Turn, y_Turn, z_Turn )
% FFD_CONTROL_POINT ( 7, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Mov, y_Mov, z_Mov )
% FFD_DIHEDRAL_ANGLE ( 8, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End )
% FFD_TWIST_ANGLE ( 9, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End )
% FFD_ROTATION ( 10, Scale | Mark. List | FFD_BoxTag, x_Orig, y_Orig, z_Orig, x_End, y_End, z_End )
% FFD_CAMBER ( 11, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind )
% FFD_THICKNESS ( 12, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind )
% FFD_VOLUME ( 13, Scale | Mark. List | FFD_BoxTag, i_Ind, j_Ind )
% FOURIER ( 14, Scale | Mark. List | Lower(0)/Upper(1) side, index, cos(0)/sin(1) )
%
% Optimization objective function with scaling factor
% ex= Objective * Scale
OPT_OBJECTIVE= DRAG * 0.1
%
% Optimization constraint functions with scaling factors, separated by semicolons
% ex= (Objective = Value ) * Scale, use '>','<','='
OPT_CONSTRAINT= (LIFT > 0.2864) * 0.1; (MAX_THICKNESS_SEC1 > 0.0570) * 0.1; (MAX_THICKNESS_SEC2 > 0.0513) * 0.1; (MAX_THICKNESS_SEC3 > 0.0457) * 0.1; (MAX_THICKNESS_SEC4 > 0.0399) * 0.1; (MAX_THICKNESS_SEC5 > 0.0343) * 0.1
%
--------------------------------------------------------------------------
What's the tutorial's version?Maybe i should try that version to run the sample.
yugang881 is offline   Reply With Quote

Old   December 19, 2016, 04:26
Default
  #6
New Member
 
JAMES
Join Date: Dec 2016
Posts: 21
Rep Power: 9
yugang881 is on a distinguished road
Finally, i used the SU2 version 4.2.0 and the problem is not exist. The sample could be run very well. So i think maybe is the 4.3.0 version difference caused this problem. I suggest the developer should use the 4.3.0 to run the inv_ONERAM6_adv.cfg to see if it is really exist this problem. Or it is only my computer's problem.
yugang881 is offline   Reply With Quote

Old   December 22, 2016, 10:35
Default
  #7
New Member
 
Alejandro Quirós
Join Date: Nov 2016
Location: Chiclana, Spain
Posts: 6
Rep Power: 9
AQuiros is on a distinguished road
Hello.

I'm using the version 4.3 and I have the same issue while trying to run this tutorial. After a bit of research, I've found that it's not possible to use more than 2 constraints. When you use 2 constraints or more, in the config_GEO.cfg file that SU2 creates in the DESIGNS/DSN_XXX/GEOMETRY folder the OBJECTIVE_FUNCTION value is not the one stated in the cfg file but the second constraint stated in the OPT_CONSTRAINTS in the cfg.

I have tried the tutorial using a different constraint to see if the problem was in the use of MAX_THICKNESS_SECX constraint, but the issue remains with any constraint that you use in second position. Maybe the problem could be in the script that reads the cfg file. Has it changed in the last version?

Last edited by AQuiros; December 22, 2016 at 14:31.
AQuiros is offline   Reply With Quote

Old   December 27, 2016, 00:14
Default
  #8
hlk
Senior Member
 
Heather Kline
Join Date: Jun 2013
Posts: 309
Rep Power: 13
hlk is on a distinguished road
Thank you all for testing the tutorial. I have not managed to reproduce the problem, but it looks like multiple people are seeing the same issue, and since it's one of the tutorials it would be good to fix it soon.
After some searching, the only thing that pops out at me is that there is a mismatch in names - in option_structure.hpp MAX_THICK_SEC* is listed, while in the python files 'MAX_THICKNESS_SEC*' is used.

The fastest way to check would likely be to modify the python file SU2/bin/SU2/io/tools.py to replace every instance of 'THICKNESS' with 'THICK' and see if that fixes it. If anyone is willing to do that, please go ahead. If there continue to be issues, try the develop branch and/or go ahead and open an issue on github. If you find the source of the problem and fix it, please submit a pull request so that others can benefit.

Its a bit confusing, since this name mismatch also occurs in version 4.2, but that could at least eliminate a possible cause. If you think you may submit a pull request, first check out the develop branch rather than the master branch prior to modifying the code, and take a look at the developer section in the github wiki.
hlk is offline   Reply With Quote

Old   December 30, 2016, 07:45
Default
  #9
New Member
 
Alejandro Quirós
Join Date: Nov 2016
Location: Chiclana, Spain
Posts: 6
Rep Power: 9
AQuiros is on a distinguished road
I don't think that is causing the bug since I've had the same report with any constraint I use in second position. For example I've tried the tutorial changing MAX_THICKNESS_SEC1 with AREA_SEC1 and I got this message,

"OBJECTIVE_FUNCTION: invalid option value AREA_SEC1. Check current SU2 options in config_template.cfg."

I think something is making the value of the OBJECTIVE_FUNCTION changes from its value in the config file to the value used for the second constraint in OPT_CONSTRAINT.
AQuiros is offline   Reply With Quote

Old   December 31, 2016, 15:26
Default
  #10
hlk
Senior Member
 
Heather Kline
Join Date: Jun 2013
Posts: 309
Rep Power: 13
hlk is on a distinguished road
Quote:
Originally Posted by AQuiros View Post
I don't think that is causing the bug since I've had the same report with any constraint I use in second position. For example I've tried the tutorial changing MAX_THICKNESS_SEC1 with AREA_SEC1 and I got this message,

"OBJECTIVE_FUNCTION: invalid option value AREA_SEC1. Check current SU2 options in config_template.cfg."

I think something is making the value of the OBJECTIVE_FUNCTION changes from its value in the config file to the value used for the second constraint in OPT_CONSTRAINT.
Thanks for looking into this further.

Just to narrow this down, can you try a non-geometric constraint in the second position?
And, separately, try a geometric constraint in the first position?
This will help narrow down whether this problem is coming from all the geometric constraints or from the processing of multiple constraints.
(Geometric constraints = max thickness, area, etc, anything evaluated by SU2_GEO; non-geometric = lift, drag, moments, etc)


What that error means is that 'AREA_SEC1' does not exist in the option_structure.hpp definition of the options available for that variable. A quick fix would be to simply add the options to the list in option_structure.hpp and recompile, however I do not think that is the right fix to do here.
I had not previously spent much time with SU2_GEO - after looking more closely, I think now that what the python code SHOULD be doing is to NOT set the objective_function variable at all during the SU2_GEO step. SU2_GEO outputs the geometric quantities to a file and does not depend on the value in that option.
So the question to answer now is why the code is incorrectly generating the config file for SU2_GEO in v4.3 - if it's because of a change to how multiple constraints are handled, or if it's because of a change to how geometric quantities are evaluated.
hlk is offline   Reply With Quote

Old   January 5, 2017, 15:24
Default
  #11
New Member
 
Alejandro Quirós
Join Date: Nov 2016
Location: Chiclana, Spain
Posts: 6
Rep Power: 9
AQuiros is on a distinguished road
I have done a few tests today and I think now it's clear the bug is related to geometrical constraints.

WIth a non-geometrical constraint it runs well. With one geometrical constraint it crashes.
With two constraints, one geometrical and one non-geometrical it crashes and it doesn't matter in what position they are. The value of OBJECTIVE_FUNCTION always changes from the value it should have, DRAG, to the value of the geometrical constraint.
AQuiros is offline   Reply With Quote

Old   February 1, 2017, 18:10
Default
  #12
hlk
Senior Member
 
Heather Kline
Join Date: Jun 2013
Posts: 309
Rep Power: 13
hlk is on a distinguished road
Hello
I am happy to announce that this problem has been fixed in SU2 version 5.0.0 'Raven'.
hlk is offline   Reply With Quote

Old   February 3, 2017, 07:15
Default
  #13
New Member
 
Alejandro Quirós
Join Date: Nov 2016
Location: Chiclana, Spain
Posts: 6
Rep Power: 9
AQuiros is on a distinguished road
Thanks! I've used v5.0 and it's working properly.
AQuiros 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
Problem running tutorial vrolin OpenFOAM Installation 6 November 30, 2012 08:12
Problem running cavityGrade Tutorial CFDMike OpenFOAM Running, Solving & CFD 0 September 23, 2010 07:46
Problem in running tutorial cases preetham OpenFOAM Installation 2 June 13, 2009 16:36
problem when running icoFoam on a complex shape flow field wendywu OpenFOAM 1 May 20, 2009 23:40
Kubuntu uses dash breaks All scripts in tutorials platopus OpenFOAM Bugs 8 April 15, 2008 07:52


All times are GMT -4. The time now is 14:40.