DAMASK_EICMD/src/kinematics_thermal_expansio...

152 lines
6.6 KiB
Fortran
Raw Normal View History

!--------------------------------------------------------------------------------------------------
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
!> @brief material subroutine incorporating kinematics resulting from thermal expansion
!> @details to be done
!--------------------------------------------------------------------------------------------------
submodule(constitutive:constitutive_thermal) kinematics_thermal_expansion
2020-02-28 14:55:07 +05:30
2020-02-29 14:06:42 +05:30
integer, dimension(:), allocatable :: kinematics_thermal_expansion_instance
2019-05-17 02:44:47 +05:30
type :: tParameters
2020-02-29 15:40:23 +05:30
real(pReal) :: &
T_ref
2020-02-29 16:51:03 +05:30
real(pReal), dimension(3,3,3) :: &
expansion = 0.0_pReal
end type tParameters
2020-02-28 14:55:07 +05:30
type(tParameters), dimension(:), allocatable :: param
2020-02-28 14:55:07 +05:30
contains
!--------------------------------------------------------------------------------------------------
!> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks
!--------------------------------------------------------------------------------------------------
2020-08-15 19:32:10 +05:30
module function kinematics_thermal_expansion_init(kinematics_length) result(myKinematics)
2020-02-28 14:55:07 +05:30
2020-08-15 19:32:10 +05:30
integer, intent(in) :: kinematics_length
logical, dimension(:,:), allocatable :: myKinematics
2020-02-28 14:55:07 +05:30
2020-08-15 19:32:10 +05:30
integer :: Ninstance,p,i,k
real(pReal), dimension(:), allocatable :: temp
class(tNode), pointer :: &
phases, &
phase, &
pl, &
kinematics, &
kinematic_type
write(6,'(/,a)') ' <<<+- kinematics_thermal_expansion init -+>>>'
myKinematics = kinematics_active('thermal_expansion',kinematics_length)
Ninstance = count(myKinematics)
2020-07-02 00:16:26 +05:30
write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6)
2020-08-15 19:32:10 +05:30
if(Ninstance == 0) return
2020-02-28 14:55:07 +05:30
2020-08-15 19:32:10 +05:30
phases => material_root%get('phase')
allocate(param(Ninstance))
2020-08-15 19:32:10 +05:30
allocate(kinematics_thermal_expansion_instance(phases%length), source=0)
do p = 1, phases%length
if(any(myKinematics(:,p))) kinematics_thermal_expansion_instance(p) = count(myKinematics(:,1:p))
phase => phases%get(p)
pl => phase%get('plasticity')
if(count(myKinematics(:,p)) == 0) cycle
kinematics => phase%get('kinematics')
do k = 1, kinematics%length
if(myKinematics(k,p)) then
associate(prm => param(kinematics_thermal_expansion_instance(p)))
kinematic_type => kinematics%get(k)
prm%T_ref = kinematic_type%get_asFloat('T_ref', defaultVal=0.0_pReal)
! read up to three parameters (constant, linear, quadratic with T)
temp = kinematic_type%get_asFloats('A_11')
prm%expansion(1,1,1:size(temp)) = temp
temp = kinematic_type%get_asFloats('A_22',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp))
prm%expansion(2,2,1:size(temp)) = temp
temp = kinematic_type%get_asFloats('A_33',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp))
prm%expansion(3,3,1:size(temp)) = temp
do i=1, size(prm%expansion,3)
prm%expansion(1:3,1:3,i) = lattice_applyLatticeSymmetry33(prm%expansion(1:3,1:3,i),&
phase%get_asString('lattice'))
enddo
end associate
endif
2020-02-29 17:27:19 +05:30
enddo
enddo
2020-08-15 19:32:10 +05:30
end function kinematics_thermal_expansion_init
!--------------------------------------------------------------------------------------------------
!> @brief report initial thermal strain based on current temperature deviation from reference
!--------------------------------------------------------------------------------------------------
pure module function kinematics_thermal_expansion_initialStrain(homog,phase,offset) result(initialStrain)
integer, intent(in) :: &
phase, &
homog, &
offset
real(pReal), dimension(3,3) :: &
initialStrain !< initial thermal strain (should be small strain, though)
associate(prm => param(kinematics_thermal_expansion_instance(phase)))
initialStrain = &
(temperature(homog)%p(offset) - prm%T_ref)**1 / 1. * prm%expansion(1:3,1:3,1) + & ! constant coefficient
(temperature(homog)%p(offset) - prm%T_ref)**2 / 2. * prm%expansion(1:3,1:3,2) + & ! linear coefficient
(temperature(homog)%p(offset) - prm%T_ref)**3 / 3. * prm%expansion(1:3,1:3,3) ! quadratic coefficient
end associate
end function kinematics_thermal_expansion_initialStrain
!--------------------------------------------------------------------------------------------------
2020-06-26 15:14:17 +05:30
!> @brief constitutive equation for calculating the velocity gradient
!--------------------------------------------------------------------------------------------------
module subroutine kinematics_thermal_expansion_LiAndItsTangent(Li, dLi_dTstar, ipc, ip, el)
2020-02-28 14:55:07 +05:30
2019-05-17 02:44:47 +05:30
integer, intent(in) :: &
2019-06-16 00:02:53 +05:30
ipc, & !< grain number
ip, & !< integration point number
el !< element number
real(pReal), intent(out), dimension(3,3) :: &
2019-06-16 00:02:53 +05:30
Li !< thermal velocity gradient
real(pReal), intent(out), dimension(3,3,3,3) :: &
2019-06-16 00:02:53 +05:30
dLi_dTstar !< derivative of Li with respect to Tstar (4th-order tensor defined to be zero)
2020-02-29 14:06:42 +05:30
2019-05-17 02:44:47 +05:30
integer :: &
phase, &
2020-02-29 14:06:42 +05:30
homog
real(pReal) :: &
2020-02-29 15:40:23 +05:30
T, TDot
2020-02-28 14:55:07 +05:30
phase = material_phaseAt(ipc,el)
2019-03-10 15:32:32 +05:30
homog = material_homogenizationAt(el)
2020-02-29 14:06:42 +05:30
T = temperature(homog)%p(thermalMapping(homog)%p(ip,el))
TDot = temperatureRate(homog)%p(thermalMapping(homog)%p(ip,el))
2020-02-28 14:55:07 +05:30
2020-02-29 15:40:23 +05:30
associate(prm => param(kinematics_thermal_expansion_instance(phase)))
Li = TDot * ( &
2020-02-29 17:27:19 +05:30
prm%expansion(1:3,1:3,1)*(T - prm%T_ref)**0 & ! constant coefficient
+ prm%expansion(1:3,1:3,2)*(T - prm%T_ref)**1 & ! linear coefficient
+ prm%expansion(1:3,1:3,3)*(T - prm%T_ref)**2 & ! quadratic coefficient
) / &
(1.0_pReal &
2020-02-29 17:27:19 +05:30
+ prm%expansion(1:3,1:3,1)*(T - prm%T_ref)**1 / 1. &
+ prm%expansion(1:3,1:3,2)*(T - prm%T_ref)**2 / 2. &
+ prm%expansion(1:3,1:3,3)*(T - prm%T_ref)**3 / 3. &
)
2020-02-29 15:40:23 +05:30
end associate
2020-02-28 14:55:07 +05:30
dLi_dTstar = 0.0_pReal
end subroutine kinematics_thermal_expansion_LiAndItsTangent
end submodule kinematics_thermal_expansion