2021-01-21 01:24:31 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @author Martin Diehl, KU Leuven
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-06 15:25:30 +05:30
|
|
|
submodule(homogenization) damage
|
2021-01-21 01:24:31 +05:30
|
|
|
|
2021-01-24 23:17:19 +05:30
|
|
|
use lattice
|
|
|
|
|
2021-04-06 15:25:30 +05:30
|
|
|
interface
|
|
|
|
|
|
|
|
module subroutine pass_init
|
|
|
|
end subroutine pass_init
|
|
|
|
|
|
|
|
end interface
|
|
|
|
|
2021-01-24 22:50:47 +05:30
|
|
|
type :: tDataContainer
|
|
|
|
real(pReal), dimension(:), allocatable :: phi
|
|
|
|
end type tDataContainer
|
|
|
|
|
|
|
|
type(tDataContainer), dimension(:), allocatable :: current
|
|
|
|
|
|
|
|
type :: tParameters
|
|
|
|
character(len=pStringLen), allocatable, dimension(:) :: &
|
|
|
|
output
|
|
|
|
end type tParameters
|
|
|
|
|
|
|
|
type(tparameters), dimension(:), allocatable :: &
|
|
|
|
param
|
2021-01-21 01:24:31 +05:30
|
|
|
|
|
|
|
contains
|
|
|
|
|
2021-01-24 22:50:47 +05:30
|
|
|
|
2021-01-21 01:24:31 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Allocate variables and set parameters.
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module subroutine damage_init()
|
|
|
|
|
2021-01-24 22:50:47 +05:30
|
|
|
class(tNode), pointer :: &
|
|
|
|
configHomogenizations, &
|
|
|
|
configHomogenization, &
|
2021-04-07 16:52:22 +05:30
|
|
|
configHomogenizationDamage, &
|
|
|
|
num_generic, &
|
|
|
|
material_homogenization
|
2021-01-24 22:50:47 +05:30
|
|
|
integer :: ho
|
2021-04-07 16:52:22 +05:30
|
|
|
integer :: Ninstances,Nmaterialpoints,h
|
2021-01-24 22:50:47 +05:30
|
|
|
|
2021-01-21 01:24:31 +05:30
|
|
|
|
2021-01-27 15:14:03 +05:30
|
|
|
print'(/,a)', ' <<<+- homogenization:damage init -+>>>'
|
2021-04-07 12:17:46 +05:30
|
|
|
print'(/,a)', ' <<<+- homogenization:damage:pass init -+>>>'
|
2021-01-24 22:50:47 +05:30
|
|
|
|
|
|
|
configHomogenizations => config_material%get('homogenization')
|
|
|
|
allocate(param(configHomogenizations%length))
|
|
|
|
allocate(current(configHomogenizations%length))
|
|
|
|
|
|
|
|
do ho = 1, configHomogenizations%length
|
2021-04-06 15:08:44 +05:30
|
|
|
allocate(current(ho)%phi(count(material_homogenizationID==ho)), source=1.0_pReal)
|
2021-01-24 22:50:47 +05:30
|
|
|
configHomogenization => configHomogenizations%get(ho)
|
|
|
|
associate(prm => param(ho))
|
|
|
|
if (configHomogenization%contains('damage')) then
|
|
|
|
configHomogenizationDamage => configHomogenization%get('damage')
|
|
|
|
#if defined (__GFORTRAN__)
|
2021-03-11 22:30:07 +05:30
|
|
|
prm%output = output_as1dString(configHomogenizationDamage)
|
2021-01-24 22:50:47 +05:30
|
|
|
#else
|
2021-03-11 22:30:07 +05:30
|
|
|
prm%output = configHomogenizationDamage%get_as1dString('output',defaultVal=emptyStringArray)
|
2021-01-24 22:50:47 +05:30
|
|
|
#endif
|
|
|
|
else
|
|
|
|
prm%output = emptyStringArray
|
|
|
|
endif
|
|
|
|
end associate
|
|
|
|
enddo
|
2021-01-21 01:24:31 +05:30
|
|
|
|
2021-04-07 16:52:22 +05:30
|
|
|
!------------------------------------------------------------------------------------
|
|
|
|
! read numerics parameter
|
|
|
|
num_generic => config_numerics%get('generic',defaultVal= emptyDict)
|
|
|
|
num_damage%charLength = num_generic%get_asFloat('charLength',defaultVal=1.0_pReal)
|
|
|
|
|
|
|
|
Ninstances = count(damage_type == DAMAGE_nonlocal_ID)
|
|
|
|
|
|
|
|
material_homogenization => config_material%get('homogenization')
|
|
|
|
do h = 1, material_homogenization%length
|
|
|
|
if (damage_type(h) /= DAMAGE_NONLOCAL_ID) cycle
|
|
|
|
|
|
|
|
Nmaterialpoints = count(material_homogenizationAt == h)
|
|
|
|
damageState_h(h)%sizeState = 1
|
|
|
|
allocate(damageState_h(h)%state0 (1,Nmaterialpoints), source=1.0_pReal)
|
|
|
|
allocate(damageState_h(h)%state (1,Nmaterialpoints), source=1.0_pReal)
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
2021-01-21 01:24:31 +05:30
|
|
|
end subroutine damage_init
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Partition temperature onto the individual constituents.
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-01-24 22:50:47 +05:30
|
|
|
module subroutine damage_partition(ce)
|
2021-01-21 01:24:31 +05:30
|
|
|
|
2021-01-24 22:50:47 +05:30
|
|
|
real(pReal) :: phi
|
2021-01-21 01:24:31 +05:30
|
|
|
integer, intent(in) :: ce
|
|
|
|
|
2021-01-24 22:50:47 +05:30
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
if(damageState_h(material_homogenizationID(ce))%sizeState < 1) return
|
|
|
|
phi = damagestate_h(material_homogenizationID(ce))%state(1,material_homogenizationEntry(ce))
|
2021-04-08 17:01:21 +05:30
|
|
|
call phase_set_phi(phi,1,ce)
|
2021-01-21 01:24:31 +05:30
|
|
|
|
|
|
|
end subroutine damage_partition
|
|
|
|
|
|
|
|
|
2021-01-24 23:17:19 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Returns homogenized nonlocal damage mobility
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-09 03:10:20 +05:30
|
|
|
module function homogenization_mu_phi(ce) result(mu)
|
2021-01-24 23:17:19 +05:30
|
|
|
|
2021-02-23 19:40:34 +05:30
|
|
|
integer, intent(in) :: ce
|
2021-04-09 03:10:20 +05:30
|
|
|
real(pReal) :: mu
|
2021-01-24 23:17:19 +05:30
|
|
|
|
2021-04-11 11:05:43 +05:30
|
|
|
mu = lattice_mu_phi(material_phaseID(1,ce))
|
2021-01-24 23:17:19 +05:30
|
|
|
|
2021-04-08 17:01:21 +05:30
|
|
|
end function homogenization_mu_phi
|
2021-01-24 23:17:19 +05:30
|
|
|
|
|
|
|
|
2021-01-25 03:14:47 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief calculates homogenized damage driving forces
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-09 03:10:20 +05:30
|
|
|
module function homogenization_f_phi(phi,ce) result(f)
|
2021-01-25 03:14:47 +05:30
|
|
|
|
2021-02-23 19:40:34 +05:30
|
|
|
integer, intent(in) :: ce
|
2021-04-07 12:17:46 +05:30
|
|
|
real(pReal), intent(in) :: &
|
2021-01-25 03:14:47 +05:30
|
|
|
phi
|
2021-04-09 03:10:20 +05:30
|
|
|
real(pReal) :: f
|
2021-01-25 03:14:47 +05:30
|
|
|
|
2021-04-09 03:10:20 +05:30
|
|
|
f = phase_f_phi(phi, 1, ce)
|
2021-01-25 03:14:47 +05:30
|
|
|
|
2021-04-08 17:01:21 +05:30
|
|
|
end function homogenization_f_phi
|
2021-01-25 03:14:47 +05:30
|
|
|
|
2021-01-25 19:43:17 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief updated nonlocal damage field with solution from damage phase field PDE
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-08 00:36:29 +05:30
|
|
|
module subroutine homogenization_set_phi(phi,ce)
|
2021-01-25 19:43:17 +05:30
|
|
|
|
2021-02-23 19:40:34 +05:30
|
|
|
integer, intent(in) :: ce
|
2021-01-25 19:43:17 +05:30
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
phi
|
|
|
|
integer :: &
|
2021-02-23 19:40:34 +05:30
|
|
|
ho, &
|
2021-04-06 15:08:44 +05:30
|
|
|
en
|
2021-01-25 19:43:17 +05:30
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
ho = material_homogenizationID(ce)
|
|
|
|
en = material_homogenizationEntry(ce)
|
|
|
|
damagestate_h(ho)%state(1,en) = phi
|
2021-04-07 18:26:11 +05:30
|
|
|
current(ho)%phi(en) = phi
|
2021-01-25 19:43:17 +05:30
|
|
|
|
2021-04-08 00:36:29 +05:30
|
|
|
end subroutine homogenization_set_phi
|
2021-01-25 19:43:17 +05:30
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief writes results to HDF5 output file
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-07 10:56:54 +05:30
|
|
|
module subroutine damage_results(ho,group)
|
2021-01-25 19:43:17 +05:30
|
|
|
|
2021-02-23 17:47:51 +05:30
|
|
|
integer, intent(in) :: ho
|
2021-01-25 19:43:17 +05:30
|
|
|
character(len=*), intent(in) :: group
|
|
|
|
|
|
|
|
integer :: o
|
|
|
|
|
2021-02-23 17:47:51 +05:30
|
|
|
associate(prm => param(ho))
|
2021-01-25 19:43:17 +05:30
|
|
|
outputsLoop: do o = 1,size(prm%output)
|
|
|
|
select case(prm%output(o))
|
|
|
|
case ('phi')
|
2021-02-23 17:47:51 +05:30
|
|
|
call results_writeDataset(group,damagestate_h(ho)%state(1,:),prm%output(o),&
|
2021-01-25 19:43:17 +05:30
|
|
|
'damage indicator','-')
|
|
|
|
end select
|
|
|
|
enddo outputsLoop
|
|
|
|
end associate
|
|
|
|
|
2021-04-07 10:56:54 +05:30
|
|
|
end subroutine damage_results
|
2021-01-25 19:43:17 +05:30
|
|
|
|
2021-04-06 15:25:30 +05:30
|
|
|
end submodule damage
|