adding new option OPTIMIZATION with values OFF, DEFENSIVE and AGGRESSIVE to makefile. Polishing of makefile and DAMASK_spectral.f90

This commit is contained in:
Martin Diehl 2011-08-03 07:54:32 +00:00
parent 64435b8a97
commit b5abd6f203
2 changed files with 42 additions and 33 deletions

View File

@ -520,10 +520,10 @@ if ((N_l + N_Fdot /= N_n).or.(N_n /= N_t)) & ! sanity check
temp33_Real = defgrad(i,j,k,:,:) temp33_Real = defgrad(i,j,k,:,:)
if (velGradApplied(loadcase)) & ! using velocity gradient to calculate new deformation gradient (if not guessing) if (velGradApplied(loadcase)) & ! using velocity gradient to calculate new deformation gradient (if not guessing)
deltaF = math_mul33x33(bc_deformation(:,:,loadcase),defgradold(i,j,k,:,:)) deltaF = math_mul33x33(bc_deformation(:,:,loadcase),defgradold(i,j,k,:,:))
defgrad(i,j,k,:,:) = defgrad(i,j,k,:,:) & ! decide if guessing along former trajectory or apply homogeneous addon (addon only for applied deformation) defgrad(i,j,k,:,:) = defgrad(i,j,k,:,:) & ! decide if guessing along former trajectory or apply homogeneous addon (addon only for applied deformation)
+ guessmode * (defgrad(i,j,k,:,:) - defgradold(i,j,k,:,:))& + guessmode * (defgrad(i,j,k,:,:) - defgradold(i,j,k,:,:))&
+ (1.0_pReal-guessmode) * mask_defgrad * deltaF *timeinc + (1.0_pReal-guessmode) * mask_defgrad * deltaF *timeinc
defgradold(i,j,k,:,:) = temp33_Real defgradold(i,j,k,:,:) = temp33_Real
enddo; enddo; enddo enddo; enddo; enddo
guessmode = 1.0_pReal ! keep guessing along former trajectory during same loadcase guessmode = 1.0_pReal ! keep guessing along former trajectory during same loadcase
@ -598,7 +598,7 @@ if ((N_l + N_Fdot /= N_n).or.(N_n /= N_t)) & ! sanity check
defgradAimCorr = - (1.0_pReal - mask_defgrad) & ! allow alteration of all non-fixed defgrad components defgradAimCorr = - (1.0_pReal - mask_defgrad) & ! allow alteration of all non-fixed defgrad components
* math_mul3333xx33(s0, (mask_stress*(pstress_av - bc_stress(:,:,loadcase)))) ! residual on given stress components * math_mul3333xx33(s0, (mask_stress*(pstress_av - bc_stress(:,:,loadcase)))) ! residual on given stress components
do m=1,3; do n =1,3 ! calculate damper (correction is far too strong) !ToDo: Check for better values do m=1,3; do n =1,3 ! calculate damper
if (defgradAimCorr(m,n) * defgradAimCorrPrev(m,n) < -relevantStrain ** 2.0_pReal) then ! insignificant within relevantstrain around zero if (defgradAimCorr(m,n) * defgradAimCorrPrev(m,n) < -relevantStrain ** 2.0_pReal) then ! insignificant within relevantstrain around zero
damper(m,n) = max(0.01_pReal,damper(m,n)*0.8) damper(m,n) = max(0.01_pReal,damper(m,n)*0.8)
else else
@ -853,7 +853,7 @@ if ((N_l + N_Fdot /= N_n).or.(N_n /= N_t)) & ! sanity check
!!!!!!!!!!!!!!!!!!!!!!!! end divergence debugging !!!!!!!!!!!!!!!!!!!!!!!! end divergence debugging
print '(2(a,E8.2))', ' error stress: ',err_stress, ' Tol. = ', err_stress_tol print '(2(a,E8.2))', ' error stress: ',err_stress, ' Tol. = ', err_stress_tol
print '(2(a,E8.2))', ' error deformation gradient: ',err_defgrad,' Tol. = ', err_defgrad_tol print '(2(a,E8.2))', ' error deformation gradient: ',err_defgrad,' Tol. = ', err_defgrad_tol
!ToDo: usefull .and. for err_div?
if((err_stress > err_stress_tol .or. err_defgrad > err_defgrad_tol) .and. err_div < err_div_tol) then ! change to calculation of BCs, reset damper etc. if((err_stress > err_stress_tol .or. err_defgrad > err_defgrad_tol) .and. err_div < err_div_tol) then ! change to calculation of BCs, reset damper etc.
calcmode = 0_pInt calcmode = 0_pInt
defgradAimCorr = 0.0_pReal defgradAimCorr = 0.0_pReal

View File

