su2code / SU2

SU2: An Open-Source Suite for Multiphysics Simulation and Design
https://su2code.github.io
Other
1.35k stars 842 forks source link

Errors when running Shape Optimization Tutorial 1 - NACA0012 #559

Closed gitlarky closed 5 years ago

gitlarky commented 6 years ago

I tried running the shape optimization tutorial 1: Unconstrained shape design of a transonic inviscid airfoil at a cte. AoA using the given cfg and mesh file. But it seems the process only goes for 4 steps and stop. No matter I use python2 or python3, it is the same. What could cause the problem here? Thank you very much!

when using python2:

NIT    FC           OBJFUN            GNORM
    1     1     2.946447E-08     6.646259E-06
    2     3     2.927194E-08     5.513828E-06
    3     4     2.037004E-08     4.516896E-06
    4     6     1.769283E-08     5.893302E-06
Traceback (most recent call last):
  File "/opt/SU2/SU2-6.0.0/build/bin/shape_optimization.py", line 187, in <module>
    main()
  File "/opt/SU2/SU2-6.0.0/build/bin/shape_optimization.py", line 118, in main
    options.nzones      )
  File "/opt/SU2/SU2-6.0.0/build/bin/shape_optimization.py", line 163, in shape_optimization
    SU2.opt.SLSQP(project,x0,xb,its,accu)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/opt/scipy_tools.py", line 143, in scipy_slsqp
    epsilon        = eps            )
  File "/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.py", line 207, in fmin_slsqp
    constraints=cons, **opts)
  File "/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.py", line 370, in _minimize_slsqp
    raise ValueError("Objective function must return a scalar")
ValueError: Objective function must return a scalar

when using python3:

Traceback (most recent call last):
  File "/usr/lib/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/home/xu/TutorialSU2/Unconstrained_Airfoil_Design_NACA0012_AOA/DESIGNS/DSN_006/DIRECT/solution_flow.dat' -> '/home/xu/TutorialSU2/Unconstrained_Shape_Design_of_a_Transonic_Inviscid_Airfoil_at_an_AOA/DESIGNS/DSN_006/solution_flow.dat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/eval/design.py", line 146, in _eval
    vals = eval_func(*inputs)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/eval/design.py", line 243, in obj_f
    func += su2func(this_obj,config,state) * sign * scale * global_factor
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/eval/functions.py", line 98, in function
    aerodynamics( config, state )
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/eval/functions.py", line 273, in aerodynamics
    push.append(info.FILES['TARGET_HEATFLUX'])
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/io/redirect.py", line 250, in __exit__
    shutil.move(old_name,new_name)
  File "/usr/lib/python3.6/shutil.py", line 558, in move
    copy_function(src, real_dst)
  File "/usr/lib/python3.6/shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/xu/TutorialSU2/Unconstrained_Shape_Design_of_a_Transonic_Inviscid_Airfoil_at_an_AOA/DESIGNS/DSN_006/solution_flow.dat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/scipy/optimize/slsqp.py", line 368, in _minimize_slsqp
    fx = float(np.asarray(func(x)))
  File "/usr/lib/python3/dist-packages/scipy/optimize/optimize.py", line 292, in function_wrapper
    return function(*(wrapper_args + args))
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/opt/scipy_tools.py", line 393, in obj_f
    obj_list = project.obj_f(x)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/opt/project.py", line 236, in obj_f
    return self._eval(konfig, func,dvs)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/opt/project.py", line 205, in _eval
    vals = design._eval(func,*args)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/eval/design.py", line 150, in _eval
    save_data(filename,self)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/io/redirect.py", line 253, in __exit__
    os.chdir(origin)
FileNotFoundError: [Errno 2] No such file or directory: '/home/xu/TutorialSU2/Unconstrained_Shape_Design_of_a_Transonic_Inviscid_Airfoil_at_an_AOA/'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/SU2/SU2-6.0.0/build/bin/shape_optimization.py", line 187, in <module>
    main()
  File "/opt/SU2/SU2-6.0.0/build/bin/shape_optimization.py", line 118, in main
    options.nzones      )
  File "/opt/SU2/SU2-6.0.0/build/bin/shape_optimization.py", line 163, in shape_optimization
    SU2.opt.SLSQP(project,x0,xb,its,accu)
  File "/opt/SU2/SU2-6.0.0/build/bin/SU2/opt/scipy_tools.py", line 143, in scipy_slsqp
    epsilon        = eps            )
  File "/usr/lib/python3/dist-packages/scipy/optimize/slsqp.py", line 207, in fmin_slsqp
    constraints=cons, **opts)
  File "/usr/lib/python3/dist-packages/scipy/optimize/slsqp.py", line 370, in _minimize_slsqp
    raise ValueError("Objective function must return a scalar")
ValueError: Objective function must return a scalar
perjorgen commented 5 years ago

I am getting the exact same error when I try to run it out of the box - even though if I add the restrictions I get a convergence. I tried to run it multithreaded and got very different results and in some case crash with reboot. Then I looked closer at the result - the result from quick start should look very similar to DSN_001, but it doesn't - could the problem be in the python wrapper since that is basically the only difference between DSN_001 and quick start? dsn_001 The last design before crash: dsn_006

perjorgen commented 5 years ago

Now I have tried to compile v6.1.0 on

They all give the same result - could it be the hardware? it is a i7-8700K

jayantmukho commented 5 years ago

I know this is wicked late, but I have just recently been doing a lot of shape optimization and finally can answer some questions on it. Is this still an issue?

Usually when the optimizer exits with that error, it means the DIRECT run diverged, or something of that sort.

perjorgen commented 5 years ago

Thanks for your reply - I haven't tried the latest version, but plan to do it soon. It sound like a reasonable explanation that DIRECT diverged (the images does look rather diverged). Have you run the shape optimization tutorial 1?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.