Compute the determinant of a symmetric matrix field, given as a 6-vector, at a given grid point
FT 26.03.2021
Generalized to not be bound to the mesh
FT 07.02.2022
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
double precision, | intent(in) | :: | A(jxx:jzz) |
The symmetric matrix, given as a 6-vector. |
||
double precision, | intent(out) | :: | det |
Determinant of the symmetric matrix |
SUBROUTINE determinant_sym3x3( A, det )
!****************************************************************
!
!# Compute the determinant of a \(3\times 3\) symmetric matrix
! field, given as a 6-vector, at a given grid point
!
! FT 26.03.2021
!
! Generalized to not be bound to the mesh
!
! FT 07.02.2022
!
!****************************************************************
USE tensor, ONLY: jxx, jxy, jxz, jyy, jyz, jzz, n_sym3x3
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN):: A(jxx:jzz)
!# The \(3\times 3\) symmetric matrix, given as a 6-vector.
DOUBLE PRECISION, INTENT(OUT):: det
!! Determinant of the \(3\times 3\) symmetric matrix
IF( SIZE(A) /= n_sym3x3 )THEN
PRINT *, "** ERROR in determinant_sym3x3_grid in MODULE utility.", &
" This subroutine needs an array with 6 components,",&
" and a ", SIZE(A), "component array was given instead."
STOP
ENDIF
det= A(jxx)*A(jyy)*A(jzz) &
+ A(jxy)*A(jyz)*A(jxz) &
+ A(jxz)*A(jxy)*A(jyz) &
- A(jxy)*A(jxy)*A(jzz) &
- A(jxz)*A(jyy)*A(jxz) &
- A(jxx)*A(jyz)*A(jyz)
END SUBROUTINE determinant_sym3x3