more work on field state.

This commit is contained in:
Luv Sharma 2014-09-04 16:11:00 +00:00
parent 6612603a23
commit a7741457b9
2 changed files with 49 additions and 18 deletions

View File

@ -120,7 +120,7 @@ subroutine homogenization_init()
implicit none implicit none
integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt), parameter :: FILEUNIT = 200_pInt
integer(pInt) :: e,i,p,myInstance integer(pInt) :: e,i,p,myInstance, NofMyField
integer(pInt), dimension(:,:), pointer :: thisSize integer(pInt), dimension(:,:), pointer :: thisSize
character(len=64), dimension(:,:), pointer :: thisOutput character(len=64), dimension(:,:), pointer :: thisOutput
character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready
@ -176,6 +176,44 @@ subroutine homogenization_init()
enddo enddo
close(FILEUNIT) close(FILEUNIT)
#ifdef NEWSTATE
do p = 1,material_Nhomogenization
NofMyField=count(material_homog==p)
select case(field_damage_type(p))
case (FIELD_DAMAGE_LOCAL_ID)
fieldDamage(p)%sizeState = 0_pInt
fieldDamage(p)%sizePostResults = 0_pInt
allocate(fieldDamage(p)%state(fieldDamage(p)%sizeState,NofMyField), source = 1.0_pReal)
case (FIELD_DAMAGE_NONLOCAL_ID)
fieldDamage(p)%sizeState = 1_pInt
fieldDamage(p)%sizePostResults = 1_pInt
allocate(fieldDamage(p)%state(fieldDamage(p)%sizeState,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)%sizeState = 0_pInt
fieldThermal(p)%sizePostResults = 0_pInt
allocate(fieldThermal(p)%state(fieldThermal(p)%sizeState,NofMyField), source = 1.0_pReal)
case (FIELD_THERMAL_CONDUCTION_ID)
fieldThermal(p)%sizeState = 1_pInt
fieldThermal(p)%sizePostResults = 1_pInt
allocate(fieldThermal(p)%state(fieldThermal(p)%sizeState,NofMyField), source = 1.0_pReal)
end select
enddo
#endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate and initialize global variables ! allocate and initialize global variables
#ifndef NEWSTATE #ifndef NEWSTATE

View File

@ -33,15 +33,10 @@ module material
#ifdef NEWSTATE #ifdef NEWSTATE
LOCAL_DAMAGE_NONE_label = 'none', & LOCAL_DAMAGE_NONE_label = 'none', &
LOCAL_DAMAGE_BRITTLE_label = 'brittle', & LOCAL_DAMAGE_BRITTLE_label = 'brittle', &
LOCAL_THERMAL_NONE_label = 'none', & LOCAL_THERMAL_NONE_label = 'none', &
LOCAL_THERMAL_HEATGEN_label = 'heatgen', & LOCAL_THERMAL_HEATGEN_label = 'heatgen', &
FIELD_DAMAGE_NONE_label = 'none', &
FIELD_DAMAGE_LOCAL_label = 'local', & FIELD_DAMAGE_LOCAL_label = 'local', &
FIELD_DAMAGE_NONLOCAL_label = 'nonlocal', & FIELD_DAMAGE_NONLOCAL_label = 'nonlocal', &
FIELD_THERMAL_NONE_label = 'none', &
FIELD_THERMAL_ADIABATIC_label = 'adiabatic', & FIELD_THERMAL_ADIABATIC_label = 'adiabatic', &
FIELD_THERMAL_CONDUCTION_label = 'conduction', & FIELD_THERMAL_CONDUCTION_label = 'conduction', &
@ -84,14 +79,12 @@ module material
LOCAL_THERMAL_HEATGEN_ID LOCAL_THERMAL_HEATGEN_ID
end enum end enum
enum, bind(c) enum, bind(c)
enumerator :: FIELD_DAMAGE_NONE_ID, & enumerator :: FIELD_DAMAGE_LOCAL_ID ,&
FIELD_DAMAGE_LOCAL_ID ,&
FIELD_DAMAGE_NONLOCAL_ID FIELD_DAMAGE_NONLOCAL_ID
end enum end enum
enum, bind(c) enum, bind(c)
enumerator :: FIELD_THERMAL_NONE_ID, & enumerator :: FIELD_THERMAL_ADIABATIC_ID, &
FIELD_THERMAL_ADIABATIC_ID, &
FIELD_THERMAL_CONDUCTION_ID FIELD_THERMAL_CONDUCTION_ID
end enum end enum
#else #else
@ -132,9 +125,9 @@ module material
phase_damage !< local damage of each phase phase_damage !< local damage of each phase
integer(kind(LOCAL_THERMAL_none_ID)), dimension(:), allocatable, public, protected :: & integer(kind(LOCAL_THERMAL_none_ID)), dimension(:), allocatable, public, protected :: &
phase_thermal !< local thermal of each phase phase_thermal !< local thermal of each phase
integer(kind(FIELD_DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & integer(kind(FIELD_DAMAGE_LOCAL_ID)), dimension(:), allocatable, public, protected :: &
field_damage_type !< field damage of each phase field_damage_type !< field damage of each phase
integer(kind(FIELD_THERMAL_none_ID)), dimension(:), allocatable, public, protected :: & integer(kind(FIELD_THERMAL_ADIABATIC_ID)), dimension(:), allocatable, public, protected :: &
field_thermal_type !< field thermal of each phase field_thermal_type !< field thermal of each phase
#else #else
integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: &
@ -268,6 +261,10 @@ module material
LOCAL_DAMAGE_brittle_ID, & LOCAL_DAMAGE_brittle_ID, &
LOCAL_THERMAL_none_ID, & LOCAL_THERMAL_none_ID, &
LOCAL_THERMAL_heatgen_ID, & LOCAL_THERMAL_heatgen_ID, &
FIELD_DAMAGE_LOCAL_ID, &
FIELD_DAMAGE_NONLOCAL_ID, &
FIELD_THERMAL_ADIABATIC_ID, &
FIELD_THERMAL_CONDUCTION_ID, &
#else #else
DAMAGE_none_ID, & DAMAGE_none_ID, &
DAMAGE_local_ID, & DAMAGE_local_ID, &
@ -462,8 +459,8 @@ subroutine material_parseHomogenization(fileUnit,myPart)
allocate(homogenization_name(Nsections)); homogenization_name = '' allocate(homogenization_name(Nsections)); homogenization_name = ''
allocate(homogenization_type(Nsections), source=HOMOGENIZATION_undefined_ID) allocate(homogenization_type(Nsections), source=HOMOGENIZATION_undefined_ID)
#ifdef NEWSTATE #ifdef NEWSTATE
allocate(FIELD_DAMAGE_type(Nsections), source=FIELD_DAMAGE_none_ID) allocate(FIELD_DAMAGE_type(Nsections), source=FIELD_DAMAGE_LOCAL_ID)
allocate(FIELD_THERMAL_type(Nsections), source=FIELD_THERMAL_none_ID) allocate(FIELD_THERMAL_type(Nsections), source=FIELD_THERMAL_ADIABATIC_ID)
#endif #endif
allocate(homogenization_typeInstance(Nsections), source=0_pInt) allocate(homogenization_typeInstance(Nsections), source=0_pInt)
allocate(homogenization_Ngrains(Nsections), source=0_pInt) allocate(homogenization_Ngrains(Nsections), source=0_pInt)
@ -514,8 +511,6 @@ subroutine material_parseHomogenization(fileUnit,myPart)
#ifdef NEWSTATE #ifdef NEWSTATE
case ('field_damage') case ('field_damage')
select case (IO_lc(IO_stringValue(line,positions,2_pInt))) select case (IO_lc(IO_stringValue(line,positions,2_pInt)))
case(FIELD_DAMAGE_NONE_label)
FIELD_DAMAGE_type(section) = FIELD_DAMAGE_NONE_ID
case(FIELD_DAMAGE_LOCAL_label) case(FIELD_DAMAGE_LOCAL_label)
FIELD_DAMAGE_type(section) = FIELD_DAMAGE_LOCAL_ID FIELD_DAMAGE_type(section) = FIELD_DAMAGE_LOCAL_ID
case(FIELD_DAMAGE_NONLOCAL_label) case(FIELD_DAMAGE_NONLOCAL_label)
@ -526,8 +521,6 @@ subroutine material_parseHomogenization(fileUnit,myPart)
case ('field_thermal') case ('field_thermal')
select case (IO_lc(IO_stringValue(line,positions,2_pInt))) select case (IO_lc(IO_stringValue(line,positions,2_pInt)))
case(FIELD_THERMAL_NONE_label)
FIELD_THERMAL_type(section) = FIELD_THERMAL_NONE_ID
case(FIELD_THERMAL_ADIABATIC_label) case(FIELD_THERMAL_ADIABATIC_label)
FIELD_THERMAL_type(section) = FIELD_THERMAL_ADIABATIC_ID FIELD_THERMAL_type(section) = FIELD_THERMAL_ADIABATIC_ID
case(FIELD_THERMAL_CONDUCTION_label) case(FIELD_THERMAL_CONDUCTION_label)