From 82dee9db0e754512b44c41564aaf565f8357153d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 25 Feb 2020 17:53:15 +0100 Subject: [PATCH] matching names --- src/CPFEM.f90 | 13 +++++- src/CPFEM2.f90 | 23 ++++++++++- src/DAMASK_marc.f90 | 2 - src/crystallite.f90 | 99 ++++++++++++++++++++++----------------------- 4 files changed, 81 insertions(+), 56 deletions(-) diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index 085bf7739..418c7f7bc 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -77,7 +77,7 @@ subroutine CPFEM_initAll(el,ip) !$OMP CRITICAL (init) if (.not. CPFEM_init_done) then - call DAMASK_interface_init ! Spectral and FEM interface to commandline + call DAMASK_interface_init call prec_init call IO_init call numerics_init @@ -331,9 +331,18 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt end subroutine CPFEM_general +!-------------------------------------------------------------------------------------------------- +!> @brief Forward data for new time increment. +!-------------------------------------------------------------------------------------------------- +subroutine CPFEM_forward + + call crystallite_forward + +end subroutine CPFEM_forward + !-------------------------------------------------------------------------------------------------- -!> @brief triggers writing of the results +!> @brief Trigger writing of results. !-------------------------------------------------------------------------------------------------- subroutine CPFEM_results(inc,time) diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index f6842d1bc..882fe8ae3 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -59,21 +59,40 @@ subroutine CPFEM_initAll call crystallite_init call homogenization_init call CPFEM_init - call CPFEM_initX end subroutine CPFEM_initAll !-------------------------------------------------------------------------------------------------- -!> @brief allocate the arrays defined in module CPFEM and initialize them +!> @brief Read restart information if needed. !-------------------------------------------------------------------------------------------------- subroutine CPFEM_init write(6,'(/,a)') ' <<<+- CPFEM init -+>>>'; flush(6) + if (interface_restartInc > 0) call crystallite_restartRead + end subroutine CPFEM_init +!-------------------------------------------------------------------------------------------------- +!> @brief Write restart information. +!-------------------------------------------------------------------------------------------------- +subroutine CPFEM_restartWrite + + call crystallite_restartWrite + +end subroutine CPFEM_restartWrite + + +!-------------------------------------------------------------------------------------------------- +!> @brief Forward data for new time increment. +!-------------------------------------------------------------------------------------------------- +subroutine CPFEM_forward + + call crystallite_forward + +end subroutine CPFEM_forward !-------------------------------------------------------------------------------------------------- diff --git a/src/DAMASK_marc.f90 b/src/DAMASK_marc.f90 index 871d3cb38..782657da6 100644 --- a/src/DAMASK_marc.f90 +++ b/src/DAMASK_marc.f90 @@ -43,8 +43,6 @@ module DAMASK_interface logical, public :: symmetricSolver character(len=*), parameter, public :: INPUTFILEEXTENSION = '.dat' - integer(pInt), parameter, public :: interface_restartInc = 0 - public :: & DAMASK_interface_init, & getSolverJobName diff --git a/src/crystallite.f90 b/src/crystallite.f90 index f6ac282dc..d0bad9cd5 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -107,9 +107,9 @@ module crystallite crystallite_orientations, & crystallite_push33ToRef, & crystallite_results, & - CPFEM_restartWrite, & - CPFEM_forward, & - CPFEM_initX + crystallite_restartWrite, & + crystallite_restartRead, & + crystallite_forward contains @@ -1852,8 +1852,9 @@ end function stateJump !-------------------------------------------------------------------------------------------------- !> @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 !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_restartWrite +subroutine crystallite_restartWrite integer :: i integer(HID_T) :: fileHandle, groupHandle @@ -1887,14 +1888,55 @@ subroutine CPFEM_restartWrite call HDF5_closeFile(fileHandle) -end subroutine CPFEM_restartWrite +end subroutine crystallite_restartWrite + + +!-------------------------------------------------------------------------------------------------- +!> @brief Read data for restart +! ToDo: Merge data into one file for MPI, move state to constitutive and homogenization, respectively +!-------------------------------------------------------------------------------------------------- +subroutine crystallite_restartRead + + integer :: i + integer(HID_T) :: fileHandle, groupHandle + character(len=pStringLen) :: fileName, datasetName + + write(6,'(/,a,i0,a)') ' reading restart information of increment from file' + + write(fileName,'(a,i0,a)') trim(getSolverJobName())//'_',worldrank,'.hdf5' + fileHandle = HDF5_openFile(fileName) + + call HDF5_read(fileHandle,crystallite_F0, 'F') + call HDF5_read(fileHandle,crystallite_Fp0,'Fp') + call HDF5_read(fileHandle,crystallite_Fi0,'Fi') + call HDF5_read(fileHandle,crystallite_Lp0,'Lp') + call HDF5_read(fileHandle,crystallite_Li0,'Li') + call HDF5_read(fileHandle,crystallite_S0, 'S') + + groupHandle = HDF5_openGroup(fileHandle,'constituent') + do i = 1,size(phase_plasticity) + write(datasetName,'(i0,a)') i,'_omega_plastic' + call HDF5_read(groupHandle,plasticState(i)%state0,datasetName) + enddo + call HDF5_closeGroup(groupHandle) + + groupHandle = HDF5_openGroup(fileHandle,'materialpoint') + do i = 1, material_Nhomogenization + write(datasetName,'(i0,a)') i,'_omega_homogenization' + call HDF5_read(groupHandle,homogState(i)%state0,datasetName) + enddo + call HDF5_closeGroup(groupHandle) + + call HDF5_closeFile(fileHandle) + +end subroutine crystallite_restartRead !-------------------------------------------------------------------------------------------------- !> @brief Forward data after successful increment. ! ToDo: Any guessing for the current states possible? !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_forward +subroutine crystallite_forward integer :: i, j @@ -1918,49 +1960,6 @@ subroutine CPFEM_forward damageState (i)%state0 = damageState (i)%state enddo -end subroutine CPFEM_forward - -!-------------------------------------------------------------------------------------------------- -!> @brief allocate the arrays defined in module CPFEM and initialize them -!-------------------------------------------------------------------------------------------------- -subroutine CPFEM_initX - - integer :: i - integer(HID_T) :: fileHandle, groupHandle - character(len=pStringLen) :: fileName, datasetName - - write(6,'(/,a)') ' <<<+- CPFEM init -+>>>'; flush(6) - - if (interface_restartInc > 0) then - write(6,'(/,a,i0,a)') ' reading restart information of increment ', interface_restartInc, ' from file' - - write(fileName,'(a,i0,a)') trim(getSolverJobName())//'_',worldrank,'.hdf5' - fileHandle = HDF5_openFile(fileName) - - call HDF5_read(fileHandle,crystallite_F0, 'F') - call HDF5_read(fileHandle,crystallite_Fp0,'Fp') - call HDF5_read(fileHandle,crystallite_Fi0,'Fi') - call HDF5_read(fileHandle,crystallite_Lp0,'Lp') - call HDF5_read(fileHandle,crystallite_Li0,'Li') - call HDF5_read(fileHandle,crystallite_S0, 'S') - - groupHandle = HDF5_openGroup(fileHandle,'constituent') - do i = 1,size(phase_plasticity) - write(datasetName,'(i0,a)') i,'_omega_plastic' - call HDF5_read(groupHandle,plasticState(i)%state0,datasetName) - enddo - call HDF5_closeGroup(groupHandle) - - groupHandle = HDF5_openGroup(fileHandle,'materialpoint') - do i = 1, material_Nhomogenization - write(datasetName,'(i0,a)') i,'_omega_homogenization' - call HDF5_read(groupHandle,homogState(i)%state0,datasetName) - enddo - call HDF5_closeGroup(groupHandle) - - call HDF5_closeFile(fileHandle) - endif - -end subroutine CPFEM_initX +end subroutine crystallite_forward end module crystallite