define functions where needed

only use solver specific element names
This commit is contained in:
Martin Diehl 2019-01-31 11:29:56 +01:00
parent 346561beed
commit beb0ca01eb
3 changed files with 97 additions and 150 deletions

View File

@ -57,19 +57,11 @@ module IO
public :: & public :: &
IO_open_inputFile, & IO_open_inputFile, &
IO_open_logFile IO_open_logFile
#endif
#ifdef Abaqus
public :: &
IO_abaqus_hasNoPart
#endif #endif
private :: & private :: &
IO_fixedFloatValue, & IO_fixedFloatValue, &
IO_verifyFloatValue, & IO_verifyFloatValue, &
IO_verifyIntValue IO_verifyIntValue
#ifdef Abaqus
private :: &
abaqus_assembleInputFile
#endif
contains contains
@ -385,6 +377,59 @@ subroutine IO_open_inputFile(fileUnit,modelName)
if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path) if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=path)
if (.not.abaqus_assembleInputFile(fileUnit,fileUnit+1_pInt)) call IO_error(103_pInt) ! strip comments and concatenate any "include"s if (.not.abaqus_assembleInputFile(fileUnit,fileUnit+1_pInt)) call IO_error(103_pInt) ! strip comments and concatenate any "include"s
close(fileUnit+1_pInt) close(fileUnit+1_pInt)
contains
!--------------------------------------------------------------------------------------------------
!> @brief create a new input file for abaqus simulations by removing all comment lines and
!> including "include"s
!--------------------------------------------------------------------------------------------------
recursive function abaqus_assembleInputFile(unit1,unit2) result(createSuccess)
implicit none
integer(pInt), intent(in) :: unit1, &
unit2
integer(pInt), allocatable, dimension(:) :: chunkPos
character(len=65536) :: line,fname
logical :: createSuccess,fexist
do
read(unit2,'(A65536)',END=220) line
chunkPos = IO_stringPos(line)
if (IO_lc(IO_StringValue(line,chunkPos,1_pInt))=='*include') then
fname = trim(line(9+scan(line(9:),'='):))
inquire(file=fname, exist=fexist)
if (.not.(fexist)) then
!$OMP CRITICAL (write2out)
write(6,*)'ERROR: file does not exist error in abaqus_assembleInputFile'
write(6,*)'filename: ', trim(fname)
!$OMP END CRITICAL (write2out)
createSuccess = .false.
return
endif
open(unit2+1,err=200,status='old',file=fname)
if (abaqus_assembleInputFile(unit1,unit2+1_pInt)) then
createSuccess=.true.
close(unit2+1)
else
createSuccess=.false.
return
endif
else if (line(1:2) /= '**' .OR. line(1:8)=='**damask') then
write(unit1,'(A)') trim(line)
endif
enddo
220 createSuccess = .true.
return
200 createSuccess =.false.
end function abaqus_assembleInputFile
#endif #endif
#ifdef Marc4DAMASK #ifdef Marc4DAMASK
path = trim(modelName)//inputFileExtension path = trim(modelName)//inputFileExtension
@ -556,35 +601,6 @@ subroutine IO_read_intFile(fileUnit,ext,modelName,recMultiplier)
end subroutine IO_read_intFile end subroutine IO_read_intFile
#ifdef Abaqus
!--------------------------------------------------------------------------------------------------
!> @brief check if the input file for Abaqus contains part info
!--------------------------------------------------------------------------------------------------
logical function IO_abaqus_hasNoPart(fileUnit)
implicit none
integer(pInt), intent(in) :: fileUnit
integer(pInt), allocatable, dimension(:) :: chunkPos
character(len=65536) :: line
IO_abaqus_hasNoPart = .true.
610 FORMAT(A65536)
rewind(fileUnit)
do
read(fileUnit,610,END=620) line
chunkPos = IO_stringPos(line)
if (IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == '*part' ) then
IO_abaqus_hasNoPart = .false.
exit
endif
enddo
620 end function IO_abaqus_hasNoPart
#endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief identifies strings without content !> @brief identifies strings without content
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -1598,57 +1614,4 @@ real(pReal) function IO_verifyFloatValue (string,validChars,myName)
end function IO_verifyFloatValue end function IO_verifyFloatValue
#ifdef Abaqus
!--------------------------------------------------------------------------------------------------
!> @brief create a new input file for abaqus simulations by removing all comment lines and
!> including "include"s
!--------------------------------------------------------------------------------------------------
recursive function abaqus_assembleInputFile(unit1,unit2) result(createSuccess)
implicit none
integer(pInt), intent(in) :: unit1, &
unit2
integer(pInt), allocatable, dimension(:) :: chunkPos
character(len=65536) :: line,fname
logical :: createSuccess,fexist
do
read(unit2,'(A65536)',END=220) line
chunkPos = IO_stringPos(line)
if (IO_lc(IO_StringValue(line,chunkPos,1_pInt))=='*include') then
fname = trim(line(9+scan(line(9:),'='):))
inquire(file=fname, exist=fexist)
if (.not.(fexist)) then
!$OMP CRITICAL (write2out)
write(6,*)'ERROR: file does not exist error in abaqus_assembleInputFile'
write(6,*)'filename: ', trim(fname)
!$OMP END CRITICAL (write2out)
createSuccess = .false.
return
endif
open(unit2+1,err=200,status='old',file=fname)
if (abaqus_assembleInputFile(unit1,unit2+1_pInt)) then
createSuccess=.true.
close(unit2+1)
else
createSuccess=.false.
return
endif
else if (line(1:2) /= '**' .OR. line(1:8)=='**damask') then
write(unit1,'(A)') trim(line)
endif
enddo
220 createSuccess = .true.
return
200 createSuccess =.false.
end function abaqus_assembleInputFile
#endif
end module IO end module IO

