cutoff_factor Function

private function cutoff_factor(me, radius) result(cutoff_fac)

return the cutoff multiplication factor This routine returns the cutoff factor for a circle of size r_min. Outside r_min, the quantity is

  • for me%linear == .true. : linearly reduced to 0 until r_max.
  • for me%quadratic == .true. : quadratically reduced to 0 until r_max. outside the radius r_max, the cutoff factor is set to zero

Arguments

Type IntentOptional Attributes Name
type(cutoff_type), intent(in) :: me

global gauss pulse data

real(kind=rk), intent(in) :: radius

coordinate of an element

Return Value real(kind=rk)

return value which is sent to state variable


Called by

proc~~cutoff_factor~~CalledByGraph proc~cutoff_factor cutoff_factor proc~ic_2dcrvpx_for ic_2dcrvpX_for proc~ic_2dcrvpx_for->proc~cutoff_factor proc~ic_2dcrvppressure_for ic_2dcrvpPressure_for proc~ic_2dcrvppressure_for->proc~cutoff_factor proc~ic_2dcrvppressure_for->proc~ic_2dcrvpx_for proc~ic_2dcrvpy_for ic_2dcrvpY_for proc~ic_2dcrvppressure_for->proc~ic_2dcrvpy_for proc~ic_2dcrvpy_for->proc~cutoff_factor proc~tem_spatial_for_coord tem_spatial_for_coord proc~tem_spatial_for_coord->proc~ic_2dcrvpx_for proc~tem_spatial_for_coord->proc~ic_2dcrvppressure_for proc~tem_spatial_for_coord->proc~ic_2dcrvpy_for proc~tem_spatial_scalar_for_index tem_spatial_scalar_for_index proc~tem_spatial_scalar_for_index->proc~tem_spatial_for_coord interface~tem_spatial_for tem_spatial_for interface~tem_spatial_for->proc~tem_spatial_for_coord interface~tem_spatial_for->proc~tem_spatial_scalar_for_index proc~tem_spacetime_for_treeids tem_spacetime_for_treeIDs proc~tem_spacetime_for_treeids->interface~tem_spatial_for proc~tem_spacetime_vector_for_index tem_spacetime_vector_for_index proc~tem_spacetime_vector_for_index->interface~tem_spatial_for proc~tem_spatial_scalar_storeval tem_spatial_scalar_storeVal proc~tem_spatial_scalar_storeval->interface~tem_spatial_for proc~tem_spacetime_for_coord tem_spacetime_for_coord proc~tem_spacetime_for_coord->interface~tem_spatial_for proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index proc~tem_spacetime_scalar_for_index->interface~tem_spatial_for proc~tem_spacetime_vector_for_treeids tem_spacetime_vector_for_treeIDs proc~tem_spacetime_vector_for_treeids->interface~tem_spatial_for proc~tem_spacetime_vector_for_coord tem_spacetime_vector_for_coord proc~tem_spacetime_vector_for_coord->interface~tem_spatial_for proc~tem_spatial_vector_storeval tem_spatial_vector_storeVal proc~tem_spatial_vector_storeval->interface~tem_spatial_for

Contents

Source Code


Source Code

  function cutoff_factor(me, radius) result(cutoff_fac)
    ! ---------------------------------------------------------------------------
    !> global gauss pulse data
    type(cutoff_type), intent(in) :: me
    !> coordinate of an element
    real(kind=rk), intent(in) :: radius
    !> return value which is sent to state variable
    real(kind=rk) :: cutoff_fac
    ! ---------------------------------------------------------------------------
    real(kind=rk) :: r_min, r_max ! minimum and maximum absolute radius
    real(kind=rk) :: a0, a1, a2   ! polynomial coefficients
    ! ---------------------------------------------------------------------------

    ! Define no cutoff as the default
    cutoff_fac = 1._rk

    if( me%active ) then
      ! If the cutoff is active ...
      ! first compute the absolute radius from the domain center:
      ! min for where to start cutting of
      r_min = me%length*me%r_min
      ! max for where to end cutting of
      r_max = me%length*me%r_max
      if( radius .le. r_min ) then
        cutoff_fac = 1._rk
      elseif( radius .gt. r_max ) then
        cutoff_fac = 0._rk
      else
        if( me%linear ) then
          ! Linear progress from r_min towards r_max
          cutoff_fac = 1._rk - (radius - r_min) / (r_max-r_min)
        elseif( me%quadratic ) then
          ! Quadratic progress from r_min towards r_max,
          ! where the derivative at r_min is zero for a smooth progression from
          ! the domain inside
          a0 = 1._rk / ( -r_min*r_min -r_max*r_max + 2._rk*r_min*r_max)
          a1 = -2._rk*a0*r_min
          a2 = 1._rk - a0*r_min*r_min - a1*r_min
          cutoff_fac = a0*radius*radius + a1*radius + a2
        end if
      endif
    endif

  end function cutoff_factor