modified reading in of values (realizes, if phase is not used in the model at all), started to include HDF5 output and new state
This commit is contained in:
parent
9b220c5c9a
commit
3fdf602acc
|
@ -9,6 +9,10 @@
|
||||||
!! untextured polycrystal
|
!! untextured polycrystal
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module constitutive_j2
|
module constitutive_j2
|
||||||
|
#ifdef HDF
|
||||||
|
use hdf5, only: &
|
||||||
|
HID_T
|
||||||
|
#endif
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pReal,&
|
pReal,&
|
||||||
pInt
|
pInt
|
||||||
|
@ -28,7 +32,6 @@ module constitutive_j2
|
||||||
|
|
||||||
integer(pInt), dimension(:), allocatable, private :: &
|
integer(pInt), dimension(:), allocatable, private :: &
|
||||||
constitutive_j2_Noutput !< number of outputs per instance
|
constitutive_j2_Noutput !< number of outputs per instance
|
||||||
|
|
||||||
real(pReal), dimension(:), allocatable, private :: &
|
real(pReal), dimension(:), allocatable, private :: &
|
||||||
constitutive_j2_fTaylor, & !< Taylor factor
|
constitutive_j2_fTaylor, & !< Taylor factor
|
||||||
constitutive_j2_tau0, & !< initial plastic stress
|
constitutive_j2_tau0, & !< initial plastic stress
|
||||||
|
@ -55,13 +58,26 @@ module constitutive_j2
|
||||||
end enum
|
end enum
|
||||||
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
|
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
|
||||||
constitutive_j2_outputID !< ID of each post result output
|
constitutive_j2_outputID !< ID of each post result output
|
||||||
|
|
||||||
|
#ifdef HDF
|
||||||
|
type constitutive_j2_tOutput
|
||||||
|
real(pReal), dimension(:), allocatable, private :: &
|
||||||
|
flowstress, &
|
||||||
|
strainrate
|
||||||
|
logical :: flowstressActive = .false., strainrateActive = .false. ! if we can write the output block wise, this is not needed anymore because we can do an if(allocated(xxx))
|
||||||
|
end type constitutive_j2_tOutput
|
||||||
|
type(constitutive_j2_tOutput), allocatable, dimension(:) :: constitutive_j2_Output2
|
||||||
|
integer(HID_T), allocatable, dimension(:) :: outID
|
||||||
|
#endif
|
||||||
public :: &
|
public :: &
|
||||||
constitutive_j2_init, &
|
constitutive_j2_init, &
|
||||||
constitutive_j2_stateInit, &
|
constitutive_j2_stateInit, &
|
||||||
constitutive_j2_aTolState, &
|
constitutive_j2_aTolState, &
|
||||||
constitutive_j2_LpAndItsTangent, &
|
constitutive_j2_LpAndItsTangent, &
|
||||||
constitutive_j2_dotState, &
|
constitutive_j2_dotState, &
|
||||||
|
#ifdef HDF
|
||||||
|
constitutive_j2_postResults2, &
|
||||||
|
#endif
|
||||||
constitutive_j2_postResults
|
constitutive_j2_postResults
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
@ -73,7 +89,10 @@ contains
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine constitutive_j2_init(fileUnit)
|
subroutine constitutive_j2_init(fileUnit)
|
||||||
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
|
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
|
||||||
use debug, only: &
|
#ifdef HDF
|
||||||
|
use hdf5
|
||||||
|
#endif
|
||||||
|
use debug, only: &
|
||||||
debug_level, &
|
debug_level, &
|
||||||
debug_constitutive, &
|
debug_constitutive, &
|
||||||
debug_levelBasic
|
debug_levelBasic
|
||||||
|
@ -90,6 +109,11 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
IO_floatValue, &
|
IO_floatValue, &
|
||||||
IO_error, &
|
IO_error, &
|
||||||
IO_timeStamp, &
|
IO_timeStamp, &
|
||||||
|
#ifdef HDF
|
||||||
|
tempResults, &
|
||||||
|
HDF5_addGroup, &
|
||||||
|
HDF5_addScalarDataset,&
|
||||||
|
#endif
|
||||||
IO_EOF
|
IO_EOF
|
||||||
use material, only: &
|
use material, only: &
|
||||||
homogenization_maxNgrains, &
|
homogenization_maxNgrains, &
|
||||||
|
@ -98,6 +122,7 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
phase_Noutput, &
|
phase_Noutput, &
|
||||||
PLASTICITY_J2_label, &
|
PLASTICITY_J2_label, &
|
||||||
PLASTICITY_J2_ID, &
|
PLASTICITY_J2_ID, &
|
||||||
|
material_phase,&
|
||||||
MATERIAL_partPhase
|
MATERIAL_partPhase
|
||||||
use lattice
|
use lattice
|
||||||
|
|
||||||
|
@ -107,10 +132,15 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
integer(pInt), parameter :: MAXNCHUNKS = 7_pInt
|
integer(pInt), parameter :: MAXNCHUNKS = 7_pInt
|
||||||
|
|
||||||
integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions
|
integer(pInt), dimension(1_pInt+2_pInt*MAXNCHUNKS) :: positions
|
||||||
integer(pInt) :: phase, maxNinstance, instance,o, mySize
|
integer(pInt) :: phase, maxNinstance, instance,o, mySize, myConstituents
|
||||||
character(len=65536) :: &
|
character(len=65536) :: &
|
||||||
tag = '', &
|
tag = '', &
|
||||||
line = ''
|
line = ''
|
||||||
|
#ifdef HDF
|
||||||
|
character(len=5) :: &
|
||||||
|
str1
|
||||||
|
integer(HID_T) :: ID,ID2,ID4
|
||||||
|
#endif
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_J2_label//' init -+>>>'
|
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_J2_label//' init -+>>>'
|
||||||
write(6,'(a)') ' $Id$'
|
write(6,'(a)') ' $Id$'
|
||||||
|
@ -120,6 +150,11 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
maxNinstance = int(count(phase_plasticity == PLASTICITY_J2_ID),pInt)
|
maxNinstance = int(count(phase_plasticity == PLASTICITY_J2_ID),pInt)
|
||||||
if (maxNinstance == 0_pInt) return
|
if (maxNinstance == 0_pInt) return
|
||||||
|
|
||||||
|
#ifdef HDF
|
||||||
|
allocate(constitutive_j2_Output2(maxNinstance))
|
||||||
|
allocate(outID(maxNinstance))
|
||||||
|
#endif
|
||||||
|
|
||||||
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
||||||
|
|
||||||
|
@ -151,7 +186,7 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
line = IO_read(fileUnit)
|
line = IO_read(fileUnit)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
|
||||||
line = IO_read(fileUnit)
|
line = IO_read(fileUnit)
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
||||||
|
@ -159,16 +194,25 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next section
|
if (IO_getTag(line,'[',']') /= '') then ! next section
|
||||||
|
myConstituents = 0_pInt
|
||||||
phase = phase + 1_pInt ! advance section counter
|
phase = phase + 1_pInt ! advance section counter
|
||||||
if (phase_plasticity(phase) == PLASTICITY_J2_ID) then
|
if (phase_plasticity(phase) == PLASTICITY_J2_ID) then
|
||||||
instance = phase_plasticityInstance(phase)
|
instance = phase_plasticityInstance(phase)
|
||||||
|
myConstituents = count(material_phase==phase)
|
||||||
|
#ifdef HDF
|
||||||
|
outID(instance)=HDF5_addGroup(str1,tempResults)
|
||||||
|
#endif
|
||||||
|
#ifdef NEWSTATE
|
||||||
|
allocate(plasticState(phase)%s(1,myConstituents)) ! initialize state (like stateInit)
|
||||||
|
#endif
|
||||||
endif
|
endif
|
||||||
cycle ! skip to next line
|
cycle ! skip to next line
|
||||||
endif
|
endif
|
||||||
if (phase > 0_pInt ) then; if (phase_plasticity(phase) == PLASTICITY_J2_ID) then ! one of my sections. Do not short-circuit here (.and. between if-statements), it's not safe in Fortran
|
if (myConstituents > 0_pInt ) then
|
||||||
instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase
|
instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,MAXNCHUNKS)
|
positions = IO_stringPos(line,MAXNCHUNKS)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
|
||||||
select case(tag)
|
select case(tag)
|
||||||
case ('plasticity','elasticity','lattice_structure', &
|
case ('plasticity','elasticity','lattice_structure', &
|
||||||
'covera_ratio','c/a_ratio','c/a', &
|
'covera_ratio','c/a_ratio','c/a', &
|
||||||
|
@ -180,8 +224,19 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
select case(IO_lc(IO_stringValue(line,positions,2_pInt)))
|
select case(IO_lc(IO_stringValue(line,positions,2_pInt)))
|
||||||
case ('flowstress')
|
case ('flowstress')
|
||||||
constitutive_j2_outputID(constitutive_j2_Noutput(instance),instance) = flowstress_ID
|
constitutive_j2_outputID(constitutive_j2_Noutput(instance),instance) = flowstress_ID
|
||||||
|
#ifdef HDF
|
||||||
|
call HDF5_addScalarDataset(outID(instance),a,'flowstress','MPa')
|
||||||
|
allocate(constitutive_j2_Output2(instance)%flowstress(a))
|
||||||
|
constitutive_j2_Output2(instance)%flowstressActive = .true.
|
||||||
|
#endif
|
||||||
case ('strainrate')
|
case ('strainrate')
|
||||||
constitutive_j2_outputID(constitutive_j2_Noutput(instance),instance) = strainrate_ID
|
constitutive_j2_outputID(constitutive_j2_Noutput(instance),instance) = strainrate_ID
|
||||||
|
#ifdef HDF
|
||||||
|
call HDF5_addScalarDataset(outID(instance),a,'strainrate','1/s')
|
||||||
|
allocate(constitutive_j2_Output2(instance)%strainrate(a))
|
||||||
|
constitutive_j2_Output2(instance)%strainrateActive = .true.
|
||||||
|
#endif
|
||||||
|
|
||||||
case default
|
case default
|
||||||
call IO_error(105_pInt,ext_msg=IO_stringValue(line,positions,2_pInt)//' ('//PLASTICITY_J2_label//')')
|
call IO_error(105_pInt,ext_msg=IO_stringValue(line,positions,2_pInt)//' ('//PLASTICITY_J2_label//')')
|
||||||
end select
|
end select
|
||||||
|
@ -228,28 +283,30 @@ subroutine constitutive_j2_init(fileUnit)
|
||||||
case default
|
case default
|
||||||
call IO_error(210_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')')
|
call IO_error(210_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_J2_label//')')
|
||||||
end select
|
end select
|
||||||
endif; endif
|
endif
|
||||||
enddo parsingFile
|
enddo parsingFile
|
||||||
|
|
||||||
instancesLoop: do instance = 1_pInt,maxNinstance
|
initializeInstances: do phase = 1_pInt, size(phase_plasticity)
|
||||||
outputsLoop: do o = 1_pInt,constitutive_j2_Noutput(instance)
|
if (phase_plasticity(phase) == PLASTICITY_j2_ID .and. count(material_phase==phase)/=0) then
|
||||||
select case(constitutive_j2_outputID(o,instance))
|
outputsLoop: do o = 1_pInt,constitutive_j2_Noutput(instance)
|
||||||
case(flowstress_ID,strainrate_ID)
|
select case(constitutive_j2_outputID(o,instance))
|
||||||
mySize = 1_pInt
|
case(flowstress_ID,strainrate_ID)
|
||||||
case default
|
mySize = 1_pInt
|
||||||
end select
|
case default
|
||||||
|
end select
|
||||||
|
|
||||||
if (mySize > 0_pInt) then ! any meaningful output found
|
if (mySize > 0_pInt) then ! any meaningful output found
|
||||||
constitutive_j2_sizePostResult(o,instance) = mySize
|
constitutive_j2_sizePostResult(o,instance) = mySize
|
||||||
constitutive_j2_sizePostResults(instance) = &
|
constitutive_j2_sizePostResults(instance) = &
|
||||||
constitutive_j2_sizePostResults(instance) + mySize
|
constitutive_j2_sizePostResults(instance) + mySize
|
||||||
endif
|
endif
|
||||||
enddo outputsLoop
|
enddo outputsLoop
|
||||||
enddo instancesLoop
|
endif
|
||||||
|
enddo initializeInstances
|
||||||
|
|
||||||
end subroutine constitutive_j2_init
|
end subroutine constitutive_j2_init
|
||||||
|
|
||||||
|
! probably not needed for new state
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets the initial microstructural state for a given instance of this plasticity
|
!> @brief sets the initial microstructural state for a given instance of this plasticity
|
||||||
!> @details initial microstructural state is set to the value specified by tau0
|
!> @details initial microstructural state is set to the value specified by tau0
|
||||||
|
@ -262,6 +319,7 @@ pure function constitutive_j2_stateInit(instance)
|
||||||
|
|
||||||
constitutive_j2_stateInit = constitutive_j2_tau0(instance)
|
constitutive_j2_stateInit = constitutive_j2_tau0(instance)
|
||||||
|
|
||||||
|
|
||||||
end function constitutive_j2_stateInit
|
end function constitutive_j2_stateInit
|
||||||
|
|
||||||
|
|
||||||
|
@ -439,7 +497,56 @@ pure function constitutive_j2_dotState(Tstar_v,state,ipc,ip,el)
|
||||||
|
|
||||||
end function constitutive_j2_dotState
|
end function constitutive_j2_dotState
|
||||||
|
|
||||||
|
#ifdef HDF
|
||||||
|
subroutine constitutive_j2_postResults2(Tstar_v,state,ipc,ip,el,offset)
|
||||||
|
use prec, only: &
|
||||||
|
p_vec
|
||||||
|
use material, only: &
|
||||||
|
material_phase, &
|
||||||
|
phase_plasticityInstance
|
||||||
|
use math, only: &
|
||||||
|
math_mul6x6
|
||||||
|
implicit none
|
||||||
|
real(pReal), dimension(6), intent(in) :: &
|
||||||
|
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
|
||||||
|
integer(pInt), intent(in) :: &
|
||||||
|
ipc, & !< component-ID of integration point
|
||||||
|
ip, & !< integration point
|
||||||
|
el, &
|
||||||
|
offset !< element
|
||||||
|
type(p_vec), intent(in) :: &
|
||||||
|
state
|
||||||
|
!< microstructure state
|
||||||
|
|
||||||
|
real(pReal), dimension(6) :: &
|
||||||
|
Tstar_dev_v ! deviatoric part of the 2nd Piola Kirchhoff stress tensor in Mandel notation
|
||||||
|
real(pReal) :: &
|
||||||
|
norm_Tstar_dev ! euclidean norm of Tstar_dev
|
||||||
|
integer(pInt) :: &
|
||||||
|
instance
|
||||||
|
|
||||||
|
|
||||||
|
instance = phase_plasticityInstance(material_phase(ipc,ip,el))
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! calculate deviatoric part of 2nd Piola-Kirchhoff stress and its norm
|
||||||
|
Tstar_dev_v(1:3) = Tstar_v(1:3) - sum(Tstar_v(1:3))/3.0_pReal
|
||||||
|
Tstar_dev_v(4:6) = Tstar_v(4:6)
|
||||||
|
norm_Tstar_dev = sqrt(math_mul6x6(Tstar_dev_v,Tstar_dev_v))
|
||||||
|
|
||||||
|
|
||||||
|
if(constitutive_j2_Output2(instance)%flowstressActive) &
|
||||||
|
constitutive_j2_Output2(instance)%flowstress(offset) =state%p(1)
|
||||||
|
if(constitutive_j2_Output2(instance)%strainrateActive) then
|
||||||
|
constitutive_j2_Output2(instance)%strainrate(offset)= &
|
||||||
|
constitutive_j2_gdot0(instance) * ( sqrt(1.5_pReal) * norm_Tstar_dev &
|
||||||
|
/ &!----------------------------------------------------------------------------------
|
||||||
|
(constitutive_j2_fTaylor(instance) * state%p(1)) ) ** constitutive_j2_n(instance)
|
||||||
|
endif
|
||||||
|
|
||||||
|
end subroutine constitutive_j2_postResults2
|
||||||
|
|
||||||
|
#endif
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief return array of constitutive results
|
!> @brief return array of constitutive results
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -506,4 +613,5 @@ pure function constitutive_j2_postResults(Tstar_v,state,ipc,ip,el)
|
||||||
|
|
||||||
end function constitutive_j2_postResults
|
end function constitutive_j2_postResults
|
||||||
|
|
||||||
|
|
||||||
end module constitutive_j2
|
end module constitutive_j2
|
||||||
|
|
Loading…
Reference in New Issue