xref: /libCEED/examples/fluids/README.md (revision 43e1b16f0c7c5dbfae04543c0675e255f265ff67)
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
331This problem can be run with:
332
333```
334./navierstokes -problem euler_vortex -mean_velocity .5,-.8,0.
335```
336
337For the Density Current problem, the following additional command-line options are available:
338
339:::{list-table} Euler Vortex Runtime Options
340:header-rows: 1
341
342* - Option
343  - Description
344  - Default value
345  - Unit
346
347* - `-lx`
348  - Length scale in x direction
349  - `8000`
350  - `m`
351
352* - `-ly`
353  - Length scale in y direction
354  - `8000`
355  - `m`
356
357* - `-lz`
358  - Length scale in z direction
359  - `4000`
360  - `m`
361
362* - `-center`
363  - Location of bubble center
364  - `(lx,ly,lz)/2`
365  - `(m,m,m)`
366
367* - `-dc_axis`
368  - Axis of density current cylindrical anomaly, or `(0,0,0)` for spherically symmetric
369  - `(0,0,0)`
370  -
371
372* - `-rc`
373  - Characteristic radius of thermal bubble
374  - `1000`
375  - `m`
376
377* - `-bc_wall`
378  - Use wall boundary conditions on this list of faces
379  - `-`
380  -
381
382* - `-bc_slip_x`
383  - Use slip boundary conditions, for the x component, on this list of faces
384  - `5,6`
385  -
386
387* - `-bc_slip_y`
388  - Use slip boundary conditions, for the y component, on this list of faces
389  - `3,4`
390  -
391
392* - `-bc_slip_z`
393  - Use slip boundary conditions, for the z component, on this list of faces
394  - `1,2`
395  -
396
397* - `-units_meter`
398  - 1 meter in scaled length units
399  - `1E-2`
400  -
401
402* - `-units_second`
403  - 1 second in scaled time units
404  - `1E-2`
405  -
406
407* - `-units_kilogram`
408  - 1 kilogram in scaled mass units
409  - `1E-6`
410  -
411
412* - `-units_Kelvin`
413  - 1 Kelvin in scaled temperature units
414  - `1`
415  -
416
417* - `-stab`
418  - Stabilization method (`none`, `su`, or `supg`)
419  - `none`
420  -
421
422* - `-theta0`
423  - Reference potential temperature
424  - `300`
425  - `K`
426
427* - `-thetaC`
428  - Perturbation of potential temperature
429  - `-15`
430  - `K`
431
432* - `-P0`
433  - Atmospheric pressure
434  - `1E5`
435  - `Pa`
436
437* - `-N`
438  - Brunt-Vaisala frequency
439  - `0.01`
440  - `1/s`
441
442* - `-cv`
443  - Heat capacity at constant volume
444  - `717`
445  - `J/(kg K)`
446
447* - `-cp`
448  - Heat capacity at constant pressure
449  - `1004`
450  - `J/(kg K)`
451
452* - `-g`
453  - Gravitational acceleration
454  - `9.81`
455  - `m/s^2`
456
457* - `-lambda`
458  - Stokes hypothesis second viscosity coefficient
459  - `-2/3`
460  -
461
462* - `-mu`
463  - Shear dynamic viscosity coefficient
464  - `75`
465  -  `Pa s`
466
467* - `-k`
468  - Thermal conductivity
469  - `0.02638`
470  - `W/(m K)`
471:::
472
473For 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:
474
475* 2D:
476  - faceMarkerBottom = 1
477  - faceMarkerRight  = 2
478  - faceMarkerTop    = 3
479  - faceMarkerLeft   = 4
480* 3D:
481  - faceMarkerBottom = 1
482  - faceMarkerTop    = 2
483  - faceMarkerFront  = 3
484  - faceMarkerBack   = 4
485  - faceMarkerRight  = 5
486  - faceMarkerLeft   = 6
487
488This problem can be run with:
489
490```
491./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
492```
493