clarified logic

This commit is contained in:
Martin Diehl 2020-09-19 10:00:49 +02:00
parent c4ce28e63f
commit 201303f35f
1 changed files with 34 additions and 54 deletions

View File

@ -328,87 +328,67 @@ subroutine material_parseMicrostructure
homogenization homogenization
integer, dimension(:), allocatable :: & integer, dimension(:), allocatable :: &
CounterPhase, & counterPhase, &
CounterHomogenization counterHomogenization
real(pReal), dimension(:,:), allocatable :: &
microstructure_fraction !< vol fraction of each constituent in microstrcuture
real(pReal) :: &
frac
integer :: & integer :: &
e, & e, &
i, & i, &
m, & m, &
c, & c, &
microstructure_maxNconstituents maxNconstituents
homogenization => config_material%get('homogenization')
phases => config_material%get('phase')
microstructure => config_material%get('microstructure') microstructure => config_material%get('microstructure')
allocate(microstructure_Nconstituents(microstructure%length),source=0)
if(any(discretization_microstructureAt > microstructure%length)) & if(any(discretization_microstructureAt > microstructure%length)) &
call IO_error(155,ext_msg='More microstructures requested than found in material.yaml') call IO_error(155,ext_msg='More microstructures requested than found in material.yaml')
allocate(microstructure_Nconstituents(microstructure%length),source=0)
do m = 1, microstructure%length do m = 1, microstructure%length
constituentsInMicrostructure => microstructure%get(m) constituentsInMicrostructure => microstructure%get(m)
constituents => constituentsInMicrostructure%get('constituents') constituents => constituentsInMicrostructure%get('constituents')
microstructure_Nconstituents(m) = constituents%length microstructure_Nconstituents(m) = constituents%length
enddo enddo
maxNconstituents = maxval(microstructure_Nconstituents)
microstructure_maxNconstituents = maxval(microstructure_Nconstituents) allocate(material_orientation0(maxNconstituents,discretization_nIP,discretization_nElem))
allocate(microstructure_fraction(microstructure_maxNconstituents,microstructure%length), source =0.0_pReal)
allocate(material_orientation0(microstructure_maxNconstituents,discretization_nIP,discretization_nElem))
allocate(material_homogenizationAt(discretization_nElem),source=0) allocate(material_homogenizationAt(discretization_nElem),source=0)
allocate(material_homogenizationMemberAt(discretization_nIP,discretization_nElem),source=0) allocate(material_homogenizationMemberAt(discretization_nIP,discretization_nElem),source=0)
allocate(material_phaseAt(microstructure_maxNconstituents,discretization_nElem),source=0) allocate(material_phaseAt(maxNconstituents,discretization_nElem),source=0)
allocate(material_phaseMemberAt(microstructure_maxNconstituents,discretization_nIP,discretization_nElem),source=0) allocate(material_phaseMemberAt(maxNconstituents,discretization_nIP,discretization_nElem),source=0)
allocate(CounterPhase(phases%length),source=0) phases => config_material%get('phase')
allocate(CounterHomogenization(homogenization%length),source=0) allocate(counterPhase(phases%length),source=0)
homogenization => config_material%get('homogenization')
do m = 1, microstructure%length allocate(counterHomogenization(homogenization%length),source=0)
constituentsInMicrostructure => microstructure%get(m)
constituents => constituentsInMicrostructure%get('constituents')
do c = 1, constituents%length
constituent => constituents%get(c)
microstructure_fraction(c,m) = constituent%get_asFloat('fraction')
enddo
if (dNeq(sum(microstructure_fraction(:,m)),1.0_pReal)) call IO_error(153,ext_msg='constituent')
enddo
do e = 1, discretization_nElem do e = 1, discretization_nElem
constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e)) constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e))
constituents => constituentsInMicrostructure%get('constituents') constituents => constituentsInMicrostructure%get('constituents')
do i = 1, discretization_nIP
do c = 1, constituents%length
constituent => constituents%get(c)
material_phaseAt(c,e) = phases%getIndex(constituent%get_asString('phase'))
call material_orientation0(c,i,e)%fromQuaternion(constituent%get_asFloats('orientation',requiredSize=4))
enddo
enddo
enddo
do e = 1, discretization_nElem
constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e))
material_homogenizationAt(e) = homogenization%getIndex(constituentsInMicrostructure%get_asString('homogenization')) material_homogenizationAt(e) = homogenization%getIndex(constituentsInMicrostructure%get_asString('homogenization'))
do i = 1, discretization_nIP do i = 1, discretization_nIP
CounterHomogenization(material_homogenizationAt(e)) = CounterHomogenization(material_homogenizationAt(e)) + 1 counterHomogenization(material_homogenizationAt(e)) = counterHomogenization(material_homogenizationAt(e)) + 1
material_homogenizationMemberAt(i,e) = CounterHomogenization(material_homogenizationAt(e)) material_homogenizationMemberAt(i,e) = counterHomogenization(material_homogenizationAt(e))
enddo enddo
enddo
do e = 1, discretization_nElem frac = 0.0_pReal
constituentsInMicrostructure => microstructure%get(discretization_microstructureAt(e)) do c = 1, constituents%length
constituents => constituentsInMicrostructure%get('constituents') constituent => constituents%get(c)
frac = frac + constituent%get_asFloat('fraction')
do i = 1, discretization_nIP material_phaseAt(c,e) = phases%getIndex(constituent%get_asString('phase'))
do c = 1, constituents%length
CounterPhase(material_phaseAt(c,e)) = & do i = 1, discretization_nIP
CounterPhase(material_phaseAt(c,e)) + 1 counterPhase(material_phaseAt(c,e)) = counterPhase(material_phaseAt(c,e)) + 1
material_phaseMemberAt(c,i,e) = CounterPhase(material_phaseAt(c,e)) material_phaseMemberAt(c,i,e) = counterPhase(material_phaseAt(c,e))
call material_orientation0(c,i,e)%fromQuaternion(constituent%get_asFloats('orientation',requiredSize=4))
enddo enddo
enddo enddo
if (dNeq(frac,1.0_pReal)) call IO_error(153,ext_msg='constituent')
enddo enddo