fixed bug in fiber texture component caused non-even distribution by correctly getting numbers of the halton sequence
This commit is contained in:
parent
3cd5fa90e8
commit
405c3765bd
|
@ -937,6 +937,7 @@ pure subroutine Gauss (dimen,A,B,LogAbsDetA,NegHDK,error)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
|
|
||||||
logical, intent(out) :: error
|
logical, intent(out) :: error
|
||||||
integer(pInt), intent(in) :: dimen
|
integer(pInt), intent(in) :: dimen
|
||||||
integer(pInt), intent(out) :: NegHDK
|
integer(pInt), intent(out) :: NegHDK
|
||||||
|
@ -1062,6 +1063,7 @@ pure subroutine Gauss (dimen,A,B,LogAbsDetA,NegHDK,error)
|
||||||
LogAbsDetA = LogAbsDetA + LOG10(AbsA)
|
LogAbsDetA = LogAbsDetA + LOG10(AbsA)
|
||||||
ENDDO
|
ENDDO
|
||||||
|
|
||||||
|
|
||||||
error = .false.
|
error = .false.
|
||||||
|
|
||||||
end subroutine Gauss
|
end subroutine Gauss
|
||||||
|
@ -1932,16 +1934,16 @@ endif
|
||||||
end function math_sampleGaussOri
|
end function math_sampleGaussOri
|
||||||
|
|
||||||
|
|
||||||
!********************************************************************
|
!--------------------------------------------------------------------------------------------------
|
||||||
! draw a random sample from Fiber component
|
!> @brief draw a random sample from Fiber component with noise (in radians)
|
||||||
! with noise (in radians)
|
!--------------------------------------------------------------------------------------------------
|
||||||
!********************************************************************
|
|
||||||
function math_sampleFiberOri(alpha,beta,noise)
|
function math_sampleFiberOri(alpha,beta,noise)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
real(pReal), dimension(3) :: math_sampleFiberOri, fiberInC,fiberInS,axis
|
real(pReal), dimension(3) :: math_sampleFiberOri, fiberInC,fiberInS,axis
|
||||||
real(pReal), dimension(2) :: alpha,beta, rnd
|
real(pReal), dimension(2), intent(in) :: alpha,beta
|
||||||
|
real(pReal), dimension(6) :: rnd
|
||||||
real(pReal), dimension(3,3) :: oRot,fRot,pRot
|
real(pReal), dimension(3,3) :: oRot,fRot,pRot
|
||||||
real(pReal) :: noise, scatter, cos2Scatter, angle
|
real(pReal) :: noise, scatter, cos2Scatter, angle
|
||||||
integer(pInt), dimension(2,3), parameter :: rotMap = reshape((/2_pInt,3_pInt,&
|
integer(pInt), dimension(2,3), parameter :: rotMap = reshape((/2_pInt,3_pInt,&
|
||||||
|
@ -1974,12 +1976,14 @@ function math_sampleFiberOri(alpha,beta,noise)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
! ---# rotation matrix about fiber axis (random angle) #---
|
! ---# rotation matrix about fiber axis (random angle) #---
|
||||||
call halton(1_pInt,rnd)
|
do
|
||||||
|
call halton(6_pInt,rnd)
|
||||||
fRot = math_AxisAngleToR(fiberInS,rnd(1)*2.0_pReal*pi)
|
fRot = math_AxisAngleToR(fiberInS,rnd(1)*2.0_pReal*pi)
|
||||||
|
|
||||||
! ---# rotation about random axis perpend to fiber #---
|
! ---# rotation about random axis perpend to fiber #---
|
||||||
! random axis pependicular to fiber axis
|
! random axis pependicular to fiber axis
|
||||||
call halton(2_pInt,axis)
|
|
||||||
|
axis(1:2) = rnd(2:3)
|
||||||
if (fiberInS(3) /= 0.0_pReal) then
|
if (fiberInS(3) /= 0.0_pReal) then
|
||||||
axis(3)=-(axis(1)*fiberInS(1)+axis(2)*fiberInS(2))/fiberInS(3)
|
axis(3)=-(axis(1)*fiberInS(1)+axis(2)*fiberInS(2))/fiberInS(3)
|
||||||
else if(fiberInS(2) /= 0.0_pReal) then
|
else if(fiberInS(2) /= 0.0_pReal) then
|
||||||
|
@ -1991,13 +1995,17 @@ function math_sampleFiberOri(alpha,beta,noise)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
! scattered rotation angle
|
! scattered rotation angle
|
||||||
do
|
if (noise > 0.0_pReal) then
|
||||||
call halton(2_pInt,rnd)
|
angle = acos(cos2Scatter+(1.0_pReal-cos2Scatter)*rnd(4))
|
||||||
angle = acos(cos2Scatter+(1.0_pReal-cos2Scatter)*rnd(1))
|
if (rnd(5) <= exp(-1.0_pReal*(angle/scatter)**2.0_pReal)) exit
|
||||||
if (rnd(2) <= exp(-1.0_pReal*(angle/scatter)**2.0_pReal)) exit
|
else
|
||||||
|
angle = 0.0_pReal
|
||||||
|
exit
|
||||||
|
end if
|
||||||
enddo
|
enddo
|
||||||
call halton(1_pInt,rnd)
|
|
||||||
if (rnd(1) <= 0.5) angle = -angle
|
if (rnd(6) <= 0.5) angle = -angle
|
||||||
|
|
||||||
pRot = math_AxisAngleToR(axis,angle)
|
pRot = math_AxisAngleToR(axis,angle)
|
||||||
|
|
||||||
! ---# apply the three rotations #---
|
! ---# apply the three rotations #---
|
||||||
|
@ -3646,6 +3654,7 @@ if (pReal /= C_DOUBLE .or. pInt /= C_INT) call IO_error(error_ID=808_pInt)
|
||||||
end subroutine divergence_fft
|
end subroutine divergence_fft
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
subroutine divergence_fdm(res,geomdim,vec_tens,order,field,divergence)
|
subroutine divergence_fdm(res,geomdim,vec_tens,order,field,divergence)
|
||||||
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
@ -3711,6 +3720,7 @@ subroutine divergence_fdm(res,geomdim,vec_tens,order,field,divergence)
|
||||||
end subroutine divergence_fdm
|
end subroutine divergence_fdm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
subroutine tensor_avg(res,tensor,avg)
|
subroutine tensor_avg(res,tensor,avg)
|
||||||
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
Loading…
Reference in New Issue