DAMASK_EICMD/src/damage_nonlocal.f90

213 lines
7.9 KiB
Fortran
Raw Normal View History

!--------------------------------------------------------------------------------------------------
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
!> @brief material subroutine for non-locally evolving damage field
!--------------------------------------------------------------------------------------------------
module damage_nonlocal
use prec
use material
use config
2020-06-17 18:51:51 +05:30
use YAML_types
use crystallite
use lattice
use constitutive
2019-12-10 11:44:39 +05:30
use results
implicit none
private
type :: tParameters
2020-02-28 15:36:21 +05:30
character(len=pStringLen), allocatable, dimension(:) :: &
output
end type tParameters
2020-02-28 15:36:21 +05:30
type, private :: tNumerics
real(pReal) :: &
charLength !< characteristic length scale for gradient problems
end type tNumerics
2019-06-11 13:18:07 +05:30
type(tparameters), dimension(:), allocatable :: &
param
type(tNumerics), private :: &
num
public :: &
damage_nonlocal_init, &
damage_nonlocal_getSourceAndItsTangent, &
2020-02-29 17:27:19 +05:30
damage_nonlocal_getDiffusion, &
damage_nonlocal_getMobility, &
damage_nonlocal_putNonLocalDamage, &
2020-02-28 15:36:21 +05:30
damage_nonlocal_results
contains
!--------------------------------------------------------------------------------------------------
!> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks
!--------------------------------------------------------------------------------------------------
subroutine damage_nonlocal_init
2020-03-02 20:19:14 +05:30
integer :: Ninstance,NofMyHomog,h
class(tNode), pointer :: &
2020-08-15 19:32:10 +05:30
num_generic, &
material_homogenization, &
homog, &
homogDamage
2020-06-29 18:39:13 +05:30
print'(/,a)', ' <<<+- damage_nonlocal init -+>>>'; flush(6)
!------------------------------------------------------------------------------------
! read numerics parameter
num_generic => config_numerics%get('generic',defaultVal= emptyDict)
num%charLength = num_generic%get_asFloat('charLength',defaultVal=1.0_pReal)
2020-03-02 20:19:14 +05:30
Ninstance = count(damage_type == DAMAGE_nonlocal_ID)
allocate(param(Ninstance))
material_homogenization => config_material%get('homogenization')
2020-08-15 19:32:10 +05:30
do h = 1, material_homogenization%length
if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle
2020-08-15 19:32:10 +05:30
homog => material_homogenization%get(h)
homogDamage => homog%get('damage')
associate(prm => param(damage_typeInstance(h)))
2020-02-28 15:36:21 +05:30
2020-08-15 19:32:10 +05:30
#if defined (__GFORTRAN__)
prm%output = output_asStrings(homogDamage)
#else
prm%output = homogDamage%get_asStrings('output',defaultVal=emptyStringArray)
#endif
2019-12-21 15:25:11 +05:30
NofMyHomog = count(material_homogenizationAt == h)
damageState(h)%sizeState = 1
allocate(damageState(h)%state0 (1,NofMyHomog), source=damage_initialPhi(h))
allocate(damageState(h)%subState0(1,NofMyHomog), source=damage_initialPhi(h))
allocate(damageState(h)%state (1,NofMyHomog), source=damage_initialPhi(h))
2019-12-21 15:25:11 +05:30
nullify(damageMapping(h)%p)
damageMapping(h)%p => material_homogenizationMemberAt
2019-12-21 15:25:11 +05:30
deallocate(damage(h)%p)
damage(h)%p => damageState(h)%state(1,:)
2020-02-28 15:36:21 +05:30
end associate
enddo
2019-12-21 15:25:11 +05:30
end subroutine damage_nonlocal_init
!--------------------------------------------------------------------------------------------------
2020-02-28 15:36:21 +05:30
!> @brief calculates homogenized damage driving forces
!--------------------------------------------------------------------------------------------------
subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el)
2020-02-28 15:36:21 +05:30
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
real(pReal), intent(in) :: &
phi
real(pReal) :: &
phiDot, dPhiDot_dPhi
phiDot = 0.0_pReal
dPhiDot_dPhi = 0.0_pReal
2020-07-15 18:05:21 +05:30
call constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el)
phiDot = phiDot/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal)
dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal)
2020-02-28 15:36:21 +05:30
end subroutine damage_nonlocal_getSourceAndItsTangent
2019-05-17 02:44:47 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief returns homogenized non local damage diffusion tensor in reference configuration
!--------------------------------------------------------------------------------------------------
2020-02-29 17:27:19 +05:30
function damage_nonlocal_getDiffusion(ip,el)
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
real(pReal), dimension(3,3) :: &
2020-02-29 17:27:19 +05:30
damage_nonlocal_getDiffusion
integer :: &
homog, &
grain
2020-02-28 15:36:21 +05:30
homog = material_homogenizationAt(el)
2020-02-29 17:27:19 +05:30
damage_nonlocal_getDiffusion = 0.0_pReal
do grain = 1, homogenization_Ngrains(homog)
2020-02-29 17:27:19 +05:30
damage_nonlocal_getDiffusion = damage_nonlocal_getDiffusion + &
2020-09-23 05:20:13 +05:30
crystallite_push33ToRef(grain,ip,el,lattice_D(1:3,1:3,material_phaseAt(grain,el)))
enddo
2020-02-29 17:27:19 +05:30
damage_nonlocal_getDiffusion = &
num%charLength**2*damage_nonlocal_getDiffusion/real(homogenization_Ngrains(homog),pReal)
2020-02-28 15:36:21 +05:30
2020-02-29 17:27:19 +05:30
end function damage_nonlocal_getDiffusion
2020-02-28 15:36:21 +05:30
!--------------------------------------------------------------------------------------------------
2020-02-28 15:36:21 +05:30
!> @brief Returns homogenized nonlocal damage mobility
!--------------------------------------------------------------------------------------------------
real(pReal) function damage_nonlocal_getMobility(ip,el)
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
integer :: &
ipc
2020-02-28 15:36:21 +05:30
damage_nonlocal_getMobility = 0.0_pReal
2020-02-28 15:36:21 +05:30
2019-06-07 00:44:37 +05:30
do ipc = 1, homogenization_Ngrains(material_homogenizationAt(el))
2020-09-23 05:20:13 +05:30
damage_nonlocal_getMobility = damage_nonlocal_getMobility + lattice_M(material_phaseAt(ipc,el))
enddo
damage_nonlocal_getMobility = damage_nonlocal_getMobility/&
2019-06-07 00:44:37 +05:30
real(homogenization_Ngrains(material_homogenizationAt(el)),pReal)
end function damage_nonlocal_getMobility
2019-05-17 02:44:47 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief updated nonlocal damage field with solution from damage phase field PDE
!--------------------------------------------------------------------------------------------------
subroutine damage_nonlocal_putNonLocalDamage(phi,ip,el)
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
real(pReal), intent(in) :: &
phi
integer :: &
homog, &
offset
2020-02-28 15:36:21 +05:30
homog = material_homogenizationAt(el)
offset = damageMapping(homog)%p(ip,el)
damage(homog)%p(offset) = phi
end subroutine damage_nonlocal_putNonLocalDamage
2019-05-17 02:44:47 +05:30
2019-12-10 11:44:39 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief writes results to HDF5 output file
!--------------------------------------------------------------------------------------------------
2019-12-10 21:55:51 +05:30
subroutine damage_nonlocal_results(homog,group)
2019-12-10 11:44:39 +05:30
integer, intent(in) :: homog
character(len=*), intent(in) :: group
2020-02-28 15:36:21 +05:30
2019-12-21 15:06:42 +05:30
integer :: o
2019-12-10 11:44:39 +05:30
2020-02-28 15:36:21 +05:30
associate(prm => param(damage_typeInstance(homog)))
outputsLoop: do o = 1,size(prm%output)
select case(prm%output(o))
2020-08-15 19:32:10 +05:30
case ('phi')
call results_writeDataset(group,damage(homog)%p,prm%output(o),&
2019-12-10 11:44:39 +05:30
'damage indicator','-')
end select
enddo outputsLoop
end associate
end subroutine damage_nonlocal_results
end module damage_nonlocal