xref: /libCEED/examples/fluids/README.md (revision d8dd9a912dc9d585dc5c0667639a4157f4b711a3)
1## libCEED: Navier-Stokes Example
2
3This page provides a description of the Navier-Stokes example for the libCEED library, based on PETSc.
4
5The Navier-Stokes problem solves the compressible Navier-Stokes equations in three dimensions using an explicit time integration.
6The state variables are mass density, momentum density, and energy density.
7
8The main Navier-Stokes solver for libCEED is defined in [`navierstokes.c`](navierstokes.c) with different problem definitions according to the application of interest.
9
10Build by using:
11
12`make`
13
14and run with:
15
16```
17./navierstokes -ceed [ceed] -problem [problem type] -degree [degree]
18```
19
20## Runtime options
21
22% inclusion-fluids-marker
23
24The Navier-Stokes mini-app is controlled via command-line options.
25The following options are common among all problem types:
26
27:::{list-table} Common Runtime Options
28:header-rows: 1
29
30* - Option
31  - Description
32  - Default value
33
34* - `-ceed`
35  - CEED resource specifier
36  - `/cpu/self/opt/blocked`
37
38* - `-test`
39  - Run in test mode
40  - `false`
41
42* - `-compare_final_state_atol`
43  - Test absolute tolerance
44  - `1E-11`
45
46* - `-compare_final_state_filename`
47  - Test filename
48  -
49
50* - `-problem`
51  - Problem to solve (`advection`, `advection2d`, `density_current`, or `euler_vortex`)
52  - `density_current`
53
54* - `-implicit`
55  - Use implicit time integartor formulation
56  -
57
58* - `-degree`
59  - Polynomial degree of tensor product basis (must be >= 1)
60  - `1`
61
62* - `-qextra`
63  - Number of extra quadrature points
64  - `2`
65
66* - `-viz_refine`
67  - Use regular refinement for visualization
68  - `0`
69
70* - `-output_freq`
71  - Frequency of output, in number of steps
72  - `10`
73
74* - `-continue`
75  - Continue from previous solution
76  - `0`
77
78* - `-output_dir`
79  - Output directory
80  - `.`
81
82* - `-dm_plex_box_faces`
83  - Number of faces in each linear direction
84  - `3,3,3`
85
86* - `-snes_view`
87  - View PETSc `SNES` nonlinear solver configuration
88  -
89
90* - `-log_view`
91  - View PETSc performance log
92  -
93
94* - `-help`
95  - View comprehensive information about run-time options
96  -
97:::
98
99For the 2D advection problem, the following additional command-line options are available:
100
101:::{list-table} Advection2D Runtime Options
102:header-rows: 1
103
104* - Option
105  - Description
106  - Default value
107  - Unit
108
109* - `-lx`
110  - Length scale in x direction
111  - `8000`
112  - `m`
113
114* - `-ly`
115  - Length scale in y direction
116  - `8000`
117  - `m`
118
119* - `-rc`
120  - Characteristic radius of thermal bubble
121  - `1000`
122  - `m`
123
124* - `-units_meter`
125  - 1 meter in scaled length units
126  - `1E-2`
127  -
128
129* - `-units_second`
130  - 1 second in scaled time units
131  - `1E-2`
132  -
133
134* - `-units_kilogram`
135  - 1 kilogram in scaled mass units
136  - `1E-6`
137  -
138
139* - `-strong_form`
140  - Strong (1) or weak/integrated by parts (0) residual
141  - `0`
142  -
143
144* - `-stab`
145  - Stabilization method (`none`, `su`, or `supg`)
146  - `none`
147  -
148
149* - `-CtauS`
150  - Scale coefficient for stabilization tau (nondimensional)
151  - `0`
152  -
153
154* - `-wind_type`
155  - Wind type in Advection (`rotation` or `translation`)
156  - `rotation`
157  -
158
159* - `-wind_translation`
160  - Constant wind vector when `-wind_type translation`
161  - `1,0,0`
162  -
163
164* - `-E_wind`
165  - Total energy of inflow wind when `-wind_type translation`
166  - `1E6`
167  - `J`
168:::
169
170An example of the `rotation` mode can be run with:
171
172```
173./navierstokes -problem advection2d -wind_type rotation -implicit -stab supg
174```
175
176and the `translation` mode with:
177
178```
179./navierstokes -problem advection2d -wind_type translation -wind_translation 1,-.5
180```
181
182For the 3D advection problem, the following additional command-line options are available:
183
184:::{list-table} Advection3D Runtime Options
185:header-rows: 1
186
187* - Option
188  - Description
189  - Default value
190  - Unit
191
192* - `-lx`
193  - Length scale in x direction
194  - `8000`
195  - `m`
196
197* - `-ly`
198  - Length scale in y direction
199  - `8000`
200  - `m`
201
202* - `-lz`
203  - Length scale in z direction
204  - `4000`
205  - `m`
206
207* - `-rc`
208  - Characteristic radius of thermal bubble
209  - `1000`
210  - `m`
211
212* - `-units_meter`
213  - 1 meter in scaled length units
214  - `1E-2`
215  -
216
217* - `-units_second`
218  - 1 second in scaled time units
219  - `1E-2`
220  -
221
222* - `-units_kilogram`
223  - 1 kilogram in scaled mass units
224  - `1E-6`
225  -
226
227* - `-strong_form`
228  - Strong (1) or weak/integrated by parts (0) residual
229  - `0`
230  -
231
232* - `-stab`
233  - Stabilization method (`none`, `su`, or `supg`)
234  - `none`
235  -
236
237* - `-CtauS`
238  - Scale coefficient for stabilization tau (nondimensional)
239  - `0`
240  -
241
242* - `-wind_type`
243  - Wind type in Advection (`rotation` or `translation`)
244  - `rotation`
245  -
246
247* - `-wind_translation`
248  - Constant wind vector when `-wind_type translation`
249  - `1,0,0`
250  -
251
252* - `-E_wind`
253  - Total energy of inflow wind when `-wind_type translation`
254  - `1E6`
255  - `J`
256
257* - `-bubble_type`
258  - `sphere` (3D) or `cylinder` (2D)
259  - `shpere`
260  -
261
262* - `-bubble_continuity`
263  - `smooth`, `back_sharp`, or `thick`
264  - `smooth`
265  -
266:::
267
268An example of the `rotation` mode can be run with:
269
270```
271./navierstokes -problem advection -wind_type rotation -implicit -stab supg
272```
273
274and the `translation` mode with:
275
276```
277./navierstokes -problem advection -wind_type translation -wind_translation .5,-1,0
278```
279
280For the Isentropic Vortex problem, the following additional command-line options are available:
281
282:::{list-table} Isentropic Vortex Runtime Options
283:header-rows: 1
284
285* - Option
286  - Description
287  - Default value
288  - Unit
289
290* - `-lx`
291  - Length scale in x direction
292  - `1000`
293  - `m`
294
295* - `-ly`
296  - Length scale in y direction
297  - `1000`
298  - `m`
299
300* - `-lz`
301  - Length scale in z direction
302  - `1`
303  - `m`
304
305* - `-center`
306  - Location of vortex center
307  - `(lx,ly,lz)/2`
308  - `(m,m,m)`
309
310* - `-units_meter`
311  - 1 meter in scaled length units
312  - `1E-2`
313  -
314
315* - `-units_second`
316  - 1 second in scaled time units
317  - `1E-2`
318  -
319
320* - `-mean_velocity`
321  - Background velocity vector
322  - `(1,1,0)`
323  -
324
325* - `-vortex_strength`
326  - Strength of vortex < 10
327  - `5`
328  -
329
330* - `-c_tau`
331  - Stabilization constant
332  - `0.5`
333  -
334:::
335
336This problem can be run with:
337
338```
339./navierstokes -problem euler_vortex -mean_velocity .5,-.8,0.
340```
341
342For the Density Current problem, the following additional command-line options are available:
343
344:::{list-table} Euler Vortex Runtime Options
345:header-rows: 1
346
347* - Option
348  - Description
349  - Default value
350  - Unit
351
352* - `-lx`
353  - Length scale in x direction
354  - `8000`
355  - `m`
356
357* - `-ly`
358  - Length scale in y direction
359  - `8000`
360  - `m`
361
362* - `-lz`
363  - Length scale in z direction
364  - `4000`
365  - `m`
366
367* - `-center`
368  - Location of bubble center
369  - `(lx,ly,lz)/2`
370  - `(m,m,m)`
371
372* - `-dc_axis`
373  - Axis of density current cylindrical anomaly, or `(0,0,0)` for spherically symmetric
374  - `(0,0,0)`
375  -
376
377* - `-rc`
378  - Characteristic radius of thermal bubble
379  - `1000`
380  - `m`
381
382* - `-bc_wall`
383  - Use wall boundary conditions on this list of faces
384  - `-`
385  -
386
387* - `-bc_slip_x`
388  - Use slip boundary conditions, for the x component, on this list of faces
389  - `5,6`
390  -
391
392* - `-bc_slip_y`
393  - Use slip boundary conditions, for the y component, on this list of faces
394  - `3,4`
395  -
396
397* - `-bc_slip_z`
398  - Use slip boundary conditions, for the z component, on this list of faces
399  - `1,2`
400  -
401
402* - `-units_meter`
403  - 1 meter in scaled length units
404  - `1E-2`
405  -
406
407* - `-units_second`
408  - 1 second in scaled time units
409  - `1E-2`
410  -
411
412* - `-units_kilogram`
413  - 1 kilogram in scaled mass units
414  - `1E-6`
415  -
416
417* - `-units_Kelvin`
418  - 1 Kelvin in scaled temperature units
419  - `1`
420  -
421
422* - `-stab`
423  - Stabilization method (`none`, `su`, or `supg`)
424  - `none`
425  -
426
427* - `-c_tau`
428  - Stabilization constant
429  - `0.5`
430  -
431
432* - `-theta0`
433  - Reference potential temperature
434  - `300`
435  - `K`
436
437* - `-thetaC`
438  - Perturbation of potential temperature
439  - `-15`
440  - `K`
441
442* - `-P0`
443  - Atmospheric pressure
444  - `1E5`
445  - `Pa`
446
447* - `-N`
448  - Brunt-Vaisala frequency
449  - `0.01`
450  - `1/s`
451
452* - `-cv`
453  - Heat capacity at constant volume
454  - `717`
455  - `J/(kg K)`
456
457* - `-cp`
458  - Heat capacity at constant pressure
459  - `1004`
460  - `J/(kg K)`
461
462* - `-g`
463  - Gravitational acceleration
464  - `9.81`
465  - `m/s^2`
466
467* - `-lambda`
468  - Stokes hypothesis second viscosity coefficient
469  - `-2/3`
470  -
471
472* - `-mu`
473  - Shear dynamic viscosity coefficient
474  - `75`
475  -  `Pa s`
476
477* - `-k`
478  - Thermal conductivity
479  - `0.02638`
480  - `W/(m K)`
481:::
482
483For the case of a square/cubic mesh, the list of face indices to be used with `-bc_wall` and/or `-bc_slip_x`, `-bc_slip_y`, and `-bc_slip_z` are:
484
485* 2D:
486  - faceMarkerBottom = 1
487  - faceMarkerRight  = 2
488  - faceMarkerTop    = 3
489  - faceMarkerLeft   = 4
490* 3D:
491  - faceMarkerBottom = 1
492  - faceMarkerTop    = 2
493  - faceMarkerFront  = 3
494  - faceMarkerBack   = 4
495  - faceMarkerRight  = 5
496  - faceMarkerLeft   = 6
497
498This problem can be run with:
499
500```
501./navierstokes -problem density_current -dm_plex_box_faces 16,1,8 -degree 1 -lx 2000 -ly 125 -lz 1000 -rc 400. -bc_wall 1,2,5,6 -bc_slip_y 3,4 -viz_refine 2
502```
503