From cdae867beb06391ccb91eccc19fc05e0678e1b7d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 7 Apr 2021 09:11:40 +0200 Subject: [PATCH] simplified damage currently works only for single constituent --- src/homogenization_damage.f90 | 22 ++------- src/phase.f90 | 11 ++--- src/phase_damage.f90 | 81 +++---------------------------- src/phase_damage_anisobrittle.f90 | 23 --------- src/phase_damage_anisoductile.f90 | 23 --------- src/phase_damage_isobrittle.f90 | 23 --------- src/phase_damage_isoductile.f90 | 23 --------- 7 files changed, 16 insertions(+), 190 deletions(-) diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index 53b5dd285..fa1eaab3f 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -76,14 +76,10 @@ module subroutine damage_partition(ce) real(pReal) :: phi integer, intent(in) :: ce - integer :: co - if(damageState_h(material_homogenizationID(ce))%sizeState < 1) return phi = damagestate_h(material_homogenizationID(ce))%state(1,material_homogenizationEntry(ce)) - do co = 1, homogenization_Nconstituents(material_homogenizationID(ce)) - call phase_damage_set_phi(phi,co,ce) - enddo + call phase_damage_set_phi(phi,1,ce) end subroutine damage_partition @@ -95,17 +91,9 @@ end subroutine damage_partition module function damage_nonlocal_getMobility(ce) result(M) integer, intent(in) :: ce - integer :: & - co real(pReal) :: M - M = 0.0_pReal - - do co = 1, homogenization_Nconstituents(material_homogenizationID(ce)) - M = M + lattice_M(material_phaseID(co,ce)) - enddo - - M = M/real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal) + M = lattice_M(material_phaseID(1,ce)) end function damage_nonlocal_getMobility @@ -121,11 +109,7 @@ module subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, phi, ce) real(pReal), intent(out) :: & phiDot - real(pReal) :: & - dPhiDot_dPhi - - call phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ce) - phiDot = phiDot/real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal) + phiDot = phase_damage_phi_dot(phi, ce) end subroutine damage_nonlocal_getSourceAndItsTangent diff --git a/src/phase.f90 b/src/phase.f90 index d10df84ba..d391e78cf 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -227,14 +227,13 @@ module phase end function phase_homogenizedC - module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ce) + module function phase_damage_phi_dot(phi, ce) result(phi_dot) integer, intent(in) :: ce real(pReal), intent(in) :: & phi !< damage parameter - real(pReal), intent(inout) :: & - phiDot, & - dPhiDot_dPhi - end subroutine phase_damage_getRateAndItsTangents + real(pReal) :: & + phi_dot + end function phase_damage_phi_dot module subroutine phase_thermal_getRate(TDot, ph,me) integer, intent(in) :: ph, me @@ -301,7 +300,7 @@ module phase public :: & phase_init, & phase_homogenizedC, & - phase_damage_getRateAndItsTangents, & + phase_damage_phi_dot, & phase_thermal_getRate, & phase_results, & phase_allocateState, & diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 4397d5cad..56f53c7bd 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -65,43 +65,6 @@ submodule(phase) damage integer, intent(in) :: ph,me end subroutine isoductile_dotState - - module subroutine anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) - integer, intent(in) :: ph,me - real(pReal), intent(in) :: & - phi !< damage parameter - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - end subroutine anisobrittle_getRateAndItsTangent - - module subroutine anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) - integer, intent(in) :: ph,me - real(pReal), intent(in) :: & - phi !< damage parameter - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - end subroutine anisoductile_getRateAndItsTangent - - module subroutine isobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) - integer, intent(in) :: ph,me - real(pReal), intent(in) :: & - phi !< damage parameter - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - end subroutine isobrittle_getRateAndItsTangent - - module subroutine isoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) - integer, intent(in) :: ph,me - real(pReal), intent(in) :: & - phi !< damage parameter - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - end subroutine isoductile_getRateAndItsTangent - module subroutine anisobrittle_results(phase,group) integer, intent(in) :: phase character(len=*), intent(in) :: group @@ -179,53 +142,25 @@ end subroutine damage_init !---------------------------------------------------------------------------------------------- !< @brief returns local part of nonlocal damage driving force !---------------------------------------------------------------------------------------------- -module subroutine phase_damage_getRateAndItsTangents(phiDot, dPhiDot_dPhi, phi, ce) +module function phase_damage_phi_dot(phi, ce) result(phi_dot) integer, intent(in) :: ce real(pReal), intent(in) :: & phi !< damage parameter - real(pReal), intent(inout) :: & - phiDot, & - dPhiDot_dPhi - real(pReal) :: & - localphiDot, & - dLocalphiDot_dPhi + phi_dot + integer :: & ph, & - co, & me - phiDot = 0.0_pReal - dPhiDot_dPhi = 0.0_pReal + ph = material_phaseID(1,ce) + me = material_phaseEntry(1,ce) - do co = 1, homogenization_Nconstituents(material_homogenizationID(ce)) - ph = material_phaseID(co,ce) - me = material_phaseEntry(co,ce) + phi_dot = 1.0_pReal & + - phi*damageState(ph)%state(1,me) - select case(phase_source(ph)) - case (DAMAGE_ISOBRITTLE_ID) - call isobrittle_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - case (DAMAGE_ISODUCTILE_ID) - call isoductile_getRateAndItsTangent (localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - case (DAMAGE_ANISOBRITTLE_ID) - call anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - case (DAMAGE_ANISODUCTILE_ID) - call anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - case default - localphiDot = 0.0_pReal - dLocalphiDot_dPhi = 0.0_pReal - - end select - phiDot = phiDot + localphiDot - dPhiDot_dPhi = dPhiDot_dPhi + dLocalphiDot_dPhi - enddo - -end subroutine phase_damage_getRateAndItsTangents +end function phase_damage_phi_dot diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index e9672dd3b..d937255a5 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -148,29 +148,6 @@ module subroutine anisobrittle_dotState(S, ph,me) end subroutine anisobrittle_dotState -!-------------------------------------------------------------------------------------------------- -!> @brief returns local part of nonlocal damage driving force -!-------------------------------------------------------------------------------------------------- -module subroutine anisobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - integer, intent(in) :: & - ph, & - me - real(pReal), intent(in) :: & - phi - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - - - dLocalphiDot_dPhi = -damageState(ph)%state(1,me) - - localphiDot = 1.0_pReal & - + dLocalphiDot_dPhi*phi - -end subroutine anisobrittle_getRateAndItsTangent - - !-------------------------------------------------------------------------------------------------- !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_damage_anisoductile.f90 b/src/phase_damage_anisoductile.f90 index 54b63278f..049f148bc 100644 --- a/src/phase_damage_anisoductile.f90 +++ b/src/phase_damage_anisoductile.f90 @@ -113,29 +113,6 @@ module subroutine anisoductile_dotState(ph,me) end subroutine anisoductile_dotState -!-------------------------------------------------------------------------------------------------- -!> @brief returns local part of nonlocal damage driving force -!-------------------------------------------------------------------------------------------------- -module subroutine anisoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph,me) - - integer, intent(in) :: & - ph, & - me - real(pReal), intent(in) :: & - phi - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - - - dLocalphiDot_dPhi = -damageState(ph)%state(1,me) - - localphiDot = 1.0_pReal & - + dLocalphiDot_dPhi*phi - -end subroutine anisoductile_getRateAndItsTangent - - !-------------------------------------------------------------------------------------------------- !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 59cedb554..e88a87352 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -113,29 +113,6 @@ module subroutine isobrittle_deltaState(C, Fe, ph,me) end subroutine isobrittle_deltaState -!-------------------------------------------------------------------------------------------------- -!> @brief returns local part of nonlocal damage driving force -!-------------------------------------------------------------------------------------------------- -module subroutine isobrittle_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - integer, intent(in) :: & - ph, me - real(pReal), intent(in) :: & - phi - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - - - associate(prm => param(ph)) - localphiDot = 1.0_pReal & - - phi*damageState(ph)%state(1,me) - dLocalphiDot_dPhi = - damageState(ph)%state(1,me) - end associate - -end subroutine isobrittle_getRateAndItsTangent - - !-------------------------------------------------------------------------------------------------- !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_damage_isoductile.f90 b/src/phase_damage_isoductile.f90 index 1f1bba847..997b948fe 100644 --- a/src/phase_damage_isoductile.f90 +++ b/src/phase_damage_isoductile.f90 @@ -103,29 +103,6 @@ module subroutine isoductile_dotState(ph, me) end subroutine isoductile_dotState -!-------------------------------------------------------------------------------------------------- -!> @brief returns local part of nonlocal damage driving force -!-------------------------------------------------------------------------------------------------- -module subroutine isoductile_getRateAndItsTangent(localphiDot, dLocalphiDot_dPhi, phi, ph, me) - - integer, intent(in) :: & - ph, & - me - real(pReal), intent(in) :: & - phi - real(pReal), intent(out) :: & - localphiDot, & - dLocalphiDot_dPhi - - - dLocalphiDot_dPhi = -damageState(ph)%state(1,me) - - localphiDot = 1.0_pReal & - + dLocalphiDot_dPhi*phi - -end subroutine isoductile_getRateAndItsTangent - - !-------------------------------------------------------------------------------------------------- !> @brief writes results to HDF5 output file !--------------------------------------------------------------------------------------------------