homogenization_RGC.f90
>> Fixing problems related to the size of homogenization_RGC_state vector.
This commit is contained in:
parent
5f7e5b8409
commit
ec524a1dd2
|
@ -1,4 +1,4 @@
|
||||||
!* $Id$
|
|
||||||
!*****************************************************
|
!*****************************************************
|
||||||
!* Module: HOMOGENIZATION_RGC *
|
!* Module: HOMOGENIZATION_RGC *
|
||||||
!*****************************************************
|
!*****************************************************
|
||||||
|
@ -132,7 +132,7 @@ subroutine homogenization_RGC_init(&
|
||||||
= 3*(homogenization_RGC_Ngrains(1,i)-1)*homogenization_RGC_Ngrains(2,i)*homogenization_RGC_Ngrains(3,i) &
|
= 3*(homogenization_RGC_Ngrains(1,i)-1)*homogenization_RGC_Ngrains(2,i)*homogenization_RGC_Ngrains(3,i) &
|
||||||
+ 3*homogenization_RGC_Ngrains(1,i)*(homogenization_RGC_Ngrains(2,i)-1)*homogenization_RGC_Ngrains(3,i) &
|
+ 3*homogenization_RGC_Ngrains(1,i)*(homogenization_RGC_Ngrains(2,i)-1)*homogenization_RGC_Ngrains(3,i) &
|
||||||
+ 3*homogenization_RGC_Ngrains(1,i)*homogenization_RGC_Ngrains(2,i)*(homogenization_RGC_Ngrains(3,i)-1) &
|
+ 3*homogenization_RGC_Ngrains(1,i)*homogenization_RGC_Ngrains(2,i)*(homogenization_RGC_Ngrains(3,i)-1) &
|
||||||
+ homogenization_RGC_sizePostResults(i)
|
+ 3_pInt ! (1) Average constitutive work, (2) Average penalty energy, (3) Overall mismatch
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -152,7 +152,7 @@ function homogenization_RGC_stateInit(myInstance)
|
||||||
real(pReal), dimension(homogenization_RGC_sizeState(myInstance)) :: homogenization_RGC_stateInit
|
real(pReal), dimension(homogenization_RGC_sizeState(myInstance)) :: homogenization_RGC_stateInit
|
||||||
|
|
||||||
!* Open a debugging file
|
!* Open a debugging file
|
||||||
open(1978,file='homogenization_RGC_debugging.out')
|
! open(1978,file='homogenization_RGC_debugging.out',status='unknown')
|
||||||
homogenization_RGC_stateInit = 0.0_pReal
|
homogenization_RGC_stateInit = 0.0_pReal
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -175,6 +175,8 @@ subroutine homogenization_RGC_partitionDeformation(&
|
||||||
use prec, only: pReal,pInt,p_vec
|
use prec, only: pReal,pInt,p_vec
|
||||||
use mesh, only: mesh_element,mesh_NcpElems,mesh_maxNips
|
use mesh, only: mesh_element,mesh_NcpElems,mesh_maxNips
|
||||||
use material, only: homogenization_maxNgrains,homogenization_Ngrains,homogenization_typeInstance
|
use material, only: homogenization_maxNgrains,homogenization_Ngrains,homogenization_typeInstance
|
||||||
|
use FEsolving, only: theInc,theCycle,theTime
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
!* Definition of variables
|
!* Definition of variables
|
||||||
|
@ -192,15 +194,17 @@ subroutine homogenization_RGC_partitionDeformation(&
|
||||||
!
|
!
|
||||||
integer(pInt), parameter :: nFace = 6
|
integer(pInt), parameter :: nFace = 6
|
||||||
|
|
||||||
RGCdebug = (el == 1 .and. ip == 1)
|
RGCdebug = .false.
|
||||||
|
|
||||||
!* Debugging the overall deformation gradient
|
!* Debugging the overall deformation gradient
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
write(1978,'(x,a32,i3,i3)')'Overall deformation gradient: '
|
write(6,'(x,a,i3,a,i3,a)')'========== Increment: ',theInc,' Cycle: ',theCycle,' =========='
|
||||||
|
write(6,'(x,a32)')'Overall deformation gradient: '
|
||||||
do i = 1,3
|
do i = 1,3
|
||||||
write(1978,'(x,3(e10.4,x))')(avgF(i,j), j = 1,3)
|
write(6,'(x,3(e14.8,x))')(avgF(i,j), j = 1,3)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!* Compute the deformation gradient of individual grains due to relaxations
|
!* Compute the deformation gradient of individual grains due to relaxations
|
||||||
|
@ -218,11 +222,12 @@ subroutine homogenization_RGC_partitionDeformation(&
|
||||||
F(:,:,iGrain) = F(:,:,iGrain) + avgF(:,:) ! relaxed deformation gradient
|
F(:,:,iGrain) = F(:,:,iGrain) + avgF(:,:) ! relaxed deformation gradient
|
||||||
!* Debugging the grain deformation gradients
|
!* Debugging the grain deformation gradients
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
write(1978,'(x,a32,x,i3)')'Deformation gradient of grain: ',iGrain
|
write(6,'(x,a32,x,i3)')'Deformation gradient of grain: ',iGrain
|
||||||
do i = 1,3
|
do i = 1,3
|
||||||
write(1978,'(x,3(e10.4,x))')(F(i,j,iGrain), j = 1,3)
|
write(6,'(x,3(e14.8,x))')(F(i,j,iGrain), j = 1,3)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -251,6 +256,7 @@ function homogenization_RGC_updateState(&
|
||||||
use mesh, only: mesh_element,mesh_NcpElems,mesh_maxNips
|
use mesh, only: mesh_element,mesh_NcpElems,mesh_maxNips
|
||||||
use material, only: homogenization_maxNgrains,homogenization_typeInstance,homogenization_Ngrains
|
use material, only: homogenization_maxNgrains,homogenization_typeInstance,homogenization_Ngrains
|
||||||
use numerics, only: absTol_RGC,relTol_RGC,absMax_RGC,relMax_RGC,pPert_RGC
|
use numerics, only: absTol_RGC,relTol_RGC,absMax_RGC,relMax_RGC,pPert_RGC
|
||||||
|
use FEsolving, only: theInc,theCycle,theTime
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
|
@ -269,14 +275,16 @@ function homogenization_RGC_updateState(&
|
||||||
real(pReal), dimension (homogenization_maxNgrains) :: NN,pNN
|
real(pReal), dimension (homogenization_maxNgrains) :: NN,pNN
|
||||||
real(pReal), dimension (3) :: normP,normN,mornP,mornN
|
real(pReal), dimension (3) :: normP,normN,mornP,mornN
|
||||||
real(pReal) residMax,stresMax,constitutiveWork,penaltyEnergy
|
real(pReal) residMax,stresMax,constitutiveWork,penaltyEnergy
|
||||||
logical error,RGCdebug,RGCdebugJacobi
|
logical error,RGCdebug,RGCdebugJacobi,RGCcheck
|
||||||
!
|
!
|
||||||
integer(pInt), parameter :: nFace = 6
|
integer(pInt), parameter :: nFace = 6
|
||||||
|
real(pInt), parameter :: max_drelax = 0.5_pReal
|
||||||
!
|
!
|
||||||
real(pReal), dimension(:,:), allocatable :: tract,jmatrix,jnverse,smatrix,pmatrix
|
real(pReal), dimension(:,:), allocatable :: tract,jmatrix,jnverse,smatrix,pmatrix
|
||||||
real(pReal), dimension(:), allocatable :: resid,relax,p_relax,p_resid
|
real(pReal), dimension(:), allocatable :: resid,relax,p_relax,p_resid,drelax
|
||||||
|
|
||||||
RGCdebug = (el == 1 .and. ip == 1)
|
RGCcheck = (el == 1 .and. ip == 1)
|
||||||
|
RGCdebug = .false.
|
||||||
RGCdebugJacobi = .false.
|
RGCdebugJacobi = .false.
|
||||||
|
|
||||||
!* Get the dimension of the cluster (grains and interfaces)
|
!* Get the dimension of the cluster (grains and interfaces)
|
||||||
|
@ -286,16 +294,17 @@ function homogenization_RGC_updateState(&
|
||||||
+ nGDim(1)*nGDim(2)*(nGDim(3)-1)
|
+ nGDim(1)*nGDim(2)*(nGDim(3)-1)
|
||||||
|
|
||||||
!* Allocate the size of the arrays/matrices depending on the size of the cluster
|
!* Allocate the size of the arrays/matrices depending on the size of the cluster
|
||||||
allocate(resid(3*nIntFaceTot)); resid = 0.0_pReal
|
allocate(resid(3*nIntFaceTot)); resid = 0.0_pReal
|
||||||
allocate(tract(nIntFaceTot,3)); tract = 0.0_pReal
|
allocate(tract(nIntFaceTot,3)); tract = 0.0_pReal
|
||||||
allocate(relax(3*nIntFaceTot)); relax = state%p(1:3*nIntFaceTot)
|
allocate(relax(3*nIntFaceTot)); relax = state%p(1:3*nIntFaceTot)
|
||||||
|
allocate(drelax(3*nIntFaceTot)); drelax = 0.0_pReal
|
||||||
!* Debugging the obtained state
|
!* Debugging the obtained state
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
write(1978,'(x,a30)')'Obtained state: '
|
write(6,'(x,a30)')'Obtained state: '
|
||||||
do i = 1,3*nIntFaceTot
|
do i = 1,3*nIntFaceTot
|
||||||
write(1978,'(x,2(e10.4,x))')state%p(i)
|
write(6,'(x,2(e14.8,x))')state%p(i)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!* Stress-like penalty related to mismatch or incompatibility at interfaces
|
!* Stress-like penalty related to mismatch or incompatibility at interfaces
|
||||||
|
@ -303,13 +312,13 @@ function homogenization_RGC_updateState(&
|
||||||
!* Debugging the mismatch, stress and penalty of grains
|
!* Debugging the mismatch, stress and penalty of grains
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
do iGrain = 1,homogenization_Ngrains(mesh_element(3,el))
|
do iGrain = 1,homogenization_Ngrains(mesh_element(3,el))
|
||||||
write(1978,'(x,a30,x,i3,x,a4,x,e10.4)')'Mismatch magnitude of grain(',iGrain,') :',NN(iGrain)
|
write(6,'(x,a30,x,i3,x,a4,x,e14.8)')'Mismatch magnitude of grain(',iGrain,') :',NN(iGrain)
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
write(1978,'(x,a30,x,i3)')'Stress and penalty of grain: ',iGrain
|
write(6,'(x,a30,x,i3)')'Stress and penalty of grain: ',iGrain
|
||||||
do i = 1,3
|
do i = 1,3
|
||||||
write(1978,'(x,3(e10.4,x),x,3(e10.4,x))')(P(i,j,iGrain), j = 1,3),(R(i,j,iGrain), j = 1,3)
|
write(6,'(x,3(e14.8,x),x,3(e14.8,x))')(P(i,j,iGrain), j = 1,3),(R(i,j,iGrain), j = 1,3)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
enddo
|
enddo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -336,9 +345,9 @@ function homogenization_RGC_updateState(&
|
||||||
enddo
|
enddo
|
||||||
!* Debugging the residual stress
|
!* Debugging the residual stress
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
write(1978,'(x,a30,x,i3)')'Traction difference: ',iNum
|
write(6,'(x,a30,x,i3)')'Traction at interface: ',iNum
|
||||||
write(1978,'(x,3(e10.4,x))')(tract(iNum,j), j = 1,3)
|
write(6,'(x,3(e14.8,x))')(tract(iNum,j), j = 1,3)
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -348,23 +357,25 @@ function homogenization_RGC_updateState(&
|
||||||
residMax = maxval(abs(tract))
|
residMax = maxval(abs(tract))
|
||||||
residLoc = maxloc(abs(tract))
|
residLoc = maxloc(abs(tract))
|
||||||
!* Debugging the convergent criteria
|
!* Debugging the convergent criteria
|
||||||
if (RGCdebug) then
|
if (RGCcheck) then
|
||||||
write(1978,'(x,a)')' '
|
write(6,'(x,a)')' '
|
||||||
write(1978,'(x,a)')'Residual check ...'
|
write(6,'(x,a,x,i2,x,i4)')'RGC residual check ...',ip,el
|
||||||
write(1978,'(x,a15,x,e10.4,x,a7,i3,x,a12,i2,i2)')'Max stress: ',stresMax, &
|
write(6,'(x,a15,x,e14.8,x,a7,i3,x,a12,i2,i2)')'Max stress: ',stresMax, &
|
||||||
'@ grain',stresLoc(3),'in component',stresLoc(1),stresLoc(2)
|
'@ grain',stresLoc(3),'in component',stresLoc(1),stresLoc(2)
|
||||||
write(1978,'(x,a15,x,e10.4,x,a7,i3,x,a12,i2)')'Max residual: ',residMax, &
|
write(6,'(x,a15,x,e14.8,x,a7,i3,x,a12,i2)')'Max residual: ',residMax, &
|
||||||
'@ iface',residLoc(1),'in direction',residLoc(2)
|
'@ iface',residLoc(1),'in direction',residLoc(2)
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
homogenization_RGC_updateState = .false.
|
homogenization_RGC_updateState = .false.
|
||||||
!*** If convergence reached => done and happy
|
!*** If convergence reached => done and happy
|
||||||
if (residMax < relTol_RGC*stresMax .or. residMax < absTol_RGC) then
|
if (residMax < relTol_RGC*stresMax .or. residMax < absTol_RGC) then
|
||||||
homogenization_RGC_updateState = .true.
|
homogenization_RGC_updateState = .true.
|
||||||
if (RGCdebug) then
|
if (RGCcheck) then
|
||||||
write(1978,'(x,a55)')'... done and happy'
|
write(6,'(x,a55)')'... done and happy'
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
write(6,'(x,a,x,i3,x,a6,x,i3,x,a12)')'RGC_updateState: ip',ip,'| el',el,'converged :)'
|
! write(6,'(x,a,x,i3,x,a6,x,i3,x,a12)')'RGC_updateState: ip',ip,'| el',el,'converged :)'
|
||||||
!* Then compute/update the state for postResult, i.e., ...
|
!* Then compute/update the state for postResult, i.e., ...
|
||||||
!* ... the (bulk) constitutive work and penalty energy
|
!* ... the (bulk) constitutive work and penalty energy
|
||||||
constitutiveWork = state%p(3*nIntFaceTot+1)
|
constitutiveWork = state%p(3*nIntFaceTot+1)
|
||||||
|
@ -382,28 +393,36 @@ function homogenization_RGC_updateState(&
|
||||||
!* ... the overall mismatch
|
!* ... the overall mismatch
|
||||||
state%p(3*nIntFaceTot+3) = sum(NN)
|
state%p(3*nIntFaceTot+3) = sum(NN)
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
write(1978,'(x,a30,x,e10.4)')'Constitutive work: ',constitutiveWork
|
write(6,'(x,a30,x,e14.8)')'Constitutive work: ',constitutiveWork
|
||||||
write(1978,'(x,a30,x,e10.4)')'Penalty energy: ',penaltyEnergy
|
write(6,'(x,a30,x,e14.8)')'Penalty energy: ',penaltyEnergy
|
||||||
write(1978,'(x,a30,x,e10.4)')'Magnitude mismatch: ',sum(NN)
|
write(6,'(x,a30,x,e14.8)')'Magnitude mismatch: ',sum(NN)
|
||||||
write(1978,*)' '
|
write(6,*)''
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
deallocate(tract,resid,relax)
|
deallocate(tract,resid,relax,drelax)
|
||||||
return
|
return
|
||||||
!*** If residual blows-up => done but unhappy
|
!*** If residual blows-up => done but unhappy
|
||||||
elseif (residMax > relMax_RGC*stresMax .or. residMax > absMax_RGC) then
|
elseif (residMax > relMax_RGC*stresMax .or. residMax > absMax_RGC) then
|
||||||
homogenization_RGC_updateState = (/.true.,.false./)
|
!* Try to restart when residual blows up exceeding maximum bound
|
||||||
if (RGCdebug) then
|
homogenization_RGC_updateState = (/.true.,.false./) ! ... with direct cut-back
|
||||||
write(1978,'(x,a55)')'... broken'
|
write(6,'(x,a,x,i3,x,a,x,i3,x,a)')'RGC_updateState: ip',ip,'| el',el,'enforces cutback'
|
||||||
write(1978,*)' '
|
write(6,'(x,a,x,e14.8,x,a,x,e14.8)')'due to high residual =',residMax,'for stress =',stresMax
|
||||||
|
! state%p(1:3*nIntFaceTot) = 0.0_pReal ! ... with full Taylor assumption
|
||||||
|
! write(6,'(x,a,x,i3,x,a,x,i3,x,a)')'RGC_updateState: ip',ip,'| el',el,'relaxation vectors reset to zero'
|
||||||
|
if (RGCcheck) then
|
||||||
|
write(6,'(x,a55)')'... broken'
|
||||||
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
write(6,'(x,a,x,i3,x,a6,x,i3,x,a9)')'RGC_updateState: ip',ip,'| el',el,'broken :('
|
! write(6,'(x,a,x,i3,x,a6,x,i3,x,a9)')'RGC_updateState: ip',ip,'| el',el,'broken :('
|
||||||
deallocate(tract,resid,relax)
|
deallocate(tract,resid,relax,drelax)
|
||||||
return
|
return
|
||||||
!*** Otherwise, proceed with computing the Jacobian and state update
|
!*** Otherwise, proceed with computing the Jacobian and state update
|
||||||
else
|
else
|
||||||
if (RGCdebug) then
|
if (RGCcheck) then
|
||||||
write(1978,'(x,a55)')'... not yet done'
|
write(6,'(x,a55)')'... not yet done'
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -443,11 +462,12 @@ function homogenization_RGC_updateState(&
|
||||||
enddo
|
enddo
|
||||||
!* Debugging the global Jacobian matrix of stress tangent
|
!* Debugging the global Jacobian matrix of stress tangent
|
||||||
if (RGCdebugJacobi) then
|
if (RGCdebugJacobi) then
|
||||||
write(1978,'(x,a30)')'Jacobian matrix of stress'
|
write(6,'(x,a30)')'Jacobian matrix of stress'
|
||||||
do i = 1,3*nIntFaceTot
|
do i = 1,3*nIntFaceTot
|
||||||
write(1978,'(x,100(e10.4,x))')(smatrix(i,j), j = 1,3*nIntFaceTot)
|
write(6,'(x,100(e10.4,x))')(smatrix(i,j), j = 1,3*nIntFaceTot)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!* Compute the Jacobian of the stress-like penalty (penalty tangent) using perturbation technique
|
!* Compute the Jacobian of the stress-like penalty (penalty tangent) using perturbation technique
|
||||||
|
@ -486,46 +506,63 @@ function homogenization_RGC_updateState(&
|
||||||
enddo
|
enddo
|
||||||
!* Debugging the global Jacobian matrix of penalty tangent
|
!* Debugging the global Jacobian matrix of penalty tangent
|
||||||
if (RGCdebugJacobi) then
|
if (RGCdebugJacobi) then
|
||||||
write(1978,'(x,a30)')'Jacobian matrix of penalty'
|
write(6,'(x,a30)')'Jacobian matrix of penalty'
|
||||||
do i = 1,3*nIntFaceTot
|
do i = 1,3*nIntFaceTot
|
||||||
write(1978,'(x,100(e10.4,x))')(pmatrix(i,j), j = 1,3*nIntFaceTot)
|
write(6,'(x,100(e10.4,x))')(pmatrix(i,j), j = 1,3*nIntFaceTot)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!* The overall Jacobian matrix (due to constitutive and penalty tangents)
|
!* The overall Jacobian matrix (due to constitutive and penalty tangents)
|
||||||
allocate(jmatrix(3*nIntFaceTot,3*nIntFaceTot)); jmatrix = smatrix + pmatrix
|
allocate(jmatrix(3*nIntFaceTot,3*nIntFaceTot)); jmatrix = smatrix + pmatrix
|
||||||
if (RGCdebugJacobi) then
|
if (RGCdebugJacobi) then
|
||||||
write(1978,'(x,a30)')'Jacobian matrix (total)'
|
write(6,'(x,a30)')'Jacobian matrix (total)'
|
||||||
do i = 1,3*nIntFaceTot
|
do i = 1,3*nIntFaceTot
|
||||||
write(1978,'(x,100(e10.4,x))')(jmatrix(i,j), j = 1,3*nIntFaceTot)
|
write(6,'(x,100(e10.4,x))')(jmatrix(i,j), j = 1,3*nIntFaceTot)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
allocate(jnverse(3*nIntFaceTot,3*nIntFaceTot)); jnverse = 0.0_pReal
|
allocate(jnverse(3*nIntFaceTot,3*nIntFaceTot)); jnverse = 0.0_pReal
|
||||||
call math_invert(3*nIntFaceTot,jmatrix,jnverse,ival,error)
|
call math_invert(3*nIntFaceTot,jmatrix,jnverse,ival,error)
|
||||||
!* Debugging the inverse Jacobian matrix
|
!* Debugging the inverse Jacobian matrix
|
||||||
if (RGCdebugJacobi) then
|
if (RGCdebugJacobi) then
|
||||||
write(1978,'(x,a30)')'Jacobian inverse'
|
write(6,'(x,a30)')'Jacobian inverse'
|
||||||
do i = 1,3*nIntFaceTot
|
do i = 1,3*nIntFaceTot
|
||||||
write(1978,'(x,100(e10.4,x))')(jnverse(i,j), j = 1,3*nIntFaceTot)
|
write(6,'(x,100(e10.4,x))')(jnverse(i,j), j = 1,3*nIntFaceTot)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!* Calculate the state update (i.e., new relaxation vectors)
|
!* Calculate the state update (i.e., new relaxation vectors)
|
||||||
forall(i=1:3*nIntFaceTot,j=1:3*nIntFaceTot) relax(i) = relax(i) - jnverse(i,j)*resid(j)
|
do i = 1,3*nIntFaceTot
|
||||||
|
do j = 1,3*nIntFaceTot
|
||||||
|
drelax(i) = drelax(i) - jnverse(i,j)*resid(j)
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
relax = relax + drelax
|
||||||
state%p(1:3*nIntFaceTot) = relax
|
state%p(1:3*nIntFaceTot) = relax
|
||||||
|
if (any(abs(drelax(:)) > max_drelax)) then
|
||||||
|
! state%p(1:3*nIntFaceTot) = 0.0_pReal
|
||||||
|
! write(6,'(x,a,x,i3,x,a,x,i3,x,a)')'RGC_updateState: ip',ip,'| el',el,'relaxation vectors reset to zero'
|
||||||
|
homogenization_RGC_updateState = (/.true.,.false./)
|
||||||
|
write(6,'(x,a,x,i3,x,a,x,i3,x,a)')'RGC_updateState: ip',ip,'| el',el,'enforces cutback'
|
||||||
|
write(6,'(x,a,x,e14.8)')'due to large relaxation change =',maxval(abs(drelax))
|
||||||
|
call flush(6)
|
||||||
|
endif
|
||||||
!* Debugging the return state
|
!* Debugging the return state
|
||||||
if (RGCdebugJacobi) then
|
if (RGCdebugJacobi) then
|
||||||
write(1978,'(x,a30)')'Returned state: '
|
write(6,'(x,a30)')'Returned state: '
|
||||||
do i = 1,3*nIntFaceTot
|
do i = 1,3*nIntFaceTot
|
||||||
write(1978,'(x,2(e10.4,x))')state%p(i)
|
write(6,'(x,2(e14.8,x))')state%p(i)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
deallocate(tract,resid,jmatrix,jnverse,relax,pmatrix,smatrix,p_relax,p_resid)
|
deallocate(tract,resid,jmatrix,jnverse,relax,drelax,pmatrix,smatrix,p_relax,p_resid)
|
||||||
return
|
return
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -567,12 +604,13 @@ subroutine homogenization_RGC_averageStressAndItsTangent(&
|
||||||
if (RGCdebug) then
|
if (RGCdebug) then
|
||||||
do iGrain = 1,homogenization_Ngrains(mesh_element(3,el))
|
do iGrain = 1,homogenization_Ngrains(mesh_element(3,el))
|
||||||
dPdF99 = math_Plain3333to99(dPdF(:,:,:,:,iGrain))
|
dPdF99 = math_Plain3333to99(dPdF(:,:,:,:,iGrain))
|
||||||
write(1978,'(x,a30,x,i3)')'Stress tangent of grain: ',iGrain
|
write(6,'(x,a30,x,i3)')'Stress tangent of grain: ',iGrain
|
||||||
do i = 1,9
|
do i = 1,9
|
||||||
write(1978,'(x,(e10.4,x))') (dPdF99(i,j), j = 1,9)
|
write(6,'(x,(e14.8,x))') (dPdF99(i,j), j = 1,9)
|
||||||
enddo
|
enddo
|
||||||
write(1978,*)' '
|
write(6,*)' '
|
||||||
enddo
|
enddo
|
||||||
|
call flush(6)
|
||||||
endif
|
endif
|
||||||
Ngrains = homogenization_Ngrains(mesh_element(3,el))
|
Ngrains = homogenization_Ngrains(mesh_element(3,el))
|
||||||
avgP = sum(P,3)/dble(Ngrains)
|
avgP = sum(P,3)/dble(Ngrains)
|
||||||
|
@ -732,11 +770,11 @@ subroutine homogenization_RGC_stressPenalty(&
|
||||||
nDefNorm = max(nDefToler,sqrt(nDefNorm)) ! zero mismatch approximation if too small
|
nDefNorm = max(nDefToler,sqrt(nDefNorm)) ! zero mismatch approximation if too small
|
||||||
!* Debugging the mismatch tensor
|
!* Debugging the mismatch tensor
|
||||||
! if (ip == 1 .and. el == 1) then
|
! if (ip == 1 .and. el == 1) then
|
||||||
! write(1978,'(x,a20,i2,x,a20,x,i3)')'Mismatch to face: ',intFace(1),'neighbor grain: ',iGNghb
|
! write(6,'(x,a20,i2,x,a20,x,i3)')'Mismatch to face: ',intFace(1),'neighbor grain: ',iGNghb
|
||||||
! do i = 1,3
|
! do i = 1,3
|
||||||
! write(1978,'(x,3(e10.4,x))')(nDef(i,j), j = 1,3)
|
! write(6,'(x,3(e10.4,x))')(nDef(i,j), j = 1,3)
|
||||||
! enddo
|
! enddo
|
||||||
! write(1978,'(x,a20,e10.4))')'with magnitude: ',nDefNorm
|
! write(6,'(x,a20,e10.4))')'with magnitude: ',nDefNorm
|
||||||
! endif
|
! endif
|
||||||
!* Compute the stress-like penalty from all six interfaces
|
!* Compute the stress-like penalty from all six interfaces
|
||||||
do i = 1,3
|
do i = 1,3
|
||||||
|
@ -756,9 +794,9 @@ subroutine homogenization_RGC_stressPenalty(&
|
||||||
enddo
|
enddo
|
||||||
!* Debugging the stress-like penalty
|
!* Debugging the stress-like penalty
|
||||||
! if (ip == 1 .and. el == 1) then
|
! if (ip == 1 .and. el == 1) then
|
||||||
! write(1978,'(x,a20,i2)')'Penalty of grain: ',iGrain
|
! write(6,'(x,a20,i2)')'Penalty of grain: ',iGrain
|
||||||
! do i = 1,3
|
! do i = 1,3
|
||||||
! write(1978,'(x,3(e10.4,x))')(rPen(i,j,iGrain), j = 1,3)
|
! write(6,'(x,3(e10.4,x))')(rPen(i,j,iGrain), j = 1,3)
|
||||||
! enddo
|
! enddo
|
||||||
! endif
|
! endif
|
||||||
enddo
|
enddo
|
||||||
|
|
Loading…
Reference in New Issue