quintic_spline_kernel Subroutine

public pure subroutine quintic_spline_kernel(skf, r, dx, w, dwdx)

Smoothed kernel function: Quintic spline
四次样条曲线 (Liu 2010)

Arguments

Type IntentOptional Attributes Name
class(smoothed_kernel_function_type), intent(in) :: skf
real(kind=rk), intent(in) :: r

Euclidean distance between two points
欧氏距离

real(kind=rk), intent(in) :: dx(2)

Dimensional distance between two points
对应坐标轴距离

real(kind=rk), intent(out) :: w

kernel value
核函数值

real(kind=rk), intent(out) :: dwdx(2)

Derivative of kernel value
核函数导数


Contents

Source Code


Source Code

    pure subroutine quintic_spline_kernel(skf, r, dx, w, dwdx)
        class(smoothed_kernel_function_type), intent(in) :: skf
        real(rk), intent(in) :: r           !! Euclidean distance between two points <br>
                                            !! 欧氏距离
        real(rk), intent(in) :: dx(2)       !! Dimensional distance between two points <br>
                                            !! 对应坐标轴距离
        real(rk), intent(out) :: w          !! kernel value <br>
                                            !! 核函数值
        real(rk), intent(out) :: dwdx(2)    !! Derivative of kernel value <br>
                                            !! 核函数导数
        real(rk) :: q

        q = r/skf%hsml
        if (q <= 1.0_rk) then
            w = skf%factor*((3 - q)**5 - 6*(2 - q)**5 + 15*(1 - q)**5)
            dwdx = skf%factor*(-120.0_rk + 120.0_rk*q - 50.0_rk*q**2)*dx/skf%hsml**2
        else if (q > 1.0_rk .and. q <= 2.0_rk) then
            w = skf%factor*((3 - q)**5 - 6*(2 - q)**5)
            dwdx = skf%factor*(-5.0_rk*(3 - q)**4 + 30.0_rk*(2 - q)**4)*dx/(skf%hsml*r)
        else if (q > 2.0_rk .and. q <= 3.0_rk) then
            w = skf%factor*((3 - q)**5)
            dwdx = skf%factor*(-5.0_rk*(3 - q)**4)*dx/(skf%hsml*r)
        else
            w = 0.0_rk
            dwdx = 0.0_rk
        end if

    end subroutine quintic_spline_kernel