DAMASK_EICMD/src/phase.f90

706 lines
28 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
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
type(tDebugOptions) :: debugCrystallite
integer, dimension(:), allocatable, public :: & !< ToDo: should be protected (bug in Intel compiler)
2021-01-08 02:45:18 +05:30
thermal_Nsources, &
2020-08-15 19:32:10 +05:30
phase_Nsources, & !< number of source mechanisms active in each phase
phase_Nkinematics, & !< number of kinematic mechanisms active in each phase
phase_NstiffnessDegradations, & !< number of stiffness degradation mechanisms active in each phase
phase_plasticityInstance, & !< instance of particular plasticity of each phase
phase_elasticityInstance !< instance of particular elasticity of each phase
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(tSourceState), allocatable, dimension(:), public :: &
2021-01-08 11:40:38 +05:30
damageState, thermalState
2020-08-15 19:32:10 +05:30
2019-06-15 19:10:22 +05:30
integer, public, protected :: &
constitutive_plasticity_maxSizeDotState, &
constitutive_source_maxSizeDotState
interface
2020-12-21 16:44:09 +05:30
! == cleaned:begin =================================================================================
module subroutine mech_init(phases)
class(tNode), pointer :: phases
2020-11-03 02:09:33 +05:30
end subroutine mech_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
module subroutine mech_results(group,ph)
character(len=*), intent(in) :: group
integer, intent(in) :: ph
end subroutine mech_results
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
2020-12-31 14:24:13 +05:30
module subroutine mech_windForward(ph,me)
integer, intent(in) :: ph, me
end subroutine mech_windForward
module subroutine mech_forward()
end subroutine mech_forward
module subroutine thermal_forward()
end subroutine thermal_forward
2020-12-23 03:57:56 +05:30
2021-01-24 14:09:40 +05:30
module subroutine mech_restore(ce,includeL)
integer, intent(in) :: ce
2020-12-31 14:24:13 +05:30
logical, intent(in) :: includeL
2020-12-28 02:15:31 +05:30
end subroutine mech_restore
2020-12-31 14:24:13 +05:30
2020-12-30 02:01:22 +05:30
module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF)
real(pReal), intent(in) :: dt
integer, intent(in) :: &
co, & !< counter in constituent loop
ip, & !< counter in integration point loop
el !< counter in element loop
real(pReal), dimension(3,3,3,3) :: dPdF
end function constitutive_mech_dPdF
2020-12-30 04:44:48 +05:30
module subroutine mech_restartWrite(groupHandle,ph)
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
end subroutine mech_restartWrite
module subroutine mech_restartRead(groupHandle,ph)
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
end subroutine mech_restartRead
2020-12-30 14:24:06 +05:30
2020-12-30 17:15:08 +05:30
module function mech_S(ph,me) result(S)
integer, intent(in) :: ph,me
2020-12-30 14:24:06 +05:30
real(pReal), dimension(3,3) :: S
2020-12-30 17:15:08 +05:30
end function mech_S
2020-12-30 14:24:06 +05:30
2020-12-30 17:15:08 +05:30
module function mech_L_p(ph,me) result(L_p)
integer, intent(in) :: ph,me
real(pReal), dimension(3,3) :: L_p
end function mech_L_p
2020-12-30 14:24:06 +05:30
module function constitutive_mech_getF(co,ip,el) result(F)
integer, intent(in) :: co, ip, el
real(pReal), dimension(3,3) :: F
end function constitutive_mech_getF
2020-12-30 17:15:08 +05:30
module function mech_F_e(ph,me) result(F_e)
integer, intent(in) :: ph,me
2020-12-30 14:24:06 +05:30
real(pReal), dimension(3,3) :: F_e
2020-12-30 17:15:08 +05:30
end function mech_F_e
2020-12-30 14:24:06 +05:30
2020-12-30 15:33:13 +05:30
module function constitutive_mech_getP(co,ip,el) result(P)
integer, intent(in) :: co, ip, el
real(pReal), dimension(3,3) :: P
end function constitutive_mech_getP
2021-01-21 01:24:31 +05:30
module function constitutive_damage_get_phi(co,ip,el) result(phi)
integer, intent(in) :: co, ip, el
real(pReal) :: phi
end function constitutive_damage_get_phi
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
2020-12-30 16:30:47 +05:30
2020-12-30 14:24:06 +05:30
module subroutine constitutive_mech_setF(F,co,ip,el)
real(pReal), dimension(3,3), intent(in) :: F
integer, intent(in) :: co, ip, el
end subroutine constitutive_mech_setF
2021-01-24 17:56:01 +05:30
module subroutine constitutive_thermal_setField(T,dot_T, co,ce)
real(pReal), intent(in) :: T, dot_T
integer, intent(in) :: ce, co
end subroutine constitutive_thermal_setField
2021-01-21 01:24:31 +05:30
module subroutine constitutive_damage_set_phi(phi,co,ce)
real(pReal), intent(in) :: phi
integer, intent(in) :: co, ce
end subroutine constitutive_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
module function constitutive_homogenizedC(ph,me) result(C)
integer, intent(in) :: ph, me
2020-12-23 22:00:19 +05:30
real(pReal), dimension(6,6) :: C
end function constitutive_homogenizedC
2020-07-15 18:05:21 +05:30
module subroutine constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ip, el)
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
real(pReal), intent(in) :: &
phi !< damage parameter
real(pReal), intent(inout) :: &
phiDot, &
dPhiDot_dPhi
end subroutine constitutive_damage_getRateAndItsTangents
2021-01-27 04:14:11 +05:30
module subroutine constitutive_thermal_getRate(TDot, ph,me)
integer, intent(in) :: ph, me
2021-01-08 13:27:30 +05:30
real(pReal), intent(out) :: &
TDot
2021-01-11 20:43:59 +05:30
end subroutine constitutive_thermal_getRate
2020-07-15 18:05:21 +05:30
2020-07-10 21:59:36 +05:30
module subroutine plastic_nonlocal_updateCompatibility(orientation,instance,i,e)
integer, intent(in) :: &
instance, &
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
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 :: &
constitutive_init, &
constitutive_homogenizedC, &
2020-07-15 18:05:21 +05:30
constitutive_damage_getRateAndItsTangents, &
2021-01-11 20:43:59 +05:30
constitutive_thermal_getRate, &
2020-08-15 19:32:10 +05:30
constitutive_results, &
constitutive_allocateState, &
2020-12-20 13:57:37 +05:30
constitutive_forward, &
constitutive_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, &
2020-12-30 02:01:22 +05:30
constitutive_mech_dPdF, &
crystallite_orientations, &
crystallite_push33ToRef, &
2020-12-30 02:01:22 +05:30
constitutive_restartWrite, &
constitutive_restartRead, &
2021-01-08 04:02:54 +05:30
integrateDamageState, &
2021-01-24 17:56:01 +05:30
constitutive_thermal_setField, &
2021-01-21 01:24:31 +05:30
constitutive_damage_set_phi, &
constitutive_damage_get_phi, &
2020-12-30 15:33:13 +05:30
constitutive_mech_getP, &
2020-12-30 17:15:08 +05:30
constitutive_mech_setF, &
2020-12-29 22:57:24 +05:30
constitutive_mech_getF, &
2021-01-27 13:15:54 +05:30
constitutive_windForward
2020-12-21 15:27:18 +05:30
contains
!--------------------------------------------------------------------------------------------------
!> @brief Initialze constitutive models for individual physics
!--------------------------------------------------------------------------------------------------
2019-04-06 01:56:23 +05:30
subroutine constitutive_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, &
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
print'(/,a)', ' <<<+- constitutive init -+>>>'; flush(IO_STDOUT)
debug_constitutive => config_debug%get('constitutive', defaultVal=emptyList)
debugConstitutive%basic = debug_constitutive%contains('basic')
debugConstitutive%extensive = debug_constitutive%contains('extensive')
2020-07-03 20:15:11 +05:30
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('grain',defaultVal = 1)
2020-07-02 02:21:21 +05:30
phases => config_material%get('phase')
call mech_init(phases)
call damage_init
call thermal_init(phases)
2019-06-15 19:10:22 +05:30
constitutive_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
2020-12-23 19:33:03 +05:30
forall(so = 1:phase_Nsources(ph))
damageState(ph)%p(so)%state = damageState(ph)%p(so)%state0
2019-06-15 19:10:22 +05:30
end forall
2020-07-13 18:18:23 +05:30
2020-03-16 23:58:50 +05:30
constitutive_source_maxSizeDotState = max(constitutive_source_maxSizeDotState, &
2021-01-08 11:40:38 +05:30
maxval(damageState(ph)%p%sizeDotState))
2019-06-15 19:10:22 +05:30
enddo PhaseLoop2
2020-03-16 23:58:50 +05:30
constitutive_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState)
end subroutine constitutive_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
!--------------------------------------------------------------------------------------------------
subroutine constitutive_allocateState(state, &
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
end subroutine constitutive_allocateState
2020-12-20 13:57:37 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief Restore data after homog cutback.
!--------------------------------------------------------------------------------------------------
2021-01-24 14:09:40 +05:30
subroutine constitutive_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 :: &
2020-12-23 11:44:07 +05:30
co, & !< constituent number
2020-12-28 02:15:31 +05:30
so
2020-12-20 13:57:37 +05:30
2021-01-24 14:09:40 +05:30
do co = 1,homogenization_Nconstituents(material_homogenizationAt2(ce))
do so = 1, phase_Nsources(material_phaseAt2(co,ce))
2021-01-25 19:13:09 +05:30
damageState(material_phaseAt2(co,ce))%p(so)%state( :,material_phasememberAt2(co,ce)) = &
damageState(material_phaseAt2(co,ce))%p(so)%state0(:,material_phasememberAt2(co,ce))
2020-12-20 13:57:37 +05:30
enddo
enddo
2021-01-24 14:09:40 +05:30
call mech_restore(ce,includeL)
2020-12-28 02:15:31 +05:30
2020-12-20 13:57:37 +05:30
end subroutine constitutive_restore
!--------------------------------------------------------------------------------------------------
!> @brief Forward data after successful increment.
! ToDo: Any guessing for the current states possible?
!--------------------------------------------------------------------------------------------------
2020-12-31 14:24:13 +05:30
subroutine constitutive_forward()
2020-12-20 13:57:37 +05:30
2020-12-29 22:57:24 +05:30
integer :: ph, so
2020-12-23 11:28:54 +05:30
2020-12-30 04:44:48 +05:30
2020-12-31 14:24:13 +05:30
call mech_forward()
call thermal_forward()
2020-12-23 11:28:54 +05:30
2021-01-08 11:40:38 +05:30
do ph = 1, size(damageState)
2020-12-29 22:57:24 +05:30
do so = 1,phase_Nsources(ph)
2021-01-08 11:40:38 +05:30
damageState(ph)%p(so)%state0 = damageState(ph)%p(so)%state
2020-12-20 13:57:37 +05:30
enddo; enddo
end subroutine constitutive_forward
2018-12-05 04:25:39 +05:30
!--------------------------------------------------------------------------------------------------
!> @brief writes constitutive results to HDF5 output file
2018-12-05 04:25:39 +05:30
!--------------------------------------------------------------------------------------------------
2020-12-31 14:24:13 +05:30
subroutine constitutive_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))
call mech_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
2018-12-05 04:25:39 +05:30
end subroutine constitutive_results
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, &
debug_crystallite, & ! pointer to debug options for crystallite
phases
2020-12-23 11:44:07 +05:30
print'(/,a)', ' <<<+- crystallite init -+>>>'
debug_crystallite => config_debug%get('crystallite', defaultVal=emptyList)
debugCrystallite%extensive = debug_crystallite%contains('extensive')
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
2020-12-29 04:43:49 +05:30
do so = 1, phase_Nsources(ph)
2021-01-08 11:40:38 +05:30
allocate(damageState(ph)%p(so)%subState0,source=damageState(ph)%p(so)%state0) ! ToDo: hack
2020-12-29 04:43:49 +05:30
enddo
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.
!--------------------------------------------------------------------------------------------------
2020-12-23 11:44:07 +05:30
subroutine constitutive_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)
2020-12-31 14:24:13 +05:30
call mech_windForward(ph,me)
2020-12-28 02:52:08 +05:30
do so = 1, phase_Nsources(material_phaseAt(co,el))
damageState(ph)%p(so)%state0(:,me) = damageState(ph)%p(so)%state(:,me)
enddo
2020-12-31 14:24:13 +05:30
enddo
2020-12-22 14:53:46 +05:30
end subroutine constitutive_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(&
2020-12-30 17:15:08 +05:30
mech_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, &
phase_plasticityInstance(material_phaseAt(1,el)),ip,el)
end subroutine crystallite_orientations
!--------------------------------------------------------------------------------------------------
!> @brief Map 2nd order tensor to reference config
!--------------------------------------------------------------------------------------------------
2020-12-23 11:37:18 +05:30
function crystallite_push33ToRef(co,ip,el, tensor33)
real(pReal), dimension(3,3), intent(in) :: tensor33
integer, intent(in):: &
el, &
ip, &
2020-12-23 11:37:18 +05:30
co
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
2020-12-23 12:44:42 +05:30
2020-12-30 14:24:06 +05:30
T = matmul(material_orientation0(co,ip,el)%asMatrix(),transpose(math_inv33(constitutive_mech_getF(co,ip,el)))) ! ToDo: initial orientation correct?
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
!--------------------------------------------------------------------------------------------------
2020-12-30 02:01:22 +05:30
subroutine constitutive_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))
call mech_restartWrite(groupHandle(2),ph)
call HDF5_closeGroup(groupHandle(2))
enddo
2020-12-30 04:44:48 +05:30
call HDF5_closeGroup(groupHandle(1))
2020-12-30 02:01:22 +05:30
end subroutine constitutive_restartWrite
!--------------------------------------------------------------------------------------------------
!> @brief Read data for restart
2020-12-30 04:44:48 +05:30
! ToDo: Merge data into one file for MPI
!--------------------------------------------------------------------------------------------------
2020-12-30 02:01:22 +05:30
subroutine constitutive_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))
call mech_restartRead(groupHandle(2),ph)
call HDF5_closeGroup(groupHandle(2))
enddo
2020-12-30 04:44:48 +05:30
call HDF5_closeGroup(groupHandle(1))
2020-12-30 02:01:22 +05:30
end subroutine constitutive_restartRead
end module phase