fixed calculation of post results size introduced with new state

This commit is contained in:
Martin Diehl 2014-07-03 13:17:29 +00:00
parent d5952138e3
commit 27d861decc
5 changed files with 82 additions and 132 deletions

View File

@ -29,7 +29,7 @@ endif
COMPILERNAME ?= $(F90) COMPILERNAME ?= $(F90)
INCLUDE_DIRS :=-I../lib INCLUDE_DIRS :=-I../lib
LIBRARIES :=-lfftw3 LIBRARIES :=-llapack -lfftw3
LIB_DIRS :=-L$(FFTW_ROOT)/lib LIB_DIRS :=-L$(FFTW_ROOT)/lib
RUN_PATH :=-Wl,-rpath,$(FFTW_ROOT)/lib RUN_PATH :=-Wl,-rpath,$(FFTW_ROOT)/lib
@ -372,7 +372,7 @@ endif
DAMASK_spectral.exe: DAMASK_spectral_driver.o DAMASK_spectral.exe: DAMASK_spectral_driver.o
$(PREFIX) $(COMPILERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \ $(PREFIX) $(COMPILERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \
-o DAMASK_spectral.exe DAMASK_spectral_driver.o \ -o DAMASK_spectral.exe DAMASK_spectral_driver.o \
$(COMPILED_FILES) $(LIBRARIES) $(LIB_DIRS) $(RUN_PATH) $(SUFFIX) $(COMPILED_FILES) $(LIB_DIRS) $(LIBRARIES) $(LIB_DIRS) $(RUN_PATH) $(SUFFIX)
DAMASK_spectral_driver.o: DAMASK_spectral_driver.f90 DAMASK_spectral_solverBasic.o $(PETSC_FILES) DAMASK_spectral_driver.o: DAMASK_spectral_driver.f90 DAMASK_spectral_solverBasic.o $(PETSC_FILES)
$(PREFIX) $(COMPILERNAME) $(COMPILE_MAXOPTI) -c DAMASK_spectral_driver.f90 $(SUFFIX) $(PREFIX) $(COMPILERNAME) $(COMPILE_MAXOPTI) -c DAMASK_spectral_driver.f90 $(SUFFIX)

View File

@ -11,8 +11,6 @@ module constitutive
implicit none implicit none
private private
integer(pInt), public, dimension(:,:,:), allocatable :: &
constitutive_sizePostResults !< size of postResults array per grain
integer(pInt), public, protected :: & integer(pInt), public, protected :: &
constitutive_maxSizePostResults, & constitutive_maxSizePostResults, &
constitutive_maxSizeDotState constitutive_maxSizeDotState
@ -104,17 +102,9 @@ subroutine constitutive_init
implicit none implicit none
integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt), parameter :: FILEUNIT = 200_pInt
integer(pInt) :: & integer(pInt) :: &
g, & !< grain number e, & !< maximum number of elements
i, & !< integration point number
e, & !< element number
cMax, & !< maximum number of grains
iMax, & !< maximum number of integration points
eMax, & !< maximum number of elements
phase, & phase, &
s, & instance
p, &
instance,&
myNgrains
integer(pInt), dimension(:,:), pointer :: thisSize integer(pInt), dimension(:,:), pointer :: thisSize
character(len=64), dimension(:,:), pointer :: thisOutput character(len=64), dimension(:,:), pointer :: thisOutput
@ -185,54 +175,41 @@ subroutine constitutive_init
enddo enddo
close(FILEUNIT) close(FILEUNIT)
!--------------------------------------------------------------------------------------------------
! allocation of states PhaseLoop:do phase = 1_pInt,material_Nphase ! loop over phases
cMax = homogenization_maxNgrains instance = phase_plasticityInstance(phase)
iMax = mesh_maxNips select case(phase_plasticity(phase))
eMax = mesh_NcpElems case (PLASTICITY_NONE_ID)
allocate(constitutive_sizePostResults(cMax,iMax,eMax), source=0_pInt) plasticState(phase)%sizePostResults = constitutive_none_sizePostResults(instance)
ElemLoop:do e = 1_pInt,mesh_NcpElems ! loop over elements case (PLASTICITY_J2_ID)
myNgrains = homogenization_Ngrains(mesh_element(3,e)) plasticState(phase)%sizePostResults = constitutive_j2_sizePostResults(instance)
IPloop:do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) ! loop over IPs case (PLASTICITY_PHENOPOWERLAW_ID)
GrainLoop:do g = 1_pInt,myNgrains ! loop over grains plasticState(phase)%sizePostResults = constitutive_none_sizePostResults(instance)
select case(phase_elasticity(material_phase(g,i,e))) case (PLASTICITY_DISLOTWIN_ID)
case default ! so far no output for elasticity plasticState(phase)%sizePostResults = constitutive_dislotwin_sizePostResults(instance)
end select case (PLASTICITY_TITANMOD_ID)
phase = material_phase(g,i,e) plasticState(phase)%sizePostResults = constitutive_titanmod_sizePostResults(instance)
instance = phase_plasticityInstance(phase) case (PLASTICITY_NONLOCAL_ID)
select case(phase_plasticity(material_phase(g,i,e))) nonlocalConstitutionPresent = .true.
case (PLASTICITY_NONE_ID) plasticState(phase)%nonlocal = .true.
constitutive_sizePostResults(g,i,e) = 0_pInt plasticState(phase)%sizePostResults = constitutive_nonlocal_sizePostResults(instance)
case (PLASTICITY_J2_ID) end select
constitutive_sizePostResults(g,i,e) = constitutive_j2_sizePostResults(instance)
case (PLASTICITY_PHENOPOWERLAW_ID) enddo PhaseLoop
constitutive_sizePostResults(g,i,e) = constitutive_phenopowerlaw_sizePostResults(instance)
case (PLASTICITY_DISLOTWIN_ID)
constitutive_sizePostResults(g,i,e) = constitutive_dislotwin_sizePostResults(instance)
case (PLASTICITY_TITANMOD_ID)
constitutive_sizePostResults(g,i,e) = constitutive_titanmod_sizePostResults(instance)
case (PLASTICITY_NONLOCAL_ID)
nonlocalConstitutionPresent = .true.
plasticState(mappingConstitutive(2,g,i,e))%nonlocal = .true.
if(myNgrains/=1_pInt) call IO_error(252_pInt, e,i,g)
constitutive_sizePostResults(g,i,e) = constitutive_nonlocal_sizePostResults(instance)
end select
enddo GrainLoop
enddo IPloop
enddo ElemLoop
if (nonlocalConstitutionPresent) & if (nonlocalConstitutionPresent) &
call constitutive_nonlocal_stateInit() call constitutive_nonlocal_stateInit()
do e = 1_pInt,mesh_NcpElems ! loop over elements
myNgrains = homogenization_Ngrains(mesh_element(3,e)) constitutive_maxSizeDotState = 0_pInt
forall(i = 1_pInt:FE_Nips(FE_geomtype(mesh_element(2,e))), g = 1_pInt:myNgrains) constitutive_maxSizePostResults = 0_pInt
plasticState(mappingConstitutive(2,g,i,e))%partionedState0(:,mappingConstitutive(1,g,i,e)) = &
plasticState(mappingConstitutive(2,g,i,e))%State0(:,mappingConstitutive(1,g,i,e)) ! need to be defined for first call of constitutive_microstructure in crystallite_init PhaseLoop2:do phase = 1_pInt,material_Nphase
plasticState(mappingConstitutive(2,g,i,e))%State(:,mappingConstitutive(1,g,i,e)) = & plasticState(phase)%partionedState0 = plasticState(phase)%State0
plasticState(mappingConstitutive(2,g,i,e))%State0(:,mappingConstitutive(1,g,i,e)) ! need to be defined for first call of constitutive_microstructure in crystallite_init plasticState(phase)%State = plasticState(phase)%State0
endforall constitutive_maxSizeDotState = max(constitutive_maxSizeDotState, plasticState(phase)%sizeDotState)
enddo constitutive_maxSizePostResults = max(constitutive_maxSizePostResults, plasticState(phase)%sizePostResults)
enddo PhaseLoop2
#ifdef HDF #ifdef HDF
call HDF5_mappingConstitutive(mappingConstitutive) call HDF5_mappingConstitutive(mappingConstitutive)
@ -276,12 +253,6 @@ subroutine constitutive_init
flush(6) flush(6)
#endif #endif
constitutive_maxSizePostResults = 0_pInt
constitutive_maxSizeDotState = 0_pInt
do p = 1, size(plasticState)
constitutive_maxSizeDotState = max(constitutive_maxSizeDotState, plasticState(p)%sizeDotState)
constitutive_maxSizePostResults = max(constitutive_maxSizePostResults, plasticState(p)%sizePostResults)
enddo
end subroutine constitutive_init end subroutine constitutive_init
@ -733,7 +704,7 @@ function constitutive_postResults(Tstar_v, FeArray, temperature, ipc, ip, el)
ipc, & !< grain number ipc, & !< grain number
ip, & !< integration point number ip, & !< integration point number
el !< element number el !< element number
real(pReal), dimension(constitutive_sizePostResults(ipc,ip,el)) :: & real(pReal), dimension(plasticState(mappingConstitutive(1,ipc,ip,el))%sizePostResults) :: &
constitutive_postResults constitutive_postResults
real(pReal), intent(in) :: & real(pReal), intent(in) :: &
temperature temperature

