|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
Hello SU2 developers,
I'm trying to perform a NACA0012 subsonic constrained shape optimization. I performed direct and two adjoint (the first with J=DRAG, the second with J=LIFT) simulations. My objective function is DRAG and the constraint is on the LIFT force. My problem arises when I execute shape_optimization.py with restart solutions, everything seems to be ok, but, when the second adjoint simulation starts (the one on the LIFT), the solver can't reach the solution and residuals go to infinity, although the solution_adj_cl comes from a converged solution. Actually I used the same convergence criteria for all the three simulations (CAUCHY with CAUCHY_EPS=1E-6). If I instead execute SU2_CFD with MATH_PROBLEM= ADJOINT and the same restart solution, the required convergence is reached. I attach below the configuration file and the two log files. Cheers, Roberto |
|
|
|
|
|
|
|
|
#2 |
|
New Member
Join Date: Dec 2011
Posts: 10
Rep Power: 3 ![]() |
Dear Roberto,
Could you please provide your mesh as well as your restart files for this case? Regards, Aniket |
|
|
|
|
|
|
|
|
#3 |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
Thank you for the reply.
Here the mesh and restart files: https://dl.dropboxusercontent.com/u/...26solution.zip |
|
|
|
|
|
|
|
|
#4 |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
I tried to perform shape optimization without restart, but the tool takes a lot of time in executing SU2_MDC (1000 min); it seems that a first deformation is executed, but the direct simulation doesn't converge. Then another deformation starts, but it doesn't converge. Maybe there is something wrong with the scale factor of objective function, but I don't understand how to set that value. Here is the log file: https://dl.dropboxusercontent.com/u/...logSU2v2.0.txt
I also downloaded and compiled SU2v2.0.3; with the new version of the code, the shape optimization seems to stop after the first adjoint simulation with this error: Code:
Traceback (most recent call last):
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 121, in <module>
main()
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 66, in main
options.step )
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 104, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/scipy_tools.py", line 86, in scipy_slsqp
epsilon = 1.0e-06 )
File "/usr/lib/python2.6/dist-packages/scipy/optimize/slsqp.py", line 299, in fmin_slsqp
g = append(fprime(x),0.0)
File "/usr/lib/python2.6/dist-packages/scipy/optimize/optimize.py", line 97, in function_wrapper
return function(x, *args)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/scipy_tools.py", line 120, in obj_df
dobj = project.obj_df(x)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/project.py", line 180, in obj_df
return self._eval(konfig, func,dvs)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/project.py", line 149, in _eval
vals = design._eval(func,*args)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/design.py", line 119, in _eval
vals = eval_func(*inputs)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/design.py", line 260, in obj_df
grad = su2grad(this_obj,grad_method,config,state)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/gradients.py", line 77, in gradient
grads = adjoint(func_name, config, state)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/gradients.py", line 205, in adjoint
info = su2run.adjoint(config)
File "/users/pieri/SU2/trunk/SU2Py/SU2/run/adjoint.py", line 88, in adjoint
history = su2io.read_history( history_filename )
File "/users/pieri/SU2/trunk/SU2Py/SU2/io/tools.py", line 115, in read_history
line_data = [ float(x.strip()) for x in line_data ]
ValueError: invalid literal for float(): 0.0
Best regards, Roberto |
|
|
|
|
|
|
|
|
#5 |
|
New Member
Join Date: Dec 2011
Posts: 10
Rep Power: 3 ![]() |
Hi Roberto,
The mesh deformation procedure should not take this long. Could you please visualize the deformation by setting the option VISUALIZE_DEFORMATION in your config file to YES? Regards, Aniket |
|
|
|
|
|
|
|
|
#6 |
|
Member
Trent Lukaczyk
Join Date: Feb 2011
Location: Stanford, CA
Posts: 33
Rep Power: 4 ![]() |
Hi Roberto,
I'm having trouble running your configuration file, and it seems strange that you are able to run this config with 2.0.3. It looks like the optimization options need to be updated, please see this post - here also, i'm not able to run su2_ddc without adding a MARKER_EULER= (AIRFOIL). i think this is a bug we need to work out yet. i'm sure this is unlikely the issue, but just in case, can you please confirm that your path and environment variables point to the new version? finally, one thing to note in 2.0.3 is to use restarts for an optimization you should set RESTART_SOL=YES in the config file. lots of things to try out, maybe one will stick? best, -trent |
|
|
|
|
|
|
|
|
#7 | ||||
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
@aniketaranake:
Quote:
@rktchip: Quote:
Quote:
Quote:
Obviously when I ran shape optimization with previous direct&adjoint solutions I set to YES the option RESTART_SOL. |
|||||
|
|
|
|||||
|
|
|
#8 |
|
Member
Trent Lukaczyk
Join Date: Feb 2011
Location: Stanford, CA
Posts: 33
Rep Power: 4 ![]() |
Hi Roberto,
So it sounds like you've run a couple different scenarios in different versions, but the core problem you're facing is that the adjoint problem for a subsonic pseudo-incompressible turbulent naca0012 is not converging, correct? please keep in mind that the subsonic pseudo-incompressible turbulent problem you're exploring is very much outside of the original intent of that test case, which is very cool! But that might mean some solver development will be needed in this area. At any rate, would you please test/comment on this troubleshooting tree with 2.0.3? no need to rerun a step you've already done of course. we'll know where to look based on which of these fail. 1. naca 0012 standard test case optimization (euler, transonic) 2. one naca 0012 turbulent evaluation with parallel_computation 3. naca0012 turbulent optimization with small number of external iterations (this is to test the the optimization framework is behaving) 4. your optimization test case. thanks, - trent Last edited by rktchip; May 11, 2013 at 06:32. |
|
|
|
|
|
|
|
|
#9 |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
Hi trent,
thank you for the reply. The adjoint solution seems to be ok either with drag or lift objective function. The problem is the shape optimization that, with the 2.0.3 version, stops with the error posted above. However I am setting the "troubleshooting tree". 1. I have to use the same config file in test cases on my mesh and I run it in serial, is it right? 2. Should this case be transonic or subsonic? I already have some results in subsonic Mach range: https://dl.dropboxusercontent.com/u/...bsonicTurb.zip 3. What do you mean for small number of external iterations? Is it the maximum number of iteration of the optimization? Best regards, Roberto |
|
|
|
|
|
|
|
|
#10 |
|
Member
Trent Lukaczyk
Join Date: Feb 2011
Location: Stanford, CA
Posts: 33
Rep Power: 4 ![]() |
Hi Roberto,
Great. As you mentioned parallel will be much faster, so I would try to sort out why that isn't working first (which may be another thread in itself). Your config will be the same for steps 2-4, but not for step 1, which you should get from the original naca0012 euler test case. small number of iterations is a trick we use to test that the optimizer is working. you can set EXT_ITER=9 for example. this separates out the solver in some sense. So if you see that it works with small number of iterations, but fails when fully converging the solution, that tells you something. we can explore this when you get your results. sorry there isn't an easy answer for this one. this troubleshooting is basically what i would be doing, but unfortunately i'm in the middle of writing a paper, so i only have time to guide you through finding the solution. best, - trent |
|
|
|
|
|
|
|
|
#11 | |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
I am facing some troubles with adjoint euler on my NACA0012 mesh. The file configuration is the same in your test cases.
Concerning about my case, the problem is not related to parallel (actually with the version 2.0.3 it seems to be ok because the test case on cylinder converges, differently from version 2.0), but with shape optimization. The error (also posted above) is: Code:
Traceback (most recent call last):
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 121, in <module>
main()
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 66, in main
options.step )
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 104, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/scipy_tools.py", line 86, in scipy_slsqp
epsilon = 1.0e-06 )
File "/usr/lib/python2.6/dist-packages/scipy/optimize/slsqp.py", line 299, in fmin_slsqp
g = append(fprime(x),0.0)
File "/usr/lib/python2.6/dist-packages/scipy/optimize/optimize.py", line 97, in function_wrapper
return function(x, *args)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/scipy_tools.py", line 120, in obj_df
dobj = project.obj_df(x)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/project.py", line 180, in obj_df
return self._eval(konfig, func,dvs)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/project.py", line 149, in _eval
vals = design._eval(func,*args)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/design.py", line 119, in _eval
vals = eval_func(*inputs)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/design.py", line 260, in obj_df
grad = su2grad(this_obj,grad_method,config,state)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/gradients.py", line 77, in gradient
grads = adjoint(func_name, config, state)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/gradients.py", line 205, in adjoint
info = su2run.adjoint(config)
File "/users/pieri/SU2/trunk/SU2Py/SU2/run/adjoint.py", line 88, in adjoint
history = su2io.read_history( history_filename )
File "/users/pieri/SU2/trunk/SU2Py/SU2/io/tools.py", line 115, in read_history
line_data = [ float(x.strip()) for x in line_data ]
ValueError: invalid literal for float(): 0.0
However I am also working to make euler adjoint converge. Quote:
@Aniket: shape optimization stops during SU2_MDC, as you requested I set to YES the option VISUALIZE_DEFORMATION. Do you need deformed_surface_grid.vtk and deformed_volumetric_grid.vtk? files are here: https://dl.dropboxusercontent.com/u/...etric_grid.vtk https://dl.dropboxusercontent.com/u/...rface_grid.vtk But the mesh doesn't seem to be deformed. |
||
|
|
|
||
|
|
|
#12 |
|
Member
Trent Lukaczyk
Join Date: Feb 2011
Location: Stanford, CA
Posts: 33
Rep Power: 4 ![]() |
do you get this error when you run continuous_adjoint.py?
-trent |
|
|
|
|
|
|
|
|
#13 |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
No, I don't. It runs without any problem.
Roberto |
|
|
|
|
|
|
|
|
#14 |
|
Member
Trent Lukaczyk
Join Date: Feb 2011
Location: Stanford, CA
Posts: 33
Rep Power: 4 ![]() |
strange. so let me make sure i'm synced with your status - you've compiled serially correct? with autoconf? and for the naca0012 test case shape optimization fails on the first iteration with restart?
if you're running serially, can you try using a -p 0 (zero) option for shape optimization. it this doesnt work, please zip up the design folder that fails and post it. thanks dude, - trent |
|
|
|
|
|
|
|
|
#15 |
|
New Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 27
Rep Power: 3 ![]() |
I'll try to explain my situation more clearly.
Using version 2.0 of the software, direct and adjoint simulations converge. The next step would be shape optimization, but python routine stops during mesh deformation (after 1000 mins it doesn't converge). Remind that I can't use parallel computation because the cylinder test case gives different results if run in parallel or serial, therefore I discarded parallel computation. The restart of the solution with shape optimization is also a problem, actually adjoint simulation starts but it diverges after some tens of iterations (while if I run SU2_CFD from a previous solution it converges without any problem). Concerning version 2.0.3, parallel seems to work, but problems with restart solution remain. Recently I faced with the error posted above. Today I discovered that it is related to the way SU2_CFD save data in history.csv (or .plt); actually in column 11, related to Res_AdjTurb[0], there is a symbol (as you can see from picture attached below). I solved the problem adding these lines in tools.py after line 114: Code:
for i,x in enumerate(line_data):
if i==11:
line_data[i] = '0.0'
Code:
!!! Error: NaNs detected in solution. Now exiting... !!!
Traceback (most recent call last):
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 121, in <module>
main()
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 66, in main
options.step )
File "/users/pieri/SU2/trunk/SU2Py/shape_optimization.py", line 104, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/scipy_tools.py", line 86, in scipy_slsqp
epsilon = 1.0e-06 )
File "/usr/lib/python2.6/dist-packages/scipy/optimize/slsqp.py", line 268, in fmin_slsqp
fx = func(x)
File "/usr/lib/python2.6/dist-packages/scipy/optimize/optimize.py", line 97, in function_wrapper
return function(x, *args)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/scipy_tools.py", line 104, in obj_f
obj = project.obj_f(x)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/project.py", line 175, in obj_f
return self._eval(konfig, func,dvs)
File "/users/pieri/SU2/trunk/SU2Py/SU2/opt/project.py", line 149, in _eval
vals = design._eval(func,*args)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/design.py", line 119, in _eval
vals = eval_func(*inputs)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/design.py", line 209, in obj_f
func = su2func(this_obj,config,state)
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/functions.py", line 75, in function
aero = aerodynamics( config, state )
File "/users/pieri/SU2/trunk/SU2Py/SU2/eval/functions.py", line 196, in aerodynamics
info = su2run.direct(config)
File "/users/pieri/SU2/trunk/SU2Py/SU2/run/direct.py", line 75, in direct
SU2_CFD(konfig)
File "/users/pieri/SU2/trunk/SU2Py/SU2/run/interface.py", line 91, in CFD
run_command( the_Command )
File "/users/pieri/SU2/trunk/SU2Py/SU2/run/interface.py", line 275, in run_command
raise Exception , message
Exception: SU2 process returned error '1'
Concerning the troubleshooting tree, I get the same error in step number 3, for which I set EXT_ITER= 9. |
|
|
|
|
|
|
|
|
#16 |
|
Super Moderator
Thomas D. Economon
Join Date: Jan 2013
Location: Stanford, CA
Posts: 55
Rep Power: 2 ![]() |
Hi Roberto,
It does indeed look like your problem involves the mesh deformation (at least this is the first issue ). Before attempting any optimization, can you please try running SU2_MDC with your mesh and the following options:% Grid deformation technique (SPRING, TORSIONAL_SPRING, ALGEBRAIC) GRID_DEFORM_METHOD= TORSIONAL_SPRING % % Maximum error in the grid deformation GRID_DEFORM_ERROR= 1E-10 It looks like you are using a structured mesh, and we have found that the torsional spring method works a little better in this situation. Lowering the error tolerance should also help a little too with convergence. Once you have a deformed mesh, please check that the deformation was successful (no inverted cells, should be a smooth deformation near the airfoil) and try to run a simulation with the new mesh to make sure there are no quality issues. Hope this helps! Tom |
|
|
|
|
|
![]() |
| Tags |
| optimization, restart solution, su2 |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with SimpleFoam for a solution around an OneraM6 wing | gara1988 | OpenFOAM Running, Solving & CFD | 3 | November 13, 2012 05:47 |
| Solution of Lid driven Cavity problem using SIMPLE algorithm | sasank | Main CFD Forum | 2 | May 20, 2012 09:22 |
| Problem with restart | henryss | STAR-CD | 2 | October 25, 2009 08:29 |
| How to get an accurate CFD solution to aeroheating problem for hypersonic flows? | Leining D | Main CFD Forum | 5 | April 14, 2009 11:26 |
| Numerical solution to the rotating disk problem? | johny | Main CFD Forum | 7 | September 5, 2005 05:53 |