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

Viscous Adjoint does not work

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By AndreaMichelotti

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 29, 2021, 06:59
Default Viscous Adjoint does not work
  #1
New Member
 
Andrea Michelotti
Join Date: Mar 2021
Posts: 12
Rep Power: 3
AndreaMichelotti is on a distinguished road
Hello everyone,

I am attempting an Adjoint Optimization problem with viscous solver (RANS/NAVIER_STOKES) using the shape_optimization.py script but I can't complete it because I receive the following message:

Code:
Error in "void CSolver::Read_SU2_Restart_Binary(CGeometry*, const CConfig*, std::__cxx11::string)":
-------------------------------------------------------------------------
Unable to open SU2 restart file solution_adj_cd.dat
Code:
---- error analysis ----- 
Traceback (most recent call last): 
  File "shape_optimization.py", line 183, in <module> 
    main() 
  File "shape_optimization.py", line 98, in main 
    options.nzones      ) 
  File "shape_optimization.py", line 159, in shape_optimization 
    SU2.opt.SLSQP(project,x0,xb,its,accu) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\opt\scipy_tools.py", line 133, in scipy_slsqp 
    epsilon        = eps            ) 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\slsqp.py", line 208, in fmin_slsqp 
    constraints=cons, **opts) 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\slsqp.py", line 377, in _minimize_slsqp 
    bounds=new_bounds) 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\optimize.py", line 262, in _prepare_scalar_function 
    finite_diff_rel_step, bounds, epsilon=epsilon) 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 159, in __init__ 
    self._update_grad() 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 238, in _update_grad 
    self._update_grad_impl() 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 149, in update_grad 
    self.g = grad_wrapped(self.x) 
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 146, in grad_wrapped 
    return np.atleast_1d(grad(np.copy(x), *args)) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\opt\scipy_tools.py", line 400, in obj_df 
    dobj_list = project.obj_df(x) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\opt\project.py", line 242, in obj_df 
    return self._eval(konfig, func,dvs) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\opt\project.py", line 206, in _eval 
    vals = design._eval(func,*args) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\eval\design.py", line 147, in _eval 
    vals = eval_func(*inputs) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\eval\design.py", line 380, in obj_df 
    grad = su2grad(this_obj,grad_method,config,state) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\eval\gradients.py", line 96, in gradient 
    grads = adjoint( func_name, config, state ) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\eval\gradients.py", line 314, in adjoint 
    info = su2run.adjoint(konfig) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\run\adjoint.py", line 79, in adjoint 
    SU2_CFD(konfig) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\run\interface.py", line 112, in CFD 
    run_command( the_Command ) 
  File "X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\SU2\run\interface.py", line 270, in run_command 
    raise exception(message) 
SU2.EvaluationFailure: Path = X:\Programmi\Confronto_mesh\Nuove\21_Confronto opt inv mesh mod\21_unstr_inv_sup - opt HH mesh mod - 0.01\DESIGNS\DSN_001\ADJOINT_DRAG\, 
Command = mpiexec -n 8 "C:\bin\SU2_CFD" config_CFD.cfg 
SU2 process returned error '1'
With EULER solver it works fine, it creates the solution_adj_*.dat files everytime it runs the ADJOINT problem so, at the beginning, the process does not require any further file besides the .su2 and the .cfg ones.

Even the Constrained shape design of a transonic turbulent airfoil tutorial does not work. The required files (initial solution files for the solver and adjoint solution_flow.dat, solution_adj_cd.dat, and solution_adj_cmz.dat) are given from the beginning and if they are not added to the path in which the tutorial will be run, it cannot be completed.

I also tried the turb_ONERAM6 Test case and personal files as well.

Furthemore, I tried to cheat (?) creating a solution_adj_cd.dat and solution_adj_cmz.dat files from the EULER ADJOINT problem because it was the only way I had to obtain that file: the RANS ADJOINT problem performed better than expected reaching a feasible geometry which is not the one obtained in the tutorial.

I do not get why I have this problem, if it is correct or not. Has anyone experienced this before?

Actually, I think I will run this kind of problem with the cheating (?) procedure described before because I need to go ahead with the work and it seems to work relatively fine.

In conclusion, the ADJOINT problem with RANS/NAVIER_STOKES solver does not work because it needs solution_adj_*.dat which are created autonomously with EULER solver.
nikki likes this.
AndreaMichelotti is offline   Reply With Quote

Reply

Tags
adjoint, optimization, rans, viscous

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Implementation of continuous adjoint SA model c3k1uI5gzT OpenFOAM Programming & Development 1 August 13, 2018 05:16
Viscous Work in rhoPimpleFoam (OF 1612) L_W OpenFOAM Programming & Development 1 August 1, 2018 11:56
Viscous forces (interDyMFoam) differ between OF 2.0 and later versions maxof OpenFOAM Running, Solving & CFD 2 May 30, 2013 05:17
Linearization of viscous flux in discontinuous Galerkin finite element methods yidongxia Main CFD Forum 1 November 17, 2011 13:11
Include Viscous Work term (in fluid model) mehshan.javaid Main CFD Forum 0 September 22, 2011 11:43


All times are GMT -4. The time now is 07:55.