Zhen ZHANG |
May 5, 2021 23:38 |
Hi, thank you for your reply.
I have read the codes in CFlowOutput.cpp and tried the test case these days. Basically, I understand the codes to calculate the difference between the two distributions, but I get some problems.
1. I cannot run the test case. When using the shape_optimiazation.py, it returns the following:
Code:
-------------------------------------------------------------------------
| ___ _ _ ___ |
| / __| | | |_ ) Release 7.1.1 "Blackbird" |
| \__ \ |_| |/ / |
| |___/\___//___| Aerodynamic Shape Optimization Script |
| |
-------------------------------------------------------------------------
| SU2 Project Website: https://su2code.github.io |
| |
| The SU2 Project is maintained by the SU2 Foundation |
| (http://su2foundation.org) |
-------------------------------------------------------------------------
| Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) |
| |
| SU2 is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Lesser General Public |
| License as published by the Free Software Foundation; either |
| version 2.1 of the License, or (at your option) any later version. |
| |
| SU2 is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Lesser General Public License for more details. |
| |
| You should have received a copy of the GNU Lesser General Public |
| License along with SU2. If not, see <http://www.gnu.org/licenses/>. |
-------------------------------------------------------------------------
Found: Arina2Kmesh.su2
Found: TargetCp.dat
New Project: ./
Sequential Least SQuares Programming (SLSQP) parameters:
Number of design variables: 73 ( 73 )
Objective function scaling factor: [0.9]
Maximum number of iterations: 1
Requested accuracy: 9e-08
Initial guess for the independent variable(s): [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Lower and upper bound for each independent variable: [(-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06), (-5e-06, 5e-06)]
NIT FC OBJFUN GNORM
Traceback (most recent call last):
File "/usr/local/bin/shape_optimization.py", line 183, in <module>
main()
File "/usr/local/bin/shape_optimization.py", line 98, in main
options.nzones )
File "/usr/local/bin/shape_optimization.py", line 159, in shape_optimization
SU2.opt.SLSQP(project,x0,xb,its,accu)
File "/usr/local/bin/SU2/opt/scipy_tools.py", line 133, in scipy_slsqp
epsilon = eps )
File "/home/zhen17/app/anaconda3/lib/python3.7/site-packages/scipy/optimize/slsqp.py", line 208, in fmin_slsqp
constraints=cons, **opts)
File "/home/zhen17/app/anaconda3/lib/python3.7/site-packages/scipy/optimize/slsqp.py", line 399, in _minimize_slsqp
fx = func(x)
File "/home/zhen17/app/anaconda3/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 327, in function_wrapper
return function(*(wrapper_args + args))
File "/usr/local/bin/SU2/opt/scipy_tools.py", line 383, in obj_f
obj_list = project.obj_f(x)
File "/usr/local/bin/SU2/opt/project.py", line 237, in obj_f
return self._eval(konfig, func,dvs)
File "/usr/local/bin/SU2/opt/project.py", line 206, in _eval
vals = design._eval(func,*args)
File "/usr/local/bin/SU2/eval/design.py", line 147, in _eval
vals = eval_func(*inputs)
File "/usr/local/bin/SU2/eval/design.py", line 244, in obj_f
func += su2func(this_obj,config,state) * sign * scale * global_factor
File "/usr/local/bin/SU2/eval/functions.py", line 118, in function
func_out = state['FUNCTIONS'][func_name]
KeyError: 'INVERSE_DESIGN_PRESSURE'
When calculating separately, the SU2_CFD_AD works well, but the SU2_DOT fails and outputs the following:
Code:
-------------------------------------------------------------------------
| ___ _ _ ___ |
| / __| | | |_ ) Release 7.1.1 "Blackbird" |
| \__ \ |_| |/ / |
| |___/\___//___| Suite (Gradient Projection Code) |
| |
-------------------------------------------------------------------------
| SU2 Project Website: https://su2code.github.io |
| |
| The SU2 Project is maintained by the SU2 Foundation |
| (http://su2foundation.org) |
-------------------------------------------------------------------------
| Copyright 2012-2020, SU2 Contributors |
| |
| SU2 is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Lesser General Public |
| License as published by the Free Software Foundation; either |
| version 2.1 of the License, or (at your option) any later version. |
| |
| SU2 is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Lesser General Public License for more details. |
| |
| You should have received a copy of the GNU Lesser General Public |
| License along with SU2. If not, see <http://www.gnu.org/licenses/>. |
-------------------------------------------------------------------------
----------------- Physical Case Definition ( Zone 0 ) -------------------
Input mesh file name: Arina2Kmesh.su2
Input sensitivity file name: solution_adj_invpress.dat.
-------------- Surface deformation parameters ( Zone 0 ) ----------------
Design variables definition (markers <-> value <-> param):
Hicks Henne <-> WALL1 <-> 0.01 <-> ( 0, 0.5 )
---------------- Design problem definition ( Zone 0 ) ------------------
Inverse design (Cp) objective function.
-------------------- Output Information ( Zone 0 ) ----------------------
Output Volume Sensitivity file name: volume_sens.
Output Surface Sensitivity file name: surface_sens.
Output gradient file name: of_grad.dat.
------------- Config File Boundary Information ( Zone 0 ) ---------------
+-----------------------------------------------------------------------+
| Marker Type| Marker Name|
+-----------------------------------------------------------------------+
| Euler wall| WALL1|
+-----------------------------------------------------------------------+
| Symmetry plane| SYMMETRY|
+-----------------------------------------------------------------------+
| Inlet boundary| INFLOW|
+-----------------------------------------------------------------------+
| Outlet boundary| OUTFLOW|
+-----------------------------------------------------------------------+
Two dimensional problem.
1111 grid points.
2000 volume elements.
4 surface markers.
10 boundary elements in index 0 (Marker = INFLOW).
100 boundary elements in index 1 (Marker = WALL1).
10 boundary elements in index 2 (Marker = OUTFLOW).
100 boundary elements in index 3 (Marker = SYMMETRY).
2000 triangles.
Identify vertices.
Storing a mapping from global to local point index.
----------------------- Preprocessing computations ----------------------
Setting local point connectivity.
Checking the numerical grid orientation of the elements.
All volume elements are correctly orientend.
All surface elements are correctly orientend.
Identify edges and vertices.
Setting the bound control volume structure.
Storing a mapping from global to local point index.
Reading volume sensitivities at each node from file.
Reading in sensitivity at iteration 0.
---------------------- Mesh sensitivity computation ---------------------
Computing volumes of the grid elements.
Min. volume: 2.50135e-05, max. volume: 6.286e-05.
Min. distance: 0.00500837, max. distance: 0.125.
[node9:97674] *** Process received signal ***
[node9:97674] Signal: Segmentation fault (11)
[node9:97674] Signal code: Address not mapped (1)
[node9:97674] Failing at address: (nil)
[node9:97674] [ 0] /lib64/libpthread.so.0(+0xf6d0)[0x7f9ef7d886d0]
[node9:97674] [ 1] SU2_DOT[0x69898c]
[node9:97674] [ 2] SU2_DOT[0x7a8edb]
[node9:97674] [ 3] SU2_DOT[0x40d2ca]
[node9:97674] [ 4] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f9ef79ce445]
[node9:97674] [ 5] SU2_DOT[0x41df37]
[node9:97674] *** End of error message ***
Segmentation fault (core dumped)
2. How to separately call the SU2 components to do an optimization task, because I want to get the d(obj)_d(dv) to see what the code do and to verify the sensitivity calculation. Is the following correct after setting the file "test.cfg"?
Code:
SU2_CFD test.cfg
SU2_CFD_AD test.cfg
SU2_DOT test.cfg
I am new to SU2 and try to solve an inverse problem with new objective functions and design variables. There seem many things to do and thanks for the kind guide!
zhen
|