@ -17,52 +17,61 @@
# VERSION = 10 (12): version of Intel compiler. More aggressive optimization if VERSION =12 # VERSION = 10 (12): version of Intel compiler. More aggressive optimization if VERSION =12
# PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built # PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built
ifeq ($(F90), )
ifeq ($(F90), gfortran)
OPENMP_FLAG =-fopenmp
OPTIMIZATION_AGGRESSIVE =-O3
OPTIMIZATION_DEFENSIVE =-O2
COMPILE_OPTIONS =-xf95-cpp-input
HEAP_ARRAYS =
else
F90 =ifort F90 =ifort
endif
ifeq ($(OPTIMIZATION), )
OPTIMIZATION =DEFENSIVE
endif
MAXOPTI =$(OPTIMIZATION)
ifeq ($(F90), ifort)
ifeq ($(PORTABLE), FALSE) ifeq ($(PORTABLE), FALSE)
PORTABLE_SWITCH =-xHost PORTABLE_SWITCH =-xHost
endif endif
ifneq ($(VERSION), 12)
OPENMP_FLAG =-openmp ifeq ($(OPTIMIZATION), AGGRESSIVE)
HEAP_ARRAYS =-heap-arrays 500000000 MAXOPTI =DEFENSIVE
COMPILE_OPTIONS =-fpp -diag-disable 8291,8290 endif
#fpp: for preprocessor, diag-disable: switch off messages on formatting of output
OPTIMIZATION_AGGRESSIVE =-O3 -static $(PORTABLE_SWITCH)
ifeq ($(VERSION), 12)
OPTIMIZATION_DEFENSIVE =$(OPTIMIZATION_AGGRESIVE)
else
OPTIMIZATION_DEFENSIVE =-O2
endif endif
endif endif
OPENMP_FLAG_ifort =-openmp
OPENMP_FLAG_gfortran =-fopenmp
COMPILE =$(OPENMP_FLAG) $(COMPILE_OPTIONS) $(OPTIMIZATION_AGGRESSIVE) -c OPTIMIZATION_OFF_ifort =-O0
COMPILE_HEAP =$(COMPILE) $(HEAP_ARRAYS) OPTIMIZATION_OFF_gfortran =-O0
COMPILE_HEAP_DEFENSIVE =$(OPENMP_FLAG) $(COMPILE_OPTIONS) $(OPTIMIZATION_DEFENSIVE) -c $(HEAP_ARRAYS) OPTIMIZATION_DEFENSIVE_ifort =-O2
OPTIMIZATION_DEFENSIVE_gfortran =-O2
OPTIMIZATION_AGGRESSIVE_ifort =-O3 -static $(PORTABLE_SWITCH)
OPTIMIZATION_AGGRESSIVE_gfortran =-O3
COMPILE_OPTIONS_ifort =-fpp -diag-disable 8291,8290
COMPILE_OPTIONS_gfortran =-xf95-cpp-input
HEAP_ARRAYS_ifort =-heap-arrays 500000000
HEAP_ARRAYS_gfortran =
COMPILE =${OPENMP_FLAG_${F90}} ${COMPILE_OPTIONS_${F90}} ${OPTIMIZATION_${OPTIMIZATION}_${F90}} -c
COMPILE_HEAP =$(COMPILE) ${HEAP_ARRAYS_${F90}}
COMPILE_HEAP_MAXOPTI =${OPENMP_FLAG_${F90}} ${COMPILE_OPTIONS_${F90}} ${OPTIMIZATION_${MAXOPTI}_${F90}} ${HEAP_ARRAYS_${F90}} -c
ifeq ($(PRECISION),single) ifeq ($(PRECISION),single)
DAMASK_spectral_single.exe: DAMASK_spectral_single.o CPFEM.a DAMASK_spectral_single.exe: DAMASK_spectral_single.o CPFEM.a
$(F90) $(OPENMP_FLAG) -o DAMASK_spectral_single.exe DAMASK_spectral_single.o CPFEM.a include/libfftw3f_threads.a include/libfftw3f.a constitutive.a advanced.a basics.a -lpthread $(F90) ${OPENMP_FLAG_${F90}} -o DAMASK_spectral_single.exe DAMASK_spectral_single.o CPFEM.a include/libfftw3f_threads.a include/libfftw3f.a constitutive.a advanced.a basics.a -lpthread
DAMASK_spectral_single.o: DAMASK_spectral_single.f90 CPFEM.o DAMASK_spectral_single.o: DAMASK_spectral_single.f90 CPFEM.o
$(F90) $(COMPILE_HEAP_DEFENSIVE) DAMASK_spectral_single.f90 $(F90) $(COMPILE_HEAP_MAXOPTI) DAMASK_spectral_single.f90
else else
DAMASK_spectral.exe: DAMASK_spectral.o CPFEM.a DAMASK_spectral.exe: DAMASK_spectral.o CPFEM.a
$(F90) $(OPENMP_FLAG) -o DAMASK_spectral.exe DAMASK_spectral.o CPFEM.a include/libfftw3_threads.a include/libfftw3.a constitutive.a advanced.a basics.a -lpthread $(F90) ${OPENMP_FLAG_${F90}} -o DAMASK_spectral.exe DAMASK_spectral.o CPFEM.a include/libfftw3_threads.a include/libfftw3.a constitutive.a advanced.a basics.a -lpthread
DAMASK_spectral.o: DAMASK_spectral.f90 CPFEM.o DAMASK_spectral.o: DAMASK_spectral.f90 CPFEM.o
$(F90) $(COMPILE_HEAP_DEFENSIVE) DAMASK_spectral.f90 $(F90) $(COMPILE_HEAP_MAXOPTI) DAMASK_spectral.f90
endif endif
CPFEM.a: CPFEM.o CPFEM.a: CPFEM.o