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
Description
This PR updates the parameters of both the matrix-based and matrix-free TGV simulations according to the findings in the matrix-free article. To summarize:
BDF3 scheme was changed to BDF2.
Linear solver parameters were already tuned for the article, so we updated tolerances, number of iterations and krylov vectors accordingly.
The example was written with constant time step, which works well so it won't be changed. However, trying constant CFL was added as a suggestion and the script to calculate the kinetic energy rate for that case was already available in the example folder.
I do not think it is necessary to re run all the cases, so the part that talks about approximate times was left as it is.
Copy file name to clipboardexpand all lines: doc/source/examples/incompressible-flow/3d-taylor-green-vortex/3d-taylor-green-vortex.rst
+32-44
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Features
10
10
---------
11
11
12
12
- Solvers: ``lethe-fluid`` (with Q2-Q2) or ``lethe-fluid-matrix-free`` (with Q2-Q2 or Q3-Q3)
13
-
- Transient problem using ``bdf3`` time integrator
13
+
- Transient problem using ``bdf2`` time integrator
14
14
- Displays the calculation of enstrophy and total kinetic energy
15
15
16
16
@@ -34,13 +34,12 @@ The three velocity components :math:`[u_x,u_y,u_z]^T` and the pressure :math:`p`
34
34
35
35
.. math::
36
36
37
-
u_{x} &= \sin(x)*\cos(y)*\cos(z) \\
38
-
u_{y} &= -\cos(x)*\sin(y)*\cos(z)\\
37
+
u_{x} &= \sin(x)\cos(y)\cos(z) \\
38
+
u_{y} &= -\cos(x)\sin(y)\cos(z)\\
39
39
u_{z} &= 0 \\
40
-
p &= \frac{1}{16}*\left[\cos(2x)+\cos(2y)\right]\left[\cos(2z)+2\right]
41
-
42
-
In this case, the vortex, which is initially 2D, will decay by generating smaller 3D turbulent structures (vortex tubes, rings and sheets). This decay can be monitored through the total kinetic energy of the system. Since the simulation domain is periodic, it can be demontrated that the time derative of the total kinetic energy :math:`E_\mathrm{k}` is directly related to the enstrophy :math:`\mathcal{E}` such that:
40
+
p &= \frac{1}{16}\left[\cos(2x)+\cos(2y)\right]\left[\cos(2z)+2\right]
43
41
42
+
In this case, the vortex, which is initially 2D, will decay by generating smaller 3D turbulent structures (vortex tubes, rings and sheets). This decay can be monitored through the total kinetic energy of the system. Since the simulation domain is periodic, it can be demonstrated that the time derative of the total kinetic energy :math:`E_\mathrm{k}` is directly related to the enstrophy :math:`\mathcal{E}` such that:
44
43
45
44
46
45
.. math::
@@ -70,7 +69,7 @@ The ``mesh`` subsection specifies the computational grid:
70
69
set initial refinement = 5
71
70
end
72
71
73
-
The ``type`` specifies the mesh format used. We use the ``hyper_cube`` mesh generated from the deal.II `GridGenerator <https://www.dealii.org/current/doxygen/deal.II/namespaceGridGenerator.html>`_ . We set ``colorize = true`` to be able to adequately set-up the periodic boundary conditions.
72
+
The ``type`` specifies the mesh format used. We use the ``hyper_cube`` mesh generated from the deal.II `GridGenerator <https://www.dealii.org/current/doxygen/deal.II/namespaceGridGenerator.html>`_ . We set ``colorize = true`` (the last parameter of the grid arguments) to assign boundary condition ids to each of the walls of the cube.
74
73
75
74
76
75
The last parameter specifies the ``initial refinement`` of the grid. Indicating an ``initial refinement = 5`` implies that the initial mesh is refined 5 times. In 3D, each cell is divided by 8 per refinement. Consequently, the final grid is made of 32768 cells.
@@ -104,7 +103,7 @@ The ``boundary conditions`` subsection establishes the constraints on different
104
103
end
105
104
end
106
105
107
-
First, the ``number`` of boundary conditions to be applied must be specified. For each boundary condition, the ``id`` of the boundary as well as its ``type`` must be specified. All boundaries are ``periodic``. The ``x-`` (id=0) is periodic with the ``x+`` boundary (id=1), the ``y-`` (id=2) is periodic with the ``y+`` boundary (id=3) and so on and so forth. For each periodic boundary condition, the periodic direction must be specified. A periodic direction of ``0`` implies that the normal direction of the wall is the :math:`\mathbf{e}_x` vector, ``1`` implies that it's the :math:`\mathbf{e}_y`.
106
+
First, the ``number`` of boundary conditions to be applied must be specified. For each boundary condition, the ``id`` of the boundary as well as its ``type`` must be specified. All boundaries are ``periodic``. The ``x-`` boundary (id=0) is periodic with the ``x+`` boundary (id=1), the ``y-`` boundary (id=2) is periodic with the ``y+`` boundary (id=3) and so on and so forth. For each periodic boundary condition, the periodic direction must be specified. A periodic direction of ``0`` implies that the normal direction of the wall is the :math:`\mathbf{e}_x` vector, ``1`` implies that it's the :math:`\mathbf{e}_y`.
108
107
109
108
Physical Properties
110
109
~~~~~~~~~~~~~~~~~~~
@@ -124,7 +123,7 @@ The Reynolds number of 1600 is set solely using the kinematic viscosity since th
124
123
FEM Interpolation
125
124
~~~~~~~~~~~~~~~~~
126
125
127
-
The results obtained for the Taylor-Green vortex are highly dependent on the numerical dissipation that occurs within the CFD scheme. Generally, high-order methods outperform traditional second-order accurate methods for this type of flow. In the present case, we will investigate the usage of both second and third degree polynomial.
126
+
The results obtained for the Taylor-Green vortex are highly dependent on the numerical dissipation that occurs within the CFD scheme. Generally, high-order methods outperform traditional second-order accurate methods for this type of flow. In the present case, we will investigate the usage of both second and third degree polynomials.
128
127
129
128
.. code-block:: text
130
129
@@ -149,21 +148,19 @@ To monitor the kinetic energy and the enstrophy, we set both calculation to ``tr
149
148
Simulation Control
150
149
~~~~~~~~~~~~~~~~~~
151
150
152
-
The ``simulation control`` subsection controls the flow of the simulation. To maximize the temporal accuracy of the simulation, we use a third order ``bdf3`` scheme. Results are written every 2 time-steps. To ensure a more adequate visualization of the high-order elements, we set ``subdivision = 3``. This will allow Paraview to render the high-order solutions with more fidelity.
151
+
The ``simulation control`` subsection controls the flow of the simulation. To maximize the temporal accuracy of the simulation, we use a second order ``bdf2`` scheme. Results are written every 2 time-steps. To ensure a more adequate visualization of the high-order elements, we set ``subdivision = 3``. This will allow Paraview to render the high-order solutions with more fidelity.
153
152
154
153
.. code-block:: text
155
154
156
155
subsection simulation control
157
-
set method = bdf3
156
+
set method = bdf2
158
157
set time step = 0.05
159
-
set number mesh adapt = 0
160
158
set time end = 20
161
159
set output frequency = 2
162
160
set subdivision = 3
163
161
end
164
162
165
163
166
-
167
164
Matrix-based - Non-linear Solver
168
165
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169
166
@@ -192,12 +189,13 @@ Since this is a transient problem, the linear solver can be relatively simple. W
192
189
subsection fluid dynamics
193
190
set verbosity = verbose
194
191
set method = gmres
195
-
set max iters = 200
192
+
set max iters = 100
196
193
set max krylov vectors = 200
197
194
set relative residual = 1e-4
198
-
set minimum residual = 1e-12
195
+
set minimum residual = 1e-7
196
+
set preconditioner = ilu
199
197
set ilu preconditioner fill = 0
200
-
set ilu preconditioner absolute tolerance = 1e-12
198
+
set ilu preconditioner absolute tolerance = 1e-10
201
199
set ilu preconditioner relative tolerance = 1.00
202
200
end
203
201
end
@@ -225,45 +223,33 @@ The ``lethe-fluid-matrix-free`` has significantly more parameters for its linear
225
223
226
224
subsection linear solver
227
225
subsection fluid dynamics
228
-
set method = gmres
229
-
set max iters = 100
230
-
set relative residual = 1e-4
231
-
set minimum residual = 1e-7
232
-
set preconditioner = gcmg
233
-
set verbosity = verbos
226
+
set verbosity = verbose
227
+
set method = gmres
228
+
set max iters = 100
229
+
set max krylov vectors = 200
230
+
set relative residual = 1e-4
231
+
set minimum residual = 1e-7
232
+
set preconditioner = gcmg
234
233
235
234
# MG parameters
236
-
set mg verbosity = quiet
237
-
set mg min level = -1
238
-
set mg level min cells = 16
235
+
set mg verbosity = quiet
236
+
set mg enable hessians in jacobian = false
239
237
240
238
# Smoother
241
-
set mg smoother iterations = 10
239
+
set mg smoother iterations = 5
242
240
set mg smoother eig estimation = true
243
-
241
+
244
242
# Eigenvalue estimation parameters
245
243
set eig estimation smoothing range = 5
246
244
set eig estimation cg n iterations = 20
247
-
set eig estimation verbosity = verbose
245
+
set eig estimation verbosity = quiet
248
246
249
247
# Coarse-grid solver
250
-
set mg coarse grid solver = gmres
251
-
set mg gmres max iterations = 2000
252
-
set mg gmres tolerance = 1e-7
253
-
set mg gmres reduce = 1e-4
254
-
set mg gmres max krylov vectors = 30
255
-
set mg gmres preconditioner = ilu
256
-
set ilu preconditioner fill = 1
257
-
set ilu preconditioner absolute tolerance = 1e-10
258
-
set ilu preconditioner relative tolerance = 1.00
248
+
set mg coarse grid solver = direct
259
249
end
260
250
end
261
251
262
-
We set ``mg verbosity = quiet`` to prevent logging of the multigrid parameters during the simulation. Setting ``mg min level = -1`` ensures that the ``mg level min cells = 16`` parameter is used to determine the coarsest level. It is important to ensure that the Taylor-Green vortex has sufficient cells on the coarsest level since periodic boundary conditions are used. Indeed, using a coarsest level with a single cell can lead to a problematic situation where too few degrees of freedom are available on the coarsest level.
263
-
264
-
The ``smoother``, ``Eigenvalue estimation parameters`` and ``coarse-grid solver`` subsections are explained in the **Theory Guide** (under construction).
265
-
266
-
252
+
We set ``mg verbosity = quiet`` to prevent logging of the multigrid parameters during the simulation. The ``smoother``, ``Eigenvalue estimation parameters`` and ``coarse-grid solver`` subsections are explained in the :doc:`../../../parameters/cfd/linear_solver_control` section.
267
253
268
254
----------------------
269
255
Running the Simulation
@@ -304,14 +290,14 @@ Using the ``enstrophy.dat`` and ``kinetic_energy.dat`` files generated by Lethe,
- This case is very interesting to postprocess. Try to postprocess this case using other quantities (vorticity, q-criterion) and use the results to generate interesting animations. Feel free to share them with us!
358
344
345
+
- This case can also be used to experiment with adaptive time step. In the simulation control section add ``adapt = true`` and ``set max cfl = 1``, similar results should be obtained but with significantly less iterations as larger time steps are taken. To postprocess the results use the additional script ``calculate_dissipation_rate_constant_cfl.py`` given in the same folder to calculate the kinetic energy rate.
0 commit comments