DAMASK_EICMD/src/phase.f90

719 lines
27 KiB
Fortran
Raw Normal View History

!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
2013-03-06 20:11:15 +05:30
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
2020-07-15 18:05:21 +05:30
!> @brief elasticity, plasticity, damage & thermal internal microstructure state
!--------------------------------------------------------------------------------------------------
module phase
use prec
2019-06-15 19:10:22 +05:30
use math
use rotations
2019-06-15 19:10:22 +05:30
use IO
use config
use material
use results
use lattice
use discretization
use parallelization
use HDF5_utilities
2021-01-27 11:40:53 +05:30
2019-06-15 19:10:22 +05:30
implicit none
private
2020-12-23 22:00:19 +05:30
2021-02-23 15:17:04 +05:30
type(Rotation), dimension(:,:,:), allocatable :: &
material_orientation0 !< initial orientation of each grain,IP,element
type(rotation), dimension(:,:,:), allocatable :: &
crystallite_orientation !< current orientation
2020-12-21 00:50:39 +05:30
type :: tTensorContainer
real(pReal), dimension(:,:,:), allocatable :: data
end type
type :: tNumerics
integer :: &
iJacoLpresiduum, & !< frequency of Jacobian update of residuum in Lp
nState, & !< state loop limit
nStress !< stress loop limit
real(pReal) :: &
subStepMinCryst, & !< minimum (relative) size of sub-step allowed during cutback
subStepSizeCryst, & !< size of first substep when cutback
subStepSizeLp, & !< size of first substep when cutback in Lp calculation
subStepSizeLi, & !< size of first substep when cutback in Li calculation
stepIncreaseCryst, & !< increase of next substep size when previous substep converged
rtol_crystalliteState, & !< relative tolerance in state loop
rtol_crystalliteStress, & !< relative tolerance in stress loop
atol_crystalliteStress !< absolute tolerance in stress loop
end type tNumerics
type(tNumerics) :: num ! numerics parameters. Better name?
type :: tDebugOptions
logical :: &
basic, &
extensive, &
selective
integer :: &
element, &
ip, &
grain
end type tDebugOptions
integer, dimension(:), allocatable, public :: & !< ToDo: should be protected (bug in Intel compiler)
2021-02-13 23:11:30 +05:30
phase_elasticityInstance, &
phase_NstiffnessDegradations
2020-08-15 19:32:10 +05:30
logical, dimension(:), allocatable, public :: & ! ToDo: should be protected (bug in Intel Compiler)
2020-08-15 19:32:10 +05:30
phase_localPlasticity !< flags phases with local constitutive law
type(tPlasticState), allocatable, dimension(:), public :: &
plasticState
type(tState), allocatable, dimension(:), public :: &
2021-02-13 12:25:32 +05:30
damageState
2020-08-15 19:32:10 +05:30
2019-06-15 19:10:22 +05:30
integer, public, protected :: &
2021-02-09 03:51:53 +05:30
phase_plasticity_maxSizeDotState, &
phase_source_maxSizeDotState
interface
2020-12-21 16:44:09 +05:30
! == cleaned:begin =================================================================================
module subroutine mechanical_init(materials,phases)
class(tNode), pointer :: materials,phases
2021-02-09 03:51:53 +05:30
end subroutine mechanical_init
module subroutine damage_init
end subroutine damage_init
2020-07-03 20:15:11 +05:30
module subroutine thermal_init(phases)
class(tNode), pointer :: phases
end subroutine thermal_init
2020-12-21 16:44:09 +05:30
2021-02-09 03:51:53 +05:30
module subroutine mechanical_results(group,ph)
2020-12-21 16:44:09 +05:30
character(len=*), intent(in) :: group
integer, intent(in) :: ph
2021-02-09 03:51:53 +05:30
end subroutine mechanical_results
2020-12-21 16:44:09 +05:30
2020-12-22 16:50:00 +05:30
module subroutine damage_results(group,ph)
character(len=*), intent(in) :: group
integer, intent(in) :: ph
end subroutine damage_results
2021-02-09 03:51:53 +05:30
module subroutine mechanical_windForward(ph,me)
2020-12-31 14:24:13 +05:30
integer, intent(in) :: ph, me
2021-02-09 03:51:53 +05:30
end subroutine mechanical_windForward
2020-12-31 14:24:13 +05:30
2021-02-09 03:51:53 +05:30
module subroutine mechanical_forward()
end subroutine mechanical_forward
2020-12-31 14:24:13 +05:30
module subroutine thermal_forward()
end subroutine thermal_forward
2020-12-23 03:57:56 +05:30
2021-02-09 03:51:53 +05:30
module subroutine mechanical_restore(ce,includeL)
2021-01-24 14:09:40 +05:30
integer, intent(in) :: ce
2020-12-31 14:24:13 +05:30
logical, intent(in) :: includeL
2021-02-09 03:51:53 +05:30
end subroutine mechanical_restore
2020-12-28 02:15:31 +05:30
2020-12-31 14:24:13 +05:30
module function phase_mechanical_dPdF(dt,co,ce) result(dPdF)
2020-12-30 02:01:22 +05:30
real(pReal), intent(in) :: dt
integer, intent(in) :: &
co, & !< counter in constituent loop
ce
2020-12-30 02:01:22 +05:30
real(pReal), dimension(3,3,3,3) :: dPdF
2021-02-09 03:51:53 +05:30
end function phase_mechanical_dPdF
2020-12-30 02:01:22 +05:30
2021-02-09 03:51:53 +05:30
module subroutine mechanical_restartWrite(groupHandle,ph)
2020-12-30 04:44:48 +05:30
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
2021-02-09 03:51:53 +05:30
end subroutine mechanical_restartWrite
2020-12-30 04:44:48 +05:30
2021-02-09 03:51:53 +05:30
module subroutine mechanical_restartRead(groupHandle,ph)
2020-12-30 04:44:48 +05:30
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
2021-02-09 03:51:53 +05:30
end subroutine mechanical_restartRead
2020-12-30 04:44:48 +05:30
2020-12-30 14:24:06 +05:30
2021-02-09 03:51:53 +05:30
module function mechanical_S(ph,me) result(S)
2020-12-30 17:15:08 +05:30
integer, intent(in) :: ph,me
2020-12-30 14:24:06 +05:30
real(pReal), dimension(3,3) :: S
2021-02-09 03:51:53 +05:30
end function mechanical_S
2020-12-30 14:24:06 +05:30
2021-02-09 03:51:53 +05:30
module function mechanical_L_p(ph,me) result(L_p)
2020-12-30 17:15:08 +05:30
integer, intent(in) :: ph,me
real(pReal), dimension(3,3) :: L_p
2021-02-09 03:51:53 +05:30
end function mechanical_L_p
2020-12-30 14:24:06 +05:30
module function phase_mechanical_getF(co,ce) result(F)
integer, intent(in) :: co, ce
2020-12-30 14:24:06 +05:30
real(pReal), dimension(3,3) :: F
2021-02-09 03:51:53 +05:30
end function phase_mechanical_getF
2020-12-30 14:24:06 +05:30
2021-02-09 03:51:53 +05:30
module function mechanical_F_e(ph,me) result(F_e)
2020-12-30 17:15:08 +05:30
integer, intent(in) :: ph,me
2020-12-30 14:24:06 +05:30
real(pReal), dimension(3,3) :: F_e
2021-02-09 03:51:53 +05:30
end function mechanical_F_e
2020-12-30 14:24:06 +05:30
module function phase_mechanical_getP(co,ce) result(P)
integer, intent(in) :: co, ce
2020-12-30 15:33:13 +05:30
real(pReal), dimension(3,3) :: P
2021-02-09 03:51:53 +05:30
end function phase_mechanical_getP
2020-12-30 15:33:13 +05:30
2021-02-09 03:51:53 +05:30
module function phase_damage_get_phi(co,ip,el) result(phi)
2021-01-21 01:24:31 +05:30
integer, intent(in) :: co, ip, el
real(pReal) :: phi
2021-02-09 03:51:53 +05:30
end function phase_damage_get_phi
2021-01-21 01:24:31 +05:30
module function thermal_T(ph,me) result(T)
integer, intent(in) :: ph,me
2020-12-30 14:24:06 +05:30
real(pReal) :: T
end function thermal_T
2020-12-30 14:24:06 +05:30
module function thermal_dot_T(ph,me) result(dot_T)
integer, intent(in) :: ph,me
real(pReal) :: dot_T
end function thermal_dot_T
2021-02-13 11:45:57 +05:30
module function damage_phi(ph,me) result(phi)
integer, intent(in) :: ph,me
real(pReal) :: phi
end function damage_phi
2020-12-30 16:30:47 +05:30
2021-02-15 23:13:51 +05:30
module subroutine phase_mechanical_setF(F,co,ce)
2020-12-30 14:24:06 +05:30
real(pReal), dimension(3,3), intent(in) :: F
2021-02-15 23:13:51 +05:30
integer, intent(in) :: co, ce
2021-02-09 03:51:53 +05:30
end subroutine phase_mechanical_setF
2020-12-30 14:24:06 +05:30
2021-02-09 03:51:53 +05:30
module subroutine phase_thermal_setField(T,dot_T, co,ce)
2021-01-24 17:56:01 +05:30
real(pReal), intent(in) :: T, dot_T
integer, intent(in) :: ce, co
2021-02-09 03:51:53 +05:30
end subroutine phase_thermal_setField
2021-01-24 17:56:01 +05:30
2021-02-09 03:51:53 +05:30
module subroutine phase_damage_set_phi(phi,co,ce)
2021-01-21 01:24:31 +05:30
real(pReal), intent(in) :: phi
integer, intent(in) :: co, ce
2021-02-09 03:51:53 +05:30
end subroutine phase_damage_set_phi
2020-12-30 16:30:47 +05:30
2020-12-23 11:28:54 +05:30
! == cleaned:end ===================================================================================
2020-12-20 21:41:43 +05:30
module function thermal_stress(Delta_t,ph,me) result(converged_)
real(pReal), intent(in) :: Delta_t
integer, intent(in) :: ph, me
logical :: converged_
end function thermal_stress
2021-01-08 02:45:18 +05:30
2021-01-08 04:02:54 +05:30
module function integrateDamageState(dt,co,ip,el) result(broken)
2021-01-08 02:45:18 +05:30
real(pReal), intent(in) :: dt
integer, intent(in) :: &
el, & !< element index in element loop
ip, & !< integration point index in ip loop
co !< grain index in grain loop
logical :: broken
2021-01-08 04:02:54 +05:30
end function integrateDamageState
2021-01-08 02:45:18 +05:30
2020-12-27 20:43:31 +05:30
module function crystallite_stress(dt,co,ip,el) result(converged_)
2020-12-24 14:52:41 +05:30
real(pReal), intent(in) :: dt
integer, intent(in) :: co, ip, el
2020-12-27 20:43:31 +05:30
logical :: converged_
2020-12-24 14:52:41 +05:30
end function crystallite_stress
2021-02-09 03:51:53 +05:30
module function phase_homogenizedC(ph,me) result(C)
integer, intent(in) :: ph, me
2020-12-23 22:00:19 +05:30
real(pReal), dimension(6,6) :: C
2021-02-09 03:51:53 +05:30
end function phase_homogenizedC
2020-12-23 22:00:19 +05:30
module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ce)
integer, intent(in) :: ce
2020-07-15 18:05:21 +05:30
real(pReal), intent(in) :: &
phi !< damage parameter
real(pReal), intent(inout) :: &
phiDot, &
dPhiDot_dPhi
2021-02-09 03:51:53 +05:30
end subroutine phase_damage_getRateAndItsTangents
2020-07-15 18:05:21 +05:30
2021-02-09 03:51:53 +05:30
module subroutine phase_thermal_getRate(TDot, ph,me)
2021-01-27 04:14:11 +05:30
integer, intent(in) :: ph, me
2021-01-08 13:27:30 +05:30
real(pReal), intent(out) :: &
TDot
2021-02-09 03:51:53 +05:30
end subroutine phase_thermal_getRate
2020-07-15 18:05:21 +05:30
module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e)
2020-07-10 21:59:36 +05:30
integer, intent(in) :: &
ph, &
2020-07-10 21:59:36 +05:30
i, &
e
type(rotation), dimension(1,discretization_nIPs,discretization_Nelems), intent(in) :: &
2020-07-10 21:59:36 +05:30
orientation !< crystal orientation
end subroutine plastic_nonlocal_updateCompatibility
2021-01-26 16:47:00 +05:30
module subroutine plastic_dependentState(co,ip,el)
2020-07-15 18:05:21 +05:30
integer, intent(in) :: &
2021-01-08 12:07:51 +05:30
co, & !< component-ID of integration point
2020-07-15 18:05:21 +05:30
ip, & !< integration point
el !< element
2021-01-26 16:47:00 +05:30
end subroutine plastic_dependentState
2020-07-15 18:05:21 +05:30
2021-02-13 23:27:41 +05:30
module subroutine kinematics_cleavage_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me)
integer, intent(in) :: ph, me
real(pReal), intent(in), dimension(3,3) :: &
S
real(pReal), intent(out), dimension(3,3) :: &
Ld !< damage velocity gradient
real(pReal), intent(out), dimension(3,3,3,3) :: &
dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor)
end subroutine kinematics_cleavage_opening_LiAndItsTangent
module subroutine kinematics_slipplane_opening_LiAndItsTangent(Ld, dLd_dTstar, S, ph,me)
integer, intent(in) :: ph, me
real(pReal), intent(in), dimension(3,3) :: &
S
real(pReal), intent(out), dimension(3,3) :: &
Ld !< damage velocity gradient
real(pReal), intent(out), dimension(3,3,3,3) :: &
dLd_dTstar !< derivative of Ld with respect to Tstar (4th-order tensor)
end subroutine kinematics_slipplane_opening_LiAndItsTangent
2020-12-21 12:35:38 +05:30
end interface
2020-07-02 02:21:21 +05:30
2020-12-23 12:50:29 +05:30
type(tDebugOptions) :: debugConstitutive
#if __INTEL_COMPILER >= 1900
public :: &
prec, &
math, &
rotations, &
IO, &
config, &
material, &
results, &
lattice, &
discretization, &
HDF5_utilities
#endif
2019-06-15 19:10:22 +05:30
public :: &
2021-02-09 03:51:53 +05:30
phase_init, &
phase_homogenizedC, &
phase_damage_getRateAndItsTangents, &
phase_thermal_getRate, &
phase_results, &
phase_allocateState, &
phase_forward, &
phase_restore, &
2020-08-15 19:32:10 +05:30
plastic_nonlocal_updateCompatibility, &
2020-12-21 15:27:18 +05:30
converged, &
crystallite_init, &
crystallite_stress, &
thermal_stress, &
2021-02-09 03:51:53 +05:30
phase_mechanical_dPdF, &
crystallite_orientations, &
crystallite_push33ToRef, &
2021-02-09 03:51:53 +05:30
phase_restartWrite, &
phase_restartRead, &
2021-01-08 04:02:54 +05:30
integrateDamageState, &
2021-02-09 03:51:53 +05:30
phase_thermal_setField, &
phase_damage_set_phi, &
phase_damage_get_phi, &
phase_mechanical_getP, &
phase_mechanical_setF, &
phase_mechanical_getF, &
phase_windForward
2020-12-21 15:27:18 +05:30
contains
!--------------------------------------------------------------------------------------------------
!> @brief Initialze constitutive models for individual physics
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_init
2019-06-15 19:10:22 +05:30
integer :: &
2020-12-23 19:33:03 +05:30
ph, & !< counter in phase loop
so !< counter in source loop
2020-07-02 02:21:21 +05:30
class (tNode), pointer :: &
2020-08-15 19:32:10 +05:30
debug_constitutive, &
materials, &
2020-11-03 02:09:33 +05:30
phases
2020-07-02 02:21:21 +05:30
2020-12-23 19:33:03 +05:30
2021-01-27 15:14:03 +05:30
print'(/,a)', ' <<<+- phase init -+>>>'; flush(IO_STDOUT)
2021-03-26 22:07:38 +05:30
debug_constitutive => config_debug%get('phase', defaultVal=emptyList)
debugConstitutive%basic = debug_constitutive%contains('basic')
debugConstitutive%extensive = debug_constitutive%contains('extensive')
debugConstitutive%selective = debug_constitutive%contains('selective')
debugConstitutive%element = config_debug%get_asInt('element', defaultVal = 1)
debugConstitutive%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1)
debugConstitutive%grain = config_debug%get_asInt('constituent', defaultVal = 1)
2020-07-02 02:21:21 +05:30
materials => config_material%get('material')
2021-03-26 22:07:38 +05:30
phases => config_material%get('phase')
call mechanical_init(materials,phases)
call damage_init
call thermal_init(phases)
2021-02-09 03:51:53 +05:30
phase_source_maxSizeDotState = 0
2020-12-23 19:33:03 +05:30
PhaseLoop2:do ph = 1,phases%length
!--------------------------------------------------------------------------------------------------
2020-06-26 15:14:17 +05:30
! partition and initialize state
plasticState(ph)%state = plasticState(ph)%state0
2021-02-13 23:11:30 +05:30
if(damageState(ph)%sizeState > 0) &
damageState(ph)%state = damageState(ph)%state0
2019-06-15 19:10:22 +05:30
enddo PhaseLoop2
phase_source_maxSizeDotState = maxval(damageState%sizeDotState)
2021-02-09 03:51:53 +05:30
phase_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState)
2021-02-09 03:51:53 +05:30
end subroutine phase_init
2009-03-06 15:32:36 +05:30
2020-08-15 19:32:10 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief Allocate the components of the state structure for a given phase
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_allocateState(state, &
2021-02-13 23:11:30 +05:30
Nconstituents,sizeState,sizeDotState,sizeDeltaState)
2020-08-15 19:32:10 +05:30
class(tState), intent(out) :: &
state
integer, intent(in) :: &
Nconstituents, &
2020-08-15 19:32:10 +05:30
sizeState, &
sizeDotState, &
sizeDeltaState
2020-12-29 02:11:48 +05:30
2020-08-15 19:32:10 +05:30
state%sizeState = sizeState
state%sizeDotState = sizeDotState
state%sizeDeltaState = sizeDeltaState
state%offsetDeltaState = sizeState-sizeDeltaState ! deltaState occupies latter part of state by definition
2020-12-29 02:11:48 +05:30
allocate(state%atol (sizeState), source=0.0_pReal)
allocate(state%state0 (sizeState,Nconstituents), source=0.0_pReal)
allocate(state%state (sizeState,Nconstituents), source=0.0_pReal)
2020-08-15 19:32:10 +05:30
2020-12-29 02:11:48 +05:30
allocate(state%dotState (sizeDotState,Nconstituents), source=0.0_pReal)
2020-08-15 19:32:10 +05:30
2020-12-29 02:11:48 +05:30
allocate(state%deltaState (sizeDeltaState,Nconstituents), source=0.0_pReal)
2020-08-15 19:32:10 +05:30
2021-02-09 03:51:53 +05:30
end subroutine phase_allocateState
2020-08-15 19:32:10 +05:30
2020-12-20 13:57:37 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief Restore data after homog cutback.
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_restore(ce,includeL)
2020-12-20 13:57:37 +05:30
2020-12-28 02:15:31 +05:30
logical, intent(in) :: includeL
2021-01-24 14:09:40 +05:30
integer, intent(in) :: ce
2020-12-28 02:15:31 +05:30
2020-12-20 13:57:37 +05:30
integer :: &
co
2020-12-28 02:15:31 +05:30
2020-12-20 13:57:37 +05:30
2021-01-24 14:09:40 +05:30
do co = 1,homogenization_Nconstituents(material_homogenizationAt2(ce))
2021-02-13 23:11:30 +05:30
if (damageState(material_phaseAt2(co,ce))%sizeState > 0) &
damageState(material_phaseAt2(co,ce))%state( :,material_phasememberAt2(co,ce)) = &
damageState(material_phaseAt2(co,ce))%state0(:,material_phasememberAt2(co,ce))
2020-12-20 13:57:37 +05:30
enddo
2021-02-09 03:51:53 +05:30
call mechanical_restore(ce,includeL)
2020-12-28 02:15:31 +05:30
2021-02-09 03:51:53 +05:30
end subroutine phase_restore
2020-12-20 13:57:37 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief Forward data after successful increment.
! ToDo: Any guessing for the current states possible?
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_forward()
2020-12-20 13:57:37 +05:30
integer :: ph
2020-12-23 11:28:54 +05:30
2020-12-30 04:44:48 +05:30
2021-02-09 03:51:53 +05:30
call mechanical_forward()
2020-12-31 14:24:13 +05:30
call thermal_forward()
2020-12-23 11:28:54 +05:30
2021-01-08 11:40:38 +05:30
do ph = 1, size(damageState)
2021-02-13 23:11:30 +05:30
if (damageState(ph)%sizeState > 0) &
damageState(ph)%state0 = damageState(ph)%state
enddo
2020-12-20 13:57:37 +05:30
2021-02-09 03:51:53 +05:30
end subroutine phase_forward
2020-12-20 13:57:37 +05:30
2018-12-05 04:25:39 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief writes constitutive results to HDF5 output file
2018-12-05 04:25:39 +05:30
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_results()
2019-12-19 00:35:51 +05:30
2020-12-22 13:15:01 +05:30
integer :: ph
character(len=:), allocatable :: group
2020-12-22 16:50:00 +05:30
call results_closeGroup(results_addGroup('/current/phase/'))
2020-12-22 13:15:01 +05:30
do ph = 1, size(material_name_phase)
2020-12-22 16:50:00 +05:30
group = '/current/phase/'//trim(material_name_phase(ph))//'/'
2020-12-22 13:15:01 +05:30
call results_closeGroup(results_addGroup(group))
2021-02-09 03:51:53 +05:30
call mechanical_results(group,ph)
2020-12-22 16:50:00 +05:30
call damage_results(group,ph)
2020-12-22 13:15:01 +05:30
enddo
2021-02-09 03:51:53 +05:30
end subroutine phase_results
2018-12-05 04:25:39 +05:30
2020-08-15 19:32:10 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief allocates and initialize per grain variables
!--------------------------------------------------------------------------------------------------
2020-12-31 14:24:13 +05:30
subroutine crystallite_init()
integer :: &
2020-12-23 17:52:11 +05:30
ph, &
me, &
2020-12-29 02:11:48 +05:30
co, & !< counter in integration point component loop
ip, & !< counter in integration point loop
el, & !< counter in element loop
so, &
cMax, & !< maximum number of integration point components
iMax, & !< maximum number of integration points
eMax !< maximum number of elements
2021-01-08 02:45:18 +05:30
class(tNode), pointer :: &
num_crystallite, &
phases
2020-12-23 11:44:07 +05:30
print'(/,a)', ' <<<+- crystallite init -+>>>'
cMax = homogenization_maxNconstituents
iMax = discretization_nIPs
eMax = discretization_Nelems
allocate(crystallite_orientation(cMax,iMax,eMax))
num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict)
num%subStepMinCryst = num_crystallite%get_asFloat ('subStepMin', defaultVal=1.0e-3_pReal)
num%subStepSizeCryst = num_crystallite%get_asFloat ('subStepSize', defaultVal=0.25_pReal)
num%stepIncreaseCryst = num_crystallite%get_asFloat ('stepIncrease', defaultVal=1.5_pReal)
num%subStepSizeLp = num_crystallite%get_asFloat ('subStepSizeLp', defaultVal=0.5_pReal)
num%subStepSizeLi = num_crystallite%get_asFloat ('subStepSizeLi', defaultVal=0.5_pReal)
num%rtol_crystalliteState = num_crystallite%get_asFloat ('rtol_State', defaultVal=1.0e-6_pReal)
num%rtol_crystalliteStress = num_crystallite%get_asFloat ('rtol_Stress', defaultVal=1.0e-6_pReal)
num%atol_crystalliteStress = num_crystallite%get_asFloat ('atol_Stress', defaultVal=1.0e-8_pReal)
num%iJacoLpresiduum = num_crystallite%get_asInt ('iJacoLpresiduum', defaultVal=1)
num%nState = num_crystallite%get_asInt ('nState', defaultVal=20)
num%nStress = num_crystallite%get_asInt ('nStress', defaultVal=40)
if(num%subStepMinCryst <= 0.0_pReal) call IO_error(301,ext_msg='subStepMinCryst')
if(num%subStepSizeCryst <= 0.0_pReal) call IO_error(301,ext_msg='subStepSizeCryst')
if(num%stepIncreaseCryst <= 0.0_pReal) call IO_error(301,ext_msg='stepIncreaseCryst')
if(num%subStepSizeLp <= 0.0_pReal) call IO_error(301,ext_msg='subStepSizeLp')
if(num%subStepSizeLi <= 0.0_pReal) call IO_error(301,ext_msg='subStepSizeLi')
if(num%rtol_crystalliteState <= 0.0_pReal) call IO_error(301,ext_msg='rtol_crystalliteState')
if(num%rtol_crystalliteStress <= 0.0_pReal) call IO_error(301,ext_msg='rtol_crystalliteStress')
if(num%atol_crystalliteStress <= 0.0_pReal) call IO_error(301,ext_msg='atol_crystalliteStress')
if(num%iJacoLpresiduum < 1) call IO_error(301,ext_msg='iJacoLpresiduum')
if(num%nState < 1) call IO_error(301,ext_msg='nState')
if(num%nStress< 1) call IO_error(301,ext_msg='nStress')
phases => config_material%get('phase')
2020-12-23 17:52:11 +05:30
do ph = 1, phases%length
2021-02-13 23:11:30 +05:30
if (damageState(ph)%sizeState > 0) &
allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack
enddo
2020-12-20 22:52:04 +05:30
print'(a42,1x,i10)', ' # of elements: ', eMax
print'(a42,1x,i10)', ' # of integration points/element: ', iMax
print'(a42,1x,i10)', 'max # of constituents/integration point: ', cMax
flush(IO_STDOUT)
2020-12-23 17:52:11 +05:30
!$OMP PARALLEL DO PRIVATE(ph,me)
2020-12-27 16:18:02 +05:30
do el = 1, size(material_phaseMemberAt,3)
do ip = 1, size(material_phaseMemberAt,2)
2020-12-23 13:27:58 +05:30
do co = 1,homogenization_Nconstituents(material_homogenizationAt(el))
2020-12-23 17:52:11 +05:30
ph = material_phaseAt(co,el)
me = material_phaseMemberAt(co,ip,el)
2020-12-27 16:18:02 +05:30
call crystallite_orientations(co,ip,el)
2021-01-26 16:47:00 +05:30
call plastic_dependentState(co,ip,el) ! update dependent state variables to be consistent with basic states
enddo
enddo
enddo
!$OMP END PARALLEL DO
end subroutine crystallite_init
!--------------------------------------------------------------------------------------------------
!> @brief Wind homog inc forward.
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_windForward(ip,el)
integer, intent(in) :: &
2020-12-23 11:44:07 +05:30
ip, & !< integration point number
el !< element number
2020-12-28 13:37:35 +05:30
integer :: &
2020-12-23 11:44:07 +05:30
co, & !< constituent number
2020-12-28 02:52:08 +05:30
so, ph, me
2020-12-28 13:37:35 +05:30
2020-12-23 11:44:07 +05:30
do co = 1,homogenization_Nconstituents(material_homogenizationAt(el))
ph = material_phaseAt(co,el)
me = material_phaseMemberAt(co,ip,el)
2021-02-09 03:51:53 +05:30
call mechanical_windForward(ph,me)
2020-12-31 14:24:13 +05:30
2021-02-13 23:11:30 +05:30
if(damageState(ph)%sizeState > 0) damageState(ph)%state0(:,me) = damageState(ph)%state(:,me)
2020-12-31 14:24:13 +05:30
enddo
2021-02-09 03:51:53 +05:30
end subroutine phase_windForward
!--------------------------------------------------------------------------------------------------
!> @brief calculates orientations
!--------------------------------------------------------------------------------------------------
2020-12-27 16:18:02 +05:30
subroutine crystallite_orientations(co,ip,el)
2020-12-27 16:18:02 +05:30
integer, intent(in) :: &
2020-12-23 11:44:07 +05:30
co, & !< counter in integration point component loop
ip, & !< counter in integration point loop
el !< counter in element loop
2020-12-29 12:38:14 +05:30
call crystallite_orientation(co,ip,el)%fromMatrix(transpose(math_rotationalPart(&
2021-02-09 03:51:53 +05:30
mechanical_F_e(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el)))))
2020-12-27 16:18:02 +05:30
if (plasticState(material_phaseAt(1,el))%nonlocal) &
call plastic_nonlocal_updateCompatibility(crystallite_orientation, &
material_phaseAt(1,el),ip,el)
end subroutine crystallite_orientations
!--------------------------------------------------------------------------------------------------
!> @brief Map 2nd order tensor to reference config
!--------------------------------------------------------------------------------------------------
function crystallite_push33ToRef(co,ce, tensor33)
real(pReal), dimension(3,3), intent(in) :: tensor33
integer, intent(in):: &
co, &
ce
2020-12-23 12:42:56 +05:30
real(pReal), dimension(3,3) :: crystallite_push33ToRef
2020-12-30 04:44:48 +05:30
2020-12-29 22:57:24 +05:30
real(pReal), dimension(3,3) :: T
integer :: ph, me
ph = material_phaseAt2(co,ce)
me = material_phaseMemberAt2(co,ce)
T = matmul(material_orientation0(co,ph,me)%asMatrix(),transpose(math_inv33(phase_mechanical_getF(co,ce)))) ! ToDo: initial orientation correct?
2020-12-30 14:24:06 +05:30
crystallite_push33ToRef = matmul(transpose(T),matmul(tensor33,T))
end function crystallite_push33ToRef
!--------------------------------------------------------------------------------------------------
!> @brief determines whether a point is converged
!--------------------------------------------------------------------------------------------------
logical pure function converged(residuum,state,atol)
real(pReal), intent(in), dimension(:) ::&
residuum, state, atol
real(pReal) :: &
rTol
rTol = num%rTol_crystalliteState
converged = all(abs(residuum) <= max(atol, rtol*abs(state)))
end function converged
!--------------------------------------------------------------------------------------------------
!> @brief Write current restart information (Field and constitutive data) to file.
2020-12-30 04:44:48 +05:30
! ToDo: Merge data into one file for MPI
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_restartWrite(fileHandle)
2020-12-30 02:01:22 +05:30
integer(HID_T), intent(in) :: fileHandle
2020-12-30 04:44:48 +05:30
integer(HID_T), dimension(2) :: groupHandle
2020-12-28 13:37:35 +05:30
integer :: ph
2020-12-30 04:44:48 +05:30
groupHandle(1) = HDF5_addGroup(fileHandle,'phase')
do ph = 1, size(material_name_phase)
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_phase(ph))
2021-02-09 03:51:53 +05:30
call mechanical_restartWrite(groupHandle(2),ph)
2020-12-30 04:44:48 +05:30
call HDF5_closeGroup(groupHandle(2))
enddo
2020-12-30 04:44:48 +05:30
call HDF5_closeGroup(groupHandle(1))
2021-02-09 03:51:53 +05:30
end subroutine phase_restartWrite
!--------------------------------------------------------------------------------------------------
!> @brief Read data for restart
2020-12-30 04:44:48 +05:30
! ToDo: Merge data into one file for MPI
!--------------------------------------------------------------------------------------------------
2021-02-09 03:51:53 +05:30
subroutine phase_restartRead(fileHandle)
2020-12-30 02:01:22 +05:30
integer(HID_T), intent(in) :: fileHandle
2020-12-30 04:44:48 +05:30
integer(HID_T), dimension(2) :: groupHandle
2020-12-28 13:37:35 +05:30
integer :: ph
2020-12-30 04:44:48 +05:30
groupHandle(1) = HDF5_openGroup(fileHandle,'phase')
do ph = 1, size(material_name_phase)
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_phase(ph))
2021-02-09 03:51:53 +05:30
call mechanical_restartRead(groupHandle(2),ph)
2020-12-30 04:44:48 +05:30
call HDF5_closeGroup(groupHandle(2))
enddo
2020-12-30 04:44:48 +05:30
call HDF5_closeGroup(groupHandle(1))
2021-02-09 03:51:53 +05:30
end subroutine phase_restartRead
end module phase