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