less variables for better readability

This commit is contained in:
Martin Diehl 2019-12-07 15:20:04 +01:00
parent 7ecb0245ec
commit 23944de6de
1 changed files with 46 additions and 52 deletions

View File

@ -42,7 +42,7 @@ contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief call (thread safe) all module initializations !> @brief call all module initializations
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine CPFEM_initAll subroutine CPFEM_initAll
@ -70,28 +70,23 @@ subroutine CPFEM_initAll
end subroutine CPFEM_initAll end subroutine CPFEM_initAll
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief allocate the arrays defined in module CPFEM and initialize them !> @brief allocate the arrays defined in module CPFEM and initialize them
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine CPFEM_init subroutine CPFEM_init
integer :: ph,homog integer :: i
character(len=1024) :: rankStr, PlasticItem, HomogItem integer(HID_T) :: fileHandle, groupHandle
integer(HID_T) :: fileHandle, groupPlasticID, groupHomogID character(len=pStringLen) :: fileName, datasetName
write(6,'(/,a)') ' <<<+- CPFEM init -+>>>' write(6,'(/,a)') ' <<<+- CPFEM init -+>>>'; flush(6)
flush(6)
! *** restore the last converged values of each essential variable
if (interface_restartInc > 0) then if (interface_restartInc > 0) then
if (iand(debug_level(debug_CPFEM), debug_levelExtensive) /= 0) then write(6,'(/,a,i0,a)') ' reading restart information of increment ', interface_restartInc, ' from file'
write(6,'(a)') '<< CPFEM >> restored state variables of last converged step from hdf5 file'
flush(6)
endif
write(rankStr,'(a1,i0)')'_',worldrank write(fileName,'(a,i0,a)') trim(getSolverJobName())//'_',worldrank,'.hdf5'
fileHandle = HDF5_openFile(fileName)
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5')
call HDF5_read(fileHandle,crystallite_F0, 'F') call HDF5_read(fileHandle,crystallite_F0, 'F')
call HDF5_read(fileHandle,crystallite_Fp0,'Fp') call HDF5_read(fileHandle,crystallite_Fp0,'Fp')
@ -100,19 +95,19 @@ subroutine CPFEM_init
call HDF5_read(fileHandle,crystallite_Li0,'Li') call HDF5_read(fileHandle,crystallite_Li0,'Li')
call HDF5_read(fileHandle,crystallite_S0, 'S') call HDF5_read(fileHandle,crystallite_S0, 'S')
groupPlasticID = HDF5_openGroup(fileHandle,'constituent') groupHandle = HDF5_openGroup(fileHandle,'constituent')
do ph = 1,size(phase_plasticity) do i = 1,size(phase_plasticity)
write(PlasticItem,*) ph,'_' write(datasetName,'(i0,a)') i,'_omega_plastic'
call HDF5_read(groupPlasticID,plasticState(ph)%state0,trim(PlasticItem)//'omega_plastic') call HDF5_read(groupHandle,plasticState(i)%state,datasetName)
enddo enddo
call HDF5_closeGroup(groupPlasticID) call HDF5_closeGroup(groupHandle)
groupHomogID = HDF5_openGroup(fileHandle,'materialpoint') groupHandle = HDF5_openGroup(fileHandle,'materialpoint')
do homog = 1, material_Nhomogenization do i = 1, material_Nhomogenization
write(HomogItem,*) homog,'_' write(datasetName,'(i0,a)') i,'_omega_homogenization'
call HDF5_read(groupHomogID,homogState(homog)%state0, trim(HomogItem)//'omega_homogenization') call HDF5_read(groupHandle,homogState(i)%state,datasetName)
enddo enddo
call HDF5_closeGroup(groupHomogID) call HDF5_closeGroup(groupHandle)
call HDF5_closeFile(fileHandle) call HDF5_closeFile(fileHandle)
endif endif
@ -126,7 +121,7 @@ end subroutine CPFEM_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine CPFEM_forward subroutine CPFEM_forward
integer :: i, homog, mySource integer :: i, j
if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0) & if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0) &
write(6,'(a)') '<< CPFEM >> aging states' write(6,'(a)') '<< CPFEM >> aging states'
@ -142,32 +137,31 @@ subroutine CPFEM_forward
plasticState(i)%state0 = plasticState(i)%state plasticState(i)%state0 = plasticState(i)%state
enddo enddo
do i = 1, size(sourceState) do i = 1, size(sourceState)
do mySource = 1,phase_Nsources(i) do j = 1,phase_Nsources(i)
sourceState(i)%p(mySource)%state0 = sourceState(i)%p(mySource)%state sourceState(i)%p(j)%state0 = sourceState(i)%p(j)%state
enddo; enddo enddo; enddo
do homog = 1, material_Nhomogenization do i = 1, material_Nhomogenization
homogState (homog)%state0 = homogState (homog)%state homogState (i)%state0 = homogState (i)%state
thermalState (homog)%state0 = thermalState (homog)%state thermalState(i)%state0 = thermalState(i)%state
damageState (homog)%state0 = damageState (homog)%state damageState (i)%state0 = damageState (i)%state
enddo enddo
end subroutine CPFEM_forward end subroutine CPFEM_forward
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Write current constitutive variables for restart to file. !> @brief Write current restart information (Field and constitutive data) to file.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine CPFEM_restartWrite subroutine CPFEM_restartWrite
integer :: ph, homog integer :: i
character(len=32) :: rankStr, PlasticItem, HomogItem integer(HID_T) :: fileHandle, groupHandle
integer(HID_T) :: fileHandle, groupPlastic, groupHomog character(len=pStringLen) :: fileName, datasetName
write(6,'(a)') ' writing field and constitutive data required for restart to file';flush(6)
write(6,'(a)') ' writing constitutive data required for restart to file';flush(6) write(fileName,'(a,i0,a)') trim(getSolverJobName())//'_',worldrank,'.hdf5'
fileHandle = HDF5_openFile(fileName,'a')
write(rankStr,'(a1,i0)')'_',worldrank
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','a')
call HDF5_write(fileHandle,crystallite_partionedF,'F') call HDF5_write(fileHandle,crystallite_partionedF,'F')
call HDF5_write(fileHandle,crystallite_Fp, 'Fp') call HDF5_write(fileHandle,crystallite_Fp, 'Fp')
@ -176,19 +170,19 @@ subroutine CPFEM_restartWrite
call HDF5_write(fileHandle,crystallite_Li, 'Li') call HDF5_write(fileHandle,crystallite_Li, 'Li')
call HDF5_write(fileHandle,crystallite_S, 'S') call HDF5_write(fileHandle,crystallite_S, 'S')
groupPlastic = HDF5_addGroup(fileHandle,'constituent') groupHandle = HDF5_addGroup(fileHandle,'constituent')
do ph = 1,size(phase_plasticity) do i = 1,size(phase_plasticity)
write(PlasticItem,*) ph,'_' write(datasetName,'(i0,a)') i,'_omega_plastic'
call HDF5_write(groupPlastic,plasticState(ph)%state,trim(PlasticItem)//'omega_plastic') call HDF5_write(groupHandle,plasticState(i)%state,datasetName)
enddo enddo
call HDF5_closeGroup(groupPlastic) call HDF5_closeGroup(groupHandle)
groupHomog = HDF5_addGroup(fileHandle,'materialpoint') groupHandle = HDF5_addGroup(fileHandle,'materialpoint')
do homog = 1, material_Nhomogenization do i = 1, material_Nhomogenization
write(HomogItem,*) homog,'_' write(datasetName,'(i0,a)') i,'_omega_homogenization'
call HDF5_write(groupHomog,homogState(homog)%state,trim(HomogItem)//'omega_homogenization') call HDF5_write(groupHandle,homogState(i)%state,datasetName)
enddo enddo
call HDF5_closeGroup(groupHomog) call HDF5_closeGroup(groupHandle)
call HDF5_closeFile(fileHandle) call HDF5_closeFile(fileHandle)
@ -209,7 +203,7 @@ subroutine CPFEM_results(inc,time)
call crystallite_results call crystallite_results
call homogenization_results call homogenization_results
call discretization_results call discretization_results
call results_removeLink('current') ! ToDo: put this into closeJobFile call results_removeLink('current') ! ToDo: put this into closeJobFile?
call results_closeJobFile call results_closeJobFile
end subroutine CPFEM_results end subroutine CPFEM_results