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