View File

@ -434,7 +434,6 @@ subroutine mesh_init(ip,el)
#endif #endif
use DAMASK_interface use DAMASK_interface
use IO, only: & use IO, only: &
IO_abaqus_hasNoPart, &
IO_open_InputFile, & IO_open_InputFile, &
IO_timeStamp, & IO_timeStamp, &
IO_error, & IO_error, &
@ -471,7 +470,7 @@ subroutine mesh_init(ip,el)
call IO_open_inputFile(FILEUNIT,modelName) ! parse info from input file... call IO_open_inputFile(FILEUNIT,modelName) ! 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 = IO_abaqus_hasNoPart(FILEUNIT) noPart = hasNoPart(FILEUNIT)
call mesh_abaqus_count_nodesAndElements(FILEUNIT) call mesh_abaqus_count_nodesAndElements(FILEUNIT)
if (myDebug) write(6,'(a)') ' Counted nodes/elements'; flush(6) if (myDebug) write(6,'(a)') ' Counted nodes/elements'; flush(6)
call mesh_abaqus_count_elementSets(FILEUNIT) call mesh_abaqus_count_elementSets(FILEUNIT)
@ -542,6 +541,33 @@ subroutine mesh_init(ip,el)
mesh_CPnodeID = mesh_element(5:4+mesh_NipsPerElem,:) mesh_CPnodeID = mesh_element(5:4+mesh_NipsPerElem,:)
!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!
contains
!--------------------------------------------------------------------------------------------------
!> @brief check if the input file for Abaqus contains part info
!--------------------------------------------------------------------------------------------------
logical function hasNoPart(fileUnit)
implicit none
integer(pInt), intent(in) :: fileUnit
integer(pInt), allocatable, dimension(:) :: chunkPos
character(len=65536) :: line
hasNoPart = .true.
610 FORMAT(A65536)
rewind(fileUnit)
do
read(fileUnit,610,END=620) line
chunkPos = IO_stringPos(line)
if (IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == '*part' ) then
hasNoPart = .false.
exit
endif
enddo
620 end function hasNoPart
end subroutine mesh_init end subroutine mesh_init
@ -1497,7 +1523,6 @@ subroutine mesh_abaqus_build_elements(fileUnit)
use IO, only: IO_lc, & use IO, only: IO_lc, &
IO_stringValue, & IO_stringValue, &
IO_skipChunks, &
IO_stringPos, & IO_stringPos, &
IO_intValue, & IO_intValue, &
IO_extractValue, & IO_extractValue, &
@ -2173,49 +2198,28 @@ integer(pInt) function FE_mapElemtype(what)
character(len=*), intent(in) :: what character(len=*), intent(in) :: what
select case (IO_lc(what)) select case (IO_lc(what))
case ( '6') case ( 'cpe4', &
FE_mapElemtype = 1_pInt ! Two-dimensional Plane Strain Triangle
case ( '155', &
'125', &
'128')
FE_mapElemtype = 2_pInt ! Two-dimensional Plane Strain triangle (155: cubic shape function, 125/128: second order isoparametric)
case ( '11', &
'cpe4', &
'cpe4t') 'cpe4t')
FE_mapElemtype = 3_pInt ! Arbitrary Quadrilateral Plane-strain FE_mapElemtype = 3_pInt ! Arbitrary Quadrilateral Plane-strain
case ( '27', & case ( 'cpe8', &
'cpe8', &
'cpe8t') 'cpe8t')
FE_mapElemtype = 4_pInt ! Plane Strain, Eight-node Distorted Quadrilateral FE_mapElemtype = 4_pInt ! Plane Strain, Eight-node Distorted Quadrilateral
case ( '54') case ( 'c3d4', &
FE_mapElemtype = 5_pInt ! Plane Strain, Eight-node Distorted Quadrilateral with reduced integration
case ( '134', &
'c3d4', &
'c3d4t') 'c3d4t')
FE_mapElemtype = 6_pInt ! Three-dimensional Four-node Tetrahedron FE_mapElemtype = 6_pInt ! Three-dimensional Four-node Tetrahedron
case ( '157') case ( 'c3d6', &
FE_mapElemtype = 7_pInt ! Three-dimensional, Low-order, Tetrahedron, Herrmann Formulations
case ( '127')
FE_mapElemtype = 8_pInt ! Three-dimensional Ten-node Tetrahedron
case ( '136', &
'c3d6', &
'c3d6t') 'c3d6t')
FE_mapElemtype = 9_pInt ! Three-dimensional Arbitrarily Distorted Pentahedral FE_mapElemtype = 9_pInt ! Three-dimensional Arbitrarily Distorted Pentahedral
case ( '117', & case ( 'c3d8r', &
'123', &
'c3d8r', &
'c3d8rt') 'c3d8rt')
FE_mapElemtype = 10_pInt ! Three-dimensional Arbitrarily Distorted linear hexahedral with reduced integration FE_mapElemtype = 10_pInt ! Three-dimensional Arbitrarily Distorted linear hexahedral with reduced integration
case ( '7', & case ( 'c3d8', &
'c3d8', &
'c3d8t') 'c3d8t')
FE_mapElemtype = 11_pInt ! Three-dimensional Arbitrarily Distorted Brick FE_mapElemtype = 11_pInt ! Three-dimensional Arbitrarily Distorted Brick
case ( '57', & case ( 'c3d20r', &
'c3d20r', &
'c3d20rt') 'c3d20rt')
FE_mapElemtype = 12_pInt ! Three-dimensional Arbitrarily Distorted quad hexahedral with reduced integration FE_mapElemtype = 12_pInt ! Three-dimensional Arbitrarily Distorted quad hexahedral with reduced integration
case ( '21', & case ( 'c3d20', &
'c3d20', &
'c3d20t') 'c3d20t')
FE_mapElemtype = 13_pInt ! Three-dimensional Arbitrarily Distorted quadratic hexahedral FE_mapElemtype = 13_pInt ! Three-dimensional Arbitrarily Distorted quadratic hexahedral
case default case default

