From f6c0f7062e59cb17b67e0923af0c41de80ca11ba Mon Sep 17 00:00:00 2001
From: Pratheek Shanthraj
Date: Mon, 22 Sep 2014 20:36:55 +0000
Subject: [PATCH] moved field initialization from homogenization to material
since it is needed in crystallite
---
code/homogenization.f90 | 40 +-------------------------------
code/material.f90 | 51 ++++++++++++++++++++++++++++++++++-------
2 files changed, 44 insertions(+), 47 deletions(-)
diff --git a/code/homogenization.f90 b/code/homogenization.f90
index 2a34372fb..b43391f86 100644
--- a/code/homogenization.f90
+++ b/code/homogenization.f90
@@ -118,7 +118,7 @@ subroutine homogenization_init()
implicit none
integer(pInt), parameter :: FILEUNIT = 200_pInt
- integer(pInt) :: e,i,p,myInstance, NofMyField
+ integer(pInt) :: e,i,p,myInstance
integer(pInt), dimension(:,:), pointer :: thisSize
character(len=64), dimension(:,:), pointer :: thisOutput
character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready
@@ -173,44 +173,6 @@ subroutine homogenization_init()
endif
enddo
close(FILEUNIT)
-
- do p = 1,material_Nhomogenization
- NofMyField=count(material_homog==p)
-
- select case(field_damage_type(p))
-
- case (FIELD_DAMAGE_LOCAL_ID)
- fieldDamage(p)%sizeField = 0_pInt
- fieldDamage(p)%sizePostResults = 0_pInt
- allocate(fieldDamage(p)%field(fieldDamage(p)%sizeField,NofMyField), source = 1.0_pReal)
-
- case (FIELD_DAMAGE_NONLOCAL_ID)
- fieldDamage(p)%sizeField = 1_pInt
- fieldDamage(p)%sizePostResults = 1_pInt
- allocate(fieldDamage(p)%field(fieldDamage(p)%sizeField,NofMyField), source = 1.0_pReal)
-
- end select
- enddo
-
- do p = 1,material_Nhomogenization
- NofMyField=count(material_homog==p)
-
- select case(field_thermal_type(p))
-
- case (FIELD_THERMAL_ADIABATIC_ID)
- fieldThermal(p)%sizeField = 0_pInt
- fieldThermal(p)%sizePostResults = 0_pInt
- allocate(fieldThermal(p)%field(fieldThermal(p)%sizeField,NofMyField), &
- source = 273.0_pReal) ! ToDo: temporary fix for now
-
- case (FIELD_THERMAL_CONDUCTION_ID)
- fieldThermal(p)%sizeField = 1_pInt
- fieldThermal(p)%sizePostResults = 1_pInt
- allocate(fieldThermal(p)%field(fieldThermal(p)%sizeField,NofMyField), &
- source = 273.0_pReal) ! ToDo: temporary fix for now
-
- end select
- enddo
!--------------------------------------------------------------------------------------------------
! allocate and initialize global variables
diff --git a/code/material.f90 b/code/material.f90
index 4be9718c6..4a07a9dff 100644
--- a/code/material.f90
+++ b/code/material.f90
@@ -199,11 +199,6 @@ module material
integer(pInt), dimension(:,:,:), allocatable, public, protected :: mappingCrystallite
integer(pInt), dimension(:,:,:), allocatable, public, protected :: mappingHomogenization
- integer(pInt), dimension(:), allocatable :: ConstitutivePosition
- integer(pInt), dimension(:), allocatable :: CrystallitePosition
- integer(pInt), dimension(:), allocatable :: HomogenizationPosition
-
-
public :: &
material_init, &
ELASTICITY_hooke_ID ,&
@@ -271,7 +266,13 @@ subroutine material_init
g, & !< grain number
i, & !< integration point number
e, & !< element number
- phase
+ phase, &
+ homog, &
+ NofMyField
+ integer(pInt), dimension(:), allocatable :: ConstitutivePosition
+ integer(pInt), dimension(:), allocatable :: CrystallitePosition
+ integer(pInt), dimension(:), allocatable :: HomogenizationPosition
+
myDebug = debug_level(debug_material)
write(6,'(/,a)') ' <<<+- material init -+>>>'
@@ -359,6 +360,40 @@ subroutine material_init
enddo IPloop
enddo ElemLoop
+ do homog = 1,material_Nhomogenization
+ NofMyField=count(material_homog==homog)
+ select case(field_damage_type(homog))
+ case (FIELD_DAMAGE_LOCAL_ID)
+ fieldDamage(homog)%sizeField = 0_pInt
+ fieldDamage(homog)%sizePostResults = 0_pInt
+ allocate(fieldDamage(homog)%field(fieldDamage(homog)%sizeField,NofMyField), source = 1.0_pReal)
+
+ case (FIELD_DAMAGE_NONLOCAL_ID)
+ fieldDamage(homog)%sizeField = 1_pInt
+ fieldDamage(homog)%sizePostResults = 1_pInt
+ allocate(fieldDamage(homog)%field(fieldDamage(homog)%sizeField,NofMyField), source = 1.0_pReal)
+
+ end select
+ enddo
+
+ do homog = 1,material_Nhomogenization
+ NofMyField=count(material_homog==homog)
+ select case(field_thermal_type(homog))
+ case (FIELD_THERMAL_ADIABATIC_ID)
+ fieldThermal(homog)%sizeField = 0_pInt
+ fieldThermal(homog)%sizePostResults = 0_pInt
+ allocate(fieldThermal(homog)%field(fieldThermal(homog)%sizeField,NofMyField), &
+ source = 300.0_pReal) ! ToDo: temporary fix for now
+
+ case (FIELD_THERMAL_CONDUCTION_ID)
+ fieldThermal(homog)%sizeField = 1_pInt
+ fieldThermal(homog)%sizePostResults = 1_pInt
+ allocate(fieldThermal(homog)%field(fieldThermal(homog)%sizeField,NofMyField), &
+ source = 300.0_pReal) ! ToDo: temporary fix for now
+
+ end select
+ enddo
+
end subroutine material_init
@@ -989,9 +1024,9 @@ subroutine material_populateGrains
real(pReal), dimension (3) :: orientation
real(pReal), dimension (3,3) :: symOrientation
integer(pInt), dimension (:), allocatable :: phaseOfGrain, textureOfGrain
- integer(pInt) :: t,e,i,ii,g,j,m,c,r,homog,micro,sgn,hme, myDebug, &
+ integer(pInt) :: t,e,i,g,j,m,c,r,homog,micro,sgn,hme, myDebug, &
phaseID,textureID,dGrains,myNgrains,myNorientations,myNconstituents, &
- grain,constituentGrain,ipGrain,symExtension, ip, HomogInstType
+ grain,constituentGrain,ipGrain,symExtension, ip
real(pReal) :: extreme,rnd
integer(pInt), dimension (:,:), allocatable :: Nelems ! counts number of elements in homog, micro array
type(p_intvec), dimension (:,:), allocatable :: elemsOfHomogMicro ! lists element number in homog, micro array