diff --git a/code/DAMASK_abaqus_exp.f b/code/DAMASK_abaqus_exp.f index 5887ad2a4..46fa7f4db 100644 --- a/code/DAMASK_abaqus_exp.f +++ b/code/DAMASK_abaqus_exp.f @@ -86,6 +86,7 @@ end module DAMASK_interface #include "damage_brittle.f90" #include "damage_ductile.f90" #include "damage_gurson.f90" +#include "damage_anisotropic.f90" #include "thermal_isothermal.f90" #include "thermal_adiabatic.f90" #include "vacancy_constant.f90" diff --git a/code/DAMASK_abaqus_std.f b/code/DAMASK_abaqus_std.f index e11144f0c..68017af86 100644 --- a/code/DAMASK_abaqus_std.f +++ b/code/DAMASK_abaqus_std.f @@ -86,6 +86,7 @@ end module DAMASK_interface #include "damage_brittle.f90" #include "damage_ductile.f90" #include "damage_gurson.f90" +#include "damage_anisotropic.f90" #include "thermal_isothermal.f90" #include "thermal_adiabatic.f90" #include "vacancy_constant.f90" diff --git a/code/DAMASK_marc.f90 b/code/DAMASK_marc.f90 index 549c6ffcd..33db62627 100644 --- a/code/DAMASK_marc.f90 +++ b/code/DAMASK_marc.f90 @@ -115,6 +115,7 @@ end module DAMASK_interface #include "damage_brittle.f90" #include "damage_ductile.f90" #include "damage_gurson.f90" +#include "damage_anisotropic.f90" #include "thermal_isothermal.f90" #include "thermal_adiabatic.f90" #include "vacancy_constant.f90" diff --git a/code/Makefile b/code/Makefile index 4104c9554..1d1a49013 100644 --- a/code/Makefile +++ b/code/Makefile @@ -326,7 +326,7 @@ COMPILE =$(COMPILE_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATI COMPILE_MAXOPTI =$(COMPILE_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) ################################################################################################### DAMAGE_FILES = \ - damage_none.o damage_brittle.o damage_ductile.o damage_gurson.o + damage_none.o damage_brittle.o damage_ductile.o damage_gurson.o damage_anisotropic.o THERMAL_FILES = \ thermal_isothermal.o thermal_adiabatic.o @@ -489,6 +489,9 @@ damage_ductile.o: damage_ductile.f90 \ damage_gurson.o: damage_gurson.f90 \ lattice.o + +damage_anisotropic.o: damage_anisotropic.f90 \ + lattice.o thermal_isothermal.o: thermal_isothermal.f90 \ lattice.o diff --git a/code/constitutive.f90 b/code/constitutive.f90 index 9040dc27b..205a91119 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -122,6 +122,7 @@ subroutine constitutive_init(temperature_init) LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & LOCAL_THERMAL_isothermal_ID, & LOCAL_THERMAL_adiabatic_ID, & LOCAL_VACANCY_constant_ID, & @@ -130,6 +131,7 @@ subroutine constitutive_init(temperature_init) LOCAL_DAMAGE_brittle_label, & LOCAL_DAMAGE_ductile_label, & LOCAL_DAMAGE_gurson_label, & + LOCAL_DAMAGE_anisotropic_label, & LOCAL_THERMAL_isothermal_label, & LOCAL_THERMAL_adiabatic_label, & LOCAL_VACANCY_constant_label, & @@ -152,6 +154,7 @@ subroutine constitutive_init(temperature_init) use damage_brittle use damage_ductile use damage_gurson + use damage_anisotropic use thermal_isothermal use thermal_adiabatic use vacancy_constant @@ -196,6 +199,7 @@ subroutine constitutive_init(temperature_init) if (any(phase_damage == LOCAL_DAMAGE_brittle_ID)) call damage_brittle_init(FILEUNIT) if (any(phase_damage == LOCAL_DAMAGE_ductile_ID)) call damage_ductile_init(FILEUNIT) if (any(phase_damage == LOCAL_DAMAGE_gurson_ID)) call damage_gurson_init(FILEUNIT) + if (any(phase_damage == LOCAL_DAMAGE_anisotropic_ID)) call damage_anisotropic_init(FILEUNIT) close(FILEUNIT) !-------------------------------------------------------------------------------------------------- @@ -299,6 +303,11 @@ subroutine constitutive_init(temperature_init) thisNoutput => damage_gurson_Noutput thisOutput => damage_gurson_output thisSize => damage_gurson_sizePostResult + case (LOCAL_DAMAGE_anisotropic_ID) + outputName = LOCAL_DAMAGE_anisotropic_label + thisNoutput => damage_anisotropic_Noutput + thisOutput => damage_anisotropic_output + thisSize => damage_anisotropic_sizePostResult case default knownDamage = .false. end select @@ -492,7 +501,8 @@ subroutine constitutive_microstructure(Tstar_v, Fe, Fp, ipc, ip, el) PLASTICITY_nonlocal_ID, & LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & - LOCAL_DAMAGE_gurson_ID + LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID use constitutive_titanmod, only: & constitutive_titanmod_microstructure @@ -508,6 +518,8 @@ subroutine constitutive_microstructure(Tstar_v, Fe, Fp, ipc, ip, el) damage_ductile_microstructure use damage_gurson, only: & damage_gurson_microstructure + use damage_anisotropic, only: & + damage_anisotropic_microstructure implicit none integer(pInt), intent(in) :: & @@ -552,6 +564,9 @@ subroutine constitutive_microstructure(Tstar_v, Fe, Fp, ipc, ip, el) call damage_ductile_microstructure(nSlip,accumulatedSlip,ipc, ip, el) case (LOCAL_DAMAGE_gurson_ID) call damage_gurson_microstructure(ipc, ip, el) + case (LOCAL_DAMAGE_anisotropic_ID) + call constitutive_getAccumulatedSlip(nSlip,accumulatedSlip,Fp,ipc, ip, el) + call damage_anisotropic_microstructure(nSlip,accumulatedSlip,ipc, ip, el) end select @@ -743,6 +758,7 @@ subroutine constitutive_collectDotState(Tstar_v, Lp, FeArray, FpArray, subdt, su LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & LOCAL_THERMAL_adiabatic_ID, & LOCAL_VACANCY_generation_ID use constitutive_j2, only: & @@ -763,6 +779,8 @@ subroutine constitutive_collectDotState(Tstar_v, Lp, FeArray, FpArray, subdt, su damage_ductile_dotState use damage_gurson, only: & damage_gurson_dotState + use damage_anisotropic, only: & + damage_anisotropic_dotState use thermal_adiabatic, only: & thermal_adiabatic_dotState use vacancy_generation, only: & @@ -819,6 +837,8 @@ subroutine constitutive_collectDotState(Tstar_v, Lp, FeArray, FpArray, subdt, su call damage_ductile_dotState(ipc, ip, el) case (LOCAL_DAMAGE_gurson_ID) call damage_gurson_dotState(Tstar_v, Lp, ipc, ip, el) + case (LOCAL_DAMAGE_anisotropic_ID) + call damage_anisotropic_dotState(ipc, ip, el) end select select case (phase_thermal(material_phase(ipc,ip,el))) @@ -906,7 +926,7 @@ end function constitutive_collectDeltaState !-------------------------------------------------------------------------------------------------- -!> @brief Returns the local(unregularised) damage +!> @brief Returns the local(regularised) damage !-------------------------------------------------------------------------------------------------- function constitutive_getLocalDamage(ipc, ip, el) use prec, only: & @@ -917,6 +937,7 @@ function constitutive_getLocalDamage(ipc, ip, el) LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & phase_damage use damage_brittle, only: & constitutive_brittle_getDamage @@ -924,6 +945,8 @@ function constitutive_getLocalDamage(ipc, ip, el) constitutive_ductile_getDamage use damage_gurson, only: & constitutive_gurson_getDamage + use damage_anisotropic, only: & + constitutive_anisotropic_getDamage implicit none integer(pInt), intent(in) :: & @@ -944,6 +967,9 @@ function constitutive_getLocalDamage(ipc, ip, el) case (LOCAL_DAMAGE_gurson_ID) constitutive_getLocalDamage = constitutive_gurson_getDamage(ipc, ip, el) + + case (LOCAL_DAMAGE_anisotropic_ID) + constitutive_getLocalDamage = constitutive_anisotropic_getDamage(ipc, ip, el) end select end function constitutive_getLocalDamage @@ -959,6 +985,7 @@ subroutine constitutive_putLocalDamage(ipc, ip, el, localDamage) LOCAL_DAMAGE_BRITTLE_ID, & LOCAL_DAMAGE_DUCTILE_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & phase_damage use damage_brittle, only: & constitutive_brittle_putDamage @@ -966,6 +993,8 @@ subroutine constitutive_putLocalDamage(ipc, ip, el, localDamage) constitutive_ductile_putDamage use damage_gurson, only: & constitutive_gurson_putDamage + use damage_anisotropic, only: & + constitutive_anisotropic_putDamage implicit none integer(pInt), intent(in) :: & @@ -984,6 +1013,9 @@ subroutine constitutive_putLocalDamage(ipc, ip, el, localDamage) case (LOCAL_DAMAGE_gurson_ID) call constitutive_gurson_putDamage(ipc, ip, el, localDamage) + + case (LOCAL_DAMAGE_anisotropic_ID) + call constitutive_anisotropic_putDamage(ipc, ip, el, localDamage) end select @@ -1037,6 +1069,7 @@ function constitutive_getDamageDiffusion33(ipc, ip, el) LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & phase_damage use damage_brittle, only: & damage_brittle_getDamageDiffusion33 @@ -1460,6 +1493,7 @@ function constitutive_postResults(Tstar_v, FeArray, ipc, ip, el) LOCAL_DAMAGE_BRITTLE_ID, & LOCAL_DAMAGE_DUCTILE_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & LOCAL_THERMAL_ADIABATIC_ID, & LOCAL_VACANCY_generation_ID use constitutive_j2, only: & @@ -1484,6 +1518,8 @@ function constitutive_postResults(Tstar_v, FeArray, ipc, ip, el) damage_ductile_postResults use damage_gurson, only: & damage_gurson_postResults + use damage_anisotropic, only: & + damage_anisotropic_postResults use thermal_adiabatic, only: & thermal_adiabatic_postResults use vacancy_generation, only: & @@ -1548,6 +1584,8 @@ function constitutive_postResults(Tstar_v, FeArray, ipc, ip, el) constitutive_postResults(startPos:endPos) = damage_ductile_postResults(ipc, ip, el) case (LOCAL_DAMAGE_gurson_ID) constitutive_postResults(startPos:endPos) = damage_gurson_postResults(ipc, ip, el) + case (LOCAL_DAMAGE_anisotropic_ID) + constitutive_postResults(startPos:endPos) = damage_anisotropic_postResults(ipc, ip, el) end select startPos = endPos + 1_pInt diff --git a/code/damage_anisotropic.f90 b/code/damage_anisotropic.f90 new file mode 100644 index 000000000..ba8b9e860 --- /dev/null +++ b/code/damage_anisotropic.f90 @@ -0,0 +1,409 @@ +!-------------------------------------------------------------------------------------------------- +! $Id: damage_anisotropic.f90 3210 2014-06-17 15:24:44Z MPIE\m.diehl $ +!-------------------------------------------------------------------------------------------------- +!> @author Luv Sharma, Max-Planck-Institut für Eisenforschung GmbH +!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH +!> @brief material subroutine incorporating anisotropic ductile damage +!> @details to be done +!-------------------------------------------------------------------------------------------------- +module damage_anisotropic + use prec, only: & + pReal, & + pInt + + implicit none + private + integer(pInt), dimension(:), allocatable, public, protected :: & + damage_anisotropic_sizePostResults !< cumulative size of post results + + integer(pInt), dimension(:,:), allocatable, target, public :: & + damage_anisotropic_sizePostResult !< size of each post result output + + character(len=64), dimension(:,:), allocatable, target, public :: & + damage_anisotropic_output !< name of each post result output + + integer(pInt), dimension(:), allocatable, target, public :: & + damage_anisotropic_Noutput !< number of outputs per instance of this damage + + integer(pInt), dimension(:), allocatable, target, private :: & + damage_anisotropic_nSlip !< Todo + + real(pReal), dimension(:), allocatable, private :: & + damage_anisotropic_aTol, & + damage_anisotropic_critpStrain + + enum, bind(c) + enumerator :: undefined_ID, & + local_damage_ID + end enum !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11 ToDo + + integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & + damage_anisotropic_outputID !< ID of each post result output + + + public :: & + damage_anisotropic_init, & + damage_anisotropic_stateInit, & + damage_anisotropic_aTolState, & + damage_anisotropic_dotState, & + damage_anisotropic_microstructure, & + constitutive_anisotropic_getDamage, & + constitutive_anisotropic_putDamage, & + damage_anisotropic_postResults + +contains + + +!-------------------------------------------------------------------------------------------------- +!> @brief module initialization +!> @details reads in material parameters, allocates arrays, and does sanity checks +!-------------------------------------------------------------------------------------------------- +subroutine damage_anisotropic_init(fileUnit) + use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use debug, only: & + debug_level,& + debug_constitutive,& + debug_levelBasic + use mesh, only: & + mesh_maxNips, & + mesh_NcpElems + use IO, only: & + IO_read, & + IO_lc, & + IO_getTag, & + IO_isBlank, & + IO_stringPos, & + IO_stringValue, & + IO_floatValue, & + IO_intValue, & + IO_warning, & + IO_error, & + IO_timeStamp, & + IO_EOF + use material, only: & + homogenization_maxNgrains, & + phase_damage, & + phase_damageInstance, & + phase_Noutput, & + LOCAL_DAMAGE_anisotropic_label, & + LOCAL_DAMAGE_anisotropic_ID, & + material_phase, & + damageState, & + MATERIAL_partPhase + use numerics,only: & + worldrank, & + numerics_integrator + + implicit none + integer(pInt), intent(in) :: fileUnit + + integer(pInt), parameter :: MAXNCHUNKS = 7_pInt + integer(pInt), dimension(1+2*MAXNCHUNKS) :: positions + integer(pInt) :: maxNinstance,mySize=0_pInt,phase,instance,o + integer(pInt) :: sizeState, sizeDotState + integer(pInt) :: NofMyPhase + character(len=65536) :: & + tag = '', & + line = '' + + mainProcess: if (worldrank == 0) then + write(6,'(/,a)') ' <<<+- damage_'//LOCAL_DAMAGE_anisotropic_LABEL//' init -+>>>' + write(6,'(a)') ' $Id: damage_anisotropic.f90 3210 2014-06-17 15:24:44Z MPIE\m.diehl $' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() +#include "compilation_info.f90" + endif mainProcess + + maxNinstance = int(count(phase_damage == LOCAL_DAMAGE_anisotropic_ID),pInt) + if (maxNinstance == 0_pInt) return + + if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & + write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance + + allocate(damage_anisotropic_sizePostResults(maxNinstance), source=0_pInt) + allocate(damage_anisotropic_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) + allocate(damage_anisotropic_output(maxval(phase_Noutput),maxNinstance)) + damage_anisotropic_output = '' + allocate(damage_anisotropic_outputID(maxval(phase_Noutput),maxNinstance), source=undefined_ID) + allocate(damage_anisotropic_Noutput(maxNinstance), source=0_pInt) + allocate(damage_anisotropic_critpStrain(maxNinstance), source=0.0_pReal) + allocate(damage_anisotropic_nSlip(maxNinstance), source=0_pInt) + allocate(damage_anisotropic_aTol(maxNinstance), source=0.0_pReal) + + rewind(fileUnit) + phase = 0_pInt + do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to + line = IO_read(fileUnit) + enddo + + parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part + line = IO_read(fileUnit) + if (IO_isBlank(line)) cycle ! skip empty lines + if (IO_getTag(line,'<','>') /= '') then ! stop at next part + line = IO_read(fileUnit, .true.) ! reset IO_read + exit + endif + if (IO_getTag(line,'[',']') /= '') then ! next phase section + phase = phase + 1_pInt ! advance phase section counter + cycle ! skip to next line + endif + if (phase > 0_pInt ) then; if (phase_damage(phase) == LOCAL_DAMAGE_anisotropic_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran + instance = phase_damageInstance(phase) ! which instance of my damage is present phase + positions = IO_stringPos(line,MAXNCHUNKS) + tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key + select case(tag) + case ('(output)') + select case(IO_lc(IO_stringValue(line,positions,2_pInt))) + case ('local_damage') + damage_anisotropic_Noutput(instance) = damage_anisotropic_Noutput(instance) + 1_pInt + damage_anisotropic_outputID(damage_anisotropic_Noutput(instance),instance) = local_damage_ID + damage_anisotropic_output(damage_anisotropic_Noutput(instance),instance) = & + IO_lc(IO_stringValue(line,positions,2_pInt)) + end select + + case ('critical_plastic_strain') + damage_anisotropic_critpStrain(instance) = IO_floatValue(line,positions,2_pInt) + + case ('atol_damage') + damage_anisotropic_aTol(instance) = IO_floatValue(line,positions,2_pInt) + + case ('Nslip') ! + damage_anisotropic_nSlip(instance) = IO_floatValue(line,positions,2_pInt) + + end select + endif; endif + enddo parsingFile + + initializeInstances: do phase = 1_pInt, size(phase_damage) + if (phase_damage(phase) == LOCAL_DAMAGE_anisotropic_ID) then + NofMyPhase=count(material_phase==phase) + instance = phase_damageInstance(phase) + +!-------------------------------------------------------------------------------------------------- +! Determine size of postResults array + outputsLoop: do o = 1_pInt,damage_anisotropic_Noutput(instance) + select case(damage_anisotropic_outputID(o,instance)) + case(local_damage_ID) + mySize = 1_pInt + end select + + if (mySize > 0_pInt) then ! any meaningful output found + damage_anisotropic_sizePostResult(o,instance) = mySize + damage_anisotropic_sizePostResults(instance) = damage_anisotropic_sizePostResults(instance) + mySize + endif + enddo outputsLoop +! Determine size of state array + sizeDotState = damage_anisotropic_nSlip(instance) + sizeState = 2_pInt * damage_anisotropic_nSlip(instance) + + damageState(phase)%sizeState = sizeState + damageState(phase)%sizeDotState = sizeDotState + damageState(phase)%sizePostResults = damage_anisotropic_sizePostResults(instance) + allocate(damageState(phase)%aTolState (sizeState), source=0.0_pReal) + allocate(damageState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%state (sizeState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) + + allocate(damageState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%deltaState (sizeDotState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) + if (any(numerics_integrator == 1_pInt)) then + allocate(damageState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) + allocate(damageState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) + endif + if (any(numerics_integrator == 4_pInt)) & + allocate(damageState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) + if (any(numerics_integrator == 5_pInt)) & + allocate(damageState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) + + call damage_anisotropic_stateInit(phase) + call damage_anisotropic_aTolState(phase,instance) + endif + + enddo initializeInstances +end subroutine damage_anisotropic_init + +!-------------------------------------------------------------------------------------------------- +!> @brief sets the relevant state values for a given instance of this damage +!-------------------------------------------------------------------------------------------------- +subroutine damage_anisotropic_stateInit(phase) + use material, only: & + damageState + + implicit none + integer(pInt), intent(in) :: phase !< number specifying the phase of the damage + + real(pReal), dimension(damageState(phase)%sizeState) :: tempState + + tempState = 1.0_pReal + damageState(phase)%state = spread(tempState,2,size(damageState(phase)%state(1,:))) + damageState(phase)%state0 = damageState(phase)%state + damageState(phase)%partionedState0 = damageState(phase)%state +end subroutine damage_anisotropic_stateInit + +!-------------------------------------------------------------------------------------------------- +!> @brief sets the relevant state values for a given instance of this damage +!-------------------------------------------------------------------------------------------------- +subroutine damage_anisotropic_aTolState(phase,instance) + use material, only: & + damageState + + implicit none + integer(pInt), intent(in) :: & + phase, & + instance ! number specifying the current instance of the damage + real(pReal), dimension(damageState(phase)%sizeState) :: tempTol + + tempTol = damage_anisotropic_aTol(instance) + damageState(phase)%aTolState = tempTol +end subroutine damage_anisotropic_aTolState + +!-------------------------------------------------------------------------------------------------- +!> @brief calculates derived quantities from state +!-------------------------------------------------------------------------------------------------- +subroutine damage_anisotropic_dotState(ipc, ip, el) + use material, only: & + mappingConstitutive, & + damageState + use math, only: & + math_norm33 + use lattice, only: & + lattice_DamageMobility + + implicit none + integer(pInt), intent(in) :: & + ipc, & !< component-ID of integration point + ip, & !< integration point + el !< element + integer(pInt) :: & + phase, & + constituent, & + i + + phase = mappingConstitutive(2,ipc,ip,el) + constituent = mappingConstitutive(1,ipc,ip,el) + + forall (i = 1_pInt:damageState(phase)%sizeState) & + damageState(phase)%dotState(i,constituent) = & + (1.0_pReal/lattice_DamageMobility(phase))* & + (damageState(phase)%state(i+damageState(phase)%sizeState,constituent) - & + damageState(phase)%state(i,constituent)) + +end subroutine damage_anisotropic_dotState + +!-------------------------------------------------------------------------------------------------- +!> @brief calculates derived quantities from state +!-------------------------------------------------------------------------------------------------- +subroutine damage_anisotropic_microstructure(nSlip,accumulatedSlip,ipc, ip, el) + use material, only: & + mappingConstitutive, & + phase_damageInstance, & + damageState + use math, only: & + math_Mandel6to33, & + math_mul33x33, & + math_transpose33, & + math_I3, & + math_norm33 + + implicit none + integer(pInt), intent(in) :: & + nSlip, & + ipc, & !< component-ID of integration point + ip, & !< integration point + el !< element + real(pReal), dimension(nSlip), intent(in) :: & + accumulatedSlip + integer(pInt) :: & + phase, constituent, i + + phase = mappingConstitutive(2,ipc,ip,el) + constituent = mappingConstitutive(1,ipc,ip,el) + + forall (i = 1_pInt:damageState(phase)%sizeState) & + damageState(phase)%state(damageState(phase)%sizeState + i,constituent) = & + min(damageState(phase)%state(i,constituent), & + damage_anisotropic_critpStrain(phase)/ & + accumulatedSlip(i)) + +end subroutine damage_anisotropic_microstructure + +!-------------------------------------------------------------------------------------------------- +!> @brief returns temperature based on local damage model state layout +!-------------------------------------------------------------------------------------------------- +function constitutive_anisotropic_getDamage(ipc, ip, el) + use material, only: & + mappingConstitutive, & + damageState + + implicit none + integer(pInt), intent(in) :: & + ipc, & !< grain number + ip, & !< integration point number + el !< element number + real(pReal) :: constitutive_anisotropic_getDamage + + constitutive_anisotropic_getDamage = & + damageState(mappingConstitutive(2,ipc,ip,el))%state(1,mappingConstitutive(1,ipc,ip,el)) + +end function constitutive_anisotropic_getDamage + +!-------------------------------------------------------------------------------------------------- +!> @brief returns damage value based on local damage +!-------------------------------------------------------------------------------------------------- +subroutine constitutive_anisotropic_putDamage(ipc, ip, el, localDamage) + use material, only: & + mappingConstitutive, & + damageState + + implicit none + integer(pInt), intent(in) :: & + ipc, & !< grain number + ip, & !< integration point number + el !< element number + real(pReal), intent(in) :: localDamage + + damageState(mappingConstitutive(2,ipc,ip,el))%state(1,mappingConstitutive(1,ipc,ip,el)) = & + localDamage + +end subroutine constitutive_anisotropic_putDamage + +!-------------------------------------------------------------------------------------------------- +!> @brief return array of constitutive results +!-------------------------------------------------------------------------------------------------- +function damage_anisotropic_postResults(ipc,ip,el) + use material, only: & + mappingConstitutive, & + phase_damageInstance,& + damageState + + implicit none + integer(pInt), intent(in) :: & + ipc, & !< component-ID of integration point + ip, & !< integration point + el !< element + real(pReal), dimension(damage_anisotropic_sizePostResults(phase_damageInstance(mappingConstitutive(2,ipc,ip,el)))) :: & + damage_anisotropic_postResults + + integer(pInt) :: & + instance, phase, constituent, o, c + + phase = mappingConstitutive(2,ipc,ip,el) + constituent = mappingConstitutive(1,ipc,ip,el) + instance = phase_damageInstance(phase) + + c = 0_pInt + damage_anisotropic_postResults = 0.0_pReal + + do o = 1_pInt,damage_anisotropic_Noutput(instance) + select case(damage_anisotropic_outputID(o,instance)) + case (local_damage_ID) + damage_anisotropic_postResults(c+1_pInt) = damageState(phase)%state(1,constituent) + c = c + 1 + + end select + enddo +end function damage_anisotropic_postResults + +end module damage_anisotropic diff --git a/code/material.f90 b/code/material.f90 index 7f24a17c5..4c5d803e7 100644 --- a/code/material.f90 +++ b/code/material.f90 @@ -31,6 +31,7 @@ module material LOCAL_DAMAGE_brittle_label = 'brittle', & LOCAL_DAMAGE_ductile_label = 'ductile', & LOCAL_DAMAGE_gurson_label = 'gurson', & + LOCAL_DAMAGE_anisotropic_label = 'anisotropic', & LOCAL_THERMAL_isothermal_label = 'isothermal', & LOCAL_THERMAL_adiabatic_label = 'adiabatic', & LOCAL_VACANCY_constant_label = 'constant', & @@ -65,7 +66,8 @@ module material enumerator :: LOCAL_DAMAGE_none_ID, & LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & - LOCAL_DAMAGE_gurson_ID + LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID end enum enum, bind(c) enumerator :: LOCAL_THERMAL_isothermal_ID, & @@ -238,6 +240,7 @@ module material LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_ductile_ID, & LOCAL_DAMAGE_gurson_ID, & + LOCAL_DAMAGE_anisotropic_ID, & LOCAL_THERMAL_isothermal_ID, & LOCAL_THERMAL_adiabatic_ID, & LOCAL_VACANCY_constant_ID, & @@ -849,6 +852,8 @@ subroutine material_parsePhase(fileUnit,myPart) phase_damage(section) = LOCAL_DAMAGE_DUCTILE_ID case (LOCAL_DAMAGE_gurson_label) phase_damage(section) = LOCAL_DAMAGE_gurson_ID + case (LOCAL_DAMAGE_anisotropic_label) + phase_damage(section) = LOCAL_DAMAGE_anisotropic_ID case default call IO_error(200_pInt,ext_msg=trim(IO_stringValue(line,positions,2_pInt))) end select