restart for commercial FE solvers untested

better no code than unreliable code. If functionality is needed,
implement it without the use of publicly writeable variables
This commit is contained in:
Martin Diehl 2019-10-23 22:09:11 +02:00
parent 8a4a5a8bef
commit dfe65e406d
4 changed files with 19 additions and 82 deletions

View File

@ -5,17 +5,13 @@
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module FEsolving module FEsolving
use prec use prec
use debug
use IO use IO
use DAMASK_interface use DAMASK_interface
implicit none implicit none
private private
logical, public :: & logical, public :: &
#if defined(Marc4DAMASK) || defined(Abaqus)
restartRead = .false., & !< restart information to continue calculation from saved state
#endif
restartWrite = .false., & !< write current state to enable restart restartWrite = .false., & !< write current state to enable restart
terminallyIll = .false. !< at least one material point is terminally ill terminallyIll = .false. !< at least one material point is terminally ill
@ -27,8 +23,6 @@ module FEsolving
#if defined(Marc4DAMASK) || defined(Abaqus) #if defined(Marc4DAMASK) || defined(Abaqus)
logical, public, protected :: & logical, public, protected :: &
symmetricSolver = .false. !< use a symmetric FEM solver (only Abaqus) symmetricSolver = .false. !< use a symmetric FEM solver (only Abaqus)
character(len=1024), public :: &
modelName !< needs description
logical, dimension(:,:), allocatable, public :: & logical, dimension(:,:), allocatable, public :: &
calcMode !< do calculation or simply collect when using ping pong scheme calcMode !< do calculation or simply collect when using ping pong scheme
@ -40,86 +34,32 @@ contains
#if defined(Marc4DAMASK) || defined(Abaqus) #if defined(Marc4DAMASK) || defined(Abaqus)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief determine whether a symmetric solver is used and whether restart is requested !> @brief determine whether a symmetric solver is used
!> @details restart information is found in input file in case of FEM solvers, in case of spectal
!> solver the information is provided by the interface module
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine FE_init subroutine FE_init
integer, parameter :: & integer, parameter :: &
FILEUNIT = 222 FILEUNIT = 222
integer :: j character(len=pStringLen) :: tag, line
character(len=65536) :: tag, line
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
write(6,'(/,a)') ' <<<+- FEsolving init -+>>>' write(6,'(/,a)') ' <<<+- FEsolving init -+>>>'
modelName = getSolverJobName() call IO_open_inputFile(FILEUNIT)
call IO_open_inputFile(FILEUNIT,modelName)
rewind(FILEUNIT) rewind(FILEUNIT)
do do
read (FILEUNIT,'(a1024)',END=100) line read (FILEUNIT,'(a256)',END=100) line
chunkPos = IO_stringPos(line) chunkPos = IO_stringPos(line)
tag = IO_lc(IO_stringValue(line,chunkPos,1)) ! extract key tag = IO_lc(IO_stringValue(line,chunkPos,1))
select case(tag) select case(tag)
case ('solver') case ('solver')
read (FILEUNIT,'(a1024)',END=100) line ! next line read (FILEUNIT,'(a256)',END=100) line ! next line
chunkPos = IO_stringPos(line) chunkPos = IO_stringPos(line)
symmetricSolver = (IO_intValue(line,chunkPos,2) /= 1) symmetricSolver = (IO_intValue(line,chunkPos,2) /= 1)
case ('restart')
read (FILEUNIT,'(a1024)',END=100) line ! next line
chunkPos = IO_stringPos(line)
restartWrite = iand(IO_intValue(line,chunkPos,1),1) > 0
restartRead = iand(IO_intValue(line,chunkPos,1),2) > 0
case ('*restart')
do j=2,chunkPos(1)
restartWrite = (IO_lc(IO_StringValue(line,chunkPos,j)) == 'write') .or. restartWrite
restartRead = (IO_lc(IO_StringValue(line,chunkPos,j)) == 'read') .or. restartRead
enddo
if(restartWrite) then
do j=2,chunkPos(1)
restartWrite = (IO_lc(IO_StringValue(line,chunkPos,j)) /= 'frequency=0') .and. restartWrite
enddo
endif
end select end select
enddo enddo
100 close(FILEUNIT) 100 close(FILEUNIT)
if (restartRead) then
#ifdef Marc4DAMASK
call IO_open_logFile(FILEUNIT)
rewind(FILEUNIT)
do
read (FILEUNIT,'(a1024)',END=200) line
chunkPos = IO_stringPos(line)
if ( IO_lc(IO_stringValue(line,chunkPos,1)) == 'restart' &
.and. IO_lc(IO_stringValue(line,chunkPos,2)) == 'file' &
.and. IO_lc(IO_stringValue(line,chunkPos,3)) == 'job' &
.and. IO_lc(IO_stringValue(line,chunkPos,4)) == 'id' ) &
modelName = IO_StringValue(line,chunkPos,6)
enddo
#else
call IO_open_inputFile(FILEUNIT,modelName)
rewind(FILEUNIT)
do
read (FILEUNIT,'(a1024)',END=200) line
chunkPos = IO_stringPos(line)
if (IO_lc(IO_stringValue(line,chunkPos,1))=='*heading') then
read (FILEUNIT,'(a1024)',END=200) line
chunkPos = IO_stringPos(line)
modelName = IO_StringValue(line,chunkPos,1)
endif
enddo
#endif
200 close(FILEUNIT)
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
if (restartRead) write(6,'(a,/)') ' restart Job: '//trim(modelName)
endif
end subroutine FE_init end subroutine FE_init
#endif #endif

