DAMASK_EICMD/src/homogenization_mech_isostra...

119 lines
4.8 KiB
Fortran
Raw Normal View History

!--------------------------------------------------------------------------------------------------
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Isostrain (full constraint Taylor assuption) homogenization scheme
!--------------------------------------------------------------------------------------------------
submodule(homogenization) homogenization_mech_isostrain
2020-03-17 12:47:14 +05:30
enum, bind(c); enumerator :: &
parallel_ID, &
average_ID
2019-04-06 00:18:20 +05:30
end enum
type :: tParameters !< container type for internal constitutive parameters
2019-04-06 00:18:20 +05:30
integer :: &
Nconstituents
integer(kind(average_ID)) :: &
mapping
end type
type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance)
contains
!--------------------------------------------------------------------------------------------------
!> @brief allocates all neccessary fields, reads information from material configuration file
!--------------------------------------------------------------------------------------------------
2020-07-02 01:50:22 +05:30
module subroutine mech_isostrain_init
2019-05-15 02:42:32 +05:30
2019-04-06 00:18:20 +05:30
integer :: &
Ninstance, &
h, &
NofMyHomog
2020-08-15 19:32:10 +05:30
class(tNode), pointer :: &
material_homogenization, &
homog, &
homogMech
2020-09-18 02:27:56 +05:30
print'(/,a)', ' <<<+- homogenization_mech_isostrain init -+>>>'
2019-04-06 00:18:20 +05:30
Ninstance = count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID)
print'(a,i2)', ' # instances: ',Ninstance; flush(OUTPUT_UNIT)
2019-04-06 00:18:20 +05:30
allocate(param(Ninstance)) ! one container of parameters per instance
2020-08-15 19:32:10 +05:30
material_homogenization => config_material%get('homogenization')
2019-04-06 00:18:20 +05:30
do h = 1, size(homogenization_type)
if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle
2020-08-15 19:32:10 +05:30
homog => material_homogenization%get(h)
homogMech => homog%get('mech')
associate(prm => param(homogenization_typeInstance(h)))
2020-08-15 19:32:10 +05:30
prm%Nconstituents = homogMech%get_asInt('N_constituents')
select case(homogMech%get_asString('mapping',defaultVal = 'sum'))
2019-04-06 00:18:20 +05:30
case ('sum')
prm%mapping = parallel_ID
case ('avg')
prm%mapping = average_ID
case default
2020-08-15 19:32:10 +05:30
call IO_error(211,ext_msg='sum'//' (mech_isostrain)')
2019-04-06 00:18:20 +05:30
end select
2019-04-06 00:18:20 +05:30
NofMyHomog = count(material_homogenizationAt == h)
homogState(h)%sizeState = 0
allocate(homogState(h)%state0 (0,NofMyHomog))
allocate(homogState(h)%subState0(0,NofMyHomog))
allocate(homogState(h)%state (0,NofMyHomog))
2019-04-06 00:18:20 +05:30
end associate
2019-04-06 00:18:20 +05:30
enddo
end subroutine mech_isostrain_init
!--------------------------------------------------------------------------------------------------
!> @brief partitions the deformation gradient onto the constituents
!--------------------------------------------------------------------------------------------------
module subroutine mech_isostrain_partitionDeformation(F,avgF)
2019-04-06 00:18:20 +05:30
real(pReal), dimension (:,:,:), intent(out) :: F !< partitioned deformation gradient
2019-04-06 00:18:20 +05:30
real(pReal), dimension (3,3), intent(in) :: avgF !< average deformation gradient at material point
2019-04-06 00:18:20 +05:30
F = spread(avgF,3,size(F,3))
end subroutine mech_isostrain_partitionDeformation
!--------------------------------------------------------------------------------------------------
!> @brief derive average stress and stiffness from constituent quantities
!--------------------------------------------------------------------------------------------------
module subroutine mech_isostrain_averageStressAndItsTangent(avgP,dAvgPdAvgF,P,dPdF,instance)
2019-04-06 00:18:20 +05:30
real(pReal), dimension (3,3), intent(out) :: avgP !< average stress at material point
real(pReal), dimension (3,3,3,3), intent(out) :: dAvgPdAvgF !< average stiffness at material point
2019-04-06 00:18:20 +05:30
real(pReal), dimension (:,:,:), intent(in) :: P !< partitioned stresses
real(pReal), dimension (:,:,:,:,:), intent(in) :: dPdF !< partitioned stiffnesses
integer, intent(in) :: instance
2019-04-06 00:18:20 +05:30
associate(prm => param(instance))
2019-04-06 00:18:20 +05:30
select case (prm%mapping)
case (parallel_ID)
avgP = sum(P,3)
dAvgPdAvgF = sum(dPdF,5)
case (average_ID)
avgP = sum(P,3) /real(prm%Nconstituents,pReal)
dAvgPdAvgF = sum(dPdF,5)/real(prm%Nconstituents,pReal)
end select
2019-04-06 00:18:20 +05:30
end associate
end subroutine mech_isostrain_averageStressAndItsTangent
end submodule homogenization_mech_isostrain