avoid array out of bounds

allows to handle un- or partly defined non schmid coefficients
This commit is contained in:
Martin Diehl 2018-10-05 10:36:44 +02:00
parent 79b0efc678
commit aa34b83978
1 changed files with 14 additions and 10 deletions

View File

@ -2237,7 +2237,7 @@ function lattice_nonSchmidMatrix(Nslip,nonSchmidCoefficients,sense) result(nonSc
math_axisAngleToR
implicit none
integer(pInt), dimension(:), intent(in) :: Nslip !< number of active slip systems per family
real(pReal), dimension(6), intent(in) :: nonSchmidCoefficients
real(pReal), dimension(:), intent(in) :: nonSchmidCoefficients
integer(pInt), intent(in) :: sense !< sense (-1,+1)
real(pReal), dimension(1:3,1:3,sum(Nslip)) :: nonSchmidMatrix
@ -2256,15 +2256,19 @@ function lattice_nonSchmidMatrix(Nslip,nonSchmidCoefficients,sense) result(nonSc
direction = coordinateSystem(1:3,1,i)
normal = coordinateSystem(1:3,2,i)
np = math_mul33x3(math_axisAngleToR(direction,60.0_pReal*INRAD), normal)
nonSchmidMatrix(1:3,1:3,i) &
= nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(1) * math_tensorproduct33(direction, np) &
+ nonSchmidCoefficients(2) * math_tensorproduct33(math_crossproduct(normal, direction), normal) &
+ nonSchmidCoefficients(3) * math_tensorproduct33(math_crossproduct(np, direction), np) &
+ nonSchmidCoefficients(4) * math_tensorproduct33(normal, normal) &
+ nonSchmidCoefficients(5) * math_tensorproduct33(math_crossproduct(normal, direction), &
math_crossproduct(normal, normal)) &
+ nonSchmidCoefficients(6) * math_tensorproduct33(direction, direction)
if (size(nonSchmidCoefficients)>1) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(1) * math_tensorproduct33(direction, np)
if (size(nonSchmidCoefficients)>2) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(2) * math_tensorproduct33(math_crossproduct(normal, direction), normal)
if (size(nonSchmidCoefficients)>3) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(3) * math_tensorproduct33(math_crossproduct(np, direction), np)
if (size(nonSchmidCoefficients)>4) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(4) * math_tensorproduct33(normal, normal)
if (size(nonSchmidCoefficients)>5) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(5) * math_tensorproduct33(math_crossproduct(normal, direction), &
math_crossproduct(normal, normal))
if (size(nonSchmidCoefficients)>6) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) &
+ nonSchmidCoefficients(6) * math_tensorproduct33(direction, direction)
enddo
end function lattice_nonSchmidMatrix