View File

@ -63,17 +63,9 @@ use damage_gradient
implicit none implicit none
integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt), parameter :: FILEUNIT = 200_pInt
integer(pInt) :: & integer(pInt) :: &
g, & !< grain number e, & !< grain number
i, & !< integration point number ph, &
e, & !< element number instance
cMax, & !< maximum number of grains
iMax, & !< maximum number of integration points
eMax, & !< maximum number of elements
phase, &
s, &
p, &
instance,&
myNgrains
integer(pInt), dimension(:,:), pointer :: thisSize integer(pInt), dimension(:,:), pointer :: thisSize
logical :: knownDamage logical :: knownDamage
@ -96,10 +88,10 @@ use damage_gradient
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! write description file for constitutive phase output ! write description file for constitutive phase output
call IO_write_jobFile(FILEUNIT,'outputDamage') call IO_write_jobFile(FILEUNIT,'outputDamage')
do phase = 1_pInt,material_Nphase do ph = 1_pInt,material_Nphase
instance = phase_damageInstance(phase) ! which instance of a plasticity is present phase instance = phase_damageInstance(ph) ! which instance of a plasticity is present phase
knownDamage = .true. knownDamage = .true.
select case(phase_damage(phase)) ! split per constititution select case(phase_damage(ph)) ! split per constititution
case (DAMAGE_none_ID) case (DAMAGE_none_ID)
outputName = DAMAGE_NONE_label outputName = DAMAGE_NONE_label
thisOutput => null() thisOutput => null()
@ -111,11 +103,11 @@ use damage_gradient
case default case default
knownDamage = .false. knownDamage = .false.
end select end select
write(FILEUNIT,'(/,a,/)') '['//trim(phase_name(phase))//']' write(FILEUNIT,'(/,a,/)') '['//trim(phase_name(ph))//']'
if (knownDamage) then if (knownDamage) then
write(FILEUNIT,'(a)') '(damage)'//char(9)//trim(outputName) write(FILEUNIT,'(a)') '(damage)'//char(9)//trim(outputName)
if (phase_damage(phase) /= DAMAGE_none_ID) then if (phase_damage(ph) /= DAMAGE_none_ID) then
do e = 1_pInt,phase_Noutput(phase) do e = 1_pInt,phase_Noutput(ph)
write(FILEUNIT,'(a,i4)') trim(thisOutput(e,instance))//char(9),thisSize(e,instance) write(FILEUNIT,'(a,i4)') trim(thisOutput(e,instance))//char(9),thisSize(e,instance)
enddo enddo
endif endif
@ -125,24 +117,22 @@ use damage_gradient
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocation of states ! allocation of states
PhaseLoop:do phase = 1_pInt,material_Nphase ! loop over phases
instance = phase_damageInstance(phase)
select case(phase_damage(phase))
case (DAMAGE_none_ID)
damageState(phase)%sizePostResults = damage_none_sizePostResults(instance)
case (DAMAGE_gradient_ID)
damageState(phase)%sizePostResults = damage_gradient_sizePostResults(instance)
end select
enddo PhaseLoop
constitutive_damage_maxSizePostResults = 0_pInt constitutive_damage_maxSizePostResults = 0_pInt
constitutive_damage_maxSizeDotState = 0_pInt constitutive_damage_maxSizeDotState = 0_pInt
do p = 1, size(damageState) PhaseLoop:do ph = 1_pInt,material_Nphase ! loop over phases
constitutive_damage_maxSizeDotState = max(constitutive_damage_maxSizeDotState, damageState(p)%sizeDotState) instance = phase_damageInstance(ph)
constitutive_damage_maxSizePostResults = max(constitutive_damage_maxSizePostResults, damageState(p)%sizePostResults) select case(phase_damage(ph))
enddo case (DAMAGE_none_ID)
damageState(ph)%sizePostResults = damage_none_sizePostResults(instance)
case (DAMAGE_gradient_ID)
damageState(ph)%sizePostResults = damage_gradient_sizePostResults(instance)
end select
constitutive_damage_maxSizeDotState = max(constitutive_damage_maxSizeDotState, damageState(ph)%sizeDotState)
constitutive_damage_maxSizePostResults = max(constitutive_damage_maxSizePostResults, damageState(ph)%sizePostResults)
enddo PhaseLoop
end subroutine constitutive_damage_init end subroutine constitutive_damage_init

