no need to be real state

This commit is contained in:
Martin Diehl 2019-01-12 23:22:13 +01:00
parent 837699e6c1
commit 7f459e85f1
1 changed files with 37 additions and 34 deletions

View File

@ -47,23 +47,28 @@ module homogenization_RGC
type, private :: tRGCstate type, private :: tRGCstate
real(pReal), pointer, dimension(:) :: & real(pReal), pointer, dimension(:) :: &
work, & work, &
penaltyEnergy, & penaltyEnergy
volumeDiscrepancy, &
relaxationRate_avg, &
relaxationRate_max
real(pReal), pointer, dimension(:,:) :: & real(pReal), pointer, dimension(:,:) :: &
relaxationVector, & relaxationVector
mismatch
end type tRGCstate end type tRGCstate
type, private :: tRGCdependentState type, private :: tRGCdependentState
real(pReal), allocatable, dimension(:) :: &
volumeDiscrepancy, &
relaxationRate_avg, &
relaxationRate_max
real(pReal), allocatable, dimension(:,:) :: &
mismatch
real(pReal), allocatable, dimension(:,:,:) :: & real(pReal), allocatable, dimension(:,:,:) :: &
orientation orientation
end type tRGCdependentState end type tRGCdependentState
type(tparameters), dimension(:), allocatable, private :: param !< containers of parameters (len Ninstance) type(tparameters), dimension(:), allocatable, private :: &
type(tRGCstate), dimension(:), allocatable, private :: state param
type(tRGCdependentState), dimension(:), allocatable, private :: dependentState type(tRGCstate), dimension(:), allocatable, private :: &
state
type(tRGCdependentState), dimension(:), allocatable, private :: &
dependentState
public :: & public :: &
homogenization_RGC_init, & homogenization_RGC_init, &
@ -215,9 +220,7 @@ subroutine homogenization_RGC_init()
+ prm%Nconstituents(1)*(prm%Nconstituents(2)-1_pInt)*prm%Nconstituents(3) & + prm%Nconstituents(1)*(prm%Nconstituents(2)-1_pInt)*prm%Nconstituents(3) &
+ prm%Nconstituents(1)*prm%Nconstituents(2)*(prm%Nconstituents(3)-1_pInt)) + prm%Nconstituents(1)*prm%Nconstituents(2)*(prm%Nconstituents(3)-1_pInt))
sizeState = nIntFaceTot & sizeState = nIntFaceTot &
+ size(['avg constitutive work']) + size(['overall mismatch']) * 3_pInt & + size(['avg constitutive work ','average penalty energy'])
+ size(['average penalty energy ','volume discrepancy ',&
'avg relaxation rate component ','max relaxation rate componenty'])
homogState(h)%sizeState = sizeState homogState(h)%sizeState = sizeState
homogState(h)%sizePostResults = sum(homogenization_RGC_sizePostResult(:,homogenization_typeInstance(h))) homogState(h)%sizePostResults = sum(homogenization_RGC_sizePostResult(:,homogenization_typeInstance(h)))
@ -227,13 +230,13 @@ subroutine homogenization_RGC_init()
stt%relaxationVector => homogState(h)%state(1:nIntFaceTot,:) stt%relaxationVector => homogState(h)%state(1:nIntFaceTot,:)
stt%work => homogState(h)%state(nIntFaceTot+1,:) stt%work => homogState(h)%state(nIntFaceTot+1,:)
stt%mismatch => homogState(h)%state(nIntFaceTot+2:nIntFaceTot+4,:) stt%penaltyEnergy => homogState(h)%state(nIntFaceTot+2,:)
stt%penaltyEnergy => homogState(h)%state(nIntFaceTot+5,:)
stt%volumeDiscrepancy => homogState(h)%state(nIntFaceTot+6,:)
stt%relaxationRate_avg => homogState(h)%state(nIntFaceTot+7,:)
stt%relaxationRate_max => homogState(h)%state(nIntFaceTot+8,:)
allocate(dst%orientation(3,3,NofMyHomog)) allocate(dst%volumeDiscrepancy( NofMyHomog))
allocate(dst%relaxationRate_avg( NofMyHomog))
allocate(dst%relaxationRate_max( NofMyHomog))
allocate(dst%mismatch( 3, NofMyHomog))
allocate(dst%orientation( 3,3,NofMyHomog))
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -381,7 +384,7 @@ function homogenization_RGC_updateState(P,F,F0,avgF,dt,dPdF,ip,el)
instance = homogenization_typeInstance(material_homogenizationAt(el)) instance = homogenization_typeInstance(material_homogenizationAt(el))
of = mappingHomogenization(1,ip,el) of = mappingHomogenization(1,ip,el)
associate(stt => state(instance), prm => param(instance)) associate(stt => state(instance), dst => dependentState(instance), prm => param(instance))
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! get the dimension of the cluster (grains and interfaces) ! get the dimension of the cluster (grains and interfaces)
@ -415,7 +418,7 @@ function homogenization_RGC_updateState(P,F,F0,avgF,dt,dPdF,ip,el)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! calculating volume discrepancy and stress penalty related to overall volume discrepancy ! calculating volume discrepancy and stress penalty related to overall volume discrepancy
call volumePenalty(D,stt%volumeDiscrepancy(of),avgF,F,nGrain,instance,of) call volumePenalty(D,dst%volumeDiscrepancy(of),avgF,F,nGrain,instance,of)
#ifdef DEBUG #ifdef DEBUG
if (iand(debug_level(debug_homogenization),debug_levelExtensive) /= 0_pInt) then if (iand(debug_level(debug_homogenization),debug_levelExtensive) /= 0_pInt) then
@ -519,21 +522,21 @@ function homogenization_RGC_updateState(P,F,F0,avgF,dt,dPdF,ip,el)
enddo; enddo enddo; enddo
enddo enddo
stt%mismatch(1:3,of) = sum(NN,2)/real(nGrain,pReal) dst%mismatch(1:3,of) = sum(NN,2)/real(nGrain,pReal)
stt%relaxationRate_avg(of) = sum(abs(drelax))/dt/real(3_pInt*nIntFaceTot,pReal) dst%relaxationRate_avg(of) = sum(abs(drelax))/dt/real(3_pInt*nIntFaceTot,pReal)
stt%relaxationRate_max(of) = maxval(abs(drelax))/dt dst%relaxationRate_max(of) = maxval(abs(drelax))/dt
#ifdef DEBUG #ifdef DEBUG
if (iand(debug_level(debug_homogenization),debug_levelExtensive) /= 0_pInt & if (iand(debug_level(debug_homogenization),debug_levelExtensive) /= 0_pInt &
.and. debug_e == el .and. debug_i == ip) then .and. debug_e == el .and. debug_i == ip) then
write(6,'(1x,a30,1x,e15.8)') 'Constitutive work: ',stt%work(of) write(6,'(1x,a30,1x,e15.8)') 'Constitutive work: ',stt%work(of)
write(6,'(1x,a30,3(1x,e15.8))')'Magnitude mismatch: ',stt%mismatch(1,of), & write(6,'(1x,a30,3(1x,e15.8))')'Magnitude mismatch: ',dst%mismatch(1,of), &
stt%mismatch(2,of), & dst%mismatch(2,of), &
stt%mismatch(3,of) dst%mismatch(3,of)
write(6,'(1x,a30,1x,e15.8)') 'Penalty energy: ', stt%penaltyEnergy(of) write(6,'(1x,a30,1x,e15.8)') 'Penalty energy: ', stt%penaltyEnergy(of)
write(6,'(1x,a30,1x,e15.8,/)') 'Volume discrepancy: ', stt%volumeDiscrepancy(of) write(6,'(1x,a30,1x,e15.8,/)') 'Volume discrepancy: ', dst%volumeDiscrepancy(of)
write(6,'(1x,a30,1x,e15.8)') 'Maximum relaxation rate: ', stt%relaxationRate_max(of) write(6,'(1x,a30,1x,e15.8)') 'Maximum relaxation rate: ', dst%relaxationRate_max(of)
write(6,'(1x,a30,1x,e15.8,/)') 'Average relaxation rate: ', stt%relaxationRate_avg(of) write(6,'(1x,a30,1x,e15.8,/)') 'Average relaxation rate: ', dst%relaxationRate_avg(of)
flush(6) flush(6)
endif endif
#endif #endif
@ -1087,7 +1090,7 @@ pure function homogenization_RGC_postResults(instance,of) result(postResults)
real(pReal), dimension(sum(homogenization_RGC_sizePostResult(:,instance))) :: & real(pReal), dimension(sum(homogenization_RGC_sizePostResult(:,instance))) :: &
postResults postResults
associate(prm => param(instance), stt => state(instance)) associate(stt => state(instance), dst => dependentState(instance), prm => param(instance))
c = 0_pInt c = 0_pInt
@ -1098,19 +1101,19 @@ pure function homogenization_RGC_postResults(instance,of) result(postResults)
postResults(c+1) = stt%work(of) postResults(c+1) = stt%work(of)
c = c + 1_pInt c = c + 1_pInt
case (magnitudemismatch_ID) case (magnitudemismatch_ID)
postResults(c+1:c+3) = stt%mismatch(1:3,of) postResults(c+1:c+3) = dst%mismatch(1:3,of)
c = c + 3_pInt c = c + 3_pInt
case (penaltyenergy_ID) case (penaltyenergy_ID)
postResults(c+1) = stt%penaltyEnergy(of) postResults(c+1) = stt%penaltyEnergy(of)
c = c + 1_pInt c = c + 1_pInt
case (volumediscrepancy_ID) case (volumediscrepancy_ID)
postResults(c+1) = stt%volumeDiscrepancy(of) postResults(c+1) = dst%volumeDiscrepancy(of)
c = c + 1_pInt c = c + 1_pInt
case (averagerelaxrate_ID) case (averagerelaxrate_ID)
postResults(c+1) = stt%relaxationrate_avg(of) postResults(c+1) = dst%relaxationrate_avg(of)
c = c + 1_pInt c = c + 1_pInt
case (maximumrelaxrate_ID) case (maximumrelaxrate_ID)
postResults(c+1) = stt%relaxationrate_max(of) postResults(c+1) = dst%relaxationrate_max(of)
c = c + 1_pInt c = c + 1_pInt
end select end select