unitVectorsC Subroutine

private subroutine unitVectorsC(B, b1, b2, b3)

Arguments

Type IntentOptional AttributesName
real(kind=rp), intent(in), DIMENSION(3):: B
real(kind=rp), intent(out), DIMENSION(3):: b1
real(kind=rp), intent(out), DIMENSION(3):: b2
real(kind=rp), intent(out), DIMENSION(3):: b3

Calls

proc~~unitvectorsc~~CallsGraph proc~unitvectorsc unitVectorsC proc~cross~3 cross proc~unitvectorsc->proc~cross~3

Contents

Source Code


Source Code

  subroutine unitVectorsC(B,b1,b2,b3)
    REAL(rp), DIMENSION(3), INTENT(IN) 	:: B
    REAL(rp), DIMENSION(3), INTENT(OUT) :: b1
    REAL(rp), DIMENSION(3), INTENT(OUT) :: b2
    REAL(rp), DIMENSION(3), INTENT(OUT) :: b3

    b1 = B/SQRT(DOT_PRODUCT(B,B))

    b2 = cross(b1,(/0.0_rp,0.0_rp,1.0_rp/))
    b2 = b2/SQRT(DOT_PRODUCT(b2,b2))

    b3 = cross(b1,b2)
    b3 = b3/SQRT(DOT_PRODUCT(b3,b3))
  end subroutine unitVectorsC