added field quantity output

This commit is contained in:
Pratheek Shanthraj 2014-09-26 10:34:36 +00:00
parent 280e563fa0
commit 82932c3708
3 changed files with 193 additions and 69 deletions

View File

@ -25,7 +25,8 @@ module homogenization
materialpoint_results !< results array of material point materialpoint_results !< results array of material point
integer(pInt), public, protected :: & integer(pInt), public, protected :: &
materialpoint_sizeResults, & materialpoint_sizeResults, &
homogenization_maxSizePostResults homogenization_maxSizePostResults, &
field_maxSizePostResults
real(pReal), dimension(:,:), allocatable, public, protected :: & real(pReal), dimension(:,:), allocatable, public, protected :: &
materialpoint_heat materialpoint_heat
@ -43,6 +44,22 @@ module homogenization
materialpoint_converged materialpoint_converged
logical, dimension(:,:,:), allocatable, private :: & logical, dimension(:,:,:), allocatable, private :: &
materialpoint_doneAndHappy materialpoint_doneAndHappy
enum, bind(c)
enumerator :: undefined_ID, &
temperature_ID, &
damage_ID
end enum
integer(pInt), dimension(:), allocatable, private, protected :: &
field_sizePostResults
integer(pInt), dimension(:,:), allocatable, private :: &
field_sizePostResult
character(len=64), dimension(:,:), allocatable, private :: &
field_output !< name of each post result output
integer(pInt), dimension(:), allocatable, private :: &
field_Noutput !< number of outputs per homog instance
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
field_outputID !< ID of each post result output
public :: & public :: &
homogenization_init, & homogenization_init, &
@ -56,7 +73,8 @@ module homogenization
field_getThermalConductivity33, & field_getThermalConductivity33, &
field_getMassDensity, & field_getMassDensity, &
field_getSpecificHeat, & field_getSpecificHeat, &
materialpoint_postResults materialpoint_postResults, &
field_postResults
private :: & private :: &
homogenization_partitionDeformation, & homogenization_partitionDeformation, &
homogenization_updateState, & homogenization_updateState, &
@ -86,13 +104,6 @@ subroutine homogenization_init()
debug_levelBasic, & debug_levelBasic, &
debug_e, & debug_e, &
debug_g debug_g
use IO, only: &
IO_error, &
IO_open_file, &
IO_open_jobFile_stat, &
IO_write_jobFile, &
IO_write_jobIntFile, &
IO_timeStamp
use mesh, only: & use mesh, only: &
mesh_maxNips, & mesh_maxNips, &
mesh_NcpElems, & mesh_NcpElems, &
@ -111,11 +122,13 @@ subroutine homogenization_init()
use homogenization_none use homogenization_none
use homogenization_isostrain use homogenization_isostrain
use homogenization_RGC use homogenization_RGC
use IO
implicit none implicit none
integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt), parameter :: FILEUNIT = 200_pInt
integer(pInt) :: e,i,p,myInstance integer(pInt) :: e,i,p,myInstance
integer(pInt), dimension(:,:), pointer :: thisSize integer(pInt), dimension(:,:), pointer :: thisSize
integer(pInt), dimension(:) , pointer :: thisNoutput
character(len=64), dimension(:,:), pointer :: thisOutput character(len=64), dimension(:,:), pointer :: thisOutput
character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready
logical :: knownHomogenization logical :: knownHomogenization
@ -125,6 +138,13 @@ subroutine homogenization_init()
allocate(mapping(mesh_ncpelems,4),source=0_pInt) allocate(mapping(mesh_ncpelems,4),source=0_pInt)
allocate(InstancePosition(material_Nhomogenization),source=0_pInt) allocate(InstancePosition(material_Nhomogenization),source=0_pInt)
#endif #endif
integer(pInt), parameter :: MAXNCHUNKS = 2_pInt
integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions
integer(pInt) :: section = 0_pInt
character(len=65536) :: &
tag = '', &
line = ''
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! parse homogenization from config file ! parse homogenization from config file
if (.not. IO_open_jobFile_stat(FILEUNIT,material_localFileExt)) & ! no local material configuration present... if (.not. IO_open_jobFile_stat(FILEUNIT,material_localFileExt)) & ! no local material configuration present...
@ -137,6 +157,61 @@ subroutine homogenization_init()
call homogenization_RGC_init(FILEUNIT) call homogenization_RGC_init(FILEUNIT)
close(FILEUNIT) close(FILEUNIT)
!--------------------------------------------------------------------------------------------------
! parse field from config file
allocate(field_sizePostResults(material_Nhomogenization), source=0_pInt)
allocate(field_sizePostResult(maxval(homogenization_Noutput),material_Nhomogenization), &
source=0_pInt)
allocate(field_Noutput(material_Nhomogenization), source=0_pInt)
allocate(field_outputID(maxval(homogenization_Noutput),material_Nhomogenization), &
source=undefined_ID)
allocate(field_output(maxval(homogenization_Noutput),material_Nhomogenization))
field_output = ''
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
rewind(FILEUNIT)
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
line = IO_read(FILEUNIT)
enddo
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of homogenization 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 section
section = section + 1_pInt
cycle
endif
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran
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('temperature')
field_Noutput(section) = field_Noutput(section) + 1_pInt
field_outputID(field_Noutput(section),section) = temperature_ID
field_sizePostResult(field_Noutput(section),section) = 1_pInt
field_sizePostResults(section) = field_sizePostResults(section) + 1_pInt
field_output(field_Noutput(section),section) = IO_lc(IO_stringValue(line,positions,2_pInt))
case('damage')
field_Noutput(section) = field_Noutput(section) + 1_pInt
field_outputID(field_Noutput(section),section) = damage_ID
field_sizePostResult(field_Noutput(section),section) = 1_pInt
field_sizePostResults(section) = field_sizePostResults(section) + 1_pInt
field_output(field_Noutput(section),section) = IO_lc(IO_stringValue(line,positions,2_pInt))
end select
end select
endif
enddo parsingFile
close(FILEUNIT)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! write description file for homogenization output ! write description file for homogenization output
call IO_write_jobFile(FILEUNIT,'outputHomogenization') call IO_write_jobFile(FILEUNIT,'outputHomogenization')
@ -146,14 +221,17 @@ subroutine homogenization_init()
select case(homogenization_type(p)) ! split per homogenization type select case(homogenization_type(p)) ! split per homogenization type
case (HOMOGENIZATION_NONE_ID) case (HOMOGENIZATION_NONE_ID)
outputName = HOMOGENIZATION_NONE_label outputName = HOMOGENIZATION_NONE_label
thisNoutput => null()
thisOutput => null() thisOutput => null()
thisSize => null() thisSize => null()
case (HOMOGENIZATION_ISOSTRAIN_ID) case (HOMOGENIZATION_ISOSTRAIN_ID)
outputName = HOMOGENIZATION_ISOSTRAIN_label outputName = HOMOGENIZATION_ISOSTRAIN_label
thisNoutput => homogenization_isostrain_Noutput
thisOutput => homogenization_isostrain_output thisOutput => homogenization_isostrain_output
thisSize => homogenization_isostrain_sizePostResult thisSize => homogenization_isostrain_sizePostResult
case (HOMOGENIZATION_RGC_ID) case (HOMOGENIZATION_RGC_ID)
outputName = HOMOGENIZATION_RGC_label outputName = HOMOGENIZATION_RGC_label
thisNoutput => homogenization_RGC_Noutput
thisOutput => homogenization_RGC_output thisOutput => homogenization_RGC_output
thisSize => homogenization_RGC_sizePostResult thisSize => homogenization_RGC_sizePostResult
case default case default
@ -163,10 +241,16 @@ subroutine homogenization_init()
if (knownHomogenization) then if (knownHomogenization) then
write(FILEUNIT,'(a)') '(type)'//char(9)//trim(outputName) write(FILEUNIT,'(a)') '(type)'//char(9)//trim(outputName)
write(FILEUNIT,'(a,i4)') '(ngrains)'//char(9),homogenization_Ngrains(p) write(FILEUNIT,'(a,i4)') '(ngrains)'//char(9),homogenization_Ngrains(p)
do e = 1,homogenization_Noutput(p) do e = 1,thisNoutput(i)
write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i) write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i)
enddo enddo
endif endif
#ifdef multiphysicsOut
write(FILEUNIT,'(a)') '(field)'
do e = 1_pInt,field_Noutput(p)
write(FILEUNIT,'(a,i4)') trim(field_output(e,p))//char(9),field_sizePostResult(e,p)
enddo
#endif
enddo enddo
close(FILEUNIT) close(FILEUNIT)
@ -204,11 +288,16 @@ subroutine homogenization_init()
#endif #endif
homogenization_maxSizePostResults = 0_pInt homogenization_maxSizePostResults = 0_pInt
field_maxSizePostResults = 0_pInt
do p = 1,material_Nhomogenization do p = 1,material_Nhomogenization
homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState(p)%sizePostResults) homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState(p)%sizePostResults)
field_maxSizePostResults = max(field_maxSizePostResults,field_Noutput(p))
enddo enddo
materialpoint_sizeResults = 1 & ! grain count materialpoint_sizeResults = 1 & ! grain count
+ 1 + homogenization_maxSizePostResults & ! homogSize & homogResult + 1 + homogenization_maxSizePostResults & ! homogSize & homogResult
#ifdef multiphysicsOut
+ 1 + field_maxSizePostResults & ! field size & field result
#endif
+ homogenization_maxNgrains * (1 + crystallite_maxSizePostResults & ! crystallite size & crystallite results + homogenization_maxNgrains * (1 + crystallite_maxSizePostResults & ! crystallite size & crystallite results
#ifdef multiphysicsOut #ifdef multiphysicsOut
+ 1 + constitutive_damage_maxSizePostResults & + 1 + constitutive_damage_maxSizePostResults &
@ -625,6 +714,17 @@ subroutine materialpoint_postResults
materialpoint_results(thePos+1:thePos+theSize,i,e) = homogenization_postResults(i,e) ! tell homogenization results materialpoint_results(thePos+1:thePos+theSize,i,e) = homogenization_postResults(i,e) ! tell homogenization results
thePos = thePos + theSize thePos = thePos + theSize
endif endif
#ifdef multiphysicsOut
theSize = field_Noutput(mappingHomogenization(2,i,e))
materialpoint_results(thePos+1,i,e) = real(theSize,pReal) ! tell size of field results
thePos = thePos + 1_pInt
if (theSize > 0_pInt) then ! any homogenization results to mention?
materialpoint_results(thePos+1:thePos+theSize,i,e) = field_postResults(i,e) ! tell field results
thePos = thePos + theSize
endif
#endif
materialpoint_results(thePos+1,i,e) = real(myNgrains,pReal) ! tell number of grains at materialpoint materialpoint_results(thePos+1,i,e) = real(myNgrains,pReal) ! tell number of grains at materialpoint
thePos = thePos + 1_pInt thePos = thePos + 1_pInt
@ -1184,4 +1284,36 @@ function homogenization_postResults(ip,el)
end function homogenization_postResults end function homogenization_postResults
!--------------------------------------------------------------------------------------------------
!> @brief return array of homogenization results for post file inclusion. call only,
!> if homogenization_sizePostResults(i,e) > 0 !!
!--------------------------------------------------------------------------------------------------
function field_postResults(ip,el)
use material, only: &
mappingHomogenization
implicit none
integer(pInt), intent(in) :: &
ip, & !< integration point
el !< element number
real(pReal), dimension(field_sizePostResults(mappingHomogenization(2,ip,el))) :: &
field_postResults
integer(pInt) :: &
c = 0_pInt, homog, o
field_postResults = 0.0_pReal
homog = mappingHomogenization(2,ip,el)
do o = 1_pInt,field_Noutput(homog)
select case(field_outputID(o,homog))
case (temperature_ID)
field_postResults(c+1_pInt) = field_getThermal(ip,el)
c = c + 1_pInt
case (damage_ID)
field_postResults(c+1_pInt) = field_getDAMAGE(ip,el)
c = c + 1_pInt
end select
enddo
end function field_postResults
end module homogenization end module homogenization

View File

@ -21,7 +21,7 @@ module homogenization_RGC
homogenization_RGC_sizePostResult homogenization_RGC_sizePostResult
character(len=64), dimension(:,:), allocatable,target, public :: & character(len=64), dimension(:,:), allocatable,target, public :: &
homogenization_RGC_output ! name of each post result output homogenization_RGC_output ! name of each post result output
integer(pInt), dimension(:), allocatable, private :: & integer(pInt), dimension(:), allocatable,target, public :: &
homogenization_RGC_Noutput !< number of outputs per homog instance homogenization_RGC_Noutput !< number of outputs per homog instance
integer(pInt), dimension(:,:), allocatable, private :: & integer(pInt), dimension(:,:), allocatable, private :: &
homogenization_RGC_Ngrains homogenization_RGC_Ngrains
@ -35,7 +35,6 @@ module homogenization_RGC
homogenization_RGC_ciAlpha homogenization_RGC_ciAlpha
enum, bind(c) enum, bind(c)
enumerator :: undefined_ID, & enumerator :: undefined_ID, &
temperature_ID, &
constitutivework_ID, & constitutivework_ID, &
penaltyenergy_ID, & penaltyenergy_ID, &
volumediscrepancy_ID, & volumediscrepancy_ID, &
@ -110,7 +109,7 @@ subroutine homogenization_RGC_init(fileUnit)
o, & o, &
instance, & instance, &
sizeHState sizeHState
integer(pInt) :: section=0_pInt, maxNinstance, i,j,e, output=-1_pInt, mySize, myInstance integer(pInt) :: section=0_pInt, maxNinstance, i,j,e, mySize, myInstance
character(len=65536) :: & character(len=65536) :: &
tag = '', & tag = '', &
line = '' line = ''
@ -154,7 +153,6 @@ subroutine homogenization_RGC_init(fileUnit)
endif endif
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
output = 0_pInt ! reset output counter
cycle cycle
endif endif
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran
@ -163,45 +161,54 @@ subroutine homogenization_RGC_init(fileUnit)
positions = IO_stringPos(line,MAXNCHUNKS) positions = IO_stringPos(line,MAXNCHUNKS)
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
select case(tag) select case(tag)
case ('nconstituents','ngrains','type')
case('field_damage')
case ('(output)') case ('(output)')
output = output + 1_pInt select case(IO_lc(IO_stringValue(line,positions,2_pInt)))
homogenization_RGC_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt))
select case(homogenization_RGC_output(output,i))
case('constitutivework') case('constitutivework')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = constitutivework_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = constitutivework_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('penaltyenergy') case('penaltyenergy')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = penaltyenergy_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = penaltyenergy_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('volumediscrepancy') case('volumediscrepancy')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = volumediscrepancy_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = volumediscrepancy_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('averagerelaxrate') case('averagerelaxrate')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = averagerelaxrate_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = averagerelaxrate_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('maximumrelaxrate') case('maximumrelaxrate')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = maximumrelaxrate_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = maximumrelaxrate_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('magnitudemismatch') case('magnitudemismatch')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = magnitudemismatch_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = magnitudemismatch_ID
case('temperature') homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt IO_lc(IO_stringValue(line,positions,2_pInt))
homogenization_RGC_outputID(output,i) = temperature_ID
case('ipcoords') case('ipcoords')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = ipcoords_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = ipcoords_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('avgdefgrad','avgf') case('avgdefgrad','avgf')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = avgdefgrad_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = avgdefgrad_ID
homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('avgp','avgfirstpiola','avg1stpiola') case('avgp','avgfirstpiola','avg1stpiola')
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
homogenization_RGC_outputID(output,i) = avgfirstpiola_ID homogenization_RGC_outputID(homogenization_RGC_Noutput(i),i) = avgfirstpiola_ID
case default homogenization_RGC_output(homogenization_RGC_Noutput(i),i) = &
call IO_error(105_pInt,ext_msg=IO_stringValue(line,positions,2_pInt)//& IO_lc(IO_stringValue(line,positions,2_pInt))
' ('//HOMOGENIZATION_RGC_label//')')
end select end select
case ('clustersize') case ('clustersize')
homogenization_RGC_Ngrains(1,i) = IO_intValue(line,positions,2_pInt) homogenization_RGC_Ngrains(1,i) = IO_intValue(line,positions,2_pInt)
@ -221,8 +228,7 @@ subroutine homogenization_RGC_init(fileUnit)
homogenization_RGC_angles(1,i) = IO_floatValue(line,positions,2_pInt) homogenization_RGC_angles(1,i) = IO_floatValue(line,positions,2_pInt)
homogenization_RGC_angles(2,i) = IO_floatValue(line,positions,3_pInt) homogenization_RGC_angles(2,i) = IO_floatValue(line,positions,3_pInt)
homogenization_RGC_angles(3,i) = IO_floatValue(line,positions,4_pInt) homogenization_RGC_angles(3,i) = IO_floatValue(line,positions,4_pInt)
case default
call IO_error(210_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_RGC_label//')')
end select end select
endif endif
endif endif
@ -270,7 +276,7 @@ subroutine homogenization_RGC_init(fileUnit)
! * Determine size of postResults array ! * Determine size of postResults array
outputsLoop: do o = 1_pInt, homogenization_RGC_Noutput(instance) outputsLoop: do o = 1_pInt, homogenization_RGC_Noutput(instance)
select case(homogenization_RGC_outputID(o,instance)) select case(homogenization_RGC_outputID(o,instance))
case(temperature_ID,constitutivework_ID,penaltyenergy_ID,volumediscrepancy_ID, & case(constitutivework_ID,penaltyenergy_ID,volumediscrepancy_ID, &
averagerelaxrate_ID,maximumrelaxrate_ID) averagerelaxrate_ID,maximumrelaxrate_ID)
mySize = 1_pInt mySize = 1_pInt
case(ipcoords_ID,magnitudemismatch_ID) case(ipcoords_ID,magnitudemismatch_ID)
@ -949,8 +955,6 @@ pure function homogenization_RGC_postResults(ip,el,avgP,avgF)
homogState, & homogState, &
mappingHomogenization, & mappingHomogenization, &
homogenization_Noutput homogenization_Noutput
use crystallite, only: &
crystallite_temperature
implicit none implicit none
integer(pInt), intent(in) :: & integer(pInt), intent(in) :: &
@ -973,9 +977,6 @@ pure function homogenization_RGC_postResults(ip,el,avgP,avgF)
homogenization_RGC_postResults = 0.0_pReal homogenization_RGC_postResults = 0.0_pReal
do o = 1_pInt,homogenization_Noutput(mesh_element(3,el)) do o = 1_pInt,homogenization_Noutput(mesh_element(3,el))
select case(homogenization_RGC_outputID(o,homID)) select case(homogenization_RGC_outputID(o,homID))
case (temperature_ID)
homogenization_RGC_postResults(c+1_pInt) = crystallite_temperature(ip,el)
c = c + 1_pInt
case (avgdefgrad_ID) case (avgdefgrad_ID)
homogenization_RGC_postResults(c+1_pInt:c+9_pInt) = reshape(avgF,[9]) homogenization_RGC_postResults(c+1_pInt:c+9_pInt) = reshape(avgF,[9])
c = c + 9_pInt c = c + 9_pInt

View File

@ -18,14 +18,13 @@ module homogenization_isostrain
character(len=64), dimension(:,:), allocatable, target, public :: & character(len=64), dimension(:,:), allocatable, target, public :: &
homogenization_isostrain_output !< name of each post result output homogenization_isostrain_output !< name of each post result output
integer(pInt), dimension(:), allocatable, private :: & integer(pInt), dimension(:), allocatable, target, public :: &
homogenization_isostrain_Noutput !< number of outputs per homog instance homogenization_isostrain_Noutput !< number of outputs per homog instance
integer(pInt), dimension(:), allocatable, private :: & integer(pInt), dimension(:), allocatable, private :: &
homogenization_isostrain_Ngrains homogenization_isostrain_Ngrains
enum, bind(c) enum, bind(c)
enumerator :: undefined_ID, & enumerator :: undefined_ID, &
nconstituents_ID, & nconstituents_ID, &
temperature_ID, &
ipcoords_ID, & ipcoords_ID, &
avgdefgrad_ID, & avgdefgrad_ID, &
avgfirstpiola_ID avgfirstpiola_ID
@ -67,7 +66,7 @@ subroutine homogenization_isostrain_init(fileUnit)
integer(pInt), parameter :: MAXNCHUNKS = 2_pInt integer(pInt), parameter :: MAXNCHUNKS = 2_pInt
integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions
integer(pInt) :: & integer(pInt) :: &
section = 0_pInt, i, output, mySize, o section = 0_pInt, i, mySize, o
integer :: & integer :: &
maxNinstance, & maxNinstance, &
homog, & homog, &
@ -113,7 +112,6 @@ subroutine homogenization_isostrain_init(fileUnit)
endif endif
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
output = 0_pInt ! reset output counter
cycle cycle
endif endif
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if-statement). It's not safe in Fortran
@ -122,30 +120,29 @@ subroutine homogenization_isostrain_init(fileUnit)
positions = IO_stringPos(line,MAXNCHUNKS) positions = IO_stringPos(line,MAXNCHUNKS)
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
select case(tag) select case(tag)
case('type')
case('field_damage')
case ('(output)') case ('(output)')
output = output + 1_pInt select case(IO_lc(IO_stringValue(line,positions,2_pInt)))
homogenization_isostrain_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt))
select case(homogenization_isostrain_output(output,i))
case('nconstituents','ngrains') case('nconstituents','ngrains')
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
homogenization_isostrain_outputID(output,i) = nconstituents_ID homogenization_isostrain_outputID(homogenization_isostrain_Noutput(i),i) = nconstituents_ID
case('temperature') homogenization_isostrain_output(homogenization_isostrain_Noutput(i),i) = &
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt IO_lc(IO_stringValue(line,positions,2_pInt))
homogenization_isostrain_outputID(output,i) = temperature_ID
case('ipcoords') case('ipcoords')
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
homogenization_isostrain_outputID(output,i) = ipcoords_ID homogenization_isostrain_outputID(homogenization_isostrain_Noutput(i),i) = ipcoords_ID
homogenization_isostrain_output(homogenization_isostrain_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('avgdefgrad','avgf') case('avgdefgrad','avgf')
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
homogenization_isostrain_outputID(output,i) = avgdefgrad_ID homogenization_isostrain_outputID(homogenization_isostrain_Noutput(i),i) = avgdefgrad_ID
homogenization_isostrain_output(homogenization_isostrain_Noutput(i),i) = &
IO_lc(IO_stringValue(line,positions,2_pInt))
case('avgp','avgfirstpiola','avg1stpiola') case('avgp','avgfirstpiola','avg1stpiola')
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
homogenization_isostrain_outputID(output,i) = avgfirstpiola_ID homogenization_isostrain_outputID(homogenization_isostrain_Noutput(i),i) = avgfirstpiola_ID
case default homogenization_isostrain_output(homogenization_isostrain_Noutput(i),i) = &
call IO_error(105_pInt,ext_msg=IO_stringValue(line,positions,2_pInt)//& IO_lc(IO_stringValue(line,positions,2_pInt))
' ('//HOMOGENIZATION_isostrain_label//')')
end select end select
case ('nconstituents','ngrains') case ('nconstituents','ngrains')
homogenization_isostrain_Ngrains(i) = IO_intValue(line,positions,2_pInt) homogenization_isostrain_Ngrains(i) = IO_intValue(line,positions,2_pInt)
@ -158,8 +155,7 @@ subroutine homogenization_isostrain_init(fileUnit)
case default case default
call IO_error(211_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')') call IO_error(211_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')')
end select end select
case default
call IO_error(210_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')')
end select end select
endif endif
endif endif
@ -173,7 +169,7 @@ subroutine homogenization_isostrain_init(fileUnit)
! * Determine size of postResults array ! * Determine size of postResults array
outputsLoop: do o = 1_pInt, homogenization_isostrain_Noutput(instance) outputsLoop: do o = 1_pInt, homogenization_isostrain_Noutput(instance)
select case(homogenization_isostrain_outputID(o,instance)) select case(homogenization_isostrain_outputID(o,instance))
case(nconstituents_ID, temperature_ID) case(nconstituents_ID)
mySize = 1_pInt mySize = 1_pInt
case(ipcoords_ID) case(ipcoords_ID)
mySize = 3_pInt mySize = 3_pInt
@ -277,8 +273,6 @@ pure function homogenization_isostrain_postResults(ip,el,avgP,avgF)
use material, only: & use material, only: &
homogenization_typeInstance, & homogenization_typeInstance, &
homogenization_Noutput homogenization_Noutput
use crystallite, only: &
crystallite_temperature
implicit none implicit none
integer(pInt), intent(in) :: & integer(pInt), intent(in) :: &
@ -304,9 +298,6 @@ pure function homogenization_isostrain_postResults(ip,el,avgP,avgF)
case (nconstituents_ID) case (nconstituents_ID)
homogenization_isostrain_postResults(c+1_pInt) = real(homogenization_isostrain_Ngrains(homID),pReal) homogenization_isostrain_postResults(c+1_pInt) = real(homogenization_isostrain_Ngrains(homID),pReal)
c = c + 1_pInt c = c + 1_pInt
case (temperature_ID)
homogenization_isostrain_postResults(c+1_pInt) = crystallite_temperature(ip,el)
c = c + 1_pInt
case (avgdefgrad_ID) case (avgdefgrad_ID)
homogenization_isostrain_postResults(c+1_pInt:c+9_pInt) = reshape(avgF,[9]) homogenization_isostrain_postResults(c+1_pInt:c+9_pInt) = reshape(avgF,[9])
c = c + 9_pInt c = c + 9_pInt