You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _tutorials/design_features/Inc_Turbulent_Bend_Opt/Inc_Turbulent_Bend_Opt.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ If you have not done so already, please first have a look at the prerequisite tu
42
42
43
43
## Resources
44
44
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.
46
46
47
47
## 1. Basic setup of FFD box and FADO
48
48
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**
85
85
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.
86
86
87
87
The list of FFD control points can be created using:
88
-
```
88
+
```python
89
89
s ="FFD_CONTROL_POINT"
90
90
ffd_string = s
91
91
for i inrange((DX**NDIM)*NDIM-1):
@@ -100,9 +100,9 @@ And we automatically replace the placeholder **\_\_FFD_CTRL_PTS\_\_** in the fad
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!
124
124
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
+
125
131
Unfortunately, if we use this unconstrained setup, the mesh deformation will be as shown in Figure (2) below:
126
132
127
133
: 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
135
141
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.
136
142
137
143
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
139
145
nDV = nDV -2*DX*DX
140
146
ffd_string.replace(s+", ","",2*DX*DX)
141
147
```
142
148
143
149
Additionally, we need to remove the vertical movement of the nodes in the plane with j=[0,1]:
144
150
145
-
```
151
+
```python
146
152
jlist = [0,1]
147
153
dof ="0.0, 1.0, 0.0"
148
154
@@ -160,12 +166,12 @@ Another modification to the configuration file that we would like to add is to r
160
166
161
167
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:
The easiest way to perform the update is to simply add it as another ExternalRun process:
168
-
```
174
+
```python
169
175
update_restart = ExternalRun("UPDATE_RESTART",restart_yes,False) # True means sym links are used for addData
170
176
update_restart.addData(configCopy)
171
177
```
@@ -175,7 +181,7 @@ FADO copies the restart file and all other necessary files from the base directo
175
181
176
182
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.
0 commit comments