View File

@ -1909,44 +1909,28 @@ integer(pInt) function FE_mapElemtype(what)
'125', & '125', &
'128') '128')
FE_mapElemtype = 2_pInt ! Two-dimensional Plane Strain triangle (155: cubic shape function, 125/128: second order isoparametric) FE_mapElemtype = 2_pInt ! Two-dimensional Plane Strain triangle (155: cubic shape function, 125/128: second order isoparametric)
case ( '11', & case ( '11')
'cpe4', &
'cpe4t')
FE_mapElemtype = 3_pInt ! Arbitrary Quadrilateral Plane-strain FE_mapElemtype = 3_pInt ! Arbitrary Quadrilateral Plane-strain
case ( '27', & case ( '27')
'cpe8', &
'cpe8t')
FE_mapElemtype = 4_pInt ! Plane Strain, Eight-node Distorted Quadrilateral FE_mapElemtype = 4_pInt ! Plane Strain, Eight-node Distorted Quadrilateral
case ( '54') case ( '54')
FE_mapElemtype = 5_pInt ! Plane Strain, Eight-node Distorted Quadrilateral with reduced integration FE_mapElemtype = 5_pInt ! Plane Strain, Eight-node Distorted Quadrilateral with reduced integration
case ( '134', & case ( '134')
'c3d4', &
'c3d4t')
FE_mapElemtype = 6_pInt ! Three-dimensional Four-node Tetrahedron FE_mapElemtype = 6_pInt ! Three-dimensional Four-node Tetrahedron
case ( '157') case ( '157')
FE_mapElemtype = 7_pInt ! Three-dimensional, Low-order, Tetrahedron, Herrmann Formulations FE_mapElemtype = 7_pInt ! Three-dimensional, Low-order, Tetrahedron, Herrmann Formulations
case ( '127') case ( '127')
FE_mapElemtype = 8_pInt ! Three-dimensional Ten-node Tetrahedron FE_mapElemtype = 8_pInt ! Three-dimensional Ten-node Tetrahedron
case ( '136', & case ( '136')
'c3d6', &
'c3d6t')
FE_mapElemtype = 9_pInt ! Three-dimensional Arbitrarily Distorted Pentahedral FE_mapElemtype = 9_pInt ! Three-dimensional Arbitrarily Distorted Pentahedral
case ( '117', & case ( '117', &
'123', & '123')
'c3d8r', &
'c3d8rt')
FE_mapElemtype = 10_pInt ! Three-dimensional Arbitrarily Distorted linear hexahedral with reduced integration FE_mapElemtype = 10_pInt ! Three-dimensional Arbitrarily Distorted linear hexahedral with reduced integration
case ( '7', & case ( '7')
'c3d8', &
'c3d8t')
FE_mapElemtype = 11_pInt ! Three-dimensional Arbitrarily Distorted Brick FE_mapElemtype = 11_pInt ! Three-dimensional Arbitrarily Distorted Brick
case ( '57', & case ( '57')
'c3d20r', &
'c3d20rt')
FE_mapElemtype = 12_pInt ! Three-dimensional Arbitrarily Distorted quad hexahedral with reduced integration FE_mapElemtype = 12_pInt ! Three-dimensional Arbitrarily Distorted quad hexahedral with reduced integration
case ( '21', & case ( '21')
'c3d20', &
'c3d20t')
FE_mapElemtype = 13_pInt ! Three-dimensional Arbitrarily Distorted quadratic hexahedral FE_mapElemtype = 13_pInt ! Three-dimensional Arbitrarily Distorted quadratic hexahedral
case default case default
call IO_error(error_ID=190_pInt,ext_msg=IO_lc(what)) call IO_error(error_ID=190_pInt,ext_msg=IO_lc(what))
@ -2807,7 +2791,3 @@ end function mesh_get_nodeAtIP
end module mesh end module mesh