View File

@ -63,17 +63,9 @@ subroutine constitutive_thermal_init
implicit none implicit none
integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt), parameter :: FILEUNIT = 200_pInt
integer(pInt) :: & integer(pInt) :: &
g, & !< grain number e, & !< grain number
i, & !< integration point number ph, & !< phase
e, & !< element number instance
cMax, & !< maximum number of grains
iMax, & !< maximum number of integration points
eMax, & !< maximum number of elements
phase, &
s, &
p, &
instance,&
myNgrains
integer(pInt), dimension(:,:), pointer :: thisSize integer(pInt), dimension(:,:), pointer :: thisSize
logical :: knownThermal logical :: knownThermal
@ -96,10 +88,10 @@ subroutine constitutive_thermal_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! write description file for constitutive phase output ! write description file for constitutive phase output
call IO_write_jobFile(FILEUNIT,'outputThermal') call IO_write_jobFile(FILEUNIT,'outputThermal')
do phase = 1_pInt,material_Nphase do ph = 1_pInt,material_Nphase
instance = phase_thermalInstance(phase) ! which instance is present phase instance = phase_thermalInstance(ph) ! which instance is present phase
knownThermal = .true. knownThermal = .true.
select case(phase_thermal(phase)) ! split per constititution select case(phase_thermal(ph)) ! split per constititution
case (THERMAL_none_ID) case (THERMAL_none_ID)
outputName = THERMAL_NONE_label outputName = THERMAL_NONE_label
thisOutput => null() thisOutput => null()
@ -111,11 +103,11 @@ subroutine constitutive_thermal_init
case default case default
knownThermal = .false. knownThermal = .false.
end select end select
write(FILEUNIT,'(/,a,/)') '['//trim(phase_name(phase))//']' write(FILEUNIT,'(/,a,/)') '['//trim(phase_name(ph))//']'
if (knownThermal) then if (knownThermal) then
write(FILEUNIT,'(a)') '(thermal)'//char(9)//trim(outputName) write(FILEUNIT,'(a)') '(thermal)'//char(9)//trim(outputName)
if (phase_thermal(phase) /= THERMAL_none_ID) then if (phase_thermal(ph) /= THERMAL_none_ID) then
do e = 1_pInt,phase_Noutput(phase) do e = 1_pInt,phase_Noutput(ph)
write(FILEUNIT,'(a,i4)') trim(thisOutput(e,instance))//char(9),thisSize(e,instance) write(FILEUNIT,'(a,i4)') trim(thisOutput(e,instance))//char(9),thisSize(e,instance)
enddo enddo
endif endif
@ -125,24 +117,22 @@ subroutine constitutive_thermal_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocation of states ! allocation of states
PhaseLoop:do phase = 1_pInt,material_Nphase ! loop over phases
instance = phase_thermalInstance(phase)
select case(phase_thermal(phase))
case (THERMAL_none_ID)
thermalState(phase)%sizePostResults = thermal_none_sizePostResults(instance)
case (THERMAL_conduction_ID)
thermalState(phase)%sizePostResults = thermal_conduction_sizePostResults(instance)
end select
enddo PhaseLoop
constitutive_thermal_maxSizePostResults = 0_pInt constitutive_thermal_maxSizePostResults = 0_pInt
constitutive_thermal_maxSizeDotState = 0_pInt constitutive_thermal_maxSizeDotState = 0_pInt
do p = 1, size(thermalState) PhaseLoop:do ph = 1_pInt,material_Nphase ! loop over phases
constitutive_thermal_maxSizeDotState = max(constitutive_thermal_maxSizeDotState, thermalState(p)%sizeDotState) instance = phase_thermalInstance(ph)
constitutive_thermal_maxSizePostResults = max(constitutive_thermal_maxSizePostResults, thermalState(p)%sizePostResults) select case(phase_thermal(ph))
enddo case (THERMAL_none_ID)
thermalState(ph)%sizePostResults = thermal_none_sizePostResults(instance)
case (THERMAL_conduction_ID)
thermalState(ph)%sizePostResults = thermal_conduction_sizePostResults(instance)
end select
constitutive_thermal_maxSizeDotState = max(constitutive_thermal_maxSizeDotState, thermalState(ph)%sizeDotState)
constitutive_thermal_maxSizePostResults = max(constitutive_thermal_maxSizePostResults, thermalState(ph)%sizePostResults)
enddo PhaseLoop
end subroutine constitutive_thermal_init end subroutine constitutive_thermal_init

View File

@ -3948,7 +3948,6 @@ function crystallite_postResults(ipc, ip, el)
material_texture, & material_texture, &
homogenization_Ngrains homogenization_Ngrains
use constitutive, only: & use constitutive, only: &
constitutive_sizePostResults, &
constitutive_postResults, & constitutive_postResults, &
constitutive_homogenizedC constitutive_homogenizedC
use constitutive_damage, only: & use constitutive_damage, only: &