Time derivative of a unit vector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | u |
vector [ |
|
real(kind=wp), | intent(in), | dimension(3) | :: | udot |
derivative of vector [ |
derivative of unit vector [d(uhat)/dt
]
pure function uhat_dot(u,udot) result(uhatd) implicit none real(wp),dimension(3),intent(in) :: u !! vector [`u`] real(wp),dimension(3),intent(in) :: udot !! derivative of vector [`du/dt`] real(wp),dimension(3) :: uhatd !! derivative of unit vector [`d(uhat)/dt`] real(wp) :: umag !! vector magnitude real(wp),dimension(3) :: uhat !! unit vector umag = norm2(u) if (umag == zero) then !singularity uhatd = zero else uhat = u / umag uhatd = ( udot - dot_product(uhat,udot)*uhat ) / umag end if end function uhat_dot