DAMASK_EICMD/code/IO.f90

1470 lines
46 KiB
Fortran
Raw Normal View History

! Copyright 2011 Max-Planck-Institut für Eisenforschung GmbH
!
! This file is part of DAMASK,
! the Düsseldorf Advanced MAterial Simulation Kit.
!
! DAMASK is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! DAMASK is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with DAMASK. If not, see <http://www.gnu.org/licenses/>.
!
!##############################################################
!* $Id$
!##############################################################
MODULE IO
!##############################################################
2012-02-10 16:54:53 +05:30
CONTAINS
!---------------------------
! function IO_abaqus_assembleInputFile
! function IO_open_file(unit,relPath)
! function IO_open_inputFile(unit, model)
! function IO_open_logFile(unit)
! function IO_hybridIA(Nast,ODFfileName)
! private function hybridIA_reps(dV_V,steps,C)
2007-04-10 16:51:34 +05:30
! function IO_stringPos(line,maxN)
! function IO_stringValue(line,positions,pos)
! function IO_floatValue(line,positions,pos)
! function IO_intValue(line,positions,pos)
2007-04-10 16:51:34 +05:30
! function IO_fixedStringValue(line,ends,pos)
! function IO_fixedFloatValue(line,ends,pos)
! function IO_fixedFloatNoEValue(line,ends,pos)
! function IO_fixedIntValue(line,ends,pos)
! function IO_continousIntValues(unit,maxN)
2007-04-10 16:51:34 +05:30
! function IO_lc(line)
! subroutine IO_lcInplace(line)
! subroutine IO_error(ID)
! subroutine IO_warning(ID)
!---------------------------
!********************************************************************
! output version number
!********************************************************************
subroutine IO_init ()
2012-02-10 16:54:53 +05:30
use, intrinsic :: iso_fortran_env
!$OMP CRITICAL (write2out)
write(6,*)
write(6,*) '<<<+- IO init -+>>>'
write(6,*) '$Id$'
#include "compilation_info.f90"
call flush(6)
!$OMP END CRITICAL (write2out)
endsubroutine
!********************************************************************
! AP: 12.07.10
! create a new input file for abaqus simulations
! by removing all comment lines and including "include"s
!********************************************************************
recursive function IO_abaqus_assembleInputFile(unit1,unit2) result(createSuccess)
use prec
use DAMASK_interface
implicit none
character(len=300) line,fname
integer(pInt), intent(in) :: unit1, unit2
logical createSuccess,fexist
integer(pInt), parameter :: maxNchunks = 6
integer(pInt), dimension(1+2*maxNchunks) :: positions
do
read(unit2,'(A300)',END=220) line
! line = IO_lc(trim(line))
! do not change the whole line to lower case, file names in Linux are case sensitive!
positions = IO_stringPos(line,maxNchunks)
! call IO_lcInPlace(line)
2012-02-02 18:49:02 +05:30
if (IO_lc(IO_StringValue(line,positions,1_pInt))=='*include') then
fname = trim(getSolverWorkingDirectoryName())//trim(line(9_pInt+scan(line(9_pInt:),'='):))
inquire(file=fname, exist=fexist)
if (.not.(fexist)) then
!$OMP CRITICAL (write2out)
write(6,*)'ERROR: file does not exist error in IO_abaqus_assembleInputFile'
write(6,*)'filename: ', trim(fname)
!$OMP END CRITICAL (write2out)
createSuccess = .false.
return
endif
open(unit2+1,err=200,status='old',file=fname)
2012-02-02 18:49:02 +05:30
if (IO_abaqus_assembleInputFile(unit1,unit2+1_pInt)) then
createSuccess=.true.
close(unit2+1)
else
createSuccess=.false.
return
endif
else if (line(1:2) /= '**') then
write(unit1,'(A)') trim(line)
endif
enddo
220 createSuccess = .true.
return
200 createSuccess =.false.
end function
!***********************************************************
! check if the input file for Abaqus contains part info
!***********************************************************
function IO_abaqus_hasNoPart(unit)
use prec, only: pInt
implicit none
integer(pInt) unit
integer(pInt), parameter :: maxNchunks = 1
integer(pInt), dimension(1+2*maxNchunks) :: pos
logical IO_abaqus_hasNoPart
character(len=300) line
IO_abaqus_hasNoPart = .true.
610 FORMAT(A300)
rewind(unit)
do
read(unit,610,END=620) line
pos = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
if (IO_lc(IO_stringValue(line,pos,1_pInt)) == '*part' ) then
IO_abaqus_hasNoPart = .false.
exit
endif
enddo
620 endfunction
!********************************************************************
! open existing file to given unit
! path to file is relative to working directory
!********************************************************************
logical function IO_open_file(unit,relPath)
use prec, only: pInt
use DAMASK_interface
2012-02-10 16:54:53 +05:30
implicit none
character(len=*) relPath
integer(pInt) unit
IO_open_file = .false.
open(unit,status='old',err=100,file=trim(getSolverWorkingDirectoryName())//relPath)
IO_open_file = .true.
100 endfunction
!********************************************************************
! open FEM inputfile to given unit
! AP: 12.07.10
! : changed the function to open *.inp_assembly, which is basically
! the input file without comment lines and possibly assembled includes
!********************************************************************
logical function IO_open_inputFile(unit,model)
use prec, only: pReal, pInt
use DAMASK_interface
implicit none
integer(pInt), intent(in) :: unit
character(len=*) model
IO_open_inputFile = .false.
if (FEsolver == 'Abaqus') then
open(unit+1,status='old',err=100,&
file=trim(getSolverWorkingDirectoryName())//&
trim(model)//InputFileExtension)
open(unit,err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(model)//InputFileExtension//'_assembly')
2012-02-10 16:54:53 +05:30
IO_open_inputFile = IO_abaqus_assembleInputFile(unit,unit+1_pInt) ! strip comments and concatenate any "include"s
close(unit+1_pInt)
else
open(unit,status='old',err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(model)//InputFileExtension)
IO_open_inputFile = .true.
endif
100 endfunction
!********************************************************************
! open FEM logfile to given unit
!********************************************************************
logical function IO_open_logFile(unit)
use prec, only: pReal, pInt
use DAMASK_interface
implicit none
integer(pInt), intent(in) :: unit
IO_open_logFile = .false.
open(unit,status='old',err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//LogFileExtension)
IO_open_logFile = .true.
100 endfunction
!********************************************************************
! open (write) file related to current job
! but with different extension to given unit
!********************************************************************
logical function IO_open_jobFile(unit,newExt)
use prec, only: pReal, pInt
use DAMASK_interface
implicit none
integer(pInt), intent(in) :: unit
character(*), intent(in) :: newExt
IO_open_jobFile = .false.
open(unit,status='old',err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//'.'//newExt)
IO_open_jobFile = .true.
100 endfunction
!********************************************************************
! open (write) file related to current job
! but with different extension to given unit
!********************************************************************
logical function IO_write_jobFile(unit,newExt)
use prec, only: pReal, pInt
use DAMASK_interface
implicit none
integer(pInt), intent(in) :: unit
character(*), intent(in) :: newExt
IO_write_jobFile = .false.
open(unit,status='replace',err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//'.'//newExt)
IO_write_jobFile = .true.
100 endfunction
!********************************************************************
! open (write) binary file related to current job
! but with different extension to given unit
!********************************************************************
logical function IO_write_jobBinaryFile(unit,newExt,recMultiplier)
use prec, only: pReal, pInt
use DAMASK_interface
implicit none
integer(pInt), intent(in) :: unit
integer(pInt), intent(in), optional :: recMultiplier
character(*), intent(in) :: newExt
IO_write_jobBinaryFile = .false.
if (present(recMultiplier)) then
open(unit,status='replace',form='unformatted',access='direct',recl=pReal*recMultiplier, &
err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//'.'//newExt)
else
open(unit,status='replace',form='unformatted',access='direct',recl=pReal, &
err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//'.'//newExt)
endif
IO_write_jobBinaryFile = .true.
100 endfunction
!********************************************************************
! open (read) binary file related to restored job
! and with different extension to given unit
!********************************************************************
logical function IO_read_jobBinaryFile(unit,newExt,jobName,recMultiplier)
use prec, only: pReal, pInt
use DAMASK_interface
implicit none
integer(pInt), intent(in) :: unit
integer(pInt), intent(in), optional :: recMultiplier
character(*), intent(in) :: newExt, jobName
IO_read_jobBinaryFile = .false.
if (present(recMultiplier)) then
open(unit,status='old',form='unformatted',access='direct',recl=pReal*recMultiplier, &
err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(jobName)//'.'//newExt)
else
open(unit,status='old',form='unformatted',access='direct',recl=pReal, &
err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(jobName)//'.'//newExt)
endif
IO_read_jobBinaryFile = .true.
100 endfunction
2007-03-21 18:02:15 +05:30
!********************************************************************
! hybrid IA repetition counter
!********************************************************************
function hybridIA_reps(dV_V,steps,C)
2007-03-21 18:02:15 +05:30
use prec, only: pReal, pInt
implicit none
integer(pInt), intent(in), dimension(3) :: steps
integer(pInt) hybridIA_reps, phi1,Phi,phi2
real(pReal), intent(in), dimension(steps(3),steps(2),steps(1)) :: dV_V
real(pReal), intent(in) :: C
hybridIA_reps = 0_pInt
do phi1=1,steps(1)
do Phi =1,steps(2)
do phi2=1,steps(3)
hybridIA_reps = hybridIA_reps+nint(C*dV_V(phi2,Phi,phi1), pInt)
enddo
enddo
enddo
2007-03-21 18:02:15 +05:30
endfunction
2007-03-21 18:02:15 +05:30
!********************************************************************
! hybrid IA sampling of ODFfile
!********************************************************************
function IO_hybridIA(Nast,ODFfileName)
2007-03-21 18:02:15 +05:30
use prec, only: pReal, pInt
implicit none
real(pReal), parameter :: pi = 3.14159265358979323846264338327950288419716939937510_pReal
real(pReal), parameter :: inRad = pi/180.0_pReal
2007-03-21 18:02:15 +05:30
character(len=*) ODFfileName
character(len=80) line
character(len=*), parameter :: fileFormat = '(A80)'
integer(pInt) i,j,bin,Nast,NnonZero,Nset,Nreps,reps,phi1,Phi,phi2
integer(pInt), dimension(7) :: pos
2007-03-21 18:02:15 +05:30
integer(pInt), dimension(3) :: steps
integer(pInt), dimension(:), allocatable :: binSet
real(pReal) center,sum_dV_V,prob,dg_0,C,lowerC,upperC,rnd
real(pReal), dimension(3) :: limits,deltas
real(pReal), dimension(:,:,:), allocatable :: dV_V
real(pReal), dimension(3,Nast) :: IO_hybridIA
2007-03-21 18:02:15 +05:30
2012-02-02 18:49:02 +05:30
if (.not. IO_open_file(999_pInt,ODFfileName)) goto 100
2007-03-21 18:02:15 +05:30
!--- parse header of ODF file ---
!--- limits in phi1, Phi, phi2 ---
read(999,fmt=fileFormat,end=100) line
2012-02-02 18:49:02 +05:30
pos = IO_stringPos(line,3_pInt)
2007-03-21 18:02:15 +05:30
if (pos(1).ne.3) goto 100
do i=1,3
2012-02-10 16:54:53 +05:30
limits(i) = IO_floatValue(line,pos,i)*inRad
enddo
2007-03-21 18:02:15 +05:30
!--- deltas in phi1, Phi, phi2 ---
read(999,fmt=fileFormat,end=100) line
2012-02-02 18:49:02 +05:30
pos = IO_stringPos(line,3_pInt)
2007-03-21 18:02:15 +05:30
if (pos(1).ne.3) goto 100
do i=1,3
2012-02-10 16:54:53 +05:30
deltas(i) = IO_floatValue(line,pos,i)*inRad
enddo
2007-03-21 18:02:15 +05:30
steps = nint(limits/deltas,pInt)
allocate(dV_V(steps(3),steps(2),steps(1)))
!--- box boundary/center at origin? ---
read(999,fmt=fileFormat,end=100) line
if (index(IO_lc(line),'bound')>0) then
center = 0.5_pReal
else
center = 0.0_pReal
endif
2007-03-21 18:02:15 +05:30
!--- skip blank line ---
read(999,fmt=fileFormat,end=100) line
sum_dV_V = 0.0_pReal
dV_V = 0.0_pReal
dg_0 = deltas(1)*deltas(3)*2.0_pReal*sin(deltas(2)/2.0_pReal)
NnonZero = 0_pInt
do phi1=1,steps(1)
do Phi=1,steps(2)
do phi2=1,steps(3)
read(999,fmt=*,end=100) prob
2007-03-21 18:02:15 +05:30
if (prob > 0.0_pReal) then
NnonZero = NnonZero+1
sum_dV_V = sum_dV_V+prob
else
prob = 0.0_pReal
endif
2007-03-21 18:02:15 +05:30
dV_V(phi2,Phi,phi1) = prob*dg_0*sin((Phi-1.0_pReal+center)*deltas(2))
enddo
enddo
enddo
2007-03-21 18:02:15 +05:30
dV_V = dV_V/sum_dV_V ! normalize to 1
!--- now fix bounds ---
2009-10-14 18:51:03 +05:30
Nset = max(Nast,NnonZero) ! if less than non-zero voxel count requested, sample at least that much
2007-03-21 18:02:15 +05:30
lowerC = 0.0_pReal
upperC = real(Nset, pReal)
do while (hybridIA_reps(dV_V,steps,upperC) < Nset)
lowerC = upperC
upperC = upperC*2.0_pReal
enddo
2007-03-21 18:02:15 +05:30
!--- binary search for best C ---
do
C = (upperC+lowerC)/2.0_pReal
Nreps = hybridIA_reps(dV_V,steps,C)
if (abs(upperC-lowerC) < upperC*1.0e-14_pReal) then
C = upperC
Nreps = hybridIA_reps(dV_V,steps,C)
exit
elseif (Nreps < Nset) then
lowerC = C
elseif (Nreps > Nset) then
upperC = C
else
exit
endif
enddo
2007-03-21 18:02:15 +05:30
allocate(binSet(Nreps))
2012-02-10 16:54:53 +05:30
bin = 0_pInt ! bin counter
2007-03-21 18:02:15 +05:30
i = 1 ! set counter
do phi1=1,steps(1)
do Phi=1,steps(2)
do phi2=1,steps(3)
reps = nint(C*dV_V(phi2,Phi,phi1), pInt)
binSet(i:i+reps-1) = bin
bin = bin+1 ! advance bin
i = i+reps ! advance set
enddo
enddo
enddo
2007-03-21 18:02:15 +05:30
do i=1,Nast
if (i < Nast) then
call random_number(rnd)
j = nint(rnd*(Nreps-i)+i+0.5_pReal,pInt)
2007-03-21 18:02:15 +05:30
else
j = i
endif
2007-03-21 18:02:15 +05:30
bin = binSet(j)
2012-02-10 16:54:53 +05:30
IO_hybridIA(1,i) = deltas(1)*(real(mod(bin/(steps(3)*steps(2)),steps(1)),pReal)+center) ! phi1
IO_hybridIA(2,i) = deltas(2)*(real(mod(bin/ steps(3) ,steps(2)),pReal)+center) ! Phi
IO_hybridIA(3,i) = deltas(3)*(real(mod(bin ,steps(3)),pReal)+center) ! phi2
2007-03-21 18:02:15 +05:30
binSet(j) = binSet(i)
enddo
2007-03-21 18:02:15 +05:30
close(999)
return
! on error
2012-02-10 16:54:53 +05:30
100 IO_hybridIA = -1.0_pReal
2007-03-21 18:02:15 +05:30
close(999)
endfunction
2007-03-21 18:02:15 +05:30
!********************************************************************
! identifies lines without content
!********************************************************************
pure function IO_isBlank (line)
use prec, only: pInt
implicit none
character(len=*), intent(in) :: line
character(len=*), parameter :: blank = achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
character(len=*), parameter :: comment = achar(35) ! comment id '#'
integer(pInt) posNonBlank, posComment
logical IO_isBlank
posNonBlank = verify(line,blank)
posComment = scan(line,comment)
IO_isBlank = posNonBlank == 0 .or. posNonBlank == posComment
endfunction
!********************************************************************
! get tagged content of line
!********************************************************************
pure function IO_getTag (line,openChar,closeChar)
use prec, only: pInt
implicit none
character(len=*), intent(in) :: line,openChar,closeChar
character(len=*), parameter :: sep=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
character(len=len_trim(line)) IO_getTag
integer(pInt) left,right
IO_getTag = ''
left = scan(line,openChar)
right = scan(line,closeChar)
if (left == verify(line,sep) .and. right > left) & ! openChar is first and closeChar occurs
IO_getTag = line(left+1:right-1)
endfunction
!*********************************************************************
function IO_countSections(file,part)
!*********************************************************************
use prec, only: pInt
implicit none
!* Definition of variables
integer(pInt), intent(in) :: file
character(len=*), intent(in) :: part
integer(pInt) IO_countSections
character(len=1024) line
IO_countSections = 0
line = ''
rewind(file)
do while (IO_getTag(line,'<','>') /= part) ! search for part
read(file,'(a1024)',END=100) line
enddo
do
read(file,'(a1024)',END=100) line
if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
IO_countSections = IO_countSections + 1
enddo
100 endfunction
!*********************************************************************
! return array of myTag counts within <part> for at most N[sections]
!*********************************************************************
function IO_countTagInPart(file,part,myTag,Nsections)
use prec, only: pInt
implicit none
!* Definition of variables
integer(pInt), intent(in) :: file, Nsections
character(len=*), intent(in) :: part, myTag
integer(pInt), dimension(Nsections) :: IO_countTagInPart, counter
integer(pInt), parameter :: maxNchunks = 1
integer(pInt), dimension(1+2*maxNchunks) :: positions
integer(pInt) section
character(len=1024) line,tag
counter = 0_pInt
section = 0_pInt
line = ''
rewind(file)
do while (IO_getTag(line,'<','>') /= part) ! search for part
read(file,'(a1024)',END=100) line
enddo
do
read(file,'(a1024)',END=100) line
if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
section = section + 1
if (section > 0) then
positions = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
if (tag == myTag) & ! match
2012-02-02 18:49:02 +05:30
counter(section) = counter(section) + 1_pInt
endif
enddo
100 IO_countTagInPart = counter
endfunction
2009-04-03 16:00:18 +05:30
!*********************************************************************
! return array of myTag presence within <part> for at most N[sections]
!*********************************************************************
function IO_spotTagInPart(file,part,myTag,Nsections)
2009-04-03 16:00:18 +05:30
use prec, only: pInt
implicit none
!* Definition of variables
integer(pInt), intent(in) :: file, Nsections
character(len=*), intent(in) :: part, myTag
logical, dimension(Nsections) :: IO_spotTagInPart
integer(pInt), parameter :: maxNchunks = 1
integer(pInt), dimension(1+2*maxNchunks) :: positions
integer(pInt) section
character(len=1024) line,tag
IO_spotTagInPart = .false. ! assume to nowhere spot tag
section = 0_pInt
line = ''
rewind(file)
do while (IO_getTag(line,'<','>') /= part) ! search for part
read(file,'(a1024)',END=100) line
enddo
do
read(file,'(a1024)',END=100) line
if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
section = section + 1
if (section > 0) then
positions = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
2009-04-03 16:00:18 +05:30
if (tag == myTag) & ! match
IO_spotTagInPart(section) = .true.
endif
enddo
100 endfunction
2009-04-03 16:00:18 +05:30
!********************************************************************
! locate at most N space-separated parts in line
! return array containing number of parts in line and
! the left/right positions of at most N to be used by IO_xxxVal
!********************************************************************
! pure function IO_stringPos (line,N)
function IO_stringPos (line,N)
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
character(len=*), parameter :: sep=achar(44)//achar(32)//achar(9)//achar(10)//achar(13) ! comma and whitespaces
2009-01-20 00:40:58 +05:30
integer(pInt), intent(in) :: N
integer(pInt) left,right
integer(pInt) IO_stringPos(1+N*2)
IO_stringPos = -1
IO_stringPos(1) = 0
right = 0
do while (verify(line(right+1:),sep)>0)
left = right + verify(line(right+1:),sep)
right = left + scan(line(left:),sep) - 2
if ( line(left:left) == '#' ) then
exit
endif
if ( IO_stringPos(1)<N ) then
IO_stringPos(1+IO_stringPos(1)*2+1) = left
IO_stringPos(1+IO_stringPos(1)*2+2) = right
endif
IO_stringPos(1) = IO_stringPos(1)+1
enddo
endfunction
!********************************************************************
! read string value at pos from line
!********************************************************************
pure function IO_stringValue (line,positions,pos)
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
integer(pInt), intent(in) :: positions(*),pos
character(len=1+positions(pos*2+1)-positions(pos*2)) IO_stringValue
if (positions(1) < pos) then
IO_stringValue = ''
else
IO_stringValue = line(positions(pos*2):positions(pos*2+1))
endif
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
2007-03-21 20:19:21 +05:30
! read string value at pos from fixed format line
2007-03-21 20:15:03 +05:30
!********************************************************************
pure function IO_fixedStringValue (line,ends,pos)
2007-03-21 20:15:03 +05:30
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
integer(pInt), intent(in) :: ends(*),pos
character(len=ends(pos+1)-ends(pos)) IO_fixedStringValue
2007-03-21 20:15:03 +05:30
IO_fixedStringValue = line(ends(pos)+1:ends(pos+1))
2007-03-21 20:15:03 +05:30
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
! read float value at pos from line
!********************************************************************
pure function IO_floatValue (line,positions,myPos)
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
integer(pInt), intent(in) :: positions(*),myPos
2009-01-20 00:40:58 +05:30
real(pReal) IO_floatValue
if (positions(1) < myPos) then
IO_floatValue = 0.0_pReal
else
read(UNIT=line(positions(myPos*2):positions(myPos*2+1)),ERR=100,FMT=*) IO_floatValue
endif
return
100 IO_floatValue = huge(1.0_pReal)
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
2007-03-21 20:19:21 +05:30
! read float value at pos from fixed format line
2007-03-21 20:15:03 +05:30
!********************************************************************
pure function IO_fixedFloatValue (line,ends,pos)
2007-03-21 20:15:03 +05:30
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
integer(pInt), intent(in) :: ends(*),pos
2009-01-20 00:40:58 +05:30
real(pReal) IO_fixedFloatValue
2007-03-21 20:15:03 +05:30
read(UNIT=line(ends(pos-1)+1:ends(pos)),ERR=100,FMT=*) IO_fixedFloatValue
2007-03-21 20:15:03 +05:30
return
100 IO_fixedFloatValue = huge(1.0_pReal)
2007-03-21 20:15:03 +05:30
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
2007-03-21 20:19:21 +05:30
! read float x.y+z value at pos from format line line
2007-03-21 20:15:03 +05:30
!********************************************************************
pure function IO_fixedNoEFloatValue (line,ends,pos)
2007-03-21 20:15:03 +05:30
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
2009-01-20 00:40:58 +05:30
integer(pInt), intent(in) :: ends(*),pos
integer(pInt) pos_exp,expon
real(pReal) IO_fixedNoEFloatValue,base
2007-03-21 20:15:03 +05:30
pos_exp = scan(line(ends(pos)+1:ends(pos+1)),'+-',back=.true.)
2007-03-21 20:15:03 +05:30
if (pos_exp > 1) then
read(UNIT=line(ends(pos)+1:ends(pos)+pos_exp-1),ERR=100,FMT=*) base
read(UNIT=line(ends(pos)+pos_exp:ends(pos+1)),ERR=100,FMT=*) expon
2007-03-21 20:15:03 +05:30
else
read(UNIT=line(ends(pos)+1:ends(pos+1)),ERR=100,FMT=*) base
expon = 0_pInt
2007-03-21 20:15:03 +05:30
endif
IO_fixedNoEFloatValue = base*10.0_pReal**expon
return
100 IO_fixedNoEFloatValue = huge(1.0_pReal)
2007-03-21 20:15:03 +05:30
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
! read int value at pos from line
!********************************************************************
pure function IO_intValue (line,positions,pos)
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
integer(pInt), intent(in) :: positions(*),pos
2009-01-20 00:40:58 +05:30
integer(pInt) IO_intValue
if (positions(1) < pos) then
IO_intValue = 0_pInt
else
read(UNIT=line(positions(pos*2):positions(pos*2+1)),ERR=100,FMT=*) IO_intValue
endif
return
100 IO_intValue = huge(1_pInt)
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
! read int value at pos from fixed format line
!********************************************************************
pure function IO_fixedIntValue (line,ends,pos)
2007-03-21 20:15:03 +05:30
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line
integer(pInt), intent(in) :: ends(*),pos
2009-01-20 00:40:58 +05:30
integer(pInt) IO_fixedIntValue
2007-03-21 20:15:03 +05:30
read(UNIT=line(ends(pos)+1:ends(pos+1)),ERR=100,FMT=*) IO_fixedIntValue
2007-03-21 20:15:03 +05:30
return
100 IO_fixedIntValue = huge(1_pInt)
2007-03-21 20:15:03 +05:30
endfunction
2007-03-21 20:15:03 +05:30
!********************************************************************
! change character in line to lower case
!********************************************************************
pure function IO_lc (line)
use prec, only: pInt
implicit none
character (len=*), intent(in) :: line
2007-03-21 18:02:15 +05:30
character (len=len(line)) IO_lc
integer(pInt) i
2007-03-21 18:02:15 +05:30
IO_lc = line
do i=1,len(line)
if(64<iachar(line(i:i)) .and. iachar(line(i:i))<91) IO_lc(i:i)=achar(iachar(line(i:i))+32)
enddo
endfunction
!********************************************************************
2007-03-21 18:02:15 +05:30
! in place change of character in line to lower case
!********************************************************************
subroutine IO_lcInplace (line)
use prec, only: pInt
implicit none
character (len=*) line
2007-03-28 14:01:12 +05:30
character (len=len(line)) IO_lc
integer(pInt) i
2007-03-28 14:01:12 +05:30
IO_lc = line
do i=1,len(line)
if(64<iachar(line(i:i)) .and. iachar(line(i:i))<91) IO_lc(i:i)=achar(iachar(line(i:i))+32)
enddo
2007-03-28 14:01:12 +05:30
line = IO_lc
endsubroutine
!********************************************************************
! read on in file to skip (at least) N chunks (may be over multiple lines)
!********************************************************************
subroutine IO_skipChunks (unit,N)
use prec, only: pReal,pInt
implicit none
integer(pInt) remainingChunks,unit,N
integer(pInt), parameter :: maxNchunks = 64
integer(pInt), dimension(1+2*maxNchunks) :: pos
character(len=300) line
remainingChunks = N
do while (remainingChunks > 0)
read(unit,'(A300)',end=100) line
pos = IO_stringPos(line,maxNchunks)
remainingChunks = remainingChunks - pos(1)
enddo
100 endsubroutine
!********************************************************************
! extract value from key=value pair and check whether key matches
!********************************************************************
pure function IO_extractValue (line,key)
use prec, only: pReal,pInt
implicit none
character(len=*), intent(in) :: line,key
character(len=*), parameter :: sep = achar(61) ! '='
integer(pInt) pos
character(len=300) IO_extractValue
IO_extractValue = ''
pos = scan(line,sep)
if (pos > 0 .and. line(:pos-1) == key(:pos-1)) & ! key matches expected key
IO_extractValue = line(pos+1:) ! extract value
endfunction
!********************************************************************
! count lines containig data up to next *keyword
! AP: changed the function to neglect comment lines between keyword definitions.
! : is not changed back to the original version since *.inp_assembly does not
! : contain any comment lines (12.07.2010)
!********************************************************************
function IO_countDataLines (unit)
use prec, only: pReal,pInt
implicit none
integer(pInt) IO_countDataLines,unit
integer(pInt), parameter :: maxNchunks = 1
integer(pInt), dimension(1+2*maxNchunks) :: pos
character(len=300) line,tmp
IO_countDataLines = 0
do
read(unit,'(A300)',end=100) line
pos = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
tmp = IO_lc(IO_stringValue(line,pos,1_pInt))
if (tmp(1:1) == '*' .and. tmp(2:2) /= '*') then ! found keyword
exit
else
if (tmp(2:2) /= '*') IO_countDataLines = IO_countDataLines + 1_pInt
endif
enddo
100 backspace(unit)
endfunction
!********************************************************************
! count items in consecutive lines
! Marc: ints concatenated by "c" as last char or range of values a "to" b
! Abaqus: triplet of start,stop,inc
!********************************************************************
function IO_countContinousIntValues (unit)
use DAMASK_interface
use prec, only: pReal,pInt
implicit none
integer(pInt) unit,l,count
integer(pInt) IO_countContinousIntValues
integer(pInt), parameter :: maxNchunks = 8192
integer(pInt), dimension(1+2*maxNchunks) :: pos
character(len=65536) line
IO_countContinousIntValues = 0_pInt
select case (FEsolver)
case ('Marc','Spectral')
do
read(unit,'(A300)',end=100) line
pos = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
if (IO_lc(IO_stringValue(line,pos,2_pInt)) == 'to' ) then ! found range indicator
IO_countContinousIntValues = 1_pInt + IO_intValue(line,pos,3_pInt) - IO_intValue(line,pos,1_pInt)
exit ! only one single range indicator allowed
else
2012-02-02 18:49:02 +05:30
IO_countContinousIntValues = IO_countContinousIntValues+pos(1)-1_pInt ! add line's count when assuming 'c'
if ( IO_lc(IO_stringValue(line,pos,pos(1))) /= 'c' ) then ! line finished, read last value
IO_countContinousIntValues = IO_countContinousIntValues+1
exit ! data ended
endif
endif
enddo
case('Abaqus')
count = IO_countDataLines(unit)
do l = 1,count
backspace(unit)
enddo
do l = 1,count
read(unit,'(A300)',end=100) line
pos = IO_stringPos(line,maxNchunks)
IO_countContinousIntValues = IO_countContinousIntValues + 1 + & ! assuming range generation
2012-02-10 16:54:53 +05:30
(IO_intValue(line,pos,2_pInt)-IO_intValue(line,pos,1_pInt))/&
max(1_pInt,IO_intValue(line,pos,3_pInt))
enddo
endselect
100 endfunction
!********************************************************************
! return integer list corrsponding to items in consecutive lines
! Marc: ints concatenated by "c" as last char, range of a "to" b, or named set
! Abaqus: triplet of start,stop,inc or named set
!********************************************************************
function IO_continousIntValues (unit,maxN,lookupName,lookupMap,lookupMaxN)
use DAMASK_interface
use prec, only: pReal,pInt
implicit none
integer(pInt) unit,maxN,i,j,l,count,first,last
integer(pInt), dimension(1+maxN) :: IO_continousIntValues
integer(pInt), parameter :: maxNchunks = 8192_pInt
integer(pInt), dimension(1+2*maxNchunks) :: pos
character(len=64), dimension(:) :: lookupName
integer(pInt) :: lookupMaxN
integer(pInt), dimension(:,:) :: lookupMap
character(len=65536) line
logical rangeGeneration
IO_continousIntValues = 0
rangeGeneration = .false.
select case (FEsolver)
case ('Marc','Spectral')
do
read(unit,'(A65536)',end=100) line
pos = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
if (verify(IO_stringValue(line,pos,1_pInt),'0123456789') > 0) then ! a non-int, i.e. set name
do i = 1_pInt,lookupMaxN ! loop over known set names
if (IO_stringValue(line,pos,1_pInt) == lookupName(i)) then ! found matching name
IO_continousIntValues = lookupMap(:,i) ! return resp. entity list
exit
endif
enddo
exit
2012-02-02 18:49:02 +05:30
else if (pos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,pos,2_pInt)) == 'to' ) then ! found range indicator
do i = IO_intValue(line,pos,1_pInt),IO_intValue(line,pos,3_pInt)
IO_continousIntValues(1) = IO_continousIntValues(1) + 1_pInt
IO_continousIntValues(1+IO_continousIntValues(1)) = i
enddo
exit
else
do i = 1,pos(1)-1 ! interpret up to second to last value
2012-02-02 18:49:02 +05:30
IO_continousIntValues(1) = IO_continousIntValues(1) + 1_pInt
IO_continousIntValues(1+IO_continousIntValues(1)) = IO_intValue(line,pos,i)
enddo
if ( IO_lc(IO_stringValue(line,pos,pos(1))) /= 'c' ) then ! line finished, read last value
2012-02-02 18:49:02 +05:30
IO_continousIntValues(1) = IO_continousIntValues(1) + 1_pInt
IO_continousIntValues(1+IO_continousIntValues(1)) = IO_intValue(line,pos,pos(1))
exit
endif
endif
enddo
case('Abaqus')
count = IO_countDataLines(unit)
do l = 1,count
backspace(unit)
enddo
! check if the element values in the elset are auto generated
backspace(unit)
read(unit,'(A65536)',end=100) line
pos = IO_stringPos(line,maxNchunks)
do i = 1,pos(1)
if (IO_lc(IO_stringValue(line,pos,i)) == 'generate') rangeGeneration = .true.
enddo
do l = 1,count
read(unit,'(A65536)',end=100) line
pos = IO_stringPos(line,maxNchunks)
2012-02-02 18:49:02 +05:30
if (verify(IO_stringValue(line,pos,1_pInt),'0123456789') > 0_pInt) then ! a non-int, i.e. set names follow on this line
do i = 1,pos(1) ! loop over set names in line
do j = 1,lookupMaxN ! look thru known set names
if (IO_stringValue(line,pos,i) == lookupName(j)) then ! found matching name
first = 2 + IO_continousIntValues(1) ! where to start appending data
last = first + lookupMap(1,j) - 1 ! up to where to append data
IO_continousIntValues(first:last) = lookupMap(2:1+lookupMap(1,j),j) ! add resp. entity list
IO_continousIntValues(1) = IO_continousIntValues(1) + lookupMap(1,j) ! count them
endif
enddo
enddo
else if (rangeGeneration) then ! range generation
2012-02-02 18:49:02 +05:30
do i = IO_intValue(line,pos,1_pInt),IO_intValue(line,pos,2_pInt),max(1_pInt,IO_intValue(line,pos,3_pInt))
IO_continousIntValues(1) = IO_continousIntValues(1) + 1
IO_continousIntValues(1+IO_continousIntValues(1)) = i
enddo
else ! read individual elem nums
do i = 1,pos(1)
! write(*,*)'IO_CIV-int',IO_intValue(line,pos,i)
IO_continousIntValues(1) = IO_continousIntValues(1) + 1
IO_continousIntValues(1+IO_continousIntValues(1)) = IO_intValue(line,pos,i)
enddo
endif
enddo
endselect
100 endfunction
!********************************************************************
! write error statements to standard out
! and terminate the Marc run with exit #9xxx
! in ABAQUS either time step is reduced or execution terminated
!********************************************************************
subroutine IO_error(error_ID,e,i,g,ext_msg)
use prec, only: pInt
implicit none
integer(pInt), intent(in) :: error_ID
integer(pInt), optional, intent(in) :: e,i,g
character(len=*), optional, intent(in) :: ext_msg
character(len=1024) msg
select case (error_ID)
2012-02-02 18:49:02 +05:30
case (30_pInt)
msg = 'could not open spectral loadcase'
2012-02-02 18:49:02 +05:30
case (31_pInt)
msg = 'mask consistency violated in spectral loadcase'
2012-02-02 18:49:02 +05:30
case (32_pInt)
msg = 'ill-defined L (each line should be either fully or not at all defined) in spectral loadcase'
2012-02-02 18:49:02 +05:30
case (34_pInt)
msg = 'negative time increment in spectral loadcase'
2012-02-02 18:49:02 +05:30
case (35_pInt)
msg = 'non-positive increments in spectral loadcase'
2012-02-02 18:49:02 +05:30
case (36_pInt)
msg = 'non-positive result frequency in spectral loadcase'
2012-02-02 18:49:02 +05:30
case (37_pInt)
msg = 'incomplete loadcase'
2012-02-02 18:49:02 +05:30
case (38_pInt)
msg = 'mixed boundary conditions allow rotation'
2012-02-02 18:49:02 +05:30
case (39_pInt)
2011-11-07 16:34:57 +05:30
msg = 'non-positive restart frequency in spectral loadcase'
2012-02-02 18:49:02 +05:30
case (40_pInt)
msg = 'path rectification error'
2012-02-02 18:49:02 +05:30
case (41_pInt)
msg = 'path too long'
2012-02-02 18:49:02 +05:30
case (42_pInt)
msg = 'missing header info in spectral mesh'
2012-02-02 18:49:02 +05:30
case (43_pInt)
msg = 'resolution in spectral mesh'
2012-02-02 18:49:02 +05:30
case (44_pInt)
msg = 'dimension in spectral mesh'
2012-02-02 18:49:02 +05:30
case (45_pInt)
msg = 'incomplete information in spectral mesh header'
2012-02-02 18:49:02 +05:30
case (46_pInt)
msg = 'not a rotation defined for loadcase rotation'
2012-02-02 18:49:02 +05:30
case (47_pInt)
msg = 'updating of gamma operator not possible if it is pre calculated'
2012-02-02 18:49:02 +05:30
case (50_pInt)
msg = 'writing constitutive output description'
2012-02-02 18:49:02 +05:30
case (100_pInt)
msg = 'opening material configuration'
2012-02-02 18:49:02 +05:30
case (101_pInt)
msg = 'opening input file'
2012-02-02 18:49:02 +05:30
case (102_pInt)
2012-02-10 16:54:53 +05:30
msg = 'non-positive dimension'
2012-02-02 18:49:02 +05:30
case (103_pInt)
msg = 'odd resolution given'
2012-02-02 18:49:02 +05:30
case (105_pInt)
msg = 'reading from ODF file'
2012-02-02 18:49:02 +05:30
case (106_pInt)
msg = 'reading info on old job'
2012-02-02 18:49:02 +05:30
case (107_pInt)
msg = 'writing spectralOut file'
2012-02-10 16:54:53 +05:30
case (108_pInt)
msg = 'precistion not suitable for FFTW'
case (109_pInt)
msg = 'initializing FFTW'
2012-02-02 18:49:02 +05:30
case (110_pInt)
msg = 'no homogenization specified via State Variable 2'
2012-02-02 18:49:02 +05:30
case (120_pInt)
msg = 'no microstructure specified via State Variable 3'
2012-02-02 18:49:02 +05:30
case (125_pInt)
msg = 'no entries in config part'
2012-02-02 18:49:02 +05:30
case (130_pInt)
msg = 'homogenization index out of bounds'
2012-02-02 18:49:02 +05:30
case (140_pInt)
msg = 'microstructure index out of bounds'
2012-02-02 18:49:02 +05:30
case (150_pInt)
msg = 'crystallite index out of bounds'
2012-02-02 18:49:02 +05:30
case (155_pInt)
msg = 'phase index out of bounds'
2012-02-02 18:49:02 +05:30
case (160_pInt)
msg = 'texture index out of bounds'
2012-02-02 18:49:02 +05:30
case (170_pInt)
msg = 'sum of phase fractions differs from 1'
2012-02-02 18:49:02 +05:30
case (180_pInt)
msg = 'mismatch of microstructure count and a*b*c in geom file'
2012-02-02 18:49:02 +05:30
case (200_pInt)
msg = 'unknown constitution specified'
2012-02-02 18:49:02 +05:30
case (201_pInt)
msg = 'unknown homogenization specified'
2012-02-02 18:49:02 +05:30
case (205_pInt)
msg = 'unknown lattice structure encountered'
2012-02-02 18:49:02 +05:30
case (210_pInt)
msg = 'negative initial resistance'
2012-02-02 18:49:02 +05:30
case (211_pInt)
msg = 'non-positive reference shear rate'
2012-02-02 18:49:02 +05:30
case (212_pInt)
msg = 'non-positive stress exponent'
2012-02-02 18:49:02 +05:30
case (213_pInt)
msg = 'non-positive saturation stress'
2012-02-02 18:49:02 +05:30
case (214_pInt)
msg = 'zero hardening exponent'
2012-02-02 18:49:02 +05:30
case (220_pInt)
msg = 'negative initial dislocation density'
2012-02-02 18:49:02 +05:30
case (221_pInt)
msg = 'negative Burgers vector'
2012-02-02 18:49:02 +05:30
case (222_pInt)
msg = 'negative activation energy for edge dislocation glide'
2012-02-02 18:49:02 +05:30
case (223_pInt)
msg = 'zero stackin fault energy'
2012-02-02 18:49:02 +05:30
case (225_pInt)
msg = 'no slip systems specified'
2012-02-02 18:49:02 +05:30
case (226_pInt)
msg = 'non-positive prefactor for dislocation velocity'
2012-02-02 18:49:02 +05:30
case (227_pInt)
msg = 'non-positive prefactor for mean free path'
2012-02-02 18:49:02 +05:30
case (228_pInt)
msg = 'non-positive minimum stable dipole distance'
2012-02-02 18:49:02 +05:30
case (229_pInt)
msg = 'non-positive hardening interaction coefficients'
2012-02-02 18:49:02 +05:30
case (230_pInt)
msg = 'non-positive atomic volume'
2012-02-02 18:49:02 +05:30
case (231_pInt)
msg = 'non-positive prefactor for self-diffusion coefficient'
case (232_pInt)
msg = 'non-positive activation energy for self-diffusion'
2012-02-02 18:49:02 +05:30
case (233_pInt)
msg = 'non-positive relevant dislocation density'
2012-02-02 18:49:02 +05:30
case (234_pInt)
msg = 'error in shear banding input'
2012-02-02 18:49:02 +05:30
case (235_pInt)
msg = 'material parameter for nonlocal constitutive phase out of bounds:'
2012-02-02 18:49:02 +05:30
case (236_pInt)
msg = 'unknown material parameter for nonlocal constitutive phase:'
2012-02-02 18:49:02 +05:30
case (237_pInt)
msg = 'unknown constitutive output for nonlocal constitution:'
2012-02-02 18:49:02 +05:30
case (240_pInt)
msg = 'non-positive Taylor factor'
2012-02-02 18:49:02 +05:30
case (241_pInt)
msg = 'non-positive hardening exponent'
2012-02-02 18:49:02 +05:30
case (242_pInt)
msg = 'non-positive relevant slip resistance'
2012-02-02 18:49:02 +05:30
case (260_pInt)
msg = 'non-positive relevant strain'
2012-02-02 18:49:02 +05:30
case (261_pInt)
msg = 'frequency of stiffness update < 0'
2012-02-02 18:49:02 +05:30
case (262_pInt)
msg = 'frequency of Jacobian update of Lp residuum < 0'
2012-02-02 18:49:02 +05:30
case (263_pInt)
msg = 'non-positive perturbation value'
2012-02-02 18:49:02 +05:30
case (264_pInt)
msg = 'limit for homogenization loop too small'
2012-02-02 18:49:02 +05:30
case (265_pInt)
msg = 'limit for crystallite loop too small'
2012-02-02 18:49:02 +05:30
case (266_pInt)
msg = 'limit for state loop too small'
2012-02-02 18:49:02 +05:30
case (267_pInt)
msg = 'limit for stress loop too small'
2012-02-02 18:49:02 +05:30
case (268_pInt)
msg = 'non-positive minimum substep size'
2012-02-02 18:49:02 +05:30
case (269_pInt)
msg = 'non-positive relative state tolerance'
2012-02-02 18:49:02 +05:30
case (270_pInt)
msg = 'Non-positive relative stress tolerance'
2012-02-02 18:49:02 +05:30
case (271_pInt)
msg = 'Non-positive absolute stress tolerance'
!* Error messages related to RGC numerical parameters <<<updated 31.07.2009>>>
2012-02-02 18:49:02 +05:30
case (272_pInt)
msg = 'non-positive relative tolerance of residual in RGC'
2012-02-02 18:49:02 +05:30
case (273_pInt)
msg = 'non-positive absolute tolerance of residual in RGC'
2012-02-02 18:49:02 +05:30
case (274_pInt)
msg = 'non-positive relative maximum of residual in RGC'
2012-02-02 18:49:02 +05:30
case (275_pInt)
msg = 'non-positive absolute maximum of residual in RGC'
2012-02-02 18:49:02 +05:30
case (276_pInt)
msg = 'non-positive penalty perturbation in RGC'
2012-02-02 18:49:02 +05:30
case (277_pInt)
msg = 'non-positive relevant mismatch in RGC'
2012-02-02 18:49:02 +05:30
case (278_pInt)
msg = 'non-positive definite viscosity model in RGC'
2012-02-02 18:49:02 +05:30
case (288_pInt)
msg = 'non-positive maximum threshold of relaxation change in RGC'
2012-02-02 18:49:02 +05:30
case (289_pInt)
msg = 'non-positive definite volume discrepancy penalty in RGC'
2012-02-02 18:49:02 +05:30
case (294_pInt)
msg = 'non-positive tolerance for deformation gradient'
2012-02-02 18:49:02 +05:30
case (298_pInt)
msg = 'chosen integration method does not exist'
2012-02-02 18:49:02 +05:30
case (299_pInt)
msg = 'chosen perturbation method does not exist'
2012-02-02 18:49:02 +05:30
case (300_pInt)
msg = 'this material can only be used with elements with three direct stress components'
2012-02-02 18:49:02 +05:30
case (500_pInt)
msg = 'unknown lattice type specified'
2012-02-02 18:49:02 +05:30
case (550_pInt)
msg = 'unknown symmetry type specified'
2012-02-02 18:49:02 +05:30
case (600_pInt)
msg = 'convergence not reached'
2012-02-02 18:49:02 +05:30
case (610_pInt)
msg = 'stress loop not converged'
2012-02-02 18:49:02 +05:30
case (666_pInt)
msg = 'memory leak detected'
2012-02-02 18:49:02 +05:30
case (667_pInt)
msg = 'invalid materialpoint result requested'
2012-02-02 18:49:02 +05:30
case (670_pInt)
msg = 'math_check: quat -> axisAngle -> quat failed'
2012-02-02 18:49:02 +05:30
case (671_pInt)
msg = 'math_check: quat -> R -> quat failed'
2012-02-02 18:49:02 +05:30
case (672_pInt)
msg = 'math_check: quat -> euler -> quat failed'
2012-02-02 18:49:02 +05:30
case (673_pInt)
msg = 'math_check: R -> euler -> R failed'
2012-02-02 18:49:02 +05:30
case (700_pInt)
msg = 'singular matrix in stress iteration'
2012-02-02 18:49:02 +05:30
case (800_pInt)
msg = 'matrix inversion error'
case (801_pInt)
msg = 'I_TO_HALTON-error: An input base BASE is <= 1'
case (802_pInt)
msg = 'Prime-error: N must be between 0 and PRIME_MAX'
! Error messages related to parsing of Abaqus input file
2012-02-02 18:49:02 +05:30
case (900_pInt)
msg = 'PARSE ERROR: Improper definition of nodes in input file (Nnodes < 2)'
2012-02-02 18:49:02 +05:30
case (901_pInt)
msg = 'PARSE ERROR: No Elements defined in input file (Nelems = 0)'
2012-02-02 18:49:02 +05:30
case (902_pInt)
msg = 'PARSE ERROR: No Element sets defined in input file (Atleast one *Elset must exist)'
2012-02-02 18:49:02 +05:30
case (903_pInt)
msg = 'PARSE ERROR: No Materials defined in input file (Look into section assigments)'
2012-02-02 18:49:02 +05:30
case (904_pInt)
msg = 'PARSE ERROR: No elements could be assigned for Elset: '
2012-02-02 18:49:02 +05:30
case (905_pInt)
msg = 'PARSE ERROR: Error in mesh_abaqus_map_materials'
2012-02-02 18:49:02 +05:30
case (906_pInt)
msg = 'PARSE ERROR: Error in mesh_abaqus_count_cpElements'
2012-02-02 18:49:02 +05:30
case (907_pInt)
msg = 'PARSE ERROR: Incorrect size of mesh_mapFEtoCPelem in mesh_abaqus_map_elements; Size cannot be zero'
2012-02-02 18:49:02 +05:30
case (908_pInt)
msg = 'PARSE ERROR: Incorrect size of mesh_mapFEtoCPnode in mesh_abaqus_map_nodes; Size cannot be zero'
2012-02-02 18:49:02 +05:30
case (909_pInt)
msg = 'PARSE ERROR: Incorrect size of mesh_node in mesh_abaqus_build_nodes; must be equal to mesh_Nnodes'
2012-02-02 18:49:02 +05:30
case (910_pInt)
msg = 'PARSE ERROR: Incorrect element type mapping in '
case default
msg = 'Unknown error number...'
end select
2009-01-20 00:40:58 +05:30
!$OMP CRITICAL (write2out)
write(6,*)
write(6,'(a38)') '+------------------------------------+'
write(6,'(a38)') '+ error +'
write(6,'(a17,i3,a18)') '+ ',error_ID,' +'
write(6,'(a38)') '+ +'
write(6,'(a2,a)') '+ ', trim(msg)
if (present(ext_msg)) write(6,'(a2,a)') '+ ', trim(ext_msg)
if (present(e)) then
if (present(i) .and. present(g)) then
write(6,'(a13,i6,a4,i2,a7,i4,a2)') '+ at element ',e,' IP ',i,' grain ',g,' +'
else
write(6,'(a18,i6,a14)') '+ at ',e,' +'
endif
endif
write(6,'(a38)') '+------------------------------------+'
call flush(6)
2012-02-10 16:54:53 +05:30
call quit(9000_pInt+error_ID)
2010-02-18 15:42:45 +05:30
!$OMP END CRITICAL (write2out)
2009-01-20 00:40:58 +05:30
! ABAQUS returns in some cases
endsubroutine
!********************************************************************
! write warning statements to standard out
!********************************************************************
subroutine IO_warning(warning_ID,e,i,g,ext_msg)
use prec, only: pInt
implicit none
integer(pInt), intent(in) :: warning_ID
integer(pInt), optional, intent(in) :: e,i,g
character(len=*), optional, intent(in) :: ext_msg
character(len=1024) msg
select case (warning_ID)
2012-02-02 18:49:02 +05:30
case (34_pInt)
msg = 'invalid restart increment given'
2012-02-02 18:49:02 +05:30
case (35_pInt)
msg = 'could not get $DAMASK_NUM_THREADS'
case (47_pInt)
msg = 'No valid parameter for FFTW given, using FFTW_PATIENT'
case (101_pInt)
msg = '+ crystallite debugging off... +'
case (600_pInt)
msg = '+ crystallite responds elastically +'
case (601_pInt)
msg = '+ stiffness close to zero +'
case (650_pInt)
msg = '+ polar decomposition failed +'
case (700_pInt)
constitutive_nonlocal: - corrected flux term - multiplication is now aware of dislocation type - corrected change rate for "dipole size" dupper - corrected term for dipole dissociation by stress change - added transmissivity term in fluxes which accounts for misorientation between two neighboring grains (yet hardcoded transmissivity according to misorientation angle) - added more output variables constitutive: - 2 additional variables "previousDotState" and "previousDotState2", which are used to store the previous and second previous dotState (used in crystallite for acceleration/stabilization of state integration) - timer for dotState now measures the time for calls to constitutive_ collectState (used to reside in crystallite_updateState, which is not critical in terms of calculation time anymore) crystallite: - convergence check for nonlocal elments is now done at end of crystallite loop, not at the beginning; we simple set all elements to not converged if there is at least one nonlocal element that did not converge - need call to microstructure before first call to collect dotState for dependent states - stiffness calculation (jacobian): if there are nonlocal elements, we also have to consider changes in our neighborhood's states; so for every perturbed component in a single ip, we have to loop over all elements; since this is extremely time-consuming, we just perturb one component per cycle, starting with the one that changes the most during regular time step. - updateState gets a damping prefactor for our dotState that helps to improve convergence; prefactor is calculated according to change of dotState IO: - additional warning message for unknown crystal symmetry
2009-12-15 13:50:31 +05:30
msg = '+ unknown crystal symmetry +'
case default
msg = '+ unknown warning number... +'
end select
!$OMP CRITICAL (write2out)
write(6,*)
write(6,'(a38)') '+------------------------------------+'
write(6,'(a38)') '+ warning +'
write(6,'(a38)') '+ +'
write(6,'(a17,i3,a18)') '+ ',warning_ID,' +'
write(6,'(a2,a)') '+ ', trim(msg)
if (present(ext_msg)) write(6,'(a2,a)') '+ ', trim(ext_msg)
if (present(e)) then
if (present(i)) then
if (present(g)) then
write(6,'(a12,1x,i6,1x,a2,1x,i2,1x,a5,1x,i4,a2)') '+ at element',e,'IP',i,'grain',g,' +'
else
write(6,'(a12,1x,i6,1x,a2,1x,i2,a13)') '+ at element',e,'IP',i,' +'
endif
else
write(6,'(a12,1x,i6,a19)') '+ at element',e,' +'
endif
endif
write(6,'(a38)') '+------------------------------------+'
call flush(6)
!$OMP END CRITICAL (write2out)
endsubroutine
END MODULE IO