Skip to content

Instantly share code, notes, and snippets.

@KapilKhanal
Created December 9, 2022 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KapilKhanal/63c3a74e39cbdb7de7954e13f97a1879 to your computer and use it in GitHub Desktop.
Save KapilKhanal/63c3a74e39cbdb7de7954e13f97a1879 to your computer and use it in GitHub Desktop.
PURE SUBROUTINE COMPUTE_ASYMPTOTIC_RANKINE_SOURCE(m, face_center, &
& face_area, s0, vs0)
IMPLICIT NONE
REAL :: pre
! Same as above, but always use the approximate aymptotic value.
! Inputs
REAL(kind=8), DIMENSION(3), INTENT(IN) :: m
REAL(kind=8), DIMENSION(3), INTENT(IN) :: face_center
REAL(kind=8), INTENT(IN) :: face_area
! Outputs
REAL(kind=8), INTENT(OUT) :: s0
REAL(kind=8), DIMENSION(3), INTENT(OUT) :: vs0
! Local variables
REAL(kind=pre) :: ro
EXTERNAL NORM2
INTEGER :: NORM2
INTRINSIC REAL
REAL :: zero
REAL(kind=8), DIMENSION(3) :: arg1
! Distance from center of mass of the face to M.
arg1(:) = m(1:3) - face_center(1:3)
ro = NORM2(arg1(:))
IF (ro .GT. REAL(1e-7, kind=pre)) THEN
! Asymptotic value if face far away from M
s0 = face_area/ro
vs0(1:3) = (face_center(1:3)-m)*s0/ro**2
ELSE
! Singularity...
s0 = zero
vs0(1:3) = zero
END IF
END SUBROUTINE COMPUTE_ASYMPTOTIC_RANKINE_SOURCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment