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-15 02:14:38 +05:30
|
|
|
use prec
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
implicit none
|
|
|
|
private
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, dimension(:,:), allocatable, target, public :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
damage_nonlocal_sizePostResult !< size of each post result output
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
character(len=64), dimension(:,:), allocatable, target, public :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
damage_nonlocal_output !< name of each post result output
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, dimension(:), allocatable, target, public :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
damage_nonlocal_Noutput !< number of outputs per instance of this damage
|
|
|
|
|
|
|
|
enum, bind(c)
|
|
|
|
enumerator :: undefined_ID, &
|
|
|
|
damage_ID
|
|
|
|
end enum
|
|
|
|
|
2019-03-09 03:46:56 +05:30
|
|
|
type, private :: tParameters
|
|
|
|
integer(kind(undefined_ID)), dimension(:), allocatable :: &
|
|
|
|
outputID
|
|
|
|
end type tParameters
|
|
|
|
|
|
|
|
type(tparameters), dimension(:), allocatable, private :: &
|
|
|
|
param
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
public :: &
|
|
|
|
damage_nonlocal_init, &
|
|
|
|
damage_nonlocal_getSourceAndItsTangent, &
|
|
|
|
damage_nonlocal_getDiffusion33, &
|
|
|
|
damage_nonlocal_getMobility, &
|
|
|
|
damage_nonlocal_putNonLocalDamage, &
|
|
|
|
damage_nonlocal_postResults
|
|
|
|
|
|
|
|
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
|
|
|
use material, only: &
|
|
|
|
damage_type, &
|
|
|
|
damage_typeInstance, &
|
|
|
|
homogenization_Noutput, &
|
|
|
|
DAMAGE_nonlocal_label, &
|
|
|
|
DAMAGE_nonlocal_ID, &
|
2019-03-10 15:32:32 +05:30
|
|
|
material_homogenizationAt, &
|
2015-05-28 22:32:23 +05:30
|
|
|
mappingHomogenization, &
|
|
|
|
damageState, &
|
|
|
|
damageMapping, &
|
|
|
|
damage, &
|
2018-06-10 21:31:52 +05:30
|
|
|
damage_initialPhi
|
2018-06-14 10:09:49 +05:30
|
|
|
use config, only: &
|
2019-03-09 03:46:56 +05:30
|
|
|
config_homogenization
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer :: maxNinstance,homog,instance,o,i
|
|
|
|
integer :: sizeState
|
|
|
|
integer :: NofMyHomog, h
|
|
|
|
integer(kind(undefined_ID)) :: &
|
2019-03-09 03:46:56 +05:30
|
|
|
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
|
|
|
|
2017-11-21 19:38:45 +05:30
|
|
|
write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_nonlocal_label//' init -+>>>'
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
maxNinstance = int(count(damage_type == DAMAGE_nonlocal_ID))
|
|
|
|
if (maxNinstance == 0) return
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
allocate(damage_nonlocal_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0)
|
2015-05-28 22:32:23 +05:30
|
|
|
allocate(damage_nonlocal_output (maxval(homogenization_Noutput),maxNinstance))
|
|
|
|
damage_nonlocal_output = ''
|
2019-05-15 02:14:38 +05:30
|
|
|
allocate(damage_nonlocal_Noutput (maxNinstance), source=0)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-03-09 03:46:56 +05:30
|
|
|
allocate(param(maxNinstance))
|
|
|
|
|
|
|
|
do h = 1, size(damage_type)
|
|
|
|
if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle
|
|
|
|
associate(prm => param(damage_typeInstance(h)), &
|
|
|
|
config => config_homogenization(h))
|
|
|
|
|
2019-03-09 12:31:20 +05:30
|
|
|
instance = damage_typeInstance(h)
|
2019-03-09 03:46:56 +05:30
|
|
|
outputs = config%getStrings('(output)',defaultVal=emptyStringArray)
|
|
|
|
allocate(prm%outputID(0))
|
|
|
|
|
|
|
|
do i=1, size(outputs)
|
|
|
|
outputID = undefined_ID
|
|
|
|
select case(outputs(i))
|
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
case ('damage')
|
2019-03-09 03:46:56 +05:30
|
|
|
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]
|
2015-05-28 22:32:23 +05:30
|
|
|
end select
|
2019-03-09 03:46:56 +05:30
|
|
|
|
|
|
|
enddo
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-03-09 03:46:56 +05:30
|
|
|
homog = h
|
|
|
|
|
2019-03-10 15:32:32 +05:30
|
|
|
NofMyHomog = count(material_homogenizationAt == homog)
|
2019-03-09 03:46:56 +05:30
|
|
|
instance = damage_typeInstance(homog)
|
|
|
|
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
! allocate state arrays
|
2019-05-15 02:14:38 +05:30
|
|
|
sizeState = 1
|
2019-03-09 03:46:56 +05:30
|
|
|
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,:)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-03-09 03:46:56 +05:30
|
|
|
end associate
|
|
|
|
enddo
|
2015-05-28 22:32:23 +05:30
|
|
|
end subroutine damage_nonlocal_init
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief calculates homogenized damage driving forces
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el)
|
|
|
|
use material, only: &
|
|
|
|
homogenization_Ngrains, &
|
2019-03-10 15:53:39 +05:30
|
|
|
material_homogenizationAt, &
|
2016-05-27 15:16:34 +05:30
|
|
|
phaseAt, &
|
2018-12-31 01:38:48 +05:30
|
|
|
phasememberAt, &
|
2015-05-28 22:32:23 +05:30
|
|
|
phase_source, &
|
|
|
|
phase_Nsources, &
|
|
|
|
SOURCE_damage_isoBrittle_ID, &
|
|
|
|
SOURCE_damage_isoDuctile_ID, &
|
|
|
|
SOURCE_damage_anisoBrittle_ID, &
|
|
|
|
SOURCE_damage_anisoDuctile_ID
|
|
|
|
use source_damage_isoBrittle, only: &
|
|
|
|
source_damage_isobrittle_getRateAndItsTangent
|
|
|
|
use source_damage_isoDuctile, only: &
|
|
|
|
source_damage_isoductile_getRateAndItsTangent
|
|
|
|
use source_damage_anisoBrittle, only: &
|
|
|
|
source_damage_anisobrittle_getRateAndItsTangent
|
|
|
|
use source_damage_anisoDuctile, only: &
|
|
|
|
source_damage_anisoductile_getRateAndItsTangent
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, intent(in) :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
phi
|
2019-05-15 02:14:38 +05:30
|
|
|
integer :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
phase, &
|
|
|
|
grain, &
|
2018-12-31 01:38:48 +05:30
|
|
|
source, &
|
|
|
|
constituent
|
2015-05-28 22:32:23 +05:30
|
|
|
real(pReal) :: &
|
|
|
|
phiDot, dPhiDot_dPhi, localphiDot, dLocalphiDot_dPhi
|
|
|
|
|
|
|
|
phiDot = 0.0_pReal
|
|
|
|
dPhiDot_dPhi = 0.0_pReal
|
2019-03-10 15:53:39 +05:30
|
|
|
do grain = 1, homogenization_Ngrains(material_homogenizationAt(el))
|
2016-01-15 05:49:44 +05:30
|
|
|
phase = phaseAt(grain,ip,el)
|
2018-12-31 01:38:48 +05:30
|
|
|
constituent = phasememberAt(grain,ip,el)
|
2019-03-09 03:46:56 +05:30
|
|
|
do source = 1, phase_Nsources(phase)
|
2015-05-28 22:32:23 +05:30
|
|
|
select case(phase_source(source,phase))
|
|
|
|
case (SOURCE_damage_isoBrittle_ID)
|
2018-12-31 01:38:48 +05:30
|
|
|
call source_damage_isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
case (SOURCE_damage_isoDuctile_ID)
|
2018-12-31 01:38:48 +05:30
|
|
|
call source_damage_isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
case (SOURCE_damage_anisoBrittle_ID)
|
2018-12-31 01:38:48 +05:30
|
|
|
call source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
case (SOURCE_damage_anisoDuctile_ID)
|
2018-12-31 01:38:48 +05:30
|
|
|
call source_damage_anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
case default
|
|
|
|
localphiDot = 0.0_pReal
|
|
|
|
dLocalphiDot_dPhi = 0.0_pReal
|
|
|
|
|
|
|
|
end select
|
|
|
|
phiDot = phiDot + localphiDot
|
|
|
|
dPhiDot_dPhi = dPhiDot_dPhi + dLocalphiDot_dPhi
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
2019-03-10 15:53:39 +05:30
|
|
|
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
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns homogenized non local damage diffusion tensor in reference configuration
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function damage_nonlocal_getDiffusion33(ip,el)
|
2015-06-01 21:32:27 +05:30
|
|
|
use numerics, only: &
|
|
|
|
charLength
|
2015-05-28 22:32:23 +05:30
|
|
|
use lattice, only: &
|
|
|
|
lattice_DamageDiffusion33
|
|
|
|
use material, only: &
|
|
|
|
homogenization_Ngrains, &
|
|
|
|
material_phase, &
|
2019-03-10 15:53:39 +05:30
|
|
|
material_homogenizationAt
|
2015-05-28 22:32:23 +05:30
|
|
|
use crystallite, only: &
|
|
|
|
crystallite_push33ToRef
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, intent(in) :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
real(pReal), dimension(3,3) :: &
|
|
|
|
damage_nonlocal_getDiffusion33
|
2019-05-15 02:14:38 +05:30
|
|
|
integer :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
homog, &
|
|
|
|
grain
|
|
|
|
|
2019-03-10 15:53:39 +05:30
|
|
|
homog = material_homogenizationAt(el)
|
2015-05-28 22:32:23 +05:30
|
|
|
damage_nonlocal_getDiffusion33 = 0.0_pReal
|
|
|
|
do grain = 1, homogenization_Ngrains(homog)
|
|
|
|
damage_nonlocal_getDiffusion33 = damage_nonlocal_getDiffusion33 + &
|
|
|
|
crystallite_push33ToRef(grain,ip,el,lattice_DamageDiffusion33(1:3,1:3,material_phase(grain,ip,el)))
|
|
|
|
enddo
|
|
|
|
|
|
|
|
damage_nonlocal_getDiffusion33 = &
|
2019-05-15 02:14:38 +05:30
|
|
|
charLength**2*damage_nonlocal_getDiffusion33/real(homogenization_Ngrains(homog),pReal)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
end function damage_nonlocal_getDiffusion33
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Returns homogenized nonlocal damage mobility
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
real(pReal) function damage_nonlocal_getMobility(ip,el)
|
|
|
|
use mesh, only: &
|
|
|
|
mesh_element
|
|
|
|
use lattice, only: &
|
|
|
|
lattice_damageMobility
|
|
|
|
use material, only: &
|
|
|
|
material_phase, &
|
|
|
|
homogenization_Ngrains
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, intent(in) :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
2019-05-15 02:14:38 +05:30
|
|
|
integer :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
ipc
|
|
|
|
|
|
|
|
damage_nonlocal_getMobility = 0.0_pReal
|
|
|
|
|
|
|
|
do ipc = 1, homogenization_Ngrains(mesh_element(3,el))
|
|
|
|
damage_nonlocal_getMobility = damage_nonlocal_getMobility + lattice_DamageMobility(material_phase(ipc,ip,el))
|
|
|
|
enddo
|
|
|
|
|
2016-05-27 15:16:34 +05:30
|
|
|
damage_nonlocal_getMobility = damage_nonlocal_getMobility/&
|
|
|
|
real(homogenization_Ngrains(mesh_element(3,el)),pReal)
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
end function damage_nonlocal_getMobility
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief updated nonlocal damage field with solution from damage phase field PDE
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
subroutine damage_nonlocal_putNonLocalDamage(phi,ip,el)
|
|
|
|
use material, only: &
|
2019-03-10 15:32:32 +05:30
|
|
|
material_homogenizationAt, &
|
2015-05-28 22:32:23 +05:30
|
|
|
damageMapping, &
|
|
|
|
damage
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, intent(in) :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
ip, & !< integration point number
|
|
|
|
el !< element number
|
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
phi
|
2019-05-15 02:14:38 +05:30
|
|
|
integer :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
homog, &
|
|
|
|
offset
|
|
|
|
|
2019-03-10 15:32:32 +05:30
|
|
|
homog = material_homogenizationAt(el)
|
2015-05-28 22:32:23 +05:30
|
|
|
offset = damageMapping(homog)%p(ip,el)
|
|
|
|
damage(homog)%p(offset) = phi
|
|
|
|
|
|
|
|
end subroutine damage_nonlocal_putNonLocalDamage
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return array of damage results
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function damage_nonlocal_postResults(ip,el)
|
|
|
|
use material, only: &
|
2019-03-10 15:53:39 +05:30
|
|
|
material_homogenizationAt, &
|
2015-05-28 22:32:23 +05:30
|
|
|
damage_typeInstance, &
|
2019-03-09 03:46:56 +05:30
|
|
|
damageMapping, &
|
2015-05-28 22:32:23 +05:30
|
|
|
damage
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer, intent(in) :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
ip, & !< integration point
|
|
|
|
el !< element
|
2019-03-10 15:53:39 +05:30
|
|
|
real(pReal), dimension(sum(damage_nonlocal_sizePostResult(:,damage_typeInstance(material_homogenizationAt(el))))) :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
damage_nonlocal_postResults
|
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
integer :: &
|
2015-05-28 22:32:23 +05:30
|
|
|
instance, homog, offset, o, c
|
|
|
|
|
2019-03-10 15:53:39 +05:30
|
|
|
homog = material_homogenizationAt(el)
|
2019-03-09 03:46:56 +05:30
|
|
|
offset = damageMapping(homog)%p(ip,el)
|
2015-05-28 22:32:23 +05:30
|
|
|
instance = damage_typeInstance(homog)
|
2019-03-09 03:46:56 +05:30
|
|
|
associate(prm => param(instance))
|
2019-05-15 02:14:38 +05:30
|
|
|
c = 0
|
2015-05-28 22:32:23 +05:30
|
|
|
|
2019-05-15 02:14:38 +05:30
|
|
|
outputsLoop: do o = 1,size(prm%outputID)
|
2019-03-09 03:46:56 +05:30
|
|
|
select case(prm%outputID(o))
|
2015-05-28 22:32:23 +05:30
|
|
|
|
|
|
|
case (damage_ID)
|
2019-05-15 02:14:38 +05:30
|
|
|
damage_nonlocal_postResults(c+1) = damage(homog)%p(offset)
|
2015-05-28 22:32:23 +05:30
|
|
|
c = c + 1
|
|
|
|
end select
|
2019-03-09 03:46:56 +05:30
|
|
|
enddo outputsLoop
|
|
|
|
|
|
|
|
end associate
|
2015-05-28 22:32:23 +05:30
|
|
|
end function damage_nonlocal_postResults
|
|
|
|
|
|
|
|
end module damage_nonlocal
|