DAMASK_EICMD/src/homogenization_damage.f90

159 lines
5.0 KiB
Fortran
Raw Normal View History

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
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-21 01:24:31 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief Allocate variables and set parameters.
!--------------------------------------------------------------------------------------------------
module subroutine damage_init()
class(tNode), pointer :: &
configHomogenizations, &
configHomogenization, &
configHomogenizationDamage
integer :: ho
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 -+>>>'
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)
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)
#else
2021-03-11 22:30:07 +05:30
prm%output = configHomogenizationDamage%get_as1dString('output',defaultVal=emptyStringArray)
#endif
else
prm%output = emptyStringArray
endif
end associate
enddo
2021-01-21 01:24:31 +05:30
end subroutine damage_init
!--------------------------------------------------------------------------------------------------
!> @brief Partition temperature onto the individual constituents.
!--------------------------------------------------------------------------------------------------
module subroutine damage_partition(ce)
2021-01-21 01:24:31 +05:30
real(pReal) :: phi
2021-01-21 01:24:31 +05:30
integer, intent(in) :: ce
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))
call phase_damage_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
!--------------------------------------------------------------------------------------------------
module function damage_nonlocal_getMobility(ce) result(M)
2021-01-24 23:17:19 +05:30
integer, intent(in) :: ce
2021-01-24 23:17:19 +05:30
real(pReal) :: M
M = lattice_M(material_phaseID(1,ce))
2021-01-24 23:17:19 +05:30
end function damage_nonlocal_getMobility
2021-01-25 03:14:47 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief calculates homogenized damage driving forces
!--------------------------------------------------------------------------------------------------
2021-04-07 12:17:46 +05:30
module subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, phi, ce)
2021-01-25 03:14:47 +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-07 12:17:46 +05:30
real(pReal), intent(out) :: &
phiDot
2021-01-25 03:14:47 +05:30
phiDot = phase_damage_phi_dot(phi, ce)
2021-01-25 03:14:47 +05:30
end subroutine damage_nonlocal_getSourceAndItsTangent
2021-01-25 19:43:17 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief updated nonlocal damage field with solution from damage phase field PDE
!--------------------------------------------------------------------------------------------------
module subroutine damage_nonlocal_putNonLocalDamage(phi,ce)
2021-01-25 19:43:17 +05:30
integer, intent(in) :: ce
2021-01-25 19:43:17 +05:30
real(pReal), intent(in) :: &
phi
integer :: &
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-01-25 19:43:17 +05:30
end subroutine damage_nonlocal_putNonLocalDamage
!--------------------------------------------------------------------------------------------------
!> @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
integer, intent(in) :: ho
2021-01-25 19:43:17 +05:30
character(len=*), intent(in) :: group
integer :: o
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')
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