return the cutoff multiplication factor This routine returns the cutoff factor for a circle of size r_min. Outside r_min, the quantity is
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(cutoff_type), | intent(in) | :: | me |
global gauss pulse data |
||
real(kind=rk), | intent(in) | :: | radius |
coordinate of an element |
return value which is sent to state variable
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