xref: /libCEED/examples/fluids/README.md (revision 465e63d4360400a97854f5fe9df5a988c6c958c5)
1## libCEED: Navier-Stokes Example
2
3This page provides a description of the Navier-Stokes example for the libCEED library, based on PETSc.
4
5HONEE, a more fully featured fluid dynamics solver, can be found on [GitLab](https://gitlab.com/phypid/honee).
6
7The Navier-Stokes problem solves the compressible Navier-Stokes equations in three dimensions using an explicit time integration.
8The state variables are mass density, momentum density, and energy density.
9
10The main Navier-Stokes solver for libCEED is defined in [`navierstokes.c`](navierstokes.c) with different problem definitions according to the application of interest.
11
12## Build instructions
13
14Build by using:
15
16`make`
17
18and run with:
19
20```
21./navierstokes -ceed [ceed] -problem [problem type] -degree [degree]
22```
23
24## Runtime options
25
26% inclusion-fluids-marker
27
28The Navier-Stokes mini-app is controlled via command-line options.
29The following options are common among all problem types:
30
31:::{list-table} Common Runtime Options
32:header-rows: 1
33
34* - Option
35  - Description
36  - Default value
37
38* - `-ceed`
39  - CEED resource specifier
40  - `/cpu/self/opt/blocked`
41
42* - `-test_type`
43  - Run in test mode and specify whether solution (`solver`) or turbulent statistics (`turb_spanstats`) output should be verified
44  - `none`
45
46* - `-compare_final_state_atol`
47  - Test absolute tolerance
48  - `1E-11`
49
50* - `-compare_final_state_filename`
51  - Test filename
52  -
53
54* - `-problem`
55  - Problem to solve (`advection`, `density_current`, `euler_vortex`, `shocktube`, `blasius`, `channel`, `gaussian_wave`, and `taylor_green`)
56  - `density_current`
57
58* - `-implicit`
59  - Use implicit time integrator formulation
60  -
61
62* - `-degree`
63  - Polynomial degree of tensor product basis (must be >= 1)
64  - `1`
65
66* - `-q_extra`
67  - Number of extra quadrature points
68  - `0`
69
70* - `-ts_monitor_solution`
71  - PETSc output format, such as `cgns:output-%d.cgns` (requires PETSc `--download-cgns`)
72  -
73
74* - `-ts_monitor_solution_interval`
75  - Number of time steps between visualization output frames.
76  - `1`
77
78* - `-viewer_cgns_batch_size`
79  - Number of frames written per CGNS file if the CGNS file name includes a format specifier (`%d`).
80  - `20`
81
82* - `-checkpoint_interval`
83  - Number of steps between writing binary checkpoints. `0` has no output, `-1` outputs final state only
84  - `10`
85
86* - `-checkpoint_vtk`
87  - Checkpoints include VTK (`*.vtu`) files for visualization. Consider `-ts_monitor_solution`instead.
88  - `false`
89
90* - `-viz_refine`
91  - Use regular refinement for VTK visualization
92  - `0`
93
94* - `-output_dir`
95  - Output directory for binary checkpoints and VTK files (if enabled).
96  - `.`
97
98* - `-output_add_stepnum2bin`
99  - Whether to add step numbers to output binary files
100  - `false`
101
102* - `-continue`
103  - Continue from previous solution (input is step number of previous solution)
104  - `0`
105
106* - `-continue_filename`
107  - Path to solution binary file from which to continue from
108  - `[output_dir]/ns-solution.bin`
109
110* - `-continue_time_filename`
111  - Path to time stamp binary file (only for legacy checkpoints)
112  - `[output_dir]/ns-time.bin`
113
114* - `-bc_wall`
115  - Use wall boundary conditions on this list of faces
116  -
117
118* - `-wall_comps`
119  - An array of constrained component numbers for wall BCs
120  -
121
122* - `-bc_slip`
123  - Use weak slip boundary condition on this list of faces
124  -
125
126* - `-bc_symmetry_x`
127  - Use symmetry boundary conditions, for the x component, on this list of faces
128  -
129
130* - `-bc_symmetry_y`
131  - Use symmetry boundary conditions, for the y component, on this list of faces
132  -
133
134* - `-bc_symmetry_z`
135  - Use symmetry boundary conditions, for the z component, on this list of faces
136  -
137
138* - `-bc_inflow`
139  - Use inflow boundary conditions on this list of faces
140  -
141
142* - `-bc_outflow`
143  - Use outflow boundary conditions on this list of faces
144  -
145
146* - `-bc_freestream`
147  - Use freestream boundary conditions on this list of faces
148  -
149
150* - `-ts_monitor_turbulence_spanstats_collect_interval`
151  - Number of timesteps between statistics collection
152  - `1`
153
154* - `-ts_monitor_turbulence_spanstats_viewer`
155  - Sets the PetscViewer for the statistics file writing, such as `cgns:output-%d.cgns` (requires PETSc `--download-cgns`). Also turns the statistics collection on.
156  -
157
158* - `-ts_monitor_turbulence_spanstats_viewer_interval`
159  - Number of timesteps between statistics file writing (`-1` means only at end of run)
160  - `-1`
161
162* - `-ts_monitor_turbulence_spanstats_viewer_cgns_batch_size`
163  - Number of frames written per CGNS file if the CGNS file name includes a format specifier (`%d`).
164  - `20`
165
166* - `-ts_monitor_wall_force`
167  - Viewer for the force on each no-slip wall, e.g., `ascii:force.csv:ascii_csv` to write a CSV file.
168  -
169
170* - `-mesh_transform`
171  - Transform the mesh, usually for an initial box mesh.
172  - `none`
173
174* - `-snes_view`
175  - View PETSc `SNES` nonlinear solver configuration
176  -
177
178* - `-log_view`
179  - View PETSc performance log
180  -
181
182* - `-help`
183  - View comprehensive information about run-time options
184  -
185:::
186
187For the case of a square/cubic mesh, the list of face indices to be used with `-bc_wall`, `bc_inflow`, `bc_outflow`, `bc_freestream`  and/or `-bc_symmetry_x`, `-bc_symmetry_y`, and `-bc_symmetry_z` are:
188
189:::{list-table} 2D Face ID Labels
190:header-rows: 1
191* - PETSc Face Name
192  - Cartesian direction
193  - Face ID
194
195* - faceMarkerBottom
196  - -z
197  - 1
198
199* - faceMarkerRight
200  - +x
201  - 2
202
203* - faceMarkerTop
204  - +z
205  - 3
206
207* - faceMarkerLeft
208  - -x
209  - 4
210:::
211
212:::{list-table} 3D Face ID Labels
213:header-rows: 1
214* - PETSc Face Name
215  - Cartesian direction
216  - Face ID
217
218* - faceMarkerBottom
219  - -z
220  - 1
221
222* - faceMarkerTop
223  - +z
224  - 2
225
226* - faceMarkerFront
227  - -y
228  - 3
229
230* - faceMarkerBack
231  - +y
232  - 4
233
234* - faceMarkerRight
235  - +x
236  - 5
237
238* - faceMarkerLeft
239  - -x
240  - 6
241:::
242
243### Boundary conditions
244
245Boundary conditions for compressible viscous flows are notoriously tricky.
246Here we offer some recommendations.
247
248#### Inflow
249
250If in a region where the flow velocity is known (e.g., away from viscous walls), use `bc_freestream`, which solves a Riemann problem and can handle inflow and outflow (simultaneously and dynamically).
251It is stable and the least reflective boundary condition for acoustics.
252
253If near a viscous wall, you may want a specified inflow profile.
254Use `bc_inflow` and see {ref}`example-blasius` and discussion of synthetic turbulence generation for ways to analytically generate developed inflow profiles.
255These conditions may be either weak or strong, with the latter specifying velocity and temperature as essential boundary conditions and evaluating a boundary integral for the mass flux.
256The strong approach gives sharper resolution of velocity structures.
257We have described the primitive variable formulation here; the conservative variants are similar, but not equivalent.
258
259#### Outflow
260
261If you know the complete exterior state, `bc_freestream` is the least reflective boundary condition, but is disruptive to viscous flow structures.
262If thermal anomalies must exit the domain, the Riemann solver must resolve the contact wave to avoid reflections.
263The default Riemann solver, HLLC, is sufficient in this regard while the simpler HLL converts thermal structures exiting the domain into grid-scale reflecting acoustics.
264
265If acoustic reflections are not a concern and/or the flow is impacted by walls or interior structures that you wish to resolve to near the boundary, choose `bc_outflow`. This condition (with default `outflow_type: riemann`) is stable for both inflow and outflow, so can be used in areas that have recirculation and lateral boundaries in which the flow fluctuates.
266
267The simpler `bc_outflow` variant, `outflow_type: pressure`, requires that the flow be a strict outflow (or the problem becomes ill-posed and the solver will diverge).
268In our experience, `riemann` is slightly less reflective but produces similar flows in cases of strict outflow.
269The `pressure` variant is retained to facilitate comparison with other codes, such as PHASTA-C, but we recommend `riemann` for general use.
270
271#### Periodicity
272
273PETSc provides two ways to specify periodicity:
274
2751. Topological periodicity, in which the donor and receiver dofs are the same, obtained using:
276
277```yaml
278dm_plex:
279  shape: box
280  box_faces: 10,12,4
281  box_bd: none,none,periodic
282```
283
284The coordinates for such cases are stored as a new field with special cell-based indexing to enable wrapping through the boundary.
285This choice of coordinates prevents evaluating boundary integrals that cross the periodicity, such as for the outflow Riemann problem in the presence of spanwise periodicity.
286
2872. Isoperiodicity, in which the donor and receiver dofs are distinct in local vectors. This is obtained using `zbox`, as in:
288
289```yaml
290dm_plex:
291  shape: zbox
292  box_faces: 10,12,4
293  box_bd: none,none,periodic
294```
295
296Isoperiodicity enables standard boundary integrals, and is recommended for general use.
297At the time of this writing, it only supports one direction of periodicity.
298The `zbox` method uses [Z-ordering](https://en.wikipedia.org/wiki/Z-order_curve) to construct the mesh in parallel and provide an adequate initial partition, which makes it higher performance and avoids needing a partitioning package.
299
300### Advection
301
302For testing purposes, there is a reduced mode for pure advection, which holds density $\rho$ and momentum density $\rho \bm u$ constant while advecting "total energy density" $E$.
303The advection problems can be run in both 2D and 3D, based on the DM defined for the problem.
304The following additional command-line options are available:
305
306:::{list-table} Advection Runtime Options
307:header-rows: 1
308
309* - Option
310  - Description
311  - Default value
312  - Unit
313
314* - `-rc`
315  - Characteristic radius of thermal bubble
316  - `1000`
317  - `m`
318
319* - `-units_meter`
320  - 1 meter in scaled length units
321  - `1E-2`
322  -
323
324* - `-units_second`
325  - 1 second in scaled time units
326  - `1E-2`
327  -
328
329* - `-units_kilogram`
330  - 1 kilogram in scaled mass units
331  - `1E-6`
332  -
333
334* - `-strong_form`
335  - Strong (1) or weak/integrated by parts (0) residual
336  - `0`
337  -
338
339* - `-stab`
340  - Stabilization method (`none`, `su`, or `supg`)
341  - `none`
342  -
343
344* - `-stab_tau`
345  - Formulation for $\tau$ in stabilization (`ctau`, `advdiff_shakib`)
346  - `ctau`
347  -
348
349* - `-Ctau_t`
350  - Scaling factor on the temporal portion of the $\tau$ formulation
351  - 0.
352  -
353
354* - `-Ctau_a`
355  - Scaling factor on the advection portion of the $\tau$ formulation
356  - $P^2$
357  -
358
359* - `-CtauS`
360  - Scale coefficient for stabilization tau (nondimensional)
361  - `0`
362  -
363
364* - `-wind_type`
365  - Wind type in Advection (`rotation` or `translation`)
366  - `rotation`
367  -
368
369* - `-wind_translation`
370  - Constant wind vector when `-wind_type translation`
371  - `1,0,0`
372  -
373
374* - `-diffusion_coeff`
375  - Diffusion coefficient
376  - `0`
377  -
378
379* - `-E_wind`
380  - Total energy of inflow wind when `-wind_type translation`
381  - `1E6`
382  - `J`
383
384* - `-advection_ic_type`
385  - Initial condition type, from `sphere`, `cylinder`, `cosine_hill`, and `skew`
386  - `sphere`
387  -
388
389* - `-bubble_continuity`
390  - Different shapes for `sphere` and `cylinder` initial conditions, from `smooth`, `back_sharp`, `thick`, or `cosine`
391  - `smooth`
392  -
393:::
394
395For 3D advection, an example of the `rotation` mode can be run with:
396
397```
398./navierstokes -problem advection -dm_plex_box_faces 10,10,10 -dm_plex_dim 3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 8000,8000,8000 -bc_wall 1,2,3,4,5,6 -wall_comps 4 -wind_type rotation -implicit -stab su
399```
400
401and the `translation` mode with:
402
403```
404./navierstokes -problem advection -dm_plex_box_faces 10,10,10 -dm_plex_dim 3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 8000,8000,8000 -wind_type translation -wind_translation .5,-1,0 -bc_inflow 1,2,3,4,5,6
405```
406
407For 2D advection, an example of the `rotation` mode can be run with:
408
409```
410./navierstokes -problem advection -dm_plex_box_faces 20,20 -dm_plex_box_lower 0,0 -dm_plex_box_upper 1000,1000 -bc_wall 1,2,3,4 -wall_comps 4 -wind_type rotation -implicit -stab supg
411```
412
413and the `translation` mode with:
414
415```
416./navierstokes -problem advection -dm_plex_box_faces 20,20 -dm_plex_box_lower 0,0 -dm_plex_box_upper 1000,1000 -units_meter 1e-4 -wind_type translation -wind_translation 1,-.5 -bc_inflow 1,2,3,4
417```
418Note the lengths in `-dm_plex_box_upper` are given in meters, and will be nondimensionalized according to `-units_meter`.
419
420### Inviscid Ideal Gas
421
422#### Isentropic Euler vortex
423
424For the Isentropic Vortex problem, the following additional command-line options are available:
425
426:::{list-table} Isentropic Vortex Runtime Options
427:header-rows: 1
428
429* - Option
430  - Description
431  - Default value
432  - Unit
433
434* - `-center`
435  - Location of vortex center
436  - `(lx,ly,lz)/2`
437  - `(m,m,m)`
438
439* - `-units_meter`
440  - 1 meter in scaled length units
441  - `1E-2`
442  -
443
444* - `-units_second`
445  - 1 second in scaled time units
446  - `1E-2`
447  -
448
449* - `-mean_velocity`
450  - Background velocity vector
451  - `(1,1,0)`
452  -
453
454* - `-vortex_strength`
455  - Strength of vortex < 10
456  - `5`
457  -
458
459* - `-c_tau`
460  - Stabilization constant
461  - `0.5`
462  -
463:::
464
465This problem can be run with:
466
467```
468./navierstokes -problem euler_vortex -dm_plex_box_faces 20,20,1 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1000,1000,50 -dm_plex_dim 3 -bc_inflow 4,6 -bc_outflow 3,5 -bc_symmetry_z 1,2 -mean_velocity .5,-.8,0.
469```
470
471#### Sod shock tube
472
473For the Shock Tube problem, the following additional command-line options are available:
474
475:::{list-table} Shock Tube Runtime Options
476:header-rows: 1
477
478* - Option
479  - Description
480  - Default value
481  - Unit
482
483* - `-units_meter`
484  - 1 meter in scaled length units
485  - `1E-2`
486  -
487
488* - `-units_second`
489  - 1 second in scaled time units
490  - `1E-2`
491  -
492
493* - `-yzb`
494  - Use YZB discontinuity capturing
495  - `none`
496  -
497
498* - `-stab`
499  - Stabilization method (`none`, `su`, or `supg`)
500  - `none`
501  -
502:::
503
504This problem can be run with:
505
506```
507./navierstokes -problem shocktube -yzb -stab su -bc_symmetry_z 3,4 -bc_symmetry_y 1,2 -bc_wall 5,6 -dm_plex_dim 3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1000,100,100 -dm_plex_box_faces 200,1,1 -units_second 0.1
508```
509
510### Newtonian viscosity, Ideal Gas
511
512For the Density Current, Channel, and Blasius problems, the following common command-line options are available:
513
514:::{list-table} Newtonian Ideal Gas problems Runtime Options
515:header-rows: 1
516
517* - Option
518  - Description
519  - Default value
520  - Unit
521
522* - `-units_meter`
523  - 1 meter in scaled length units
524  - `1`
525  -
526
527* - `-units_second`
528  - 1 second in scaled time units
529  - `1`
530  -
531
532* - `-units_kilogram`
533  - 1 kilogram in scaled mass units
534  - `1`
535  -
536
537* - `-units_Kelvin`
538  - 1 Kelvin in scaled temperature units
539  - `1`
540  -
541
542* - `-stab`
543  - Stabilization method (`none`, `su`, or `supg`)
544  - `none`
545  -
546
547* - `-c_tau`
548  - Stabilization constant, $c_\tau$
549  - `0.5`
550  -
551
552* - `-Ctau_t`
553  - Stabilization time constant, $C_t$
554  - `1.0`
555  -
556
557* - `-Ctau_v`
558  - Stabilization viscous constant, $C_v$
559  - `36, 60, 128 for degree = 1, 2, 3`
560  -
561
562* - `-Ctau_C`
563  - Stabilization continuity constant, $C_c$
564  - `1.0`
565  -
566
567* - `-Ctau_M`
568  - Stabilization momentum constant, $C_m$
569  - `1.0`
570  -
571
572* - `-Ctau_E`
573  - Stabilization energy constant, $C_E$
574  - `1.0`
575  -
576
577* - `-cv`
578  - Heat capacity at constant volume
579  - `717`
580  - `J/(kg K)`
581
582* - `-cp`
583  - Heat capacity at constant pressure
584  - `1004`
585  - `J/(kg K)`
586
587* - `-gravity`
588  - Gravitational acceleration vector
589  - `0,0,0`
590  - `m/s^2`
591
592* - `-lambda`
593  - Stokes hypothesis second viscosity coefficient
594  - `-2/3`
595  -
596
597* - `-mu`
598  - Shear dynamic viscosity coefficient
599  - `1.8e-5`
600  -  `Pa s`
601
602* - `-k`
603  - Thermal conductivity
604  - `0.02638`
605  - `W/(m K)`
606
607* - `-newtonian_unit_tests`
608  - Developer option to test properties
609  - `false`
610  - boolean
611
612* - `-state_var`
613  - State variables to solve solution with. `conservative` ($\rho, \rho \bm{u}, \rho e$), `primitive` ($P, \bm{u}, T$), or `entropy` ($\frac{\gamma - s}{\gamma - 1} - \frac{\rho}{P} (e - c_v T),\ \frac{\rho}{P} \bm{u},\ -\frac{\rho}{P}$) where  $s = \ln(P\rho^{-\gamma})$
614  - `conservative`
615  - string
616
617* - `-idl_decay_time`
618  - Characteristic timescale of the pressure deviance decay. The timestep is good starting point
619  - `-1` (disabled)
620  - `s`
621
622* - `-idl_start`
623  - Start of IDL in the x direction
624  - `0`
625  - `m`
626
627* - `-idl_length`
628  - Length of IDL in the positive x direction
629  - `0`
630  - `m`
631
632* - `-idl_pressure`
633  - Pressure used for IDL reference pressure
634  -  `-reference_pressure`
635  - `Pa`
636
637* - `-diff_filter_monitor`
638  - Enable differential filter TSMonitor
639  - `false`
640  - boolean
641
642* - `-diff_filter_grid_based_width`
643  - Use filter width based on the grid size
644  - `false`
645  - boolean
646
647* - `-diff_filter_width_scaling`
648  - Anisotropic scaling for filter width in wall-aligned coordinates (snz)
649  - `1,1,1`
650  - `m`
651
652* - `-diff_filter_kernel_scaling`
653  - Scaling to make differential kernel size equivalent to other filter kernels
654  - `0.1`
655  - `m^2`
656
657* - `-diff_filter_wall_damping_function`
658  - Damping function to use at the wall for anisotropic filtering (`none`, `van_driest`)
659  - `none`
660  - string
661
662* - `-diff_filter_wall_damping_constant`
663  - Constant for the wall-damping function. $A^+$ for `van_driest` damping function.
664  - 25
665  -
666
667* - `-diff_filter_friction_length`
668  - Friction length associated with the flow, $\delta_\nu$. Used in wall-damping functions
669  - 0
670  - `m`
671:::
672
673#### Gaussian Wave
674
675The Gaussian wave problem has the following command-line options in addition to the Newtonian Ideal Gas options:
676
677:::{list-table} Gaussian Wave Runtime Options
678:header-rows: 1
679
680* - Option
681  - Description
682  - Default value
683  - Unit
684
685* - `-freestream_riemann`
686  - Riemann solver for boundaries (HLL or HLLC)
687  - `hllc`
688  -
689
690* - `-freestream_velocity`
691  - Freestream velocity vector
692  - `0,0,0`
693  - `m/s`
694
695* - `-freestream_temperature`
696  - Freestream temperature
697  - `288`
698  - `K`
699
700* - `-freestream_pressure`
701  - Freestream pressure
702  - `1.01e5`
703  - `Pa`
704
705* - `-epicenter`
706  - Coordinates of center of perturbation
707  - `0,0,0`
708  - `m`
709
710* - `-amplitude`
711  - Amplitude of the perturbation
712  - `0.1`
713  -
714
715* - `-width`
716  - Width parameter of the perturbation
717  - `0.002`
718  - `m`
719
720:::
721
722This problem can be run with the `gaussianwave.yaml` file via:
723
724```
725./navierstokes -options_file gaussianwave.yaml
726```
727
728```{literalinclude} ../../../../../examples/fluids/gaussianwave.yaml
729:language: yaml
730```
731
732#### Vortex Shedding - Flow past Cylinder
733
734The vortex shedding, flow past cylinder problem has the following command-line options in addition to the Newtonian Ideal Gas options:
735
736:::{list-table} Vortex Shedding Runtime Options
737:header-rows: 1
738
739* - Option
740  - Description
741  - Default value
742  - Unit
743
744* - `-freestream_velocity`
745  - Freestream velocity vector
746  - `0,0,0`
747  - `m/s`
748
749* - `-freestream_temperature`
750  - Freestream temperature
751  - `288`
752  - `K`
753
754* - `-freestream_pressure`
755  - Freestream pressure
756  - `1.01e5`
757  - `Pa`
758
759:::
760
761The initial condition is taken from `-reference_temperature` and `-reference_pressure`.
762To run this problem, first generate a mesh:
763
764```console
765$ make -C examples/fluids/meshes
766```
767
768Then run by building the executable and running:
769
770```console
771$ make build/fluids-navierstokes
772$ mpiexec -n 6 build/fluids-navierstokes -options_file examples/fluids/vortexshedding.yaml -{ts,snes}_monitor_
773```
774
775The vortex shedding period is roughly 5.6 and this problem runs until time 100 (2000 time steps).
776The above run writes a file named `force.csv` (see `ts_monitor_wall_force` in `vortexshedding.yaml`), which can be postprocessed by running to create a figure showing lift and drag coefficients over time.
777
778```console
779$ python examples/fluids/postprocess/vortexshedding.py
780```
781
782```{literalinclude} ../../../../../examples/fluids/vortexshedding.yaml
783:language: yaml
784```
785
786#### Density current
787
788The Density Current problem has the following command-line options in addition to the Newtonian Ideal Gas options:
789
790:::{list-table} Density Current Runtime Options
791:header-rows: 1
792
793* - Option
794  - Description
795  - Default value
796  - Unit
797
798* - `-center`
799  - Location of bubble center
800  - `(lx,ly,lz)/2`
801  - `(m,m,m)`
802
803* - `-dc_axis`
804  - Axis of density current cylindrical anomaly, or `(0,0,0)` for spherically symmetric
805  - `(0,0,0)`
806  -
807
808* - `-rc`
809  - Characteristic radius of thermal bubble
810  - `1000`
811  - `m`
812
813* - `-theta0`
814  - Reference potential temperature
815  - `300`
816  - `K`
817
818* - `-thetaC`
819  - Perturbation of potential temperature
820  - `-15`
821  - `K`
822
823* - `-P0`
824  - Atmospheric pressure
825  - `1E5`
826  - `Pa`
827
828* - `-N`
829  - Brunt-Vaisala frequency
830  - `0.01`
831  - `1/s`
832:::
833
834This problem can be run with:
835
836```
837./navierstokes -problem density_current -dm_plex_box_faces 16,1,8 -degree 1 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 2000,125,1000 -dm_plex_dim 3 -rc 400. -bc_wall 1,2,5,6 -wall_comps 1,2,3 -bc_symmetry_y 3,4 -mu 75
838```
839
840#### Channel flow
841
842The Channel problem has the following command-line options in addition to the Newtonian Ideal Gas options:
843
844:::{list-table} Channel Runtime Options
845:header-rows: 1
846
847* - Option
848  - Description
849  - Default value
850  - Unit
851
852* - `-umax`
853  - Maximum/centerline velocity of the flow
854  - `10`
855  - `m/s`
856
857* - `-theta0`
858  - Reference potential temperature
859  - `300`
860  - `K`
861
862* - `-P0`
863  - Atmospheric pressure
864  - `1E5`
865  - `Pa`
866
867* - `-body_force_scale`
868  - Multiplier for body force (`-1` for flow reversal)
869  - 1
870  -
871:::
872
873This problem can be run with the `channel.yaml` file via:
874
875```
876./navierstokes -options_file channel.yaml
877```
878```{literalinclude} ../../../../../examples/fluids/channel.yaml
879:language: yaml
880```
881
882(example-blasius)=
883
884#### Blasius boundary layer
885
886The Blasius problem has the following command-line options in addition to the Newtonian Ideal Gas options:
887
888:::{list-table} Blasius Runtime Options
889:header-rows: 1
890
891* - Option
892  - Description
893  - Default value
894  - Unit
895
896* - `-velocity_infinity`
897  - Freestream velocity
898  - `40`
899  - `m/s`
900
901* - `-temperature_infinity`
902  - Freestream temperature
903  - `288`
904  - `K`
905
906* - `-pressure_infinity`
907  - Atmospheric pressure, also sets IDL reference pressure
908  - `1.01E5`
909  - `Pa`
910
911* - `-temperature_wall`
912  - Wall temperature
913  - `288`
914  - `K`
915
916* - `-delta0`
917  - Boundary layer height at the inflow
918  - `4.2e-3`
919  - `m`
920
921* - `-platemesh_modify_mesh`
922  - Whether to modify the mesh using the given options below.
923  - `false`
924  -
925
926* - `-platemesh_refine_height`
927  - Height at which `-platemesh_Ndelta` number of elements should refined into
928  - `5.9E-4`
929  - `m`
930
931* - `-platemesh_Ndelta`
932  - Number of elements to keep below `-platemesh_refine_height`
933  - `45`
934  -
935
936* - `-platemesh_growth`
937  - Growth rate of the elements in the refinement region
938  - `1.08`
939  -
940
941* - `-platemesh_top_angle`
942  - Downward angle of the top face of the domain. This face serves as an outlet.
943  - `5`
944  - `degrees`
945
946* - `-platemesh_y_node_locs_path`
947  - Path to file with y node locations. If empty, will use mesh warping instead.
948  - `""`
949  -
950
951* - `-stg_use`
952  - Whether to use STG for the inflow conditions
953  - `false`
954  -
955
956* - `-n_chebyshev`
957  - Number of Chebyshev terms
958  - `20`
959  -
960
961* - `-chebyshev_`
962  - Prefix for Chebyshev snes solve
963  -
964  -
965
966:::
967
968This problem can be run with the `blasius.yaml` file via:
969
970```
971./navierstokes -options_file blasius.yaml
972```
973
974```{literalinclude} ../../../../../examples/fluids/blasius.yaml
975:language: yaml
976```
977
978#### STG Inflow for Flat Plate
979
980Using the STG Inflow for the blasius problem adds the following command-line options:
981
982:::{list-table} Blasius Runtime Options
983:header-rows: 1
984
985* - Option
986  - Description
987  - Default value
988  - Unit
989
990* - `-stg_inflow_path`
991  - Path to the STGInflow file
992  - `./STGInflow.dat`
993  -
994
995* - `-stg_rand_path`
996  - Path to the STGRand file
997  - `./STGRand.dat`
998  -
999
1000* - `-stg_alpha`
1001  - Growth rate of the wavemodes
1002  - `1.01`
1003  -
1004
1005* - `-stg_u0`
1006  - Convective velocity, $U_0$
1007  - `0.0`
1008  - `m/s`
1009
1010* - `-stg_mean_only`
1011  - Only impose the mean velocity (no fluctutations)
1012  - `false`
1013  -
1014
1015* - `-stg_strong`
1016  - Strongly enforce the STG inflow boundary condition
1017  - `false`
1018  -
1019
1020* - `-stg_fluctuating_IC`
1021  - "Extrude" the fluctuations through the domain as an initial condition
1022  - `false`
1023  -
1024
1025* - `-stg_dx`
1026  - Set the element size in the x direction. Default is calculated for box meshes, assuming equispaced elements.
1027  -
1028  - `m`
1029
1030* - `-stg_h_scale_factor`
1031  - Scale element size for cutoff frequency calculation
1032  - $1/p$
1033  -
1034
1035:::
1036
1037This problem can be run with the `blasius.yaml` file via:
1038
1039```
1040./navierstokes -options_file blasius.yaml -stg_use true
1041```
1042
1043Note the added `-stg_use true` flag
1044This overrides the `stg: use: false` setting in the `blasius.yaml` file, enabling the use of the STG inflow.
1045