fixed buggy initialization. Now initialising in similar way to constitutive models.
This commit is contained in:
parent
8e6ea7d9c7
commit
e8f8655c98
|
@ -21,7 +21,10 @@ module homogenization_RGC
|
|||
homogenization_RGC_sizePostResult
|
||||
character(len=64), dimension(:,:), allocatable,target, public :: &
|
||||
homogenization_RGC_output ! name of each post result output
|
||||
|
||||
#ifdef NEWSTATE
|
||||
integer(pInt), dimension(:), allocatable, private :: &
|
||||
homogenization_RGC_Noutput !< number of outputs per homog instance
|
||||
#endif
|
||||
integer(pInt), dimension(:,:), allocatable, private :: &
|
||||
homogenization_RGC_Ngrains
|
||||
real(pReal), dimension(:,:), allocatable, private :: &
|
||||
|
@ -107,6 +110,7 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
integer :: &
|
||||
homog, &
|
||||
NofMyHomog, &
|
||||
o, &
|
||||
instance, &
|
||||
sizeHState
|
||||
#endif
|
||||
|
@ -122,9 +126,15 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
|
||||
maxNinstance = int(count(homogenization_type == HOMOGENIZATION_RGC_ID),pInt)
|
||||
if (maxNinstance == 0_pInt) return
|
||||
|
||||
#ifdef NEWSTATE
|
||||
if (iand(debug_level(debug_HOMOGENIZATION),debug_levelBasic) /= 0_pInt) &
|
||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
||||
#endif
|
||||
allocate(homogenization_RGC_sizeState(maxNinstance), source=0_pInt)
|
||||
allocate(homogenization_RGC_sizePostResults(maxNinstance), source=0_pInt)
|
||||
#ifdef NEWSTATE
|
||||
allocate(homogenization_RGC_Noutput(maxNinstance), source=0_pInt)
|
||||
#endif
|
||||
allocate(homogenization_RGC_Ngrains(3,maxNinstance), source=0_pInt)
|
||||
allocate(homogenization_RGC_ciAlpha(maxNinstance), source=0.0_pReal)
|
||||
allocate(homogenization_RGC_xiAlpha(maxNinstance), source=0.0_pReal)
|
||||
|
@ -143,7 +153,7 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
line = IO_read(fileUnit)
|
||||
enddo
|
||||
|
||||
do while (trim(line) /= IO_EOF) ! read through sections of homogenization part
|
||||
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
|
||||
|
@ -167,24 +177,54 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
homogenization_RGC_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt))
|
||||
select case(homogenization_RGC_output(output,i))
|
||||
case('constitutivework')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = constitutivework_ID
|
||||
case('penaltyenergy')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = penaltyenergy_ID
|
||||
case('volumediscrepancy')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = volumediscrepancy_ID
|
||||
case('averagerelaxrate')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = averagerelaxrate_ID
|
||||
case('maximumrelaxrate')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = maximumrelaxrate_ID
|
||||
case('magnitudemismatch')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = magnitudemismatch_ID
|
||||
case('temperature')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = temperature_ID
|
||||
case('ipcoords')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = ipcoords_ID
|
||||
case('avgdefgrad','avgf')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = avgdefgrad_ID
|
||||
case('avgp','avgfirstpiola','avg1stpiola')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_RGC_Noutput(i) = homogenization_RGC_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_RGC_outputID(output,i) = avgfirstpiola_ID
|
||||
case default
|
||||
call IO_error(105_pInt,ext_msg=IO_stringValue(line,positions,2_pInt)//&
|
||||
|
@ -213,10 +253,10 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
end select
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
enddo parsingFile
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! assigning cluster orientations
|
||||
! * assigning cluster orientations
|
||||
elementLooping: do e = 1_pInt,mesh_NcpElems
|
||||
if (homogenization_type(mesh_element(3,e)) == HOMOGENIZATION_RGC_ID) then
|
||||
myInstance = homogenization_typeInstance(mesh_element(3,e))
|
||||
|
@ -248,6 +288,55 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
write(6,'(a25,3(1x,e10.3))') 'cluster orientation: ',(homogenization_RGC_angles(j,i),j=1_pInt,3_pInt)
|
||||
enddo
|
||||
endif
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
#ifdef NEWSTATE
|
||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
||||
myHomog: if (homogenization_type(homog) == HOMOGENIZATION_RGC_ID) then
|
||||
NofMyHomog = count(material_homog == homog)
|
||||
instance = homogenization_typeInstance(homog)
|
||||
|
||||
! * Determine size of postResults array
|
||||
outputsLoop: do o = 1_pInt, homogenization_RGC_Noutput(instance)
|
||||
select case(homogenization_RGC_outputID(o,instance))
|
||||
case(temperature_ID,constitutivework_ID,penaltyenergy_ID,volumediscrepancy_ID, &
|
||||
averagerelaxrate_ID,maximumrelaxrate_ID)
|
||||
mySize = 1_pInt
|
||||
case(ipcoords_ID,magnitudemismatch_ID)
|
||||
mySize = 3_pInt
|
||||
case(avgdefgrad_ID,avgfirstpiola_ID)
|
||||
mySize = 9_pInt
|
||||
case default
|
||||
mySize = 0_pInt
|
||||
end select
|
||||
|
||||
outputFound: if (mySize > 0_pInt) then
|
||||
homogenization_RGC_sizePostResult(o,instance) = mySize
|
||||
homogenization_RGC_sizePostResults(instance) = &
|
||||
homogenization_RGC_sizePostResults(instance) + mySize
|
||||
endif outputFound
|
||||
enddo outputsLoop
|
||||
|
||||
sizeHState = &
|
||||
3_pInt*(homogenization_RGC_Ngrains(1,instance)-1_pInt)* &
|
||||
homogenization_RGC_Ngrains(2,instance)*homogenization_RGC_Ngrains(3,instance) &
|
||||
+ 3_pInt*homogenization_RGC_Ngrains(1,instance)*(homogenization_RGC_Ngrains(2,instance)-1_pInt)* &
|
||||
homogenization_RGC_Ngrains(3,instance) &
|
||||
+ 3_pInt*homogenization_RGC_Ngrains(1,instance)*homogenization_RGC_Ngrains(2,instance)* &
|
||||
(homogenization_RGC_Ngrains(3,instance)-1_pInt) &
|
||||
+ 8_pInt ! (1) Average constitutive work, (2-4) Overall mismatch, (5) Average penalty energy,
|
||||
! (6) Volume discrepancy, (7) Avg relaxation rate component, (8) Max relaxation rate component
|
||||
|
||||
! allocate state arrays
|
||||
homogState(homog)%sizeState = sizeHState
|
||||
homogState(homog)%sizePostResults = homogenization_RGC_sizePostResults(instance)
|
||||
allocate(homogState(homog)%state0 ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
allocate(homogState(homog)%subState0 ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
allocate(homogState(homog)%state ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
|
||||
endif myHomog
|
||||
enddo initializeInstances
|
||||
|
||||
#else
|
||||
|
||||
do i = 1_pInt,maxNinstance
|
||||
do j = 1_pInt,maxval(homogenization_Noutput)
|
||||
|
@ -269,32 +358,10 @@ subroutine homogenization_RGC_init(fileUnit)
|
|||
homogenization_RGC_sizePostResults(i) + mySize
|
||||
endif outputFound
|
||||
enddo
|
||||
|
||||
homogenization_RGC_sizeState(i) &
|
||||
= 3_pInt*(homogenization_RGC_Ngrains(1,i)-1_pInt)*homogenization_RGC_Ngrains(2,i)*homogenization_RGC_Ngrains(3,i) &
|
||||
+ 3_pInt*homogenization_RGC_Ngrains(1,i)*(homogenization_RGC_Ngrains(2,i)-1_pInt)*homogenization_RGC_Ngrains(3,i) &
|
||||
+ 3_pInt*homogenization_RGC_Ngrains(1,i)*homogenization_RGC_Ngrains(2,i)*(homogenization_RGC_Ngrains(3,i)-1_pInt) &
|
||||
+ 8_pInt ! (1) Average constitutive work, (2-4) Overall mismatch, (5) Average penalty energy,
|
||||
! (6) Volume discrepancy, (7) Avg relaxation rate component, (8) Max relaxation rate component
|
||||
enddo
|
||||
#ifdef NEWSTATE
|
||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
||||
|
||||
myhomog: if (homogenization_type(homog) == HOMOGENIZATION_RGC_ID) then
|
||||
NofMyHomog = count(material_homog == homog)
|
||||
! instance = phase_plasticityInstance(phase)
|
||||
|
||||
! allocate homogenization state arrays
|
||||
sizeHState = homogenization_RGC_sizeState(homog)
|
||||
homogState(homog)%sizeState = sizeHState
|
||||
homogState(homog)%sizePostResults = homogenization_RGC_sizePostResults(homog)
|
||||
allocate(homogState(homog)%state0 ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
allocate(homogState(homog)%subState0 ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
allocate(homogState(homog)%state ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
|
||||
endif myhomog
|
||||
enddo initializeInstances
|
||||
|
||||
#endif
|
||||
|
||||
end subroutine homogenization_RGC_init
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@ module homogenization_isostrain
|
|||
|
||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
||||
homogenization_isostrain_output !< name of each post result output
|
||||
#ifdef NEWSTATE
|
||||
integer(pInt), dimension(:), allocatable, private :: &
|
||||
homogenization_isostrain_Noutput !< number of outputs per homog instance
|
||||
#endif
|
||||
integer(pInt), dimension(:), allocatable, private :: &
|
||||
homogenization_isostrain_Ngrains
|
||||
enum, bind(c)
|
||||
|
@ -54,6 +58,12 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
use prec, only: &
|
||||
pReal, &
|
||||
pInt
|
||||
#ifdef NEWSTATE
|
||||
use debug, only: &
|
||||
debug_HOMOGENIZATION, &
|
||||
debug_level, &
|
||||
debug_levelBasic
|
||||
#endif
|
||||
use IO
|
||||
use material
|
||||
|
||||
|
@ -62,7 +72,7 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
integer(pInt), parameter :: MAXNCHUNKS = 2_pInt
|
||||
integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions
|
||||
integer(pInt) :: &
|
||||
section = 0_pInt, i, j, output, mySize
|
||||
section = 0_pInt, i, j, output, mySize, o
|
||||
integer :: &
|
||||
maxNinstance, &
|
||||
#ifdef NEWSTATE
|
||||
|
@ -84,10 +94,16 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
|
||||
maxNinstance = count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID)
|
||||
if (maxNinstance == 0) return
|
||||
|
||||
#ifdef NEWSTATE
|
||||
if (iand(debug_level(debug_HOMOGENIZATION),debug_levelBasic) /= 0_pInt) &
|
||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
||||
#endif
|
||||
allocate(homogenization_isostrain_sizePostResults(maxNinstance), source=0_pInt)
|
||||
allocate(homogenization_isostrain_sizePostResult(maxval(homogenization_Noutput),maxNinstance), &
|
||||
source=0_pInt)
|
||||
#ifdef NEWSTATE
|
||||
allocate(homogenization_isostrain_Noutput(maxNinstance), source=0_pInt)
|
||||
#endif
|
||||
allocate(homogenization_isostrain_Ngrains(maxNinstance), source=0_pInt)
|
||||
allocate(homogenization_isostrain_mapping(maxNinstance), source=average_ID)
|
||||
allocate(homogenization_isostrain_output(maxval(homogenization_Noutput),maxNinstance))
|
||||
|
@ -100,7 +116,7 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
line = IO_read(fileUnit)
|
||||
enddo
|
||||
|
||||
do while (trim(line) /= IO_EOF) ! read through sections of homogenization part
|
||||
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
|
||||
|
@ -124,14 +140,29 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
homogenization_isostrain_output(output,i) = IO_lc(IO_stringValue(line,positions,2_pInt))
|
||||
select case(homogenization_isostrain_output(output,i))
|
||||
case('nconstituents','ngrains')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_isostrain_outputID(output,i) = nconstituents_ID
|
||||
case('temperature')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_isostrain_outputID(output,i) = temperature_ID
|
||||
case('ipcoords')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_isostrain_outputID(output,i) = ipcoords_ID
|
||||
case('avgdefgrad','avgf')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_isostrain_outputID(output,i) = avgdefgrad_ID
|
||||
case('avgp','avgfirstpiola','avg1stpiola')
|
||||
#ifdef NEWSTATE
|
||||
homogenization_isostrain_Noutput(i) = homogenization_isostrain_Noutput(i) + 1_pInt
|
||||
#endif
|
||||
homogenization_isostrain_outputID(output,i) = avgfirstpiola_ID
|
||||
case default
|
||||
call IO_error(105_pInt,ext_msg=IO_stringValue(line,positions,2_pInt)//&
|
||||
|
@ -153,26 +184,47 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
end select
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
enddo parsingFile
|
||||
|
||||
#ifdef NEWSTATE
|
||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
||||
|
||||
myhomog: if (homogenization_type(homog) == HOMOGENIZATION_ISOSTRAIN_ID) then
|
||||
NofMyHomog = count(material_homog == homog)
|
||||
! instance = phase_plasticityInstance(phase)
|
||||
initializeInstances: do homog = 1_pInt, material_Nhomogenization
|
||||
myHomog: if (homogenization_type(homog) == HOMOGENIZATION_ISOSTRAIN_ID) then
|
||||
NofMyHomog = count(material_homog == homog)
|
||||
instance = homogenization_typeInstance(homog)
|
||||
|
||||
! allocate homogenization state arrays
|
||||
! * Determine size of postResults array
|
||||
outputsLoop: do o = 1_pInt, homogenization_isostrain_Noutput(instance)
|
||||
select case(homogenization_isostrain_outputID(o,instance))
|
||||
case(nconstituents_ID, temperature_ID)
|
||||
mySize = 1_pInt
|
||||
case(ipcoords_ID)
|
||||
mySize = 3_pInt
|
||||
case(avgdefgrad_ID, avgfirstpiola_ID)
|
||||
mySize = 9_pInt
|
||||
case default
|
||||
mySize = 0_pInt
|
||||
end select
|
||||
|
||||
outputFound: if (mySize > 0_pInt) then
|
||||
homogenization_isostrain_sizePostResult(o,instance) = mySize
|
||||
homogenization_isostrain_sizePostResults(instance) = &
|
||||
homogenization_isostrain_sizePostResults(instance) + mySize
|
||||
endif outputFound
|
||||
enddo outputsLoop
|
||||
|
||||
! allocate state arrays
|
||||
sizeHState = 0_pInt
|
||||
homogState(homog)%sizeState = sizeHState
|
||||
homogState(homog)%sizePostResults = homogenization_isostrain_sizePostResults(homog)
|
||||
homogState(homog)%sizePostResults = homogenization_isostrain_sizePostResults(instance)
|
||||
allocate(homogState(homog)%state0 ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
allocate(homogState(homog)%subState0 ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
allocate(homogState(homog)%state ( sizeHState,NofMyHomog), source=0.0_pReal)
|
||||
|
||||
endif myhomog
|
||||
endif myHomog
|
||||
enddo initializeInstances
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
do i = 1,maxNinstance
|
||||
|
||||
do j = 1_pInt,maxval(homogenization_Noutput)
|
||||
|
@ -194,6 +246,9 @@ subroutine homogenization_isostrain_init(fileUnit)
|
|||
endif outputFound
|
||||
enddo
|
||||
enddo
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
end subroutine homogenization_isostrain_init
|
||||
|
||||
|
|
Loading…
Reference in New Issue