2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
!##############################################################
|
2007-04-17 13:28:53 +05:30
|
|
|
MODULE CPFEM
|
2007-04-11 15:36:28 +05:30
|
|
|
!##############################################################
|
2007-04-17 13:28:53 +05:30
|
|
|
! *** CPFEM engine ***
|
|
|
|
!
|
|
|
|
use prec, only: pReal,pInt
|
|
|
|
implicit none
|
|
|
|
!
|
|
|
|
! ****************************************************************
|
|
|
|
! *** General variables for the material behaviour calculation ***
|
|
|
|
! ****************************************************************
|
2007-10-16 22:38:06 +05:30
|
|
|
real(pReal), dimension (:,:), allocatable :: CPFEM_Temperature
|
2007-04-17 13:28:53 +05:30
|
|
|
real(pReal), dimension (:,:,:), allocatable :: CPFEM_stress_all
|
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_jacobi_all
|
2007-03-26 15:57:34 +05:30
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_ffn_all
|
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_ffn1_all
|
2007-04-17 13:28:53 +05:30
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_results
|
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_ini_ori
|
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_sigma_old
|
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_sigma_new
|
|
|
|
real(pReal), dimension (:,:,:,:,:), allocatable :: CPFEM_Fp_old
|
|
|
|
real(pReal), dimension (:,:,:,:,:), allocatable :: CPFEM_Fp_new
|
2008-02-18 23:41:24 +05:30
|
|
|
real(pReal), dimension (:,:,:,:), allocatable :: CPFEM_jacobian
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal), parameter :: CPFEM_odd_stress = 1e15_pReal, CPFEM_odd_jacobian = 1e50_pReal
|
2007-04-17 13:28:53 +05:30
|
|
|
integer(pInt) :: CPFEM_inc_old = 0_pInt
|
2007-03-22 17:39:37 +05:30
|
|
|
integer(pInt) :: CPFEM_subinc_old = 1_pInt
|
2007-11-08 13:56:02 +05:30
|
|
|
integer(pInt) :: CPFEM_cycle_old = -1_pInt
|
2007-11-06 14:00:04 +05:30
|
|
|
integer(pInt) :: CPFEM_Nresults = 4_pInt ! three Euler angles plus volume fraction
|
2007-04-17 13:28:53 +05:30
|
|
|
logical :: CPFEM_first_call = .true.
|
2007-03-22 17:39:37 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
CONTAINS
|
2007-03-22 17:39:37 +05:30
|
|
|
|
2007-04-11 15:36:28 +05:30
|
|
|
!*********************************************************
|
|
|
|
!*** allocate the arrays defined in module CPFEM ***
|
|
|
|
!*** and initialize them ***
|
|
|
|
!*********************************************************
|
|
|
|
SUBROUTINE CPFEM_init()
|
|
|
|
!
|
2008-01-11 00:23:57 +05:30
|
|
|
use prec
|
2007-11-08 13:56:02 +05:30
|
|
|
use math, only: math_EulertoR, math_I3, math_identity2nd
|
2007-04-11 15:36:28 +05:30
|
|
|
use mesh
|
|
|
|
use constitutive
|
|
|
|
!
|
|
|
|
implicit none
|
2007-04-11 20:58:46 +05:30
|
|
|
|
|
|
|
integer(pInt) e,i,g
|
2007-04-11 15:36:28 +05:30
|
|
|
!
|
|
|
|
! *** mpie.marc parameters ***
|
2007-10-16 22:38:06 +05:30
|
|
|
allocate(CPFEM_Temperature (mesh_maxNips,mesh_NcpElems)) ; CPFEM_Temperature = 0.0_pReal
|
2007-11-08 13:56:02 +05:30
|
|
|
allocate(CPFEM_ffn_all (3,3,mesh_maxNips,mesh_NcpElems))
|
2008-02-21 16:03:34 +05:30
|
|
|
forall(e=1:mesh_NcpElems,i=1:mesh_maxNips) CPFEM_ffn_all(:,:,i,e) = math_I3
|
2007-11-08 13:56:02 +05:30
|
|
|
allocate(CPFEM_ffn1_all (3,3,mesh_maxNips,mesh_NcpElems)) ; CPFEM_ffn1_all = CPFEM_ffn_all
|
2007-04-11 15:36:28 +05:30
|
|
|
allocate(CPFEM_stress_all( 6,mesh_maxNips,mesh_NcpElems)) ; CPFEM_stress_all = 0.0_pReal
|
|
|
|
allocate(CPFEM_jacobi_all(6,6,mesh_maxNips,mesh_NcpElems)) ; CPFEM_jacobi_all = 0.0_pReal
|
|
|
|
!
|
|
|
|
! *** User defined results !!! MISSING incorporate consti_Nresults ***
|
|
|
|
allocate(CPFEM_results(CPFEM_Nresults+constitutive_maxNresults,constitutive_maxNgrains,mesh_maxNips,mesh_NcpElems))
|
|
|
|
CPFEM_results = 0.0_pReal
|
|
|
|
!
|
|
|
|
! *** Second Piola-Kirchoff stress tensor at (t=t0) and (t=t1) ***
|
|
|
|
allocate(CPFEM_sigma_old(6,constitutive_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; CPFEM_sigma_old = 0.0_pReal
|
|
|
|
allocate(CPFEM_sigma_new(6,constitutive_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; CPFEM_sigma_new = 0.0_pReal
|
|
|
|
!
|
2007-04-17 13:28:53 +05:30
|
|
|
! *** Plastic deformation gradient at (t=t0) and (t=t1) ***
|
2007-04-11 20:58:46 +05:30
|
|
|
allocate(CPFEM_Fp_old(3,3,constitutive_maxNgrains,mesh_maxNips,mesh_NcpElems))
|
|
|
|
forall (e=1:mesh_NcpElems,i=1:mesh_maxNips,g=1:constitutive_maxNgrains) &
|
|
|
|
CPFEM_Fp_old(:,:,g,i,e) = math_EulerToR(constitutive_EulerAngles(:,g,i,e)) ! plastic def gradient reflects init orientation
|
2007-04-11 15:36:28 +05:30
|
|
|
allocate(CPFEM_Fp_new(3,3,constitutive_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; CPFEM_Fp_new = 0.0_pReal
|
2007-04-17 13:28:53 +05:30
|
|
|
!
|
2008-02-18 23:41:24 +05:30
|
|
|
! *** FEM jacobian (consistent tangent) ***
|
|
|
|
allocate(CPFEM_jacobian(6,6,mesh_maxNips,mesh_NcpElems)) ; CPFEM_jacobian = 0.0_pReal
|
2007-04-11 15:36:28 +05:30
|
|
|
!
|
2007-11-15 16:42:58 +05:30
|
|
|
!
|
2007-04-11 15:36:28 +05:30
|
|
|
! *** Output to MARC output file ***
|
|
|
|
write(6,*)
|
|
|
|
write(6,*) 'Arrays allocated:'
|
2007-10-16 22:38:06 +05:30
|
|
|
write(6,*) 'CPFEM_Temperature: ', shape(CPFEM_Temperature)
|
2007-04-11 15:36:28 +05:30
|
|
|
write(6,*) 'CPFEM_ffn_all: ', shape(CPFEM_ffn_all)
|
|
|
|
write(6,*) 'CPFEM_ffn1_all: ', shape(CPFEM_ffn1_all)
|
|
|
|
write(6,*) 'CPFEM_stress_all: ', shape(CPFEM_stress_all)
|
|
|
|
write(6,*) 'CPFEM_jacobi_all: ', shape(CPFEM_jacobi_all)
|
|
|
|
write(6,*) 'CPFEM_results: ', shape(CPFEM_results)
|
|
|
|
write(6,*) 'CPFEM_sigma_old: ', shape(CPFEM_sigma_old)
|
|
|
|
write(6,*) 'CPFEM_sigma_new: ', shape(CPFEM_sigma_new)
|
|
|
|
write(6,*) 'CPFEM_Fp_old: ', shape(CPFEM_Fp_old)
|
|
|
|
write(6,*) 'CPFEM_Fp_new: ', shape(CPFEM_Fp_new)
|
2008-02-18 23:41:24 +05:30
|
|
|
write(6,*) 'CPFEM_jacobian: ', shape(CPFEM_jacobian)
|
2007-04-11 15:36:28 +05:30
|
|
|
write(6,*)
|
|
|
|
call flush(6)
|
|
|
|
return
|
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
END SUBROUTINE
|
2008-02-21 16:03:34 +05:30
|
|
|
!
|
|
|
|
!
|
2007-03-22 17:39:37 +05:30
|
|
|
!***********************************************************************
|
2007-04-11 15:36:28 +05:30
|
|
|
!*** perform initialization at first call, update variables and ***
|
|
|
|
!*** call the actual material model ***
|
2007-03-22 17:39:37 +05:30
|
|
|
!***********************************************************************
|
2007-11-08 13:56:02 +05:30
|
|
|
SUBROUTINE CPFEM_general(ffn, ffn1, Temperature, CPFEM_inc, CPFEM_subinc, CPFEM_cn, CPFEM_stress_recovery, CPFEM_dt,&
|
|
|
|
CPFEM_en, CPFEM_in, CPFEM_stress, CPFEM_jaco, CPFEM_ngens)
|
2007-03-22 17:39:37 +05:30
|
|
|
!
|
|
|
|
use prec, only: pReal,pInt
|
2008-01-11 00:23:57 +05:30
|
|
|
use debug
|
2008-02-18 23:41:24 +05:30
|
|
|
use math, only: math_init, invnrmMandel, math_identity2nd, math_Mandel3333to66,math_Mandel33to6,math_Mandel6to33
|
2007-11-08 13:56:02 +05:30
|
|
|
use mesh, only: mesh_init,mesh_FEasCP, mesh_NcpElems, FE_Nips, FE_mapElemtype, mesh_element
|
2007-10-15 15:46:51 +05:30
|
|
|
use crystal, only: crystal_Init
|
2008-02-15 15:34:49 +05:30
|
|
|
use constitutive, only: constitutive_init,constitutive_state_old,constitutive_state_new,material_Cslip_66
|
2007-03-22 17:39:37 +05:30
|
|
|
implicit none
|
2008-02-15 15:34:49 +05:30
|
|
|
|
2008-03-14 13:53:43 +05:30
|
|
|
integer(pInt) CPFEM_inc, CPFEM_subinc, CPFEM_cn, CPFEM_en, CPFEM_in, cp_en, CPFEM_ngens, i, e
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal) ffn(3,3),ffn1(3,3),Temperature,CPFEM_dt,CPFEM_stress(CPFEM_ngens),CPFEM_jaco(CPFEM_ngens,CPFEM_ngens)
|
2007-11-08 13:56:02 +05:30
|
|
|
logical CPFEM_stress_recovery
|
2008-02-18 23:41:24 +05:30
|
|
|
|
2007-11-08 13:56:02 +05:30
|
|
|
! calculate only every second cycle
|
2008-02-15 15:34:49 +05:30
|
|
|
|
2008-02-18 23:41:24 +05:30
|
|
|
if (mod(CPFEM_cn,2) /= 0) then ! odd cycle: record data for use in even cycle and return stiff result for this odd cycle
|
2008-02-15 15:34:49 +05:30
|
|
|
cp_en = mesh_FEasCP('elem',CPFEM_en)
|
|
|
|
CPFEM_Temperature(CPFEM_in, cp_en) = Temperature
|
|
|
|
CPFEM_ffn_all(:,:,CPFEM_in, cp_en) = ffn
|
|
|
|
CPFEM_ffn1_all(:,:,CPFEM_in, cp_en) = ffn1
|
|
|
|
CPFEM_stress(1:CPFEM_ngens) = CPFEM_odd_stress
|
|
|
|
CPFEM_jaco(1:CPFEM_ngens,1:CPFEM_ngens) = CPFEM_odd_jacobian*math_identity2nd(CPFEM_ngens)
|
2008-02-18 23:41:24 +05:30
|
|
|
CPFEM_cycle_old = CPFEM_cn
|
2008-02-15 15:34:49 +05:30
|
|
|
|
|
|
|
else ! even cycle: really calculate only in first call of new cycle and when in stress recovery
|
|
|
|
|
2008-02-18 23:41:24 +05:30
|
|
|
if (CPFEM_cn /= CPFEM_cycle_old .and. CPFEM_stress_recovery) then
|
2008-02-15 15:34:49 +05:30
|
|
|
if (CPFEM_first_call) then ! initialization step
|
|
|
|
! three dimensional stress state ?
|
2007-11-08 13:56:02 +05:30
|
|
|
call math_init()
|
|
|
|
call mesh_init()
|
|
|
|
call crystal_Init()
|
|
|
|
call constitutive_init()
|
2007-12-14 18:58:41 +05:30
|
|
|
call CPFEM_init()
|
2007-11-08 13:56:02 +05:30
|
|
|
CPFEM_Temperature = Temperature
|
|
|
|
CPFEM_first_call = .false.
|
2008-02-18 23:41:24 +05:30
|
|
|
|
2007-11-08 13:56:02 +05:30
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
|
|
|
|
if (CPFEM_inc == CPFEM_inc_old) then ! not a new increment
|
|
|
|
if (CPFEM_subinc > CPFEM_subinc_old) then ! new subincrement: update starting with subinc 2
|
2007-11-08 13:56:02 +05:30
|
|
|
CPFEM_sigma_old = CPFEM_sigma_new
|
|
|
|
CPFEM_Fp_old = CPFEM_Fp_new
|
|
|
|
constitutive_state_old = constitutive_state_new
|
|
|
|
CPFEM_subinc_old = CPFEM_subinc
|
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
else ! new increment
|
2007-11-08 13:56:02 +05:30
|
|
|
CPFEM_sigma_old = CPFEM_sigma_new
|
|
|
|
CPFEM_Fp_old = CPFEM_Fp_new
|
|
|
|
constitutive_state_old = constitutive_state_new
|
|
|
|
CPFEM_inc_old = CPFEM_inc
|
|
|
|
CPFEM_subinc_old = 1_pInt
|
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
CPFEM_cycle_old = CPFEM_cn
|
|
|
|
|
|
|
|
debug_cutbackDistribution = 0_pInt ! initialize debugging data
|
|
|
|
debug_InnerLoopDistribution = 0_pInt
|
|
|
|
debug_OuterLoopDistribution = 0_pInt
|
|
|
|
|
2007-11-08 13:56:02 +05:30
|
|
|
! this shall be done in a parallel loop in the future
|
2008-02-15 15:34:49 +05:30
|
|
|
|
2007-11-08 13:56:02 +05:30
|
|
|
do e=1,mesh_NcpElems
|
|
|
|
do i=1,FE_Nips(FE_mapElemtype(mesh_element(2,e)))
|
2008-02-18 23:41:24 +05:30
|
|
|
debugger = (e==1 .and. i==1)
|
2007-11-08 13:56:02 +05:30
|
|
|
call CPFEM_stressIP(CPFEM_cn, CPFEM_dt, i, e)
|
|
|
|
enddo
|
|
|
|
enddo
|
2008-02-15 15:34:49 +05:30
|
|
|
|
|
|
|
call debug_info() ! output of debugging/performance statistics
|
2007-11-08 13:56:02 +05:30
|
|
|
end if
|
2008-02-15 15:34:49 +05:30
|
|
|
|
2007-11-08 13:56:02 +05:30
|
|
|
! return stress and jacobi
|
|
|
|
cp_en = mesh_FEasCP('elem', CPFEM_en)
|
2008-02-18 23:41:24 +05:30
|
|
|
CPFEM_stress(1:CPFEM_ngens) = CPFEM_stress_all(1:CPFEM_ngens, CPFEM_in, cp_en)
|
|
|
|
CPFEM_jaco(1:CPFEM_ngens,1:CPFEM_ngens) = CPFEM_jacobian(1:CPFEM_ngens,1:CPFEM_ngens, CPFEM_in, cp_en)
|
2007-11-08 13:56:02 +05:30
|
|
|
end if
|
2007-03-22 17:39:37 +05:30
|
|
|
return
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
END SUBROUTINE
|
2007-03-22 17:39:37 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
|
2007-04-11 15:36:28 +05:30
|
|
|
!**********************************************************
|
|
|
|
!*** calculate the material behaviour at IP level ***
|
|
|
|
!**********************************************************
|
2007-04-17 13:28:53 +05:30
|
|
|
SUBROUTINE CPFEM_stressIP(&
|
|
|
|
CPFEM_cn,& ! Cycle number
|
|
|
|
CPFEM_dt,& ! Time increment (dt)
|
2007-11-08 13:56:02 +05:30
|
|
|
CPFEM_in,& ! Integration point number
|
|
|
|
cp_en) ! Element number
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2007-04-11 20:25:06 +05:30
|
|
|
use prec, only: pReal,pInt,ijaco,nCutback
|
2008-01-11 00:23:57 +05:30
|
|
|
use debug
|
2008-02-15 15:34:49 +05:30
|
|
|
use math, only: math_pDecomposition,math_RtoEuler, inDeg, math_I3, math_invert3x3
|
2007-04-17 13:28:53 +05:30
|
|
|
use IO, only: IO_error
|
|
|
|
use mesh, only: mesh_element
|
|
|
|
use constitutive
|
2008-02-15 15:34:49 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
implicit none
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
integer(pInt), parameter :: i_now = 1_pInt,i_then = 2_pInt
|
|
|
|
character(len=128) msg
|
2008-02-21 16:03:34 +05:30
|
|
|
integer(pInt) CPFEM_cn,cp_en,CPFEM_in,grain,i,max_cutbacks
|
|
|
|
logical updateJaco,error,cutback
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal) CPFEM_dt,dt,t,volfrac,det
|
2007-04-11 15:36:28 +05:30
|
|
|
real(pReal), dimension(6) :: cs,Tstar_v
|
2007-04-11 20:21:49 +05:30
|
|
|
real(pReal), dimension(6,6) :: cd
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal), dimension(3,3) :: Fe,U,R,deltaFg,invFgthen,invFpnow,Lp
|
2007-04-11 15:36:28 +05:30
|
|
|
real(pReal), dimension(3,3,2) :: Fg,Fp
|
2007-04-11 20:21:49 +05:30
|
|
|
real(pReal), dimension(constitutive_maxNstatevars,2) :: state
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2007-11-08 13:56:02 +05:30
|
|
|
updateJaco = (mod(CPFEM_cn,2_pInt*ijaco)==0) ! update consistent tangent every ijaco'th iteration
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
CPFEM_stress_all(:,CPFEM_in,cp_en) = 0.0_pReal ! average Cauchy stress
|
2008-02-18 23:41:24 +05:30
|
|
|
if (updateJaco) CPFEM_jacobian(:,:,CPFEM_in,cp_en) = 0.0_pReal ! average consistent tangent
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
! -------------- grain loop -----------------
|
2007-04-25 19:28:10 +05:30
|
|
|
do grain = 1,texture_Ngrains(mesh_element(4,cp_en))
|
2007-04-11 15:36:28 +05:30
|
|
|
! -------------------------------------------
|
2007-04-17 13:28:53 +05:30
|
|
|
|
2007-04-11 15:36:28 +05:30
|
|
|
i = 0_pInt ! cutback counter
|
2008-02-21 16:03:34 +05:30
|
|
|
max_cutbacks = 0_pInt ! maximum depth of cut backing
|
2008-02-15 15:34:49 +05:30
|
|
|
dt = CPFEM_dt
|
2007-04-11 15:36:28 +05:30
|
|
|
state(:,i_now) = constitutive_state_old(:,grain,CPFEM_in,cp_en)
|
|
|
|
Fg(:,:,i_now) = CPFEM_ffn_all(:,:,CPFEM_in,cp_en)
|
|
|
|
Fp(:,:,i_now) = CPFEM_Fp_old(:,:,grain,CPFEM_in,cp_en)
|
2008-02-15 15:34:49 +05:30
|
|
|
invFgthen = 0.0_pReal
|
|
|
|
invFpnow = 0.0_pReal
|
|
|
|
call math_invert3x3(CPFEM_ffn1_all(:,:,CPFEM_in,cp_en),invFgthen,det,error)
|
|
|
|
call math_invert3x3(Fp(:,:,i_now),invFpnow,det,error)
|
|
|
|
if (dt /= 0.0_pReal) then
|
|
|
|
Lp = (math_I3-matmul(Fp(:,:,i_now),matmul(invFgthen,matmul(Fg(:,:,i_now),invFpnow))))/dt ! fully plastic initial guess
|
|
|
|
else
|
|
|
|
Lp = 0.0_pReal ! fully elastic guess
|
|
|
|
endif
|
2007-04-17 13:28:53 +05:30
|
|
|
|
2007-04-11 15:36:28 +05:30
|
|
|
deltaFg = CPFEM_ffn1_all(:,:,CPFEM_in,cp_en)-CPFEM_ffn_all(:,:,CPFEM_in,cp_en)
|
2007-04-17 13:28:53 +05:30
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
Tstar_v = CPFEM_sigma_old(:,grain,CPFEM_in,cp_en) ! use last result as initial guess
|
2007-04-11 15:36:28 +05:30
|
|
|
Fg(:,:,i_then) = Fg(:,:,i_now)
|
2008-02-15 15:34:49 +05:30
|
|
|
Fp(:,:,i_then) = Fp(:,:,i_now)
|
|
|
|
state(:,i_then) = 0.0_pReal ! state_old as initial guess
|
2007-04-11 15:36:28 +05:30
|
|
|
t = 0.0_pReal
|
2008-02-21 16:03:34 +05:30
|
|
|
cutback = .false. ! no cutback has happened so far
|
2007-04-11 15:36:28 +05:30
|
|
|
! ------- crystallite integration -----------
|
|
|
|
do
|
|
|
|
! -------------------------------------------
|
|
|
|
if (t+dt < CPFEM_dt) then ! intermediate solution
|
|
|
|
t = t+dt ! next time inc
|
|
|
|
Fg(:,:,i_then) = Fg(:,:,i_then)+deltaFg ! corresponding Fg
|
|
|
|
else ! full step solution
|
|
|
|
t = CPFEM_dt ! final time
|
2007-05-14 17:43:36 +05:30
|
|
|
Fg(:,:,i_then) = CPFEM_ffn1_all(:,:,CPFEM_in,cp_en) ! final Fg
|
2007-04-11 15:36:28 +05:30
|
|
|
endif
|
2007-04-17 13:28:53 +05:30
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
call CPFEM_stressCrystallite(msg,cs,cd,Tstar_v,Lp,Fp(:,:,i_then),Fe,state(:,i_then),&
|
2008-02-08 13:55:19 +05:30
|
|
|
t,cp_en,CPFEM_in,grain,updateJaco .and. t==CPFEM_dt,&
|
2008-03-14 13:53:43 +05:30
|
|
|
Fg(:,:,i_then),Fp(:,:,i_now),state(:,i_now))
|
2007-04-11 15:36:28 +05:30
|
|
|
if (msg == 'ok') then ! solution converged
|
2008-01-11 00:23:57 +05:30
|
|
|
if (t == CPFEM_dt) then
|
2008-02-21 16:03:34 +05:30
|
|
|
debug_cutbackDistribution(max_cutbacks+1) = debug_cutbackDistribution(max_cutbacks+1)+1
|
2008-02-15 15:34:49 +05:30
|
|
|
exit ! reached final "then"
|
2008-01-11 00:23:57 +05:30
|
|
|
endif
|
2008-02-21 16:03:34 +05:30
|
|
|
if (cutback == .false.) then ! stable solution at current speed?
|
|
|
|
dt = 2.0_pReal*dt ! double time-step
|
|
|
|
i = i-1_pInt ! dec cutback counter
|
|
|
|
endif
|
|
|
|
cutback = .false. ! solution in next step does not derive from a cutback
|
2007-04-11 15:36:28 +05:30
|
|
|
else ! solution not found
|
|
|
|
i = i+1_pInt ! inc cutback counter
|
2008-02-21 16:03:34 +05:30
|
|
|
max_cutbacks = max(i,max_cutbacks)
|
|
|
|
cutback = .true.
|
2007-04-11 15:36:28 +05:30
|
|
|
if (i > nCutback) then ! limit exceeded?
|
2008-02-15 15:34:49 +05:30
|
|
|
debug_cutbackDistribution(nCutback+1) = debug_cutbackDistribution(nCutback+1)+1
|
2008-02-18 23:41:24 +05:30
|
|
|
write(6,'(x,a,x,i6,x,a,x,i2,x,a,x,i2)') 'element:',cp_en,'IP:',CPFEM_in,'grain:',grain
|
2007-04-11 15:36:28 +05:30
|
|
|
write(6,*) 'cutback limit --> '//msg
|
|
|
|
call IO_error(600)
|
2008-02-15 15:34:49 +05:30
|
|
|
return ! byebye
|
2007-04-11 15:36:28 +05:30
|
|
|
else
|
|
|
|
t = t-dt ! rewind time
|
|
|
|
Fg(:,:,i_then) = Fg(:,:,i_then)-deltaFg ! rewind Fg
|
|
|
|
dt = 0.5_pReal*dt ! cut time-step in half
|
|
|
|
deltaFg = 0.5_pReal*deltaFg ! cut Fg-step in half
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo ! crystallite integration (cutback loop)
|
2007-04-17 13:28:53 +05:30
|
|
|
|
|
|
|
! ---- update crystallite matrices at t = t1 ----
|
2007-04-11 15:36:28 +05:30
|
|
|
CPFEM_Fp_new(:,:,grain,CPFEM_in,cp_en) = Fp(:,:,i_then)
|
|
|
|
constitutive_state_new(:,grain,CPFEM_in,cp_en) = state(:,i_then)
|
|
|
|
CPFEM_sigma_new(:,grain,CPFEM_in,cp_en) = Tstar_v
|
2007-11-06 14:00:04 +05:30
|
|
|
! ---- contribute to IP result ----
|
|
|
|
volfrac = constitutive_matVolFrac(grain,CPFEM_in,cp_en)*constitutive_texVolFrac(grain,CPFEM_in,cp_en)
|
|
|
|
CPFEM_stress_all(:,CPFEM_in,cp_en) = CPFEM_stress_all(:,CPFEM_in,cp_en)+volfrac*cs ! average Cauchy stress
|
2008-02-18 23:41:24 +05:30
|
|
|
if (updateJaco) CPFEM_jacobian(:,:,CPFEM_in,cp_en) = CPFEM_jacobian(:,:,CPFEM_in,cp_en)+volfrac*cd ! average consistent tangent
|
2007-04-17 13:28:53 +05:30
|
|
|
! ---- update results plotted in MENTAT ----
|
2007-04-11 20:21:49 +05:30
|
|
|
call math_pDecomposition(Fe,U,R,error) ! polar decomposition
|
|
|
|
if (error) then
|
|
|
|
write(6,*) 'polar decomposition'
|
|
|
|
write(6,*) 'Grain: ',grain
|
|
|
|
write(6,*) 'Integration point: ',CPFEM_in
|
|
|
|
write(6,*) 'Element: ',mesh_element(1,cp_en)
|
2008-02-15 15:34:49 +05:30
|
|
|
call IO_error(650)
|
2007-04-11 20:21:49 +05:30
|
|
|
return
|
|
|
|
endif
|
2007-10-16 20:17:09 +05:30
|
|
|
CPFEM_results(1:3,grain,CPFEM_in,cp_en) = math_RtoEuler(transpose(R))*inDeg ! orientation
|
2007-11-06 14:00:04 +05:30
|
|
|
CPFEM_results(4 ,grain,CPFEM_in,cp_en) = volfrac ! volume fraction of orientation
|
|
|
|
CPFEM_results(5:4+constitutive_Nresults(grain,CPFEM_in,cp_en),grain,CPFEM_in,cp_en) = &
|
2007-10-16 22:38:06 +05:30
|
|
|
constitutive_post_results(Tstar_v,state(:,i_then),CPFEM_dt,CPFEM_Temperature(CPFEM_in,cp_en),grain,CPFEM_in,cp_en)
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
enddo ! grain loop
|
2007-04-17 13:28:53 +05:30
|
|
|
|
|
|
|
return
|
|
|
|
END SUBROUTINE
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
|
|
|
|
!********************************************************************
|
|
|
|
! Calculates the stress for a single component
|
|
|
|
!********************************************************************
|
2007-04-17 13:28:53 +05:30
|
|
|
subroutine CPFEM_stressCrystallite(&
|
2007-04-11 15:36:28 +05:30
|
|
|
msg,& ! return message
|
2007-03-22 17:39:37 +05:30
|
|
|
cs,& ! Cauchy stress vector
|
2007-04-11 15:36:28 +05:30
|
|
|
dcs_de,& ! consistent tangent
|
2008-02-18 23:41:24 +05:30
|
|
|
Tstar_v,& ! second Piola-Kirchhoff stress tensor
|
2008-02-15 15:34:49 +05:30
|
|
|
Lp,& ! guess of plastic velocity gradient
|
2007-04-11 15:36:28 +05:30
|
|
|
Fp_new,& ! new plastic deformation gradient
|
2007-04-11 20:21:49 +05:30
|
|
|
Fe_new,& ! new "elastic" deformation gradient
|
2007-04-11 15:36:28 +05:30
|
|
|
state_new,& ! new state variable array
|
|
|
|
!
|
2007-04-17 13:28:53 +05:30
|
|
|
dt,& ! time increment
|
2007-04-11 15:36:28 +05:30
|
|
|
cp_en,& ! element number
|
|
|
|
CPFEM_in,& ! integration point number
|
|
|
|
grain,& ! grain number
|
|
|
|
updateJaco,& ! boolean to calculate Jacobi matrix
|
2007-04-17 13:28:53 +05:30
|
|
|
Fg_new,& ! new global deformation gradient
|
|
|
|
Fp_old,& ! old plastic deformation gradient
|
|
|
|
state_old) ! old state variable array
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2008-02-18 23:41:24 +05:30
|
|
|
use prec, only: pReal,pInt,pert_Fg
|
2008-02-15 15:34:49 +05:30
|
|
|
use debug
|
2007-03-28 12:09:48 +05:30
|
|
|
use constitutive, only: constitutive_Nstatevars
|
2008-02-15 15:34:49 +05:30
|
|
|
use mesh, only: mesh_element
|
2008-02-21 16:03:34 +05:30
|
|
|
use math, only: math_Mandel6to33,math_Mandel33to6,math_Mandel3333to66,&
|
|
|
|
math_I3,math_det3x3,math_invert3x3
|
2007-04-17 13:28:53 +05:30
|
|
|
implicit none
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
character(len=*) msg
|
2008-02-18 23:41:24 +05:30
|
|
|
logical updateJaco,error
|
|
|
|
integer(pInt) cp_en,CPFEM_in,grain,i,j,k,l,m,n
|
|
|
|
real(pReal) dt,invJ,det
|
|
|
|
real(pReal), dimension(3,3,3,3) :: A,H
|
2008-03-14 13:53:43 +05:30
|
|
|
real(pReal), dimension(3,3) :: Lp,Lp_pert,Fg_new,Fg_pert,Fp_old,Fp_new,invFp_new,Fp_pert,invFp_pert
|
|
|
|
real(pReal), dimension(3,3) :: Fe_new,Fe_pert,Tstar,tau,P,P_pert
|
2007-04-11 20:21:49 +05:30
|
|
|
real(pReal), dimension(6) :: cs,Tstar_v,Tstar_v_pert
|
2007-04-11 15:36:28 +05:30
|
|
|
real(pReal), dimension(6,6) :: dcs_de
|
2007-04-11 20:21:49 +05:30
|
|
|
real(pReal), dimension(constitutive_Nstatevars(grain,CPFEM_in,cp_en)) :: state_old,state_new,state_pert
|
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
call CPFEM_timeIntegration(msg,Lp,Fp_new,Fe_new,Tstar_v,state_new, & ! def gradients and PK2 at end of time step
|
2008-03-14 13:53:43 +05:30
|
|
|
dt,cp_en,CPFEM_in,grain,Fg_new,Fp_old,state_old)
|
2008-02-15 15:34:49 +05:30
|
|
|
if (msg /= 'ok') return ! solution not reached --> report back
|
2008-02-18 23:41:24 +05:30
|
|
|
Tstar = math_Mandel6to33(Tstar_v) ! second PK in intermediate
|
|
|
|
tau = matmul(Fe_new,matmul(Tstar,transpose(Fe_new))) ! Kirchhoff stress
|
|
|
|
invJ = 1.0_pReal/math_det3x3(Fe_new) ! inverse dilatation of Fe
|
|
|
|
cs = math_Mandel33to6(invJ*tau) ! Cauchy stress
|
2008-02-21 16:03:34 +05:30
|
|
|
if (updateJaco) then ! consistent tangent using
|
|
|
|
! numerical perturbation of Fg (D. Tjahjanto Diss p.106)
|
2008-02-18 23:41:24 +05:30
|
|
|
call math_invert3x3(Fp_new,invFp_new,det,error)
|
|
|
|
if (error) then
|
|
|
|
msg = 'inversion of Fp_new'
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
P = matmul(Fe_new,&
|
|
|
|
matmul(Tstar,transpose(invFp_new))) ! first PK at center
|
|
|
|
do k=1,3
|
|
|
|
do l=1,3
|
|
|
|
Fg_pert = Fg_new ! initialize perturbed Fg
|
|
|
|
Fg_pert(k,l) = Fg_pert(k,l) + pert_Fg ! perturb single component
|
|
|
|
Lp_pert = Lp
|
|
|
|
state_pert = state_new ! initial guess from end of time step
|
|
|
|
call CPFEM_timeIntegration(msg,Lp_pert,Fp_pert,Fe_pert,Tstar_v_pert,state_pert, &
|
2008-03-14 13:53:43 +05:30
|
|
|
dt,cp_en,CPFEM_in,grain,Fg_pert,Fp_old,state_old)
|
2008-02-18 23:41:24 +05:30
|
|
|
if (msg /= 'ok') then
|
|
|
|
msg = 'consistent tangent --> '//msg
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
call math_invert3x3(Fp_pert,invFp_pert,det,error)
|
|
|
|
if (error) then
|
|
|
|
msg = 'inversion of Fp_pert'
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
P_pert = matmul(Fe_pert,&
|
|
|
|
matmul(math_mandel6to33(Tstar_v_pert),transpose(invFp_pert))) ! perturbed first PK
|
|
|
|
A(:,:,k,l) = (P_pert-P)/pert_Fg ! dP_ij/dFg_kl
|
|
|
|
enddo
|
2007-04-17 13:28:53 +05:30
|
|
|
enddo
|
2008-02-18 23:41:24 +05:30
|
|
|
|
|
|
|
H = 0.0_pReal
|
|
|
|
forall(i=1:3,j=1:3,k=1:3,l=1:3,m=1:3,n=1:3) &
|
|
|
|
H(i,j,k,l) = H(i,j,k,l) + &
|
|
|
|
(Fg_new(j,m)*Fg_new(l,n)*A(i,m,k,n) - math_I3(j,l)*Fg_new(i,m)*P(k,m)) + &
|
|
|
|
0.5_pReal*(math_I3(i,k)*tau(j,l) + math_I3(j,l)*tau(i,k) + &
|
|
|
|
math_I3(i,l)*tau(j,k) + math_I3(j,k)*tau(i,l))
|
|
|
|
dcs_de = math_Mandel3333to66(invJ*H) ! Mandel version of stiffness tensor
|
2007-04-11 15:36:28 +05:30
|
|
|
endif
|
2007-04-11 20:21:49 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
return
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
END SUBROUTINE
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
|
|
|
|
!***********************************************************************
|
|
|
|
!*** fully-implicit two-level time integration ***
|
2008-02-15 15:34:49 +05:30
|
|
|
!*** based on a residuum in Lp and intermediate ***
|
|
|
|
!*** acceleration of the Newton-Raphson correction ***
|
2007-04-11 15:36:28 +05:30
|
|
|
!***********************************************************************
|
2007-04-17 13:28:53 +05:30
|
|
|
SUBROUTINE CPFEM_timeIntegration(&
|
2007-04-11 15:36:28 +05:30
|
|
|
msg,& ! return message
|
2008-02-15 15:34:49 +05:30
|
|
|
Lpguess,& ! guess of plastic velocity gradient
|
2007-04-11 15:36:28 +05:30
|
|
|
Fp_new,& ! new plastic deformation gradient
|
|
|
|
Fe_new,& ! new "elastic" deformation gradient
|
|
|
|
Tstar_v,& ! 2nd PK stress (taken as initial guess if /= 0)
|
2008-02-15 15:34:49 +05:30
|
|
|
state,& ! current microstructure at end of time inc (taken as guess if /= 0)
|
2007-04-11 15:36:28 +05:30
|
|
|
!
|
2007-04-17 13:28:53 +05:30
|
|
|
dt,& ! time increment
|
2007-04-11 15:36:28 +05:30
|
|
|
cp_en,& ! element number
|
|
|
|
CPFEM_in,& ! integration point number
|
|
|
|
grain,& ! grain number
|
2007-04-17 13:28:53 +05:30
|
|
|
Fg_new,& ! new total def gradient
|
|
|
|
Fp_old,& ! former plastic def gradient
|
2007-04-11 15:36:28 +05:30
|
|
|
state_old) ! former microstructure
|
2007-04-17 13:28:53 +05:30
|
|
|
|
2007-07-20 19:02:44 +05:30
|
|
|
use prec
|
2008-01-11 00:23:57 +05:30
|
|
|
use debug
|
2008-02-15 15:34:49 +05:30
|
|
|
use mesh, only: mesh_element
|
2007-04-11 15:36:28 +05:30
|
|
|
use constitutive, only: constitutive_Nstatevars,&
|
2007-10-16 17:00:05 +05:30
|
|
|
constitutive_homogenizedC,constitutive_dotState,constitutive_LpAndItsTangent,&
|
2007-12-14 19:06:04 +05:30
|
|
|
constitutive_Microstructure
|
2007-04-17 13:28:53 +05:30
|
|
|
use math
|
2007-03-26 15:57:34 +05:30
|
|
|
implicit none
|
2007-04-11 15:36:28 +05:30
|
|
|
|
|
|
|
character(len=*) msg
|
|
|
|
integer(pInt) cp_en, CPFEM_in, grain
|
2008-02-15 15:34:49 +05:30
|
|
|
integer(pInt) iOuter,iInner,dummy, i,j,k,l,m,n
|
2008-03-14 13:53:43 +05:30
|
|
|
real(pReal) dt, det, p_hydro, leapfrog,maxleap
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal), dimension(6) :: Tstar_v
|
|
|
|
|
|
|
|
real(pReal), dimension(9,9) :: dLp,dTdLp,dRdLp,invdRdLp,eye2
|
|
|
|
real(pReal), dimension(6,6) :: C_66
|
2008-03-14 13:53:43 +05:30
|
|
|
real(pReal), dimension(3,3) :: Fg_new,invFg_new,Fp_new,invFp_new,Fp_old,invFp_old,Fe_new,Fe_old
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal), dimension(3,3) :: Tstar
|
2008-03-14 13:53:43 +05:30
|
|
|
real(pReal), dimension(3,3) :: Lp,Lpguess,Lpguess_old,Rinner,Rinner_old,A,B,BT,AB,BTA
|
2008-02-15 15:34:49 +05:30
|
|
|
real(pReal), dimension(3,3,3,3) :: C
|
|
|
|
real(pReal), dimension(constitutive_Nstatevars(grain, CPFEM_in, cp_en)) :: state_old,state,ROuter
|
2007-04-11 15:36:28 +05:30
|
|
|
logical failed
|
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
msg = 'ok' ! error-free so far
|
2008-02-15 15:34:49 +05:30
|
|
|
|
|
|
|
eye2 = math_identity2nd(9)
|
|
|
|
call math_invert3x3(Fp_old,invFp_old,det,failed) ! inversion of Fp_old
|
2007-04-17 13:28:53 +05:30
|
|
|
if (failed) then
|
|
|
|
msg = 'inversion Fp_old'
|
|
|
|
return
|
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
call math_invert3x3(Fg_new,invFg_new,det,failed) ! inversion of Fg_new
|
|
|
|
if (failed) then
|
|
|
|
msg = 'inversion Fg_new'
|
|
|
|
return
|
|
|
|
endif
|
2007-04-11 15:36:28 +05:30
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
Fe_old = matmul(Fg_new,invFp_old)
|
|
|
|
A = matmul(transpose(Fe_old), Fe_old)
|
2007-12-07 16:04:21 +05:30
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
if (all(state == 0.0_pReal)) state = state_old ! former state guessed, if none specified
|
|
|
|
iOuter = 0_pInt ! outer counter
|
2007-03-28 19:02:25 +05:30
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
Outer: do ! outer iteration: State
|
|
|
|
iOuter = iOuter+1
|
|
|
|
if (iOuter > nOuter) then
|
|
|
|
msg = 'limit Outer iteration'
|
|
|
|
debug_OuterLoopDistribution(nOuter) = debug_OuterLoopDistribution(nOuter)+1
|
2007-04-11 15:36:28 +05:30
|
|
|
return
|
2007-04-17 13:28:53 +05:30
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
call constitutive_Microstructure(state,CPFEM_Temperature(CPFEM_in,cp_en),grain,CPFEM_in,cp_en)
|
|
|
|
C_66 = constitutive_HomogenizedC(state, grain, CPFEM_in, cp_en)
|
|
|
|
C = math_Mandel66to3333(C_66) ! 4th rank elasticity tensor
|
|
|
|
|
|
|
|
iInner = 0_pInt
|
|
|
|
leapfrog = 1.0_pReal ! correction as suggested by invdRdLp-step
|
|
|
|
maxleap = 1024.0_pReal ! preassign maximum acceleration level
|
|
|
|
|
|
|
|
Inner: do ! inner iteration: Lp
|
|
|
|
iInner = iInner+1
|
|
|
|
if (iInner > nInner) then ! too many loops required
|
|
|
|
msg = 'limit Inner iteration'
|
|
|
|
debug_InnerLoopDistribution(nInner) = debug_InnerLoopDistribution(nInner)+1
|
2007-04-11 15:36:28 +05:30
|
|
|
return
|
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
B = math_i3 - dt*Lpguess
|
|
|
|
BT = transpose(B)
|
2007-04-23 18:53:03 +05:30
|
|
|
AB = matmul(A,B)
|
2008-02-15 15:34:49 +05:30
|
|
|
BTA = matmul(BT,A)
|
|
|
|
Tstar_v = 0.5_pReal*matmul(C_66,math_mandel33to6(matmul(BT,AB)-math_I3))
|
|
|
|
Tstar = math_Mandel6to33(Tstar_v)
|
|
|
|
p_hydro=(Tstar_v(1)+Tstar_v(2)+Tstar_v(3))/3.0_pReal
|
|
|
|
forall(i=1:3) Tstar_v(i) = Tstar_v(i)-p_hydro ! subtract hydrostatic pressure
|
|
|
|
call constitutive_LpAndItsTangent(Lp,dLp, &
|
|
|
|
Tstar_v,state,CPFEM_Temperature(CPFEM_in,cp_en),grain,CPFEM_in,cp_en)
|
|
|
|
Rinner = Lpguess - Lp ! update current residuum
|
|
|
|
if (( maxval(abs(Rinner)) < abstol_Inner ) .or. &
|
|
|
|
( any(abs(dt*Lpguess) > relevantStrain) .and. &
|
|
|
|
maxval(abs(Rinner/Lpguess),abs(dt*Lpguess) > relevantStrain) < reltol_Inner )&
|
|
|
|
) exit Inner
|
|
|
|
|
|
|
|
! check for acceleration/deceleration in Newton--Raphson correction
|
|
|
|
|
|
|
|
if (leapfrog > 1.0_pReal .and. &
|
|
|
|
(sum(Rinner*Rinner) > sum(Rinner_old*Rinner_old) .or. & ! worse residuum
|
|
|
|
sum(Rinner*Rinner_old) < 0.0_pReal)) then ! residuum changed sign (overshoot)
|
|
|
|
|
|
|
|
maxleap = 0.5_pReal * leapfrog ! limit next acceleration
|
|
|
|
leapfrog = 1.0_pReal ! grinding halt
|
|
|
|
|
|
|
|
else ! better residuum
|
|
|
|
|
|
|
|
dTdLp = 0.0_pReal ! calc dT/dLp
|
|
|
|
forall (i=1:3,j=1:3,k=1:3,l=1:3,m=1:3,n=1:3) &
|
|
|
|
dTdLp(3*(i-1)+j,3*(k-1)+l) = dTdLp(3*(i-1)+j,3*(k-1)+l) + &
|
|
|
|
C(i,j,l,n)*AB(k,n)+C(i,j,m,l)*BTA(m,k)
|
|
|
|
dTdLp = -0.5_pReal*dt*dTdLp
|
|
|
|
|
|
|
|
dRdLp = eye2 - matmul(dLp,dTdLp) ! calc dR/dLp
|
|
|
|
|
|
|
|
invdRdLp = 0.0_pReal
|
|
|
|
call math_invert(9,dRdLp,invdRdLp,dummy,failed) ! invert dR/dLp --> dLp/dR
|
|
|
|
if (failed) then
|
|
|
|
msg = 'inversion dR/dLp'
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
Rinner_old = Rinner ! remember current residuum
|
|
|
|
Lpguess_old = Lpguess ! remember current Lp guess
|
|
|
|
if (iInner > 1 .and. leapfrog < maxleap) &
|
|
|
|
leapfrog = 2.0_pReal * leapfrog ! accelerate
|
2007-04-17 13:28:53 +05:30
|
|
|
endif
|
|
|
|
|
2008-02-15 15:34:49 +05:30
|
|
|
Lpguess = Lpguess_old ! start from current guess
|
|
|
|
Rinner = Rinner_old ! use current residuum
|
|
|
|
forall (i=1:3,j=1:3,k=1:3,l=1:3) & ! leapfrog to updated Lpguess
|
|
|
|
Lpguess(i,j) = Lpguess(i,j) - leapfrog*invdRdLp(3*(i-1)+j,3*(k-1)+l)*Rinner(k,l)
|
|
|
|
|
|
|
|
enddo Inner
|
|
|
|
|
|
|
|
debug_InnerLoopDistribution(iInner) = debug_InnerLoopDistribution(iInner)+1
|
|
|
|
ROuter = state - state_old - &
|
|
|
|
dt*constitutive_dotState(Tstar_v,state,CPFEM_Temperature(CPFEM_in,cp_en),&
|
2008-02-18 23:41:24 +05:30
|
|
|
grain,CPFEM_in,cp_en) ! residuum from evolution of microstructure
|
|
|
|
state = state - ROuter ! update of microstructure
|
2008-02-15 15:34:49 +05:30
|
|
|
if (maxval(abs(Router/state),state /= 0.0_pReal) < reltol_Outer) exit Outer
|
|
|
|
|
|
|
|
enddo Outer
|
|
|
|
|
|
|
|
debug_OuterLoopDistribution(iOuter) = debug_OuterLoopDistribution(iOuter)+1
|
2007-04-17 13:28:53 +05:30
|
|
|
invFp_new = matmul(invFp_old,B)
|
2007-04-11 15:36:28 +05:30
|
|
|
call math_invert3x3(invFp_new,Fp_new,det,failed)
|
|
|
|
if (failed) then
|
|
|
|
msg = 'inversion Fp_new'
|
2007-03-26 20:21:01 +05:30
|
|
|
return
|
|
|
|
endif
|
2008-02-15 15:34:49 +05:30
|
|
|
Fp_new = Fp_new*det**(1.0_pReal/3.0_pReal) ! regularize Fp by det = det(InvFp_new) !!
|
|
|
|
Fe_new = matmul(Fg_new,invFp_new) ! calc resulting Fe
|
|
|
|
forall (i=1:3) Tstar_v(i) = Tstar_v(i)+p_hydro ! add hydrostatic component back
|
2008-02-18 23:41:24 +05:30
|
|
|
|
2007-04-17 13:28:53 +05:30
|
|
|
return
|
2008-01-11 00:23:57 +05:30
|
|
|
|
2007-04-11 15:36:28 +05:30
|
|
|
END SUBROUTINE
|
2007-04-17 13:28:53 +05:30
|
|
|
|
|
|
|
|
2007-04-11 15:36:28 +05:30
|
|
|
END MODULE
|