Skip to content

Commit daa7ea9

Browse files
committed
small update
1 parent c05fdd1 commit daa7ea9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

_tutorials/design_features/Inc_Turbulent_Bend_Opt/Inc_Turbulent_Bend_Opt.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you have not done so already, please first have a look at the prerequisite tu
4242

4343
## Resources
4444

45-
You can find the resources for this tutorial in the folder [incompressible_flow/Inc_Turbulent_Bend](https://github.com/su2code/Tutorials/tree/master/incompressible_flow/Inc_Turbulent_Bend) and the respective subfolders. Note that the setup used in this tutorial uses a pipe bend with a shorter pipe lenght before and after the bend to reduce the computing time. We have also merged all wall boundaries and all symmetry planes into one wall boundary and one symemtry plane. The gmsh file is provided in the repository so you can create your own pipe bend(s) with it.
45+
You can find the resources for this tutorial in the folder [design/Inc_Turbulent_Bend_Wallfunctions](https://github.com/su2code/Tutorials/tree/master/design/Inc_Turbulent_Bend_Wallfunctions) and the respective subfolders. Note that the setup used in this tutorial uses a pipe bend with a shorter pipe length before and after the bend to reduce the computing time. We have also merged all wall boundaries and all symmetry planes into one wall boundary and one symmetry plane. The gmsh file is provided in the repository so you can create your own pipe bend(s) with it.
4646

4747
## 1. Basic setup of FFD box and FADO
4848
Usually, designs are created with a CAD tool. These designs are then discretized into a computational mesh for CFD analysis. When optimizing a design, we usually only have the discretized mesh available. We could manipulate the mesh nodes directly but this usually does not lead to very smooth deformations. Instead we modify our mesh using FFD boxes. The nodes of the FFD box are moved according to the design sensitivities, and the mesh nodes inside the FFD box are then smoothly deformed using Bezier curves (default) or B-splines.
@@ -85,7 +85,7 @@ For the optimization, we need to modify 2 things in our config file: **DV_KIND**
8585
Note that the meaning of the entries are *( FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp )* , meaning that after the keyword **BOX**, we get the 3 indices i,j,k of the FFD box, followed by the allowed displacement of that index in the x-,y- and z-direction. Mesh nodes in the symmetry plane only move in the symmetry plane, so symmetry is preserved.
8686

8787
The list of FFD control points can be created using:
88-
```
88+
```python
8989
s = "FFD_CONTROL_POINT"
9090
ffd_string = s
9191
for i in range((DX**NDIM)*NDIM - 1):
@@ -100,9 +100,9 @@ And we automatically replace the placeholder **\_\_FFD_CTRL_PTS\_\_** in the fad
100100
replace_dv_kind = Parameter([ffd_string], LabelReplacer("__FFD_CTRL_PTS__"))
101101
```
102102

103-
For the DV_PARAM string, we can use a similar piece of python code:
103+
For the **DV_PARAM** string, we can use a similar piece of python code:
104104

105-
```
105+
```python
106106
dv_param_string=""
107107
for idim in range(NDIM):
108108
xdim = ydim = zdim = "0.0"
@@ -116,12 +116,18 @@ for idim in range(NDIM):
116116
dv_param_string += s
117117
```
118118
which is replaced using:
119-
```
119+
```python
120120
replace_dv_param =Parameter([dv_param_string], LabelReplacer("__FFD_PARAM__"))
121121
```
122122

123123
The only thing we need to take care of now is to define the correct number of FFD nodes DX=6 and the correct dimension of the problem, NDIM=3. You could even get these values from the .su2 mesh file if you want!
124124

125+
In our config file sudo.cfg, we also use the following setting:
126+
```
127+
FFD_CONTINUITY= 1ST_DERIVATIVE
128+
```
129+
Which means that when the sides of the FFD box cuts through the mesh, then at the cut, we want the mesh deformation to stay first order continuous. If you do not do this, you might get sharp jumps in your mesh at the location of the intersection.
130+
125131
Unfortunately, if we use this unconstrained setup, the mesh deformation will be as shown in Figure (2) below:
126132

127133
![bend](../../../tutorials_files/design_features/Inc_Turbulent_Bend/mesh_deformation.png "Figure(2): bad mesh for unconstrained FFD box.")
@@ -135,14 +141,14 @@ The problem here is that the mesh nodes on the symmetry plane are not allowed to
135141
Since we disallow vertical movement in 2x(6x6)=72 nodes in the planes with $j=0$ and $j=1$, The total degrees of freedom is then $648 - 72 = 576$ d.o.f.
136142

137143
The number of design variables needs to be reduced by 2x6x6 and we need to remove 2x6x6 strings from the ffd_string:
138-
```
144+
```python
139145
nDV = nDV - 2*DX*DX
140146
ffd_string.replace(s+", ","",2*DX*DX)
141147
```
142148

143149
Additionally, we need to remove the vertical movement of the nodes in the plane with j=[0,1]:
144150

145-
```
151+
```python
146152
jlist = [0,1]
147153
dof = "0.0, 1.0, 0.0"
148154

@@ -160,12 +166,12 @@ Another modification to the configuration file that we would like to add is to r
160166

161167
We can do this with a simple *sed* command that searches and replaces the string in config.cfg in the working directory and then copies the config file back to the base dir:
162168

163-
```
169+
```python
164170
restart_yes="sed -i 's/RESTART_SOL= NO/RESTART_SOL= YES/' config.cfg && cp " + configCopy + " ../../"
165171
```
166172

167173
The easiest way to perform the update is to simply add it as another ExternalRun process:
168-
```
174+
```python
169175
update_restart = ExternalRun("UPDATE_RESTART",restart_yes,False) # True means sym links are used for addData
170176
update_restart.addData(configCopy)
171177
```
@@ -175,7 +181,7 @@ FADO copies the restart file and all other necessary files from the base directo
175181

176182
So what we will do now is every time after we run the primal solver, we copy the restart file from the working directory *OPTIM/DIRECT* back to the base dir.
177183

178-
```
184+
```python
179185
cfd_command = "mpirun -n " + ncores + " " + su2_run + "SU2_CFD " + configMaster + "&& cp restart.csv ../../solution.csv"
180186
```
181187

0 commit comments

Comments
 (0)