HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
4th order discretization of the second derivative More...
#include <stdio.h>
#include <stdlib.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <secondderivative.h>
#include <mpivars.h>
#include <hypar.h>
Go to the source code of this file.
Macros | |
#define | _MINIMUM_GHOSTS_ 2 |
Functions | |
int | SecondDerivativeFourthOrderCentral (double *D2f, double *f, int dir, void *s, void *m) |
4th order discretization of the second derivative
Definition in file SecondDerivativeFourthOrder.c.
#define _MINIMUM_GHOSTS_ 2 |
Minimum number of ghost points required.
Definition at line 18 of file SecondDerivativeFourthOrder.c.
int SecondDerivativeFourthOrderCentral | ( | double * | D2f, |
double * | f, | ||
int | dir, | ||
void * | s, | ||
void * | m | ||
) |
Computes the fourth-order finite-difference approximation to the second derivative (Note: not divided by the grid spacing):
\begin{equation} \left(\partial^2 f\right)_i = -\frac{1}{12}f_{i-2} + \frac{4}{3}f_{i-1} - \frac{15}{6}f_i + \frac{4}{3}f_{i+1} - \frac{1}{12}f_{i+2} \end{equation}
where \(i\) is the grid index along the spatial dimension of the derivative.
Notes:
D2f | Array to hold the computed second derivative (with ghost points) (same size and layout as f) |
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 |
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
Definition at line 34 of file SecondDerivativeFourthOrder.c.