DAMASK_EICMD/src/phase_mechanical_eigen.f90

218 lines
7.6 KiB
Fortran
Raw Normal View History

2021-02-13 23:27:41 +05:30
submodule(phase:mechanical) eigen
2021-01-27 05:02:44 +05:30
2021-02-13 23:11:30 +05:30
integer, dimension(:), allocatable :: &
Nmodels
2021-12-11 14:24:46 +05:30
integer(kind(EIGEN_UNDEFINED_ID)), dimension(:,:), allocatable :: &
2021-02-13 23:11:30 +05:30
model
2021-12-11 14:24:46 +05:30
integer(kind(EIGEN_UNDEFINED_ID)), dimension(:), allocatable :: &
2021-02-13 23:11:30 +05:30
model_damage
2021-01-27 05:02:44 +05:30
interface
2021-04-06 15:48:48 +05:30
module function damage_anisobrittle_init() result(myKinematics)
2021-02-13 23:11:30 +05:30
logical, dimension(:), allocatable :: myKinematics
2021-04-06 15:48:48 +05:30
end function damage_anisobrittle_init
2021-01-27 05:02:44 +05:30
2021-02-13 23:11:30 +05:30
module function thermalexpansion_init(kinematics_length) result(myKinematics)
2021-01-27 05:02:44 +05:30
integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
2021-02-13 23:11:30 +05:30
end function thermalexpansion_init
2021-01-27 11:40:53 +05:30
module subroutine thermalexpansion_LiAndItsTangent(Li, dLi_dTstar, ph,me)
integer, intent(in) :: ph, me
real(pReal), intent(out), dimension(3,3) :: &
Li !< thermal velocity gradient
real(pReal), intent(out), dimension(3,3,3,3) :: &
dLi_dTstar !< derivative of Li with respect to Tstar (4th-order tensor defined to be zero)
end subroutine thermalexpansion_LiAndItsTangent
2021-01-27 05:02:44 +05:30
end interface
contains
2021-07-17 15:20:21 +05:30
module subroutine eigen_init(phases)
2021-01-27 05:02:44 +05:30
class(tNode), pointer :: &
phases
integer :: &
ph
class(tNode), pointer :: &
phase, &
kinematics, &
mechanics
2021-01-27 05:02:44 +05:30
print'(/,1x,a)', '<<<+- phase:mechanical:eigen init -+>>>'
2021-01-27 05:02:44 +05:30
!--------------------------------------------------------------------------------------------------
2021-02-13 23:11:30 +05:30
! explicit eigen mechanisms
allocate(Nmodels(phases%length),source = 0)
2021-01-27 05:02:44 +05:30
do ph = 1,phases%length
phase => phases%get(ph)
2021-03-25 23:52:59 +05:30
mechanics => phase%get('mechanical')
kinematics => mechanics%get('eigen',defaultVal=emptyList)
2021-02-13 23:11:30 +05:30
Nmodels(ph) = kinematics%length
end do
2021-01-27 05:02:44 +05:30
2021-12-11 14:24:46 +05:30
allocate(model(maxval(Nmodels),phases%length), source = EIGEN_undefined_ID)
2021-01-27 05:02:44 +05:30
if (maxval(Nmodels) /= 0) then
2021-12-11 14:24:46 +05:30
where(thermalexpansion_init(maxval(Nmodels))) model = EIGEN_thermal_expansion_ID
2021-01-27 05:02:44 +05:30
endif
2021-12-11 14:24:46 +05:30
allocate(model_damage(phases%length), source = EIGEN_UNDEFINED_ID)
2021-02-13 23:11:30 +05:30
2021-12-11 14:24:46 +05:30
where(damage_anisobrittle_init()) model_damage = EIGEN_cleavage_opening_ID
2021-02-13 23:11:30 +05:30
2021-07-17 15:20:21 +05:30
end subroutine eigen_init
2021-01-27 05:02:44 +05:30
2021-01-27 11:40:53 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief checks if a kinematic mechanism is active or not
!--------------------------------------------------------------------------------------------------
function kinematics_active(kinematics_label,kinematics_length) result(active_kinematics)
character(len=*), intent(in) :: kinematics_label !< name of kinematic mechanism
integer, intent(in) :: kinematics_length !< max. number of kinematics in system
logical, dimension(:,:), allocatable :: active_kinematics
class(tNode), pointer :: &
phases, &
phase, &
kinematics, &
kinematics_type, &
mechanics
2021-07-22 19:11:09 +05:30
integer :: ph,k
2021-01-27 11:40:53 +05:30
phases => config_material%get('phase')
allocate(active_kinematics(kinematics_length,phases%length), source = .false. )
2021-07-22 19:11:09 +05:30
do ph = 1, phases%length
phase => phases%get(ph)
2021-03-25 23:52:59 +05:30
mechanics => phase%get('mechanical')
kinematics => mechanics%get('eigen',defaultVal=emptyList)
2021-01-27 11:40:53 +05:30
do k = 1, kinematics%length
kinematics_type => kinematics%get(k)
2021-07-22 19:11:09 +05:30
active_kinematics(k,ph) = kinematics_type%get_asString('type') == kinematics_label
end do
end do
2021-01-27 11:40:53 +05:30
end function kinematics_active
!--------------------------------------------------------------------------------------------------
!> @brief checks if a kinematic mechanism is active or not
!--------------------------------------------------------------------------------------------------
2021-02-13 23:11:30 +05:30
function kinematics_active2(kinematics_label) result(active_kinematics)
2021-02-13 23:11:30 +05:30
character(len=*), intent(in) :: kinematics_label !< name of kinematic mechanism
logical, dimension(:), allocatable :: active_kinematics
class(tNode), pointer :: &
phases, &
phase, &
kinematics, &
kinematics_type
2021-07-22 19:11:09 +05:30
integer :: ph
phases => config_material%get('phase')
2021-07-22 19:11:09 +05:30
allocate(active_kinematics(phases%length), source = .false.)
do ph = 1, phases%length
phase => phases%get(ph)
kinematics => phase%get('damage',defaultVal=emptyList)
if (kinematics%length < 1) return
2021-02-13 18:47:08 +05:30
kinematics_type => kinematics%get(1)
if (.not. kinematics_type%contains('type')) continue
2021-07-22 19:11:09 +05:30
active_kinematics(ph) = kinematics_type%get_asString('type',defaultVal='n/a') == kinematics_label
end do
end function kinematics_active2
2021-01-27 11:40:53 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief contains the constitutive equation for calculating the velocity gradient
! ToDo: MD: S is Mi?
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, &
2021-04-13 00:51:15 +05:30
S, Fi, ph,en)
2021-01-27 11:40:53 +05:30
integer, intent(in) :: &
2021-04-13 00:51:15 +05:30
ph,en
2021-01-27 11:40:53 +05:30
real(pReal), intent(in), dimension(3,3) :: &
S !< 2nd Piola-Kirchhoff stress
real(pReal), intent(in), dimension(3,3) :: &
Fi !< intermediate deformation gradient
real(pReal), intent(out), dimension(3,3) :: &
Li !< intermediate velocity gradient
real(pReal), intent(out), dimension(3,3,3,3) :: &
dLi_dS, & !< derivative of Li with respect to S
dLi_dFi
real(pReal), dimension(3,3) :: &
my_Li, & !< intermediate velocity gradient
FiInv, &
temp_33
real(pReal), dimension(3,3,3,3) :: &
my_dLi_dS
real(pReal) :: &
detFi
integer :: &
2021-02-13 11:45:57 +05:30
k, i, j
2021-02-13 23:11:30 +05:30
logical :: active
2021-01-27 11:40:53 +05:30
2021-02-13 23:11:30 +05:30
active = .false.
2021-01-27 11:40:53 +05:30
Li = 0.0_pReal
dLi_dS = 0.0_pReal
dLi_dFi = 0.0_pReal
2021-02-13 11:45:57 +05:30
plasticType: select case (phase_plasticity(ph))
2021-12-11 14:24:46 +05:30
case (PLASTIC_isotropic_ID) plasticType
2021-04-13 00:51:15 +05:30
call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,ph,en)
2021-02-13 23:11:30 +05:30
Li = Li + my_Li
dLi_dS = dLi_dS + my_dLi_dS
active = .true.
2021-02-09 03:51:53 +05:30
end select plasticType
2021-01-27 11:40:53 +05:30
2021-02-13 23:11:30 +05:30
KinematicsLoop: do k = 1, Nmodels(ph)
kinematicsType: select case (model(k,ph))
2021-12-11 14:24:46 +05:30
case (EIGEN_thermal_expansion_ID) kinematicsType
2021-04-13 00:51:15 +05:30
call thermalexpansion_LiAndItsTangent(my_Li, my_dLi_dS, ph,en)
2021-02-13 23:11:30 +05:30
Li = Li + my_Li
dLi_dS = dLi_dS + my_dLi_dS
active = .true.
2021-01-27 11:40:53 +05:30
end select kinematicsType
end do KinematicsLoop
2021-01-27 11:40:53 +05:30
2021-02-13 23:11:30 +05:30
select case (model_damage(ph))
2021-12-11 14:24:46 +05:30
case (EIGEN_cleavage_opening_ID)
2021-04-13 00:51:15 +05:30
call damage_anisobrittle_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, en)
2021-02-13 23:11:30 +05:30
Li = Li + my_Li
dLi_dS = dLi_dS + my_dLi_dS
active = .true.
end select
if (.not. active) return
2021-02-13 23:11:30 +05:30
2021-01-27 11:40:53 +05:30
FiInv = math_inv33(Fi)
detFi = math_det33(Fi)
Li = matmul(matmul(Fi,Li),FiInv)*detFi !< push forward to intermediate configuration
temp_33 = matmul(FiInv,Li)
do i = 1,3; do j = 1,3
dLi_dS(1:3,1:3,i,j) = matmul(matmul(Fi,dLi_dS(1:3,1:3,i,j)),FiInv)*detFi
dLi_dFi(1:3,1:3,i,j) = dLi_dFi(1:3,1:3,i,j) + Li*FiInv(j,i)
dLi_dFi(1:3,i,1:3,j) = dLi_dFi(1:3,i,1:3,j) + math_I3*temp_33(j,i) + Li*FiInv(j,i)
end do; end do
2021-01-27 11:40:53 +05:30
2021-02-09 03:51:53 +05:30
end subroutine phase_LiAndItsTangents
2021-01-27 11:40:53 +05:30
2021-02-13 23:27:41 +05:30
end submodule eigen