HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Compute the gravitational source term for the 3D Navier Stokes system. More...
#include <stdlib.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <physicalmodels/navierstokes3d.h>
#include <mpivars.h>
#include <hypar.h>
Go to the source code of this file.
Functions | |
int | NavierStokes3DSourceFunction (double *, double *, double *, void *, void *, double, int) |
int | NavierStokes3DSourceUpwind (double *, double *, double *, double *, int, void *, double) |
int | NavierStokes3DSource (double *source, double *u, void *s, void *m, double t) |
Compute the gravitational source term for the 3D Navier Stokes system.
Definition in file NavierStokes3DSource.c.
int NavierStokes3DSourceFunction | ( | double * | f, |
double * | u, | ||
double * | x, | ||
void * | s, | ||
void * | m, | ||
double | t, | ||
int | dir | ||
) |
Compute the source function in the well-balanced treatment of the source terms. The source function is:
\begin{equation} dir = x \rightarrow \left[\begin{array}{c}0 \\ \varphi\left(x,y,z\right) \\ 0 \\ 0 \\ \varphi\left(x,y,z\right) \end{array}\right], \ dir = y \rightarrow \left[\begin{array}{c}0 \\ 0 \\ \varphi\left(x,y,z\right) \\ 0 \\ \varphi\left(x,y,z\right) \end{array}\right], \ dir = z \rightarrow \left[\begin{array}{c}0 \\ 0 \\ 0 \\ \varphi\left(x,y,z\right) \\ \varphi\left(x,y,z\right) \end{array}\right] \end{equation}
where \(\varphi\) (NavierStokes3D::grav_field_g) is computed in NavierStokes3D::GravityField().
References:
f | Array to hold the computed source function |
u | Solution vector array |
x | Array of spatial coordinates (grid) |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
t | Current simulation time |
dir | Spatial dimension (x, y, or z) |
Definition at line 124 of file NavierStokes3DSource.c.
int NavierStokes3DSourceUpwind | ( | double * | fI, |
double * | fL, | ||
double * | fR, | ||
double * | u, | ||
int | dir, | ||
void * | s, | ||
double | t | ||
) |
Compute the "upwind" source function value at the interface: the upwinding is just the arithmetic average of the left and right biased interpolated values of the source function at the interface.
References:
fI | Array to hold the computed "upwind" interface source function |
fL | Interface source function value computed using left-biased interpolation |
fR | Interface source function value computed using right-biased interpolation |
u | Solution vector array |
dir | Spatial dimension (x,y, or z) |
s | Solver object of type HyPar |
t | Current simulation time |
Definition at line 174 of file NavierStokes3DSource.c.
int NavierStokes3DSource | ( | double * | source, |
double * | u, | ||
void * | s, | ||
void * | m, | ||
double | t | ||
) |
Computes the gravitational source term using a well-balanced formulation: the source term is rewritten as follows:
\begin{equation} \left[\begin{array}{c} 0 \\ -\rho {\bf g}\cdot{\bf \hat{i}} \\ -\rho {\bf g}\cdot{\bf \hat{j}} \\ -\rho {\bf g}\cdot{\bf \hat{k}} \\ -\rho u {\bf g}\cdot{\bf \hat{i}} - \rho v {\bf g}\cdot{\bf \hat{j}} - \rho w {\bf g}\cdot{\bf \hat{k}} \end{array}\right] = \left[\begin{array}{ccccc} 0 & p_0 \varrho^{-1} & 0 & 0 & p_0 u \varrho^{-1} \end{array}\right] \cdot \frac{\partial}{\partial x}\left[\begin{array}{c} 0 \\ \varphi \\ 0 \\ 0 \\ \varphi \end{array}\right] + \left[\begin{array}{ccccc} 0 & 0 & p_0 \varrho^{-1} & 0 & p_0 v \varrho^{-1} \end{array}\right] \cdot \frac{\partial}{\partial y}\left[\begin{array}{c} 0 \\ 0 \\ \varphi \\ 0 \\ \varphi \end{array}\right] + \left[\begin{array}{ccccc} 0 & 0 & 0 & p_0 \varrho^{-1} & p_0 w \varrho^{-1} \end{array}\right] \cdot \frac{\partial}{\partial y}\left[\begin{array}{c} 0 \\ 0 \\ 0 \\ \varphi \\ \varphi \end{array}\right] \end{equation}
where \(\varphi = \varphi\left(x,y\right)\) and \(\varrho = \varrho\left(x,y\right)\) are computed in NavierStokes3DGravityField(). The derivatives are computed in an exactly identical manner as the hyperbolic flux (i.e., using a conservative finite-difference formulation) (see HyperbolicFunction()).
References:
source | Array to hold the computed source |
u | Solution vector array |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
t | Current simulation time |
Definition at line 38 of file NavierStokes3DSource.c.