meaningful scope

This commit is contained in:
Martin Diehl 2021-01-07 23:50:06 +01:00
parent 1df409376c
commit 5efa6c997a
4 changed files with 59 additions and 64 deletions

View File

@ -21,21 +21,6 @@ module constitutive
private private
enum, bind(c); enumerator :: & enum, bind(c); enumerator :: &
PLASTICITY_UNDEFINED_ID, &
PLASTICITY_NONE_ID, &
PLASTICITY_ISOTROPIC_ID, &
PLASTICITY_PHENOPOWERLAW_ID, &
PLASTICITY_KINEHARDENING_ID, &
PLASTICITY_DISLOTWIN_ID, &
PLASTICITY_DISLOTUNGSTEN_ID, &
PLASTICITY_NONLOCAL_ID, &
SOURCE_UNDEFINED_ID ,&
SOURCE_THERMAL_DISSIPATION_ID, &
SOURCE_THERMAL_EXTERNALHEAT_ID, &
SOURCE_DAMAGE_ISOBRITTLE_ID, &
SOURCE_DAMAGE_ISODUCTILE_ID, &
SOURCE_DAMAGE_ANISOBRITTLE_ID, &
SOURCE_DAMAGE_ANISODUCTILE_ID, &
KINEMATICS_UNDEFINED_ID ,& KINEMATICS_UNDEFINED_ID ,&
KINEMATICS_CLEAVAGE_OPENING_ID, & KINEMATICS_CLEAVAGE_OPENING_ID, &
KINEMATICS_SLIPPLANE_OPENING_ID, & KINEMATICS_SLIPPLANE_OPENING_ID, &
@ -81,12 +66,7 @@ module constitutive
type(tDebugOptions) :: debugCrystallite type(tDebugOptions) :: debugCrystallite
integer(kind(KINEMATICS_UNDEFINED_ID)), dimension(:,:), allocatable :: &
integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable, public :: &
phase_plasticity !< plasticity of each phase
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable :: &
phase_source, & !< active sources mechanisms of each phase
phase_kinematics !< active kinematic mechanisms of each phase phase_kinematics !< active kinematic mechanisms of each phase
integer, dimension(:), allocatable, public :: & !< ToDo: should be protected (bug in Intel compiler) integer, dimension(:), allocatable, public :: & !< ToDo: should be protected (bug in Intel compiler)
@ -428,21 +408,6 @@ module constitutive
constitutive_mech_getF, & constitutive_mech_getF, &
constitutive_initializeRestorationPoints, & constitutive_initializeRestorationPoints, &
constitutive_windForward, & constitutive_windForward, &
PLASTICITY_UNDEFINED_ID, &
PLASTICITY_NONE_ID, &
PLASTICITY_ISOTROPIC_ID, &
PLASTICITY_PHENOPOWERLAW_ID, &
PLASTICITY_KINEHARDENING_ID, &
PLASTICITY_DISLOTWIN_ID, &
PLASTICITY_DISLOTUNGSTEN_ID, &
PLASTICITY_NONLOCAL_ID, &
SOURCE_UNDEFINED_ID ,&
SOURCE_THERMAL_DISSIPATION_ID, &
SOURCE_THERMAL_EXTERNALHEAT_ID, &
SOURCE_DAMAGE_ISOBRITTLE_ID, &
SOURCE_DAMAGE_ISODUCTILE_ID, &
SOURCE_DAMAGE_ANISOBRITTLE_ID, &
SOURCE_DAMAGE_ANISODUCTILE_ID, &
KINEMATICS_UNDEFINED_ID ,& KINEMATICS_UNDEFINED_ID ,&
KINEMATICS_CLEAVAGE_OPENING_ID, & KINEMATICS_CLEAVAGE_OPENING_ID, &
KINEMATICS_SLIPPLANE_OPENING_ID, & KINEMATICS_SLIPPLANE_OPENING_ID, &

View File

