cross Function

private pure function cross(a, b)

Arguments

Type IntentOptional AttributesName
real(kind=rp), intent(in), DIMENSION(3):: a

Vector .

real(kind=rp), intent(in), DIMENSION(3):: b

Vector .

Return Value real(kind=rp), DIMENSION(3)

Value of


Called by

proc~~cross~~CalledByGraph proc~cross cross proc~gc_init GC_init proc~gc_init->proc~cross program~main main program~main->proc~gc_init

Contents

Source Code


Source Code

  pure function cross(a,b)
    !! @note Function that calculates and returns the cross product
    !! \(\mathbf{a}\times \mathbf{b}\). These vectors are in Cartesian
    !! coordinates. @endnote
    !! @note Notice that all the variables in this subroutine have been
    !! normalized using the characteristic scales in [[korc_units]]. @endnote
    REAL(rp), DIMENSION(3), INTENT(IN) :: a
    !! Vector \(\mathbf{a}\).
    REAL(rp), DIMENSION(3), INTENT(IN) :: b
    !! Vector \(\mathbf{b}\).
    REAL(rp), DIMENSION(3)             :: cross
    !!Value of \(\mathbf{a}\times \mathbf{b}\)

    cross(1) = a(2)*b(3) - a(3)*b(2)
    cross(2) = a(3)*b(1) - a(1)*b(3)
    cross(3) = a(1)*b(2) - a(2)*b(1)
  end function cross