restructured algorithm, initialization now not longer within increments, lot of small improvements/polishing

makefile now calls compiler with lot of warning flags
This commit is contained in:
Martin Diehl 2012-02-10 11:59:59 +00:00
parent 37ac7bf1b4
commit 1cc2315954
3 changed files with 516 additions and 387 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,10 @@
!##############################################################
MODULE FEsolving
!##############################################################
use prec, only: pInt,pReal
implicit none
integer(pInt) :: cycleCounter = 0_pInt, theInc = -1_pInt, restartReadInc = 0_pInt
integer(pInt) :: cycleCounter = 0_pInt, theInc = -1_pInt, restartInc = 1_pInt
real(pReal) :: theTime = 0.0_pReal, theDelta = 0.0_pReal
logical :: lastIncConverged = .false.,outdatedByNewInc = .false.,outdatedFFN1 = .false.,terminallyIll = .false.
logical :: symmetricSolver = .false.
@ -46,6 +45,7 @@
!***********************************************************
subroutine FE_init()
use, intrinsic :: iso_fortran_env
use prec, only: pInt
use debug, only: debug_verbosity
use DAMASK_interface
@ -55,7 +55,7 @@
integer(pInt), parameter :: fileunit = 222
integer(pInt), parameter :: maxNchunks = 6
integer(pInt):: i, start = 0_pInt, length=0_pInt
integer(pInt), dimension(1+2*maxNchunks) :: positions
integer(pInt), dimension(1_pInt+2_pInt*maxNchunks) :: positions
character(len=64) tag
character(len=1024) line, commandLine
@ -74,27 +74,29 @@
if(start /= 0_pInt) then ! found something
length = verify(commandLine(start:len(commandLine)),'0123456789',.false.) ! where is first non number after argument?
read(commandLine(start:start+length),'(I12)') restartReadInc ! read argument
restartReadInc = restartReadInc - 1_pInt ! command line argument is inc to compute
restartRead = max(0_pInt,restartReadInc) > 0_pInt
if(restartReadInc < 0_pInt) call IO_warning(warning_ID=34_pInt)
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
endif
endif
else
rewind(fileunit)
do
read (fileunit,'(a1024)',END=100) line
positions = IO_stringPos(line,maxNchunks)
tag = IO_lc(IO_stringValue(line,positions,1)) ! extract key
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) /= 1_pInt)
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),1_pInt) > 0_pInt
restartRead = iand(IO_intValue(line,positions,1),2_pInt) > 0_pInt
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')
do i=2,positions(1)
restartWrite = (IO_lc(IO_StringValue(line,positions,i)) == 'write') .or. restartWrite
@ -109,7 +111,7 @@
enddo
endif
else
call IO_error(101, ext_msg=FEmodelGeometry) ! cannot open input file
call IO_error(101_pInt, ext_msg=FEmodelGeometry) ! cannot open input file
endif
100 close(fileunit)
@ -119,27 +121,27 @@
do
read (fileunit,'(a1024)',END=200) line
positions = IO_stringPos(line,maxNchunks)
if ( IO_lc(IO_stringValue(line,positions,1)) == 'restart' .and. &
IO_lc(IO_stringValue(line,positions,2)) == 'file' .and. &
IO_lc(IO_stringValue(line,positions,3)) == 'job' .and. &
IO_lc(IO_stringValue(line,positions,4)) == 'id' ) &
FEmodelGeometry = IO_StringValue(line,positions,6)
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)
enddo
elseif (FEsolver == 'Abaqus' .and. IO_open_inputFile(fileunit,FEmodelGeometry)) then
rewind(fileunit)
do
read (fileunit,'(a1024)',END=200) line
positions = IO_stringPos(line,maxNchunks)
if ( IO_lc(IO_stringValue(line,positions,1))=='*heading') then
if ( IO_lc(IO_stringValue(line,positions,1_pInt))=='*heading') then
read (fileunit,'(a1024)',END=200) line
positions = IO_stringPos(line,maxNchunks)
FEmodelGeometry = IO_StringValue(line,positions,1)
FEmodelGeometry = IO_StringValue(line,positions,1_pInt)
endif
enddo
elseif (FEsolver == 'Spectral') then
!do nothing
else
call IO_error(106) ! cannot open file for old job info
call IO_error(106_pInt) ! cannot open file for old job info
endif
endif

View File

