corrected determination of restartRead from commandline (now done by FEsolving instead of DAMASK_spectral_interface)

recompiled fftw libraries with --enable-shared to make them work with f2py
added draft for compilation test of spectral solver
This commit is contained in:
Martin Diehl 2011-11-07 18:25:10 +00:00
parent a1adef07ef
commit de96e99bca
12 changed files with 45 additions and 1079 deletions

View File

@ -68,10 +68,11 @@ program DAMASK_spectral
integer(pInt), dimension (1 + maxNchunksLoadcase*2) :: posLoadcase integer(pInt), dimension (1 + maxNchunksLoadcase*2) :: posLoadcase
integer(pInt), parameter :: maxNchunksGeom = 7_pInt ! 4 identifiers, 3 values integer(pInt), parameter :: maxNchunksGeom = 7_pInt ! 4 identifiers, 3 values
integer(pInt), dimension (1 + maxNchunksGeom*2) :: posGeom integer(pInt), dimension (1 + maxNchunksGeom*2) :: posGeom
integer(pInt) :: myUnit, N_l, N_s, N_t, N_n, N_Fdot, headerLength ! numbers of identifiers integer(pInt) :: headerLength,N_l=0_pInt, N_t=0_pInt, N_n=0_pInt, N_Fdot=0_pInt
integer(pInt), parameter :: myUnit = 234_pInt
character(len=1024) :: path, line, keyword character(len=1024) :: path, line, keyword
logical :: gotResolution, gotDimension, gotHomogenization logical :: gotResolution =.false., gotDimension =.false., gotHomogenization = .false.
! variables storing information from loadcase file ! variables storing information from loadcase file
!ToDo: create Data Structure loadcase !ToDo: create Data Structure loadcase
real(pReal), dimension (:,:,:), allocatable :: bc_deformation, & ! applied velocity gradient or time derivative of deformation gradient real(pReal), dimension (:,:,:), allocatable :: bc_deformation, & ! applied velocity gradient or time derivative of deformation gradient
@ -91,22 +92,22 @@ program DAMASK_spectral
! variables storing information from geom file ! variables storing information from geom file
real(pReal) :: wgt real(pReal) :: wgt
real(pReal), dimension(3) :: geomdimension ! physical dimension of volume element in each direction real(pReal), dimension(3) :: geomdimension = 0.0_pReal ! physical dimension of volume element in each direction
integer(pInt) :: homog ! homogenization scheme used integer(pInt) :: homog ! homogenization scheme used
integer(pInt), dimension(3) :: resolution ! resolution (number of Fourier points) in each direction integer(pInt), dimension(3) :: resolution = 1_pInt ! resolution (number of Fourier points) in each direction
logical :: spectralPictureMode ! indicating 1 to 1 mapping of FP to microstructure logical :: spectralPictureMode = .false. ! indicating 1 to 1 mapping of FP to microstructure
! stress etc. ! stress, stiffness and compliance average etc.
real(pReal), dimension(3,3) :: pstress, pstress_av, defgrad_av, & real(pReal), dimension(3,3) :: pstress, pstress_av, defgrad_av, &
defgradAim, defgradAimOld, defgradAimCorr,& defgradAim = math_I3, defgradAimOld= math_I3, defgradAimCorr= math_I3,&
mask_stress, mask_defgrad, fDot, & mask_stress, mask_defgrad, fDot, &
pstress_av_load, defgradAim_lab ! quantities rotated to other coordinate system pstress_av_load, defgradAim_lab ! quantities rotated to other coordinate system
real(pReal), dimension(3,3,3,3) :: dPdF, c0_reference, c_current, s_prev, c_prev ! stiffness and compliance real(pReal), dimension(3,3,3,3) :: dPdF, c0_reference, c_current, s_prev, c_prev ! stiffness and compliance
real(pReal), dimension(6) :: cstress ! cauchy stress real(pReal), dimension(6) :: cstress ! cauchy stress
real(pReal), dimension(6,6) :: dsde ! small strain stiffness real(pReal), dimension(6,6) :: dsde ! small strain stiffness
real(pReal), dimension(9,9) :: s_prev99, c_prev99 ! compliance and stiffness in matrix notation real(pReal), dimension(9,9) :: s_prev99, c_prev99 ! compliance and stiffness in matrix notation
real(pReal), dimension(:,:), allocatable :: s_reduced, c_reduced ! reduced compliance and stiffness (only for stress BC) real(pReal), dimension(:,:), allocatable :: s_reduced, c_reduced ! reduced compliance and stiffness (only for stress BC)
integer(pInt) :: size_reduced ! number of stress BCs integer(pInt) :: size_reduced = 0.0_pReal ! number of stress BCs
! pointwise data ! pointwise data
real(pReal), dimension(:,:,:,:,:), allocatable :: workfft, defgrad, defgradold real(pReal), dimension(:,:,:,:,:), allocatable :: workfft, defgrad, defgradold
@ -150,15 +151,8 @@ program DAMASK_spectral
!$OMP END CRITICAL (write2out) !$OMP END CRITICAL (write2out)
! Reading the loadcase file and allocate variables ! Reading the loadcase file and allocate variables
myUnit = 234_pInt
path = getLoadcaseName() path = getLoadcaseName()
if (.not. IO_open_file(myUnit,path)) call IO_error(error_ID=30,ext_msg = trim(path)) if (.not. IO_open_file(myUnit,path)) call IO_error(error_ID=30,ext_msg = trim(path))
N_l = 0_pInt
N_Fdot = 0_pInt
N_t = 0_pInt
N_n = 0_pInt
rewind(myUnit) rewind(myUnit)
do do
read(myUnit,'(a1024)',END = 100) line read(myUnit,'(a1024)',END = 100) line
@ -261,17 +255,10 @@ program DAMASK_spectral
101 close(myUnit) 101 close(myUnit)
!read header of geom file to get the information needed before the complete geom file is intepretated by mesh.f90 !read header of geom file to get the information needed before the complete geom file is intepretated by mesh.f90
gotResolution =.false.
gotDimension =.false.
gotHomogenization = .false.
spectralPictureMode = .false.
resolution = 1_pInt
geomdimension = 0.0_pReal
path = getModelName() path = getModelName()
if (.not. IO_open_file(myUnit,trim(path)//InputFileExtension))& if (.not. IO_open_file(myUnit,trim(path)//InputFileExtension))&
call IO_error(error_ID=101,ext_msg = trim(path)//InputFileExtension) call IO_error(error_ID=101,ext_msg = trim(path)//InputFileExtension)
rewind(myUnit) rewind(myUnit)
read(myUnit,'(a1024)') line read(myUnit,'(a1024)') line
posGeom = IO_stringPos(line,2) posGeom = IO_stringPos(line,2)
@ -332,9 +319,6 @@ program DAMASK_spectral
allocate (xi (3,resolution(1)/2+1,resolution(2),resolution(3))); xi =0.0_pReal allocate (xi (3,resolution(1)/2+1,resolution(2),resolution(3))); xi =0.0_pReal
wgt = 1.0_pReal/real(resolution(1)*resolution(2)*resolution(3), pReal) wgt = 1.0_pReal/real(resolution(1)*resolution(2)*resolution(3), pReal)
defgradAim = math_I3
defgradAimOld = math_I3
defgrad_av = math_I3
! Initialization of CPFEM_general (= constitutive law) and of deformation gradient field ! Initialization of CPFEM_general (= constitutive law) and of deformation gradient field
call CPFEM_initAll(bc_temperature(1),1_pInt,1_pInt) call CPFEM_initAll(bc_temperature(1),1_pInt,1_pInt)

View File

@ -27,9 +27,7 @@ MODULE DAMASK_interface
character(len=64), parameter :: FEsolver = 'Spectral' character(len=64), parameter :: FEsolver = 'Spectral'
character(len=5), parameter :: InputFileExtension = '.geom' character(len=5), parameter :: InputFileExtension = '.geom'
character(len=4), parameter :: LogFileExtension = '.log' !until now, we don't have a log file. But IO.f90 requires it character(len=4), parameter :: LogFileExtension = '.log' !until now, we don't have a log file. But IO.f90 requires it
logical :: restartReadFlag
character(len=1024) :: geometryParameter,loadcaseParameter character(len=1024) :: geometryParameter,loadcaseParameter
integer(pInt) :: restartReadStep
CONTAINS CONTAINS
!******************************************************************** !********************************************************************
@ -41,11 +39,7 @@ subroutine DAMASK_interface_init()
implicit none implicit none
character(len=1024) commandLine character(len=1024) commandLine
integer(pInt):: i, start, length integer(pInt):: i, start = 0_pInt, length=0_pInt
start = 0_pInt
length= 0_pInt
restartReadFlag = .false.
call get_command(commandLine) call get_command(commandLine)
@ -66,7 +60,6 @@ subroutine DAMASK_interface_init()
geometryParameter = '' ! should be empty geometryParameter = '' ! should be empty
geometryParameter(1:length)=commandLine(start:start+length) geometryParameter(1:length)=commandLine(start:start+length)
call get_command(commandLine)
do i=1,len(commandLine) ! remove capitals do i=1,len(commandLine) ! remove capitals
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32) if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
enddo enddo
@ -84,25 +77,7 @@ subroutine DAMASK_interface_init()
call get_command(commandLine) ! may contain capitals call get_command(commandLine) ! may contain capitals
loadcaseParameter = '' ! should be empty loadcaseParameter = '' ! should be empty
loadcaseParameter(1:length)=commandLine(start:start+length) loadcaseParameter(1:length)=commandLine(start:start+length)
do i=1,len(commandLine) ! remove capitals
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
enddo
start = index(commandLine,'-r',.true.) + 3_pInt ! search for '-r' and jump forward to given name
if (index(commandLine,'--restart',.true.)>0) then ! if '--restart' is found, use that (contains '-r')
start = index(commandLine,'--restart',.true.) + 10_pInt
endif
length = index(commandLine(start:len(commandLine)),' ',.false.)
restartReadStep = 0_pInt
if(start/=3_pInt) then ! found -r
read(commandLine(start:start+length),'(I12)') restartReadStep
restartReadFlag = .true.
endif
if(restartReadStep<1_pInt .and. RestartReadFlag .eq. .true.) stop 'Invalid Restart Parameter, terminating DAMASK' ! Functions from IO.f90 are not available
!$OMP CRITICAL (write2out) !$OMP CRITICAL (write2out)
write(6,*) write(6,*)
write(6,*) '<<<+- DAMASK_spectral_interface init -+>>>' write(6,*) '<<<+- DAMASK_spectral_interface init -+>>>'
@ -110,11 +85,6 @@ subroutine DAMASK_interface_init()
write(6,*) write(6,*)
write(6,*) 'Geometry Parameter: ', trim(geometryParameter) write(6,*) 'Geometry Parameter: ', trim(geometryParameter)
write(6,*) 'Loadcase Parameter: ', trim(loadcaseParameter) write(6,*) 'Loadcase Parameter: ', trim(loadcaseParameter)
if (restartReadFlag) then
write(6,*) 'Restart Read: ', restartReadFlag
else
write(6,'(a,I5)') ' Restart Read at Step: ', restartReadStep
endif
write(6,*) write(6,*)
!$OMP END CRITICAL (write2out) !$OMP END CRITICAL (write2out)

View File

@ -25,7 +25,7 @@
use prec, only: pInt,pReal use prec, only: pInt,pReal
implicit none implicit none
integer(pInt) :: cycleCounter = 0_pInt, theInc = -1_pInt integer(pInt) :: cycleCounter = 0_pInt, theInc = -1_pInt, restartReadStep = 0_pInt
real(pReal) :: theTime = 0.0_pReal, theDelta = 0.0_pReal real(pReal) :: theTime = 0.0_pReal, theDelta = 0.0_pReal
logical :: lastIncConverged = .false.,outdatedByNewInc = .false.,outdatedFFN1 = .false.,terminallyIll = .false. logical :: lastIncConverged = .false.,outdatedByNewInc = .false.,outdatedFFN1 = .false.,terminallyIll = .false.
logical :: symmetricSolver = .false. logical :: symmetricSolver = .false.
@ -54,16 +54,29 @@
integer(pInt), parameter :: fileunit = 222 integer(pInt), parameter :: fileunit = 222
integer(pInt), parameter :: maxNchunks = 6 integer(pInt), parameter :: maxNchunks = 6
integer(pInt) i integer(pInt):: i, start = 0_pInt, length=0_pInt
integer(pInt), dimension(1+2*maxNchunks) :: positions integer(pInt), dimension(1+2*maxNchunks) :: positions
character(len=64) tag character(len=64) tag
character(len=1024) line character(len=1024) line, commandLine
FEmodelGeometry = getModelName() FEmodelGeometry = getModelName()
if (IO_open_inputFile(fileunit,FEmodelGeometry)) then if (IO_open_inputFile(fileunit,FEmodelGeometry)) then
if(trim(FEsolver)=='Spectral') then if(trim(FEsolver)=='Spectral') then
restartWrite = .true. restartWrite = .true.
restartRead = restartReadFlag call get_command(commandLine) ! may contain capitals
do i=1,len(commandLine) ! remove capitals
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
enddo
start = index(commandLine,'-r',.true.) + 3_pInt ! search for '-r' and jump forward to given name
if (index(commandLine,'--restart',.true.)>0) then ! if '--restart' is found, use that (contains '-r')
start = index(commandLine,'--restart',.true.) + 10_pInt
endif
length = index(commandLine(start:len(commandLine)),' ',.false.)
if(start/=3_pInt) then ! found at least -r
read(commandLine(start:start+length),'(I12)') restartReadStep
restartRead = .true.
endif
if(restartReadStep<0_pInt .and. restartRead .eq. .true.) call IO_error(error_ID=47)
else else
rewind(fileunit) rewind(fileunit)
do do

View File

@ -1166,6 +1166,8 @@ endfunction
msg = 'incomplete information in spectral mesh header' msg = 'incomplete information in spectral mesh header'
case (46) case (46)
msg = 'not a rotation defined for loadcase rotation' msg = 'not a rotation defined for loadcase rotation'
case (47)
msg = 'invalid restart increment given'
case (50) case (50)
msg = 'writing constitutive output description' msg = 'writing constitutive output description'
case (100) case (100)

View File

@ -6,8 +6,8 @@
# Uses OpenMP to parallelise the material subroutines (set number of cores with "export DAMASK_NUM_THREADS=n" to n) # Uses OpenMP to parallelise the material subroutines (set number of cores with "export DAMASK_NUM_THREADS=n" to n)
# Uses linux threads to parallelise fftw3 # Uses linux threads to parallelise fftw3
# Besides of the f90 files written at MPIE, the two library files of fftw3 "libfftw3_threads.a" "libfftw3.a" are also needed # Besides of the f90 files written at MPIE, the two library files of fftw3 "libfftw3_threads.a" "libfftw3.a" are also needed
# Install fftw3 (v3.3 is tested) with "./configure --enable-threads --enable-sse2" and "make"; "make install" is not needed # Install fftw3 (v3.3 is tested) with "./configure --enable-threads --enable-sse2 --enable-shared" and "make"; "make install" is not needed
# as long as the two library files "libfftw3_threads.a" "libfftw3.a" are copied to the code/include directory. # as long as the two library files "libfftw3_threads.a" "libfftw3.a" are copied to the /../lib directory.
# Need the AMD Core Math Library to be installed (v 4.4 is tested) # Need the AMD Core Math Library to be installed (v 4.4 is tested)
######################################################################################## ########################################################################################
# OPTIONS = standard (alternative): meaning # OPTIONS = standard (alternative): meaning

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,7 @@
# for the generation of the pyf file: # for the generation of the pyf file:
# f2py -m postprocessingMath -h postprocessingMath.pyf --overwrite-signature postprocessingMath.f90 # f2py -m postprocessingMath -h postprocessingMath.pyf --overwrite-signature postprocessingMath.f90
# --f90flags="-heap-arrays 500000000" prevents segmentation fault for large arrays # use ./configure --enable-sse2 --enable-shared for the compilation of fftw3.3
# use ./configure --enable-portable-binary --enable-shared for the compilation of fftw3.2.2
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
wd='.' wd='.'
@ -20,10 +19,10 @@ else
fi fi
cd $wd cd $wd
rm postprocessingMath.so rm ../../lib/postprocessingMath.so
f2py -c \ f2py -c \
postprocessingMath.pyf \ postprocessingMath.pyf \
postprocessingMath.f90 \ postprocessingMath.f90 \
-lfftw3 \ ../../lib/libfftw3.a \
-L./ -L./
#--f90flags="-heap-arrays 500000000" mv postprocessingMath.so ../../lib/.