2011-04-07 12:50:28 +05:30
|
|
|
! Copyright 2011 Max-Planck-Institut für Eisenforschung GmbH
|
2011-04-04 19:39:54 +05:30
|
|
|
!
|
|
|
|
! This file is part of DAMASK,
|
2011-04-07 12:50:28 +05:30
|
|
|
! the Düsseldorf Advanced MAterial Simulation Kit.
|
2011-04-04 19:39:54 +05:30
|
|
|
!
|
|
|
|
! 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/>.
|
|
|
|
!
|
|
|
|
!##############################################################
|
2010-05-06 22:10:47 +05:30
|
|
|
!* $Id$
|
2008-03-15 03:02:57 +05:30
|
|
|
!##############################################################
|
2012-03-09 01:55:28 +05:30
|
|
|
module FEsolving
|
2008-03-15 03:02:57 +05:30
|
|
|
!##############################################################
|
2012-03-20 23:31:31 +05:30
|
|
|
use prec, only: &
|
|
|
|
pInt, &
|
|
|
|
pReal
|
2012-03-09 01:55:28 +05:30
|
|
|
|
2008-03-15 03:02:57 +05:30
|
|
|
implicit none
|
2012-03-20 23:31:31 +05:30
|
|
|
private
|
|
|
|
integer(pInt), public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
cycleCounter = 0_pInt, &
|
|
|
|
theInc = -1_pInt, &
|
|
|
|
restartInc = 1_pInt
|
|
|
|
|
2012-03-20 23:31:31 +05:30
|
|
|
real(pReal), public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
theTime = 0.0_pReal, &
|
|
|
|
theDelta = 0.0_pReal
|
|
|
|
|
2012-03-20 23:31:31 +05:30
|
|
|
logical, public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
outdatedFFN1 = .false., &
|
|
|
|
symmetricSolver = .false., &
|
|
|
|
restartWrite = .false., &
|
|
|
|
restartRead = .false., &
|
2012-03-20 23:31:31 +05:30
|
|
|
terminallyIll = .false., &
|
2012-03-21 23:34:52 +05:30
|
|
|
parallelExecution = .true., &
|
|
|
|
lastMode = .true., &
|
|
|
|
lastIncConverged = .false., &
|
|
|
|
outdatedByNewInc = .false., &
|
|
|
|
cutBack = .false.
|
2012-03-20 23:31:31 +05:30
|
|
|
|
|
|
|
integer(pInt), dimension(:,:), allocatable, public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
FEsolving_execIP
|
|
|
|
|
2012-03-20 23:31:31 +05:30
|
|
|
integer(pInt), dimension(2), public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
FEsolving_execElem
|
|
|
|
|
2012-03-20 23:31:31 +05:30
|
|
|
character(len=1024), public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
FEmodelGeometry
|
|
|
|
|
2012-03-20 23:31:31 +05:30
|
|
|
logical, dimension(:,:), allocatable, public :: &
|
2012-03-09 01:55:28 +05:30
|
|
|
calcMode
|
2012-03-21 23:34:52 +05:30
|
|
|
|
2012-03-09 01:55:28 +05:30
|
|
|
public :: FE_init
|
2008-03-15 03:02:57 +05:30
|
|
|
|
2012-03-09 01:55:28 +05:30
|
|
|
contains
|
2009-01-20 00:40:58 +05:30
|
|
|
|
|
|
|
!***********************************************************
|
2011-09-13 21:27:58 +05:30
|
|
|
! determine whether a symmetric solver is used
|
2010-11-03 20:09:18 +05:30
|
|
|
! and whether restart is requested
|
2009-01-20 00:40:58 +05:30
|
|
|
!***********************************************************
|
2012-03-09 01:55:28 +05:30
|
|
|
subroutine FE_init
|
2009-01-20 00:40:58 +05:30
|
|
|
|
2012-02-21 21:12:47 +05:30
|
|
|
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
|
2012-03-20 23:31:31 +05:30
|
|
|
use debug, only: &
|
|
|
|
debug_what, &
|
|
|
|
debug_FEsolving, &
|
|
|
|
debug_levelBasic
|
|
|
|
|
|
|
|
use IO, only: &
|
|
|
|
IO_open_inputFile, &
|
|
|
|
IO_stringPos, &
|
|
|
|
IO_stringValue, &
|
|
|
|
IO_intValue, &
|
|
|
|
IO_lc, &
|
|
|
|
IO_open_logFile, &
|
|
|
|
IO_warning
|
|
|
|
|
2011-11-04 01:02:11 +05:30
|
|
|
use DAMASK_interface
|
2009-01-20 00:40:58 +05:30
|
|
|
|
2012-03-09 01:55:28 +05:30
|
|
|
implicit none
|
2012-03-20 23:31:31 +05:30
|
|
|
integer(pInt), parameter :: &
|
|
|
|
fileunit = 222_pInt, &
|
|
|
|
maxNchunks = 6_pInt
|
2012-03-09 01:55:28 +05:30
|
|
|
|
|
|
|
integer :: i, start = 0, length ! is save for FE_init (only called once)
|
2012-02-14 17:47:47 +05:30
|
|
|
integer(pInt) :: j
|
|
|
|
integer(pInt), dimension(1_pInt+2_pInt*maxNchunks) :: positions
|
2012-03-09 01:55:28 +05:30
|
|
|
character(len=64) :: tag
|
|
|
|
character(len=1024) :: line, &
|
|
|
|
commandLine
|
|
|
|
|
2011-05-28 15:14:43 +05:30
|
|
|
FEmodelGeometry = getModelName()
|
2012-02-13 23:11:27 +05:30
|
|
|
call IO_open_inputFile(fileunit,FEmodelGeometry)
|
2012-03-09 01:55:28 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
if (trim(FEsolver) == 'Spectral') then
|
|
|
|
call get_command(commandLine) ! may contain uppercase
|
|
|
|
do i=1,len(commandLine)
|
|
|
|
if(64 < iachar(commandLine(i:i)) .and. iachar(commandLine(i:i)) < 91) &
|
|
|
|
commandLine(i:i) = achar(iachar(commandLine(i:i))+32) ! make lowercase
|
|
|
|
enddo
|
|
|
|
if (index(commandLine,'-r ',.true.)>0) & ! look for -r
|
2012-02-16 00:28:38 +05:30
|
|
|
start = index(commandLine,'-r ',.true.) + 3 ! set to position after trailing space
|
2012-02-13 23:11:27 +05:30
|
|
|
if (index(commandLine,'--restart ',.true.)>0) & ! look for --restart
|
2012-02-16 00:28:38 +05:30
|
|
|
start = index(commandLine,'--restart ',.true.) + 10 ! set to position after trailing space
|
2012-03-09 01:55:28 +05:30
|
|
|
if(start /= 0) then ! found something
|
2012-02-13 23:11:27 +05:30
|
|
|
length = verify(commandLine(start:len(commandLine)),'0123456789',.false.) ! where is first non number after argument?
|
|
|
|
read(commandLine(start:start+length),'(I12)') restartInc ! read argument
|
|
|
|
restartRead = restartInc > 0_pInt
|
|
|
|
if(restartInc <= 0_pInt) then
|
|
|
|
call IO_warning(warning_ID=34_pInt)
|
|
|
|
restartInc = 1_pInt
|
2011-12-04 15:31:32 +05:30
|
|
|
endif
|
2011-11-04 01:02:11 +05:30
|
|
|
endif
|
2009-03-04 17:18:54 +05:30
|
|
|
else
|
2012-02-13 23:11:27 +05:30
|
|
|
rewind(fileunit)
|
|
|
|
do
|
|
|
|
read (fileunit,'(a1024)',END=100) line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
|
|
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
|
|
|
select case(tag)
|
|
|
|
case ('solver')
|
|
|
|
read (fileunit,'(a1024)',END=100) line ! next line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
|
|
|
symmetricSolver = (IO_intValue(line,positions,2_pInt) /= 1_pInt)
|
|
|
|
case ('restart')
|
|
|
|
read (fileunit,'(a1024)',END=100) line ! next line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
|
|
|
restartWrite = iand(IO_intValue(line,positions,1_pInt),1_pInt) > 0_pInt
|
|
|
|
restartRead = iand(IO_intValue(line,positions,1_pInt),2_pInt) > 0_pInt
|
|
|
|
case ('*restart')
|
2012-02-16 00:28:38 +05:30
|
|
|
do j=2_pInt,positions(1)
|
|
|
|
restartWrite = (IO_lc(IO_StringValue(line,positions,j)) == 'write') .or. restartWrite
|
|
|
|
restartRead = (IO_lc(IO_StringValue(line,positions,j)) == 'read') .or. restartRead
|
2012-02-13 23:11:27 +05:30
|
|
|
enddo
|
|
|
|
if(restartWrite) then
|
2012-02-16 00:28:38 +05:30
|
|
|
do j=2_pInt,positions(1)
|
2012-02-14 17:47:47 +05:30
|
|
|
restartWrite = (IO_lc(IO_StringValue(line,positions,j)) /= 'frequency=0') .and. restartWrite
|
2012-02-13 23:11:27 +05:30
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
end select
|
|
|
|
enddo
|
2009-03-04 17:18:54 +05:30
|
|
|
endif
|
2011-11-04 01:02:11 +05:30
|
|
|
100 close(fileunit)
|
2009-06-18 19:58:02 +05:30
|
|
|
|
2011-05-28 15:14:43 +05:30
|
|
|
if (restartRead) then
|
2012-02-13 23:11:27 +05:30
|
|
|
if(FEsolver == 'Marc') then
|
|
|
|
call IO_open_logFile(fileunit)
|
2011-05-28 15:14:43 +05:30
|
|
|
rewind(fileunit)
|
|
|
|
do
|
|
|
|
read (fileunit,'(a1024)',END=200) line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
2012-02-10 17:29:59 +05:30
|
|
|
if ( IO_lc(IO_stringValue(line,positions,1_pInt)) == 'restart' .and. &
|
|
|
|
IO_lc(IO_stringValue(line,positions,2_pInt)) == 'file' .and. &
|
|
|
|
IO_lc(IO_stringValue(line,positions,3_pInt)) == 'job' .and. &
|
|
|
|
IO_lc(IO_stringValue(line,positions,4_pInt)) == 'id' ) &
|
|
|
|
FEmodelGeometry = IO_StringValue(line,positions,6_pInt)
|
2011-05-28 15:14:43 +05:30
|
|
|
enddo
|
2012-02-13 23:11:27 +05:30
|
|
|
elseif (FEsolver == 'Abaqus') then
|
|
|
|
call IO_open_inputFile(fileunit,FEmodelGeometry)
|
2011-05-28 15:14:43 +05:30
|
|
|
rewind(fileunit)
|
|
|
|
do
|
|
|
|
read (fileunit,'(a1024)',END=200) line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
2012-02-10 17:29:59 +05:30
|
|
|
if ( IO_lc(IO_stringValue(line,positions,1_pInt))=='*heading') then
|
2011-07-18 14:45:20 +05:30
|
|
|
read (fileunit,'(a1024)',END=200) line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
2012-02-10 17:29:59 +05:30
|
|
|
FEmodelGeometry = IO_StringValue(line,positions,1_pInt)
|
2011-07-18 14:45:20 +05:30
|
|
|
endif
|
2011-05-28 15:14:43 +05:30
|
|
|
enddo
|
|
|
|
endif
|
2010-11-03 20:09:18 +05:30
|
|
|
endif
|
|
|
|
|
|
|
|
200 close(fileunit)
|
|
|
|
|
|
|
|
!$OMP CRITICAL (write2out)
|
|
|
|
write(6,*)
|
|
|
|
write(6,*) '<<<+- FEsolving init -+>>>'
|
|
|
|
write(6,*) '$Id$'
|
2012-01-31 20:24:49 +05:30
|
|
|
#include "compilation_info.f90"
|
2012-03-09 01:55:28 +05:30
|
|
|
if (iand(debug_what(debug_FEsolving),debug_levelBasic) /= 0_pInt) then
|
2011-03-21 16:01:17 +05:30
|
|
|
write(6,*) 'restart writing: ', restartWrite
|
|
|
|
write(6,*) 'restart reading: ', restartRead
|
2011-05-28 15:14:43 +05:30
|
|
|
if (restartRead) write(6,*) 'restart Job: ', trim(FEmodelGeometry)
|
2011-03-21 16:01:17 +05:30
|
|
|
write(6,*)
|
|
|
|
endif
|
2010-11-03 20:09:18 +05:30
|
|
|
!$OMP END CRITICAL (write2out)
|
2009-01-20 00:40:58 +05:30
|
|
|
|
2012-03-09 01:55:28 +05:30
|
|
|
end subroutine FE_init
|
2008-03-15 03:02:57 +05:30
|
|
|
|
2012-03-09 01:55:28 +05:30
|
|
|
end module FEsolving
|