DAMASK_EICMD/src/homogenization_damage.f90

182 lines
5.4 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
2021-04-11 12:02:13 +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, &
2021-07-20 21:44:19 +05:30
configHomogenizationDamage
2021-05-23 13:40:25 +05:30
integer :: ho,Nmembers
2021-01-21 01:24:31 +05:30
2021-01-27 15:14:03 +05:30
print'(/,a)', ' <<<+- homogenization:damage init -+>>>'
2021-04-11 19:02:17 +05:30
configHomogenizations => config_material%get('homogenization')
allocate(param(configHomogenizations%length))
allocate(current(configHomogenizations%length))
do ho = 1, configHomogenizations%length
2021-05-23 13:40:25 +05:30
Nmembers = count(material_homogenizationID == ho)
allocate(current(ho)%phi(Nmembers), 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
2021-04-11 19:02:17 +05:30
damageState_h(ho)%sizeState = 1
2021-05-23 13:40:25 +05:30
allocate(damageState_h(ho)%state0(1,Nmembers), source=1.0_pReal)
allocate(damageState_h(ho)%state (1,Nmembers), source=1.0_pReal)
else
prm%output = emptyStringArray
endif
end associate
enddo
2021-01-21 01:24:31 +05:30
2021-04-11 19:02:17 +05:30
call pass_init()
2021-04-07 16:52:22 +05:30
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))
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
!--------------------------------------------------------------------------------------------------
2021-04-11 12:02:13 +05:30
!> @brief Homogenized damage viscosity.
2021-01-24 23:17:19 +05:30
!--------------------------------------------------------------------------------------------------
2021-04-09 03:10:20 +05:30
module function homogenization_mu_phi(ce) result(mu)
2021-01-24 23:17:19 +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 12:02:13 +05:30
2021-04-11 16:51:27 +05:30
mu = phase_mu_phi(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
!--------------------------------------------------------------------------------------------------
2021-04-11 12:02:13 +05:30
!> @brief Homogenized damage conductivity/diffusivity in reference configuration.
!--------------------------------------------------------------------------------------------------
module function homogenization_K_phi(ce) result(K)
integer, intent(in) :: ce
real(pReal), dimension(3,3) :: K
2021-07-20 21:44:19 +05:30
K = phase_K_phi(1,ce)
2021-04-11 12:02:13 +05:30
end function homogenization_K_phi
!--------------------------------------------------------------------------------------------------
!> @brief Homogenized damage driving force.
2021-01-25 03:14:47 +05:30
!--------------------------------------------------------------------------------------------------
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
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-11 12:02:13 +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
!--------------------------------------------------------------------------------------------------
2021-04-11 12:02:13 +05:30
!> @brief Set damage field.
2021-01-25 19:43:17 +05:30
!--------------------------------------------------------------------------------------------------
2021-04-08 00:36:29 +05:30
module subroutine homogenization_set_phi(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
2021-04-11 12:02:13 +05:30
2021-01-25 19:43:17 +05:30
integer :: &
ho, &
2021-04-06 15:08:44 +05:30
en
2021-01-25 19:43:17 +05:30
2021-04-11 12:02:13 +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
integer, intent(in) :: ho
2021-01-25 19:43:17 +05:30
character(len=*), intent(in) :: group
integer :: o
associate(prm => param(ho))
2021-04-11 19:02:17 +05:30
outputsLoop: do o = 1,size(prm%output)
select case(prm%output(o))
case ('phi')
2021-06-01 20:35:13 +05:30
call results_writeDataset(damagestate_h(ho)%state(1,:),group,prm%output(o),&
2021-04-11 19:02:17 +05:30
'damage indicator','-')
end select
enddo outputsLoop
2021-01-25 19:43:17 +05:30
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