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 6explicit time integration. The 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) 9with different problem definitions according to the application of interest. 10 11Build by using 12 13`make` 14 15and run with 16 17`./navierstokes` 18 19Available runtime options are: 20 21| Option | Meaning | 22| :----------------------- | :-----------------------------------------------------------------------------------------------| 23| `-ceed` | CEED resource specifier | 24| `-test` | Run in test mode | 25| `-problem` | Problem to solve (`advection`, `advection2d`, or `density_current`) | 26| `-stab` | Stabilization method | 27| `-implicit` | Use implicit time integartor formulation | 28| `-bc_wall` | Use wall boundary conditions on this list of faces | 29| `-bc_slip_x` | Use slip boundary conditions, for the x component, on this list of faces | 30| `-bc_slip_y` | Use slip boundary conditions, for the y component, on this list of faces | 31| `-bc_slip_z` | Use slip boundary conditions, for the z component, on this list of faces | 32| `-viz_refine` | Use regular refinement for visualization | 33| `-degree` | Polynomial degree of tensor product basis (must be >= 1) | 34| `-units_meter` | 1 meter in scaled length units | 35| `-units_second` | 1 second in scaled time units | 36| `-units_kilogram` | 1 kilogram in scaled mass units | 37| `-units_Kelvin` | 1 Kelvin in scaled temperature units | 38| `-theta0` | Reference potential temperature | 39| `-thetaC` | Perturbation of potential temperature | 40| `-P0` | Atmospheric pressure | 41| `-N` | Brunt-Vaisala frequency | 42| `-cv` | Heat capacity at constant volume | 43| `-cp` | Heat capacity at constant pressure | 44| `-g` | Gravitational acceleration | 45| `-lambda` | Stokes hypothesis second viscosity coefficient | 46| `-mu` | Shear dynamic viscosity coefficient | 47| `-k` | Thermal conductivity | 48| `-CtauS` | Scale coefficient for stabilization tau (nondimensional) | 49| `-strong_form` | Strong (1) or weak/integrated by parts (0) advection residual | 50| `-lx` | Length scale in x direction | 51| `-ly` | Length scale in y direction | 52| `-lz` | Length scale in z direction | 53| `-rc` | Characteristic radius of thermal bubble | 54| `-resx` | Resolution in x | 55| `-resy` | Resolution in y | 56| `-resz` | Resolution in z | 57| `-periodicity` | Periodicity per direction | 58| `-center` | Location of bubble center | 59| `-dc_axis` | Axis of density current cylindrical anomaly, or {0,0,0} for spherically symmetric | 60| `-output_freq` | Frequency of output, in number of steps | 61| `-continue` | Continue from previous solution | 62| `-degree` | Polynomial degree of tensor product basis | 63| `-qextra` | Number of extra quadrature points | 64| `-of` | Output folder | 65 66 67### Advection 68 69This problem solves the convection (advection) equation for the total (scalar) energy density, 70transported by the (vector) velocity field. 71 72This is 3D advection given in two formulations based upon the weak form. 73 74State Variables: 75 76 *q = ( rho, U<sub>1</sub>, U<sub>2</sub>, U<sub>3</sub>, E )* 77 78 *rho* - Mass Density 79 80 *U<sub>i</sub>* - Momentum Density , *U<sub>i</sub> = rho ui* 81 82 *E* - Total Energy Density, *E = rho Cv T + rho (u u) / 2 + rho g z* 83 84Advection Equation: 85 86 *dE/dt + div( E _u_ ) = 0* 87 88#### Initial Conditions 89 90Mass Density: 91 Constant mass density of 1.0 92 93Momentum Density: 94 Rotational field in x,y with no momentum in z 95 96Energy Density: 97 Maximum of 1. x0 decreasing linearly to 0. as radial distance increases 98 to 1/8, then 0. everywhere else 99 100#### Boundary Conditions 101 102Mass Density: 103 0.0 flux 104 105Momentum Density: 106 0.0 107 108Energy Density: 109 0.0 flux 110 111### Density Current 112 113This problem solves the full compressible Navier-Stokes equations, using 114operator composition and design of coupled solvers in the context of atmospheric 115modeling. This problem uses the formulation given in Semi-Implicit Formulations 116of the Navier-Stokes Equations: Application to Nonhydrostatic Atmospheric Modeling, 117Giraldo, Restelli, and Lauter (2010). 118 119The 3D compressible Navier-Stokes equations are formulated in conservation form with state 120variables of density, momentum density, and total energy density. 121 122State Variables: 123 124 *q = ( rho, U<sub>1</sub>, U<sub>2</sub>, U<sub>3</sub>, E )* 125 126 *rho* - Mass Density 127 128 *U<sub>i</sub>* - Momentum Density , *U<sub>i</sub> = rho u<sub>i</sub>* 129 130 *E* - Total Energy Density, *E = rho c<sub>v</sub> T + rho (u u) / 2 + rho g z* 131 132Navier-Stokes Equations: 133 134 *drho/dt + div( U ) = 0* 135 136 *dU/dt + div( rho (u x u) + P I<sub>3</sub> ) + rho g khat = div( F<sub>u</sub> )* 137 138 *dE/dt + div( (E + P) u ) = div( F<sub>e</sub> )* 139 140Viscous Stress: 141 142 *F<sub>u</sub> = mu (grad( u ) + grad( u )^T + lambda div ( u ) I<sub>3</sub>)* 143 144Thermal Stress: 145 146 *F<sub>e</sub> = u F<sub>u</sub> + k grad( T )* 147 148Equation of State: 149 150 *P = (gamma - 1) (E - rho (u u) / 2 - rho g z)* 151 152Temperature: 153 154 *T = (E / rho - (u u) / 2 - g z) / c<sub>v</sub>* 155 156Constants: 157 158 *lambda = - 2 / 3*, From Stokes hypothesis 159 160 *mu* , Dynamic viscosity 161 162 *k* , Thermal conductivity 163 164 *c<sub>v</sub>* , Specific heat, constant volume 165 166 *c<sub>p</sub>* , Specific heat, constant pressure 167 168 *g* , Gravity 169 170 *gamma = c<sub>p</sub> / c<sub>v</sub>*, Specific heat ratio 171 172#### Initial Conditions 173 174Potential Temperature: 175 176 *theta = thetabar + deltatheta* 177 178 *thetabar = theta0 exp( N * * 2 z / g )* 179 180 *deltatheta = 181 r <= rc : theta0(1 + cos(pi r)) / 2 182 r > rc : 0* 183 184 *r = sqrt( (x - xc) * * 2 + (y - yc) * * 2 + (z - zc) * * 2 )* 185 with *(xc,yc,zc)* center of domain 186 187Exner Pressure: 188 189 *Pi = Pibar + deltaPi* 190 191 *Pibar = g * * 2 (exp( - N * * 2 z / g ) - 1) / (cp theta0 N * * 2)* 192 193 *deltaPi = 0* (hydrostatic balance) 194 195Velocity/Momentum Density: 196 197 *U<sub>i</sub> = u<sub>i</sub> = 0* 198 199Conversion to Conserved Variables: 200 201 *rho = P0 Pi**(c<sub>v</sub>/R<sub>d</sub>) / (R<sub>d</sub> theta)* 202 203 *E = rho (c<sub>v</sub> theta Pi + (u u)/2 + g z)* 204 205Constants: 206 207 *theta0* , Potential temperature constant 208 209 *thetaC* , Potential temperature perturbation 210 211 *P0* , Pressure at the surface 212 213 *N* , Brunt-Vaisala frequency 214 215 *c<sub>v</sub>* , Specific heat, constant volume 216 217 *c<sub>p</sub>* , Specific heat, constant pressure 218 219 *R<sub>d</sub>* = c<sub>p</sub> - c<sub>v</sub>, Specific heat difference 220 221 *g* , Gravity 222 223 *r<sub>c</sub>* , Characteristic radius of thermal bubble 224 225 *l<sub>x</sub>* , Characteristic length scale of domain in x 226 227 *l<sub>y</sub>* , Characteristic length scale of domain in y 228 229 *l<sub>z</sub>* , Characteristic length scale of domain in z 230 231 232#### Boundary Conditions 233 234Mass Density: 235 0.0 flux 236 237Momentum Density: 238 0.0 239 240Energy Density: 241 0.0 flux 242 243### Time Discretization 244 245For all different problems, the time integration is performed with an explicit formulation, therefore 246it can be subject to numerical instability, if run for large times or with large time steps. 247 248### Space Discretization 249 250The geometric factors and coordinate transformations required for the integration of the weak form 251are described in the file [`common.h`](common.h) 252