HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
2D Navier Stokes equations (compressible flows) More...
#include <basic.h>
Go to the source code of this file.
Data Structures | |
struct | NavierStokes2D |
Structure containing variables and parameters specific to the 2D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D Navier-Stokes equations. More... | |
Macros | |
#define | _NAVIER_STOKES_2D_ "navierstokes2d" |
#define | _MODEL_NDIMS_ 2 |
#define | _MODEL_NVARS_ 4 |
#define | _ROE_ "roe" |
#define | _RF_ "rf-char" |
#define | _LLF_ "llf-char" |
#define | _SWFS_ "steger-warming" |
#define | _RUSANOV_ "rusanov" |
#define | _XDIR_ 0 |
#define | _YDIR_ 1 |
#define | _NavierStokes2DGetFlowVar_(u, rho, vx, vy, e, P, gamma) |
#define | _NavierStokes2DSetFlux_(f, rho, vx, vy, e, P, dir) |
#define | _NavierStokes2DSetStiffFlux_(f, rho, vx, vy, e, P, dir, gamma) |
#define | _NavierStokes2DSetNonStiffFlux_(f, rho, vx, vy, e, P, dir, gamma) |
#define | _NavierStokes2DRoeAverage_(uavg, uL, uR, gamma) |
#define | _NavierStokes2DEigenvalues_(u, D, gamma, dir) |
#define | _NavierStokes2DLeftEigenvectors_(u, L, ga, dir) |
#define | _NavierStokes2DRightEigenvectors_(u, R, ga, dir) |
Functions | |
int | NavierStokes2DInitialize (void *, void *) |
int | NavierStokes2DCleanup (void *) |
2D Navier Stokes equations (compressible flows)
2D Navier-Stokes equations for viscous and inviscid compressible flows (with gravitational terms)
\begin{equation} \frac {\partial} {\partial t} \left[\begin{array}{c} \rho \\ \rho u \\ \rho v \\ e \end{array}\right] + \frac {\partial} {\partial x} \left[\begin{array}{c} \rho u \\ \rho u^2 + p \\ \rho u v \\ (e+p) u\end{array}\right] + \frac {\partial} {\partial y} \left[\begin{array}{c} \rho v \\ \rho u v \\ \rho v^2 + p \\ (e+p) v \end{array}\right] = \frac {\partial} {\partial x} \left[\begin{array}{c} 0 \\ \tau_{xx} \\ \tau_{yx} \\ u \tau_{xx} + v \tau_{yx} - q_x \end{array}\right] + \frac {\partial} {\partial y} \left[\begin{array}{c} 0 \\ \tau_{xy} \\ \tau_{yy} \\ u \tau_{xy} + v \tau_{yy} - q_y \end{array}\right] + \left[\begin{array}{c} 0 \\ -\rho {\bf g}\cdot{\bf \hat{i}} \\ -\rho {\bf g}\cdot{\bf \hat{j}} \\ -\rho u {\bf g}\cdot{\bf \hat{i}} - \rho v {\bf g}\cdot{\bf \hat{j}} \end{array}\right] \end{equation}
where \({\bf g}\) is the gravitational force vector per unit mass, \({\bf \hat{i}},{\bf \hat{j}}\) are the unit vectors along the x and y, the viscous terms are given by
\begin{align} \tau_{ij} &= \frac{\mu}{Re_\infty} \left[ \left( \frac{\partial u_i}{\partial x_j} + \frac{\partial u_j}{\partial x_i}\right) - \frac{2}{3}\frac{\partial u_k}{\partial x_k} \delta_{ij} \right], \\ q_i &= - \frac{\mu}{\left(\gamma-1\right)Re_\infty Pr} \frac{\partial T}{\partial x_i} \end{align}
with \(\mu\) being the viscosity coefficient (computed using Sutherland's law), and the equation of state is
\begin{equation} e = \frac {p} {\gamma-1} + \frac{1}{2} \rho \left(u^2 + v^2\right) \end{equation}
References for the governing equations (as well as non-dimensional form):-
Reference for the well-balanced treatment of gravitational source term:
Reference for the partitioning of the flux into its stiff (acoustic) and non-stiff (convective) components:
Definition in file navierstokes2d.h.
struct NavierStokes2D |
Structure containing variables and parameters specific to the 2D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D Navier-Stokes equations.
Definition at line 374 of file navierstokes2d.h.
Data Fields | ||
---|---|---|
double | gamma |
Ratio of heat capacities |
char | upw_choice[_MAX_STRING_SIZE_] |
choice of upwinding |
double | grav_x |
acceleration due to gravity in x |
double | grav_y |
acceleration due to gravity in y |
double | rho0 |
reference density at zero altitude for flows with gravity |
double | p0 |
reference pressure at zero altitude for flows with gravity |
double | Re |
Reynolds number |
double | Pr |
Prandtl number |
double | Minf |
Freestream Mach number |
double | C1 |
Sutherlands law constants |
double | C2 |
Sutherlands law constants |
double | R |
universal Gas constant |
double * | grav_field_f |
density variation function ( \(\varrho\)) for hydrostatic equilibrium for flows with gravity |
double * | grav_field_g |
pressure variation function ( \(\varrho\)) for hydrostatic equilibrium for flows with gravity |
double * | fast_jac |
"Fast" Jacobian of the flux function (comprising the acoustic modes) |
double * | solution |
array to store the solution at the beginning of each time step |
int | HB |
< Choice of hydrostatic balance for flows with gravity (1 - isothermal equilibrium, 2 - constant potential temperature 3 - stratified atmosphere with a Brunt-Vaisala frequency) |
double | N_bv |
the Brunt-Vaisala frequency for NavierStokes2D::HB = 3 |
double * | gpu_grav_field_f | |
double * | gpu_grav_field_g | |
double * | gpu_fast_jac | |
double * | gpu_solution |
#define _NAVIER_STOKES_2D_ "navierstokes2d" |
2D Navier Stokes equations
Definition at line 47 of file navierstokes2d.h.
#define _MODEL_NDIMS_ 2 |
Number of spatial dimensions
Definition at line 53 of file navierstokes2d.h.
#define _MODEL_NVARS_ 4 |
Number of variables per grid point
Definition at line 55 of file navierstokes2d.h.
#define _ROE_ "roe" |
Roe's upwinding scheme
Definition at line 59 of file navierstokes2d.h.
#define _RF_ "rf-char" |
Characteristic-based Roe-fixed scheme
Definition at line 61 of file navierstokes2d.h.
#define _LLF_ "llf-char" |
Characteristic-based local Lax-Friedrich scheme
Definition at line 63 of file navierstokes2d.h.
#define _SWFS_ "steger-warming" |
Steger-Warming flux splitting scheme
Definition at line 65 of file navierstokes2d.h.
#define _RUSANOV_ "rusanov" |
Rusanov's upwinding scheme
Definition at line 67 of file navierstokes2d.h.
#define _XDIR_ 0 |
dimension corresponding to the x spatial dimension
Definition at line 71 of file navierstokes2d.h.
#define _YDIR_ 1 |
dimension corresponding to the y spatial dimension
Definition at line 73 of file navierstokes2d.h.
#define _NavierStokes2DGetFlowVar_ | ( | u, | |
rho, | |||
vx, | |||
vy, | |||
e, | |||
P, | |||
gamma | |||
) |
Get the flow variables from the conserved solution vector.
\begin{equation} {\bf u} = \left[\begin{array}{c} \rho \\ \rho u \\ \rho v \\ e \end{array}\right] \end{equation}
Definition at line 81 of file navierstokes2d.h.
#define _NavierStokes2DSetFlux_ | ( | f, | |
rho, | |||
vx, | |||
vy, | |||
e, | |||
P, | |||
dir | |||
) |
Compute the flux vector, given the flow variables
\begin{eqnarray} dir = x, & {\bf f}\left({\bf u}\right) = \left[\begin{array}{c} \rho u \\ \rho u^2 + p \\ \rho u v \\ (e+p)u \end{array}\right], \\ dir = y, & {\bf f}\left({\bf u}\right) = \left[\begin{array}{c} \rho v \\ \rho u v \\ \rho v^2 + p \\ (e+p)v \end{array}\right] \end{eqnarray}
Definition at line 99 of file navierstokes2d.h.
#define _NavierStokes2DSetStiffFlux_ | ( | f, | |
rho, | |||
vx, | |||
vy, | |||
e, | |||
P, | |||
dir, | |||
gamma | |||
) |
Compute the stiff flux vector (comprising the acoustic modes only), given the flow variables
\begin{eqnarray} dir = x, & {\bf f}\left({\bf u}\right) = \left[\begin{array}{c} \frac{1}{\gamma}\rho u \\ \frac{1}{\gamma}\rho u^2 + p \\ \frac{1}{\gamma}\rho u v \\ (e+p)u - \frac{1}{2} \frac{\gamma-1}{\gamma}\rho\left(u^2+v^2\right)u \end{array}\right], \\ dir = y, & {\bf f}\left({\bf u}\right) = \left[\begin{array}{c} \frac{1}{\gamma}\rho v \\ \frac{1}{\gamma}\rho u v \\ \frac{1}{\gamma}\rho v^2 + p \\ (e+p)v - \frac{1}{2} \frac{\gamma-1}{\gamma}\rho\left(u^2+v^2\right)v \end{array}\right] \end{eqnarray}
Reference:
Definition at line 125 of file navierstokes2d.h.
#define _NavierStokes2DSetNonStiffFlux_ | ( | f, | |
rho, | |||
vx, | |||
vy, | |||
e, | |||
P, | |||
dir, | |||
gamma | |||
) |
Compute the non-stiff flux vector (comprising the entropy modes only), given the flow variables
\begin{eqnarray} dir = x, & {\bf f}\left({\bf u}\right) = \left[\begin{array}{c} \frac{\gamma-1}{\gamma}\rho u \\ \frac{\gamma-1}{\gamma}\rho u^2 \\ \frac{\gamma-11}{\gamma}\rho u v \\ \frac{1}{2} \frac{\gamma-1}{\gamma}\rho\left(u^2+v^2\right)u \end{array}\right], \\ dir = y, & {\bf f}\left({\bf u}\right) = \left[\begin{array}{c} \frac{\gamma-1}{\gamma}\rho v \\ \frac{\gamma-1}{\gamma}\rho u v \\ \frac{\gamma-1}{\gamma}\rho v^2 \\ \frac{1}{2} \frac{\gamma-1}{\gamma}\rho\left(u^2+v^2\right)v \end{array}\right] \end{eqnarray}
Reference:
Definition at line 152 of file navierstokes2d.h.
#define _NavierStokes2DRoeAverage_ | ( | uavg, | |
uL, | |||
uR, | |||
gamma | |||
) |
Compute the Roe-average of two solutions.
Definition at line 171 of file navierstokes2d.h.
#define _NavierStokes2DEigenvalues_ | ( | u, | |
D, | |||
gamma, | |||
dir | |||
) |
Compute the eigenvalues, given a solution vector in terms of the conserved variables. The eigenvalues are returned as a matrix D whose diagonal values are the eigenvalues. Admittedly, this is inefficient. The matrix D is stored in a row-major format.
Definition at line 213 of file navierstokes2d.h.
#define _NavierStokes2DLeftEigenvectors_ | ( | u, | |
L, | |||
ga, | |||
dir | |||
) |
Compute the left eigenvectors, given a solution vector in terms of the conserved variables. The eigenvectors are returned as a matrix L whose rows correspond to each eigenvector. The matrix L is stored in the row-major format.
Reference:
Definition at line 247 of file navierstokes2d.h.
#define _NavierStokes2DRightEigenvectors_ | ( | u, | |
R, | |||
ga, | |||
dir | |||
) |
Compute the right eigenvectors, given a solution vector in terms of the conserved variables. The eigenvectors are returned as a matrix R whose columns correspond to each eigenvector. The matrix R is stored in the row-major format.
Reference:
Definition at line 309 of file navierstokes2d.h.
int NavierStokes2DInitialize | ( | void * | s, |
void * | m | ||
) |
Initialize the 2D Navier-Stokes (NavierStokes2D) module: Sets the default parameters, read in and set physics-related parameters, and set the physics-related function pointers in HyPar.
This file reads the file "physics.inp" that must have the following format:
begin <keyword> <value> <keyword> <value> <keyword> <value> ... <keyword> <value> end
where the list of keywords are:
Keyword name | Type | Variable | Default value |
---|---|---|---|
gamma | double | NavierStokes2D::gamma | 1.4 |
Pr | double | NavierStokes2D::Pr | 0.72 |
Re | double | NavierStokes2D::Re | -1 |
Minf | double | NavierStokes2D::Minf | 1.0 |
gravity | double,double | NavierStokes2D::grav_x,NavierStokes2D::grav_y | 0.0,0.0 |
rho_ref | double | NavierStokes2D::rho0 | 1.0 |
p_ref | double | NavierStokes2D::p0 | 1.0 |
HB | int | NavierStokes2D::HB | 1 |
R | double | NavierStokes2D::R | 1.0 |
upwinding | char[] | NavierStokes2D::upw_choice | "roe" (_ROE_) |
If "HB" (NavierStokes2D::HB) is specified as 3, it should be followed by the the Brunt-Vaisala frequency (NavierStokes2D::N_bv), i.e.
begin ... HB 3 0.01 ... end
Note: "physics.inp" is optional; if absent, default values will be used.
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
Definition at line 103 of file NavierStokes2DInitialize.c.
int NavierStokes2DCleanup | ( | void * | s | ) |
Function to clean up all allocations in the 2D Navier Stokes module.
s | Object of type NavierStokes2D |
Definition at line 11 of file NavierStokes2DCleanup.c.