Merge branch 'development' into using-submodules
This commit is contained in:
commit
98d0da8e31
|
@ -9,7 +9,7 @@ source $ENV_ROOT/CONFIG
|
|||
|
||||
set path = ($DAMASK_ROOT/bin $path)
|
||||
|
||||
set SOLVER=`which DAMASK_spectral`
|
||||
set SOLVER=`which DAMASK_grid`
|
||||
if ( "x$DAMASK_NUM_THREADS" == "x" ) then
|
||||
set DAMASK_NUM_THREADS=1
|
||||
endif
|
||||
|
|
|
@ -35,7 +35,7 @@ cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd
|
|||
|
||||
PATH=${DAMASK_ROOT}/bin:$PATH
|
||||
|
||||
SOLVER=$(type -p DAMASK_spectral || true 2>/dev/null)
|
||||
SOLVER=$(type -p DAMASK_grid || true 2>/dev/null)
|
||||
[ "x$SOLVER" == "x" ] && SOLVER=$(blink 'Not found!')
|
||||
|
||||
[ "x$DAMASK_NUM_THREADS" == "x" ] && DAMASK_NUM_THREADS=1
|
||||
|
|
|
@ -27,7 +27,7 @@ cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd
|
|||
|
||||
PATH=${DAMASK_ROOT}/bin:$PATH
|
||||
|
||||
SOLVER=$(which DAMASK_spectral || true 2>/dev/null)
|
||||
SOLVER=$(which DAMASK_grid || true 2>/dev/null)
|
||||
[[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!')
|
||||
|
||||
[[ "x$DAMASK_NUM_THREADS" == "x" ]] && DAMASK_NUM_THREADS=1
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
itmin 4
|
||||
itmax 40
|
|
@ -0,0 +1,3 @@
|
|||
grid:
|
||||
itmin: 4
|
||||
itmax: 40
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -3267,6 +3267,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3599,6 +3600,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3933,6 +3935,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -3267,6 +3267,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3599,6 +3600,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3933,6 +3935,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -3267,6 +3267,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3599,6 +3600,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3933,6 +3935,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -3267,6 +3267,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3599,6 +3600,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3933,6 +3935,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -3267,6 +3267,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3599,6 +3600,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3933,6 +3935,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -3267,6 +3267,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3599,6 +3600,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3933,6 +3935,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -49,4 +49,5 @@ echo "program: $program"
|
|||
exit 1
|
||||
}
|
||||
/bin/rm $userobj
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.mod
|
||||
/bin/rm $DIRJOB/*.smod
|
||||
|
|
|
@ -3241,6 +3241,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3573,6 +3574,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3907,6 +3909,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -3241,6 +3241,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3573,6 +3574,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3907,6 +3909,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -3241,6 +3241,7 @@ else
|
|||
fi
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3573,6 +3574,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
|
||||
#
|
||||
# run marc
|
||||
|
@ -3907,6 +3909,7 @@ else # if test $link
|
|||
fi # if test $link
|
||||
/bin/rm $userobj 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.mod 2>/dev/null
|
||||
/bin/rm $DIRJOB/*.smod 2>/dev/null
|
||||
# done if no job id given
|
||||
if test -z "$jid"
|
||||
then
|
||||
|
|
|
@ -805,7 +805,7 @@ class Rotation:
|
|||
"""Rotation matrix to Bunge-Euler angles."""
|
||||
with np.errstate(invalid='ignore',divide='ignore'):
|
||||
zeta = 1.0/np.sqrt(1.0-om[...,2,2:3]**2)
|
||||
eu = np.where(np.isclose(np.abs(om[...,2,2:3]),1.0,1e-9),
|
||||
eu = np.where(np.isclose(np.abs(om[...,2,2:3]),1.0,0.0),
|
||||
np.block([np.arctan2(om[...,0,1:2],om[...,0,0:1]),
|
||||
np.pi*0.5*(1-om[...,2,2:3]),
|
||||
np.zeros(om.shape[:-2]+(1,)),
|
||||
|
|
|
@ -150,7 +150,7 @@ def om2qu(a):
|
|||
|
||||
def om2eu(om):
|
||||
"""Rotation matrix to Bunge-Euler angles."""
|
||||
if not np.isclose(np.abs(om[2,2]),1.0,1.e-9):
|
||||
if not np.isclose(np.abs(om[2,2]),1.0,0.0):
|
||||
zeta = 1.0/np.sqrt(1.0-om[2,2]**2)
|
||||
eu = np.array([np.arctan2(om[2,0]*zeta,-om[2,1]*zeta),
|
||||
np.arccos(om[2,2]),
|
||||
|
|
|
@ -248,7 +248,7 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS
|
|||
endif validCalculation
|
||||
|
||||
if (debugCPFEM%extensive &
|
||||
.and. (debugCPFEM%element == elCP .and. debugCPFEM%ip == ip) .or. .not. debugCPFEM%selective) then
|
||||
.and. ((debugCPFEM%element == elCP .and. debugCPFEM%ip == ip) .or. .not. debugCPFEM%selective)) then
|
||||
write(6,'(a,i8,1x,i2,/,12x,6(f10.3,1x)/)') &
|
||||
'<< CPFEM >> stress/MPa at elFE ip ', elFE, ip, CPFEM_cs(1:6,ip,elCP)*1.0e-6_pReal
|
||||
write(6,'(a,i8,1x,i2,/,6(12x,6(f10.3,1x)/))') &
|
||||
|
|
|
@ -529,6 +529,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg)
|
|||
msg = 'unknown material parameter:'
|
||||
case (211)
|
||||
msg = 'material parameter out of bounds:'
|
||||
case (212)
|
||||
msg = 'nonlocal model not supported'
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! numerics error messages
|
||||
|
|
|
@ -15,7 +15,8 @@ module constitutive
|
|||
use results
|
||||
use lattice
|
||||
use discretization
|
||||
use geometry_plastic_nonlocal
|
||||
use geometry_plastic_nonlocal, only: &
|
||||
geometry_plastic_nonlocal_disable
|
||||
|
||||
implicit none
|
||||
private
|
||||
|
|
|
@ -386,7 +386,11 @@ module subroutine plastic_nonlocal_init
|
|||
|
||||
call material_allocateState(plasticState(p),NipcMyPhase,sizeState,sizeDotState,sizeDeltaState)
|
||||
|
||||
plasticState(p)%nonlocal = config%KeyExists('/nonlocal/')
|
||||
plasticState(p)%nonlocal = config%KeyExists('/nonlocal/')
|
||||
if(plasticState(p)%nonlocal .and. .not. allocated(IPneighborhood)) &
|
||||
call IO_error(212,ext_msg='IPneighborhood does not exist')
|
||||
|
||||
|
||||
plasticState(p)%offsetDeltaState = 0 ! ToDo: state structure does not follow convention
|
||||
|
||||
st0%rho => plasticState(p)%state0 (0*prm%sum_N_sl+1:10*prm%sum_N_sl,:)
|
||||
|
|
|
@ -118,6 +118,7 @@ subroutine discretization_grid_init(restart)
|
|||
call results_addAttribute('origin',origin, 'geometry')
|
||||
call results_closeJobFile
|
||||
endif
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! geometry information required by the nonlocal CP model
|
||||
call geometry_plastic_nonlocal_setIPvolume(reshape([(product(mySize/real(myGrid,pReal)),j=1,product(myGrid))], &
|
||||
|
|
|
@ -119,6 +119,7 @@ subroutine discretization_marc_init
|
|||
unscaledNormals = IPareaNormal(elem,nElems,connectivity_cell,node0_cell)
|
||||
call geometry_plastic_nonlocal_setIParea(norm2(unscaledNormals,1))
|
||||
call geometry_plastic_nonlocal_setIPareaNormal(unscaledNormals/spread(norm2(unscaledNormals,1),1,3))
|
||||
!call geometry_plastic_nonlocal_setIPneighborhood ToDo: Support nonlocal
|
||||
call geometry_plastic_nonlocal_results
|
||||
|
||||
end subroutine discretization_marc_init
|
||||
|
@ -492,8 +493,8 @@ subroutine inputRead_mapNodes(FEM2DAMASK, &
|
|||
chunkPos = IO_stringPos(fileContent(l))
|
||||
if(chunkPos(1) < 1) cycle
|
||||
if(IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'coordinates') then
|
||||
chunkPos = [1,1,10]
|
||||
do i = 1,nNodes
|
||||
chunkPos = IO_stringPos(fileContent(l+1+i))
|
||||
map_unsorted(:,i) = [IO_intValue(fileContent(l+1+i),chunkPos,1),i]
|
||||
enddo
|
||||
exit
|
||||
|
@ -528,8 +529,8 @@ subroutine inputRead_elemNodes(nodes, &
|
|||
chunkPos = IO_stringPos(fileContent(l))
|
||||
if(chunkPos(1) < 1) cycle
|
||||
if(IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'coordinates') then
|
||||
chunkPos = [4,1,10,11,30,31,50,51,70]
|
||||
do i=1,nNode
|
||||
chunkPos = IO_stringPos(fileContent(l+1+i))
|
||||
m = mesh_FEM2DAMASK_node(IO_intValue(fileContent(l+1+i),chunkPos,1))
|
||||
do j = 1,3
|
||||
nodes(j,m) = mesh_unitlength * IO_floatValue(fileContent(l+1+i),chunkPos,j+1)
|
||||
|
@ -732,7 +733,7 @@ end subroutine inputRead_microstructureAndHomogenization
|
|||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Calculates cell node coordinates from element node coordinates
|
||||
!> @brief Determine cell connectivity and definition of cell nodes
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine buildCells(connectivity_cell,cellNodeDefinition, &
|
||||
elem,connectivity_elem)
|
||||
|
@ -746,7 +747,8 @@ subroutine buildCells(connectivity_cell,cellNodeDefinition, &
|
|||
integer,dimension(:), allocatable :: candidates_local
|
||||
integer,dimension(:,:), allocatable :: parentsAndWeights,candidates_global
|
||||
|
||||
integer :: e, n, c, p, s,i,m,j,nParentNodes,nCellNode,Nelem,candidateID
|
||||
integer :: e,n,c,p,s,i,m,j,&
|
||||
nParentNodes,nCellNode,Nelem,candidateID
|
||||
|
||||
Nelem = size(connectivity_elem,2)
|
||||
|
||||
|
@ -760,9 +762,7 @@ subroutine buildCells(connectivity_cell,cellNodeDefinition, &
|
|||
do e = 1, Nelem
|
||||
do c = 1, elem%NcellNodes
|
||||
realNode: if (count(elem%cellNodeParentNodeWeights(:,c) /= 0) == 1) then
|
||||
where(connectivity_cell(:,:,e) == -c)
|
||||
connectivity_cell(:,:,e) = connectivity_elem(c,e)
|
||||
end where
|
||||
where(connectivity_cell(:,:,e) == -c) connectivity_cell(:,:,e) = connectivity_elem(c,e)
|
||||
endif realNode
|
||||
enddo
|
||||
enddo
|
||||
|
@ -889,7 +889,7 @@ end subroutine buildCells
|
|||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Calculates cell node coordinates from element node coordinates
|
||||
!> @brief Calculate cell node coordinates from element node coordinates
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine buildCellNodes(node_cell, &
|
||||
definition,node_elem)
|
||||
|
@ -919,7 +919,7 @@ end subroutine buildCellNodes
|
|||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Calculates IP coordinates as center of cell
|
||||
!> @brief Calculate IP coordinates as center of cell
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine buildIPcoordinates(IPcoordinates, &
|
||||
connectivity_cell,node_cell)
|
||||
|
|
|
@ -464,6 +464,8 @@ subroutine selfTest
|
|||
real(pReal), dimension(4) :: qu
|
||||
type(quaternion) :: q, q_2
|
||||
|
||||
if(dNeq(abs(P),1.0_pReal)) call IO_error(0,ext_msg='P not in {-1,+1}')
|
||||
|
||||
call random_number(qu)
|
||||
qu = (qu-0.5_pReal) * 2.0_pReal
|
||||
q = quaternion(qu)
|
||||
|
|
|
@ -574,6 +574,7 @@ end function om2qu
|
|||
!---------------------------------------------------------------------------------------------------
|
||||
!> @author Marc De Graef, Carnegie Mellon University
|
||||
!> @brief orientation matrix to Euler angles
|
||||
!> @details Two step check for special cases to avoid invalid operations (not needed for python)
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
pure function om2eu(om) result(eu)
|
||||
|
||||
|
@ -581,16 +582,16 @@ pure function om2eu(om) result(eu)
|
|||
real(pReal), dimension(3) :: eu
|
||||
real(pReal) :: zeta
|
||||
|
||||
if (abs(om(3,3)) < 1.0_pReal) then
|
||||
zeta = 1.0_pReal/sqrt(1.0_pReal-om(3,3)**2.0_pReal)
|
||||
if (dNeq(abs(om(3,3)),1.0_pReal,1.e-8_pReal)) then
|
||||
zeta = 1.0_pReal/sqrt(math_clip(1.0_pReal-om(3,3)**2.0_pReal,1e-64_pReal,1.0_pReal))
|
||||
eu = [atan2(om(3,1)*zeta,-om(3,2)*zeta), &
|
||||
acos(om(3,3)), &
|
||||
acos(math_clip(om(3,3),-1.0_pReal,1.0_pReal)), &
|
||||
atan2(om(1,3)*zeta, om(2,3)*zeta)]
|
||||
else
|
||||
eu = [atan2(om(1,2),om(1,1)), 0.5_pReal*PI*(1.0_pReal-om(3,3)),0.0_pReal ]
|
||||
end if
|
||||
|
||||
where(eu<0.0_pReal) eu = mod(eu+2.0_pReal*PI,[2.0_pReal*PI,PI,2.0_pReal*PI])
|
||||
where(abs(eu) < 1.e-8_pReal) eu = 0.0_pReal
|
||||
where(eu<0.0_pReal) eu = mod(eu+2.0_pReal*PI,[2.0_pReal*PI,PI,2.0_pReal*PI])
|
||||
|
||||
end function om2eu
|
||||
|
||||
|
|
Loading…
Reference in New Issue