g1_cosine2 Function

public pure function g1_cosine2(r) result(val)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: r

Distance from filter center

Return Value real(kind=wp)

Result


Source Code

    pure function g1_cosine2(r) result(val)
      ! Another cosine filter
      implicit none
      real(wp), intent(in) :: r                                                !! Distance from filter center
      real(wp)             :: val                                              !! Result
      ! Work variable
      real(wp), parameter :: pi=4.0_wp*atan(1.0_wp)

      if ( (abs(r).le. 1.0_wp)) then
        val=0.5_wp*(1.0_wp+ cos(pi*r))
      else
        val=0.0_WP
      end if

      return
    end function g1_cosine2