diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 8e91e79a4..a606856c1 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -93,24 +93,24 @@ subroutine CPFEM_init fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') - call HDF5_read(fileHandle,crystallite_F0, 'convergedF') - call HDF5_read(fileHandle,crystallite_Fp0,'convergedFp') - call HDF5_read(fileHandle,crystallite_Fi0,'convergedFi') - call HDF5_read(fileHandle,crystallite_Lp0,'convergedLp') - call HDF5_read(fileHandle,crystallite_Li0,'convergedLi') - call HDF5_read(fileHandle,crystallite_S0, 'convergedS') + 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') - groupPlasticID = HDF5_openGroup(fileHandle,'PlasticPhases') + groupPlasticID = HDF5_openGroup(fileHandle,'constituent') do ph = 1,size(phase_plasticity) write(PlasticItem,*) ph,'_' - call HDF5_read(groupPlasticID,plasticState(ph)%state0,trim(PlasticItem)//'convergedStateConst') + call HDF5_read(groupPlasticID,plasticState(ph)%state0,trim(PlasticItem)//'omega_plastic') enddo call HDF5_closeGroup(groupPlasticID) - groupHomogID = HDF5_openGroup(fileHandle,'HomogStates') + groupHomogID = HDF5_openGroup(fileHandle,'materialpoint') do homog = 1, material_Nhomogenization write(HomogItem,*) homog,'_' - call HDF5_read(groupHomogID,homogState(homog)%state0, trim(HomogItem)//'convergedStateHomog') + call HDF5_read(groupHomogID,homogState(homog)%state0, trim(HomogItem)//'omega_homogenization') enddo call HDF5_closeGroup(groupHomogID) @@ -168,24 +168,24 @@ subroutine CPFEM_restartWrite write(rankStr,'(a1,i0)')'_',worldrank fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','a') - call HDF5_write(fileHandle,crystallite_partionedF, 'convergedF') - call HDF5_write(fileHandle,crystallite_Fp, 'convergedFp') - call HDF5_write(fileHandle,crystallite_Fi, 'convergedFi') - call HDF5_write(fileHandle,crystallite_Lp, 'convergedLp') - call HDF5_write(fileHandle,crystallite_Li, 'convergedLi') - call HDF5_write(fileHandle,crystallite_S, 'convergedS') + call HDF5_write(fileHandle,crystallite_partionedF,'F') + call HDF5_write(fileHandle,crystallite_Fp, 'Fp') + call HDF5_write(fileHandle,crystallite_Fi, 'Fi') + call HDF5_write(fileHandle,crystallite_Lp, 'Lp') + call HDF5_write(fileHandle,crystallite_Li, 'Li') + call HDF5_write(fileHandle,crystallite_S, 'S') - groupPlastic = HDF5_addGroup(fileHandle,'PlasticPhases') + groupPlastic = HDF5_addGroup(fileHandle,'constituent') do ph = 1,size(phase_plasticity) write(PlasticItem,*) ph,'_' - call HDF5_write(groupPlastic,plasticState(ph)%state,trim(PlasticItem)//'convergedStateConst') + call HDF5_write(groupPlastic,plasticState(ph)%state,trim(PlasticItem)//'omega_plastic') enddo call HDF5_closeGroup(groupPlastic) - groupHomog = HDF5_addGroup(fileHandle,'HomogStates') + groupHomog = HDF5_addGroup(fileHandle,'materialpoint') do homog = 1, material_Nhomogenization write(HomogItem,*) homog,'_' - call HDF5_write(groupHomog,homogState(homog)%state,trim(HomogItem)//'convergedStateHomog') + call HDF5_write(groupHomog,homogState(homog)%state,trim(HomogItem)//'omega_homogenization') enddo call HDF5_closeGroup(groupHomog) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index edcc9810c..b50b52885 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -97,7 +97,7 @@ subroutine grid_mech_FEM_init 1.0_pReal, 1.0_pReal, 1.0_pReal, 1.0_pReal], [4,8]) PetscErrorCode :: ierr integer :: rank - integer(HID_T) :: fileHandle + integer(HID_T) :: fileHandle, groupHandle character(len=1024) :: rankStr real(pReal), dimension(3,3,3,3) :: devNull PetscScalar, pointer, dimension(:,:,:,:) :: & @@ -188,15 +188,16 @@ subroutine grid_mech_FEM_init 'reading values of increment ', interface_restartInc, ' from file' write(rankStr,'(a1,i0)')'_',worldrank - fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') + fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') + groupHandle = HDF5_openGroup(fileHandle,'solver') - call HDF5_read(fileHandle,F_aim, 'F_aim') - call HDF5_read(fileHandle,F_aim_lastInc,'F_aim_lastInc') - call HDF5_read(fileHandle,F_aimDot, 'F_aimDot') - call HDF5_read(fileHandle,F, 'F') - call HDF5_read(fileHandle,F_lastInc, 'F_lastInc') - call HDF5_read(fileHandle,u_current, 'u') - call HDF5_read(fileHandle,u_lastInc, 'u_lastInc') + call HDF5_read(groupHandle,F_aim, 'F_aim') + call HDF5_read(groupHandle,F_aim_lastInc,'F_aim_lastInc') + call HDF5_read(groupHandle,F_aimDot, 'F_aimDot') + call HDF5_read(groupHandle,F, 'F') + call HDF5_read(groupHandle,F_lastInc, 'F_lastInc') + call HDF5_read(groupHandle,u_current, 'u') + call HDF5_read(groupHandle,u_lastInc, 'u_lastInc') elseif (interface_restartInc == 0) then restartRead F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity @@ -216,9 +217,12 @@ subroutine grid_mech_FEM_init restartRead2: if (interface_restartInc > 0) then write(6,'(/,a,'//IO_intOut(interface_restartInc)//',a)') & 'reading more values of increment ', interface_restartInc, ' from file' - call HDF5_read(fileHandle,C_volAvg, 'C_volAvg') - call HDF5_read(fileHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_read(groupHandle,C_volAvg, 'C_volAvg') + call HDF5_read(groupHandle,C_volAvgLastInc,'C_volAvgLastInc') + + call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) + endif restartRead2 end subroutine grid_mech_FEM_init @@ -363,7 +367,7 @@ subroutine grid_mech_FEM_restartWrite() PetscErrorCode :: ierr PetscScalar, dimension(:,:,:,:), pointer :: u_current,u_lastInc - integer(HID_T) :: fileHandle + integer(HID_T) :: fileHandle, groupHandle character(len=32) :: rankStr call DMDAVecGetArrayF90(mech_grid,solution_current,u_current,ierr); CHKERRQ(ierr) @@ -373,18 +377,20 @@ subroutine grid_mech_FEM_restartWrite() write(rankStr,'(a1,i0)')'_',worldrank fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w') + groupHandle = HDF5_addGroup(fileHandle,'solver') - call HDF5_write(fileHandle,F_aim, 'F_aim') - call HDF5_write(fileHandle,F_aim_lastInc, 'F_aim_lastInc') - call HDF5_write(fileHandle,F_aimDot, 'F_aimDot') - call HDF5_write(fileHandle,F, 'F') - call HDF5_write(fileHandle,F_lastInc, 'F_lastInc') - call HDF5_write(fileHandle,u_current, 'u') - call HDF5_write(fileHandle,u_lastInc, 'u_lastInc') + call HDF5_write(groupHandle,F_aim, 'F_aim') + call HDF5_write(groupHandle,F_aim_lastInc,'F_aim_lastInc') + call HDF5_write(groupHandle,F_aimDot, 'F_aimDot') + call HDF5_write(groupHandle,F, 'F') + call HDF5_write(groupHandle,F_lastInc, 'F_lastInc') + call HDF5_write(groupHandle,u_current, 'u') + call HDF5_write(groupHandle,u_lastInc, 'u_lastInc') - call HDF5_write(fileHandle,C_volAvg, 'C_volAvg') - call HDF5_write(fileHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_write(groupHandle,C_volAvg, 'C_volAvg') + call HDF5_write(groupHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) call DMDAVecRestoreArrayF90(mech_grid,solution_current,u_current,ierr);CHKERRQ(ierr) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 6aa56ef76..c3f538680 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -94,8 +94,8 @@ subroutine grid_mech_spectral_basic_init PetscScalar, pointer, dimension(:,:,:,:) :: & F ! pointer to solution data PetscInt, dimension(worldsize) :: localK - integer(HID_T) :: fileHandle - integer :: fileUnit + integer(HID_T) :: fileHandle, groupHandle + integer :: fileUnit character(len=1024) :: rankStr write(6,'(/,a)') ' <<<+- grid_mech_spectral_basic init -+>>>' @@ -150,18 +150,19 @@ subroutine grid_mech_spectral_basic_init ! init fields call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! places pointer on PETSc data - restartRead: if (interface_restartInc > 0) then + restartRead: if (interface_restartInc > 0) then write(6,'(/,a,'//IO_intOut(interface_restartInc)//',a)') & ' reading values of increment ', interface_restartInc, ' from file' write(rankStr,'(a1,i0)')'_',worldrank - fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') + fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') + groupHandle = HDF5_openGroup(fileHandle,'solver') - call HDF5_read(fileHandle,F_aim, 'F_aim') - call HDF5_read(fileHandle,F_aim_lastInc,'F_aim_lastInc') - call HDF5_read(fileHandle,F_aimDot, 'F_aimDot') - call HDF5_read(fileHandle,F, 'F') - call HDF5_read(fileHandle,F_lastInc, 'F_lastInc') + call HDF5_read(groupHandle,F_aim, 'F_aim') + call HDF5_read(groupHandle,F_aim_lastInc,'F_aim_lastInc') + call HDF5_read(groupHandle,F_aimDot, 'F_aimDot') + call HDF5_read(groupHandle,F, 'F') + call HDF5_read(groupHandle,F_lastInc, 'F_lastInc') elseif (interface_restartInc == 0) then restartRead F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity @@ -179,8 +180,10 @@ subroutine grid_mech_spectral_basic_init restartRead2: if (interface_restartInc > 0) then write(6,'(/,a,'//IO_intOut(interface_restartInc)//',a)') & 'reading more values of increment ', interface_restartInc, ' from file' - call HDF5_read(fileHandle,C_volAvg, 'C_volAvg') - call HDF5_read(fileHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_read(groupHandle,C_volAvg, 'C_volAvg') + call HDF5_read(groupHandle,C_volAvgLastInc,'C_volAvgLastInc') + + call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) call MPI_File_open(PETSC_COMM_WORLD, trim(getSolverJobName())//'.C_ref', & @@ -333,7 +336,7 @@ subroutine grid_mech_spectral_basic_restartWrite() PetscErrorCode :: ierr PetscScalar, dimension(:,:,:,:), pointer :: F - integer(HID_T) :: fileHandle + integer(HID_T) :: fileHandle, groupHandle character(len=32) :: rankStr call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) @@ -342,17 +345,19 @@ subroutine grid_mech_spectral_basic_restartWrite() write(rankStr,'(a1,i0)')'_',worldrank fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w') + groupHandle = HDF5_addGroup(fileHandle,'solver') - call HDF5_write(fileHandle,F_aim, 'F_aim') - call HDF5_write(fileHandle,F_aim_lastInc,'F_aim_lastInc') - call HDF5_write(fileHandle,F_aimDot, 'F_aimDot') - call HDF5_write(fileHandle,F, 'F') - call HDF5_write(fileHandle,F_lastInc, 'F_lastInc') + call HDF5_write(groupHandle,F_aim, 'F_aim') + call HDF5_write(groupHandle,F_aim_lastInc,'F_aim_lastInc') + call HDF5_write(groupHandle,F_aimDot, 'F_aimDot') + call HDF5_write(groupHandle,F, 'F') + call HDF5_write(groupHandle,F_lastInc, 'F_lastInc') - call HDF5_write(fileHandle,C_volAvg, 'C_volAvg') - call HDF5_write(fileHandle,C_volAvgLastInc,'C_volAvgLastInc') - call HDF5_write(fileHandle,C_minMaxAvg, 'C_minMaxAvg') + call HDF5_write(groupHandle,C_volAvg, 'C_volAvg') + call HDF5_write(groupHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_write(groupHandle,C_minMaxAvg, 'C_minMaxAvg') + call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) if (num%update_gamma) call utilities_saveReferenceStiffness diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 792b89fce..4c3f2de72 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -102,8 +102,8 @@ subroutine grid_mech_spectral_polarisation_init F, & ! specific (sub)pointer F_tau ! specific (sub)pointer PetscInt, dimension(worldsize) :: localK - integer(HID_T) :: fileHandle - integer :: fileUnit + integer(HID_T) :: fileHandle, groupHandle + integer :: fileUnit character(len=1024) :: rankStr write(6,'(/,a)') ' <<<+- grid_mech_spectral_polarisation init -+>>>' @@ -156,23 +156,24 @@ subroutine grid_mech_spectral_polarisation_init !-------------------------------------------------------------------------------------------------- ! init fields call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) ! places pointer on PETSc data - F => FandF_tau( 0: 8,:,:,:) - F_tau => FandF_tau( 9:17,:,:,:) + F => FandF_tau(0: 8,:,:,:) + F_tau => FandF_tau(9:17,:,:,:) restartRead: if (interface_restartInc > 0) then write(6,'(/,a,'//IO_intOut(interface_restartInc)//',a)') & ' reading values of increment ', interface_restartInc, ' from file' write(rankStr,'(a1,i0)')'_',worldrank - fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') + fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5') + groupHandle = HDF5_openGroup(fileHandle,'solver') - call HDF5_read(fileHandle,F_aim, 'F_aim') - call HDF5_read(fileHandle,F_aim_lastInc,'F_aim_lastInc') - call HDF5_read(fileHandle,F_aimDot, 'F_aimDot') - call HDF5_read(fileHandle,F, 'F') - call HDF5_read(fileHandle,F_lastInc, 'F_lastInc') - call HDF5_read(fileHandle,F_tau, 'F_tau') - call HDF5_read(fileHandle,F_tau_lastInc,'F_tau_lastInc') + call HDF5_read(groupHandle,F_aim, 'F_aim') + call HDF5_read(groupHandle,F_aim_lastInc,'F_aim_lastInc') + call HDF5_read(groupHandle,F_aimDot, 'F_aimDot') + call HDF5_read(groupHandle,F, 'F') + call HDF5_read(groupHandle,F_lastInc, 'F_lastInc') + call HDF5_read(groupHandle,F_tau, 'F_tau') + call HDF5_read(groupHandle,F_tau_lastInc,'F_tau_lastInc') elseif (interface_restartInc == 0) then restartRead F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity @@ -192,8 +193,10 @@ subroutine grid_mech_spectral_polarisation_init restartRead2: if (interface_restartInc > 0) then write(6,'(/,a,'//IO_intOut(interface_restartInc)//',a)') & ' reading more values of increment ', interface_restartInc, ' from file' - call HDF5_read(fileHandle,C_volAvg, 'C_volAvg') - call HDF5_read(fileHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_read(groupHandle,C_volAvg, 'C_volAvg') + call HDF5_read(groupHandle,C_volAvgLastInc,'C_volAvgLastInc') + + call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) call MPI_File_open(PETSC_COMM_WORLD, trim(getSolverJobName())//'.C_ref', & @@ -362,7 +365,7 @@ subroutine grid_mech_spectral_polarisation_age() PetscScalar, dimension(:,:,:,:), pointer :: FandF_tau, F call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) - F => FandF_tau(0: 8,:,:,:) + F => FandF_tau(0:8,:,:,:) materialpoint_F0 = reshape(F,[3,3,1,product(grid(1:2))*grid3]) call utilities_updateCoords(F) call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) @@ -377,7 +380,7 @@ subroutine grid_mech_spectral_polarisation_restartWrite() PetscErrorCode :: ierr PetscScalar, dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau - integer(HID_T) :: fileHandle + integer(HID_T) :: fileHandle, groupHandle character(len=32) :: rankStr call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) @@ -387,19 +390,21 @@ subroutine grid_mech_spectral_polarisation_restartWrite() write(6,'(a)') ' writing solver data required for restart to file';flush(6) write(rankStr,'(a1,i0)')'_',worldrank - fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w') + fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w') + groupHandle = HDF5_addGroup(fileHandle,'solver') - call HDF5_write(fileHandle,F_aim, 'F_aim') - call HDF5_write(fileHandle,F_aim_lastInc, 'F_aim_lastInc') - call HDF5_write(fileHandle,F_aimDot, 'F_aimDot') - call HDF5_write(fileHandle,F, 'F') - call HDF5_write(fileHandle,F_lastInc, 'F_lastInc') - call HDF5_write(fileHandle,F_tau, 'F_tau') - call HDF5_write(fileHandle,F_tau_lastInc, 'F_tau_lastInc') + call HDF5_write(groupHandle,F_aim, 'F_aim') + call HDF5_write(groupHandle,F_aim_lastInc,'F_aim_lastInc') + call HDF5_write(groupHandle,F_aimDot, 'F_aimDot') + call HDF5_write(groupHandle,F, 'F') + call HDF5_write(groupHandle,F_lastInc, 'F_lastInc') + call HDF5_write(groupHandle,F_tau, 'F_tau') + call HDF5_write(groupHandle,F_tau_lastInc,'F_tau_lastInc') - call HDF5_write(fileHandle,C_volAvg, 'C_volAvg') - call HDF5_write(fileHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_write(groupHandle,C_volAvg, 'C_volAvg') + call HDF5_write(groupHandle,C_volAvgLastInc,'C_volAvgLastInc') + call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) if(num%update_gamma) call utilities_saveReferenceStiffness @@ -483,13 +488,13 @@ subroutine formResidual(in, FandF_tau, & integer :: & i, j, k, e - F => FandF_tau(1:3,1:3,1,& + F => FandF_tau(1:3,1:3,1,& XG_RANGE,YG_RANGE,ZG_RANGE) - F_tau => FandF_tau(1:3,1:3,2,& + F_tau => FandF_tau(1:3,1:3,2,& XG_RANGE,YG_RANGE,ZG_RANGE) - residual_F => residuum(1:3,1:3,1,& + residual_F => residuum(1:3,1:3,1,& X_RANGE, Y_RANGE, Z_RANGE) - residual_F_tau => residuum(1:3,1:3,2,& + residual_F_tau => residuum(1:3,1:3,2,& X_RANGE, Y_RANGE, Z_RANGE) F_av = sum(sum(sum(F,dim=5),dim=4),dim=3) * wgt