bugfix: synchronizatopm of dPdF_min and dPdF_max was not correct
-before: using componenwise min/max among different processors -now: identify the processor that holds the minimum/maximum of the norm
This commit is contained in:
parent
507963d558
commit
ae3de821b4
|
@ -584,7 +584,6 @@ end subroutine utilities_fourierGammaConvolution
|
|||
!> @brief doing convolution DamageGreenOp_hat * field_real
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine utilities_fourierGreenConvolution(D_ref, mobility_ref, deltaT)
|
||||
|
||||
use math, only: &
|
||||
math_mul33x3, &
|
||||
PI
|
||||
|
@ -593,8 +592,8 @@ subroutine utilities_fourierGreenConvolution(D_ref, mobility_ref, deltaT)
|
|||
grid3
|
||||
|
||||
implicit none
|
||||
real(pReal), dimension(3,3), intent(in) :: D_ref !< desired average value of the field after convolution
|
||||
real(pReal), intent(in) :: mobility_ref, deltaT !< desired average value of the field after convolution
|
||||
real(pReal), dimension(3,3), intent(in) :: D_ref
|
||||
real(pReal), intent(in) :: mobility_ref, deltaT
|
||||
complex(pReal) :: GreenOp_hat
|
||||
integer(pInt) :: i, j, k
|
||||
|
||||
|
@ -817,9 +816,6 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C)
|
|||
write(6,trim(formatString),advance='no') ' S (load) ', transpose(s_reduced)
|
||||
if(errmatinv) call IO_error(error_ID=400_pInt,ext_msg='utilities_maskedCompliance')
|
||||
endif
|
||||
deallocate(c_reduced)
|
||||
deallocate(s_reduced)
|
||||
deallocate(sTimesC)
|
||||
else
|
||||
temp99_real = 0.0_pReal
|
||||
endif
|
||||
|
@ -887,6 +883,7 @@ subroutine utilities_fourierVectorGradient()
|
|||
tensorField_fourier(m,n,i,j,k) = vectorField_fourier(m,i,j,k)*xi1st(n,i,j,k)
|
||||
enddo; enddo
|
||||
enddo; enddo; enddo
|
||||
|
||||
end subroutine utilities_fourierVectorGradient
|
||||
|
||||
|
||||
|
@ -909,6 +906,7 @@ subroutine utilities_fourierTensorDivergence()
|
|||
tensorField_fourier(m,n,i,j,k)*conjg(-xi1st(n,i,j,k))
|
||||
enddo; enddo
|
||||
enddo; enddo; enddo
|
||||
|
||||
end subroutine utilities_fourierTensorDivergence
|
||||
|
||||
|
||||
|
@ -919,6 +917,8 @@ subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,&
|
|||
F,timeinc,rotation_BC)
|
||||
use IO, only: &
|
||||
IO_error
|
||||
use numerics, only: &
|
||||
worldrank
|
||||
use debug, only: &
|
||||
debug_reset, &
|
||||
debug_info
|
||||
|
@ -938,38 +938,22 @@ subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,&
|
|||
real(pReal),intent(out), dimension(3,3,3,3) :: C_volAvg, C_minmaxAvg !< average stiffness
|
||||
real(pReal),intent(out), dimension(3,3) :: P_av !< average PK stress
|
||||
real(pReal),intent(out), dimension(3,3,grid(1),grid(2),grid3) :: P !< PK stress
|
||||
|
||||
real(pReal), intent(in), dimension(3,3,grid(1),grid(2),grid3) :: F !< deformation gradient target !< previous deformation gradient
|
||||
real(pReal), intent(in), dimension(3,3,grid(1),grid(2),grid3) :: F !< deformation gradient target
|
||||
real(pReal), intent(in) :: timeinc !< loading time
|
||||
real(pReal), intent(in), dimension(3,3) :: rotation_BC !< rotation of load frame
|
||||
|
||||
|
||||
integer(pInt) :: &
|
||||
j,k,ierr
|
||||
real(pReal), dimension(3,3,3,3) :: max_dPdF, min_dPdF
|
||||
real(pReal) :: max_dPdF_norm, min_dPdF_norm, defgradDetMin, defgradDetMax, defgradDet
|
||||
i,ierr
|
||||
real(pReal), dimension(3,3,3,3) :: dPdF_max, dPdF_min
|
||||
real(pReal) :: dPdF_norm_max, dPdF_norm_min
|
||||
real(pReal), dimension(2) :: valueAndRank !< pair of min/max norm of dPdF to synchronize min/max of dPdF
|
||||
|
||||
write(6,'(/,a)') ' ... evaluating constitutive response ......................................'
|
||||
flush(6)
|
||||
|
||||
materialpoint_F = reshape(F,[3,3,1,product(grid(1:2))*grid3]) ! set materialpoint target F to estimated field
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! calculate bounds of det(F) and report
|
||||
if(debugGeneral) then
|
||||
defgradDetMax = -huge(1.0_pReal)
|
||||
defgradDetMin = +huge(1.0_pReal)
|
||||
do j = 1_pInt, product(grid(1:2))*grid3
|
||||
defgradDet = math_det33(materialpoint_F(1:3,1:3,1,j))
|
||||
defgradDetMax = max(defgradDetMax,defgradDet)
|
||||
defgradDetMin = min(defgradDetMin,defgradDet)
|
||||
end do
|
||||
|
||||
write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax
|
||||
write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin
|
||||
flush(6)
|
||||
endif
|
||||
|
||||
call debug_reset() ! this has no effect on rank >0
|
||||
call materialpoint_stressAndItsTangent(.true.,timeinc) ! calculate P field
|
||||
|
||||
|
@ -984,30 +968,38 @@ subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,&
|
|||
transpose(P_av)*1.e-6_pReal
|
||||
flush(6)
|
||||
|
||||
max_dPdF = 0.0_pReal
|
||||
max_dPdF_norm = 0.0_pReal
|
||||
min_dPdF = huge(1.0_pReal)
|
||||
min_dPdF_norm = huge(1.0_pReal)
|
||||
do k = 1_pInt, product(grid(1:2))*grid3
|
||||
if (max_dPdF_norm < sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,k)**2.0_pReal)) then
|
||||
max_dPdF = materialpoint_dPdF(1:3,1:3,1:3,1:3,1,k)
|
||||
max_dPdF_norm = sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,k)**2.0_pReal)
|
||||
dPdF_max = 0.0_pReal
|
||||
dPdF_norm_max = 0.0_pReal
|
||||
dPdF_min = huge(1.0_pReal)
|
||||
dPdF_norm_min = huge(1.0_pReal)
|
||||
do i = 1_pInt, product(grid(1:2))*grid3
|
||||
if (dPdF_norm_max < sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,i)**2.0_pReal)) then
|
||||
dPdF_max = materialpoint_dPdF(1:3,1:3,1:3,1:3,1,i)
|
||||
dPdF_norm_max = sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,i)**2.0_pReal)
|
||||
endif
|
||||
if (min_dPdF_norm > sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,k)**2.0_pReal)) then
|
||||
min_dPdF = materialpoint_dPdF(1:3,1:3,1:3,1:3,1,k)
|
||||
min_dPdF_norm = sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,k)**2.0_pReal)
|
||||
if (dPdF_norm_min > sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,i)**2.0_pReal)) then
|
||||
dPdF_min = materialpoint_dPdF(1:3,1:3,1:3,1:3,1,i)
|
||||
dPdF_norm_min = sum(materialpoint_dPdF(1:3,1:3,1:3,1:3,1,i)**2.0_pReal)
|
||||
endif
|
||||
end do
|
||||
|
||||
call MPI_Allreduce(MPI_IN_PLACE,max_dPdF,81,MPI_DOUBLE,MPI_MAX,PETSC_COMM_WORLD,ierr)
|
||||
valueAndRank = [dPdF_norm_max,real(worldrank,pReal)]
|
||||
call MPI_Allreduce(MPI_IN_PLACE,valueAndRank,1, MPI_2DOUBLE_PRECISION, MPI_MAXLOC, PETSC_COMM_WORLD, ierr)
|
||||
if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max')
|
||||
call MPI_Allreduce(MPI_IN_PLACE,min_dPdF,81,MPI_DOUBLE,MPI_MIN,PETSC_COMM_WORLD,ierr)
|
||||
call MPI_Bcast(dPdF_max,81,MPI_DOUBLE,int(valueAndRank(2)),PETSC_COMM_WORLD, ierr)
|
||||
if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Bcast max')
|
||||
|
||||
valueAndRank = [dPdF_norm_min,real(worldrank,pReal)]
|
||||
call MPI_Allreduce(MPI_IN_PLACE,valueAndRank,1, MPI_2DOUBLE_PRECISION, MPI_MINLOC, PETSC_COMM_WORLD, ierr)
|
||||
if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min')
|
||||
call MPI_Bcast(dPdF_min,81,MPI_DOUBLE,int(valueAndRank(2)),PETSC_COMM_WORLD, ierr)
|
||||
if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Bcast min')
|
||||
|
||||
C_minmaxAvg = 0.5_pReal*(max_dPdF + min_dPdF)
|
||||
C_minmaxAvg = 0.5_pReal*(dPdF_max + dPdF_min)
|
||||
|
||||
C_volAvg = sum(sum(materialpoint_dPdF,dim=6),dim=5) * wgt
|
||||
C_volAvg = sum(sum(materialpoint_dPdF,dim=6),dim=5)
|
||||
call MPI_Allreduce(MPI_IN_PLACE,C_volAvg,81,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr)
|
||||
C_volAvg = C_volAvg * wgt
|
||||
|
||||
call debug_info() ! this has no effect on rank >0
|
||||
|
||||
|
@ -1023,7 +1015,8 @@ pure function utilities_calculateRate(heterogeneous,field0,field,dt,avRate)
|
|||
grid
|
||||
|
||||
implicit none
|
||||
real(pReal), intent(in), dimension(3,3) :: avRate !< homogeneous addon
|
||||
real(pReal), intent(in), dimension(3,3) :: &
|
||||
avRate !< homogeneous addon
|
||||
real(pReal), intent(in) :: &
|
||||
dt !< timeinc between field0 and field
|
||||
logical, intent(in) :: &
|
||||
|
|
Loading…
Reference in New Issue