grid_mech_polarisation works

This commit is contained in:
Vitesh Shah 2019-04-11 15:51:34 +02:00
parent 1852f580ad
commit 8609c959df
1 changed files with 77 additions and 44 deletions

View File

@ -7,6 +7,8 @@
module grid_mech_spectral_polarisation module grid_mech_spectral_polarisation
#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: &
@ -124,6 +126,7 @@ subroutine grid_mech_spectral_polarisation_init
F, & ! specific (sub)pointer F, & ! specific (sub)pointer
F_tau ! specific (sub)pointer F_tau ! specific (sub)pointer
PetscInt, dimension(worldsize) :: localK PetscInt, dimension(worldsize) :: localK
integer(HID_T) :: fileHandle
integer :: fileUnit integer :: fileUnit
character(len=1024) :: rankStr character(len=1024) :: rankStr
@ -183,23 +186,34 @@ subroutine grid_mech_spectral_polarisation_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('F_tau'//trim(rankStr)) call HDF5_read(fileHandle,F_lastInc, 'F_lastInc')
read(fileUnit) F_tau; close (fileUnit) call HDF5_read(fileHandle,F_tau, 'F_tau')
fileUnit = IO_open_jobFile_binary('F_tau_lastInc'//trim(rankStr)) call HDF5_read(fileHandle,F_tau_lastInc, 'F_tau_lastInc')
read(fileUnit) F_tau_lastInc; close (fileUnit)
! 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
! fileUnit = IO_open_jobFile_binary('F'//trim(rankStr))
! read(fileUnit) F; close (fileUnit)
! fileUnit = IO_open_jobFile_binary('F_lastInc'//trim(rankStr))
! read(fileUnit) F_lastInc; close (fileUnit)
! fileUnit = IO_open_jobFile_binary('F_tau'//trim(rankStr))
! read(fileUnit) F_tau; close (fileUnit)
! fileUnit = IO_open_jobFile_binary('F_tau_lastInc'//trim(rankStr))
! read(fileUnit) F_tau_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
@ -218,12 +232,16 @@ subroutine grid_mech_spectral_polarisation_init
restartRead: if (restartInc > 0) then restartRead: if (restartInc > 0) 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_read(fileHandle,C_minMaxAvg,'C_ref')
read(fileUnit) C_volAvgLastInc; close(fileUnit) call HDF5_closeFile(fileHandle)
fileUnit = IO_open_jobFile_binary('C_ref') ! fileUnit = IO_open_jobFile_binary('C_volAvg')
read(fileUnit) C_minMaxAvg; close(fileUnit) ! read(fileUnit) C_volAvg; close(fileUnit)
! fileUnit = IO_open_jobFile_binary('C_volAvgLastInv')
! read(fileUnit) C_volAvgLastInc; close(fileUnit)
! fileUnit = IO_open_jobFile_binary('C_ref')
! read(fileUnit) C_minMaxAvg; close(fileUnit)
endif restartRead endif restartRead
call Utilities_updateGamma(C_minMaxAvg,.true.) call Utilities_updateGamma(C_minMaxAvg,.true.)
@ -348,6 +366,7 @@ subroutine grid_mech_spectral_polarisation_forward(guess,timeinc,timeinc_old,loa
real(pReal), dimension(3,3) :: F_lambda33 real(pReal), dimension(3,3) :: F_lambda33
integer :: fileUnit integer :: fileUnit
integer(HID_T) :: fileHandle
character(len=32) :: rankStr character(len=32) :: rankStr
call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr)
@ -361,31 +380,45 @@ subroutine grid_mech_spectral_polarisation_forward(guess,timeinc,timeinc_old,loa
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! restart information for spectral solver ! restart information for spectral solver
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)
if (worldrank == 0) then
fileUnit = IO_open_jobFile_binary('C_volAvg','w')
write(fileUnit) C_volAvg; close(fileUnit)
fileUnit = IO_open_jobFile_binary('C_volAvgLastInv','w')
write(fileUnit) C_volAvgLastInc; close(fileUnit)
fileUnit = IO_open_jobFile_binary('F_aim','w')
write(fileUnit) F_aim; close(fileUnit)
fileUnit = IO_open_jobFile_binary('F_aim_lastInc','w')
write(fileUnit) F_aim_lastInc; close(fileUnit)
fileUnit = IO_open_jobFile_binary('F_aimDot','w')
write(fileUnit) F_aimDot; close(fileUnit)
endif
write(rankStr,'(a1,i0)')'_',worldrank write(rankStr,'(a1,i0)')'_',worldrank
fileUnit = IO_open_jobFile_binary('F'//trim(rankStr),'w') fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','w')
write(fileUnit) F; close (fileUnit)
fileUnit = IO_open_jobFile_binary('F_lastInc'//trim(rankStr),'w') if (worldrank == 0) then
write(fileUnit) F_lastInc; close (fileUnit) call HDF5_write(fileHandle,C_volAvg, 'C_volAvg')
fileUnit = IO_open_jobFile_binary('F_tau'//trim(rankStr),'w') call HDF5_write(fileHandle,C_volAvgLastInc,'C_volAvgLastInc')
write(fileUnit) F_tau; close (fileUnit) call HDF5_write(fileHandle,F_aim, 'F_aim')
fileUnit = IO_open_jobFile_binary('F_tau_lastInc'//trim(rankStr),'w') call HDF5_write(fileHandle,F_aimDot, 'F_aimDot')
write(fileUnit) F_tau_lastInc; close (fileUnit) call HDF5_write(fileHandle,F_lastInc, 'F_lastInc')
! fileUnit = IO_open_jobFile_binary('C_volAvg','w')
! write(fileUnit) C_volAvg; close(fileUnit)
! fileUnit = IO_open_jobFile_binary('C_volAvgLastInv','w')
! write(fileUnit) C_volAvgLastInc; close(fileUnit)
! fileUnit = IO_open_jobFile_binary('F_aim','w')
! write(fileUnit) F_aim; close(fileUnit)
! fileUnit = IO_open_jobFile_binary('F_aim_lastInc','w')
! write(fileUnit) F_aim_lastInc; close(fileUnit)
! fileUnit = IO_open_jobFile_binary('F_aimDot','w')
call HDF5_closeFile(fileHandle)
!write(fileUnit) F_aimDot; close(fileUnit)
endif
!write(rankStr,'(a1,i0)')'_',worldrank
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_closeFile(fileHandle)
! 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('F_tau'//trim(rankStr),'w')
! write(fileUnit) F_tau; close (fileUnit)
! fileUnit = IO_open_jobFile_binary('F_tau_lastInc'//trim(rankStr),'w')
! write(fileUnit) F_tau_lastInc; close (fileUnit)
endif endif
call CPFEM_age ! age state and kinematics call CPFEM_age ! age state and kinematics