@ -33,8 +33,9 @@
# SUFFIX = arbitrary suffix
# STANDARD_CHECK = checking for Fortran 2008, compiler dependend
########################################################################################
# Here are some useful debugging switches. Switch on by uncommenting the #SUFFIX line at the end of this section:
# Here are some useful debugging switches for ifort. Switch on by uncommenting the #SUFFIX line at the end of this section:
# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/
# check if an array index is too small (<1) or too large!
DEBUG1 =-check bounds -g
@ -54,9 +55,12 @@ DEBUG5 =-warn all
#set precision (check for missing _pInt and _pReal)
DEBUG6= -real-size 32 -integer-size 16
#or one of those 16/32/64/128 (= 2,4,8,16 bytes)
#SUFFIX =$(DEBUG1) $(DEBUG2) $(DEBUG3) $(DEBUG4) $(DEBUG5) $(DEBUG6)
# Here are some useful debugging switches for gfortran
# fcheck-bounds: eqv to DEBUG1 of ifort
#SUFFIX =$(DEBUG1) $(DEBUG2) $(DEBUG3)
########################################################################################
#auto values will be set by setup_code.py
@ -70,6 +74,12 @@ COMPILERNAME ?= $(F90)
OPENMP ?= ON
OPTIMIZATION ?= DEFENSIVE
ifeq "$(F90)" "ifort"
ARCHIVE_COMMAND :=xiar
else
ARCHIVE_COMMAND :=ar
endif
ifeq "$(OPTIMIZATION)" "OFF"
OPTI := OFF
MAXOPTI := OFF
@ -93,40 +103,40 @@ MAXOPTI := DEFENSIVE
endif
ifeq "$(PORTABLE)" "FALSE"
PORTABLE_SWITCH = -msse3
PORTABLE_SWITCH =-msse3
endif
# settings for multicore support
ifeq "$(OPENMP)" "ON"
OPENMP_FLAG_ifort = -openmp -openmp-report0 -parallel
OPENMP_FLAG_gfortran = -fopenmp
OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel
OPENMP_FLAG_gfortran =-fopenmp
ACML_ARCH =_mp
LIBRARIES += -lfftw3_threads -lpthread
LIBRARIES +=-lfftw3_threads -lpthread
endif
LIBRARIES += -lfftw3
LIB_DIRS += -L$(FFTWROOT)/lib
LIBRARIES +=-lfftw3
LIB_DIRS +=-L$(FFTWROOT)/lib
ifdef IKMLROOT
LIBRARIES += -mkl
LIBRARIES +=-mkl
else
ifdef ACMLROOT
LIB_DIRS += -L$(ACMLROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES += -lacml$(ACML_ARCH)
LIB_DIRS +=-L$(ACMLROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES +=-lacml$(ACML_ARCH)
else
ifdef LAPACKROOT
LIB_DIRS += -L$(LAPACKROOT)/lib64 -L$(LAPACKROOT)/lib
LIBRARIES += -llapack
LIB_DIRS +=-L$(LAPACKROOT)/lib64 -L$(LAPACKROOT)/lib
LIBRARIES +=-llapack
endif
endif
endif
ifdef STANDARD_CHECK
STANDARD_CHECK_ifort = $(STANDARD_CHECK)
STANDARD_CHECK_gfortran = $(STANDARD_CHECK)
STANDARD_CHECK_ifort =$(STANDARD_CHECK)
STANDARD_CHECK_gfortran =$(STANDARD_CHECK)
endif
STANDARD_CHECK_ifort ?= -stand f08
STANDARD_CHECK_ifort ?=-stand f08 -standard-semantics
STANDARD_CHECK_gfortran ?=-std=f2008
@ -138,16 +148,89 @@ OPTIMIZATION_AGGRESSIVE_ifort :=-O3 $(PORTABLE_SWITCH) -ip -static -fp-model
OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 $(PORTABLE_SWITCH) -ffast-math -funroll-loops -ftree-vectorize
COMPILE_OPTIONS_ifort := -fpp -diag-disable 8291,8290,5268
#warning ID 9291,8290:
#warning ID 5268: Extension to standard: The text exceeds right hand column allowed on the line (we have only comments there)
COMPILE_OPTIONS_gfortran := -xf95-cpp-input -ffree-line-length-132 -fno-range-check
COMPILE_OPTIONS_ifort :=-fpp\
-diag-enable sc3\
-diag-disable 8291,8290,5268\
-warn declarations\
-warn general\
-warn usage
#alignments: Determines whether warnings occur for data that is not naturally aligned.
#declarations: Determines whether warnings occur for any undeclared names.
#errors: Determines whether warnings are changed to errors.
#general: Determines whether warning messages and informational messages are issued by the compiler.
#ignore_loc: Determines whether warnings occur when %LOC is stripped from an actual argument.
#interfaces: Determines whether the compiler checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks.
#stderrors: Determines whether warnings about Fortran standard violations are changed to errors.
#truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files.
#uncalled: Determines whether warnings occur when a statement function is never called
#unused: Determines whether warnings occur for declared variables that are never used.
#usage: Determines whether warnings occur for questionable programming practices.
#-fpp: preprocessor
#-diag-disable: disables warnings, where
# warning ID 9291:
# warning ID 8290:
# warning ID 5268: The text exceeds right hand column allowed on the line (we have only comments there)
COMPILE_OPTIONS_gfortran :=-xf95-cpp-input\
-ffree-line-length-132\
-fno-range-check\
-fimplicit-none\
-pedantic\
-Warray-bounds\
-Wunused-parameter\
-Wampersand\
-Wno-tabs\
-Wcharacter-truncation\
-Wintrinsic-shadow\
-Waliasing\
-Wconversion\
-Wsurprising\
-Wunused-value\
-Wunderflow
#-xf95-cpp-input: preprocessor
#-ffree-line-length-132: restrict line length to the standard 132 characters
#-fno-range-check: disables checking if result can be represented by variable. Needs to be set to enable DAMASK_NaN
#-fimplicit-none: assume "implicit-none" even if not present in source
#-pedantic: more strict on standard, enables some of the warnings below
#-Warray-bounds: checks if array reference is out of bounds at compile time. use -fcheck-bounds to also check during runtime
#-Wunused-parameter: find usused variables with "parameter" attribute
#-Wampersand: checks if a character expression is continued proberly by an ampersand at the end of the line and at the beginning of the new line
#-Wno-tabs: do not allow tabs in source
#-Wcharacter-truncation: warn if character expressions (strings) are truncated
#-Wintrinsic-shadow: warn if a user-defined procedure or module procedure has the same name as an intrinsic
#-Waliasing: warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)" in a call with an explicit interface.
#-Wconversion: warn about implicit conversions between different type
#-Wsurprising: warn when "suspicious" code constructs are encountered. While technically legal these usually indicate that an error has been made.
#-Wunused-value:
#-Wunderflow: produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation
#MORE OPTIONS
# only for gfortran 4.6:
#-Wsuggest-attribute=const
#-Wsuggest-attribute=noreturn
#-Wsuggest-attribute=pure
# too many warnings because we have comments beyond character 132:
#-Wline-truncation
# warnings because of "flush" is not longer in the standard, but still an intrinsic fuction of the compilers:
#-Wintrinsic-std
# warnings because we have many temporary arrays (performance issue?):
#-Warray-temporaries
# -Wimplicit-interface
# -pedantic-errors
# -fmodule-private
COMPILE =$(OPENMP_FLAG_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(OPTI)_$(F90)) -c
COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) -c
DAMASK_spectral.exe: DAMASK_spectral.o CPFEM.a
$(PREFIX) $(COMPILERNAME) ${OPENMP_FLAG_${F90}} -o DAMASK_spectral.exe DAMASK_spectral.o CPFEM.a \
constitutive.a advanced.a basics.a $(LIB_DIRS) $(LIBRARIES)
@ -158,7 +241,7 @@ DAMASK_spectral.o: DAMASK_spectral.f90 CPFEM.o
CPFEM.a: CPFEM.o
ar rc CPFEM.a homogenization.o homogenization_RGC.o homogenization_isostrain.o crystallite.o CPFEM.o constitutive.o
$(ARCHIVE_COMMAND) rc CPFEM.a homogenization.o homogenization_RGC.o homogenization_isostrain.o crystallite.o CPFEM.o constitutive.o
CPFEM.o: CPFEM.f90 homogenization.o
$(PREFIX) $(COMPILERNAME) $(COMPILE) CPFEM.f90 $(SUFFIX)
@ -178,7 +261,7 @@ crystallite.o: crystallite.f90 constitutive.a
constitutive.a: constitutive.o
ar rc constitutive.a constitutive.o constitutive_titanmod.o constitutive_nonlocal.o constitutive_dislotwin.o constitutive_j2.o constitutive_phenopowerlaw.o basics.a advanced.a
$(ARCHIVE_COMMAND) rc constitutive.a constitutive.o constitutive_titanmod.o constitutive_nonlocal.o constitutive_dislotwin.o constitutive_j2.o constitutive_phenopowerlaw.o basics.a advanced.a
constitutive.o: constitutive.f90 constitutive_titanmod.o constitutive_nonlocal.o constitutive_dislotwin.o constitutive_j2.o constitutive_phenopowerlaw.o
$(PREFIX) $(COMPILERNAME) $(COMPILE) constitutive.f90 $(SUFFIX)
@ -201,7 +284,7 @@ constitutive_phenopowerlaw.o: constitutive_phenopowerlaw.f90 basics.a advanced.a
advanced.a: lattice.o
ar rc advanced.a FEsolving.o mesh.o material.o lattice.o
$(ARCHIVE_COMMAND) rc advanced.a FEsolving.o mesh.o material.o lattice.o
lattice.o: lattice.f90 material.o
$(PREFIX) $(COMPILERNAME) $(COMPILE) lattice.f90 $(SUFFIX)
@ -218,7 +301,7 @@ FEsolving.o: FEsolving.f90 basics.a
basics.a: math.o
ar rc basics.a math.o debug.o numerics.o IO.o DAMASK_spectral_interface.o prec.o
$(ARCHIVE_COMMAND) rc basics.a math.o debug.o numerics.o IO.o DAMASK_spectral_interface.o prec.o
math.o: math.f90 debug.o
$(PREFIX) $(COMPILERNAME) $(COMPILE) math.f90 $(SUFFIX)