kernels.cppΒΆ

An implementation file containing the function definitions for all available SPH smoothing kernels.

Functions

void kernel_init(int form)

Control function which initialises the chosen SPH smoothing kernel and sets function pointers.

Parameters
  • form -

    an integer representing the desired smoothing kernel

double kernel_h3(double & h)

Inline function returning h^2 or h^3 depending on whether 2D or 3D.

double kernel_norm(double & h3)

Inline function returning the 2D or 3D kernel normalisation.

double CS_kernel_eval(double r, double h)

Function returning the value of the cubic spline kernel at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double CS_dw_kernel_eval(double r, double h)

Function returning the value of the cubic spline kernel gradient at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double WC2_kernel_eval(double r, double h)

Function returning the value of the second order Wendland kernel at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double WC2_dw_kernel_eval(double r, double h)

Function returning the value of the second order Wendland kernel gradient at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double WC4_kernel_eval(double r, double h)

Function returning the value of the fourth order Wendland kernel at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double WC4_dw_kernel_eval(double r, double h)

Function returning the value of the fourth order Wendland kernel gradient at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double WC6_kernel_eval(double r, double h)

Function returning the value of the sixth order Wendland kernel at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double WC6_dw_kernel_eval(double r, double h)

Function returning the value of the sixth order Wendland kernel gradient at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double HOCT_kernel_eval_3D(double r, double h)

Function returning the value of the 3D higher order OCT kernel at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double HOCT_dw_kernel_eval_3D(double r, double h)

Function returning the value of the 3D higher order OCT kernel gradient at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

void HOCT_kernel_init_3D()

Function to numerically evaluate and initialise the normalisations of the 3D higher order OCT kernel.

double trapIntegral(int indexA, int indexB, double * Xs, double * FXs)

Utility function which numerically evaluates the trapezoidal rule integration on an array.

Return
the outcome of the integral calculation
Parameters
  • indexA -

    index of the left-hand array entry for the integration

  • indexB -

    index of the right-hand array entry for the integration

  • Xs -

    array of x values where the evaluated function is f(x)

  • FXs -

    array of function values where the evaluated function is f(x)

void HOCT_kernel_init_2D()

Function to numerically evaluate and initialise the normalisations of the 2D higher order OCT kernel.

double HOCT_kernel_eval_2D(double r, double h)

Function returning the value of the 2D higher order OCT kernel at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double HOCT_dw_kernel_eval_2D(double r, double h)

Function returning the value of the 2D higher order OCT kernel gradient at a given position.

Return
kernel value
Parameters
  • r -

    the radius at which to evaluate the kernel

  • h -

    the kernel smoothing length

double linterp(double x, double lowx, double upx, double lowfx, double upfx)

Utility function which numerically evaluates the linear interpolation between supplied values.

Return
the outcome of the interpolation calculation
Parameters
  • x -

    position at which the function is approximated, where function is f(x)

  • lowx -

    lower coordinate value

  • upx -

    upper coordinate value

  • lowfx -

    lower function value, f(lowx)

  • upfx -

    upper function value, f(upx)