standard style from plasticity
using derived type for parameters explicit "use" to see dependencies
This commit is contained in:
parent
11a7103675
commit
331eaabaa4
|
@ -9,17 +9,19 @@ module homogenization_isostrain
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
private
|
private
|
||||||
integer(pInt), dimension(:), allocatable, private :: &
|
|
||||||
homogenization_isostrain_Ngrains
|
|
||||||
|
|
||||||
enum, bind(c)
|
enum, bind(c)
|
||||||
enumerator :: parallel_ID, &
|
enumerator :: parallel_ID, &
|
||||||
average_ID
|
average_ID
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
integer(kind(average_ID)), dimension(:), allocatable, private :: &
|
type, private :: tParameters !< container type for internal constitutive parameters
|
||||||
homogenization_isostrain_mapping !< mapping type
|
integer(pInt) :: &
|
||||||
|
Nconstituents
|
||||||
|
integer(kind(average_ID)) :: &
|
||||||
|
mapping
|
||||||
|
end type
|
||||||
|
|
||||||
|
type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance)
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
homogenization_isostrain_init, &
|
homogenization_isostrain_init, &
|
||||||
|
@ -43,9 +45,19 @@ subroutine homogenization_isostrain_init()
|
||||||
debug_HOMOGENIZATION, &
|
debug_HOMOGENIZATION, &
|
||||||
debug_level, &
|
debug_level, &
|
||||||
debug_levelBasic
|
debug_levelBasic
|
||||||
use IO
|
use IO, only: &
|
||||||
use material
|
IO_timeStamp, &
|
||||||
use config
|
IO_error, &
|
||||||
|
IO_warning
|
||||||
|
use material, only: &
|
||||||
|
homogenization_type, &
|
||||||
|
material_homog, &
|
||||||
|
homogState, &
|
||||||
|
HOMOGENIZATION_ISOSTRAIN_ID, &
|
||||||
|
HOMOGENIZATION_ISOSTRAIN_LABEL, &
|
||||||
|
homogenization_typeInstance
|
||||||
|
use config, only: &
|
||||||
|
config_homogenization
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
|
@ -57,6 +69,7 @@ subroutine homogenization_isostrain_init()
|
||||||
NofMyHomog ! no pInt (stores a system dependen value from 'count'
|
NofMyHomog ! no pInt (stores a system dependen value from 'count'
|
||||||
character(len=65536) :: &
|
character(len=65536) :: &
|
||||||
tag = ''
|
tag = ''
|
||||||
|
type(tParameters) :: prm
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_ISOSTRAIN_label//' init -+>>>'
|
write(6,'(/,a)') ' <<<+- homogenization_'//HOMOGENIZATION_ISOSTRAIN_label//' init -+>>>'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
|
@ -68,21 +81,21 @@ subroutine homogenization_isostrain_init()
|
||||||
if (iand(debug_level(debug_HOMOGENIZATION),debug_levelBasic) /= 0_pInt) &
|
if (iand(debug_level(debug_HOMOGENIZATION),debug_levelBasic) /= 0_pInt) &
|
||||||
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
||||||
|
|
||||||
allocate(homogenization_isostrain_Ngrains(maxNinstance),source=0_pInt)
|
allocate(param(maxNinstance)) ! one container of parameters per instance
|
||||||
allocate(homogenization_isostrain_mapping(maxNinstance),source=average_ID)
|
|
||||||
|
|
||||||
do h = 1_pInt, size(homogenization_type)
|
do h = 1_pInt, size(homogenization_type)
|
||||||
if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle
|
if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle
|
||||||
instance = homogenization_typeInstance(h)
|
instance = homogenization_typeInstance(h)
|
||||||
|
associate(prm => param(instance))
|
||||||
|
|
||||||
homogenization_isostrain_Ngrains(instance) = config_homogenization(h)%getInt('nconstituents')
|
prm%Nconstituents = config_homogenization(h)%getInt('nconstituents')
|
||||||
tag = 'sum'
|
tag = 'sum'
|
||||||
tag = config_homogenization(h)%getString('mapping',defaultVal = tag)
|
tag = config_homogenization(h)%getString('mapping',defaultVal = tag)
|
||||||
select case(trim(tag))
|
select case(trim(tag))
|
||||||
case ('parallel','sum')
|
case ('sum')
|
||||||
homogenization_isostrain_mapping(instance) = parallel_ID
|
prm%mapping = parallel_ID
|
||||||
case ('average','mean','avg')
|
case ('avg')
|
||||||
homogenization_isostrain_mapping(instance) = average_ID
|
prm%mapping = average_ID
|
||||||
case default
|
case default
|
||||||
call IO_error(211_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')')
|
call IO_error(211_pInt,ext_msg=trim(tag)//' ('//HOMOGENIZATION_isostrain_label//')')
|
||||||
end select
|
end select
|
||||||
|
@ -94,6 +107,7 @@ subroutine homogenization_isostrain_init()
|
||||||
allocate(homogState(h)%state0 (0_pInt,NofMyHomog), source=0.0_pReal)
|
allocate(homogState(h)%state0 (0_pInt,NofMyHomog), source=0.0_pReal)
|
||||||
allocate(homogState(h)%subState0(0_pInt,NofMyHomog), source=0.0_pReal)
|
allocate(homogState(h)%subState0(0_pInt,NofMyHomog), source=0.0_pReal)
|
||||||
allocate(homogState(h)%state (0_pInt,NofMyHomog), source=0.0_pReal)
|
allocate(homogState(h)%state (0_pInt,NofMyHomog), source=0.0_pReal)
|
||||||
|
end associate
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -110,16 +124,22 @@ subroutine homogenization_isostrain_partitionDeformation(F,avgF,el)
|
||||||
mesh_element
|
mesh_element
|
||||||
use material, only: &
|
use material, only: &
|
||||||
homogenization_maxNgrains, &
|
homogenization_maxNgrains, &
|
||||||
homogenization_Ngrains
|
homogenization_typeInstance
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), dimension (3,3,homogenization_maxNgrains), intent(out) :: F !< partioned def grad per grain
|
real(pReal), dimension (3,3,homogenization_maxNgrains), intent(out) :: F !< partioned def grad per grain
|
||||||
real(pReal), dimension (3,3), intent(in) :: avgF !< my average def grad
|
real(pReal), dimension (3,3), intent(in) :: avgF !< my average def grad
|
||||||
integer(pInt), intent(in) :: &
|
type(tParameters) :: &
|
||||||
el !< element number
|
prm
|
||||||
|
integer(pInt) :: &
|
||||||
|
el, &
|
||||||
|
instance
|
||||||
|
|
||||||
|
instance = homogenization_typeInstance(mesh_element(3,el))
|
||||||
|
associate(prm => param(instance))
|
||||||
F = 0.0_pReal
|
F = 0.0_pReal
|
||||||
F(1:3,1:3,1:homogenization_Ngrains(mesh_element(3,el))) = &
|
F(1:3,1:3,1:prm%Nconstituents) = spread(avgF,3,prm%Nconstituents)
|
||||||
spread(avgF,3,homogenization_Ngrains(mesh_element(3,el)))
|
end associate
|
||||||
|
|
||||||
end subroutine homogenization_isostrain_partitionDeformation
|
end subroutine homogenization_isostrain_partitionDeformation
|
||||||
|
|
||||||
|
@ -134,7 +154,6 @@ subroutine homogenization_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P
|
||||||
mesh_element
|
mesh_element
|
||||||
use material, only: &
|
use material, only: &
|
||||||
homogenization_maxNgrains, &
|
homogenization_maxNgrains, &
|
||||||
homogenization_Ngrains, &
|
|
||||||
homogenization_typeInstance
|
homogenization_typeInstance
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
@ -142,22 +161,23 @@ subroutine homogenization_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P
|
||||||
real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point
|
real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point
|
||||||
real(pReal), dimension (3,3,homogenization_maxNgrains), intent(in) :: P !< array of current grain stresses
|
real(pReal), dimension (3,3,homogenization_maxNgrains), intent(in) :: P !< array of current grain stresses
|
||||||
real(pReal), dimension (3,3,3,3,homogenization_maxNgrains), intent(in) :: dPdF !< array of current grain stiffnesses
|
real(pReal), dimension (3,3,3,3,homogenization_maxNgrains), intent(in) :: dPdF !< array of current grain stiffnesses
|
||||||
integer(pInt), intent(in) :: el !< element number
|
type(tParameters) :: &
|
||||||
|
prm
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
homID, &
|
el, &
|
||||||
Ngrains
|
instance
|
||||||
|
|
||||||
homID = homogenization_typeInstance(mesh_element(3,el))
|
instance = homogenization_typeInstance(mesh_element(3,el))
|
||||||
Ngrains = homogenization_Ngrains(mesh_element(3,el))
|
associate(prm => param(instance))
|
||||||
|
select case (prm%mapping)
|
||||||
select case (homogenization_isostrain_mapping(homID))
|
|
||||||
case (parallel_ID)
|
case (parallel_ID)
|
||||||
avgP = sum(P,3)
|
avgP = sum(P,3)
|
||||||
dAvgPdAvgF = sum(dPdF,5)
|
dAvgPdAvgF = sum(dPdF,5)
|
||||||
case (average_ID)
|
case (average_ID)
|
||||||
avgP = sum(P,3) /real(Ngrains,pReal)
|
avgP = sum(P,3) /real(prm%Nconstituents,pReal)
|
||||||
dAvgPdAvgF = sum(dPdF,5)/real(Ngrains,pReal)
|
dAvgPdAvgF = sum(dPdF,5)/real(prm%Nconstituents,pReal)
|
||||||
end select
|
end select
|
||||||
|
end associate
|
||||||
|
|
||||||
end subroutine homogenization_isostrain_averageStressAndItsTangent
|
end subroutine homogenization_isostrain_averageStressAndItsTangent
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue