From 79f572f8694fdce17e037e40ffc22756caff3c32 Mon Sep 17 00:00:00 2001 From: Luv Sharma Date: Wed, 3 Sep 2014 17:12:06 +0000 Subject: [PATCH] more work on homogenisation new state and introduced field state --- code/Makefile | 17 +++-- code/constitutive_damage.f90 | 97 +++++++++++++++++++++--- code/constitutive_thermal.f90 | 92 +++++++++++++++++++---- code/damage_local.f90 | 31 +++++++- code/damage_none.f90 | 21 +++++- code/material.f90 | 138 +++++++++++++++++++++++++++++++--- code/prec.f90 | 5 ++ code/thermal_none.f90 | 23 +++++- 8 files changed, 375 insertions(+), 49 deletions(-) diff --git a/code/Makefile b/code/Makefile index 4c85d3b66..4c42689cf 100644 --- a/code/Makefile +++ b/code/Makefile @@ -353,10 +353,20 @@ PRECISION_gfortran :=-fdefault-real-8 -fdefault-double-8 -DFLOAT=8 -DINT=4 COMPILE =$(OPENMP_FLAG_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(OPTI)_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) -DSpectral ################################################################################################### +ifeq "$(STATE)" "NEWH" +DAMAGE_FILES = \ + damage_none.o damage_local.o +else DAMAGE_FILES = \ damage_none.o damage_local.o damage_gradient.o +endif +ifeq "$(STATE)" "NEWH" +THERMAL_FILES = \ + thermal_none.o +else THERMAL_FILES = \ thermal_none.o thermal_conduction.o +endif CONSTITUTIVE_FILES = \ constitutive_dislotwin.o constitutive_dislokmc.o constitutive_j2.o constitutive_phenopowerlaw.o \ constitutive_titanmod.o constitutive_nonlocal.o constitutive_none.o \ @@ -502,9 +512,7 @@ constitutive_none.o: constitutive_none.f90 \ lattice.o constitutive_damage.o: constitutive_damage.f90 \ - damage_none.o \ - damage_local.o \ - damage_gradient.o + $(DAMAGE_FILES) damage_none.o: damage_none.f90 \ lattice.o @@ -516,8 +524,7 @@ damage_gradient.o: damage_gradient.f90 \ lattice.o constitutive_thermal.o: constitutive_thermal.f90 \ - thermal_none.o \ - thermal_conduction.o + $(THERMAL_FILES) thermal_none.o: thermal_none.f90 \ lattice.o diff --git a/code/constitutive_damage.f90 b/code/constitutive_damage.f90 index d55c65bf1..7d7b89490 100644 --- a/code/constitutive_damage.f90 +++ b/code/constitutive_damage.f90 @@ -2,6 +2,7 @@ ! $Id: constitutive_damage.f90 3205 2014-06-17 06:54:49Z MPIE\m.diehl $ !-------------------------------------------------------------------------------------------------- !> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH +!> @author Luv Sharma, Max-Planck-Institut für Eisenforschung GmbH !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @brief damage internal microstructure state !-------------------------------------------------------------------------------------------------- @@ -55,15 +56,24 @@ subroutine constitutive_damage_init homogenization_Ngrains, & homogenization_maxNgrains, & damageState, & +#ifdef NEWSTATE + LOCAL_DAMAGE_NONE_ID, & + LOCAL_DAMAGE_NONE_label, & + LOCAL_DAMAGE_BRITTLE_ID, & + LOCAL_DAMAGE_BRITTLE_label +#else DAMAGE_none_ID, & DAMAGE_NONE_label, & DAMAGE_local_ID, & DAMAGE_LOCAL_label, & DAMAGE_gradient_ID, & DAMAGE_GRADIENT_label +#endif use damage_none use damage_local +#ifndef NEWSTATE use damage_gradient +#endif implicit none integer(pInt), parameter :: FILEUNIT = 200_pInt @@ -81,9 +91,14 @@ use damage_gradient ! parse plasticities from config file if (.not. IO_open_jobFile_stat(FILEUNIT,material_localFileExt)) & ! no local material configuration present... call IO_open_file(FILEUNIT,material_configFile) ! ... open material.config file +#ifdef NEWSTATE + if (any(phase_damage == LOCAL_DAMAGE_NONE_ID)) call damage_none_init(FILEUNIT) + if (any(phase_damage == LOCAL_DAMAGE_BRITTLE_ID)) call damage_local_init(FILEUNIT) +#else if (any(phase_damage == DAMAGE_none_ID)) call damage_none_init(FILEUNIT) if (any(phase_damage == DAMAGE_local_ID)) call damage_local_init(FILEUNIT) if (any(phase_damage == DAMAGE_gradient_ID)) call damage_gradient_init(FILEUNIT) +#endif close(FILEUNIT) write(6,'(/,a)') ' <<<+- constitutive_damage init -+>>>' @@ -98,25 +113,41 @@ use damage_gradient instance = phase_damageInstance(ph) ! which instance of a plasticity is present phase knownDamage = .true. select case(phase_damage(ph)) ! split per constititution +#ifdef NEWSTATE + case (LOCAL_DAMAGE_none_ID) + outputName = LOCAL_DAMAGE_NONE_label +#else case (DAMAGE_none_ID) outputName = DAMAGE_NONE_label +#endif thisOutput => null() thisSize => null() +#ifdef NEWSTATE + case (LOCAL_DAMAGE_BRITTLE_ID) + outputName = LOCAL_DAMAGE_BRITTLE_label +#else case (DAMAGE_local_ID) outputName = DAMAGE_LOCAL_label +#endif thisOutput => damage_local_output thisSize => damage_local_sizePostResult +#ifndef NEWSTATE case (DAMAGE_gradient_ID) outputName = DAMAGE_GRADIENT_label thisOutput => damage_gradient_output thisSize => damage_gradient_sizePostResult +#endif case default knownDamage = .false. end select write(FILEUNIT,'(/,a,/)') '['//trim(phase_name(ph))//']' if (knownDamage) then write(FILEUNIT,'(a)') '(damage)'//char(9)//trim(outputName) +#ifdef NEWSTATE + if (phase_damage(ph) /= LOCAL_DAMAGE_none_ID) then +#else if (phase_damage(ph) /= DAMAGE_none_ID) then +#endif do e = 1_pInt,phase_Noutput(ph) write(FILEUNIT,'(a,i4)') trim(thisOutput(e,instance))//char(9),thisSize(e,instance) enddo @@ -143,10 +174,14 @@ end subroutine constitutive_damage_init subroutine constitutive_damage_microstructure(Tstar_v, Fe, ipc, ip, el) use material, only: & material_phase, & - phase_damage, & - DAMAGE_gradient_ID +#ifndef NEWSTATE + DAMAGE_gradient_ID, & +#endif + phase_damage +#ifndef NEWSTATE use damage_gradient, only: & damage_gradient_microstructure +#endif implicit none integer(pInt), intent(in) :: & @@ -159,8 +194,10 @@ subroutine constitutive_damage_microstructure(Tstar_v, Fe, ipc, ip, el) Fe select case (phase_damage(material_phase(ipc,ip,el))) +#ifndef NEWSTATE case (DAMAGE_gradient_ID) call damage_gradient_microstructure(Tstar_v, Fe, ipc, ip, el) +#endif end select @@ -173,11 +210,18 @@ end subroutine constitutive_damage_microstructure subroutine constitutive_damage_collectDotState(Tstar_v, Fe, Lp, ipc, ip, el) use material, only: & material_phase, & - phase_damage, & +#ifdef NEWSTATE + LOCAL_DAMAGE_BRITTLE_ID, & +#else DAMAGE_local_ID, & - DAMAGE_gradient_ID + DAMAGE_gradient_ID, & +#endif + phase_damage + +#ifndef NEWSTATE use damage_gradient, only: & damage_gradient_dotState +#endif use damage_local, only: & damage_local_dotState @@ -193,11 +237,15 @@ subroutine constitutive_damage_collectDotState(Tstar_v, Fe, Lp, ipc, ip, el) Fe select case (phase_damage(material_phase(ipc,ip,el))) +#ifdef NEWSTATE + case (LOCAL_DAMAGE_BRITTLE_ID) + call damage_local_dotState(Tstar_v, Fe, Lp, ipc, ip, el) +#else case (DAMAGE_local_ID) call damage_local_dotState(Tstar_v, Fe, Lp, ipc, ip, el) - case (DAMAGE_gradient_ID) call damage_gradient_dotState(Tstar_v, Fe, Lp, ipc, ip, el) +#endif end select @@ -209,14 +257,22 @@ end subroutine constitutive_damage_collectDotState function constitutive_damageValue(ipc, ip, el) use material, only: & material_phase, & - phase_damage, & +#ifdef NEWSTATE + LOCAL_DAMAGE_none_ID, & + LOCAL_DAMAGE_BRITTLE_ID, & +#else DAMAGE_none_ID, & DAMAGE_local_ID, & - DAMAGE_gradient_ID + DAMAGE_gradient_ID, & +#endif + phase_damage + use damage_local, only: & damage_local_damageValue +#ifndef NEWSTATE use damage_gradient, only: & damage_gradient_damageValue +#endif implicit none integer(pInt), intent(in) :: & @@ -226,14 +282,23 @@ function constitutive_damageValue(ipc, ip, el) real(pReal) :: constitutive_damageValue select case (phase_damage(material_phase(ipc,ip,el))) +#ifdef NEWSTATE + case (LOCAL_DAMAGE_none_ID) + constitutive_damageValue = 1.0_pReal + + case (LOCAL_DAMAGE_BRITTLE_ID) + constitutive_damageValue = damage_local_damageValue(ipc, ip, el) + +#else case (DAMAGE_none_ID) constitutive_damageValue = 1.0_pReal - + case (DAMAGE_local_ID) constitutive_damageValue = damage_local_damageValue(ipc, ip, el) case (DAMAGE_gradient_ID) constitutive_damageValue = damage_gradient_damageValue(ipc, ip, el) +#endif end select @@ -246,13 +311,19 @@ function constitutive_damage_postResults(ipc, ip, el) use material, only: & damageState, & material_phase, & - phase_damage, & +#ifdef NEWSTATE + LOCAL_DAMAGE_BRITTLE_ID, & +#else DAMAGE_local_ID, & - DAMAGE_gradient_ID + DAMAGE_gradient_ID, & +#endif + phase_damage use damage_local, only: & damage_local_postResults +#ifndef NEWSTATE use damage_gradient, only: & damage_gradient_postResults +#endif implicit none integer(pInt), intent(in) :: & @@ -265,11 +336,15 @@ function constitutive_damage_postResults(ipc, ip, el) constitutive_damage_postResults = 0.0_pReal select case (phase_damage(material_phase(ipc,ip,el))) +#ifdef NEWSTATE + case (LOCAL_DAMAGE_BRITTLE_ID) + constitutive_damage_postResults = damage_local_postResults(ipc, ip, el) +#else case (DAMAGE_local_ID) constitutive_damage_postResults = damage_local_postResults(ipc, ip, el) - case (DAMAGE_gradient_ID) constitutive_damage_postResults = damage_gradient_postResults(ipc,ip,el) +#endif end select end function constitutive_damage_postResults diff --git a/code/constitutive_thermal.f90 b/code/constitutive_thermal.f90 index 912e3316a..ed599ddb2 100644 --- a/code/constitutive_thermal.f90 +++ b/code/constitutive_thermal.f90 @@ -51,15 +51,24 @@ subroutine constitutive_thermal_init phase_thermal, & phase_thermalInstance, & phase_Noutput, & - homogenization_Ngrains, & - homogenization_maxNgrains, & - thermalState, & +#ifdef NEWSTATE + LOCAL_THERMAL_none_ID, & + LOCAL_THERMAL_none_label, & + LOCAL_THERMAL_heatgen_ID, & + LOCAL_THERMAL_heatgen_label, & +#else THERMAL_none_ID, & THERMAL_NONE_label, & THERMAL_conduction_ID, & - THERMAL_CONDUCTION_label + THERMAL_CONDUCTION_label, & +#endif + homogenization_Ngrains, & + homogenization_maxNgrains, & + thermalState use thermal_none +#ifndef NEWSTATE use thermal_conduction +#endif implicit none integer(pInt), parameter :: FILEUNIT = 200_pInt @@ -77,8 +86,13 @@ subroutine constitutive_thermal_init ! parse from config file if (.not. IO_open_jobFile_stat(FILEUNIT,material_localFileExt)) & ! no local material configuration present... call IO_open_file(FILEUNIT,material_configFile) ! ... open material.config file +#ifdef NEWSTATE + if (any(phase_thermal == LOCAL_THERMAL_none_ID)) call thermal_none_init(FILEUNIT) +! if (any(phase_thermal == LOCAL_THERMAL_HEATGEN_ID)) call thermal_heatgen_init(FILEUNIT) +#else if (any(phase_thermal == THERMAL_none_ID)) call thermal_none_init(FILEUNIT) if (any(phase_thermal == THERMAL_conduction_ID)) call thermal_conduction_init(FILEUNIT) +#endif close(FILEUNIT) write(6,'(/,a)') ' <<<+- constitutive_thermal init -+>>>' @@ -93,6 +107,16 @@ subroutine constitutive_thermal_init instance = phase_thermalInstance(ph) ! which instance is present phase knownThermal = .true. select case(phase_thermal(ph)) ! split per constititution +#ifdef NEWSTATE + case (LOCAL_THERMAL_none_ID) + outputName = LOCAL_THERMAL_NONE_label + thisOutput => null() + thisSize => null() + case (LOCAL_THERMAL_heatgen_ID) + outputName = LOCAL_THERMAL_HEATGEN_label + thisOutput => null() + thisSize => null() +#else case (THERMAL_none_ID) outputName = THERMAL_NONE_label thisOutput => null() @@ -101,13 +125,18 @@ subroutine constitutive_thermal_init outputName = THERMAL_CONDUCTION_label thisOutput => thermal_conduction_output thisSize => thermal_conduction_sizePostResult +#endif case default knownThermal = .false. end select write(FILEUNIT,'(/,a,/)') '['//trim(phase_name(ph))//']' if (knownThermal) then write(FILEUNIT,'(a)') '(thermal)'//char(9)//trim(outputName) +#ifdef NEWSTATE + if (phase_thermal(ph) /= LOCAL_THERMAL_none_ID) then +#else if (phase_thermal(ph) /= THERMAL_none_ID) then +#endif do e = 1_pInt,phase_Noutput(ph) write(FILEUNIT,'(a,i4)') trim(thisOutput(e,instance))//char(9),thisSize(e,instance) enddo @@ -135,10 +164,14 @@ end subroutine constitutive_thermal_init subroutine constitutive_thermal_microstructure(Tstar_v, Lp, ipc, ip, el) use material, only: & material_phase, & - phase_thermal, & - THERMAL_conduction_ID +#ifndef NEWSTATE + THERMAL_conduction_ID, & +#endif + phase_thermal +#ifndef NEWSTATE use thermal_conduction, only: & thermal_conduction_microstructure +#endif implicit none integer(pInt), intent(in) :: & @@ -151,8 +184,10 @@ subroutine constitutive_thermal_microstructure(Tstar_v, Lp, ipc, ip, el) Lp select case (phase_thermal(material_phase(ipc,ip,el))) +#ifndef NEWSTATE case (THERMAL_conduction_ID) call thermal_conduction_microstructure(Tstar_v, Lp, ipc, ip, el) +#endif end select end subroutine constitutive_thermal_microstructure @@ -164,8 +199,15 @@ end subroutine constitutive_thermal_microstructure subroutine constitutive_thermal_collectDotState(Tstar_v, Lp, ipc, ip, el) use material, only: & material_phase, & - phase_thermal, & - THERMAL_adiabatic_ID +#ifdef NEWSTATE + LOCAL_THERMAL_none_ID, & + LOCAL_THERMAL_HEATGEN_ID, & +#else + THERMAL_none_ID, & + THERMAL_adiabatic_ID, & + THERMAL_conduction_ID, & +#endif + phase_thermal ! use thermal_conduction, only: & ! thermal_adiabatic_microstructure @@ -180,7 +222,11 @@ subroutine constitutive_thermal_collectDotState(Tstar_v, Lp, ipc, ip, el) Lp select case (phase_thermal(material_phase(ipc,ip,el))) +#ifdef NEWSTATE + case (LOCAL_THERMAL_HEATGEN_ID) +#else case (THERMAL_adiabatic_ID) +#endif ! call thermal_adiabatic_dotState(Tstar_v, Lp, ipc, ip, el) end select @@ -192,14 +238,21 @@ end subroutine constitutive_thermal_collectDotState function constitutive_temperature(ipc, ip, el) use material, only: & material_phase, & - phase_thermal, & +#ifdef NEWSTATE + LOCAL_THERMAL_none_ID, & + LOCAL_THERMAL_HEATGEN_ID, & +#else THERMAL_none_ID, & THERMAL_adiabatic_ID, & - THERMAL_conduction_ID + THERMAL_conduction_ID, & +#endif + phase_thermal use lattice, only: & lattice_referenceTemperature +#ifndef NEWSTATE use thermal_conduction, only: & thermal_conduction_temperature +#endif ! use thermal_adiabatic, only: & ! thermal_adiabatic_temperature @@ -211,6 +264,13 @@ function constitutive_temperature(ipc, ip, el) real(pReal) :: constitutive_temperature select case (phase_thermal(material_phase(ipc,ip,el))) +#ifdef NEWSTATE + case (LOCAL_THERMAL_none_ID) + constitutive_temperature = lattice_referenceTemperature(material_phase(ipc,ip,el)) + + case (LOCAL_THERMAL_HEATGEN_ID) + !constitutive_temperature = thermal_heatgen_temperature(ipc, ip, el) +#else case (THERMAL_none_ID) constitutive_temperature = lattice_referenceTemperature(material_phase(ipc,ip,el)) @@ -219,7 +279,7 @@ function constitutive_temperature(ipc, ip, el) case (THERMAL_conduction_ID) constitutive_temperature = thermal_conduction_temperature(ipc, ip, el) - +#endif end select end function constitutive_temperature @@ -231,10 +291,14 @@ function constitutive_thermal_postResults(ipc, ip, el) use material, only: & thermalState, & material_phase, & - phase_thermal, & - THERMAL_conduction_ID +#ifndef NEWSTATE + THERMAL_conduction_ID, & +#endif + phase_thermal +#ifndef NEWSTATE use thermal_conduction, only: & thermal_conduction_postResults +#endif implicit none integer(pInt), intent(in) :: & @@ -247,8 +311,10 @@ function constitutive_thermal_postResults(ipc, ip, el) constitutive_thermal_postResults = 0.0_pReal select case (phase_thermal(material_phase(ipc,ip,el))) +#ifndef NEWSTATE case (THERMAL_conduction_ID) constitutive_thermal_postResults = thermal_conduction_postResults(ipc,ip,el) +#endif end select end function constitutive_thermal_postResults diff --git a/code/damage_local.f90 b/code/damage_local.f90 index 33fb5f03b..7579b3fa9 100644 --- a/code/damage_local.f90 +++ b/code/damage_local.f90 @@ -32,7 +32,8 @@ module damage_local enum, bind(c) enumerator :: undefined_ID, & local_damage_ID - end enum + end enum !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11 ToDo + integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & damage_local_outputID !< ID of each post result output @@ -79,8 +80,13 @@ subroutine damage_local_init(fileUnit) phase_damage, & phase_damageInstance, & phase_Noutput, & +#ifdef NEWSTATE + LOCAL_DAMAGE_BRITTLE_label, & + LOCAL_DAMAGE_BRITTLE_ID, & +#else DAMAGE_LOCAL_label, & DAMAGE_local_ID, & +#endif material_phase, & damageState, & MATERIAL_partPhase @@ -98,13 +104,20 @@ subroutine damage_local_init(fileUnit) character(len=65536) :: & tag = '', & line = '' - +#ifdef NEWSTATE + write(6,'(/,a)') ' <<<+- damage_'//LOCAL_DAMAGE_BRITTLE_label//' init -+>>>' +#else write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_LOCAL_label//' init -+>>>' +#endif write(6,'(a)') ' $Id: damage_local.f90 3210 2014-06-17 15:24:44Z MPIE\m.diehl $' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" +#ifdef NEWSTATE + maxNinstance = int(count(phase_damage == LOCAL_DAMAGE_BRITTLE_ID),pInt) +#else maxNinstance = int(count(phase_damage == DAMAGE_local_ID),pInt) +#endif if (maxNinstance == 0_pInt) return if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & @@ -136,14 +149,22 @@ subroutine damage_local_init(fileUnit) phase = phase + 1_pInt ! advance phase section counter cycle ! skip to next line endif - if (phase > 0_pInt ) then; if (phase_damage(phase) == DAMAGE_local_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran +#ifdef NEWSTATE + if (phase > 0_pInt ) then; if (phase_damage(phase) == LOCAL_DAMAGE_BRITTLE_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran +#else + if (phase > 0_pInt ) then; if (phase_damage(phase) == DAMAGE_local_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran +#endif 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))) +#ifdef NEWSTATE + case ('local_damage_brittle') +#else case ('local_damage') +#endif damage_local_Noutput(instance) = damage_local_Noutput(instance) + 1_pInt damage_local_outputID(damage_local_Noutput(instance),instance) = local_damage_ID damage_local_output(damage_local_Noutput(instance),instance) = & @@ -161,7 +182,11 @@ subroutine damage_local_init(fileUnit) enddo parsingFile initializeInstances: do phase = 1_pInt, size(phase_damage) +#ifdef NEWSTATE + if (phase_damage(phase) == LOCAL_DAMAGE_BRITTLE_ID) then +#else if (phase_damage(phase) == DAMAGE_local_ID) then +#endif NofMyPhase=count(material_phase==phase) instance = phase_damageInstance(phase) diff --git a/code/damage_none.f90 b/code/damage_none.f90 index 37320cd50..9946d0b25 100644 --- a/code/damage_none.f90 +++ b/code/damage_none.f90 @@ -40,10 +40,15 @@ subroutine damage_none_init(fileUnit) use material, only: & phase_damage, & phase_Noutput, & +#ifdef NEWSTATE + LOCAL_DAMAGE_NONE_label, & + LOCAL_DAMAGE_NONE_ID, & +#else DAMAGE_NONE_label, & + DAMAGE_NONE_ID, & +#endif material_phase, & damageState, & - DAMAGE_NONE_ID, & MATERIAL_partPhase implicit none @@ -55,13 +60,19 @@ subroutine damage_none_init(fileUnit) NofMyPhase, & sizeState, & sizeDotState - +#ifdef NEWSTATE + write(6,'(/,a)') ' <<<+- damage_'//LOCAL_DAMAGE_NONE_label//' init -+>>>' +#else write(6,'(/,a)') ' <<<+- damage_'//DAMAGE_NONE_label//' init -+>>>' +#endif write(6,'(a)') ' $Id: damage_none.f90 3148 2014-05-27 14:46:03Z MPIE\m.diehl $' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - +#ifdef NEWSTATE + maxNinstance = int(count(phase_damage == LOCAL_DAMAGE_NONE_ID),pInt) +#else maxNinstance = int(count(phase_damage == DAMAGE_NONE_ID),pInt) +#endif if (maxNinstance == 0_pInt) return if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & @@ -69,7 +80,11 @@ subroutine damage_none_init(fileUnit) initializeInstances: do phase = 1_pInt, size(phase_damage) NofMyPhase=count(material_phase==phase) +#ifdef NEWSTATE + if (phase_damage(phase) == LOCAL_DAMAGE_none_ID) then +#else if (phase_damage(phase) == DAMAGE_none_ID) then +#endif sizeState = 0_pInt damageState(phase)%sizeState = sizeState sizeDotState = sizeState diff --git a/code/material.f90 b/code/material.f90 index c2e8d5604..a8d5f90b9 100644 --- a/code/material.f90 +++ b/code/material.f90 @@ -15,6 +15,7 @@ module material tState, & #ifdef NEWSTATE hState, & + fState, & #endif p_intvec @@ -29,6 +30,22 @@ module material PLASTICITY_DISLOKMC_label = 'dislokmc', & PLASTICITY_TITANMOD_label = 'titanmod', & PLASTICITY_NONLOCAL_label = 'nonlocal', & +#ifdef NEWSTATE + LOCAL_DAMAGE_NONE_label = 'none', & + LOCAL_DAMAGE_BRITTLE_label = 'brittle', & + + LOCAL_THERMAL_NONE_label = 'none', & + LOCAL_THERMAL_HEATGEN_label = 'heatgen', & + + FIELD_DAMAGE_NONE_label = 'none', & + FIELD_DAMAGE_LOCAL_label = 'local', & + FIELD_DAMAGE_NONLOCAL_label = 'nonlocal', & + + FIELD_THERMAL_NONE_label = 'none', & + FIELD_THERMAL_ADIABATIC_label = 'adiabatic', & + FIELD_THERMAL_CONDUCTION_label = 'conduction', & + +#else DAMAGE_NONE_label = 'none', & DAMAGE_LOCAL_label = 'local', & DAMAGE_GRADIENT_label = 'gradient', & @@ -36,9 +53,12 @@ module material THERMAL_ISO_label = 'isothermal', & THERMAL_CONDUCTION_label = 'conduction', & THERMAL_ADIABATIC_label = 'adiabatic', & +#endif HOMOGENIZATION_NONE_label = 'none', & HOMOGENIZATION_ISOSTRAIN_label = 'isostrain', & - HOMOGENIZATION_RGC_label = 'rgc' + HOMOGENIZATION_RGC_label = 'rgc' + + enum, bind(c) enumerator :: ELASTICITY_undefined_ID, & @@ -54,6 +74,27 @@ module material PLASTICITY_titanmod_ID, & PLASTICITY_nonlocal_ID end enum +#ifdef NEWSTATE + enum, bind(c) + enumerator :: LOCAL_DAMAGE_NONE_ID, & + LOCAL_DAMAGE_BRITTLE_ID + end enum + enum, bind(c) + enumerator :: LOCAL_THERMAL_NONE_ID, & + LOCAL_THERMAL_HEATGEN_ID + end enum + enum, bind(c) + enumerator :: FIELD_DAMAGE_NONE_ID, & + FIELD_DAMAGE_LOCAL_ID ,& + FIELD_DAMAGE_NONLOCAL_ID + + end enum + enum, bind(c) + enumerator :: FIELD_THERMAL_NONE_ID, & + FIELD_THERMAL_ADIABATIC_ID, & + FIELD_THERMAL_CONDUCTION_ID + end enum +#else enum, bind(c) enumerator :: DAMAGE_none_ID, & DAMAGE_local_ID, & @@ -65,6 +106,7 @@ module material THERMAL_conduction_ID, & THERMAL_adiabatic_ID end enum +#endif enum, bind(c) enumerator :: HOMOGENIZATION_undefined_ID, & HOMOGENIZATION_none_ID, & @@ -85,10 +127,21 @@ module material phase_elasticity !< elasticity of each phase integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable, public, protected :: & phase_plasticity !< plasticity of each phase +#ifdef NEWSTATE + integer(kind(LOCAL_DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & + phase_damage !< local damage of each phase + integer(kind(LOCAL_THERMAL_none_ID)), dimension(:), allocatable, public, protected :: & + phase_thermal !< local thermal of each phase + integer(kind(FIELD_DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & + field_damage_type !< field damage of each phase + integer(kind(FIELD_THERMAL_none_ID)), dimension(:), allocatable, public, protected :: & + field_thermal_type !< field thermal of each phase +#else integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & phase_damage !< damage of each phase integer(kind(THERMAL_none_ID)), dimension(:), allocatable, public, protected :: & phase_thermal !< thermal of each phase +#endif integer(kind(HOMOGENIZATION_undefined_ID)), dimension(:), allocatable, public, protected :: & homogenization_type !< type of each homogenization @@ -130,6 +183,10 @@ module material #ifdef NEWSTATE type(hState), allocatable, dimension(:), public :: & homogState + type(fState), allocatable, dimension(:), public :: & + fieldDamage + type(fState), allocatable, dimension(:), public :: & + fieldThermal #endif @@ -206,6 +263,12 @@ module material PLASTICITY_dislokmc_ID, & PLASTICITY_titanmod_ID, & PLASTICITY_nonlocal_ID, & +#ifdef NEWSTATE + LOCAL_DAMAGE_none_ID, & + LOCAL_DAMAGE_brittle_ID, & + LOCAL_THERMAL_none_ID, & + LOCAL_THERMAL_heatgen_ID, & +#else DAMAGE_none_ID, & DAMAGE_local_ID, & DAMAGE_gradient_ID, & @@ -213,6 +276,7 @@ module material THERMAL_iso_ID, & THERMAL_conduction_ID, & THERMAL_adiabatic_ID, & +#endif HOMOGENIZATION_none_ID, & HOMOGENIZATION_isostrain_ID, & #ifdef HDF @@ -237,7 +301,7 @@ contains !> material.config !-------------------------------------------------------------------------------------------------- subroutine material_init - use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) use IO, only: & IO_error, & IO_open_file, & @@ -257,7 +321,7 @@ subroutine material_init implicit none integer(pInt), parameter :: FILEUNIT = 200_pInt - integer(pInt) :: m,c,h, myDebug, myHomogInstance + integer(pInt) :: m,c,h, myDebug, myHomog integer(pInt) :: & g, & !< grain number i, & !< integration point number @@ -288,7 +352,9 @@ subroutine material_init allocate(damageState (material_Nphase)) allocate(thermalState(material_Nphase)) #ifdef NEWSTATE - allocate(homogState(material_Nhomogenization)) + allocate(homogState (material_Nhomogenization)) + allocate(fieldDamage (material_Nhomogenization)) + allocate(fieldThermal(material_Nhomogenization)) #endif do m = 1_pInt,material_Nmicrostructure if(microstructure_crystallite(m) < 1_pInt .or. & @@ -339,11 +405,11 @@ subroutine material_init #endif allocate(CrystallitePosition(material_Nphase),source=0_pInt) ElemLoop:do e = 1_pInt,mesh_NcpElems ! loop over elements - myHomogInstance = homogenization_typeInstance(mesh_element(3,e)) + myHomog = mesh_element(3,e) IPloop:do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) ! loop over IPs #ifdef NEWSTATE - HomogenizationPosition(myHomogInstance) = HomogenizationPosition(myHomogInstance)+1_pInt - mappingHomogenization(1:2,i,e) = [HomogenizationPosition(myHomogInstance),myHomogInstance] + HomogenizationPosition(myHomog) = HomogenizationPosition(myHomog) + 1_pInt + mappingHomogenization(1:2,i,e) = [HomogenizationPosition(myHomog),myHomog] #endif GrainLoop:do g = 1_pInt,homogenization_Ngrains(mesh_element(3,e)) ! loop over grains phase = material_phase(g,i,e) @@ -395,10 +461,14 @@ subroutine material_parseHomogenization(fileUnit,myPart) allocate(homogenization_name(Nsections)); homogenization_name = '' allocate(homogenization_type(Nsections), source=HOMOGENIZATION_undefined_ID) +#ifdef NEWSTATE + allocate(FIELD_DAMAGE_type(Nsections), source=FIELD_DAMAGE_none_ID) + allocate(FIELD_THERMAL_type(Nsections), source=FIELD_THERMAL_none_ID) +#endif allocate(homogenization_typeInstance(Nsections), source=0_pInt) allocate(homogenization_Ngrains(Nsections), source=0_pInt) allocate(homogenization_Noutput(Nsections), source=0_pInt) - allocate(homogenization_active(Nsections), source=.false.) + allocate(homogenization_active(Nsections), source=.false.) !!!!!!!!!!!!!!! forall (s = 1_pInt:Nsections) homogenization_active(s) = any(mesh_element(3,:) == s) ! current homogenization used in model? Homogenization view, maximum operations depend on maximum number of homog schemes homogenization_Noutput = IO_countTagInPart(fileUnit,myPart,'(output)',Nsections) @@ -441,6 +511,32 @@ subroutine material_parseHomogenization(fileUnit,myPart) end select homogenization_typeInstance(section) = & count(homogenization_type==homogenization_type(section)) ! count instances +#ifdef NEWSTATE + case ('field_damage') + select case (IO_lc(IO_stringValue(line,positions,2_pInt))) + case(FIELD_DAMAGE_NONE_label) + FIELD_DAMAGE_type(section) = FIELD_DAMAGE_NONE_ID + case(FIELD_DAMAGE_LOCAL_label) + FIELD_DAMAGE_type(section) = FIELD_DAMAGE_LOCAL_ID + case(FIELD_DAMAGE_NONLOCAL_label) + FIELD_DAMAGE_type(section) = FIELD_DAMAGE_NONLOCAL_ID + case default + call IO_error(500_pInt,ext_msg=trim(IO_stringValue(line,positions,2_pInt))) + end select + + case ('field_thermal') + select case (IO_lc(IO_stringValue(line,positions,2_pInt))) + case(FIELD_THERMAL_NONE_label) + FIELD_THERMAL_type(section) = FIELD_THERMAL_NONE_ID + case(FIELD_THERMAL_ADIABATIC_label) + FIELD_THERMAL_type(section) = FIELD_THERMAL_ADIABATIC_ID + case(FIELD_THERMAL_CONDUCTION_label) + FIELD_THERMAL_type(section) = FIELD_THERMAL_CONDUCTION_ID + case default + call IO_error(500_pInt,ext_msg=trim(IO_stringValue(line,positions,2_pInt))) + end select +#endif + case ('nconstituents','ngrains') homogenization_Ngrains(section) = IO_intValue(line,positions,2_pInt) end select @@ -648,9 +744,17 @@ subroutine material_parsePhase(fileUnit,myPart) allocate(phase_elasticityInstance(Nsections), source=0_pInt) allocate(phase_plasticity(Nsections) , source=PLASTICITY_undefined_ID) allocate(phase_plasticityInstance(Nsections), source=0_pInt) +#ifdef NEWSTATE + allocate(phase_damage(Nsections) , source=LOCAL_DAMAGE_none_ID) +#else allocate(phase_damage(Nsections) , source=DAMAGE_none_ID) +#endif allocate(phase_damageInstance(Nsections), source=0_pInt) +#ifdef NEWSTATE + allocate(phase_thermal(Nsections) , source=LOCAL_THERMAL_none_ID) +#else allocate(phase_thermal(Nsections) , source=THERMAL_none_ID) +#endif allocate(phase_thermalInstance(Nsections), source=0_pInt) allocate(phase_Noutput(Nsections), source=0_pInt) allocate(phase_localPlasticity(Nsections), source=.false.) @@ -712,18 +816,31 @@ subroutine material_parsePhase(fileUnit,myPart) phase_plasticityInstance(section) = count(phase_plasticity(1:section) == phase_plasticity(section)) ! count instances case ('damage') select case (IO_lc(IO_stringValue(line,positions,2_pInt))) +#ifdef NEWSTATE + case (LOCAL_DAMAGE_NONE_label) + phase_damage(section) = LOCAL_DAMAGE_none_ID + case (LOCAL_DAMAGE_BRITTLE_label) + phase_damage(section) = LOCAL_DAMAGE_BRITTLE_ID +#else case (DAMAGE_NONE_label) phase_damage(section) = DAMAGE_none_ID case (DAMAGE_LOCAL_label) phase_damage(section) = DAMAGE_local_ID case (DAMAGE_GRADIENT_label) phase_damage(section) = DAMAGE_gradient_ID +#endif case default call IO_error(200_pInt,ext_msg=trim(IO_stringValue(line,positions,2_pInt))) end select phase_damageInstance(section) = count(phase_damage(1:section) == phase_damage(section)) ! count instances case ('thermal') select case (IO_lc(IO_stringValue(line,positions,2_pInt))) +#ifdef NEWSTATE + case (LOCAL_THERMAL_NONE_label) + phase_thermal(section) = LOCAL_THERMAL_none_ID + case (LOCAL_THERMAL_HEATGEN_label) + phase_thermal(section) = LOCAL_THERMAL_HEATGEN_ID +#else case (THERMAL_NONE_label) phase_thermal(section) = THERMAL_none_ID case (THERMAL_ISO_label) @@ -732,6 +849,7 @@ subroutine material_parsePhase(fileUnit,myPart) phase_thermal(section) = THERMAL_conduction_ID case (THERMAL_ADIABATIC_label) phase_thermal(section) = THERMAL_adiabatic_ID +#endif case default call IO_error(200_pInt,ext_msg=trim(IO_stringValue(line,positions,2_pInt))) end select @@ -992,9 +1110,7 @@ subroutine material_populateGrains ! populating homogenization schemes in each !-------------------------------------------------------------------------------------------------- do e = 1_pInt, mesh_NcpElems -! do i = 1_pInt:FE_Nips(FE_geomtype(mesh_element(2,e))) - material_homog(1_pInt:FE_Nips(FE_geomtype(mesh_element(2,e))),e)=homogenization_typeInstance(mesh_element(3,e)) -! enddo + material_homog(1_pInt:FE_Nips(FE_geomtype(mesh_element(2,e))),e) = mesh_element(3,e) enddo #endif diff --git a/code/prec.f90 b/code/prec.f90 index 4ce28177a..adbc56d04 100644 --- a/code/prec.f90 +++ b/code/prec.f90 @@ -84,6 +84,11 @@ module prec real(pReal), allocatable, dimension(:,:) :: state, & ! material points, state size state0, & subState0 + end type + type, public :: fState + integer(pInt) :: sizeState = 0_pInt , & + sizePostResults = 0_pInt + real(pReal), allocatable, dimension(:,:) :: state ! material points, state size end type #endif diff --git a/code/thermal_none.f90 b/code/thermal_none.f90 index 61b01c04f..d106a4188 100644 --- a/code/thermal_none.f90 +++ b/code/thermal_none.f90 @@ -40,10 +40,15 @@ subroutine thermal_none_init(fileUnit) use material, only: & phase_thermal, & phase_Noutput, & +#ifdef NEWSTATE + LOCAL_THERMAL_NONE_label, & + LOCAL_THERMAL_NONE_ID, & +#else THERMAL_NONE_label, & + THERMAL_NONE_ID, & +#endif material_phase, & thermalState, & - THERMAL_NONE_ID, & MATERIAL_partPhase implicit none @@ -55,13 +60,20 @@ subroutine thermal_none_init(fileUnit) NofMyPhase, & sizeState, & sizeDotState - +#ifdef NEWSTATE + write(6,'(/,a)') ' <<<+- thermal_'//LOCAL_THERMAL_NONE_label//' init -+>>>' +#else write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_NONE_label//' init -+>>>' +#endif write(6,'(a)') ' $Id: thermal_none.f90 3148 2014-05-27 14:46:03Z MPIE\m.diehl $' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - + +#ifdef NEWSTATE + maxNinstance = int(count(phase_thermal == LOCAL_THERMAL_NONE_ID),pInt) +#else maxNinstance = int(count(phase_thermal == THERMAL_NONE_ID),pInt) +#endif if (maxNinstance == 0_pInt) return if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & @@ -69,7 +81,12 @@ subroutine thermal_none_init(fileUnit) initializeInstances: do phase = 1_pInt, size(phase_thermal) NofMyPhase=count(material_phase==phase) + +#ifdef NEWSTATE + if (phase_thermal(phase) == LOCAL_THERMAL_none_ID) then +#else if (phase_thermal(phase) == THERMAL_none_ID) then +#endif sizeState = 0_pInt thermalState(phase)%sizeState = sizeState sizeDotState = sizeState