From f3eda7cdaa5de0ef915a1d55db5ac6f6c7ab484d Mon Sep 17 00:00:00 2001 From: Denny Tjahjanto Date: Wed, 26 Mar 2008 13:35:01 +0000 Subject: [PATCH] include a new function epsilon_ijk, i.e., the permutation function (used to compute the cross product of two tensors) --- trunk/math.f90 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/trunk/math.f90 b/trunk/math.f90 index f2d500c69..7845fd904 100644 --- a/trunk/math.f90 +++ b/trunk/math.f90 @@ -167,6 +167,31 @@ END FUNCTION +!************************************************************************** +! permutation tensor e_ijk used for computing cross product of two tensors +! e_ijk = 1 if even permutation of ijk +! e_ijk = -1 if odd permutation of ijk +! e_ijk = 0 otherwise +!************************************************************************** + FUNCTION math_permut(i,j,k) + + use prec, only: pReal, pInt + implicit none + + integer(pInt) i,j,k + real(pReal) math_permut + + math_permut = 0.0_pReal + if (((i == 1).and.(j == 2).and.(k == 3)) .or. & + ((i == 2).and.(j == 3).and.(k == 1)) .or. & + ((i == 3).and.(j == 1).and.(k == 2))) math_permut = 1.0_pReal + if (((i == 1).and.(j == 3).and.(k == 2)) .or. & + ((i == 2).and.(j == 1).and.(k == 3)) .or. & + ((i == 3).and.(j == 2).and.(k == 1))) math_permut = -1.0_pReal + math_permut + return + + END FUNCTION !************************************************************************** ! fourth rank identity tensor of specified dimension