changed comments to doxygen style

This commit is contained in:
Martin Diehl 2012-08-10 15:58:17 +00:00
parent 08c7be7d15
commit cd0da03ebc
1 changed files with 307 additions and 317 deletions

View File

@ -16,49 +16,40 @@
! You should have received a copy of the GNU General Public License
! along with DAMASK. If not, see <http://www.gnu.org/licenses/>.
!
!##############################################################
!* $Id$
!***************************************
!* Module: HOMOGENIZATION *
!***************************************
!* contains: *
!* - _init *
!* - materialpoint_stressAndItsTangent *
!* - _partitionDeformation *
!* - _updateState *
!* - _averageStressAndItsTangent *
!* - _postResults *
!***************************************
!--------------------------------------------------------------------------------------------------
! $Id$
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @author Denny Tjahjanto, Max-Planck-Institut für Eisenforschung GmbH
!> @brief homogenization manager, organizing deformation partitioning and stress homogenization
!--------------------------------------------------------------------------------------------------
module homogenization
MODULE homogenization
!*** Include other modules ***
use prec, only: pInt,pReal,p_vec
use IO, only: IO_write_jobBinaryFile
!--------------------------------------------------------------------------------------------------
! General variables for the homogenization at a material point
implicit none
type(p_vec), dimension(:,:), allocatable :: homogenization_state0, & !< pointer array to homogenization state at start of FE increment
homogenization_subState0, & !< pointer array to homogenization state at start of homogenization increment
homogenization_state !< pointer array to current homogenization state (end of converged time step)
integer(pInt), dimension(:,:), allocatable :: homogenization_sizeState, & !< size of state array per grain
homogenization_sizePostResults !< size of postResults array per material point
! ****************************************************************
! *** General variables for the homogenization at a ***
! *** material point ***
! ****************************************************************
type(p_vec), dimension(:,:), allocatable :: homogenization_state0, & ! pointer array to homogenization state at start of FE increment
homogenization_subState0, & ! pointer array to homogenization state at start of homogenization increment
homogenization_state ! pointer array to current homogenization state (end of converged time step)
integer(pInt), dimension(:,:), allocatable :: homogenization_sizeState, & ! size of state array per grain
homogenization_sizePostResults ! size of postResults array per material point
real(pReal), dimension(:,:,:,:,:,:), allocatable :: materialpoint_dPdF ! tangent of first P--K stress at IP
real(pReal), dimension(:,:,:,:), allocatable :: materialpoint_F0, & ! def grad of IP at start of FE increment
materialpoint_F, & ! def grad of IP to be reached at end of FE increment
materialpoint_subF0, & ! def grad of IP at beginning of homogenization increment
materialpoint_subF, & ! def grad of IP to be reached at end of homog inc
materialpoint_P ! first P--K stress of IP
real(pReal), dimension(:,:), allocatable :: materialpoint_Temperature, & ! temperature at IP
real(pReal), dimension(:,:,:,:,:,:), allocatable :: materialpoint_dPdF !< tangent of first P--K stress at IP
real(pReal), dimension(:,:,:,:), allocatable :: materialpoint_F0, & !< def grad of IP at start of FE increment
materialpoint_F, & !< def grad of IP to be reached at end of FE increment
materialpoint_subF0, & !< def grad of IP at beginning of homogenization increment
materialpoint_subF, & !< def grad of IP to be reached at end of homog inc
materialpoint_P !< first P--K stress of IP
real(pReal), dimension(:,:), allocatable :: materialpoint_Temperature, & !< temperature at IP
materialpoint_subFrac, &
materialpoint_subStep, &
materialpoint_subdt
real(pReal), dimension(:,:,:), allocatable :: materialpoint_results ! results array of material point
real(pReal), dimension(:,:,:), allocatable :: materialpoint_results !< results array of material point
logical, dimension(:,:), allocatable :: materialpoint_requested, &
materialpoint_converged
@ -66,12 +57,23 @@ MODULE homogenization
integer(pInt) homogenization_maxSizeState, &
homogenization_maxSizePostResults, &
materialpoint_sizeResults
!--------------------------------------------------------------------------------------------------
! functions and subroutines in the module
public :: homogenization_init, &
materialpoint_stressAndItsTangent, &
materialpoint_postResults
private :: homogenization_partitionDeformation, &
homogenization_updateState, &
homogenization_averageStressAndItsTangent, &
homogenization_averageTemperature, &
homogenization_postResults
CONTAINS
contains
!**************************************
!* Module initialization *
!**************************************
!--------------------------------------------------------------------------------------------------
!> @brief module initialization
!--------------------------------------------------------------------------------------------------
subroutine homogenization_init(Temperature)
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
use math, only: math_I3
@ -85,7 +87,6 @@ use homogenization_isostrain
use homogenization_RGC
implicit none
real(pReal) Temperature
integer(pInt), parameter :: fileunit = 200
integer(pInt) e,i,p,myInstance
@ -93,9 +94,8 @@ integer(pInt), dimension(:,:), pointer :: thisSize
character(len=64), dimension(:,:), pointer :: thisOutput
logical knownHomogenization
! --- PARSE HOMOGENIZATIONS FROM CONFIG FILE ---
!--------------------------------------------------------------------------------------------------
! parse homogenization from config file
if (.not. IO_open_jobFile_stat(fileunit,material_localFileExt)) then ! no local material configuration present...
call IO_open_file(fileunit,material_configFile) ! ... open material.config file
endif
@ -103,9 +103,8 @@ call homogenization_isostrain_init(fileunit)
call homogenization_RGC_init(fileunit)
close(fileunit)
! --- WRITE DESCRIPTION FILE FOR HOMOGENIZATION OUTPUT ---
!--------------------------------------------------------------------------------------------------
! write description file for homogenization output
call IO_write_jobFile(fileunit,'outputHomogenization')
do p = 1,material_Nhomogenization
i = homogenization_typeInstance(p) ! which instance of this homogenization type
@ -133,37 +132,49 @@ do p = 1,material_Nhomogenization
enddo
close(fileunit)
! --- ALLOCATE AND INITIALIZE GLOBAL VARIABLES ---
!--------------------------------------------------------------------------------------------------
! allocate and initialize global variables
allocate(homogenization_state0(mesh_maxNips,mesh_NcpElems))
allocate(homogenization_subState0(mesh_maxNips,mesh_NcpElems))
allocate(homogenization_state(mesh_maxNips,mesh_NcpElems))
allocate(homogenization_sizeState(mesh_maxNips,mesh_NcpElems)); homogenization_sizeState = 0_pInt
allocate(homogenization_sizePostResults(mesh_maxNips,mesh_NcpElems)); homogenization_sizePostResults = 0_pInt
allocate(homogenization_sizeState(mesh_maxNips,mesh_NcpElems))
homogenization_sizeState = 0_pInt
allocate(homogenization_sizePostResults(mesh_maxNips,mesh_NcpElems))
homogenization_sizePostResults = 0_pInt
allocate(materialpoint_dPdF(3,3,3,3,mesh_maxNips,mesh_NcpElems)); materialpoint_dPdF = 0.0_pReal
allocate(materialpoint_F0(3,3,mesh_maxNips,mesh_NcpElems));
allocate(materialpoint_F(3,3,mesh_maxNips,mesh_NcpElems)); materialpoint_F = 0.0_pReal
allocate(materialpoint_subF0(3,3,mesh_maxNips,mesh_NcpElems)); materialpoint_subF0 = 0.0_pReal
allocate(materialpoint_subF(3,3,mesh_maxNips,mesh_NcpElems)); materialpoint_subF = 0.0_pReal
allocate(materialpoint_P(3,3,mesh_maxNips,mesh_NcpElems)); materialpoint_P = 0.0_pReal
allocate(materialpoint_Temperature(mesh_maxNips,mesh_NcpElems)); materialpoint_Temperature = Temperature
allocate(materialpoint_subFrac(mesh_maxNips,mesh_NcpElems)); materialpoint_subFrac = 0.0_pReal
allocate(materialpoint_subStep(mesh_maxNips,mesh_NcpElems)); materialpoint_subStep = 0.0_pReal
allocate(materialpoint_subdt(mesh_maxNips,mesh_NcpElems)); materialpoint_subdt = 0.0_pReal
allocate(materialpoint_requested(mesh_maxNips,mesh_NcpElems)); materialpoint_requested = .false.
allocate(materialpoint_converged(mesh_maxNips,mesh_NcpElems)); materialpoint_converged = .true.
allocate(materialpoint_doneAndHappy(2,mesh_maxNips,mesh_NcpElems)); materialpoint_doneAndHappy = .true.
allocate(materialpoint_dPdF(3,3,3,3,mesh_maxNips,mesh_NcpElems))
materialpoint_dPdF = 0.0_pReal
allocate(materialpoint_F0(3,3,mesh_maxNips,mesh_NcpElems))
allocate(materialpoint_F(3,3,mesh_maxNips,mesh_NcpElems))
materialpoint_F = 0.0_pReal
allocate(materialpoint_subF0(3,3,mesh_maxNips,mesh_NcpElems))
materialpoint_subF0 = 0.0_pReal
allocate(materialpoint_subF(3,3,mesh_maxNips,mesh_NcpElems))
materialpoint_subF = 0.0_pReal
allocate(materialpoint_P(3,3,mesh_maxNips,mesh_NcpElems))
materialpoint_P = 0.0_pReal
allocate(materialpoint_Temperature(mesh_maxNips,mesh_NcpElems))
materialpoint_Temperature = Temperature
allocate(materialpoint_subFrac(mesh_maxNips,mesh_NcpElems))
materialpoint_subFrac = 0.0_pReal
allocate(materialpoint_subStep(mesh_maxNips,mesh_NcpElems))
materialpoint_subStep = 0.0_pReal
allocate(materialpoint_subdt(mesh_maxNips,mesh_NcpElems))
materialpoint_subdt = 0.0_pReal
allocate(materialpoint_requested(mesh_maxNips,mesh_NcpElems))
materialpoint_requested = .false.
allocate(materialpoint_converged(mesh_maxNips,mesh_NcpElems))
materialpoint_converged = .true.
allocate(materialpoint_doneAndHappy(2,mesh_maxNips,mesh_NcpElems))
materialpoint_doneAndHappy = .true.
forall (i = 1:mesh_maxNips,e = 1:mesh_NcpElems)
materialpoint_F0(1:3,1:3,i,e) = math_I3
materialpoint_F(1:3,1:3,i,e) = math_I3
end forall
! --- ALLOCATE AND INITIALIZE GLOBAL STATE AND POSTRESULTS VARIABLES ----------
!--------------------------------------------------------------------------------------------------
! allocate and initialize global state and postrestuls variables
!$OMP PARALLEL DO PRIVATE(myInstance)
do e = 1,mesh_NcpElems ! loop over elements
myInstance = homogenization_typeInstance(mesh_element(3,e))
@ -194,11 +205,11 @@ end forall
enddo
!$OMP END PARALLEL DO
!---write state size file out---------------------------------------
!--------------------------------------------------------------------------------------------------
! write state size file out
call IO_write_jobBinaryFile(777,'sizeStateHomog',size(homogenization_sizeState))
write (777,rec=1) homogenization_sizeState
close(777)
!--------------------------------------------------------------
homogenization_maxSizeState = maxval(homogenization_sizeState)
homogenization_maxSizePostResults = maxval(homogenization_sizePostResults)
@ -243,18 +254,13 @@ allocate(materialpoint_results(materialpoint_sizeResults,mesh_maxNips,mesh_NcpEl
call flush(6)
!$OMP END CRITICAL (write2out)
endsubroutine
end subroutine homogenization_init
!********************************************************************
!* parallelized calculation of
!* stress and corresponding tangent
!* at material points
!********************************************************************
subroutine materialpoint_stressAndItsTangent(&
updateJaco,& ! flag to initiate Jacobian updating
dt & ! time increment
)
!--------------------------------------------------------------------------------------------------
!> @brief parallelized calculation of stress and corresponding tangent at material points
!--------------------------------------------------------------------------------------------------
subroutine materialpoint_stressAndItsTangent(updateJaco,dt)
use numerics, only: subStepMinHomog, &
subStepSizeHomog, &
@ -305,23 +311,25 @@ use debug, only: debug_level, &
use math, only: math_pDecomposition
implicit none
real(pReal), intent(in) :: dt
logical, intent(in) :: updateJaco
real(pReal), intent(in) :: dt !< time increment
logical, intent(in) :: updateJaco !< initiating Jacobian update
logical :: rate_sensitivity
integer(pInt) NiterationHomog,NiterationMPstate
integer(pInt) g,i,e,myNgrains
! ------ initialize to starting condition ------
if (iand(debug_level(debug_homogenization), debug_levelBasic) /= 0_pInt &
.and. debug_e > 0 .and. debug_e <= mesh_NcpElems .and. debug_i > 0 .and. debug_i <= mesh_maxNips) then
!--------------------------------------------------------------------------------------------------
! initialize to starting condition
if (iand(debug_level(debug_homogenization), debug_levelBasic) /= 0_pInt .and. &
debug_e > 0 .and. debug_e <= mesh_NcpElems .and. debug_i > 0 .and. debug_i <= mesh_maxNips) then
!$OMP CRITICAL (write2out)
write (6,*)
write (6,'(a,i5,1x,i2)') '<< HOMOG >> Material Point start at el ip ', debug_e, debug_i
write (6,'(a,/,12x,f14.9)') '<< HOMOG >> Temp0', materialpoint_Temperature(debug_i,debug_e)
write (6,'(a,/,3(12x,3(f14.9,1x)/))') '<< HOMOG >> F0', math_transpose33(materialpoint_F0(1:3,1:3,debug_i,debug_e))
write (6,'(a,/,3(12x,3(f14.9,1x)/))') '<< HOMOG >> F', math_transpose33(materialpoint_F(1:3,1:3,debug_i,debug_e))
write (6,'(a,/,12x,f14.9)') '<< HOMOG >> Temp0', &
materialpoint_Temperature(debug_i,debug_e)
write (6,'(a,/,3(12x,3(f14.9,1x)/))') '<< HOMOG >> F0', &
math_transpose33(materialpoint_F0(1:3,1:3,debug_i,debug_e))
write (6,'(a,/,3(12x,3(f14.9,1x)/))') '<< HOMOG >> F', &
math_transpose33(materialpoint_F(1:3,1:3,debug_i,debug_e))
!$OMP END CRITICAL (write2out)
endif
@ -336,7 +344,8 @@ use debug, only: debug_level, &
crystallite_partionedTemperature0(1:myNgrains,i,e) = materialpoint_Temperature(i,e) ! ...temperatures
crystallite_partionedFp0(1:3,1:3,1:myNgrains,i,e) = crystallite_Fp0(1:3,1:3,1:myNgrains,i,e) ! ...plastic def grads
crystallite_partionedLp0(1:3,1:3,1:myNgrains,i,e) = crystallite_Lp0(1:3,1:3,1:myNgrains,i,e) ! ...plastic velocity grads
crystallite_partioneddPdF0(1:3,1:3,1:3,1:3,1:myNgrains,i,e) = crystallite_dPdF0(1:3,1:3,1:3,1:3,1:myNgrains,i,e) ! ...stiffness
crystallite_partioneddPdF0(1:3,1:3,1:3,1:3,1:myNgrains,i,e) = &
crystallite_dPdF0(1:3,1:3,1:3,1:3,1:myNgrains,i,e) ! ...stiffness
crystallite_partionedF0(1:3,1:3,1:myNgrains,i,e) = crystallite_F0(1:3,1:3,1:myNgrains,i,e) ! ...def grads
crystallite_partionedTstar0_v(1:6,1:myNgrains,i,e) = crystallite_Tstar0_v(1:6,1:myNgrains,i,e) ! ...2nd PK stress
@ -355,8 +364,8 @@ use debug, only: debug_level, &
NiterationHomog = 0_pInt
! ------ cutback loop ------
!--------------------------------------------------------------------------------------------------
! cutback loop
do while (.not. terminallyIll .and. &
any(materialpoint_subStep(:,FEsolving_execELem(1):FEsolving_execElem(2)) > subStepMinHomog)) ! cutback loop for material points
@ -380,7 +389,7 @@ use debug, only: debug_level, &
materialpoint_subFrac(i,e) = materialpoint_subFrac(i,e) + materialpoint_subStep(i,e)
!$OMP FLUSH(materialpoint_subFrac)
materialpoint_subStep(i,e) = min(1.0_pReal-materialpoint_subFrac(i,e), &
stepIncreaseHomog*materialpoint_subStep(i,e)) ! <<introduce flexibility for step increase/acceleration>>
stepIncreaseHomog*materialpoint_subStep(i,e)) ! introduce flexibility for step increase/acceleration
!$OMP FLUSH(materialpoint_subStep)
! still stepping needed
@ -551,13 +560,12 @@ use debug, only: debug_level, &
endif
return
endsubroutine
end subroutine materialpoint_stressAndItsTangent
!********************************************************************
!* parallelized calculation of
!* result array at material points
!********************************************************************
!--------------------------------------------------------------------------------------------------
!> @brief parallelized calculation of result array at material points
!--------------------------------------------------------------------------------------------------
subroutine materialpoint_postResults(dt)
use FEsolving, only: FEsolving_execElem, FEsolving_execIP
@ -598,16 +606,13 @@ subroutine materialpoint_postResults(dt)
enddo
!$OMP END PARALLEL DO
endsubroutine
end subroutine materialpoint_postResults
!********************************************************************
! partition material point def grad onto constituents
!********************************************************************
subroutine homogenization_partitionDeformation(&
ip, & ! integration point
el & ! element
)
!--------------------------------------------------------------------------------------------------
!> @brief partition material point def grad onto constituents
!--------------------------------------------------------------------------------------------------
subroutine homogenization_partitionDeformation(ip,el)
use mesh, only: mesh_element
use material, only: homogenization_type, homogenization_maxNgrains
@ -617,12 +622,14 @@ subroutine homogenization_partitionDeformation(&
implicit none
integer(pInt), intent(in) :: ip,el
integer(pInt), intent(in) :: ip, & !< integration point
el !< element
select case(homogenization_type(mesh_element(3,el)))
case (homogenization_isostrain_label)
!* isostrain
call homogenization_isostrain_partitionDeformation(crystallite_partionedF(1:3,1:3,1:homogenization_maxNgrains,ip,el), &
call homogenization_isostrain_partitionDeformation(&
crystallite_partionedF(1:3,1:3,1:homogenization_maxNgrains,ip,el), &
crystallite_partionedF0(1:3,1:3,1:homogenization_maxNgrains,ip,el),&
materialpoint_subF(1:3,1:3,ip,el),&
homogenization_state(ip,el), &
@ -638,26 +645,24 @@ subroutine homogenization_partitionDeformation(&
el)
end select
endsubroutine
end subroutine homogenization_partitionDeformation
!********************************************************************
! update the internal state of the homogenization scheme
! and tell whether "done" and "happy" with result
!********************************************************************
function homogenization_updateState(&
ip, & ! integration point
el & ! element
)
!--------------------------------------------------------------------------------------------------
!> @brief update the internal state of the homogenization scheme and tell whether "done" and
!> "happy" with result
!--------------------------------------------------------------------------------------------------
function homogenization_updateState(ip,el)
use mesh, only: mesh_element
use material, only: homogenization_type, homogenization_maxNgrains
use crystallite, only: crystallite_P,crystallite_dPdF,crystallite_partionedF,crystallite_partionedF0 ! modified <<<updated 31.07.2009>>>
use crystallite, only: crystallite_P,crystallite_dPdF,crystallite_partionedF,crystallite_partionedF0
use homogenization_isostrain
use homogenization_RGC
implicit none
integer(pInt), intent(in) :: ip,el
implicit none
integer(pInt), intent(in) :: ip, & !< integration point
el !< element
logical, dimension(2) :: homogenization_updateState
select case(homogenization_type(mesh_element(3,el)))
@ -684,18 +689,13 @@ function homogenization_updateState(&
el)
end select
return
endfunction
end function homogenization_updateState
!********************************************************************
! derive average stress and stiffness from constituent quantities
!********************************************************************
subroutine homogenization_averageStressAndItsTangent(&
ip, & ! integration point
el & ! element
)
!--------------------------------------------------------------------------------------------------
!> @brief derive average stress and stiffness from constituent quantities
!--------------------------------------------------------------------------------------------------
subroutine homogenization_averageStressAndItsTangent(ip,el)
use mesh, only: mesh_element
use material, only: homogenization_type, homogenization_maxNgrains
use crystallite, only: crystallite_P,crystallite_dPdF
@ -704,7 +704,8 @@ subroutine homogenization_averageStressAndItsTangent(&
use homogenization_isostrain
implicit none
integer(pInt), intent(in) :: ip,el
integer(pInt), intent(in) :: ip, & !< integration point
el !< element
select case(homogenization_type(mesh_element(3,el)))
!* isostrain
@ -725,18 +726,13 @@ subroutine homogenization_averageStressAndItsTangent(&
el)
end select
return
endsubroutine
end subroutine homogenization_averageStressAndItsTangent
!********************************************************************
! derive average stress and stiffness from constituent quantities
!********************************************************************
subroutine homogenization_averageTemperature(&
ip, & ! integration point
el & ! element
)
!--------------------------------------------------------------------------------------------------
!> @brief derive average stress and stiffness from constituent quantities
!--------------------------------------------------------------------------------------------------
subroutine homogenization_averageTemperature(ip,el)
use mesh, only: mesh_element
use material, only: homogenization_type, homogenization_maxNgrains
use crystallite, only: crystallite_Temperature
@ -745,7 +741,8 @@ subroutine homogenization_averageTemperature(&
use homogenization_RGC
implicit none
integer(pInt), intent(in) :: ip,el
integer(pInt), intent(in) :: ip, & !< integration point
el !< element
select case(homogenization_type(mesh_element(3,el)))
!* isostrain
@ -758,27 +755,22 @@ subroutine homogenization_averageTemperature(&
homogenization_RGC_averageTemperature(crystallite_Temperature(1:homogenization_maxNgrains,ip,el), ip, el)
end select
return
endsubroutine
end subroutine homogenization_averageTemperature
!********************************************************************
! return array of homogenization results for post file inclusion
! call only, if homogenization_sizePostResults(ip,el) > 0 !!
!********************************************************************
function homogenization_postResults(&
ip, & ! integration point
el & ! element
)
!--------------------------------------------------------------------------------------------------
!> @brief return array of homogenization results for post file inclusion. call only,
!> if homogenization_sizePostResults(ip,el) > 0 !!
!--------------------------------------------------------------------------------------------------
function homogenization_postResults(ip,el)
use mesh, only: mesh_element
use material, only: homogenization_type
use homogenization_isostrain
use homogenization_RGC
implicit none
!* Definition of variables
integer(pInt), intent(in) :: ip,el
implicit none
integer(pInt), intent(in) :: ip, & !< integration point
el !< element
real(pReal), dimension(homogenization_sizePostResults(ip,el)) :: homogenization_postResults
homogenization_postResults = 0.0_pReal
@ -791,8 +783,6 @@ function homogenization_postResults(&
homogenization_postResults = homogenization_RGC_postResults(homogenization_state(ip,el),ip,el)
end select
return
end function homogenization_postResults
endfunction
END MODULE
end module homogenization