@ -2,6 +2,16 @@
!> @brief internal microstructure state for all damage sources and kinematics constitutive models !> @brief internal microstructure state for all damage sources and kinematics constitutive models
!---------------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------------
submodule(constitutive) constitutive_damage submodule(constitutive) constitutive_damage
enum, bind(c); enumerator :: &
DAMAGE_UNDEFINED_ID, &
DAMAGE_ISOBRITTLE_ID, &
DAMAGE_ISODUCTILE_ID, &
DAMAGE_ANISOBRITTLE_ID, &
DAMAGE_ANISODUCTILE_ID
end enum
integer(kind(DAMAGE_UNDEFINED_ID)), dimension(:,:), allocatable :: &
phase_source !< active sources mechanisms of each phase
interface interface
@ -129,14 +139,14 @@ module subroutine damage_init
allocate(sourceState(ph)%p(phase_Nsources(ph))) allocate(sourceState(ph)%p(phase_Nsources(ph)))
enddo enddo
allocate(phase_source(maxval(phase_Nsources),phases%length), source = SOURCE_undefined_ID) allocate(phase_source(maxval(phase_Nsources),phases%length), source = DAMAGE_UNDEFINED_ID)
! initialize source mechanisms ! initialize source mechanisms
if(maxval(phase_Nsources) /= 0) then if(maxval(phase_Nsources) /= 0) then
where(source_damage_isoBrittle_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_isoBrittle_ID where(source_damage_isoBrittle_init (maxval(phase_Nsources))) phase_source = DAMAGE_ISOBRITTLE_ID
where(source_damage_isoDuctile_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_isoDuctile_ID where(source_damage_isoDuctile_init (maxval(phase_Nsources))) phase_source = DAMAGE_ISODUCTILE_ID
where(source_damage_anisoBrittle_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_anisoBrittle_ID where(source_damage_anisoBrittle_init (maxval(phase_Nsources))) phase_source = DAMAGE_ANISOBRITTLE_ID
where(source_damage_anisoDuctile_init (maxval(phase_Nsources))) phase_source = SOURCE_damage_anisoDuctile_ID where(source_damage_anisoDuctile_init (maxval(phase_Nsources))) phase_source = DAMAGE_ANISODUCTILE_ID
endif endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -189,16 +199,16 @@ module subroutine constitutive_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi
constituent = material_phasememberAt(grain,ip,el) constituent = material_phasememberAt(grain,ip,el)
do source = 1, phase_Nsources(phase) do source = 1, phase_Nsources(phase)
select case(phase_source(source,phase)) select case(phase_source(source,phase))
case (SOURCE_damage_isoBrittle_ID) case (DAMAGE_ISOBRITTLE_ID)
call source_damage_isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) call source_damage_isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
case (SOURCE_damage_isoDuctile_ID) case (DAMAGE_ISODUCTILE_ID)
call source_damage_isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) call source_damage_isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
case (SOURCE_damage_anisoBrittle_ID) case (DAMAGE_ANISOBRITTLE_ID)
call source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) call source_damage_anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
case (SOURCE_damage_anisoDuctile_ID) case (DAMAGE_ANISODUCTILE_ID)
call source_damage_anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent) call source_damage_anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, phase, constituent)
case default case default
@ -331,21 +341,21 @@ module subroutine damage_results(group,ph)
sourceLoop: do so = 1, phase_Nsources(ph) sourceLoop: do so = 1, phase_Nsources(ph)
if (phase_source(so,ph) /= SOURCE_UNDEFINED_ID) & if (phase_source(so,ph) /= DAMAGE_UNDEFINED_ID) &
call results_closeGroup(results_addGroup(group//'sources/')) ! should be 'damage' call results_closeGroup(results_addGroup(group//'sources/')) ! should be 'damage'
sourceType: select case (phase_source(so,ph)) sourceType: select case (phase_source(so,ph))
case (SOURCE_damage_anisoBrittle_ID) sourceType case (DAMAGE_ISOBRITTLE_ID) sourceType
call source_damage_anisoBrittle_results(ph,group//'sources/') call source_damage_anisoBrittle_results(ph,group//'sources/')
case (SOURCE_damage_anisoDuctile_ID) sourceType case (DAMAGE_ISODUCTILE_ID) sourceType
call source_damage_anisoDuctile_results(ph,group//'sources/') call source_damage_anisoDuctile_results(ph,group//'sources/')
case (SOURCE_damage_isoBrittle_ID) sourceType case (DAMAGE_ANISOBRITTLE_ID) sourceType
call source_damage_isoBrittle_results(ph,group//'sources/') call source_damage_isoBrittle_results(ph,group//'sources/')
case (SOURCE_damage_isoDuctile_ID) sourceType case (DAMAGE_ANISODUCTILE_ID) sourceType
call source_damage_isoDuctile_results(ph,group//'sources/') call source_damage_isoDuctile_results(ph,group//'sources/')
end select sourceType end select sourceType
@ -377,14 +387,14 @@ function constitutive_damage_collectDotState(co,ip,el,ph,of) result(broken)
sourceType: select case (phase_source(so,ph)) sourceType: select case (phase_source(so,ph))
case (SOURCE_damage_anisoBrittle_ID) sourceType case (DAMAGE_ISOBRITTLE_ID) sourceType
call source_damage_anisoBrittle_dotState(mech_S(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el)),& call source_damage_anisoBrittle_dotState(mech_S(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el)),&
co, ip, el) ! correct stress? co, ip, el) ! correct stress?
case (SOURCE_damage_isoDuctile_ID) sourceType case (DAMAGE_ISODUCTILE_ID) sourceType
call source_damage_isoDuctile_dotState(co, ip, el) call source_damage_isoDuctile_dotState(co, ip, el)
case (SOURCE_damage_anisoDuctile_ID) sourceType case (DAMAGE_ANISODUCTILE_ID) sourceType
call source_damage_anisoDuctile_dotState(co, ip, el) call source_damage_anisoDuctile_dotState(co, ip, el)
end select sourceType end select sourceType
@ -425,7 +435,7 @@ function constitutive_damage_deltaState(Fe, co, ip, el, ph, of) result(broken)
sourceType: select case (phase_source(so,ph)) sourceType: select case (phase_source(so,ph))
case (SOURCE_damage_isoBrittle_ID) sourceType case (DAMAGE_ISOBRITTLE_ID) sourceType
call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(co,ip,el), Fe, & call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(co,ip,el), Fe, &
co, ip, el) co, ip, el)
broken = any(IEEE_is_NaN(sourceState(ph)%p(so)%deltaState(:,of))) broken = any(IEEE_is_NaN(sourceState(ph)%p(so)%deltaState(:,of)))

View File

@ -7,12 +7,20 @@ submodule(constitutive) constitutive_mech
ELASTICITY_UNDEFINED_ID, & ELASTICITY_UNDEFINED_ID, &
ELASTICITY_HOOKE_ID, & ELASTICITY_HOOKE_ID, &
STIFFNESS_DEGRADATION_UNDEFINED_ID, & STIFFNESS_DEGRADATION_UNDEFINED_ID, &
STIFFNESS_DEGRADATION_DAMAGE_ID STIFFNESS_DEGRADATION_DAMAGE_ID, &
PLASTICITY_UNDEFINED_ID, &
PLASTICITY_NONE_ID, &
PLASTICITY_ISOTROPIC_ID, &
PLASTICITY_PHENOPOWERLAW_ID, &
PLASTICITY_KINEHARDENING_ID, &
PLASTICITY_DISLOTWIN_ID, &
PLASTICITY_DISLOTUNGSTEN_ID, &
PLASTICITY_NONLOCAL_ID
end enum end enum
integer(kind(ELASTICITY_undefined_ID)), dimension(:), allocatable :: & integer(kind(ELASTICITY_UNDEFINED_ID)), dimension(:), allocatable :: &
phase_elasticity !< elasticity of each phase phase_elasticity !< elasticity of each phase
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable :: & integer(kind(STIFFNESS_DEGRADATION_UNDEFINED_ID)), dimension(:,:), allocatable :: &
phase_stiffnessDegradation !< active stiffness degradation mechanisms of each phase phase_stiffnessDegradation !< active stiffness degradation mechanisms of each phase
type(tTensorContainer), dimension(:), allocatable :: & type(tTensorContainer), dimension(:), allocatable :: &
@ -41,6 +49,12 @@ submodule(constitutive) constitutive_mech
constitutive_mech_partitionedS0 constitutive_mech_partitionedS0
integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: &
phase_plasticity !< plasticity of each phase
interface interface
module function plastic_none_init() result(myPlasticity) module function plastic_none_init() result(myPlasticity)

View File

@ -3,10 +3,16 @@
!---------------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------------
submodule(constitutive) constitutive_thermal submodule(constitutive) constitutive_thermal
enum, bind(c); enumerator :: &
THERMAL_UNDEFINED_ID ,&
THERMAL_DISSIPATION_ID, &
THERMAL_EXTERNALHEAT_ID
end enum
type :: tDataContainer type :: tDataContainer
real(pReal), dimension(:), allocatable :: T real(pReal), dimension(:), allocatable :: T
end type tDataContainer end type tDataContainer
integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable :: & integer(kind(THERMAL_UNDEFINED_ID)), dimension(:,:), allocatable :: &
thermal_source thermal_source
type(tDataContainer), dimension(:), allocatable :: current type(tDataContainer), dimension(:), allocatable :: current
@ -93,11 +99,11 @@ module subroutine thermal_init(phases)
allocate(thermalstate(ph)%p(thermal_Nsources(ph))) allocate(thermalstate(ph)%p(thermal_Nsources(ph)))
enddo enddo
allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = SOURCE_undefined_ID) allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID)
if(maxval(thermal_Nsources) /= 0) then if(maxval(thermal_Nsources) /= 0) then
where(source_thermal_dissipation_init (maxval(thermal_Nsources))) thermal_source = SOURCE_thermal_dissipation_ID where(source_thermal_dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID
where(source_thermal_externalheat_init(maxval(thermal_Nsources))) thermal_source = SOURCE_thermal_externalheat_ID where(source_thermal_externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID
endif endif
thermal_source_maxSizeDotState = 0 thermal_source_maxSizeDotState = 0
@ -153,11 +159,11 @@ module subroutine constitutive_thermal_getRateAndItsTangents(TDot, dTDot_dT, T,
me = material_phasememberAt(co,ip,el) me = material_phasememberAt(co,ip,el)
do so = 1, thermal_Nsources(ph) do so = 1, thermal_Nsources(ph)
select case(thermal_source(so,ph)) select case(thermal_source(so,ph))
case (SOURCE_thermal_dissipation_ID) case (THERMAL_DISSIPATION_ID)
call source_thermal_dissipation_getRateAndItsTangent(my_Tdot, my_dTdot_dT, & call source_thermal_dissipation_getRateAndItsTangent(my_Tdot, my_dTdot_dT, &
mech_S(ph,me),mech_L_p(ph,me), ph) mech_S(ph,me),mech_L_p(ph,me), ph)
case (SOURCE_thermal_externalheat_ID) case (THERMAL_EXTERNALHEAT_ID)
call source_thermal_externalheat_getRateAndItsTangent(my_Tdot, my_dTdot_dT, & call source_thermal_externalheat_getRateAndItsTangent(my_Tdot, my_dTdot_dT, &
ph, me) ph, me)
@ -188,7 +194,7 @@ function constitutive_thermal_collectDotState(ph,me) result(broken)
SourceLoop: do i = 1, thermal_Nsources(ph) SourceLoop: do i = 1, thermal_Nsources(ph)
if (thermal_source(i,ph) == SOURCE_thermal_externalheat_ID) & if (thermal_source(i,ph) == THERMAL_EXTERNALHEAT_ID) &
call source_thermal_externalheat_dotState(ph,me) call source_thermal_externalheat_dotState(ph,me)
broken = broken .or. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,me))) broken = broken .or. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,me)))