View File

@ -207,27 +207,26 @@ end function IO_open_binary
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief opens FEM input file for reading located in current working directory to given unit !> @brief opens FEM input file for reading located in current working directory to given unit
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine IO_open_inputFile(fileUnit,modelName) subroutine IO_open_inputFile(fileUnit)
integer, intent(in) :: fileUnit !< file unit integer, intent(in) :: fileUnit !< file unit
character(len=*), intent(in) :: modelName !< model name, in case of restart not solver job name
integer :: myStat integer :: myStat
character(len=1024) :: path character(len=1024) :: path
#if defined(Abaqus) #if defined(Abaqus)
integer :: fileType integer :: fileType
fileType = 1 ! assume .pes fileType = 1 ! assume .pes
path = trim(modelName)//inputFileExtension(fileType) ! attempt .pes, if it exists: it should be used path = trim(getSolverJobName())//inputFileExtension(fileType) ! attempt .pes, if it exists: it should be used
open(fileUnit+1,status='old',iostat=myStat,file=path,action='read',position='rewind') open(fileUnit+1,status='old',iostat=myStat,file=path,action='read',position='rewind')
if(myStat /= 0) then ! if .pes does not work / exist; use conventional extension, i.e.".inp" if(myStat /= 0) then ! if .pes does not work / exist; use conventional extension, i.e.".inp"
fileType = 2 fileType = 2
path = trim(modelName)//inputFileExtension(fileType) path = trim(getSolverJobName())//inputFileExtension(fileType)
open(fileUnit+1,status='old',iostat=myStat,file=path,action='read',position='rewind') open(fileUnit+1,status='old',iostat=myStat,file=path,action='read',position='rewind')
endif endif
if (myStat /= 0) call IO_error(100,el=myStat,ext_msg=path) if (myStat /= 0) call IO_error(100,el=myStat,ext_msg=path)
path = trim(modelName)//inputFileExtension(fileType)//'_assembly' path = trim(getSolverJobName())//inputFileExtension(fileType)//'_assembly'
open(fileUnit,iostat=myStat,file=path) open(fileUnit,iostat=myStat,file=path)
if (myStat /= 0) call IO_error(100,el=myStat,ext_msg=path) if (myStat /= 0) call IO_error(100,el=myStat,ext_msg=path)
if (.not.abaqus_assembleInputFile(fileUnit,fileUnit+1)) call IO_error(103) ! strip comments and concatenate any "include"s if (.not.abaqus_assembleInputFile(fileUnit,fileUnit+1)) call IO_error(103) ! strip comments and concatenate any "include"s
@ -258,10 +257,8 @@ subroutine IO_open_inputFile(fileUnit,modelName)
fname = trim(line(9+scan(line(9:),'='):)) fname = trim(line(9+scan(line(9:),'='):))
inquire(file=fname, exist=fexist) inquire(file=fname, exist=fexist)
if (.not.(fexist)) then if (.not.(fexist)) then
!$OMP CRITICAL (write2out) write(6,*)'ERROR: file does not exist error in abaqus_assembleInputFile'
write(6,*)'ERROR: file does not exist error in abaqus_assembleInputFile' write(6,*)'filename: ', trim(fname)
write(6,*)'filename: ', trim(fname)
!$OMP END CRITICAL (write2out)
createSuccess = .false. createSuccess = .false.
return return
endif endif
@ -285,7 +282,7 @@ subroutine IO_open_inputFile(fileUnit,modelName)
end function abaqus_assembleInputFile end function abaqus_assembleInputFile
#elif defined(Marc4DAMASK) #elif defined(Marc4DAMASK)
path = trim(modelName)//inputFileExtension path = trim(getSolverJobName())//inputFileExtension
open(fileUnit,status='old',iostat=myStat,file=path) open(fileUnit,status='old',iostat=myStat,file=path)
if (myStat /= 0) call IO_error(100,el=myStat,ext_msg=path) if (myStat /= 0) call IO_error(100,el=myStat,ext_msg=path)
#endif #endif

