better make internal function

- not used
- no check whether matrix is positive-definite, i.e. danger of NaN
This commit is contained in:
Martin Diehl 2020-03-15 16:11:28 +01:00
parent 8c78347a8b
commit 5b71f1050f
1 changed files with 62 additions and 60 deletions

View File

@ -961,12 +961,34 @@ subroutine math_eigh33(m,w,v)
end subroutine math_eigh33 end subroutine math_eigh33
!--------------------------------------------------------------------------------------------------
!> @brief rotational part from polar decomposition of 3x3 tensor
!--------------------------------------------------------------------------------------------------
function math_rotationalPart(m)
real(pReal), intent(in), dimension(3,3) :: m
real(pReal), dimension(3,3) :: math_rotationalPart
real(pReal), dimension(3,3) :: U , Uinv
U = eigenvectorBasis(matmul(transpose(m),m))
Uinv = math_inv33(U)
inversionFailed: if (all(dEq0(Uinv))) then
math_rotationalPart = math_I3
call IO_warning(650)
else inversionFailed
math_rotationalPart = matmul(m,Uinv)
endif inversionFailed
contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief eigenvector basis of positive-definite 3x3 matrix !> @brief eigenvector basis of positive-definite 3x3 matrix
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
pure function math_eigenvectorBasisSym33(m) pure function eigenvectorBasis(m)
real(pReal), dimension(3,3) :: math_eigenvectorBasisSym33 real(pReal), dimension(3,3) :: eigenvectorBasis
real(pReal), dimension(3,3), intent(in) :: m !< positive-definite matrix of which the basis is computed real(pReal), dimension(3,3), intent(in) :: m !< positive-definite matrix of which the basis is computed
real(pReal), dimension(3) :: I, v real(pReal), dimension(3) :: I, v
@ -1015,31 +1037,11 @@ pure function math_eigenvectorBasisSym33(m)
endif twoSimilarEigVals endif twoSimilarEigVals
endif threeSimilarEigVals endif threeSimilarEigVals
math_eigenvectorBasisSym33 = sqrt(v(1)) * EB(1:3,1:3,1) & eigenvectorBasis = sqrt(v(1)) * EB(1:3,1:3,1) &
+ sqrt(v(2)) * EB(1:3,1:3,2) & + sqrt(v(2)) * EB(1:3,1:3,2) &
+ sqrt(v(3)) * EB(1:3,1:3,3) + sqrt(v(3)) * EB(1:3,1:3,3)
end function math_eigenvectorBasisSym33 end function eigenvectorBasis
!--------------------------------------------------------------------------------------------------
!> @brief rotational part from polar decomposition of 3x3 tensor
!--------------------------------------------------------------------------------------------------
function math_rotationalPart(m)
real(pReal), intent(in), dimension(3,3) :: m
real(pReal), dimension(3,3) :: math_rotationalPart
real(pReal), dimension(3,3) :: U , Uinv
U = math_eigenvectorBasisSym33(matmul(transpose(m),m))
Uinv = math_inv33(U)
inversionFailed: if (all(dEq0(Uinv))) then
math_rotationalPart = math_I3
call IO_warning(650)
else inversionFailed
math_rotationalPart = matmul(m,Uinv)
endif inversionFailed
end function math_rotationalPart end function math_rotationalPart