distributing tasks

This commit is contained in:
Martin Diehl 2020-12-30 00:14:48 +01:00
parent 6a6256dd34
commit 9ce932a082
4 changed files with 152 additions and 81 deletions

View File

@ -86,6 +86,7 @@ subroutine CPFEM_init
write(fileName,'(a,i0,a)') trim(getSolverJobName())//'_',worldrank,'.hdf5'
fileHandle = HDF5_openFile(fileName)
call homogenization_restartRead(fileHandle)
call constitutive_restartRead(fileHandle)
call HDF5_closeFile(fileHandle)
@ -108,6 +109,7 @@ subroutine CPFEM_restartWrite
write(fileName,'(a,i0,a)') trim(getSolverJobName())//'_',worldrank,'.hdf5'
fileHandle = HDF5_openFile(fileName,'a')
call homogenization_restartWrite(fileHandle)
call constitutive_restartWrite(fileHandle)
call HDF5_closeFile(fileHandle)

View File

@ -15,7 +15,6 @@ module constitutive
use discretization
use parallelization
use HDF5_utilities
use DAMASK_interface
use results
implicit none
@ -161,10 +160,6 @@ module constitutive
end subroutine damage_results
module subroutine mech_restart_read(fileHandle)
integer(HID_T), intent(in) :: fileHandle
end subroutine mech_restart_read
module subroutine mech_initializeRestorationPoints(ph,me)
integer, intent(in) :: ph, me
end subroutine mech_initializeRestorationPoints
@ -193,6 +188,16 @@ module constitutive
real(pReal), dimension(3,3,3,3) :: dPdF
end function constitutive_mech_dPdF
module subroutine mech_restartWrite(groupHandle,ph)
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
end subroutine mech_restartWrite
module subroutine mech_restartRead(groupHandle,ph)
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
end subroutine mech_restartRead
! == cleaned:end ===================================================================================
module function crystallite_stress(dt,co,ip,el) result(converged_)
@ -1152,82 +1157,58 @@ end function converged
!--------------------------------------------------------------------------------------------------
!> @brief Write current restart information (Field and constitutive data) to file.
! ToDo: Merge data into one file for MPI, move state to constitutive and homogenization, respectively
! ToDo: Merge data into one file for MPI
!--------------------------------------------------------------------------------------------------
subroutine constitutive_restartWrite(fileHandle)
integer(HID_T), intent(in) :: fileHandle
integer(HID_T), dimension(2) :: groupHandle
integer :: ph
integer(HID_T) :: groupHandle
character(len=pStringLen) :: datasetName
groupHandle = HDF5_addGroup(fileHandle,'phase')
do ph = 1,size(material_name_phase)
write(datasetName,'(i0,a)') ph,'_omega'
call HDF5_write(groupHandle,plasticState(ph)%state,datasetName)
write(datasetName,'(i0,a)') ph,'_F_i'
call HDF5_write(groupHandle,constitutive_mech_Fi(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_L_i'
call HDF5_write(groupHandle,constitutive_mech_Li(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_L_p'
call HDF5_write(groupHandle,constitutive_mech_Lp(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_F_p'
call HDF5_write(groupHandle,constitutive_mech_Fp(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_S'
call HDF5_write(groupHandle,constitutive_mech_S(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_F'
call HDF5_write(groupHandle,constitutive_mech_F(ph)%data,datasetName)
groupHandle(1) = HDF5_addGroup(fileHandle,'phase')
do ph = 1, size(material_name_phase)
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_phase(ph))
call mech_restartWrite(groupHandle(2),ph)
call HDF5_closeGroup(groupHandle(2))
enddo
call HDF5_closeGroup(groupHandle)
groupHandle = HDF5_addGroup(fileHandle,'homogenization')
do ph = 1, size(material_name_homogenization)
write(datasetName,'(i0,a)') ph,'_omega'
call HDF5_write(groupHandle,homogState(ph)%state,datasetName)
enddo
call HDF5_closeGroup(groupHandle)
call HDF5_closeGroup(groupHandle(1))
end subroutine constitutive_restartWrite
!--------------------------------------------------------------------------------------------------
!> @brief Read data for restart
! ToDo: Merge data into one file for MPI, move state to constitutive and homogenization, respectively
! ToDo: Merge data into one file for MPI
!--------------------------------------------------------------------------------------------------
subroutine constitutive_restartRead(fileHandle)
integer(HID_T), intent(in) :: fileHandle
integer(HID_T), dimension(2) :: groupHandle
integer :: ph
integer(HID_T) :: groupHandle
character(len=pStringLen) ::datasetName
groupHandle = HDF5_openGroup(fileHandle,'phase')
do ph = 1,size(material_name_phase)
write(datasetName,'(i0,a)') ph,'_omega'
call HDF5_read(groupHandle,plasticState(ph)%state0,datasetName)
write(datasetName,'(i0,a)') ph,'_F_i'
call HDF5_read(groupHandle,constitutive_mech_Fi0(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_L_i'
call HDF5_read(groupHandle,constitutive_mech_Li0(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_L_p'
call HDF5_read(groupHandle,constitutive_mech_Lp0(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_F_p'
call HDF5_read(groupHandle,constitutive_mech_Fp0(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_S'
call HDF5_read(groupHandle,constitutive_mech_S0(ph)%data,datasetName)
write(datasetName,'(i0,a)') ph,'_F'
call HDF5_read(groupHandle,constitutive_mech_F0(ph)%data,datasetName)
groupHandle(1) = HDF5_openGroup(fileHandle,'phase')
do ph = 1, size(material_name_phase)
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_phase(ph))
call mech_restartRead(groupHandle(2),ph)
call HDF5_closeGroup(groupHandle(2))
enddo
call HDF5_closeGroup(groupHandle)
groupHandle = HDF5_openGroup(fileHandle,'homogenization')
do ph = 1,size(material_name_homogenization)
write(datasetName,'(i0,a)') ph,'_omega'
call HDF5_read(groupHandle,homogState(ph)%state0,datasetName)
enddo
call HDF5_closeGroup(groupHandle)
call HDF5_closeGroup(groupHandle(1))
end subroutine constitutive_restartRead

View File

@ -799,10 +799,6 @@ module subroutine mech_results(group,ph)
end subroutine mech_results
module subroutine mech_restart_read(fileHandle)
integer(HID_T), intent(in) :: fileHandle
end subroutine mech_restart_read
!--------------------------------------------------------------------------------------------------
!> @brief calculation of stress (P) with time integration based on a residuum in Lp and
@ -1815,5 +1811,39 @@ module function constitutive_mech_dPdF(dt,co,ip,el) result(dPdF)
end function constitutive_mech_dPdF
module subroutine mech_restartWrite(groupHandle,ph)
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
call HDF5_write(groupHandle,plasticState(ph)%state,'omega')
call HDF5_write(groupHandle,constitutive_mech_Fi(ph)%data,'F_i')
call HDF5_write(groupHandle,constitutive_mech_Li(ph)%data,'L_i')
call HDF5_write(groupHandle,constitutive_mech_Lp(ph)%data,'L_p')
call HDF5_write(groupHandle,constitutive_mech_Fp(ph)%data,'F_p')
call HDF5_write(groupHandle,constitutive_mech_S(ph)%data,'S')
call HDF5_write(groupHandle,constitutive_mech_F(ph)%data,'F')
end subroutine mech_restartWrite
module subroutine mech_restartRead(groupHandle,ph)
integer(HID_T), intent(in) :: groupHandle
integer, intent(in) :: ph
call HDF5_read(groupHandle,plasticState(ph)%state0,'omega')
call HDF5_read(groupHandle,constitutive_mech_Fi0(ph)%data,'F_i')
call HDF5_read(groupHandle,constitutive_mech_Li0(ph)%data,'L_i')
call HDF5_read(groupHandle,constitutive_mech_Lp0(ph)%data,'L_p')
call HDF5_read(groupHandle,constitutive_mech_Fp0(ph)%data,'F_p')
call HDF5_read(groupHandle,constitutive_mech_S0(ph)%data,'S')
call HDF5_read(groupHandle,constitutive_mech_F0(ph)%data,'F')
end subroutine mech_restartRead
end submodule constitutive_mech

View File

@ -16,6 +16,7 @@ module homogenization
use thermal_conduction
use damage_none
use damage_nonlocal
use HDF5_utilities
use results
implicit none
@ -92,7 +93,9 @@ module homogenization
homogenization_init, &
materialpoint_stressAndItsTangent, &
homogenization_forward, &
homogenization_results
homogenization_results, &
homogenization_restartRead, &
homogenization_restartWrite
contains
@ -315,4 +318,59 @@ subroutine homogenization_forward
end subroutine homogenization_forward
!--------------------------------------------------------------------------------------------------
!--------------------------------------------------------------------------------------------------
subroutine homogenization_restartWrite(fileHandle)
integer(HID_T), intent(in) :: fileHandle
integer(HID_T), dimension(2) :: groupHandle
integer :: ho
groupHandle(1) = HDF5_addGroup(fileHandle,'homogenization')
do ho = 1, size(material_name_homogenization)
groupHandle(2) = HDF5_addGroup(groupHandle(1),material_name_homogenization(ho))
call HDF5_read(groupHandle(2),homogState(ho)%state,'omega') ! ToDo: should be done by mech
call HDF5_closeGroup(groupHandle(2))
enddo
call HDF5_closeGroup(groupHandle(1))
end subroutine homogenization_restartWrite
!--------------------------------------------------------------------------------------------------
!--------------------------------------------------------------------------------------------------
subroutine homogenization_restartRead(fileHandle)
integer(HID_T), intent(in) :: fileHandle
integer(HID_T), dimension(2) :: groupHandle
integer :: ho
groupHandle(1) = HDF5_openGroup(fileHandle,'homogenization')
do ho = 1, size(material_name_homogenization)
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_homogenization(ho))
call HDF5_write(groupHandle(2),homogState(ho)%state,'omega') ! ToDo: should be done by mech
call HDF5_closeGroup(groupHandle(2))
enddo
call HDF5_closeGroup(groupHandle(1))
end subroutine homogenization_restartRead
end module homogenization