HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
First order approximation to the first derivative. More...
#include <stdio.h>
#include <stdlib.h>
#include <basic.h>
#include <mathfunctions.h>
#include <arrayfunctions.h>
#include <firstderivative.h>
#include <mpivars.h>
#include <hypar.h>
Go to the source code of this file.
Typedefs | |
typedef MPIVariables | MPIContext |
typedef HyPar | SolverContext |
Functions | |
int | FirstDerivativeFirstOrder (double *Df, double *f, int dir, int bias, void *s, void *m) |
First order approximation to the first derivative.
Definition in file FirstDerivativeFirstOrder.c.
typedef MPIVariables MPIContext |
Definition at line 15 of file FirstDerivativeFirstOrder.c.
typedef HyPar SolverContext |
Definition at line 16 of file FirstDerivativeFirstOrder.c.
int FirstDerivativeFirstOrder | ( | double * | Df, |
double * | f, | ||
int | dir, | ||
int | bias, | ||
void * | s, | ||
void * | m | ||
) |
Computes the first-order finite-difference approximation to the first derivative (Note: not divided by the grid spacing):
\begin{equation} \left(\partial f\right)_i = \left\{ \begin{array}{ll} f_{i+1} - f_i & {\rm bias} = 1 \\ f_i - f_{i-1} & {\rm bias} = -1 \end{array}\right. \end{equation}
where \(i\) is the grid index along the spatial dimension of the derivative.
Notes:
Df | Array to hold the computed first derivative (with ghost points) |
f | Array containing the grid point function values whose first derivative is to be computed (with ghost points) |
dir | The spatial dimension along which the derivative is computed |
bias | Forward or backward differencing for non-central finite-difference schemes (-1: backward, 1: forward) |
s | Solver object of type SolverContext |
m | MPI object of type MPIContext |
Definition at line 37 of file FirstDerivativeFirstOrder.c.