most of the functionality is only relevant for commercial FEM

This commit is contained in:
Martin Diehl 2019-06-15 15:48:47 +02:00
parent 0c52262e4a
commit 25d02c2f19
7 changed files with 70 additions and 78 deletions

View File

@ -42,7 +42,7 @@ contains
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_initAll
call DAMASK_interface_init ! Spectral and FEM interface to commandline
call DAMASK_interface_init ! Spectral and FEM interface to commandline
call prec_init
call IO_init
#ifdef FEM
@ -52,7 +52,6 @@ subroutine CPFEM_initAll
call debug_init
call config_init
call math_init
call FE_init
call mesh_init
call lattice_init
call HDF5_utilities_init
@ -78,8 +77,8 @@ subroutine CPFEM_init
write(6,'(/,a)') ' <<<+- CPFEM init -+>>>'
flush(6)
! *** restore the last converged values of each essential variable from the binary file
if (restartRead) then
! *** restore the last converged values of each essential variable
if (interface_restartInc > 0) then
if (iand(debug_level(debug_CPFEM), debug_levelExtensive) /= 0) then
write(6,'(a)') '<< CPFEM >> restored state variables of last converged step from hdf5 file'
flush(6)
@ -89,30 +88,28 @@ 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, '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')
groupPlasticID = HDF5_openGroup(fileHandle,'PlasticPhases')
do ph = 1,size(phase_plasticity)
write(PlasticItem,*) ph,'_'
call HDF5_read(groupPlasticID,plasticState(ph)%state0,trim(PlasticItem)//'convergedStateConst')
write(PlasticItem,*) ph,'_'
call HDF5_read(groupPlasticID,plasticState(ph)%state0,trim(PlasticItem)//'convergedStateConst')
enddo
call HDF5_closeGroup(groupPlasticID)
groupHomogID = HDF5_openGroup(fileHandle,'HomogStates')
do homog = 1, material_Nhomogenization
write(HomogItem,*) homog,'_'
call HDF5_read(groupHomogID,homogState(homog)%state0, trim(HomogItem)//'convergedStateHomog')
write(HomogItem,*) homog,'_'
call HDF5_read(groupHomogID,homogState(homog)%state0, trim(HomogItem)//'convergedStateHomog')
enddo
call HDF5_closeGroup(groupHomogID)
call HDF5_closeFile(fileHandle)
restartRead = .false.
endif
end subroutine CPFEM_init
@ -135,7 +132,7 @@ subroutine CPFEM_age
crystallite_Lp0 = crystallite_Lp
crystallite_Fi0 = crystallite_Fi
crystallite_Li0 = crystallite_Li
crystallite_S0 = crystallite_S
crystallite_S0 = crystallite_S
do i = 1, size(plasticState)
plasticState(i)%state0 = plasticState(i)%state
@ -157,12 +154,12 @@ subroutine CPFEM_age
write(rankStr,'(a1,i0)')'_',worldrank
fileHandle = HDF5_openFile(trim(getSolverJobName())//trim(rankStr)//'.hdf5','a')
call HDF5_write(fileHandle,crystallite_F0, 'convergedF')
call HDF5_write(fileHandle,crystallite_Fp0, 'convergedFp')
call HDF5_write(fileHandle,crystallite_Fi0, 'convergedFi')
call HDF5_write(fileHandle,crystallite_Lp0, 'convergedLp')
call HDF5_write(fileHandle,crystallite_Li0, 'convergedLi')
call HDF5_write(fileHandle,crystallite_S0, 'convergedS')
call HDF5_write(fileHandle,crystallite_F0, 'convergedF')
call HDF5_write(fileHandle,crystallite_Fp0, 'convergedFp')
call HDF5_write(fileHandle,crystallite_Fi0, 'convergedFi')
call HDF5_write(fileHandle,crystallite_Lp0, 'convergedLp')
call HDF5_write(fileHandle,crystallite_Li0, 'convergedLi')
call HDF5_write(fileHandle,crystallite_S0, 'convergedS')
groupPlastic = HDF5_addGroup(fileHandle,'PlasticPhases')
do ph = 1,size(phase_plasticity)
@ -193,8 +190,8 @@ end subroutine CPFEM_age
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_results(inc,time)
integer, intent(in) :: inc
real(pReal), intent(in) :: time
integer, intent(in) :: inc
real(pReal), intent(in) :: time
call results_openJobFile
call results_addIncrement(inc,time)

View File

@ -1,8 +1,7 @@
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief triggering reading in of restart information when doing a restart
!> @todo Descriptions for public variables needed
!> @brief holds some global variables and gets extra information for commercial FEM
!--------------------------------------------------------------------------------------------------
module FEsolving
use prec
@ -12,32 +11,34 @@ module FEsolving
implicit none
private
integer, public :: &
restartInc = 1 !< needs description
logical, public :: &
symmetricSolver = .false., & !< use a symmetric FEM solver
restartWrite = .false., & !< write current state to enable restart
#if defined(Marc4DAMASK) || defined(Abaqus)
restartRead = .false., & !< restart information to continue calculation from saved state
#endif
restartWrite = .false., & !< write current state to enable restart
terminallyIll = .false. !< at least one material point is terminally ill
integer, dimension(:,:), allocatable, public :: &
FEsolving_execIP !< for ping-pong scheme always range to max IP, otherwise one specific IP
integer, dimension(2), public :: &
integer, dimension(2), public :: &
FEsolving_execElem !< for ping-pong scheme always whole range, otherwise one specific element
#if defined(Marc4DAMASK) || defined(Abaqus)
logical, public, protected :: &
symmetricSolver = .false., & !< use a symmetric FEM solver
character(len=1024), public :: &
modelName !< needs description
logical, dimension(:,:), allocatable, public :: &
calcMode !< do calculation or simply collect when using ping pong scheme
public :: FE_init
#endif
contains
#if defined(Marc4DAMASK) || defined(Abaqus)
!--------------------------------------------------------------------------------------------------
!> @brief determine whether a symmetric solver is used and whether restart is requested
!> @details restart information is found in input file in case of FEM solvers, in case of spectal
@ -45,27 +46,15 @@ contains
!--------------------------------------------------------------------------------------------------
subroutine FE_init
#if defined(Marc4DAMASK) || defined(Abaqus)
integer, parameter :: &
FILEUNIT = 222
integer :: j
character(len=65536) :: tag, line
integer, allocatable, dimension(:) :: chunkPos
#endif
write(6,'(/,a)') ' <<<+- FEsolving init -+>>>'
modelName = getSolverJobName()
#if defined(Grid) || defined(FEM)
restartInc = interface_RestartInc
if(restartInc < 0) then
call IO_warning(warning_ID=34)
restartInc = 0
endif
restartRead = restartInc > 0 ! only read in if "true" restart requested
#else
modelName = getSolverJobName()
call IO_open_inputFile(FILEUNIT,modelName)
rewind(FILEUNIT)
do
@ -125,7 +114,6 @@ subroutine FE_init
200 close(FILEUNIT)
endif
#endif
if (iand(debug_level(debug_FEsolving),debug_levelBasic) /= 0) then
write(6,'(a21,l1)') ' restart writing: ', restartWrite
write(6,'(a21,l1)') ' restart reading: ', restartRead
@ -133,5 +121,6 @@ subroutine FE_init
endif
end subroutine FE_init
#endif
end module FEsolving

View File

@ -336,20 +336,20 @@ program DAMASK_spectral
writeHeader: if (interface_restartInc < 1) then
open(newunit=fileUnit,file=trim(getSolverJobName())//&
'.spectralOut',form='UNFORMATTED',status='REPLACE')
write(fileUnit) 'load:', trim(loadCaseFile) ! ... and write header
write(fileUnit) 'load:', trim(loadCaseFile) ! ... and write header
write(fileUnit) 'workingdir:', 'n/a'
write(fileUnit) 'geometry:', trim(geometryFile)
write(fileUnit) 'grid:', grid
write(fileUnit) 'size:', geomSize
write(fileUnit) 'materialpoint_sizeResults:', materialpoint_sizeResults
write(fileUnit) 'loadcases:', size(loadCases)
write(fileUnit) 'frequencies:', loadCases%outputfrequency ! one entry per LoadCase
write(fileUnit) 'times:', loadCases%time ! one entry per LoadCase
write(fileUnit) 'frequencies:', loadCases%outputfrequency ! one entry per LoadCase
write(fileUnit) 'times:', loadCases%time ! one entry per LoadCase
write(fileUnit) 'logscales:', loadCases%logscale
write(fileUnit) 'increments:', loadCases%incs ! one entry per LoadCase
write(fileUnit) 'startingIncrement:', restartInc ! start with writing out the previous inc
write(fileUnit) 'increments:', loadCases%incs ! one entry per LoadCase
write(fileUnit) 'startingIncrement:', interface_restartInc ! start with writing out the previous inc
write(fileUnit) 'eoh'
close(fileUnit) ! end of header
close(fileUnit) ! end of header
open(newunit=statUnit,file=trim(getSolverJobName())//&
'.sta',form='FORMATTED',status='REPLACE')
write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded' ! statistics file
@ -425,7 +425,7 @@ program DAMASK_spectral
endif
timeinc = timeinc * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step
skipping: if (totalIncsCounter <= restartInc) then ! not yet at restart inc?
skipping: if (totalIncsCounter <= interface_restartInc) then ! not yet at restart inc?
time = time + timeinc ! just advance time, skip already performed calculation
guess = .true. ! QUESTION:why forced guessing instead of inheriting loadcase preference
else skipping

View File

@ -181,8 +181,9 @@ subroutine grid_mech_FEM_init
!--------------------------------------------------------------------------------------------------
! init fields
restart: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading values of increment ', restartInc, ' from file'
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')
@ -195,10 +196,10 @@ subroutine grid_mech_FEM_init
call HDF5_read(fileHandle,u_current, 'u')
call HDF5_read(fileHandle,u_lastInc, 'u_lastInc')
elseif (restartInc == 0) then restart
elseif (interface_restartInc == 0) then restartRead
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)
endif restart
endif restartRead
materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent
call utilities_updateIPcoords(F)
call utilities_constitutiveResponse(P_current,temp33_Real,C_volAvg,devNull, & ! stress field, stress avg, global average of stiffness and (min+max)/2
@ -210,12 +211,13 @@ subroutine grid_mech_FEM_init
call DMDAVecRestoreArrayF90(mech_grid,solution_lastInc,u_lastInc,ierr)
CHKERRQ(ierr)
restartRead: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading more values of increment ', restartInc, ' from file'
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_closeFile(fileHandle)
endif restartRead
endif restartRead2
end subroutine grid_mech_FEM_init

View File

@ -151,8 +151,9 @@ subroutine grid_mech_spectral_basic_init
! init fields
call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! places pointer on PETSc data
restart: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') ' reading values of increment ', restartInc, ' from file'
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')
@ -163,10 +164,10 @@ subroutine grid_mech_spectral_basic_init
call HDF5_read(fileHandle,F, 'F')
call HDF5_read(fileHandle,F_lastInc, 'F_lastInc')
elseif (restartInc == 0) then restart
elseif (interface_restartInc == 0) then restartRead
F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity
F = reshape(F_lastInc,[9,grid(1),grid(2),grid3])
endif restart
endif restartRead
materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent
call Utilities_updateIPcoords(reshape(F,shape(F_lastInc)))
@ -176,15 +177,16 @@ subroutine grid_mech_spectral_basic_init
math_I3) ! no rotation of boundary condition
call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! deassociate pointer
restartRead: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') 'reading more values of increment ', restartInc, ' from file'
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_closeFile(fileHandle)
fileUnit = IO_open_jobFile_binary('C_ref')
read(fileUnit) C_minMaxAvg; close(fileUnit)
endif restartRead
endif restartRead2
call utilities_updateGamma(C_minMaxAvg,.true.)

View File

@ -160,8 +160,9 @@ subroutine grid_mech_spectral_polarisation_init
F => FandF_tau( 0: 8,:,:,:)
F_tau => FandF_tau( 9:17,:,:,:)
restart: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') ' reading values of increment ', restartInc, ' from file'
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')
@ -174,12 +175,12 @@ subroutine grid_mech_spectral_polarisation_init
call HDF5_read(fileHandle,F_tau, 'F_tau')
call HDF5_read(fileHandle,F_tau_lastInc,'F_tau_lastInc')
elseif (restartInc == 0) then restart
elseif (interface_restartInc == 0) then restartRead
F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity
F = reshape(F_lastInc,[9,grid(1),grid(2),grid3])
F_tau = 2.0_pReal*F
F_tau_lastInc = 2.0_pReal*F_lastInc
endif restart
endif restartRead
materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent
call Utilities_updateIPcoords(reshape(F,shape(F_lastInc)))
@ -189,15 +190,16 @@ subroutine grid_mech_spectral_polarisation_init
math_I3) ! no rotation of boundary condition
call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) ! deassociate pointer
restartRead: if (restartInc > 0) then
write(6,'(/,a,'//IO_intOut(restartInc)//',a)') ' reading more values of increment ', restartInc, ' from file'
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_closeFile(fileHandle)
fileUnit = IO_open_jobFile_binary('C_ref')
read(fileUnit) C_minMaxAvg; close(fileUnit)
endif restartRead
endif restartRead2
call utilities_updateGamma(C_minMaxAvg,.true.)
C_scale = C_minMaxAvg

View File

@ -291,7 +291,7 @@ program DAMASK_FEM
endif
timeinc = timeinc * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step
skipping: if (totalIncsCounter <= restartInc) then ! not yet at restart inc?
skipping: if (totalIncsCounter <= interface_restartInc) then ! not yet at restart inc?
time = time + timeinc ! just advance time, skip already performed calculation
guess = .true.
else skipping