2015-05-28 22:32:23 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @brief material subroutine for non-locally evolving damage field
|
|
|
|
!> @details to be done
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module damage_nonlocal
|
2019-05-28 15:36:21 +05:30
|
|
|
use prec
|
|
|
|
use material
|
|
|
|
use numerics
|
|
|
|
use config
|
|
|
|
use crystallite
|
|
|
|
use lattice
|
|
|
|
use mesh
|
|
|
|
use source_damage_isoBrittle
|
|
|
|
use source_damage_isoDuctile
|
|
|
|
use source_damage_anisoBrittle
|
|
|
|
use source_damage_anisoDuctile
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
private
|
|
|
|
|
2019-06-11 13:18:07 +05:30
|
|
|
integer, dimension(:,:), allocatable, target, public :: &
|
|
|
|
damage_nonlocal_sizePostResult
|
|
|
|
character(len=64), dimension(:,:), allocatable, target, public :: &
|
|
|
|
damage_nonlocal_output
|
|
|
|
integer, dimension(:), allocatable, target, public :: &
|
|
|
|
damage_nonlocal_Noutput
|
2019-05-28 15:36:21 +05:30
|
|
|
|
|
|
|
enum, bind(c)
|
2019-06-11 13:18:07 +05:30
|
|
|
enumerator :: &
|
|
|
|
undefined_ID, &
|
|
|
|
damage_ID
|
2019-05-28 15:36:21 +05:30
|
|
|
end enum
|
|
|
|
|
|
|
|
type :: tParameters
|
2019-06-11 13:18:07 +05:30
|
|
|
integer(kind(undefined_ID)), dimension(:), allocatable :: &
|
2019-05-28 15:36:21 +05:30
|
|
|
outputID
|
|
|
|
end type tParameters
|
|
|
|
|
2019-06-11 13:18:07 +05:30
|
|
|
type(tparameters), dimension(:), allocatable :: &
|
2019-05-28 15:36:21 +05:30
|
|
|
param
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
public :: &
|
|
|
|
damage_nonlocal_init, &
|
|
|
|
damage_nonlocal_getSourceAndItsTangent, &
|
|
|
|
damage_nonlocal_getDiffusion33, &
|
|
|
|
damage_nonlocal_getMobility, &
|
|
|
|
damage_nonlocal_putNonLocalDamage, &
|
|
|
|
damage_nonlocal_postResults
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
contains
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief module initialization
|
|
|
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-03-09 03:46:56 +05:30
|
|
|
subroutine damage_nonlocal_init
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
integer :: maxNinstance,homog,instance,o,i
|
|
|
|
integer :: sizeState
|
|
|
|
integer :: NofMyHomog, h
|
|
|
|
integer(kind(undefined_ID)) :: &
|
|
|
|
outputID
|
|
|
|
character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::]
|
|
|
|
character(len=65536), dimension(:), allocatable :: &
|
|
|
|
outputs
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_nonlocal_label//' init -+>>>'
|
|
|
|
|
|
|
|
maxNinstance = count(damage_type == DAMAGE_nonlocal_ID)
|
|
|
|
if (maxNinstance == 0) return
|
2019-03-09 03:46:56 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
allocate(damage_nonlocal_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0)
|
|
|
|
allocate(damage_nonlocal_output (maxval(homogenization_Noutput),maxNinstance))
|
|
|
|
damage_nonlocal_output = ''
|
|
|
|
allocate(damage_nonlocal_Noutput (maxNinstance), source=0)
|
|
|
|
|
|
|
|
allocate(param(maxNinstance))
|
2019-03-09 03:46:56 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
do h = 1, size(damage_type)
|
|
|
|
if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle
|
|
|
|
associate(prm => param(damage_typeInstance(h)), &
|
|
|
|
config => config_homogenization(h))
|
|
|
|
|
|
|
|
instance = damage_typeInstance(h)
|
|
|
|
outputs = config%getStrings('(output)',defaultVal=emptyStringArray)
|
|
|
|
allocate(prm%outputID(0))
|
|
|
|
|
|
|
|
do i=1, size(outputs)
|
|
|
|
outputID = undefined_ID
|
|
|
|
select case(outputs(i))
|
|
|
|
|
|
|
|
case ('damage')
|
|
|
|
damage_nonlocal_output(i,damage_typeInstance(h)) = outputs(i)
|
|
|
|
damage_nonlocal_Noutput(instance) = damage_nonlocal_Noutput(instance) + 1
|
|
|
|
damage_nonlocal_sizePostResult(i,damage_typeInstance(h)) = 1
|
|
|
|
prm%outputID = [prm%outputID , damage_ID]
|
|
|
|
end select
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
homog = h
|
|
|
|
|
|
|
|
NofMyHomog = count(material_homogenizationAt == homog)
|
|
|
|
instance = damage_typeInstance(homog)
|
|
|
|
|
|
|
|
|
|
|
|
! allocate state arrays
|
|
|
|
sizeState = 1
|
|
|
|
damageState(homog)%sizeState = sizeState
|
|
|
|
damageState(homog)%sizePostResults = sum(damage_nonlocal_sizePostResult(:,instance))
|
|
|
|
allocate(damageState(homog)%state0 (sizeState,NofMyHomog), source=damage_initialPhi(homog))
|
|
|
|
allocate(damageState(homog)%subState0(sizeState,NofMyHomog), source=damage_initialPhi(homog))
|
|
|
|
allocate(damageState(homog)%state (sizeState,NofMyHomog), source=damage_initialPhi(homog))
|
|
|
|
|
|
|
|
nullify(damageMapping(homog)%p)
|
|
|
|
damageMapping(homog)%p => mappingHomogenization(1,:,:)
|
|
|
|
deallocate(damage(homog)%p)
|
|
|
|
damage(homog)%p => damageState(homog)%state(1,:)
|
|
|
|
|
|
|
|
end associate
|
|
|
|
enddo
|
2015-05-28 22:32:23 +05:30
|
|
|
end subroutine damage_nonlocal_init
|
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief calculates homogenized damage driving forces
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el)
|
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
phi
|
|
|
|
integer :: &
|
|
|
|
phase, &
|
|
|
|
grain, &
|
|
|
|
source, &
|
|
|
|
constituent
|
|
|
|
real(pReal) :: &
|
|
|
|
phiDot, dPhiDot_dPhi, localphiDot, dLocalphiDot_dPhi
|
|
|
|
|
|
|
|
phiDot = 0.0_pReal
|
|
|
|
dPhiDot_dPhi = 0.0_pReal
|
|
|
|
do grain = 1, homogenization_Ngrains(material_homogenizationAt(el))
|
2019-06-14 12:32:28 +05:30
|
|
|
phase = material_phaseAt(grain,el)
|
2019-06-14 12:39:16 +05:30
|
|
|
constituent = material_phasememberAt(grain,ip,el)
|
2019-05-28 15:36:21 +05:30
|
|
|
do source = 1, phase_Nsources(phase)
|
|
|
|
select case(phase_source(source,phase))
|
|
|
|
case (SOURCE_damage_isoBrittle_ID)
|
|
|
|
call source_damage_isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
|
|
|
|
|
|
|
case (SOURCE_damage_isoDuctile_ID)
|
|
|
|
call source_damage_isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
|
|
|
|
|
|
|
case (SOURCE_damage_anisoBrittle_ID)
|
|
|
|
call source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
|
|
|
|
|
|
|
case (SOURCE_damage_anisoDuctile_ID)
|
|
|
|
call source_damage_anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
|
|
|
|
|
|
|
case default
|
|
|
|
localphiDot = 0.0_pReal
|
|
|
|
dLocalphiDot_dPhi = 0.0_pReal
|
|
|
|
|
|
|
|
end select
|
|
|
|
phiDot = phiDot + localphiDot
|
|
|
|
dPhiDot_dPhi = dPhiDot_dPhi + dLocalphiDot_dPhi
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
phiDot = phiDot/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal)
|
|
|
|
dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
end subroutine damage_nonlocal_getSourceAndItsTangent
|
|
|
|
|
2019-05-17 02:44:47 +05:30
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns homogenized non local damage diffusion tensor in reference configuration
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function damage_nonlocal_getDiffusion33(ip,el)
|
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
real(pReal), dimension(3,3) :: &
|
|
|
|
damage_nonlocal_getDiffusion33
|
|
|
|
integer :: &
|
|
|
|
homog, &
|
|
|
|
grain
|
|
|
|
|
|
|
|
homog = material_homogenizationAt(el)
|
|
|
|
damage_nonlocal_getDiffusion33 = 0.0_pReal
|
|
|
|
do grain = 1, homogenization_Ngrains(homog)
|
|
|
|
damage_nonlocal_getDiffusion33 = damage_nonlocal_getDiffusion33 + &
|
2019-06-15 17:27:24 +05:30
|
|
|
crystallite_push33ToRef(grain,ip,el,lattice_DamageDiffusion33(1:3,1:3,material_phaseAt(grain,el)))
|
2019-05-28 15:36:21 +05:30
|
|
|
enddo
|
|
|
|
|
|
|
|
damage_nonlocal_getDiffusion33 = &
|
|
|
|
charLength**2*damage_nonlocal_getDiffusion33/real(homogenization_Ngrains(homog),pReal)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
end function damage_nonlocal_getDiffusion33
|
|
|
|
|
2019-05-17 02:44:47 +05:30
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Returns homogenized nonlocal damage mobility
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
real(pReal) function damage_nonlocal_getMobility(ip,el)
|
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
integer :: &
|
|
|
|
ipc
|
|
|
|
|
|
|
|
damage_nonlocal_getMobility = 0.0_pReal
|
|
|
|
|
2019-06-07 00:44:37 +05:30
|
|
|
do ipc = 1, homogenization_Ngrains(material_homogenizationAt(el))
|
2019-06-15 17:27:24 +05:30
|
|
|
damage_nonlocal_getMobility = damage_nonlocal_getMobility + lattice_DamageMobility(material_phaseAt(ipc,el))
|
2019-05-28 15:36:21 +05:30
|
|
|
enddo
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
damage_nonlocal_getMobility = damage_nonlocal_getMobility/&
|
2019-06-07 00:44:37 +05:30
|
|
|
real(homogenization_Ngrains(material_homogenizationAt(el)),pReal)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
end function damage_nonlocal_getMobility
|
|
|
|
|
2019-05-17 02:44:47 +05:30
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief updated nonlocal damage field with solution from damage phase field PDE
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
subroutine damage_nonlocal_putNonLocalDamage(phi,ip,el)
|
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
phi
|
|
|
|
integer :: &
|
|
|
|
homog, &
|
|
|
|
offset
|
|
|
|
|
|
|
|
homog = material_homogenizationAt(el)
|
|
|
|
offset = damageMapping(homog)%p(ip,el)
|
|
|
|
damage(homog)%p(offset) = phi
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
end subroutine damage_nonlocal_putNonLocalDamage
|
2019-05-17 02:44:47 +05:30
|
|
|
|
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return array of damage results
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function damage_nonlocal_postResults(ip,el)
|
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
ip, & !< integration point
|
|
|
|
el !< element
|
|
|
|
real(pReal), dimension(sum(damage_nonlocal_sizePostResult(:,damage_typeInstance(material_homogenizationAt(el))))) :: &
|
|
|
|
damage_nonlocal_postResults
|
|
|
|
|
|
|
|
integer :: &
|
|
|
|
instance, homog, offset, o, c
|
|
|
|
|
|
|
|
homog = material_homogenizationAt(el)
|
|
|
|
offset = damageMapping(homog)%p(ip,el)
|
|
|
|
instance = damage_typeInstance(homog)
|
|
|
|
associate(prm => param(instance))
|
|
|
|
c = 0
|
|
|
|
|
|
|
|
outputsLoop: do o = 1,size(prm%outputID)
|
|
|
|
select case(prm%outputID(o))
|
|
|
|
|
|
|
|
case (damage_ID)
|
|
|
|
damage_nonlocal_postResults(c+1) = damage(homog)%p(offset)
|
|
|
|
c = c + 1
|
|
|
|
end select
|
|
|
|
enddo outputsLoop
|
2019-03-09 03:46:56 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
end associate
|
2015-05-28 22:32:23 +05:30
|
|
|
end function damage_nonlocal_postResults
|
|
|
|
|
|
|
|
end module damage_nonlocal
|