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
{{ message }}
Repository navigation
Commit 94e5c52
Browse filesBrowse the repository at this point in the historyBrowse files
The tutorial now uses the cavity.cfg shipped with the case, drops the run at 10 1/m, and shows the converged results at 1 1/m with TOTAL_HEATFLUX including the radiative wall flux. It states that the absorption coefficient is for demonstration only and explains the 0.6 percent gap between the discrete and the exact source.
Figure (1): Temperature and velocity direction in an air cavity heated by an elliptical source, without radiation (left) and with the P1 model at an absorption coefficient of 10 1/m (right).
15
+
Figure (1): Temperature and velocity direction in an air cavity heated by an elliptical source, without radiation (left) and with the P1 model at an absorption coefficient of 1 1/m (middle). The right panel shows how much the radiation cools the gas.
16
16
17
17
## Goals
18
18
@@ -25,7 +25,7 @@ In this tutorial we heat a closed air cavity with a volumetric heat source that
25
25
26
26
## Resources
27
27
28
-
The resources for this tutorial can be found in the [P1_radiation_python](https://github.com/su2code/Tutorials/tree/develop/multiphysics/P1_radiation_python) directory in the [tutorial repository](https://github.com/su2code/Tutorials). You only need the python script [run.py](https://github.com/su2code/Tutorials/tree/develop/multiphysics/P1_radiation_python/run.py). The script writes its own configuration file, and the mesh is generated by SU2 at run time, so there is no mesh file to download.
28
+
The resources for this tutorial can be found in the [P1_radiation_python](https://github.com/su2code/Tutorials/tree/develop/multiphysics/P1_radiation_python) directory in the [tutorial repository](https://github.com/su2code/Tutorials). You need the python script [run.py](https://github.com/su2code/Tutorials/tree/develop/multiphysics/P1_radiation_python/run.py) and the configuration file[cavity.cfg](https://github.com/su2code/Tutorials/tree/develop/multiphysics/P1_radiation_python/cavity.cfg). The mesh is generated by SU2 at run time, so there is no mesh file to download.
29
29
30
30
## Background
31
31
@@ -49,7 +49,7 @@ This makes it possible to add a heat source of any shape, or one that changes in
49
49
50
50
The domain is a square cavity of side 0.05 m filled with air at 300 K. All four walls are held at 300 K and have an emissivity of 1. Gravity acts in the negative y direction. Inside the cavity there is a heat source of 1e5 W/m^3 in an ellipse with semi-axes of 10 mm and 5 mm, centered at (25, 20) mm and rotated by 30 degrees. Its total strength is $$q \pi a b = 15.71$$ W per metre of depth.
51
51
52
-
We run the case three times, with no radiation and with the P1 model at absorption coefficients of 1 and 10 1/m. These correspond to optical thicknesses of 0.05 and 0.5 based on the cavity side.
52
+
We run the case twice, without radiation and with the P1 model at an absorption coefficient of 1 1/m, which gives an optical thickness $$\kappa L = 0.05$$ based on the cavity side. This value is for demonstration only. Real air is almost transparent to thermal radiation, and the absorption comes from gases such as water vapour and carbon dioxide, or from soot and particles. The P1 model is also at its least accurate in such a thin medium, as noted above. For a real application, take the absorption coefficient from a model of the gas mixture.
53
53
54
54
### Compiling SU2 with the python wrapper
55
55
@@ -64,7 +64,7 @@ The python wrapper needs `swig` and, for MPI, the `mpi4py` package built against
64
64
65
65
## Configuration File Options
66
66
67
-
The script writes the configuration file `cavity.cfg` from a string at the top of `run.py`. The options for the flow are the same as in other incompressible natural convection cases. The energy equation is switched on and the density follows the ideal gas law, so that the buoyancy is driven by the temperature differences.
67
+
The configuration file is `cavity.cfg`. The options for the flow are the same as in other incompressible natural convection cases. The energy equation is switched on and the density follows the ideal gas law, so that the buoyancy is driven by the temperature differences.
`TOTAL_HEATFLUX` is the conductive heat flux into the walls listed in `MARKER_MONITORING`. We print it on screen to check the energy balance.
106
+
`TOTAL_HEATFLUX` is the heat flux into the walls listed in `MARKER_MONITORING`. With a radiation model it contains both the conductive and the radiative heat flux into the walls, so it can be used to check the energy balance. The radiative part is the Marshak wall flux $$\Theta (G - 4 \sigma T_w^4)$$ with $$\Theta = \varepsilon / (2(2 - \varepsilon))$$.
107
+
108
+
SU2 solves the energy equation and the P1 equation one after the other, so the P1 residual falls more slowly than the enthalpy residual and stays about four orders above it. Both residuals are used to decide when the run has converged.
109
+
110
+
```
111
+
ITER= 10000
112
+
CONV_FIELD= RMS_ENTHALPY, RMS_RAD_ENERGY
113
+
CONV_RESIDUAL_MINVAL= -6
114
+
```
115
+
116
+
When the P1 residual reaches -6, the wall heat flux has settled to about 0.01 percent.
107
117
108
118
## The Python Script
109
119
110
-
After the configuration file is written, the script creates the driver. The constructor reads the configuration and builds the mesh and the solvers, but it does not iterate yet.
120
+
The script takes the configuration file as its first argument, and `cavity.cfg` when none is given. It then creates the driver. The constructor reads the configuration and builds the mesh and the solvers, but it does not iterate yet.
Next we find the flow solver and the index of the energy equation. The incompressible solver has the variables (pressure, velocity, enthalpy), so in 2D the energy equation has index 3.
The absorption coefficient is given as the argument of the script, and 0 switches the radiation model off.
161
+
Run the case with the absorption coefficient in `cavity.cfg` as follows.
152
162
153
163
```bash
154
-
python run.py 0
155
-
python run.py 1
156
-
python run.py 10
164
+
python run.py cavity.cfg
165
+
```
166
+
167
+
A second argument overrides the absorption coefficient. The script then writes a copy of the configuration file, such as `cavity_k0.cfg`, and runs that. An absorption coefficient of 0 switches the radiation model off.
168
+
169
+
```bash
170
+
python run.py cavity.cfg 0
157
171
```
158
172
159
173
The script can also run in parallel with MPI.
160
174
161
175
```bash
162
-
mpirun -n 4 python run.py 10
176
+
mpirun -n 4 python run.py cavity.cfg
163
177
```
164
178
165
-
Each run takes a minute or two on a single core of a laptop.
179
+
With radiation the run takes about 8800 iterations, which is about a minute and a half on 4 cores of a laptop. Without radiation it converges in about 900 iterations.
166
180
167
181
## Results
168
182
169
-
The table below shows the results of the three runs.
183
+
The table below shows the results of the two runs.
184
+
185
+
| Absorption coefficient (1/m) | Maximum temperature (K) | Heat into the walls, `TOTAL_HEATFLUX` (W/m) | Conductive part (W/m) | Radiative part (W/m) |
| Absorption coefficient (1/m) | Maximum temperature (K) | Conductive heat into the walls (W/m) | Share of the source |
172
-
|---|---|---|---|
173
-
| 0 (no radiation) | 325.7 | 15.81 | 100.6 % |
174
-
| 1 | 324.6 | 14.96 | 95.2 % |
175
-
| 10 | 319.6 | 10.91 | 69.5 % |
190
+
The exact strength of the source is 15.708 W/m, but both runs give 15.808 W/m, which is 0.6 percent more. This gap is not an error in the energy balance. SU2 stores the solution at the mesh points, and each point owns a small control volume around it. The script sets the source at a point to the full value when the point lies inside the ellipse and to zero when it does not. The heat added is therefore the source value times the total volume of the control volumes whose points lie inside the ellipse. That area is slightly larger than the exact area of the ellipse on this mesh. The gap shrinks as the mesh is refined, and it would vanish if the source were set to the fraction of each control volume that lies inside the ellipse. Since the heat into the walls matches the heat that was actually added, the energy balance closes in both runs.
176
191
177
-
Without radiation, all the heat from the source has to leave by conduction through the walls. The conductive heat flux is 15.81 W/m, against 15.71 W/m for the exact ellipse. The small difference comes from sampling the source at the mesh points. A point either lies inside the ellipse or it does not, so the discrete ellipse has a slightly different area from the exact one. It becomes smaller on a finer mesh.
192
+
With radiation, the total heat into the walls stays the same, but about 5 percent of it now arrives as radiation instead of conduction. The gas emits radiation where it is hot and absorbs it where it is cool, so the plume above the source cools by up to 1.2 K and the rest of the cavity cools a little less, as the right panel of figure (1) shows. The flow pattern, with a plume rising above the source and two counter-rotating cells, hardly changes.
178
193
179
-
With radiation, the conductive heat flux into the walls drops, because part of the heat now leaves the gas as radiation and is absorbed by the walls. `TOTAL_HEATFLUX` only contains the conductive part, so the difference with the source strength is the radiative part. At an absorption coefficient of 1 1/m, about 5 percent of the heat leaves by radiation. At 10 1/m this rises to about 30 percent, and the hot plume above the source is clearly cooler, as figure (1) shows. The flow pattern itself, with a plume rising above the source and two counter-rotating cells, hardly changes.
194
+
With a larger absorption coefficient, more of the heat leaves by radiation and the effect on the temperature grows. The coupling between the energy equation and the P1 equation also becomes stronger, and since SU2 solves them one after the other, the run then needs many more iterations to converge.
0 commit comments