View File

@ -454,7 +454,7 @@ subroutine mesh_init(ip,el)
myDebug = (iand(debug_level(debug_mesh),debug_levelBasic) /= 0) myDebug = (iand(debug_level(debug_mesh),debug_levelBasic) /= 0)
call IO_open_inputFile(FILEUNIT,modelName) ! parse info from input file... call IO_open_inputFile(FILEUNIT) ! parse info from input file...
if (myDebug) write(6,'(a)') ' Opened input file'; flush(6) if (myDebug) write(6,'(a)') ' Opened input file'; flush(6)
noPart = hasNoPart(FILEUNIT) noPart = hasNoPart(FILEUNIT)
call mesh_abaqus_count_nodesAndElements(FILEUNIT) call mesh_abaqus_count_nodesAndElements(FILEUNIT)

View File

@ -201,9 +201,9 @@ subroutine inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogeni
character(len=64), dimension(:), allocatable :: & character(len=64), dimension(:), allocatable :: &
nameElemSet nameElemSet
integer, dimension(:,:), allocatable :: & integer, dimension(:,:), allocatable :: &
mapElemSet !< list of elements in elementSet mapElemSet !< list of elements in elementSet
inputFile = IO_read_ASCII(trim(modelName)//trim(InputFileExtension)) inputFile = IO_read_ASCII(trim(getSolverJobName())//trim(InputFileExtension))
call inputRead_fileFormat(fileFormatVersion, & call inputRead_fileFormat(fileFormatVersion, &
inputFile) inputFile)
call inputRead_tableStyles(initialcondTableStyle,hypoelasticTableStyle, & call inputRead_tableStyles(initialcondTableStyle,hypoelasticTableStyle, &
@ -214,7 +214,7 @@ subroutine inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogeni
call inputRead_NnodesAndElements(nNodes,nElems,& call inputRead_NnodesAndElements(nNodes,nElems,&
inputFile) inputFile)
call IO_open_inputFile(FILEUNIT,modelName) ! ToDo: It would be better to use fileContent call IO_open_inputFile(FILEUNIT) ! ToDo: It would be better to use fileContent
call inputRead_mapElemSets(nameElemSet,mapElemSet,& call inputRead_mapElemSets(nameElemSet,mapElemSet,&
FILEUNIT) FILEUNIT)