|
HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
2D Shallow Water Equations More...
Go to the source code of this file.
Data Structures | |
| struct | ShallowWater2D |
| Structure containing variables and parameters specific to the 2D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D ShallowWater equations. More... | |
Macros | |
| #define | _SHALLOW_WATER_2D_ "shallow-water-2d" |
| #define | _MODEL_NDIMS_ 2 |
| #define | _MODEL_NVARS_ 3 |
| #define | _ROE_ "roe" |
| #define | _LLF_ "llf-char" |
| #define | _XDIR_ 0 |
| #define | _YDIR_ 1 |
| #define | _ShallowWater2DGetFlowVar_(u, h, uvel, vvel) |
| #define | _ShallowWater2DSetFlux_(f, h, uvel, vvel, g, dir) |
| #define | _ShallowWater2DRoeAverage_(uavg, uL, uR, p) |
| #define | _ShallowWater2DEigenvalues_(u, D, p, dir) |
| #define | _ShallowWater2DLeftEigenvectors_(u, L, p, dir) |
| #define | _ShallowWater2DRightEigenvectors_(u, R, p, dir) |
Functions | |
| int | ShallowWater2DInitialize (void *, void *) |
| int | ShallowWater2DCleanup (void *) |
2D Shallow Water Equations
2D Shallow Water Equations
\begin{equation} \frac {\partial} {\partial t} \left[\begin{array}{c} h \\ hu \\ hv \end{array} \right] + \frac {\partial} {\partial x} \left[\begin{array}{c} hu \\ hu^2 + \frac{1}{2}gh^2 \\ huv \end{array} \right] + \frac {\partial} {\partial x} \left[\begin{array}{c} hv \\ huv \\ hv^2 + \frac{1}{2}gh^2 \end{array} \right] = \left[\begin{array}{c} 0 \\ -ghb_x \\ -ghb_y \end{array}\right] + \left[\begin{array}{c} 0 \\ fv \\ -fu \end{array}\right] \end{equation}
where \(h\) is the height, \(\left(u,v\right)\) are the velocity components, \(b(x,y)\) is the bottom topography, and \(g\) is the gravitational constant.
The Coriolis parameter \(f\) is defined as
\begin{equation} f = \hat{f} + \beta\left( y - \frac{D}{2} \right) \end{equation}
based on:
For the treatment of the topography gradient source term (well-balanced formulation), refer to:
Definition in file shallowwater2d.h.
| #define _SHALLOW_WATER_2D_ "shallow-water-2d" |
2D Shallow Water equations
Definition at line 43 of file shallowwater2d.h.
| #define _MODEL_NDIMS_ 2 |
Number of spatial dimensions
Definition at line 49 of file shallowwater2d.h.
| #define _MODEL_NVARS_ 3 |
Number of variables per grid point
Definition at line 51 of file shallowwater2d.h.
| #define _ROE_ "roe" |
Roe upwinding scheme
Definition at line 55 of file shallowwater2d.h.
| #define _LLF_ "llf-char" |
Local Lax-Friedrich upwinding scheme
Definition at line 57 of file shallowwater2d.h.
| #define _XDIR_ 0 |
dimension corresponding to the x spatial dimension
Definition at line 63 of file shallowwater2d.h.
| #define _YDIR_ 1 |
Definition at line 64 of file shallowwater2d.h.
| #define _ShallowWater2DGetFlowVar_ | ( | u, | |
| h, | |||
| uvel, | |||
| vvel | |||
| ) |
Compute the flow variables (height, velocity) from the conserved solution vector.
\begin{equation} {\bf u} = \left[\begin{array}{c} h \\ hu \\ hv \end{array}\right] \end{equation}
Definition at line 73 of file shallowwater2d.h.
| #define _ShallowWater2DSetFlux_ | ( | f, | |
| h, | |||
| uvel, | |||
| vvel, | |||
| g, | |||
| dir | |||
| ) |
Set the flux vector given the flow variables (height, velocity).
\begin{equation} {\bf F}\left({\bf u}\right) = \left\{\begin{array}{cc} \left[\begin{array}{c} hu \\ hu^2 + \frac{1}{2} gh^2 \\ huv \end{array}\right] & {\rm dir} = x \\ \left[\begin{array}{c} hv \\ huv \\ hv^2 + \frac{1}{2} gh^2 \end{array}\right] & {\rm dir} = y \\ \end{array}\right. \end{equation}
Definition at line 91 of file shallowwater2d.h.
| #define _ShallowWater2DRoeAverage_ | ( | uavg, | |
| uL, | |||
| uR, | |||
| p | |||
| ) |
Compute the Roe average of two conserved solution vectors.
Definition at line 108 of file shallowwater2d.h.
| #define _ShallowWater2DEigenvalues_ | ( | u, | |
| D, | |||
| p, | |||
| dir | |||
| ) |
Compute the eigenvalues, given the conserved solution vector. The eigenvalues are returned as a 3x3 matrix stored in row-major format. It is a diagonal matrix with the eigenvalues as diagonal elements. Admittedly, it is a wasteful way of storing the eigenvalues.
Definition at line 129 of file shallowwater2d.h.
| #define _ShallowWater2DLeftEigenvectors_ | ( | u, | |
| L, | |||
| p, | |||
| dir | |||
| ) |
Compute the matrix that has the left-eigenvectors as its rows. Stored in row-major format. Reference:
Definition at line 154 of file shallowwater2d.h.
| #define _ShallowWater2DRightEigenvectors_ | ( | u, | |
| R, | |||
| p, | |||
| dir | |||
| ) |
Compute the matrix that has the right-eigenvectors as its columns. Stored in row-major format.
Reference:
Definition at line 197 of file shallowwater2d.h.
| int ShallowWater2DInitialize | ( | void * | s, |
| void * | m | ||
| ) |
Function to initialize the 2D ShallowWater module
Function to initialize the 2D shallow water equations (ShallowWater2D) module: Sets the default parameters, read in and set physics-related parameters, and set the physics-related function pointers in HyPar.
| s | Solver object of type HyPar |
| m | Object of type MPIVariables containing MPI-related info |
Definition at line 37 of file ShallowWater2DInitialize.c.
| int ShallowWater2DCleanup | ( | void * | s | ) |
Function to clean up the 2D ShallowWater module
Function to clean up all physics-related allocations for the 2D shallow water equations
| s | Solver object of type HyPar |
Definition at line 10 of file ShallowWater2DCleanup.c.