better make internal function
- not used - no check whether matrix is positive-definite, i.e. danger of NaN
This commit is contained in:
parent
8c78347a8b
commit
5b71f1050f
50
src/math.f90
50
src/math.f90
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue