(1) change phaseOfGrain from real to integer and (2) introducing a condition to switch off the grain reshuffling when element homogeneous is requested.

This commit is contained in:
Denny Tjahjanto 2010-02-18 15:54:10 +00:00
parent d60d8a4103
commit e9aac0c4af
1 changed files with 16 additions and 12 deletions

View File

@ -452,22 +452,24 @@ subroutine material_populateGrains()
!********************************************************************* !*********************************************************************
use prec, only: pInt, pReal use prec, only: pInt, pReal
use math, only: math_sampleRandomOri, math_sampleGaussOri, math_sampleFiberOri, math_symmetricEulers use math, only: math_sampleRandomOri, math_sampleGaussOri, math_sampleFiberOri, math_symmetricEulers, inDeg
use mesh, only: mesh_element, mesh_maxNips, mesh_NcpElems, mesh_ipVolume, FE_Nips use mesh, only: mesh_element, mesh_maxNips, mesh_NcpElems, mesh_ipVolume, FE_Nips
use IO, only: IO_error, IO_hybridIA use IO, only: IO_error, IO_hybridIA
implicit none implicit none
integer(pInt), dimension (:,:), allocatable :: Ngrains integer(pInt), dimension (:,:), allocatable :: Ngrains
integer(pInt), dimension (microstructure_maxNconstituents) :: NgrainsOfConstituent integer(pInt), dimension (microstructure_maxNconstituents) :: NgrainsOfConstituent
real(pReal), dimension (:), allocatable :: volumeOfGrain, phaseOfGrain real(pReal), dimension (:), allocatable :: volumeOfGrain
real(pReal), dimension (:,:), allocatable :: orientationOfGrain real(pReal), dimension (:,:), allocatable :: orientationOfGrain
real(pReal), dimension (3) :: orientation real(pReal), dimension (3) :: orientation
real(pReal), dimension (3,3) :: symOrientation real(pReal), dimension (3,3) :: symOrientation
integer(pInt), dimension (:), allocatable :: phaseOfGrain
integer(pInt) t,e,i,g,j,m,homog,micro,sgn integer(pInt) t,e,i,g,j,m,homog,micro,sgn
integer(pInt) phaseID,textureID,dGrains,myNgrains,myNorientations, & integer(pInt) phaseID,textureID,dGrains,myNgrains,myNorientations, &
grain,constituentGrain,symExtension grain,constituentGrain,symExtension
real(pReal) extreme,rnd real(pReal) extreme,rnd
allocate(material_volume(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; material_volume = 0.0_pReal allocate(material_volume(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; material_volume = 0.0_pReal
allocate(material_phase(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; material_phase = 0_pInt allocate(material_phase(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; material_phase = 0_pInt
allocate(material_EulerAngles(3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; material_EulerAngles = 0.0_pReal allocate(material_EulerAngles(3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems)) ; material_EulerAngles = 0.0_pReal
@ -604,16 +606,18 @@ subroutine material_populateGrains()
enddo ! constituent enddo ! constituent
! ---------------------------------------------------------------------------- ! ----------------------------------------------------------------------------
do i=1,myNgrains-1 ! walk thru grains if (.not. microstructure_elemhomo(micro)) then ! unless element homogeneous, reshuffle grains
call random_number(rnd) do i=1,myNgrains-1 ! walk thru grains
t = nint(rnd*(myNgrains-i)+i+0.5_pReal,pInt) ! select a grain in remaining list call random_number(rnd)
m = phaseOfGrain(t) ! exchange current with random t = nint(rnd*(myNgrains-i)+i+0.5_pReal,pInt) ! select a grain in remaining list
phaseOfGrain(t) = phaseOfGrain(i) m = phaseOfGrain(t) ! exchange current with random
phaseOfGrain(i) = m phaseOfGrain(t) = phaseOfGrain(i)
orientation = orientationOfGrain(:,t) phaseOfGrain(i) = m
orientationOfGrain(:,t) = orientationOfGrain(:,i) orientation = orientationOfGrain(:,t)
orientationOfGrain(:,i) = orientation orientationOfGrain(:,t) = orientationOfGrain(:,i)
enddo orientationOfGrain(:,i) = orientation
enddo
endif
!calc fraction after weighing with volumePerGrain !calc fraction after weighing with volumePerGrain
!exchange in MC steps to improve result... !exchange in MC steps to improve result...