From 830d00fa675b960c6d5225638c48585915e2c04b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 12 Feb 2021 22:41:35 +0100 Subject: [PATCH] simplified structure choice of damage model triggers eigendeformation, no repeated variables This implementation is the most ugly hack I could imagine. I just serves the purpose of having a stable material.yaml --- PRIVATE | 2 +- src/phase_damage.f90 | 4 +- src/phase_damage_anisobrittle.f90 | 4 +- src/phase_damage_isobrittle.f90 | 4 +- src/phase_damage_isoductile.f90 | 4 +- src/phase_mechanical_eigen.f90 | 44 ++++++++++++++++++- ...phase_mechanical_eigen_cleavageopening.f90 | 4 +- ...hase_mechanical_eigen_slipplaneopening.f90 | 4 +- 8 files changed, 55 insertions(+), 15 deletions(-) diff --git a/PRIVATE b/PRIVATE index e74cf0062..07d125fe4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit e74cf00628285a587ced1e551cc9837c1011ca1c +Subproject commit 07d125fe476621224d9f2ef73b0cf88f3b07bc60 diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 57145c550..6063f3583 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -175,7 +175,7 @@ module subroutine damage_init allocate(current(ph)%d_phi_d_dot_phi(Nconstituents),source=0.0_pReal) phase => phases%get(ph) - sources => phase%get('source',defaultVal=emptyList) + sources => phase%get('damage',defaultVal=emptyList) phase_Nsources(ph) = sources%length allocate(damageState(ph)%p(phase_Nsources(ph))) enddo @@ -493,7 +493,7 @@ function source_active(source_label,src_length) result(active_source) allocate(active_source(src_length,phases%length), source = .false. ) do p = 1, phases%length phase => phases%get(p) - sources => phase%get('source',defaultVal=emptyList) + sources => phase%get('damage',defaultVal=emptyList) do s = 1, sources%length src => sources%get(s) if(src%get_asString('type') == source_label) active_source(s,p) = .true. diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 699e9508b..ad7f80604 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -51,7 +51,7 @@ module function anisobrittle_init(source_length) result(mySources) print'(/,a)', ' <<<+- phase:damage:anisobrittle init -+>>>' - mySources = source_active('damage_anisoBrittle',source_length) + mySources = source_active('anisobrittle',source_length) Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -65,7 +65,7 @@ module function anisobrittle_init(source_length) result(mySources) phase => phases%get(p) if(any(mySources(:,p))) source_damage_anisoBrittle_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle - sources => phase%get('source') + sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then source_damage_anisoBrittle_offset(p) = sourceOffset diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 529ecd404..a2ae7dfb7 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -41,7 +41,7 @@ module function isobrittle_init(source_length) result(mySources) print'(/,a)', ' <<<+- phase:damage:isobrittle init -+>>>' - mySources = source_active('damage_isoBrittle',source_length) + mySources = source_active('isobrittle',source_length) Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -55,7 +55,7 @@ module function isobrittle_init(source_length) result(mySources) phase => phases%get(p) if(any(mySources(:,p))) source_damage_isoBrittle_instance(p) = count(mySources(:,1:p)) if(count(mySources(:,p)) == 0) cycle - sources => phase%get('source') + sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then source_damage_isoBrittle_offset(p) = sourceOffset diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index e9aec1944..f378b7ad2 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -43,7 +43,7 @@ module function isoductile_init(source_length) result(mySources) print'(/,a)', ' <<<+- phase:damage:isoductile init -+>>>' - mySources = source_active('damage_isoDuctile',source_length) + mySources = source_active('isoductile',source_length) Ninstances = count(mySources) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -57,7 +57,7 @@ module function isoductile_init(source_length) result(mySources) phase => phases%get(p) if(count(mySources(:,p)) == 0) cycle if(any(mySources(:,p))) source_damage_isoDuctile_instance(p) = count(mySources(:,1:p)) - sources => phase%get('source') + sources => phase%get('damage') do sourceOffset = 1, sources%length if(mySources(sourceOffset,p)) then source_damage_isoDuctile_offset(p) = sourceOffset diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 6df993565..3fb2d1bf2 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -66,7 +66,8 @@ module subroutine eigendeformation_init(phases) ph class(tNode), pointer :: & phase, & - kinematics + kinematics, & + damage print'(/,a)', ' <<<+- phase:mechanics:eigendeformation init -+>>>' @@ -77,6 +78,12 @@ module subroutine eigendeformation_init(phases) phase => phases%get(ph) kinematics => phase%get('kinematics',defaultVal=emptyList) phase_Nkinematics(ph) = kinematics%length + kinematics => phase%get('damage',defaultVal=emptyList) + if(kinematics%length >0) then + damage => kinematics%get(1) + if(damage%get_asString('type') == 'anisobrittle') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 + if(damage%get_asString('type') == 'isoductile') phase_Nkinematics(ph) = phase_Nkinematics(ph) +1 + endif enddo allocate(phase_kinematics(maxval(phase_Nkinematics),phases%length), source = KINEMATICS_undefined_ID) @@ -90,7 +97,6 @@ module subroutine eigendeformation_init(phases) end subroutine eigendeformation_init - !-------------------------------------------------------------------------------------------------- !> @brief checks if a kinematic mechanism is active or not !-------------------------------------------------------------------------------------------------- @@ -122,6 +128,38 @@ function kinematics_active(kinematics_label,kinematics_length) result(active_ki end function kinematics_active + +!-------------------------------------------------------------------------------------------------- +!> @brief checks if a kinematic mechanism is active or not +!-------------------------------------------------------------------------------------------------- +function kinematics_active2(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 + integer :: p,k + + phases => config_material%get('phase') + allocate(active_kinematics(kinematics_length,phases%length), source = .false. ) + do p = 1, phases%length + phase => phases%get(p) + kinematics => phase%get('damage',defaultVal=emptyList) + do k = 1, kinematics%length + kinematics_type => kinematics%get(k) + if(kinematics_type%get_asString('type') == kinematics_label) active_kinematics(k,p) = .true. + enddo + enddo + + +end function kinematics_active2 + + !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the velocity gradient ! ToDo: MD: S is Mi? @@ -175,8 +213,10 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & KinematicsLoop: do k = 1, phase_Nkinematics(material_phaseAt(co,el)) kinematicsType: select case (phase_kinematics(k,material_phaseAt(co,el))) case (KINEMATICS_cleavage_opening_ID) kinematicsType + print*, 'clea' call kinematics_cleavage_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, co, ip, el) case (KINEMATICS_slipplane_opening_ID) kinematicsType + print*, 'slipp' call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S, co, ip, el) case (KINEMATICS_thermal_expansion_ID) kinematicsType me = material_phaseMemberAt(co,ip,el) diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 index 55102e196..f1774c78e 100644 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ b/src/phase_mechanical_eigen_cleavageopening.f90 @@ -46,7 +46,7 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:cleavageopening init -+>>>' - myKinematics = kinematics_active('cleavage_opening',kinematics_length) + myKinematics = kinematics_active2('anisobrittle',kinematics_length) Ninstances = count(myKinematics) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -59,7 +59,7 @@ module function kinematics_cleavage_opening_init(kinematics_length) result(myKin if(any(myKinematics(:,p))) kinematics_cleavage_opening_instance(p) = count(myKinematics(:,1:p)) phase => phases%get(p) if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('kinematics') + kinematics => phase%get('damage') do k = 1, kinematics%length if(myKinematics(k,p)) then associate(prm => param(kinematics_cleavage_opening_instance(p))) diff --git a/src/phase_mechanical_eigen_slipplaneopening.f90 b/src/phase_mechanical_eigen_slipplaneopening.f90 index cf5e918b3..dd5f172d9 100644 --- a/src/phase_mechanical_eigen_slipplaneopening.f90 +++ b/src/phase_mechanical_eigen_slipplaneopening.f90 @@ -51,7 +51,7 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi print'(/,a)', ' <<<+- phase:mechanics:eigendeformation:slipplaneopening init -+>>>' - myKinematics = kinematics_active('slipplane_opening',kinematics_length) + myKinematics = kinematics_active2('isoductile',kinematics_length) Ninstances = count(myKinematics) print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return @@ -66,7 +66,7 @@ module function kinematics_slipplane_opening_init(kinematics_length) result(myKi mech => phase%get('mechanics') pl => mech%get('plasticity') if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('kinematics') + kinematics => phase%get('damage') do k = 1, kinematics%length if(myKinematics(k,p)) then associate(prm => param(kinematics_slipplane_opening_instance(p)))