wrapper routine for fresnel calculation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(inout) | :: | I |
incident vector |
||
type(vector), | intent(inout) | :: | N |
normal vector |
||
real(kind=wp), | intent(in) | :: | n1 |
refractive indices |
||
real(kind=wp), | intent(in) | :: | n2 |
refractive indices |
||
logical, | intent(out) | :: | rflag |
reflection flag |
||
real(kind=wp), | intent(out) | :: | Ri |
subroutine reflect_refract(I, N, n1, n2, rflag, ri) !! wrapper routine for fresnel calculation use random, only : ran2 !> incident vector type(vector), intent(INOUT) :: I !> normal vector type(vector), intent(INOUT) :: N !> refractive indices real(kind=wp), intent(IN) :: n1, n2 real(kind=wp), intent(OUT) :: Ri !> reflection flag logical, intent(OUT) :: rflag rflag = .FALSE. !draw random number, if less than fresnel coefficents, then reflect, else refract Ri = fresnel(I, N, n1, n2) if(ran2() <= Ri)then call reflect(I, N) rflag = .true. else call refract(I, N, n1/n2) end if end subroutine reflect_refract