grid_mech_FEM works

This commit is contained in:
Vitesh Shah 2019-04-10 18:19:10 +02:00
parent 5989075009
commit 1852f580ad
1 changed files with 29 additions and 41 deletions

View File

@ -7,6 +7,8 @@
module grid_mech_FEM module grid_mech_FEM
#include <petsc/finclude/petscsnes.h> #include <petsc/finclude/petscsnes.h>
#include <petsc/finclude/petscdmda.h> #include <petsc/finclude/petscdmda.h>
use DAMASK_interface
use HDF5_utilities
use PETScdmda use PETScdmda
use PETScsnes use PETScsnes
use prec, only: & use prec, only: &
@ -115,6 +117,7 @@ subroutine grid_mech_FEM_init
PetscErrorCode :: ierr PetscErrorCode :: ierr
integer(pInt) :: rank integer(pInt) :: rank
integer :: fileUnit integer :: fileUnit
integer(HID_T) :: fileHandle
character(len=1024) :: rankStr character(len=1024) :: rankStr
real(pReal), dimension(3,3,3,3) :: devNull real(pReal), dimension(3,3,3,3) :: devNull
PetscScalar, pointer, dimension(:,:,:,:) :: & PetscScalar, pointer, dimension(:,:,:,:) :: &
@ -203,24 +206,16 @@ subroutine grid_mech_FEM_init
restart: if (restartInc > 0) then restart: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading values of increment ', restartInc, ' from file' write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading values of increment ', restartInc, ' from file'
fileUnit = IO_open_jobFile_binary('F_aim')
read(fileUnit) F_aim; close(fileUnit)
fileUnit = IO_open_jobFile_binary('F_aim_lastInc')
read(fileUnit) F_aim_lastInc; close(fileUnit)
fileUnit = IO_open_jobFile_binary('F_aimDot')
read(fileUnit) F_aimDot; close(fileUnit)
write(rankStr,'(a1,i0)')'_',worldrank write(rankStr,'(a1,i0)')'_',worldrank
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5')
fileUnit = IO_open_jobFile_binary('F'//trim(rankStr)) call HDF5_read(fileHandle,F_aim, 'F_aim')
read(fileUnit) F; close (fileUnit) call HDF5_read(fileHandle,F_aim_lastInc,'F_aim_lastInc')
fileUnit = IO_open_jobFile_binary('F_lastInc'//trim(rankStr)) call HDF5_read(fileHandle,F_aimDot, 'F_aimDot')
read(fileUnit) F_lastInc; close (fileUnit) call HDF5_read(fileHandle,F, 'F')
fileUnit = IO_open_jobFile_binary('u'//trim(rankStr)) call HDF5_read(fileHandle,F_lastInc, 'F_lastInc')
read(fileUnit) u_current; close (fileUnit) call HDF5_read(fileHandle,u_current, 'u')
fileUnit = IO_open_jobFile_binary('u_lastInc'//trim(rankStr)) call HDF5_read(fileHandle,u_lastInc, 'u_lastInc')
read(fileUnit) u_lastInc; close (fileUnit)
elseif (restartInc == 0) then restart elseif (restartInc == 0) then restart
F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity
F = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) F = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3)
@ -238,10 +233,9 @@ subroutine grid_mech_FEM_init
restartRead: if (restartInc > 0_pInt) then restartRead: if (restartInc > 0_pInt) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading more values of increment ', restartInc, ' from file' write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading more values of increment ', restartInc, ' from file'
fileUnit = IO_open_jobFile_binary('C_volAvg') call HDF5_read(fileHandle,C_volAvg, 'C_volAvg')
read(fileUnit) C_volAvg; close(fileUnit) call HDF5_read(fileHandle,C_volAvgLastInc,'C_volAvgLastInc')
fileUnit = IO_open_jobFile_binary('C_volAvgLastInv') call HDF5_closeFile(fileHandle)
read(fileUnit) C_volAvgLastInc; close(fileUnit)
endif restartRead endif restartRead
end subroutine grid_mech_FEM_init end subroutine grid_mech_FEM_init
@ -348,6 +342,7 @@ subroutine grid_mech_FEM_forward(guess,timeinc,timeinc_old,loadCaseTime,deformat
real(pReal), dimension(3,3), intent(in) :: & real(pReal), dimension(3,3), intent(in) :: &
rotation_BC rotation_BC
PetscErrorCode :: ierr PetscErrorCode :: ierr
integer(HID_T) :: fileHandle
integer :: fileUnit integer :: fileUnit
character(len=32) :: rankStr character(len=32) :: rankStr
PetscScalar, pointer, dimension(:,:,:,:) :: & PetscScalar, pointer, dimension(:,:,:,:) :: &
@ -364,30 +359,23 @@ subroutine grid_mech_FEM_forward(guess,timeinc,timeinc_old,loadCaseTime,deformat
if (restartWrite) then ! QUESTION: where is this logical properly set? if (restartWrite) then ! QUESTION: where is this logical properly set?
write(6,'(/,a)') ' writing converged results for restart' write(6,'(/,a)') ' writing converged results for restart'
flush(6) flush(6)
write(rankStr,'(a1,i0)')'_',worldrank
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w')
if (worldrank == 0) then if (worldrank == 0) then
fileUnit = IO_open_jobFile_binary('C_volAvg','w') call HDF5_write(fileHandle,C_volAvg, 'C_volAvg')
write(fileUnit) C_volAvg; close(fileUnit) call HDF5_write(fileHandle,C_volAvgLastInc,'C_volAvgLastInc')
fileUnit = IO_open_jobFile_binary('C_volAvgLastInv','w') call HDF5_write(fileHandle,F_aim, 'F_aim')
write(fileUnit) C_volAvgLastInc; close(fileUnit) call HDF5_write(fileHandle,F_aim_lastInc, 'F_aim_lastInc')
fileUnit = IO_open_jobFile_binary('F_aim','w') call HDF5_write(fileHandle,F_aimDot, 'F_aimDot')
write(fileUnit) F_aim; close(fileUnit) call HDF5_write(fileHandle,F, 'F')
fileUnit = IO_open_jobFile_binary('F_aim_lastInc','w') call HDF5_write(fileHandle,F_lastInc, 'F_lastInc')
write(fileUnit) F_aim_lastInc; close(fileUnit) call HDF5_write(fileHandle,u_current, 'u')
fileUnit = IO_open_jobFile_binary('F_aimDot','w') call HDF5_write(fileHandle,u_lastInc, 'u_lastInc')
write(fileUnit) F_aimDot; close(fileUnit) call HDF5_closeFile(fileHandle)
endif endif
write(rankStr,'(a1,i0)')'_',worldrank
fileUnit = IO_open_jobFile_binary('F'//trim(rankStr),'w')
write(fileUnit) F; close (fileUnit)
fileUnit = IO_open_jobFile_binary('F_lastInc'//trim(rankStr),'w')
write(fileUnit) F_lastInc; close (fileUnit)
fileUnit = IO_open_jobFile_binary('u'//trim(rankStr),'w')
write(fileUnit) u_current; close (fileUnit)
fileUnit = IO_open_jobFile_binary('u_lastInc'//trim(rankStr),'w')
write(fileUnit) u_lastInc; close (fileUnit)
endif endif
call CPFEM_age() ! age state and kinematics call CPFEM_age() ! age state and kinematics
call utilities_updateIPcoords(F) call utilities_updateIPcoords(F)