From ddb292e3602c84c1192df37776c443409c6167d8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 29 Jun 2016 23:27:22 +0200 Subject: [PATCH 001/139] some simplifications --- code/crystallite.f90 | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/code/crystallite.f90 b/code/crystallite.f90 index 450da5685..2fc5b4083 100644 --- a/code/crystallite.f90 +++ b/code/crystallite.f90 @@ -145,7 +145,6 @@ subroutine crystallite_init debug_crystallite, & debug_levelBasic use numerics, only: & - worldrank, & usePingPong use math, only: & math_I3, & @@ -203,11 +202,9 @@ subroutine crystallite_init tag = '', & line= '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- crystallite init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- crystallite init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess cMax = homogenization_maxNgrains iMax = mesh_maxNips @@ -3578,9 +3575,8 @@ logical function crystallite_integrateStress(& #ifndef _OPENMP if (iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0_pInt & .and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) & - .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then + .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) & write(6,'(a,i8,1x,i2,1x,i3)') '<< CRYST >> integrateStress at el ip ipc ',el,ip,ipc - endif #endif @@ -3686,9 +3682,8 @@ logical function crystallite_integrateStress(& !* calculate plastic velocity gradient and its tangent from constitutive law - if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then + if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) & call system_clock(count=tick,count_rate=tickrate,count_max=maxticks) - endif call constitutive_LpAndItsTangent(Lp_constitutive, dLp_dT3333, dLp_dFi3333, & Tstar_v, Fi_new, ipc, ip, el) @@ -3785,12 +3780,11 @@ logical function crystallite_integrateStress(& enddo LpLoop - if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then + if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) & !$OMP CRITICAL (distributionStress) debug_StressLoopLpDistribution(NiterationStressLp,numerics_integrationMode) = & debug_StressLoopLpDistribution(NiterationStressLp,numerics_integrationMode) + 1_pInt !$OMP END CRITICAL (distributionStress) - endif !* calculate intermediate velocity gradient and its tangent from constitutive law @@ -3872,12 +3866,11 @@ logical function crystallite_integrateStress(& Liguess = Liguess + steplengthLi * deltaLi enddo LiLoop - if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then + if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) & !$OMP CRITICAL (distributionStress) debug_StressLoopLiDistribution(NiterationStressLi,numerics_integrationMode) = & debug_StressLoopLiDistribution(NiterationStressLi,numerics_integrationMode) + 1_pInt !$OMP END CRITICAL (distributionStress) - endif !* calculate new plastic and elastic deformation gradient From e97f3a788d0bc42f5579f8fdbcef6677a6684eae Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 30 Jun 2016 10:30:40 +0200 Subject: [PATCH 002/139] added special function for often used comparison to 0 --- code/prec.f90 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/code/prec.f90 b/code/prec.f90 index bf9ac7124..1ab87e6ac 100644 --- a/code/prec.f90 +++ b/code/prec.f90 @@ -199,6 +199,39 @@ logical elemental pure function dNeq(a,b,tol) dNeq = merge(.False., .True.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) end function dNeq + +!-------------------------------------------------------------------------------------------------- +!> @brief equality to 0comparison for float with double precision +! replaces "==0" but for certain (relative) tolerance. Counterpart to dNeq0 +! http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm +!-------------------------------------------------------------------------------------------------- +logical elemental pure function dEq0(a,tol) + + implicit none + real(pReal), intent(in) :: a + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + dEq0 = merge(.True., .False.,abs(a) <= merge(tol,eps,present(tol))*abs(a)) +end function dEq0 + + +!-------------------------------------------------------------------------------------------------- +!> @brief inequality comparison to 0 for float with double precision +! replaces "!=0" but for certain (relative) tolerance. Counterpart to dEq0 +! http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm +!-------------------------------------------------------------------------------------------------- +logical elemental pure function dNeq0(a,tol) + + implicit none + real(pReal), intent(in) :: a + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + dNeq0 = merge(.False., .True.,abs(a) <= merge(tol,eps,present(tol))*abs(a)) +end function dNeq0 + + !-------------------------------------------------------------------------------------------------- !> @brief equality comparison for complex with double precision ! replaces "==" but for certain (relative) tolerance. Counterpart to cNeq From ffcc9300c57e1ec2919db4effbd7bc985e65ef59 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 30 Jun 2016 11:11:35 +0200 Subject: [PATCH 003/139] using norm2 function and newly introduced dNeq0/dEq0 --- code/math.f90 | 36 ++++++++++++++++++------------------ code/prec.f90 | 2 ++ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/code/math.f90 b/code/math.f90 index 12803ba3d..9876fe701 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -724,7 +724,7 @@ end function math_transpose33 !-------------------------------------------------------------------------------------------------- pure function math_inv33(A) use prec, only: & - dNeq + dNeq0 implicit none real(pReal),dimension(3,3),intent(in) :: A @@ -737,7 +737,7 @@ pure function math_inv33(A) DetA = A(1,1) * math_inv33(1,1) + A(1,2) * math_inv33(2,1) + A(1,3) * math_inv33(3,1) - if (dNeq(DetA,0.0_pReal)) then + if (dNeq0(DetA)) then math_inv33(1,2) = -A(1,2) * A(3,3) + A(1,3) * A(3,2) math_inv33(2,2) = A(1,1) * A(3,3) - A(1,3) * A(3,1) math_inv33(3,2) = -A(1,1) * A(3,2) + A(1,2) * A(3,1) @@ -762,7 +762,7 @@ end function math_inv33 !-------------------------------------------------------------------------------------------------- pure subroutine math_invert33(A, InvA, DetA, error) use prec, only: & - dEq + dEq0 implicit none logical, intent(out) :: error @@ -776,7 +776,7 @@ pure subroutine math_invert33(A, InvA, DetA, error) DetA = A(1,1) * InvA(1,1) + A(1,2) * InvA(2,1) + A(1,3) * InvA(3,1) - if (dEq(DetA,0.0_pReal)) then + if (dEq0(DetA)) then InvA = 0.0_pReal error = .true. else @@ -1100,7 +1100,7 @@ pure function math_Plain99to3333(m99) integer(pInt) :: i,j forall (i=1_pInt:9_pInt,j=1_pInt:9_pInt) math_Plain99to3333(mapPlain(1,i),mapPlain(2,i),& - mapPlain(1,j),mapPlain(2,j)) = m99(i,j) + mapPlain(1,j),mapPlain(2,j)) = m99(i,j) end function math_Plain99to3333 @@ -1212,10 +1212,10 @@ function math_qRand() real(pReal), dimension(3) :: rnd call halton(3_pInt,rnd) - math_qRand(1) = cos(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)) - math_qRand(2) = sin(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)) - math_qRand(3) = cos(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)) - math_qRand(4) = sin(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)) + math_qRand = [cos(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)), + sin(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), + cos(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), + sin(2.0_pReal*PI*rnd(1))*sqrt(rnd(3))] end function math_qRand @@ -1282,7 +1282,7 @@ end function math_qNorm !-------------------------------------------------------------------------------------------------- pure function math_qInv(Q) use prec, only: & - dNeq + dNeq0 implicit none real(pReal), dimension(4), intent(in) :: Q @@ -1292,7 +1292,7 @@ pure function math_qInv(Q) math_qInv = 0.0_pReal squareNorm = math_qDot(Q,Q) - if (dNeq(squareNorm,0.0_pReal)) math_qInv = math_qConj(Q) / squareNorm + if (dNeq0(squareNorm)) math_qInv = math_qConj(Q) / squareNorm end function math_qInv @@ -1493,7 +1493,7 @@ pure function math_axisAngleToR(axis,omega) real(pReal), dimension(3) :: axisNrm real(pReal) :: norm,s,c,c1 - norm = sqrt(math_mul3x3(axis,axis)) + norm = norm2(axis) if (norm > 1.0e-8_pReal) then ! non-zero rotation axisNrm = axis/norm ! normalize axis to be sure @@ -1599,7 +1599,7 @@ pure function math_qToR(q) S = reshape( [0.0_pReal, -q(4), q(3), & q(4), 0.0_pReal, -q(2), & - -q(3), q(2), 0.0_pReal],[3,3]) ! notation is transposed + -q(3), q(2), 0.0_pReal],[3,3]) ! notation is transposed math_qToR = (2.0_pReal * q(1)*q(1) - 1.0_pReal) * math_I3 & + 2.0_pReal * T - 2.0_pReal * q(1) * S @@ -1623,17 +1623,17 @@ pure function math_qToEuler(qPassive) q = math_qConj(qPassive) ! convert to active rotation, since formulas are defined for active rotations - math_qToEuler(2) = acos(1.0_pReal-2.0_pReal*(q(2)*q(2)+q(3)*q(3))) + math_qToEuler(2) = acos(1.0_pReal-2.0_pReal*(q(2)**2+q(3)**2)) if (abs(math_qToEuler(2)) < 1.0e-6_pReal) then math_qToEuler(1) = sign(2.0_pReal*acos(math_limit(q(1),-1.0_pReal, 1.0_pReal)),q(4)) math_qToEuler(3) = 0.0_pReal else - math_qToEuler(1) = atan2(q(1)*q(3)+q(2)*q(4), q(1)*q(2)-q(3)*q(4)) + math_qToEuler(1) = atan2(+q(1)*q(3)+q(2)*q(4), q(1)*q(2)-q(3)*q(4)) math_qToEuler(3) = atan2(-q(1)*q(3)+q(2)*q(4), q(1)*q(2)+q(3)*q(4)) endif - math_qToEuler = merge(math_qToEuler + [2.0_pReal*PI, PI, 2.0_pReal*PI], & ! ensure correct range + math_qToEuler = merge(math_qToEuler + [2.0_pReal*PI, PI, 2.0_pReal*PI], & ! ensure correct range math_qToEuler, math_qToEuler<0.0_pReal) end function math_qToEuler @@ -2097,7 +2097,7 @@ end function math_eigenvectorBasisSym33 !-------------------------------------------------------------------------------------------------- function math_rotationalPart33(m) use prec, only: & - dEq + dEq0 use IO, only: & IO_warning @@ -2109,7 +2109,7 @@ function math_rotationalPart33(m) U = math_eigenvectorBasisSym33(math_mul33x33(transpose(m),m)) Uinv = math_inv33(U) - inversionFailed: if (all(dEq(Uinv,0.0_pReal))) then + inversionFailed: if (all(dEq0(Uinv))) then math_rotationalPart33 = math_I3 call IO_warning(650_pInt) else inversionFailed diff --git a/code/prec.f90 b/code/prec.f90 index 1ab87e6ac..0ded23528 100644 --- a/code/prec.f90 +++ b/code/prec.f90 @@ -115,8 +115,10 @@ module prec prec_init, & prec_isNaN, & dEq, & + dEq0, & cEq, & dNeq, & + dNeq0, & cNeq contains From 963e058140288eb6c2abb6b52429e5e6aa1a06fb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 5 Jul 2016 17:02:07 +0200 Subject: [PATCH 004/139] came back due to line ending conflict, not used --- DAMASK_env.bat | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 DAMASK_env.bat diff --git a/DAMASK_env.bat b/DAMASK_env.bat deleted file mode 100644 index 751237800..000000000 --- a/DAMASK_env.bat +++ /dev/null @@ -1,19 +0,0 @@ -:: sets up an environment for DAMASK on Windows -:: usage: call DAMASK_env.bat -@echo off -set LOCATION=%~dp0 -set DAMASK_ROOT=%LOCATION%\DAMASK -set DAMASK_NUM_THREADS=2 -chcp 1252 -Title Düsseldorf Advanced Materials Simulation Kit - DAMASK, MPIE Düsseldorf -echo. -echo Düsseldorf Advanced Materials Simulation Kit - DAMASK -echo Max-Planck-Institut für Eisenforschung, Düsseldorf -echo http://damask.mpie.de -echo. -echo Preparing environment ... -echo DAMASK_ROOT=%DAMASK_ROOT% -echo DAMASK_NUM_THREADS=%DAMASK_NUM_THREADS% -set DAMASK_BIN=%DAMASK_ROOT%\bin -set PATH=%PATH%;%DAMASK_BIN% -set PYTHONPATH=%PYTHONPATH%;%DAMASK_ROOT%\lib From e5abb08acd981c71bf7b22b4d67a38b194a24761 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 5 Jul 2016 17:05:10 +0200 Subject: [PATCH 005/139] not needed anymore --- configure | 138 ------------------------------------------------------ 1 file changed, 138 deletions(-) delete mode 100755 configure diff --git a/configure b/configure deleted file mode 100755 index 4841dcf1a..000000000 --- a/configure +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -import os,re,sys,string,subprocess,shutil - -from optparse import OptionParser, Option - -# ----------------------------- -class extendableOption(Option): -# ----------------------------- -# used for definition of new option parser action 'extend', which enables to take multiple option arguments -# taken from online tutorial http://docs.python.org/library/optparse.html - - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, value, values, parser) - - -######################################################## -# MAIN -######################################################## - -parser = OptionParser(option_class=extendableOption, usage='%prog options', description = """ -Configures the compilation and installation of DAMASK - -""") -defaults={'DAMASK_BIN':'depending on access rights', - 'FFTW_ROOT':'/usr', - 'MSC_ROOT' :'/msc', - 'DAMASK_NUM_THREADS':4, - 'MARC_VERSION':'2015', - 'spectralOptions':{}, - } - -#--- if local config file exists, read, otherwise assume global config file ------------------------ -configFile = os.path.join(os.getenv('HOME'),'.damask/damask.conf') \ - if os.path.isfile(os.path.join(os.getenv('HOME'),'.damask/damask.conf')) \ - else '/etc/damask.conf' - -#--- set default values according to read in values ------------------------------------------------ -try: - with open(configFile,'r') as f: - print('\n<<<<< reading default values from %s\n'%configFile) - for line in f: - line = line.strip() - if line.startswith('#') or line == '': - pass - - [key,value] = (re.split('[= ]',line)+[None,None])[:2] - - if key == 'DAMASK_NUM_THREADS': - defaults['DAMASK_NUM_THREADS'] = int(value) - if key == 'DAMASK_BIN': - defaults['DAMASK_BIN'] = value -except IOError: - pass - -parser.add_option('--prefix', dest='prefix', metavar='string', - help='location of (links to) DAMASK executables [%default]') -parser.add_option('--with-OMP-threads','--with-omp-threads', - dest='threads', type='int', metavar='int', - help='number of openMP threads [%default]') -parser.add_option('--with-spectral-options', dest='spectraloptions', action='extend', metavar='', - help='options for compilation of spectral solver') - -parser.set_defaults(prefix = defaults['DAMASK_BIN']) -parser.set_defaults(mscRoot = defaults['MSC_ROOT']) -parser.set_defaults(marcVersion = defaults['MARC_VERSION']) -parser.set_defaults(threads = defaults['DAMASK_NUM_THREADS']) -parser.set_defaults(spectraloptions = []) - -(options,filenames) = parser.parse_args() - - -#--- read config file if present to keep comments and order --------------------------------------- -output = [] -try: - with open(configFile,'r') as f: - for line in f: - line = line.strip() - items = re.split('[= ]',line) - - if (not line or items[0].startswith('#')): - pass - if items[0] == 'DAMASK_BIN': - line = '%s=%s'%(items[0],options.prefix) - options.prefix ='depending on access rights' - if items[0] == 'MSC_ROOT': - line = '%s=%s'%(items[0],options.mscRoot) - options.mscRoot ='' - if items[0] == 'MARC_VERSION': - line = '%s=%s'%(items[0],options.marcVersion) - options.marcVersion ='' - if items[0] == 'DAMASK_NUM_THREADS': - line = '%s=%s'%(items[0],options.threads) - options.threads ='' - for spectralOption in options.spectraloptions: - [key,value] = re.split('[= ]',spectralOption)[0:2] - if key == items[0]: - line = '%s=%s'%(items[0],value) - options.spectraloptions.remove(spectralOption) - output.append(line) -except IOError: - pass - -#--- write remaining options -------------------------------------------------------------------------- -for opt, value in options.__dict__.items(): - if opt == 'prefix' and value != 'depending on access rights': - output.append('DAMASK_BIN=%s'%value) - if opt == 'mscRoot' and value != '': - output.append('MSC_ROOT=%s'%value) - if opt == 'marcVersion' and value != '': - output.append('MARC_VERSION=%s'%value) - if opt == 'threads' and value != '': - output.append('DAMASK_NUM_THREADS=%s'%value) - -for spectralOption in options.spectraloptions: - output.append(spectralOption) - -#--- decide where do save the data ------------------------------------------------------------------- -configDir = '/etc' if os.access('/etc/', os.W_OK) \ - else os.path.join(os.getenv('HOME'),'.damask') # use system-wide config if possible -configFileNew = os.path.join(configDir,'damask.conf') - -if not os.path.isdir(configDir): - os.mkdir(configDir) - -print('\n>>>>> writing values to %s\n'%configFileNew) -with open(configFileNew,'w') as f: - for line in output: - print(line) - f.write(line+'\n') From bc8ecc5437a3185af7f03a6a6859f577bd98932c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 8 Jul 2016 22:12:02 +0200 Subject: [PATCH 006/139] polishing --- code/math.f90 | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/code/math.f90 b/code/math.f90 index 5cdef7d54..8273b1820 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -193,11 +193,9 @@ subroutine math_init ! comment the first random_seed call out, set randSize to 1, and use ifort character(len=64) :: error_msg - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- math init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- math init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess call random_seed(size=randSize) if (allocated(randInit)) deallocate(randInit) @@ -216,13 +214,11 @@ subroutine math_init call random_number(randTest(i)) enddo - mainProcess2: if (worldrank == 0) then - write(6,*) 'size of random seed: ', randSize - do i =1, randSize - write(6,*) 'value of random seed: ', i, randInit(i) - enddo - write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest - endif mainProcess2 + write(6,'(a,I)') 'size of random seed: ', randSize + do i =1, randSize + write(6,'(a,I,I)') 'value of random seed: ', i, randInit(i) + enddo + write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest call random_seed(put = randInit) From 091b72c3ff21f78c814b73c84383257724db73c2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 13 Jul 2016 16:25:27 +0200 Subject: [PATCH 007/139] commenting --- code/Makefile | 2 +- code/material.f90 | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/Makefile b/code/Makefile index a0f419ce0..7e5a130b1 100644 --- a/code/Makefile +++ b/code/Makefile @@ -7,7 +7,7 @@ SHELL = /bin/sh # OPTIONS = standard (alternative): meaning #------------------------------------------------------------- # F90 = ifort (gfortran): compiler type, choose Intel or GNU -# FCOMPILERNAME = name of the compiler executable (if not the same as the ype), e.g. using mpich-g90 instead of ifort +# FCOMPILERNAME = name of the compiler executable (if not the same as the type), e.g. using mpich-g90 instead of ifort # PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built. # OPTIMIZATION = DEFENSIVE (OFF,AGGRESSIVE,ULTRA): Optimization mode: O2, O0, O3 + further options for most files, O3 + further options for all files # OPENMP = TRUE (FALSE): OpenMP multiprocessor support diff --git a/code/material.f90 b/code/material.f90 index 37d5741dd..e1a48bc1c 100644 --- a/code/material.f90 +++ b/code/material.f90 @@ -499,12 +499,12 @@ subroutine material_init() allocate(HomogenizationPosition(material_Nhomogenization),source=0_pInt) allocate(CrystallitePosition (material_Nphase), source=0_pInt) - ElemLoop:do e = 1_pInt,mesh_NcpElems ! loop over elements + ElemLoop:do e = 1_pInt,mesh_NcpElems myHomog = mesh_element(3,e) - IPloop:do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) ! loop over IPs + IPloop:do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) HomogenizationPosition(myHomog) = HomogenizationPosition(myHomog) + 1_pInt mappingHomogenization(1:2,i,e) = [HomogenizationPosition(myHomog),myHomog] - GrainLoop:do g = 1_pInt,homogenization_Ngrains(mesh_element(3,e)) ! loop over grains + GrainLoop:do g = 1_pInt,homogenization_Ngrains(mesh_element(3,e)) phase = material_phase(g,i,e) ConstitutivePosition(phase) = ConstitutivePosition(phase)+1_pInt ! not distinguishing between instances of same phase phaseAt(g,i,e) = phase @@ -1344,10 +1344,10 @@ subroutine material_populateGrains write(6,'(a32,1x,a32,1x,a6)') 'homogenization_name','microstructure_name','grain#' !$OMP END CRITICAL (write2out) endif - do homog = 1_pInt,material_Nhomogenization ! loop over homogenizations + homogenizationLoop: do homog = 1_pInt,material_Nhomogenization dGrains = homogenization_Ngrains(homog) ! grain number per material point - do micro = 1_pInt,material_Nmicrostructure ! all pairs of homog and micro - if (Ngrains(homog,micro) > 0_pInt) then ! an active pair of homog and micro + microstructureLoop: do micro = 1_pInt,material_Nmicrostructure ! all pairs of homog and micro + activePair: if (Ngrains(homog,micro) > 0_pInt) then myNgrains = Ngrains(homog,micro) ! assign short name for total number of grains to populate myNconstituents = microstructure_Nconstituents(micro) ! assign short name for number of constituents if (iand(myDebug,debug_levelBasic) /= 0_pInt) then @@ -1578,9 +1578,9 @@ subroutine material_populateGrains enddo enddo - endif ! active homog,micro pair - enddo - enddo + endif activePair + enddo microstructureLoop + enddo homogenizationLoop deallocate(volumeOfGrain) deallocate(phaseOfGrain) From 0fbb56a6ef013fe62cfc2a779155c677b4bc8cb5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 13 Jul 2016 22:31:38 +0200 Subject: [PATCH 008/139] python env reads from $DAMASK_ROOT/CONFIG --- CONFIG | 8 ++++++++ lib/damask/environment.py | 10 +++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 CONFIG diff --git a/CONFIG b/CONFIG new file mode 100644 index 000000000..e3955baca --- /dev/null +++ b/CONFIG @@ -0,0 +1,8 @@ +MSC_ROOT=/opt/MSC +MARC_VERSION=2015 + +DAMASK_NUM_THREADS=4 + +ABAQUS_VERSION=6.14-5 +#Set DAMASK_BIN if not $DAMASK_ROOT/bin +#DAMASK_BIN diff --git a/lib/damask/environment.py b/lib/damask/environment.py index 8ceb093dd..d9c59a22d 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -21,14 +21,10 @@ class Environment(): return os.path.normpath(os.path.join(os.path.realpath(__file__),'../../../')) def get_options(self): - if os.path.isfile(os.path.join(os.getenv('HOME'),'.damask/damask.conf')): - configFile = os.path.join(os.getenv('HOME'),'.damask/damask.conf') - else: - configFile = '/etc/damask.conf' - with open(self.relPath(configFile)) as file: - for line in file: + with open(self.relPath(self.rootDir()+'/CONFIG')) as configFile: + for line in configFile: l = line.strip() - if not (l.startswith('#') or l == ''): + if l and not l.startswith('#'): items = l.split('=') + ['',''] if items[1] != '': # nothing specified self.options[items[0].upper()] = items[1] From 83e1970f71ad31d336285206136999d07d0d4848 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 12:24:55 +0200 Subject: [PATCH 009/139] now working with tcsh --- CONFIG | 10 ++++++---- lib/damask/environment.py | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CONFIG b/CONFIG index e3955baca..3a28c2b96 100644 --- a/CONFIG +++ b/CONFIG @@ -1,8 +1,10 @@ -MSC_ROOT=/opt/MSC -MARC_VERSION=2015 +# "set syntax" needed only for tcsh (but works with bash etc) -DAMASK_NUM_THREADS=4 +set MSC_ROOT=/opt/MSC +set MARC_VERSION=2015 -ABAQUS_VERSION=6.14-5 +set DAMASK_NUM_THREADS=4 + +set ABAQUS_VERSION=6.14-5 #Set DAMASK_BIN if not $DAMASK_ROOT/bin #DAMASK_BIN diff --git a/lib/damask/environment.py b/lib/damask/environment.py index d9c59a22d..b0256e05d 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -1,7 +1,7 @@ # -*- coding: UTF-8 no BOM -*- -import os,subprocess,shlex +import os,subprocess,shlex,re class Environment(): __slots__ = [ \ @@ -23,10 +23,10 @@ class Environment(): def get_options(self): with open(self.relPath(self.rootDir()+'/CONFIG')) as configFile: for line in configFile: - l = line.strip() + l = re.sub('^set ', '', line).strip() if l and not l.startswith('#'): - items = l.split('=') + ['',''] - if items[1] != '': # nothing specified + items = l.split('=') + if len(items) == 2: self.options[items[0].upper()] = items[1] def isAvailable(self,software,Nneeded =-1): From 72d60039c1e61cd376a8ea0abdd81e94eccf5e36 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 13:46:08 +0200 Subject: [PATCH 010/139] general improvements and adoptions to be compatible with csh --- CONFIG | 7 +++---- DAMASK_env.sh | 20 +++++++++++++++----- DAMASK_env.zsh | 27 +++++++++++++++++++-------- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/CONFIG b/CONFIG index 3a28c2b96..17561c9cd 100644 --- a/CONFIG +++ b/CONFIG @@ -1,10 +1,9 @@ -# "set syntax" needed only for tcsh (but works with bash etc) +# "set"-syntax needed only for tcsh (but works with bash and zsh) set MSC_ROOT=/opt/MSC set MARC_VERSION=2015 -set DAMASK_NUM_THREADS=4 +set DAMASK_NUM_THREADS = 4 set ABAQUS_VERSION=6.14-5 -#Set DAMASK_BIN if not $DAMASK_ROOT/bin -#DAMASK_BIN +set DAMASK_BIN=${DAMASK_ROOT}/lib diff --git a/DAMASK_env.sh b/DAMASK_env.sh index 535708ed4..760ee056a 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -1,15 +1,20 @@ # sets up an environment for DAMASK on bash # usage: source DAMASK_env.sh + if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]; then - DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "`dirname $BASH_SOURCE`") + DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$(dirname $BASH_SOURCE)") else [[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="`pwd`/" STAT=$(stat "`dirname $BASE$BASH_SOURCE`") DAMASK_ROOT=${STAT##* } fi -[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf +# allows to source the same file for tcsh and bash, with and without space around = +set() { + export $1$2$3 + } +source $DAMASK_ROOT/CONFIG # if DAMASK_BIN is present and not in $PATH, add it if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then @@ -24,6 +29,9 @@ PROCESSING=`which postResults 2>/dev/null` if [ "x$PROCESSING" == "x" ]; then PROCESSING='Not found!' fi +if [ "x$DAMASK_NUM_THREADS" == "x" ]; then + DAMASK_NUM_THREADS=1 +fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size @@ -68,10 +76,12 @@ fi export DAMASK_NUM_THREADS export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH -for var in BASE STAT SOLVER PROCESSING FREE; do +for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do unset "${var}" done -for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do +for var in DAMASK MSC; do unset "${var}_ROOT" done - +for var in ABAQUS MARC; do + unset "${var}_VERSION" +done diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index b4b2d6953..b3666b34b 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -1,5 +1,6 @@ -# sets up an environment for DAMASK on bash -# usage: source DAMASK_env.sh +# sets up an environment for DAMASK on zsh +# usage: source DAMASK_env.zsh + if [ "$OSTYPE" = "linux-gnu" ] || [ "$OSTYPE" = 'linux' ]; then DAMASK_ROOT=$(readlink -f "`dirname ${(%):-%N}`") @@ -7,12 +8,17 @@ else print 'Not done yet' fi -[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf +# allows to source the same file for tcsh and zsh, with and without space around = +set() { + export $1$2$3 + } +source $DAMASK_ROOT/CONFIG # if DAMASK_BIN is present and not in $PATH, add it -#if [[ [[ "x$DAMASK_BIN" != "x" ]] && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then +MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:` +if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then export PATH=$DAMASK_BIN:$PATH -#fi +fi SOLVER=`which DAMASK_spectral 2>/dev/null` if [ "x$SOLVER" = "x" ]; then @@ -22,6 +28,9 @@ PROCESSING=`which postResults 2>/dev/null` if [ "x$PROCESSING" = "x" ]; then export PROCESSING='Not found!' fi +if [ "x$DAMASK_NUM_THREADS" = "x" ]; then + DAMASK_NUM_THREADS=1 +fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size @@ -65,10 +74,12 @@ fi export DAMASK_NUM_THREADS export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH -for var in BASE STAT SOLVER PROCESSING FREE; do +for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN MATCH; do unset "${var}" done -for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do +for var in DAMASK MSC; do unset "${var}_ROOT" done - +for var in ABAQUS MARC; do + unset "${var}_VERSION" +done From 3314e5f0514401a29c5e9596bd1e9e6f5796fdd3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 15:09:25 +0200 Subject: [PATCH 011/139] updated symlinking, removed unused "rootRelation" --- .gitignore | 1 + CONFIG | 9 +++++---- installation/symlink_Code.py | 23 ++++++++++------------- installation/symlink_Processing.py | 15 ++++----------- lib/damask/environment.py | 11 +++++------ 5 files changed, 25 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index ea92bb425..d195179bb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ *.exe *.bak *~ +bin PRIVATE diff --git a/CONFIG b/CONFIG index 17561c9cd..ee7e4fae2 100644 --- a/CONFIG +++ b/CONFIG @@ -1,9 +1,10 @@ # "set"-syntax needed only for tcsh (but works with bash and zsh) +# DAMASK_ROOT will be expanded +set DAMASK_BIN=${DAMASK_ROOT}/bin + +set DAMASK_NUM_THREADS = 4 set MSC_ROOT=/opt/MSC set MARC_VERSION=2015 -set DAMASK_NUM_THREADS = 4 - -set ABAQUS_VERSION=6.14-5 -set DAMASK_BIN=${DAMASK_ROOT}/lib +set ABAQUS_VERSION=5.14-5 diff --git a/installation/symlink_Code.py b/installation/symlink_Code.py index f0fea41e3..5d4518ddd 100755 --- a/installation/symlink_Code.py +++ b/installation/symlink_Code.py @@ -13,16 +13,9 @@ bin_link = { \ MarcReleases =[2011,2012,2013,2013.1,2014,2014.2,2015] -baseDir = damask.Environment('../../').relPath('code/') - -try: - binDir = damask.Environment().options['DAMASK_BIN'] -except: - root=os.access('/usr/local/bin', os.W_OK) - if root: - binDir = '/usr/local/bin' - else: - binDir = os.path.join(os.getenv('HOME'),'bin') +damaskEnv = damask.Environment() +baseDir = damaskEnv.relPath('code/') +binDir = damaskEnv.options['DAMASK_BIN'] if not os.path.isdir(binDir): os.mkdir(binDir) @@ -43,7 +36,11 @@ for version in MarcReleases: src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90')) if os.path.exists(src): sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90')) - if os.path.lexists(sym_link): os.remove(sym_link) - os.symlink(os.path.relpath(src,baseDir),sym_link) - sys.stdout.write(sym_link+' -> '+src+'\n') + if os.path.lexists(sym_link): + os.remove(sym_link) + sys.stdout.write(sym_link) + else: + sys.stdout.write(damask.util.bcolors.BOLD + sym_link + damask.util.bcolors.ENDC) + os.symlink(src,sym_link) + sys.stdout.write(' -> '+src+'\n') diff --git a/installation/symlink_Processing.py b/installation/symlink_Processing.py index 0ca4f8ba4..3f00e95c6 100755 --- a/installation/symlink_Processing.py +++ b/installation/symlink_Processing.py @@ -3,18 +3,11 @@ # Makes postprocessing routines acessible from everywhere. import os,sys -from damask import Environment +import damask -BOLD = '\033[1m' -ENDC = '\033[0m' - -damaskEnv = Environment() +damaskEnv = damask.Environment() baseDir = damaskEnv.relPath('processing/') -codeDir = damaskEnv.relPath('code/') -try: - binDir = damaskEnv.options['DAMASK_BIN'] -except: - binDir = '/usr/local/bin' if os.access('/usr/local/bin', os.W_OK) else os.path.join(os.getenv('HOME'),'bin') +binDir = damaskEnv.options['DAMASK_BIN'] if not os.path.isdir(binDir): os.mkdir(binDir) @@ -36,7 +29,7 @@ for subDir in processing_subDirs: os.remove(sym_link) sys.stdout.write(sym_link) else: - sys.stdout.write(BOLD + sym_link + ENDC) + sys.stdout.write(damask.util.bcolors.BOLD + sym_link + damask.util.bcolors.ENDC) os.symlink(src,sym_link) sys.stdout.write(' -> '+src+'\n') diff --git a/lib/damask/environment.py b/lib/damask/environment.py index b0256e05d..4d24c6c6e 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -5,12 +5,10 @@ import os,subprocess,shlex,re class Environment(): __slots__ = [ \ - 'rootRelation', 'options', ] - def __init__(self,rootRelation = '.'): - self.rootRelation = rootRelation + def __init__(self): self.options = {} self.get_options() @@ -23,11 +21,12 @@ class Environment(): def get_options(self): with open(self.relPath(self.rootDir()+'/CONFIG')) as configFile: for line in configFile: - l = re.sub('^set ', '', line).strip() + l = re.sub('^set ', '', line).strip() # remove "set" (tcsh) when setting variables if l and not l.startswith('#'): items = l.split('=') - if len(items) == 2: - self.options[items[0].upper()] = items[1] + if len(items) == 2: + self.options[items[0].upper()] = \ + re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT def isAvailable(self,software,Nneeded =-1): licensesNeeded = {'abaqus' :5, From 13ee927606227428d47677c70d187a7284b7c250 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 15:12:16 +0200 Subject: [PATCH 012/139] Cython was not always working --- Makefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Makefile b/Makefile index 6c63d01f6..68ffb7033 100755 --- a/Makefile +++ b/Makefile @@ -17,16 +17,6 @@ FEM: marc: @./installation/mods_MarcMentat/apply_DAMASK_modifications.sh ${MAKEFLAGS} -.PHONY: processing -processing: - @if hash cython 2>/dev/null; then \ - cd ./lib/damask; \ - ln -s orientation.py corientation.pyx; \ - CC=gcc python setup_corientation.py build_ext --inplace; \ - rm -rv build; \ - rm *.c; \ - fi - .PHONY: tidy tidy: @$(MAKE) tidy -C code >/dev/null From 630b89c25a2998f8baf7186d45319188c920a4ad Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 15:29:53 +0200 Subject: [PATCH 013/139] bugfixes (did not compile) --- code/crystallite.f90 | 7 +++++-- code/math.f90 | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/code/crystallite.f90 b/code/crystallite.f90 index 2fc5b4083..7abd737f3 100644 --- a/code/crystallite.f90 +++ b/code/crystallite.f90 @@ -145,6 +145,7 @@ subroutine crystallite_init debug_crystallite, & debug_levelBasic use numerics, only: & + worldrank, & usePingPong use math, only: & math_I3, & @@ -3780,11 +3781,12 @@ logical function crystallite_integrateStress(& enddo LpLoop - if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) & + if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then !$OMP CRITICAL (distributionStress) debug_StressLoopLpDistribution(NiterationStressLp,numerics_integrationMode) = & debug_StressLoopLpDistribution(NiterationStressLp,numerics_integrationMode) + 1_pInt !$OMP END CRITICAL (distributionStress) + endif !* calculate intermediate velocity gradient and its tangent from constitutive law @@ -3866,11 +3868,12 @@ logical function crystallite_integrateStress(& Liguess = Liguess + steplengthLi * deltaLi enddo LiLoop - if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) & + if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then !$OMP CRITICAL (distributionStress) debug_StressLoopLiDistribution(NiterationStressLi,numerics_integrationMode) = & debug_StressLoopLiDistribution(NiterationStressLi,numerics_integrationMode) + 1_pInt !$OMP END CRITICAL (distributionStress) + endif !* calculate new plastic and elastic deformation gradient diff --git a/code/math.f90 b/code/math.f90 index 8273b1820..8694e30ee 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -214,9 +214,9 @@ subroutine math_init call random_number(randTest(i)) enddo - write(6,'(a,I)') 'size of random seed: ', randSize + write(6,'(a,I2)') ' size of random seed: ', randSize do i =1, randSize - write(6,'(a,I,I)') 'value of random seed: ', i, randInit(i) + write(6,'(a,I2,I14)') ' value of random seed: ', i, randInit(i) enddo write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest @@ -1189,9 +1189,9 @@ function math_qRand() real(pReal), dimension(3) :: rnd call halton(3_pInt,rnd) - math_qRand = [cos(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)), - sin(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), - cos(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), + math_qRand = [cos(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)), & + sin(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), & + cos(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), & sin(2.0_pReal*PI*rnd(1))*sqrt(rnd(3))] end function math_qRand From 25fcfcd16938d59cde9b0313309ca23a56da9b02 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 15:50:39 +0200 Subject: [PATCH 014/139] set to correct Abaqus version --- CONFIG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONFIG b/CONFIG index ee7e4fae2..b701ec3c7 100644 --- a/CONFIG +++ b/CONFIG @@ -7,4 +7,4 @@ set DAMASK_NUM_THREADS = 4 set MSC_ROOT=/opt/MSC set MARC_VERSION=2015 -set ABAQUS_VERSION=5.14-5 +set ABAQUS_VERSION=6.14-5 From 9e3f4b1ec4ed86df9c2681ffca434b2429500e30 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 16:09:04 +0200 Subject: [PATCH 015/139] unicode string caused trouble with Abaqus' IronPython --- lib/damask/orientation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 886cd5a36..1607c220b 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -338,7 +338,7 @@ class Quaternion: type = "bunge", degrees = False, standardRange = False): - u""" + """ Orientation as Bunge-Euler angles conversion of ACTIVE rotation to Euler angles taken from: From 787a8da1c385ef29e266653b164af28d4421a8de Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 16:10:59 +0200 Subject: [PATCH 016/139] removed remainders of Corientation compilation --- lib/damask/__init__.py | 6 ++---- lib/damask/setup_corientation.py | 17 ----------------- 2 files changed, 2 insertions(+), 21 deletions(-) delete mode 100755 lib/damask/setup_corientation.py diff --git a/lib/damask/__init__.py b/lib/damask/__init__.py index fb305cc8c..a1c08ea18 100644 --- a/lib/damask/__init__.py +++ b/lib/damask/__init__.py @@ -10,10 +10,8 @@ from .environment import Environment # noqa from .asciitable import ASCIItable # noqa from .config import Material # noqa from .colormaps import Colormap, Color # noqa -try: - from .corientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa -except: - from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa +from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa + #from .block import Block # only one class from .result import Result # noqa from .geometry import Geometry # noqa diff --git a/lib/damask/setup_corientation.py b/lib/damask/setup_corientation.py deleted file mode 100755 index 2cf0be196..000000000 --- a/lib/damask/setup_corientation.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: UTF-8 no BOM -*- - -from distutils.core import setup -from distutils.extension import Extension -from Cython.Distutils import build_ext -import numpy as np - -ext = [Extension("corientation", ["corientation.pyx"], - include_dirs=[np.get_include()])] - -setup( - name="corientation", - include_dirs=[np.get_include()], - cmdclass = {'build_ext': build_ext}, - ext_modules=ext -) \ No newline at end of file From ade6db3f9cd22479ea4549b5dc25e2c90254c2ec Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 16:12:05 +0200 Subject: [PATCH 017/139] uses version string from CONFIG file --- lib/damask/solver/abaqus.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/damask/solver/abaqus.py b/lib/damask/solver/abaqus.py index ffb01ac51..19ec6b91f 100644 --- a/lib/damask/solver/abaqus.py +++ b/lib/damask/solver/abaqus.py @@ -6,14 +6,10 @@ from .solver import Solver class Abaqus(Solver): - def __init__(self,version='',solver=''): # example version string: 6.12-2, solver: std or exp self.solver='Abaqus' if version =='': - import subprocess - process = subprocess.Popen(['abaqus', 'information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE) - self.version = process.stdout.readlines()[1].split()[1] - print(self.version) + version = damask.Environment().options['ABAQUS_VERSION'] else: self.version = version @@ -40,6 +36,3 @@ class Abaqus(Solver): if self.version != detectedVersion: raise Exception('found Abaqus version %s, but requested %s'%(detectedVersion,self.version)) return '%s -job %s -user %s/code/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.solver) - - - From 38bf357e7c1372a26fa5a147bede1483f4fee218 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 16:18:27 +0200 Subject: [PATCH 018/139] removed obsolote information on lapack and (always outdated) version information --- installation/mods_MarcMentat/installation.txt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/installation/mods_MarcMentat/installation.txt b/installation/mods_MarcMentat/installation.txt index 2b9f5d9b4..d463387af 100644 --- a/installation/mods_MarcMentat/installation.txt +++ b/installation/mods_MarcMentat/installation.txt @@ -1,21 +1,13 @@ -Install MPIE modifications to use DAMASK_marc2010/11/12/13/14 +Install DAMASK modifications to use DAMASK_marc +This is for the Linux64 version of Marc/Mentat Refer to http://damask.mpie.de for complete installation instructions. Usually you will need to be root for this to work! -This is for the Linux64 version of Marc/Mentat2011/12/13(.1)/14(.2). See Marc and Mentat Release Guide for List of Build and Supported Platforms! -The Intel Fortran compiler needs to be installed. Marc/Mentat as well as DAMASK rely on Intel Fortran 12.0 or above! Make sure that ifort (the compiler executable) is in the PATH and that LD_LIBRARY_PATH is set correctly, refer to the Intel installation guide for instructions on how to do this. - -The AMD Core Math Library or an other BLAS implementation (currently IMKL and LAPACK are supported) needs to be installed! -Add acml path to LD_LIBRARY_PATH, to do so either use the script setup_shellrc.py in the installation folder or for a system wide setup edit /etc/csh.cshrc.local and/or /etc/bash.bashrc.local. -Assuming ACML is installed in path ACMLDIR the path should read: /ACMLDIR/ifort64_mp/lib (this is the version using paralllization, ie openmp): - for bash: LD_LIBRARY_PATH="/ACMLDIR/ifort64_mp/lib:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH - for csh: setenv LD_LIBRARY_PATH /ACMLDIR/ifort64_mp/lib:${LD_LIBRARY_PATH} - -As the apply_DAMASK_modifications script has to fix the path for the BLAS it needs to be installed in a place that can be accessed by all users of the system. In addition you have to specify the respective locations in DAMASK_ROOT/lib/pathInfo. +The Intel Fortran compiler needs to be installed. 1) Install Marc, Mentat and Documentation as usual Run the test example including subroutines to confirm that the installation of both Marc/Mentat and the Intel Fortran Compiler is ok! From 46cf0394ec151291cf2eb4d539a149385ee43f88 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 17:07:08 +0200 Subject: [PATCH 019/139] cleaned, exeption not needed (SOLVER and PROCESSING are always defined) --- DAMASK_env.sh | 6 +++--- DAMASK_env.zsh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DAMASK_env.sh b/DAMASK_env.sh index 760ee056a..d17412a2f 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -10,7 +10,7 @@ else DAMASK_ROOT=${STAT##* } fi -# allows to source the same file for tcsh and bash, with and without space around = +# defining set() allows to source the same file for tcsh and bash, with and without space around = set() { export $1$2$3 } @@ -58,8 +58,8 @@ if [ ! -z "$PS1" ]; then echo echo Using environment with ... echo "DAMASK $DAMASK_ROOT" - [[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER" - [[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING" + echo "Spectral Solver $SOLVER" + echo "Post Processing $PROCESSING" echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" if [ "x$PETSC_DIR" != "x" ]; then echo "PETSc location $PETSC_DIR" diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index b3666b34b..d23b00f80 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -8,7 +8,7 @@ else print 'Not done yet' fi -# allows to source the same file for tcsh and zsh, with and without space around = +# defining set() allows to source the same file for tcsh and zsh, with and without space around = set() { export $1$2$3 } @@ -57,8 +57,8 @@ if [ ! -z "$PS1" ]; then echo echo Using environment with ... echo "DAMASK $DAMASK_ROOT" - [[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER" - [[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING" + echo "Spectral Solver $SOLVER" + echo "Post Processing $PROCESSING" echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" if [ "x$PETSC_DIR" != "x" ]; then echo "PETSc location $PETSC_DIR" From cd36e752e8657c8f445b9a2a37c67327e8713004 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Jul 2016 17:21:44 +0200 Subject: [PATCH 020/139] adopted csh script --- DAMASK_env.csh | 77 ++++++++++++++++++++++++++++++++++++++------------ DAMASK_env.sh | 2 +- DAMASK_env.zsh | 2 +- 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/DAMASK_env.csh b/DAMASK_env.csh index 584f3f127..7e3bf128d 100644 --- a/DAMASK_env.csh +++ b/DAMASK_env.csh @@ -1,26 +1,67 @@ # sets up an environment for DAMASK on tcsh # usage: source DAMASK_env.csh -set MAGIG=($_) -set FILENAME=`readlink -f $called[2]` -set LOCATION = `dirname $FILENAME` -setenv DAMASK_ROOT ${LOCATION} -setenv DAMASK_NUM_THREADS 2 + +set CALLED=($_) +set DIRNAME=`dirname $CALLED[2]` +set DAMASK_ROOT=`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" $DIRNAME` + +source $DAMASK_ROOT/CONFIG + +# if DAMASK_BIN is present and not in $PATH, add it +if ( $?DAMASK_BIN) then + set MATCH=`echo :${PATH}: | grep ${DAMASK_BIN}:` + if ( "x$MATCH" == "x" ) then + set PATH=${DAMASK_BIN}:${PATH} + endif +endif + +set SOLVER=`which DAMASK_spectral` +set PROCESSING=`which postResults` +if ( "x$DAMASK_NUM_THREADS" == "x" ) then + set DAMASK_NUM_THREADS=1 +endif + +# according to http://software.intel.com/en-us/forums/topic/501500 +# this seems to make sense for the stack size +set FREE=`which free` +set FREE='' +if ( "x$FREE" != "x" ) then + set freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` + set heap=`expr $freeMem / 2` + set stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` + # http://superuser.com/questions/220059/what-parameters-has-ulimit + limit stacksize $stack # maximum stack size (kB) + limit datasize $heap # maximum heap size (kB) +endif +limit coredumpsize 2000 # core file size (512-byte blocks) +limit vmemoryuse unlimited # maximum virtual memory size +limit memoryuse unlimited # maximum physical memory size + # disable output in case of scp if($?prompt) then - echo + echo '' echo Düsseldorf Advanced Materials Simulation Kit - DAMASK echo Max-Planck-Institut für Eisenforschung, Düsseldorf - echo http://damask.mpie.de + echo https://damask.mpie.de echo - echo Preparing environment ... - echo "DAMASK_ROOT=$DAMASK_ROOT" - echo "DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" + echo Using environment with ... + echo "DAMASK $DAMASK_ROOT" + echo "Spectral Solver $SOLVER" + echo "Post Processing $PROCESSING" + echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" + if ( $?PETSC_DIR) then + echo "PETSc location $PETSC_DIR" + endif + if ( $?PETSC_ARCH) then + echo "PETSc architecture $PETSC_ARCH" + endif + if ( $?MSC_ROOT) then + echo "MSC.Marc/Mentat $MSC_ROOT" + endif + echo + echo `limit stacksize` + echo `limit datasize` endif -ulimit -s unlimited -ulimit -c 0 -ulimit -v unlimited -ulimit -m unlimited -setenv DAMASK_BIN ${DAMASK_ROOT}/bin -setenv PATH ${PATH}:${DAMASK_BIN} -setenv PYTHONPATH ${PYTHONPATH}:${DAMASK_ROOT}/lib -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH} + +setenv DAMASK_NUM_THREADS $DAMASK_NUM_THREADS +setenv PYTHONPATH $DAMASK_ROOT/lib:$PYTHONPATH diff --git a/DAMASK_env.sh b/DAMASK_env.sh index d17412a2f..f217a7d63 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -54,7 +54,7 @@ if [ ! -z "$PS1" ]; then echo echo Düsseldorf Advanced Materials Simulation Kit - DAMASK echo Max-Planck-Institut für Eisenforschung, Düsseldorf - echo http://damask.mpie.de + echo https://damask.mpie.de echo echo Using environment with ... echo "DAMASK $DAMASK_ROOT" diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index d23b00f80..dcb93dc4a 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -53,7 +53,7 @@ if [ ! -z "$PS1" ]; then echo echo Düsseldorf Advanced Materials Simulation Kit - DAMASK echo Max-Planck-Institut für Eisenforschung, Düsseldorf - echo http://damask.mpie.de + echo https://damask.mpie.de echo echo Using environment with ... echo "DAMASK $DAMASK_ROOT" From 7d84b9971091c0ef8a6fd52b2a1b901064516b0a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 10:34:17 +0200 Subject: [PATCH 021/139] bugfix: axis out of bounds for np.repeat, np.tile seems to be ok @Philip: pls check. autodoc friendly help --- processing/pre/geom_fromVoronoiTessellation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 71bf9929f..c727afee7 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -73,8 +73,7 @@ def laguerreTessellation(undeformed, coords, weights, grains, nonperiodic = Fals [ 1, 1, 1 ], ]).astype(float)*info['size'] - repeatweights = np.repeat(weights,len(copies),axis=1).flatten(order='F') # Laguerre weights (1,2,3,1,2,3,...,1,2,3) - + repeatweights = np.tile(weights,len(copies)).flatten(order='F') # Laguerre weights (1,2,3,1,2,3,...,1,2,3) for i,vec in enumerate(copies): # periodic copies of seed points ... try: seeds = np.append(seeds, coords+vec, axis=0) # ... (1+a,2+a,3+a,...,1+z,2+z,3+z) except NameError: seeds = coords+vec @@ -134,12 +133,12 @@ group.add_option('-g', '--grid', dest = 'grid', type = 'int', nargs = 3, metavar = ' '.join(['int']*3), - help = 'a,b,c grid of hexahedral box [auto]') + help = 'a,b,c grid of hexahedral box') group.add_option('-s', '--size', dest = 'size', type = 'float', nargs = 3, metavar=' '.join(['float']*3), - help = 'x,y,z size of hexahedral box [auto]') + help = 'x,y,z size of hexahedral box') group.add_option('-o', '--origin', dest = 'origin', From 2a7f772d085b803daef8f35fa638b64ebe5fae45 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 10:54:28 +0200 Subject: [PATCH 022/139] adopted to new installation config file --- .../apply_DAMASK_modifications.sh | 83 ++++++++++--------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/installation/mods_MarcMentat/apply_DAMASK_modifications.sh b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh index 348c24565..f52b70e36 100755 --- a/installation/mods_MarcMentat/apply_DAMASK_modifications.sh +++ b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh @@ -1,21 +1,24 @@ #!/usr/bin/env bash -DEFAULT_VERSION='2015' - -WORKINGDIR="$( cd "$( dirname "$0" )" && pwd )" - -if [ -f $HOME/.damask/damask.conf ]; then - source $HOME/.damask/damask.conf -else - source /etc/damask.conf -fi +SCRIPTLOCATION="$( cd "$( dirname "$0" )" && pwd )" +DAMASK_ROOT=$SCRIPTLOCATION/../../ +# defining set() allows to source the same file for tcsh and bash, with and without space around = +set() { + export $1$2$3 + } +source $DAMASK_ROOT/CONFIG if [ "x$MSC_ROOT" != "x" ]; then DEFAULT_DIR=$MSC_ROOT fi +if [ "x$MARC_VERSION" != "x" ]; then + DEFAULT_VERSION=$MARC_VERSION +fi +if [ "x$DAMASK_BIN" != "x" ]; then + BIN_DIR=$DAMASK_BIN +fi - -while [ ! -d "$WORKINGDIR/$VERSION" ] || [ -z "$VERSION" ] +while [ ! -d "$SCRIPTLOCATION/$VERSION" ] || [ -z "$VERSION" ] do echo "Input version of MARC/MENTAT installation: [${DEFAULT_VERSION}]" read VERSION @@ -66,7 +69,7 @@ for filename in 'comp_damask' \ 'run_damask_lmp' \ 'run_damask_hmp' \ 'include_linux64'; do - cp $WORKINGDIR/$VERSION/Marc_tools/$filename $theDIR + cp $SCRIPTLOCATION/$VERSION/Marc_tools/$filename $theDIR echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g" echo $filename @@ -89,7 +92,7 @@ for filename in 'edit_window' \ 'kill7' \ 'kill8' \ 'kill9'; do - cp $WORKINGDIR/$VERSION/Mentat_bin/$filename $theDIR + cp $SCRIPTLOCATION/$VERSION/Mentat_bin/$filename $theDIR echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%EDITOR%:${EDITOR}:g" @@ -101,7 +104,7 @@ echo '' echo 'copying Mentat menus...' theDIR=$INSTALLDIR/mentat$VERSION/menus for filename in 'job_run.ms'; do - cp $WORKINGDIR/$VERSION/Mentat_menus/$filename $theDIR + cp $SCRIPTLOCATION/$VERSION/Mentat_menus/$filename $theDIR echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g" echo $filename @@ -121,31 +124,33 @@ chmod 755 $INSTALLDIR/mentat$VERSION/bin/submit{4..9} chmod 755 $INSTALLDIR/mentat$VERSION/bin/kill{4..9} #creating symlinks for run_damask_scripts in /usr/local/bin -BIN_DIR=/usr/local/bin -echo '' -echo "Do you want to create symlinks for run_damask scripts in ${BIN_DIR} [YES/no] ?" -read YESNO - if [ -z "$YESNO" ]; then - YESNO=yes - fi -case $YESNO in - y* | Y* ) - echo'' - echo 'creating symlinks ...' - echo'' - theDIR=$INSTALLDIR/marc$VERSION/tools - for filename in 'run_damask' \ - 'run_damask_l' \ - 'run_damask_h' \ - 'run_damask_mp' \ - 'run_damask_lmp' \ - 'run_damask_hmp'; do - echo ${filename:4}$VERSION - [ -f $BIN_DIR/${filename:4}$VERSION ] && rm $BIN_DIR/${filename:4}$VERSION - ln -s $theDIR/$filename $BIN_DIR/${filename:4}$VERSION - done - ;; -esac + +if [ -d "$BIN_DIR" ]; then + echo '' + echo "Do you want to create symlinks for run_damask scripts in ${BIN_DIR} [YES/no] ?" + read YESNO + if [ -z "$YESNO" ]; then + YESNO=yes + fi + case $YESNO in + y* | Y* ) + echo'' + echo 'creating symlinks ...' + echo'' + theDIR=$INSTALLDIR/marc$VERSION/tools + for filename in 'run_damask' \ + 'run_damask_l' \ + 'run_damask_h' \ + 'run_damask_mp' \ + 'run_damask_lmp' \ + 'run_damask_hmp'; do + echo ${filename:4}$VERSION + [ -f $BIN_DIR/${filename:4}$VERSION ] && rm $BIN_DIR/${filename:4}$VERSION + ln -s $theDIR/$filename $BIN_DIR/${filename:4}$VERSION + done + ;; + esac +fi echo '' echo 'done.' From c792b73b4e87efc860bd7ce7222092391c8c88bc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 14:52:48 +0200 Subject: [PATCH 023/139] simplified --- processing/pre/geom_fromVoronoiTessellation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index c727afee7..5bf6141e1 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -83,7 +83,7 @@ def laguerreTessellation(undeformed, coords, weights, grains, nonperiodic = Fals devNull,closestSeeds = myKDTree.query(undeformed) else: damask.util.croak('...using {} cpu{}'.format(options.cpus, 's' if options.cpus > 1 else '')) - arguments = [[arg] + [seeds,repeatweights] for arg in list(undeformed)] + arguments = [[arg,seeds,repeatweights] for arg in list(undeformed)] if cpus > 1: # use multithreading pool = multiprocessing.Pool(processes = cpus) # initialize workers From e8153ad196dfc55fc4324fdbcd398f1912e890ce Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 15:48:53 +0200 Subject: [PATCH 024/139] corrected name --- processing/pre/geom_fromVoronoiTessellation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 5bf6141e1..fd334620f 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -31,9 +31,9 @@ def meshgrid2(*arrs): return tuple(ans) def findClosestSeed(fargs): - point, seeds, weightssquared = fargs + point, seeds, myWeights = fargs tmp = np.repeat(point.reshape(3,1), len(seeds), axis=1).T - dist = np.sum((tmp - seeds)*(tmp - seeds),axis=1) - weightssquared + dist = np.sum((tmp - seeds)**2,axis=1) -myWeights return np.argmin(dist) # seed point closest to point From 260ca270dfa6367f4e04ada1eff5fe8640e5cf9d Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 15 Jul 2016 16:20:55 +0200 Subject: [PATCH 025/139] updated version information after successful test of v2.0.0-350-g7d84b99 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 114695582..e7c04b3f7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.0-347-gbe02300 +v2.0.0-350-g7d84b99 From 0b145826a639aa989ae8e5d4c116ee86118986dd Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 16:51:49 +0200 Subject: [PATCH 026/139] =?UTF-8?q?unicode=20docstring=20does=20not=20work?= =?UTF-8?q?=20for=20abaqus,=20but=20if=20using=20=C3=B6=20pyflakes=20wants?= =?UTF-8?q?=20to=20have=20a=20unicode=20docstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/damask/orientation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 1607c220b..414db52a1 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -342,7 +342,7 @@ class Quaternion: Orientation as Bunge-Euler angles conversion of ACTIVE rotation to Euler angles taken from: - Melcher, A.; Unser, A.; Reichhardt, M.; Nestler, B.; Pötschke, M.; Selzer, M. + Melcher, A.; Unser, A.; Reichhardt, M.; Nestler, B.; Poetschke, M.; Selzer, M. Conversion of EBSD data by a quaternion based algorithm to be used for grain structure simulations Technische Mechanik 30 (2010) pp 401--413 """ From 7f67ff05fdc0249cecaf4eedd75afa5e3c00bac0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 16:53:57 +0200 Subject: [PATCH 027/139] used in both functions --- lib/damask/solver/abaqus.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/damask/solver/abaqus.py b/lib/damask/solver/abaqus.py index 19ec6b91f..c1777b4bf 100644 --- a/lib/damask/solver/abaqus.py +++ b/lib/damask/solver/abaqus.py @@ -1,8 +1,7 @@ # -*- coding: UTF-8 no BOM -*- - from .solver import Solver - +import damask class Abaqus(Solver): @@ -23,7 +22,6 @@ class Abaqus(Solver): def return_run_command(self,model): import subprocess import re - import damask env=damask.Environment() shortVersion = re.sub('[\.,-]', '',self.version) try: From ce7cd36bf5af278fe1645f9bbd9b943982068375 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 20:23:20 +0200 Subject: [PATCH 028/139] better be done with load case rotation --- processing/misc/calculateAnisotropy.py | 236 ------------------------- 1 file changed, 236 deletions(-) delete mode 100755 processing/misc/calculateAnisotropy.py diff --git a/processing/misc/calculateAnisotropy.py b/processing/misc/calculateAnisotropy.py deleted file mode 100755 index a88b39b74..000000000 --- a/processing/misc/calculateAnisotropy.py +++ /dev/null @@ -1,236 +0,0 @@ -# -*- coding: UTF-8 no BOM -*- - -import threading,os,string -import numpy as np -from optparse import OptionParser -from shutil import copy2 -from re import split -import damask - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -def list_split(option, opt, value, parser): - setattr(parser.values, option.dest, value.split(',')) - -#--------------------------------------------------------------------------------------------------- -class myThread (threading.Thread): - """Runner""" - - def __init__(self, threadID): - threading.Thread.__init__(self) - self.threadID = threadID - def run(self): - s.acquire() - conv=isFinished() - s.release() - while conv: - doSim(4.,self.name) - s.acquire() - conv=isFinished() - s.release() - -def doSim(delay,thread): - global dirCurrent - s.acquire() - delta_angle = offsetPhi() - if len(str(delta_angle)) > 5: - file_angle = str(delta_angle)[:5] - else: - file_angle = str(delta_angle) - dire = dirCurrent+'/'+file_angle - - if not os.path.isdir(dire): - os.mkdir(dire,0755) - for file in [options.geometry+'.geom',options.load+'.load','numerics.config']: - copy2(dirCurrent+'/'+file, dire) - newMaterialConfig(dirCurrent,delta_angle) - - os.chdir(dire) - if not os.path.isfile('%s_%s.spectralOut'%(options.geometry,options.load)): - print('starting uniaxial tension in direction of angle %s from %s'%(file_angle,thread)) - s.release() - damask.util.execute('DAMASK_spectral -g %s -l %s'%(options.geometry,options.load)) - else: s.release() - - s.acquire() - if not os.path.isfile('./%s/%s_%s.txt'%('Rvalues',options.geometry,options.load)): - print('starting post processing for angle %s from %s'%(file_angle,thread)) - s.release() - damask.util.execute('postResults --cr f,p -d %s %s_%s.spectralOut'%('Rvalues',options.geometry,options.load)) - damask.util.execute('addCauchy ./%s/%s_%s.txt'%('Rvalues',options.geometry,options.load)) - damask.util.execute('addStrainTensors -l -v ./%s/%s_%s.txt'%('Rvalues',options.geometry,options.load)) - print('post processing for angle %s from %s is finished'%(file_angle,thread)) - - else: - s.release() - os.chdir(dirCurrent) - -def isFinished(): - global N_simulations - - if N_simulations < options.number: - return True - else: - return False - -def offsetPhi(): - global N_simulations #, N_tensile - N_simulations+=1 - return np.linspace(0,90,options.number)[N_simulations-1] - -def newMaterialConfig(dire,angle): - filename = '/material.config' - if len(str(angle)) > 5: - file_angle = str(angle)[:5] - else: - file_angle = str(angle) - f = open(dire+'/'+file_angle+filename,'w') - data = open(dire+filename, 'r').readlines() - - for line in data: - if '(gauss)' in line: - linesplit = split(r'[;,\s,\t]\s*',line) - index = linesplit.index('phi1') - phi = float(linesplit[index+1]) - angle - if phi > 360. : - phi = phi-360.0 - elif phi < 0.0: - phi = phi+360.0 - index2 = line.index(linesplit[index+1]) - line2 = line[:index2]+str(phi)+line[index2+len(str(float(linesplit[index+1]))):] - else: - line2 = line - f.write(line2) - f.close() - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Calculate the deformation anisotropic coefficients (r values) and -strength anisotropic coefficients (normalized yield stress) - -""", version=string.replace(scriptID,'\n','\\n') -) - -parser.add_option('-l','--load' , - dest='load', type='string', - help='name of the load file [%default]', metavar='string') -parser.add_option('-g','--geometry', - dest='geometry', type='string', - help='name of the geometry file [%default]', metavar='string') -parser.add_option('-s', '--strain', - dest='strain', type='string', action='callback', callback=list_split, - help='threshold strains, using comma to seperate multiple strains [%default]', metavar='string') -parser.add_option('-t','--threads', - dest='threads', type='int', - help='number of parallel executions [%default]', metavar='int') -parser.add_option('-n','--number', - dest='number', type='int', - help='Number of uni-axial tensile tests [%default]', metavar='int') - -parser.set_defaults(geometry = '20grains16x16x16') -parser.set_defaults(load = 'tensionX') -parser.set_defaults(threads = 1) -parser.set_defaults(number = 7) -parser.set_defaults(strain = ('0.0025','0.025')) - -options = parser.parse_args()[0] - -if not os.path.isfile(options.geometry+'.geom'): - parser.error('geometry file %s.geom not found'%options.geometry) -if not os.path.isfile('material.config'): - parser.error('material.config file not found') - -thresStrain = [float(i) for i in options.strain] - -if not os.path.isfile(options.load+'.load'): - maxstrain = max(thresStrain) - f11 = str(1.2*maxstrain + 1.0) - if maxstrain < 0.05: - maxincs = '60'; maxtime = '30' - else: - maxincs = str(int(maxstrain*3000)); maxtime = str(maxstrain*600) - - f=open('tensionX.load','w') - uniaxial_load = 'f ' +f11+ ' 0 0 0 * 0 0 0 * ' + \ - 'stress ' +'* * * * 0 * * * 0 ' + \ - 'time '+ maxtime + ' incs ' + maxincs + ' freq 3' - f.write(uniaxial_load) - f.close() - -N_simulations=0 -s=threading.Semaphore(1) -threads=[] -dirCurrent = os.getcwd() -for i in range(options.threads): - threads.append(myThread(i)) - threads[i].start() - -for i in range(options.threads): - threads[i].join() - -anisotropy = {} -for i,delta_angle in enumerate(np.linspace(0,90,options.number)): - if len(str(delta_angle)) > 5: - file_angle = str(delta_angle)[:5] - else: - file_angle = str(delta_angle) - refFile = dirCurrent+'/'+file_angle+'/Rvalues/%s_%s.txt'%(options.geometry,options.load) - if not os.path.isfile(refFile): - print('post processing file is not found for the angle %s'%file_angle) - else: - File = open(refFile) - table = damask.ASCIItable(File) - table.head_read() - if not set(['1_ln(V)','5_ln(V)','9_ln(V)','1_Cauchy']).issubset(set(table.labels)): - print 'data missing in direction %s'%str(delta_angle) - table.data_readArray(['%i_Cauchy'%(i+1) for i in xrange(9)]+['%i_ln(V)'%(i+1) for i in xrange(9)]) - line, lines = 0, np.shape(table.data)[0] - aniso_thres = {} - for threshold in thresStrain: - while line < lines: - if abs(table.data[line,9])>= threshold: # 1_ln(V), e_xx - upper,lower = abs(table.data[line,9]),abs(table.data[line-1,9]) # values for linear interpolation - interplate = lambda x_d, x_u : x_d * (upper-threshold)/(upper-lower) + x_u * (threshold-lower)/(upper-lower) - e_yy = interplate (table.data[line-1,13], table.data[line,13]) - e_zz = interplate (table.data[line-1,17], table.data[line,17]) - s_xx = interplate (table.data[line-1,0 ], table.data[line,0 ]) - aniso_thres[str(threshold)] = [e_yy/e_zz, s_xx] - break - else: - line+=1 - anisotropy[file_angle] = aniso_thres - -f = open('./anisotropy.txt','w') -f.write('4 header \n') -f.write('#the first row mean the threshold strain e_xx \n#the first column means loading directions \n') -f.write('#none means the data is unavailable\n# \n') -title = ['*R values (Lankford coefficients) \n', '# \n*Normalized yield stress \n'] -for i in xrange(2): - f.write(title[i]) - f.write(' '*10+len(thresStrain)*'%-12.4f'%tuple(thresStrain)+'\n') - for j,delta_angle in enumerate(np.linspace(0,90,options.number)): - if len(str(delta_angle)) > 5: - file_angle = str(delta_angle)[:5] - else: - file_angle = str(delta_angle) - - if file_angle in anisotropy.keys(): - aniso_dic_ang = anisotropy[file_angle] - aniso_list_ang_strain = []; writeformat = '' - for threshold in thresStrain: - if str(threshold) in aniso_dic_ang.keys(): - if i == 1: # extract the normalized stress - aniso = aniso_dic_ang[str(threshold)][i]/anisotropy['0.0'][str(threshold)][i] - else: # extract r value - aniso = aniso_dic_ang[str(threshold)][i] - aniso_list_ang_strain.append(aniso) - writeformat = writeformat+'%-12.6f' - else: - aniso_list_ang_strain.append('none') - writeformat = writeformat+'%-12s' - f.write('%-10s'%file_angle + writeformat%(tuple(aniso_list_ang_strain))+'\n') -f.close() From 40414c767cc213ee0bbd44930bb6256a427a51c0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 20:24:43 +0200 Subject: [PATCH 029/139] like ang_toTable (not sure if both are needed anyway) --- .../table_fromOIMgrainFile.py => misc/OIMgrainFile_toTable.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename processing/{pre/table_fromOIMgrainFile.py => misc/OIMgrainFile_toTable.py} (100%) diff --git a/processing/pre/table_fromOIMgrainFile.py b/processing/misc/OIMgrainFile_toTable.py similarity index 100% rename from processing/pre/table_fromOIMgrainFile.py rename to processing/misc/OIMgrainFile_toTable.py From c5dba6065420b972bd399f95648eb263f5c11ab2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Jul 2016 21:03:34 +0200 Subject: [PATCH 030/139] need to unset "set" (seems to be a common function) --- DAMASK_env.sh | 1 + DAMASK_env.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/DAMASK_env.sh b/DAMASK_env.sh index f217a7d63..8536a36ca 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -15,6 +15,7 @@ set() { export $1$2$3 } source $DAMASK_ROOT/CONFIG +unset -f set # if DAMASK_BIN is present and not in $PATH, add it if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index dcb93dc4a..e434a97cf 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -13,6 +13,7 @@ set() { export $1$2$3 } source $DAMASK_ROOT/CONFIG +unset -f set # if DAMASK_BIN is present and not in $PATH, add it MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:` From 9441ee732651fe98358c7c86641be9f929dc28c2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 16 Jul 2016 09:36:15 +0200 Subject: [PATCH 031/139] removed obsolete root relation --- lib/damask/solver/marc.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/damask/solver/marc.py b/lib/damask/solver/marc.py index e693783f6..a3e75ca01 100644 --- a/lib/damask/solver/marc.py +++ b/lib/damask/solver/marc.py @@ -20,10 +20,10 @@ class Marc(Solver): #-------------------------- - def version(self,rootRelation = ''): + def version(self): import os,damask.environment - MSCpath = damask.environment.Environment(rootRelation).options['MSC_ROOT'] + MSCpath = damask.environment.Environment().options['MSC_ROOT'] for release,subdirs in sorted(self.releases.items(),reverse=True): for subdir in subdirs: @@ -35,10 +35,10 @@ class Marc(Solver): #-------------------------- - def libraryPath(self,rootRelation = '',releases = []): + def libraryPath(self,releases = []): import os,damask.environment - MSCpath = damask.environment.Environment(rootRelation).options['MSC_ROOT'] + MSCpath = damask.environment.Environment().options['MSC_ROOT'] if len(releases) == 0: releases = self.releases.keys() if type(releases) is not list: releases = [releases] @@ -53,12 +53,12 @@ class Marc(Solver): #-------------------------- - def toolsPath(self,rootRelation = '',release = ''): + def toolsPath(self,release = ''): import os,damask.environment - MSCpath = damask.environment.Environment(rootRelation).options['MSC_ROOT'] + MSCpath = damask.environment.Environment().options['MSC_ROOT'] - if len(release) == 0: release = self.version(rootRelation) + if len(release) == 0: release = self.version() path = '%s/marc%s/tools'%(MSCpath,release) if os.path.exists(path): return path else: return '' @@ -66,7 +66,6 @@ class Marc(Solver): #-------------------------- def submit_job(self, - rootRelation = '', release = '', model = 'model', job = 'job1', @@ -79,13 +78,13 @@ class Marc(Solver): import os,damask.environment import subprocess,shlex - if len(release) == 0: release = self.version(rootRelation) + if len(release) == 0: release = self.version() if release not in self.releases: raise Exception("Unknown MSC.Marc Version %s"%release) - damaskEnv = damask.environment.Environment(rootRelation) + damaskEnv = damask.environment.Environment() user = os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc') # might be updated if special version (symlink) is found if compile: @@ -99,7 +98,7 @@ class Marc(Solver): script = 'run_damask%s'%({False:'',True:'_'}[optimization!='' or openMP]) script = script+'%s%s'%({False:'',True:optimization}[optimization!=''],{False:'',True:'mp'}[openMP]) - cmd = os.path.join(self.toolsPath(rootRelation,release),script) + \ + cmd = os.path.join(self.toolsPath(release),script) + \ ' -jid ' + model + '_' + job + \ ' -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no' From 0c2b7782d4659808c043fb3acfae924fd384b72d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 17 Jul 2016 18:18:57 +0200 Subject: [PATCH 032/139] reporting correct ID --- processing/post/postResults.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 28a2b40ac..cfbd50aa0 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -1060,8 +1060,7 @@ for incCount,position in enumerate(locations): # walk through locations file = open(outFilename,'w') fileOpen = True file.write('2\theader\n') - file.write(string.replace('$Id$','\n','\\n')+ - '\t' + ' '.join(sys.argv[1:]) + '\n') + file.write(scriptID + '\t' + ' '.join(sys.argv[1:])) headerWritten = False file.flush() From 1b30b186f44e7e4d082bc494924fe91d14b70ad7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Jul 2016 06:17:22 +0200 Subject: [PATCH 033/139] rootRelation keyword was still used --- processing/post/mentat_colorMap.py | 2 +- processing/post/postResults.py | 2 +- processing/pre/mentat_pbcOnBoxMesh.py | 2 +- processing/pre/mentat_spectralBox.py | 2 +- processing/pre/patchFromReconstructedBoundaries.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/processing/post/mentat_colorMap.py b/processing/post/mentat_colorMap.py index 79ea35a39..b72f48afe 100755 --- a/processing/post/mentat_colorMap.py +++ b/processing/post/mentat_colorMap.py @@ -126,7 +126,7 @@ elif options.palette: for theColor in theMap.export(format='list',steps=options.colorcount): print '\t'.join(map(lambda x: str(int(255*x)),theColor)) else: # connect to Mentat and change colorMap - sys.path.append(damask.solver.Marc().libraryPath('../../')) + sys.path.append(damask.solver.Marc().libraryPath()) try: import py_mentat print 'waiting to connect...' diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 28a2b40ac..df32398f7 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -765,7 +765,7 @@ if options.filetype not in ['marc','spectral']: parser.error('file type "%s" not supported...'%options.filetype) if options.filetype == 'marc': - sys.path.append(damask.solver.Marc().libraryPath('../../')) + sys.path.append(damask.solver.Marc().libraryPath()) try: from py_post import post_open diff --git a/processing/pre/mentat_pbcOnBoxMesh.py b/processing/pre/mentat_pbcOnBoxMesh.py index d355639e2..b35d9ab62 100755 --- a/processing/pre/mentat_pbcOnBoxMesh.py +++ b/processing/pre/mentat_pbcOnBoxMesh.py @@ -9,7 +9,7 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -sys.path.append(damask.solver.Marc().libraryPath('../../')) +sys.path.append(damask.solver.Marc().libraryPath()) active=[True,True,True] # directions on which to add PBC def outMentat(cmd,locals): diff --git a/processing/pre/mentat_spectralBox.py b/processing/pre/mentat_spectralBox.py index 770db1279..6ff6e51d7 100755 --- a/processing/pre/mentat_spectralBox.py +++ b/processing/pre/mentat_spectralBox.py @@ -8,7 +8,7 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -sys.path.append(damask.solver.Marc().libraryPath('../../')) +sys.path.append(damask.solver.Marc().libraryPath()) #------------------------------------------------------------------------------------------------- def outMentat(cmd,locals): diff --git a/processing/pre/patchFromReconstructedBoundaries.py b/processing/pre/patchFromReconstructedBoundaries.py index f0c68b5f7..9167c7398 100755 --- a/processing/pre/patchFromReconstructedBoundaries.py +++ b/processing/pre/patchFromReconstructedBoundaries.py @@ -15,7 +15,7 @@ try: # check for Python Image Lib except: ImageCapability = False -sys.path.append(damask.solver.Marc().libraryPath('../../')) +sys.path.append(damask.solver.Marc().libraryPath()) try: # check for MSC.Mentat Python interface import py_mentat From 95182dac796f8809bd739521af229d6aee1ad035 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Jul 2016 11:20:23 +0200 Subject: [PATCH 034/139] avoid windows name conflict + and (hopefully) more descriptive name and location --- {config => examples/ConfigFiles}/Crystallite_All.config | 0 {config => examples/ConfigFiles}/Crystallite_None.config | 0 .../ConfigFiles}/Crystallite_aLittleSomething.config | 0 .../ConfigFiles}/Homogenization_Damage_NonLocal.config | 0 .../ConfigFiles}/Homogenization_HydrogenFlux_CahnHilliard.config | 0 .../ConfigFiles}/Homogenization_Isostrain_Parallel3.config | 0 .../ConfigFiles}/Homogenization_Isostrain_SX.config | 0 .../ConfigFiles}/Homogenization_Isostrain_Taylor2.config | 0 {config => examples/ConfigFiles}/Homogenization_None_Dummy.config | 0 .../ConfigFiles}/Homogenization_Porosity_PhaseField.config | 0 .../ConfigFiles}/Homogenization_RGC_8Grains.config | 0 .../ConfigFiles}/Homogenization_Thermal_Conduction.config | 0 .../ConfigFiles}/Homogenization_VacancyFlux_CahnHilliard.config | 0 {config => examples/ConfigFiles}/Homogenization_multiField.config | 0 .../ConfigFiles}/Kinematics_Hydrogen_Strain.config | 0 .../ConfigFiles}/Kinematics_Thermal_Expansion.config | 0 {config => examples/ConfigFiles}/Kinematics_Vacancy_Strain.config | 0 {config => examples/ConfigFiles}/Microstructure_DP_Steel.config | 0 .../ConfigFiles}/Microstructure_ElementHomogeneous.config | 0 {config => examples/ConfigFiles}/Phase_Damage.config | 0 {config => examples/ConfigFiles}/Phase_DisloUCLA_Tungsten.config | 0 .../ConfigFiles}/Phase_Dislotwin_TWIP-Steel-FeMnC.config | 0 {config => examples/ConfigFiles}/Phase_Dislotwin_Tungsten.config | 0 {config => examples/ConfigFiles}/Phase_Hydrogen.config | 0 .../ConfigFiles}/Phase_Isotropic_AluminumIsotropic.config | 0 .../ConfigFiles}/Phase_None_IsotropicVolumePreservation.config | 0 {config => examples/ConfigFiles}/Phase_None_Orthorombic.config | 0 {config => examples/ConfigFiles}/Phase_Nonlocal_Aluminum.config | 0 .../ConfigFiles}/Phase_Phenopowerlaw_Aluminum.config | 0 .../ConfigFiles}/Phase_Phenopowerlaw_BCC-Ferrite.config | 0 .../ConfigFiles}/Phase_Phenopowerlaw_BCC-Martensite.config | 0 {config => examples/ConfigFiles}/Phase_Phenopowerlaw_Gold.config | 0 .../ConfigFiles}/Phase_Phenopowerlaw_Magnesium.config | 0 .../ConfigFiles}/Phase_Phenopowerlaw_cpTi-alpha.config | 0 .../ConfigFiles}/Phase_Phenopowerlaw_multiField.config | 0 {config => examples/ConfigFiles}/Phase_Porosity.config | 0 {config => examples/ConfigFiles}/Phase_Thermal.config | 0 {config => examples/ConfigFiles}/Phase_Vacancy.config | 0 {config => examples/ConfigFiles}/Source_Damage_IsoBrittle.config | 0 .../ConfigFiles}/Source_Thermal_Dissipation.config | 0 .../ConfigFiles}/Source_Vacancy_Irradiation.config | 0 .../ConfigFiles}/Source_Vacancy_PhenoPlasticity.config | 0 {config => examples/ConfigFiles}/Texture_FiberExample.config | 0 {config => examples/ConfigFiles}/Texture_Gauss_001.config | 0 {config => examples/ConfigFiles}/Texture_Gauss_101.config | 0 {config => examples/ConfigFiles}/Texture_Gauss_111.config | 0 {config => examples/ConfigFiles}/Texture_Gauss_123.config | 0 .../ConfigFiles}/Texture_RandomSingleCrystals.config | 0 {config => examples/ConfigFiles}/Texture_Rolling.config | 0 {config => examples/ConfigFiles}/debug.config | 0 {config => examples/ConfigFiles}/material.config | 0 {config => examples/ConfigFiles}/numerics.config | 0 {config => examples/ConfigFiles}/rollingTexture.linearODF | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename {config => examples/ConfigFiles}/Crystallite_All.config (100%) rename {config => examples/ConfigFiles}/Crystallite_None.config (100%) rename {config => examples/ConfigFiles}/Crystallite_aLittleSomething.config (100%) rename {config => examples/ConfigFiles}/Homogenization_Damage_NonLocal.config (100%) rename {config => examples/ConfigFiles}/Homogenization_HydrogenFlux_CahnHilliard.config (100%) rename {config => examples/ConfigFiles}/Homogenization_Isostrain_Parallel3.config (100%) rename {config => examples/ConfigFiles}/Homogenization_Isostrain_SX.config (100%) rename {config => examples/ConfigFiles}/Homogenization_Isostrain_Taylor2.config (100%) rename {config => examples/ConfigFiles}/Homogenization_None_Dummy.config (100%) rename {config => examples/ConfigFiles}/Homogenization_Porosity_PhaseField.config (100%) rename {config => examples/ConfigFiles}/Homogenization_RGC_8Grains.config (100%) rename {config => examples/ConfigFiles}/Homogenization_Thermal_Conduction.config (100%) rename {config => examples/ConfigFiles}/Homogenization_VacancyFlux_CahnHilliard.config (100%) rename {config => examples/ConfigFiles}/Homogenization_multiField.config (100%) rename {config => examples/ConfigFiles}/Kinematics_Hydrogen_Strain.config (100%) rename {config => examples/ConfigFiles}/Kinematics_Thermal_Expansion.config (100%) rename {config => examples/ConfigFiles}/Kinematics_Vacancy_Strain.config (100%) rename {config => examples/ConfigFiles}/Microstructure_DP_Steel.config (100%) rename {config => examples/ConfigFiles}/Microstructure_ElementHomogeneous.config (100%) rename {config => examples/ConfigFiles}/Phase_Damage.config (100%) rename {config => examples/ConfigFiles}/Phase_DisloUCLA_Tungsten.config (100%) rename {config => examples/ConfigFiles}/Phase_Dislotwin_TWIP-Steel-FeMnC.config (100%) rename {config => examples/ConfigFiles}/Phase_Dislotwin_Tungsten.config (100%) rename {config => examples/ConfigFiles}/Phase_Hydrogen.config (100%) rename {config => examples/ConfigFiles}/Phase_Isotropic_AluminumIsotropic.config (100%) rename {config => examples/ConfigFiles}/Phase_None_IsotropicVolumePreservation.config (100%) rename {config => examples/ConfigFiles}/Phase_None_Orthorombic.config (100%) rename {config => examples/ConfigFiles}/Phase_Nonlocal_Aluminum.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_Aluminum.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_BCC-Ferrite.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_BCC-Martensite.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_Gold.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_Magnesium.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_cpTi-alpha.config (100%) rename {config => examples/ConfigFiles}/Phase_Phenopowerlaw_multiField.config (100%) rename {config => examples/ConfigFiles}/Phase_Porosity.config (100%) rename {config => examples/ConfigFiles}/Phase_Thermal.config (100%) rename {config => examples/ConfigFiles}/Phase_Vacancy.config (100%) rename {config => examples/ConfigFiles}/Source_Damage_IsoBrittle.config (100%) rename {config => examples/ConfigFiles}/Source_Thermal_Dissipation.config (100%) rename {config => examples/ConfigFiles}/Source_Vacancy_Irradiation.config (100%) rename {config => examples/ConfigFiles}/Source_Vacancy_PhenoPlasticity.config (100%) rename {config => examples/ConfigFiles}/Texture_FiberExample.config (100%) rename {config => examples/ConfigFiles}/Texture_Gauss_001.config (100%) rename {config => examples/ConfigFiles}/Texture_Gauss_101.config (100%) rename {config => examples/ConfigFiles}/Texture_Gauss_111.config (100%) rename {config => examples/ConfigFiles}/Texture_Gauss_123.config (100%) rename {config => examples/ConfigFiles}/Texture_RandomSingleCrystals.config (100%) rename {config => examples/ConfigFiles}/Texture_Rolling.config (100%) rename {config => examples/ConfigFiles}/debug.config (100%) rename {config => examples/ConfigFiles}/material.config (100%) rename {config => examples/ConfigFiles}/numerics.config (100%) rename {config => examples/ConfigFiles}/rollingTexture.linearODF (100%) diff --git a/config/Crystallite_All.config b/examples/ConfigFiles/Crystallite_All.config similarity index 100% rename from config/Crystallite_All.config rename to examples/ConfigFiles/Crystallite_All.config diff --git a/config/Crystallite_None.config b/examples/ConfigFiles/Crystallite_None.config similarity index 100% rename from config/Crystallite_None.config rename to examples/ConfigFiles/Crystallite_None.config diff --git a/config/Crystallite_aLittleSomething.config b/examples/ConfigFiles/Crystallite_aLittleSomething.config similarity index 100% rename from config/Crystallite_aLittleSomething.config rename to examples/ConfigFiles/Crystallite_aLittleSomething.config diff --git a/config/Homogenization_Damage_NonLocal.config b/examples/ConfigFiles/Homogenization_Damage_NonLocal.config similarity index 100% rename from config/Homogenization_Damage_NonLocal.config rename to examples/ConfigFiles/Homogenization_Damage_NonLocal.config diff --git a/config/Homogenization_HydrogenFlux_CahnHilliard.config b/examples/ConfigFiles/Homogenization_HydrogenFlux_CahnHilliard.config similarity index 100% rename from config/Homogenization_HydrogenFlux_CahnHilliard.config rename to examples/ConfigFiles/Homogenization_HydrogenFlux_CahnHilliard.config diff --git a/config/Homogenization_Isostrain_Parallel3.config b/examples/ConfigFiles/Homogenization_Isostrain_Parallel3.config similarity index 100% rename from config/Homogenization_Isostrain_Parallel3.config rename to examples/ConfigFiles/Homogenization_Isostrain_Parallel3.config diff --git a/config/Homogenization_Isostrain_SX.config b/examples/ConfigFiles/Homogenization_Isostrain_SX.config similarity index 100% rename from config/Homogenization_Isostrain_SX.config rename to examples/ConfigFiles/Homogenization_Isostrain_SX.config diff --git a/config/Homogenization_Isostrain_Taylor2.config b/examples/ConfigFiles/Homogenization_Isostrain_Taylor2.config similarity index 100% rename from config/Homogenization_Isostrain_Taylor2.config rename to examples/ConfigFiles/Homogenization_Isostrain_Taylor2.config diff --git a/config/Homogenization_None_Dummy.config b/examples/ConfigFiles/Homogenization_None_Dummy.config similarity index 100% rename from config/Homogenization_None_Dummy.config rename to examples/ConfigFiles/Homogenization_None_Dummy.config diff --git a/config/Homogenization_Porosity_PhaseField.config b/examples/ConfigFiles/Homogenization_Porosity_PhaseField.config similarity index 100% rename from config/Homogenization_Porosity_PhaseField.config rename to examples/ConfigFiles/Homogenization_Porosity_PhaseField.config diff --git a/config/Homogenization_RGC_8Grains.config b/examples/ConfigFiles/Homogenization_RGC_8Grains.config similarity index 100% rename from config/Homogenization_RGC_8Grains.config rename to examples/ConfigFiles/Homogenization_RGC_8Grains.config diff --git a/config/Homogenization_Thermal_Conduction.config b/examples/ConfigFiles/Homogenization_Thermal_Conduction.config similarity index 100% rename from config/Homogenization_Thermal_Conduction.config rename to examples/ConfigFiles/Homogenization_Thermal_Conduction.config diff --git a/config/Homogenization_VacancyFlux_CahnHilliard.config b/examples/ConfigFiles/Homogenization_VacancyFlux_CahnHilliard.config similarity index 100% rename from config/Homogenization_VacancyFlux_CahnHilliard.config rename to examples/ConfigFiles/Homogenization_VacancyFlux_CahnHilliard.config diff --git a/config/Homogenization_multiField.config b/examples/ConfigFiles/Homogenization_multiField.config similarity index 100% rename from config/Homogenization_multiField.config rename to examples/ConfigFiles/Homogenization_multiField.config diff --git a/config/Kinematics_Hydrogen_Strain.config b/examples/ConfigFiles/Kinematics_Hydrogen_Strain.config similarity index 100% rename from config/Kinematics_Hydrogen_Strain.config rename to examples/ConfigFiles/Kinematics_Hydrogen_Strain.config diff --git a/config/Kinematics_Thermal_Expansion.config b/examples/ConfigFiles/Kinematics_Thermal_Expansion.config similarity index 100% rename from config/Kinematics_Thermal_Expansion.config rename to examples/ConfigFiles/Kinematics_Thermal_Expansion.config diff --git a/config/Kinematics_Vacancy_Strain.config b/examples/ConfigFiles/Kinematics_Vacancy_Strain.config similarity index 100% rename from config/Kinematics_Vacancy_Strain.config rename to examples/ConfigFiles/Kinematics_Vacancy_Strain.config diff --git a/config/Microstructure_DP_Steel.config b/examples/ConfigFiles/Microstructure_DP_Steel.config similarity index 100% rename from config/Microstructure_DP_Steel.config rename to examples/ConfigFiles/Microstructure_DP_Steel.config diff --git a/config/Microstructure_ElementHomogeneous.config b/examples/ConfigFiles/Microstructure_ElementHomogeneous.config similarity index 100% rename from config/Microstructure_ElementHomogeneous.config rename to examples/ConfigFiles/Microstructure_ElementHomogeneous.config diff --git a/config/Phase_Damage.config b/examples/ConfigFiles/Phase_Damage.config similarity index 100% rename from config/Phase_Damage.config rename to examples/ConfigFiles/Phase_Damage.config diff --git a/config/Phase_DisloUCLA_Tungsten.config b/examples/ConfigFiles/Phase_DisloUCLA_Tungsten.config similarity index 100% rename from config/Phase_DisloUCLA_Tungsten.config rename to examples/ConfigFiles/Phase_DisloUCLA_Tungsten.config diff --git a/config/Phase_Dislotwin_TWIP-Steel-FeMnC.config b/examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config similarity index 100% rename from config/Phase_Dislotwin_TWIP-Steel-FeMnC.config rename to examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config diff --git a/config/Phase_Dislotwin_Tungsten.config b/examples/ConfigFiles/Phase_Dislotwin_Tungsten.config similarity index 100% rename from config/Phase_Dislotwin_Tungsten.config rename to examples/ConfigFiles/Phase_Dislotwin_Tungsten.config diff --git a/config/Phase_Hydrogen.config b/examples/ConfigFiles/Phase_Hydrogen.config similarity index 100% rename from config/Phase_Hydrogen.config rename to examples/ConfigFiles/Phase_Hydrogen.config diff --git a/config/Phase_Isotropic_AluminumIsotropic.config b/examples/ConfigFiles/Phase_Isotropic_AluminumIsotropic.config similarity index 100% rename from config/Phase_Isotropic_AluminumIsotropic.config rename to examples/ConfigFiles/Phase_Isotropic_AluminumIsotropic.config diff --git a/config/Phase_None_IsotropicVolumePreservation.config b/examples/ConfigFiles/Phase_None_IsotropicVolumePreservation.config similarity index 100% rename from config/Phase_None_IsotropicVolumePreservation.config rename to examples/ConfigFiles/Phase_None_IsotropicVolumePreservation.config diff --git a/config/Phase_None_Orthorombic.config b/examples/ConfigFiles/Phase_None_Orthorombic.config similarity index 100% rename from config/Phase_None_Orthorombic.config rename to examples/ConfigFiles/Phase_None_Orthorombic.config diff --git a/config/Phase_Nonlocal_Aluminum.config b/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config similarity index 100% rename from config/Phase_Nonlocal_Aluminum.config rename to examples/ConfigFiles/Phase_Nonlocal_Aluminum.config diff --git a/config/Phase_Phenopowerlaw_Aluminum.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config similarity index 100% rename from config/Phase_Phenopowerlaw_Aluminum.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config diff --git a/config/Phase_Phenopowerlaw_BCC-Ferrite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config similarity index 100% rename from config/Phase_Phenopowerlaw_BCC-Ferrite.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config diff --git a/config/Phase_Phenopowerlaw_BCC-Martensite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config similarity index 100% rename from config/Phase_Phenopowerlaw_BCC-Martensite.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config diff --git a/config/Phase_Phenopowerlaw_Gold.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config similarity index 100% rename from config/Phase_Phenopowerlaw_Gold.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config diff --git a/config/Phase_Phenopowerlaw_Magnesium.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config similarity index 100% rename from config/Phase_Phenopowerlaw_Magnesium.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config diff --git a/config/Phase_Phenopowerlaw_cpTi-alpha.config b/examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config similarity index 100% rename from config/Phase_Phenopowerlaw_cpTi-alpha.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config diff --git a/config/Phase_Phenopowerlaw_multiField.config b/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config similarity index 100% rename from config/Phase_Phenopowerlaw_multiField.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config diff --git a/config/Phase_Porosity.config b/examples/ConfigFiles/Phase_Porosity.config similarity index 100% rename from config/Phase_Porosity.config rename to examples/ConfigFiles/Phase_Porosity.config diff --git a/config/Phase_Thermal.config b/examples/ConfigFiles/Phase_Thermal.config similarity index 100% rename from config/Phase_Thermal.config rename to examples/ConfigFiles/Phase_Thermal.config diff --git a/config/Phase_Vacancy.config b/examples/ConfigFiles/Phase_Vacancy.config similarity index 100% rename from config/Phase_Vacancy.config rename to examples/ConfigFiles/Phase_Vacancy.config diff --git a/config/Source_Damage_IsoBrittle.config b/examples/ConfigFiles/Source_Damage_IsoBrittle.config similarity index 100% rename from config/Source_Damage_IsoBrittle.config rename to examples/ConfigFiles/Source_Damage_IsoBrittle.config diff --git a/config/Source_Thermal_Dissipation.config b/examples/ConfigFiles/Source_Thermal_Dissipation.config similarity index 100% rename from config/Source_Thermal_Dissipation.config rename to examples/ConfigFiles/Source_Thermal_Dissipation.config diff --git a/config/Source_Vacancy_Irradiation.config b/examples/ConfigFiles/Source_Vacancy_Irradiation.config similarity index 100% rename from config/Source_Vacancy_Irradiation.config rename to examples/ConfigFiles/Source_Vacancy_Irradiation.config diff --git a/config/Source_Vacancy_PhenoPlasticity.config b/examples/ConfigFiles/Source_Vacancy_PhenoPlasticity.config similarity index 100% rename from config/Source_Vacancy_PhenoPlasticity.config rename to examples/ConfigFiles/Source_Vacancy_PhenoPlasticity.config diff --git a/config/Texture_FiberExample.config b/examples/ConfigFiles/Texture_FiberExample.config similarity index 100% rename from config/Texture_FiberExample.config rename to examples/ConfigFiles/Texture_FiberExample.config diff --git a/config/Texture_Gauss_001.config b/examples/ConfigFiles/Texture_Gauss_001.config similarity index 100% rename from config/Texture_Gauss_001.config rename to examples/ConfigFiles/Texture_Gauss_001.config diff --git a/config/Texture_Gauss_101.config b/examples/ConfigFiles/Texture_Gauss_101.config similarity index 100% rename from config/Texture_Gauss_101.config rename to examples/ConfigFiles/Texture_Gauss_101.config diff --git a/config/Texture_Gauss_111.config b/examples/ConfigFiles/Texture_Gauss_111.config similarity index 100% rename from config/Texture_Gauss_111.config rename to examples/ConfigFiles/Texture_Gauss_111.config diff --git a/config/Texture_Gauss_123.config b/examples/ConfigFiles/Texture_Gauss_123.config similarity index 100% rename from config/Texture_Gauss_123.config rename to examples/ConfigFiles/Texture_Gauss_123.config diff --git a/config/Texture_RandomSingleCrystals.config b/examples/ConfigFiles/Texture_RandomSingleCrystals.config similarity index 100% rename from config/Texture_RandomSingleCrystals.config rename to examples/ConfigFiles/Texture_RandomSingleCrystals.config diff --git a/config/Texture_Rolling.config b/examples/ConfigFiles/Texture_Rolling.config similarity index 100% rename from config/Texture_Rolling.config rename to examples/ConfigFiles/Texture_Rolling.config diff --git a/config/debug.config b/examples/ConfigFiles/debug.config similarity index 100% rename from config/debug.config rename to examples/ConfigFiles/debug.config diff --git a/config/material.config b/examples/ConfigFiles/material.config similarity index 100% rename from config/material.config rename to examples/ConfigFiles/material.config diff --git a/config/numerics.config b/examples/ConfigFiles/numerics.config similarity index 100% rename from config/numerics.config rename to examples/ConfigFiles/numerics.config diff --git a/config/rollingTexture.linearODF b/examples/ConfigFiles/rollingTexture.linearODF similarity index 100% rename from config/rollingTexture.linearODF rename to examples/ConfigFiles/rollingTexture.linearODF From 325e153d3dbb9e724f0179c14142dd87f6f5bcc3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Jul 2016 11:22:53 +0200 Subject: [PATCH 035/139] import of string not needed --- processing/post/postResults.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 076d9526e..c81f561d5 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2 # -*- coding: UTF-8 no BOM -*- -import os,sys,math,re,time,struct,string +import os,sys,math,re,time,struct import damask from optparse import OptionParser, OptionGroup From 3305cae220aa7909ac1296cb054365a5debe8d0d Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Mon, 18 Jul 2016 13:03:23 +0200 Subject: [PATCH 036/139] now also corrected calculation of gamma_dot in postresults --- code/plastic_phenopowerlaw.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/plastic_phenopowerlaw.f90 b/code/plastic_phenopowerlaw.f90 index 28a8946c8..12debbb23 100644 --- a/code/plastic_phenopowerlaw.f90 +++ b/code/plastic_phenopowerlaw.f90 @@ -1160,9 +1160,9 @@ function plastic_phenopowerlaw_postResults(Tstar_v,ipc,ip,el) enddo plastic_phenopowerlaw_postResults(c+j) = plastic_phenopowerlaw_gdot0_slip(instance)*0.5_pReal* & ((abs(tau_slip_pos)/plasticState(ph)%state(j,of))**plastic_phenopowerlaw_n_slip(instance) & - +(abs(tau_slip_neg)/plasticState(ph)%state(j,of))**plastic_phenopowerlaw_n_slip(instance))& - *sign(1.0_pReal,tau_slip_pos) - + *sign(1.0_pReal,tau_slip_pos) & + +(abs(tau_slip_neg)/(plasticState(ph)%state(j,of)))**plastic_phenopowerlaw_n_slip(instance) & + *sign(1.0_pReal,tau_slip_neg)) enddo slipSystems1 enddo slipFamilies1 c = c + nSlip From bb5070b52fc968686f012fa83a139aa27cc575a3 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 18 Jul 2016 10:20:39 -0400 Subject: [PATCH 037/139] util.report without mandatory arguments reporting can now omit either "who" or "what". cleaner output in case of no "who"... --- lib/damask/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index ef2de48eb..cfc44f26c 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -49,9 +49,10 @@ def croak(what, newline = True): sys.stderr.flush() # ----------------------------- -def report(who,what): +def report(who = None, + what = None): """reports script and file name""" - croak( (emph(who) if who else '') + (': '+what if what else '') ) + croak( (emph(who)+': ' if who else '') + (what if what else '') ) # ----------------------------- From 0571ca4d66e23cc32132b496369212d0233177ae Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 18 Jul 2016 16:45:06 +0200 Subject: [PATCH 038/139] updated version information after successful test of v2.0.0-385-g1b30b18 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e7c04b3f7..9b8617d3b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.0-350-g7d84b99 +v2.0.0-385-g1b30b18 From 0a2d5e4c2a0d2bd41101be2375632cf1e20c92c5 Mon Sep 17 00:00:00 2001 From: zhangc43 Date: Mon, 18 Jul 2016 12:29:12 -0400 Subject: [PATCH 039/139] add missing newline to header for postResult --- processing/post/postResults.py | 174 ++++++++++++++++----------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index c81f561d5..e01a27044 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -18,7 +18,7 @@ fileExtensions = { \ # ----------------------------- class vector: # mimic py_post node object x,y,z = [None,None,None] - + def __init__(self,coords): self.x = coords[0] self.y = coords[1] @@ -102,7 +102,7 @@ class MPIEspectral_result: # mimic py_post result object self._frequencies = self._keyedPackedArray('frequencies:',count=self.N_loadcases,type='i') if all ( i is None for i in self._frequencies): self._frequencies = self._keyedPackedArray('frequencies',count=self.N_loadcases,type='i') - + self._increments = self._keyedPackedArray('increments:',count=self.N_loadcases,type='i') if all (i is None for i in self._increments): self._increments = self._keyedPackedArray('increments',count=self.N_loadcases,type='i') @@ -111,7 +111,7 @@ class MPIEspectral_result: # mimic py_post result object if self.startingIncrement is None: self.startingIncrement = self._keyedPackedArray('startingIncrement',count=1,type='i')[0] - + self._times = self._keyedPackedArray('times:',count=self.N_loadcases,type='d') if all (i is None for i in self._times): self._times = self._keyedPackedArray('times',count=self.N_loadcases,type='d') @@ -119,15 +119,15 @@ class MPIEspectral_result: # mimic py_post result object self._logscales = self._keyedPackedArray('logscales:',count=self.N_loadcases,type='i') if all (i is None for i in self._logscales): self._logscales = self._keyedPackedArray('logscales',count=self.N_loadcases,type='i') - + self.size = self._keyedPackedArray('size:',count=3,type='d') if self.size == [None,None,None]: # no 'size' found, try legacy alias 'dimension' self.size = self._keyedPackedArray('dimension',count=3,type='d') - + self.grid = self._keyedPackedArray('grid:',count=3,type='i') if self.grid == [None,None,None]: # no 'grid' found, try legacy alias 'resolution' self.grid = self._keyedPackedArray('resolution',count=3,type='i') - + self.N_nodes = (self.grid[0]+1)*(self.grid[1]+1)*(self.grid[2]+1) self.N_elements = self.grid[0] * self.grid[1] * self.grid[2] @@ -139,7 +139,7 @@ class MPIEspectral_result: # mimic py_post result object self.N_increments = 1 # add zero'th entry for i in range(self.N_loadcases): self.N_increments += self._increments[i]//self._frequencies[i] - + # parameters for file handling depending on output format if options.legacy: @@ -176,17 +176,17 @@ class MPIEspectral_result: # mimic py_post result object name = '' filepos=0 # start at the beginning while name != identifier and filepos < self.dataOffset: # stop searching when found or when reached end of header - self.file.seek(filepos) + self.file.seek(filepos) # read the starting tag in front of the keyword (Fortran indicates start and end of writing by a 4 byte tag indicating the length of the following data) dataLen=struct.unpack('i',self.file.read(4))[0] name = self.file.read(len(identifier)) # anticipate identifier - start=filepos+(4+len(identifier)) # position of the values for the found key + start=filepos+(4+len(identifier)) # position of the values for the found key filepos=filepos+(4+dataLen+4) # forward to next keyword - + if name==identifier: # found the correct name key['pos'] = start # save position key['name'] = name - return key + return key def _keyedPackedArray(self,identifier,count = 3,type = 'd',default = None): bytecount = {'d': 8,'i': 4} @@ -251,10 +251,10 @@ class MPIEspectral_result: # mimic py_post result object def element_sequence(self,e): return e-1 - + def element_id(self,e): return e+1 - + def element(self,e): a = self.grid[0]+1 b = self.grid[1]+1 @@ -291,7 +291,7 @@ class MPIEspectral_result: # mimic py_post result object print 'seeking',incStart+where print 'e',e,'idx',idx sys.exit(1) - + else: self.fourByteLimit = 2**31 -1 -8 # header & footer + extra header and footer for 4 byte int range (Fortran) @@ -309,7 +309,7 @@ class MPIEspectral_result: # mimic py_post result object data += self.file.read(1) where += 1 value = struct.unpack('d',data)[0] - else: + else: self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4) value = struct.unpack('d',self.file.read(8))[0] except: @@ -328,39 +328,39 @@ class MPIEspectral_result: # mimic py_post result object # ----------------------------- def ipCoords(elemType, nodalCoordinates): """returns IP coordinates for a given element""" - nodeWeightsPerNode = { - 7: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], - [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], - [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], - [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], - [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], - [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], - [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], - [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], - 57: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], - [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], - [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], - [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], - [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], - [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], - [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], - [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], - 117: [ [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ], + nodeWeightsPerNode = { + 7: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], + [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], + [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], + [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], + [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], + [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], + [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], + [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], + 57: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], + [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], + [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], + [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], + [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], + [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], + [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], + [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], + 117: [ [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ], 125: [ [ 3.0, 0.0, 0.0, 4.0, 1.0, 4.0], [ 0.0, 3.0, 0.0, 4.0, 4.0, 1.0], - [ 0.0, 0.0, 3.0, 1.0, 4.0, 4.0],], + [ 0.0, 0.0, 3.0, 1.0, 4.0, 4.0],], 127: [ [ 45.0, 17.0, 17.0, 17.0], [ 17.0, 45.0, 17.0, 17.0], [ 17.0, 17.0, 45.0, 17.0], - [ 17.0, 17.0, 17.0, 45.0],], - 136: [ [42.0, 15.0, 15.0, 14.0, 5.0, 5.0], - [15.0, 42.0, 15.0, 5.0, 14.0, 5.0], - [15.0, 15.0, 42.0, 5.0, 5.0, 14.0], - [14.0, 5.0, 5.0, 42.0, 15.0, 15.0], - [ 5.0, 14.0, 5.0, 15.0, 42.0, 15.0], - [ 5.0, 5.0, 14.0, 15.0, 15.0, 42.0] ], + [ 17.0, 17.0, 17.0, 45.0],], + 136: [ [42.0, 15.0, 15.0, 14.0, 5.0, 5.0], + [15.0, 42.0, 15.0, 5.0, 14.0, 5.0], + [15.0, 15.0, 42.0, 5.0, 5.0, 14.0], + [14.0, 5.0, 5.0, 42.0, 15.0, 15.0], + [ 5.0, 14.0, 5.0, 15.0, 42.0, 15.0], + [ 5.0, 5.0, 14.0, 15.0, 15.0, 42.0] ], } - + Nips = len(nodeWeightsPerNode[elemType]) ipCoordinates = [[0.0,0.0,0.0] for i in range(Nips)] for ip in range(Nips): @@ -369,7 +369,7 @@ def ipCoords(elemType, nodalCoordinates): ipCoordinates[ip][i] += nodeWeightsPerNode[elemType][ip][node] * nodalCoordinates[node][i] for i in range(3): ipCoordinates[ip][i] /= sum(nodeWeightsPerNode[elemType][ip]) - + return ipCoordinates @@ -377,15 +377,15 @@ def ipCoords(elemType, nodalCoordinates): # ----------------------------- def ipIDs(elemType): """returns IP numbers for given element type""" - ipPerNode = { - 7: [ 1, 2, 4, 3, 5, 6, 8, 7 ], - 57: [ 1, 2, 4, 3, 5, 6, 8, 7 ], + ipPerNode = { + 7: [ 1, 2, 4, 3, 5, 6, 8, 7 ], + 57: [ 1, 2, 4, 3, 5, 6, 8, 7 ], 117: [ 1 ], - 125: [ 1, 2, 3 ], - 127: [ 1, 2, 3, 4 ], - 136: [ 1, 2, 3, 4, 5, 6 ], + 125: [ 1, 2, 3 ], + 127: [ 1, 2, 3, 4 ], + 136: [ 1, 2, 3, 4, 5, 6 ], } - + return ipPerNode[elemType] @@ -457,7 +457,7 @@ def OpenPostfile(name,type,nodal = False): }[type](name) p.extrapolation({True:'linear',False:'translate'}[nodal]) p.moveto(1) - + return p @@ -475,9 +475,9 @@ def ParseOutputFormat(filename,what,me): break except: pass - + if content == []: return format # nothing found... - + tag = '' tagID = 0 for line in content: @@ -527,7 +527,7 @@ def ParsePostfile(p,filename, outputFormat): 'LabelOfElementalTensor': [None]*p.element_tensors(), \ } -# --- find labels +# --- find labels for labelIndex in range(stat['NumberOfNodalScalars']): label = p.node_scalar_label(labelIndex) @@ -543,17 +543,17 @@ def ParsePostfile(p,filename, outputFormat): label = p.element_tensor_label(labelIndex) stat['IndexOfLabel'][label] = labelIndex stat['LabelOfElementalTensor'][labelIndex] = label - + if 'User Defined Variable 1' in stat['IndexOfLabel']: # output format without dedicated names? stat['IndexOfLabel']['HomogenizationCount'] = stat['IndexOfLabel']['User Defined Variable 1'] # adjust first named entry - + if 'HomogenizationCount' in stat['IndexOfLabel']: # does the result file contain relevant user defined output at all? startIndex = stat['IndexOfLabel']['HomogenizationCount'] stat['LabelOfElementalScalar'][startIndex] = 'HomogenizationCount' - + # We now have to find a mapping for each output label as defined in the .output* files to the output position in the post file # Since we know where the user defined outputs start ("startIndex"), we can simply assign increasing indices to the labels -# given in the .output* file +# given in the .output* file offset = 1 for (name,N) in outputFormat['Homogenization']['outputs']: @@ -595,7 +595,7 @@ def ParsePostfile(p,filename, outputFormat): print 'trying to assign %s at position %i+%i'%(label,startIndex,offset) sys.exit(1) offset += 1 - + return stat @@ -614,7 +614,7 @@ def SummarizePostfile(stat,where=sys.stdout,format='marc'): + '\n '.join(stat['LabelOfElementalScalar']) + '\n\n') where.write('elemental tensors:\t%i'%stat['NumberOfElementalTensors'] + '\n\n '\ + '\n '.join(stat['LabelOfElementalTensor']) + '\n\n') - + return True @@ -625,9 +625,9 @@ def SummarizePostfile(stat,where=sys.stdout,format='marc'): # --- input parsing parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Extract data from a .t16 (MSC.Marc) or .spectralOut results file. +Extract data from a .t16 (MSC.Marc) or .spectralOut results file. -List of output variables is given by options '--ns','--es','--et','--ho','--cr','--co'. +List of output variables is given by options '--ns','--es','--et','--ho','--cr','--co'. Filters and separations use 'elem','node','ip','grain', and 'x','y','z' as key words. Example: @@ -751,12 +751,12 @@ if options.filetype is None: if ext in fileExtensions[theType]: options.filetype = theType break - + if options.filetype is not None: options.filetype = options.filetype.lower() if options.filetype == 'marc': offset_pos = 1 else: offset_pos = 0 - + # --- more sanity checks @@ -766,7 +766,7 @@ if options.filetype not in ['marc','spectral']: if options.filetype == 'marc': sys.path.append(damask.solver.Marc().libraryPath()) - + try: from py_post import post_open except: @@ -810,7 +810,7 @@ else: extension = os.path.splitext(files[0])[1] outputFormat = {} -me = { +me = { 'Homogenization': options.homog, 'Crystallite': options.cryst, 'Constitutive': options.phase, @@ -823,7 +823,7 @@ for what in me: if '_id' not in outputFormat[what]['specials']: print "\nsection '%s' not found in <%s>"%(me[what], what) print '\n'.join(map(lambda x:' [%s]'%x, outputFormat[what]['specials']['brothers'])) - + bg.set_message('opening result file...') p = OpenPostfile(filename+extension,options.filetype,options.nodal) bg.set_message('parsing result file...') @@ -834,7 +834,7 @@ if options.filetype == 'marc': # --- sanity check for output variables # for mentat variables (nodalScalar,elemScalar,elemTensor) we simply have to check whether the label # is found in the stat[indexOfLabel] dictionary for user defined variables (homogenizationResult, -# crystalliteResult,constitutiveResult) we have to check the corresponding outputFormat, since the +# crystalliteResult,constitutiveResult) we have to check the corresponding outputFormat, since the # namescheme in stat['IndexOfLabel'] is different for opt in ['nodalScalar','elemScalar','elemTensor','homogenizationResult','crystalliteResult','constitutiveResult']: @@ -856,13 +856,13 @@ if options.info: print '\n\n',p SummarizePostfile(stat) - + print '\nUser Defined Outputs' for what in me: print '\n ',what,':' for output in outputFormat[what]['outputs']: print ' ',output - + sys.exit(0) @@ -900,12 +900,12 @@ if options.nodalScalar: myElemID = 0 myIpID = 0 myGrainID = 0 - + # generate an expression that is only true for the locations specified by options.filter filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates) if filter != '' and not eval(filter): # for all filter expressions that are not true:... continue # ... ignore this data point and continue with next - + # --- group data locations # generate a unique key for a group of separated data based on the separation criterium for the location grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates) @@ -925,7 +925,7 @@ if options.nodalScalar: myNodeCoordinates) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member memberCount += 1 - + else: for e in xrange(stat['NumberOfElements']): if e%1000 == 0: @@ -943,22 +943,22 @@ else: and int(p.element_scalar(e, stat['IndexOfLabel']['GrainCount'])[0].value))\ or 1): myGrainID = g + 1 - + # --- filter valid locations # generates an expression that is only true for the locations specified by options.filter - filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) + filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) if filter != '' and not eval(filter): # for all filter expressions that are not true:... continue # ... ignore this data point and continue with next - + # --- group data locations # generates a unique key for a group of separated data based on the separation criterium for the location - grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) - + grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) + if grp not in index: # create a new group if not yet present index[grp] = groupCount groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location groupCount += 1 - + groups[index[grp]][0][:4] = mapIncremental('','unique', len(groups[index[grp]])-1, groups[index[grp]][0][:4], @@ -1055,12 +1055,12 @@ for incCount,position in enumerate(locations): # walk through locations +'"%(dirname + os.sep + options.prefix + os.path.split(filename)[1],increments[incCount],options.suffix)') else: outFilename = '%s.txt'%(dirname + os.sep + options.prefix + os.path.split(filename)[1] + options.suffix) - + if not fileOpen: file = open(outFilename,'w') fileOpen = True file.write('2\theader\n') - file.write(scriptID + '\t' + ' '.join(sys.argv[1:])) + file.write(scriptID + '\t' + ' '.join(sys.argv[1:]) + '\n') headerWritten = False file.flush() @@ -1097,7 +1097,7 @@ for incCount,position in enumerate(locations): # walk through locations if options.elemScalar: for label in options.elemScalar: - if assembleHeader: + if assembleHeader: header += [''.join( label.split() )] newby.append({'label':label, 'len':1, @@ -1105,17 +1105,17 @@ for incCount,position in enumerate(locations): # walk through locations if options.elemTensor: for label in options.elemTensor: - if assembleHeader: + if assembleHeader: header += heading('.',[[''.join( label.split() ),component] for component in ['intensity','t11','t22','t33','t12','t23','t13']]) myTensor = p.element_tensor(p.element_sequence(e),stat['IndexOfLabel'][label])[n_local] newby.append({'label':label, 'len':7, - 'content':[ myTensor.intensity, + 'content':[ myTensor.intensity, myTensor.t11, myTensor.t22, myTensor.t33, myTensor.t12, myTensor.t23, myTensor.t13, ]}) - + if options.homogenizationResult or \ options.crystalliteResult or \ options.constitutiveResult: @@ -1135,7 +1135,7 @@ for incCount,position in enumerate(locations): # walk through locations try: newby.append({'label':label, 'len':length, - 'content':[ p.element_scalar(p.element_sequence(e),stat['IndexOfLabel'][head])[n_local].value + 'content':[ p.element_scalar(p.element_sequence(e),stat['IndexOfLabel'][head])[n_local].value for head in thisHead ]}) except KeyError: print '\nDAMASK outputs seem missing from "post" section of the *.dat file!' @@ -1165,7 +1165,7 @@ for incCount,position in enumerate(locations): # walk through locations group[0] + \ mappedResult) ) + '\n') - + if fileOpen: file.close() From e7a174abc194001056d9fac77c0ebfbf413fe887 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Jul 2016 19:19:51 +0200 Subject: [PATCH 040/139] cleaner code --- installation/symlink_Code.py | 2 +- installation/symlink_Processing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installation/symlink_Code.py b/installation/symlink_Code.py index 5d4518ddd..82b68c2a8 100755 --- a/installation/symlink_Code.py +++ b/installation/symlink_Code.py @@ -40,7 +40,7 @@ for version in MarcReleases: os.remove(sym_link) sys.stdout.write(sym_link) else: - sys.stdout.write(damask.util.bcolors.BOLD + sym_link + damask.util.bcolors.ENDC) + sys.stdout.write(damask.util.emph(sym_link)) os.symlink(src,sym_link) sys.stdout.write(' -> '+src+'\n') diff --git a/installation/symlink_Processing.py b/installation/symlink_Processing.py index 3f00e95c6..56f4d73e3 100755 --- a/installation/symlink_Processing.py +++ b/installation/symlink_Processing.py @@ -29,7 +29,7 @@ for subDir in processing_subDirs: os.remove(sym_link) sys.stdout.write(sym_link) else: - sys.stdout.write(damask.util.bcolors.BOLD + sym_link + damask.util.bcolors.ENDC) + sys.stdout.write(damask.util.emph(sym_link)) os.symlink(src,sym_link) sys.stdout.write(' -> '+src+'\n') From cd63a927333b93061ef90b3511cf0b20f4777b9c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Jul 2016 19:35:35 +0200 Subject: [PATCH 041/139] using python 2.7 has shebang will also work on mac without symlink unless someone uses the 6 year old python 2.6, this should be save --- installation/symlink_Code.py | 2 +- installation/symlink_Processing.py | 2 +- processing/misc/OIMgrainFile_toTable.py | 2 +- processing/misc/ang_toTable.py | 2 +- processing/misc/gwyddion_filter.py | 2 +- processing/misc/vtk_fromGwyddion.py | 2 +- processing/misc/yieldSurface.py | 2 +- processing/post/addAPS34IDEstrainCoords.py | 2 +- processing/post/addCalculation.py | 2 +- processing/post/addCauchy.py | 2 +- processing/post/addCompatibilityMismatch.py | 2 +- processing/post/addCumulative.py | 2 +- processing/post/addCurl.py | 2 +- processing/post/addDeterminant.py | 2 +- processing/post/addDeviator.py | 2 +- processing/post/addDisplacement.py | 2 +- processing/post/addDivergence.py | 2 +- processing/post/addEhkl.py | 2 +- processing/post/addEuclideanDistance.py | 2 +- processing/post/addGradient.py | 2 +- processing/post/addGrainID.py | 2 +- processing/post/addIPFcolor.py | 2 +- processing/post/addInfo.py | 2 +- processing/post/addMapped.py | 2 +- processing/post/addMises.py | 2 +- processing/post/addNorm.py | 2 +- processing/post/addOrientations.py | 2 +- processing/post/addPK2.py | 2 +- processing/post/addPole.py | 2 +- processing/post/addSchmidfactors.py | 2 +- processing/post/addSpectralDecomposition.py | 2 +- processing/post/addStrainTensors.py | 2 +- processing/post/addTable.py | 2 +- processing/post/averageDown.py | 2 +- processing/post/averageTable.py | 2 +- processing/post/binXY.py | 2 +- processing/post/blowUp.py | 2 +- processing/post/filterTable.py | 2 +- processing/post/histogram.py | 2 +- processing/post/imageData.py | 2 +- processing/post/imageDataDeformed.py | 2 +- processing/post/imageDataRGB.py | 2 +- processing/post/mentat_colorMap.py | 2 +- processing/post/perceptualUniformColorMap.py | 2 +- processing/post/permuteData.py | 2 +- processing/post/postResults.py | 2 +- processing/post/reLabel.py | 2 +- processing/post/rotateData.py | 2 +- processing/post/scaleData.py | 2 +- processing/post/shiftData.py | 2 +- processing/post/showTable.py | 2 +- processing/post/sortTable.py | 2 +- processing/post/vtk2ang.py | 2 +- processing/post/vtk_addPointcloudData.py | 2 +- processing/post/vtk_addRectilinearGridData.py | 2 +- processing/post/vtk_pointcloud.py | 2 +- processing/post/vtk_rectilinearGrid.py | 2 +- processing/pre/OIMlinear2linearODF.py | 2 +- processing/pre/abq_addUserOutput.py | 2 +- processing/pre/geom_addPrimitive.py | 2 +- processing/pre/geom_canvas.py | 2 +- processing/pre/geom_clean.py | 2 +- processing/pre/geom_fromMinimalSurface.py | 2 +- processing/pre/geom_fromOsteonGeometry.py | 2 +- processing/pre/geom_fromTable.py | 2 +- processing/pre/geom_fromVPSC.py | 2 +- processing/pre/geom_fromVoronoiTessellation.py | 2 +- processing/pre/geom_grainGrowth.py | 2 +- processing/pre/geom_pack.py | 2 +- processing/pre/geom_rescale.py | 2 +- processing/pre/geom_rotate.py | 2 +- processing/pre/geom_toTable.py | 2 +- processing/pre/geom_translate.py | 2 +- processing/pre/geom_unpack.py | 2 +- processing/pre/geom_vicinityOffset.py | 2 +- processing/pre/gmsh_identifySurfaces.py | 2 +- processing/pre/hybridIA_linODFsampling.py | 2 +- processing/pre/marc_addUserOutput.py | 2 +- processing/pre/mentat_pbcOnBoxMesh.py | 2 +- processing/pre/mentat_spectralBox.py | 2 +- processing/pre/patchFromReconstructedBoundaries.py | 2 +- processing/pre/seeds_fromDistribution.py | 2 +- processing/pre/seeds_fromGeom.py | 2 +- processing/pre/seeds_fromPokes.py | 2 +- processing/pre/seeds_fromRandom.py | 2 +- 85 files changed, 85 insertions(+), 85 deletions(-) diff --git a/installation/symlink_Code.py b/installation/symlink_Code.py index 82b68c2a8..1e67c8a7b 100755 --- a/installation/symlink_Code.py +++ b/installation/symlink_Code.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/installation/symlink_Processing.py b/installation/symlink_Processing.py index 56f4d73e3..6cb8f9135 100755 --- a/installation/symlink_Processing.py +++ b/installation/symlink_Processing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- # Makes postprocessing routines acessible from everywhere. diff --git a/processing/misc/OIMgrainFile_toTable.py b/processing/misc/OIMgrainFile_toTable.py index 30cfee2f4..74d5d1819 100755 --- a/processing/misc/OIMgrainFile_toTable.py +++ b/processing/misc/OIMgrainFile_toTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/misc/ang_toTable.py b/processing/misc/ang_toTable.py index 110ea6ddf..177955f17 100755 --- a/processing/misc/ang_toTable.py +++ b/processing/misc/ang_toTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os diff --git a/processing/misc/gwyddion_filter.py b/processing/misc/gwyddion_filter.py index fd4df19a0..d5b1e39f0 100755 --- a/processing/misc/gwyddion_filter.py +++ b/processing/misc/gwyddion_filter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,string,scipy diff --git a/processing/misc/vtk_fromGwyddion.py b/processing/misc/vtk_fromGwyddion.py index 8fa206074..e64bf4393 100755 --- a/processing/misc/vtk_fromGwyddion.py +++ b/processing/misc/vtk_fromGwyddion.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,string,vtk diff --git a/processing/misc/yieldSurface.py b/processing/misc/yieldSurface.py index d636c37f3..15f97113a 100755 --- a/processing/misc/yieldSurface.py +++ b/processing/misc/yieldSurface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import threading,time,os diff --git a/processing/post/addAPS34IDEstrainCoords.py b/processing/post/addAPS34IDEstrainCoords.py index 7ba976478..a630a476b 100755 --- a/processing/post/addAPS34IDEstrainCoords.py +++ b/processing/post/addAPS34IDEstrainCoords.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 8b5dd1d33..5e8c155b1 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,re,sys diff --git a/processing/post/addCauchy.py b/processing/post/addCauchy.py index beebb0422..2f69cb043 100755 --- a/processing/post/addCauchy.py +++ b/processing/post/addCauchy.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index d311c286b..107d5d3d1 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os diff --git a/processing/post/addCumulative.py b/processing/post/addCumulative.py index a577b68fe..37bd7b5de 100755 --- a/processing/post/addCumulative.py +++ b/processing/post/addCumulative.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addCurl.py b/processing/post/addCurl.py index 79bb5f848..fab704325 100755 --- a/processing/post/addCurl.py +++ b/processing/post/addCurl.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addDeterminant.py b/processing/post/addDeterminant.py index dc04dd8ff..1f721c27e 100755 --- a/processing/post/addDeterminant.py +++ b/processing/post/addDeterminant.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addDeviator.py b/processing/post/addDeviator.py index d96564d4c..1cf301161 100755 --- a/processing/post/addDeviator.py +++ b/processing/post/addDeviator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addDisplacement.py b/processing/post/addDisplacement.py index a1a476185..2be5dcc21 100755 --- a/processing/post/addDisplacement.py +++ b/processing/post/addDisplacement.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addDivergence.py b/processing/post/addDivergence.py index 4c24eea3c..ebd9e70d3 100755 --- a/processing/post/addDivergence.py +++ b/processing/post/addDivergence.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addEhkl.py b/processing/post/addEhkl.py index 7b745526a..f7a143466 100755 --- a/processing/post/addEhkl.py +++ b/processing/post/addEhkl.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index 8cb6c3b83..dad334beb 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,itertools diff --git a/processing/post/addGradient.py b/processing/post/addGradient.py index 5ded3fc90..b77af853e 100755 --- a/processing/post/addGradient.py +++ b/processing/post/addGradient.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index 232790580..c39d67983 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,time,copy diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index 6a9e39e18..cedd075c1 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addInfo.py b/processing/post/addInfo.py index 2c8749d0c..50f003d6b 100755 --- a/processing/post/addInfo.py +++ b/processing/post/addInfo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os diff --git a/processing/post/addMapped.py b/processing/post/addMapped.py index da36097d4..c57e62d8b 100755 --- a/processing/post/addMapped.py +++ b/processing/post/addMapped.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addMises.py b/processing/post/addMises.py index 9d6a9f9db..2ce350dbd 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addNorm.py b/processing/post/addNorm.py index 0911e5784..68249379a 100755 --- a/processing/post/addNorm.py +++ b/processing/post/addNorm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 2f88107df..3c1f6dabc 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addPK2.py b/processing/post/addPK2.py index 59084a88c..80f5843ec 100755 --- a/processing/post/addPK2.py +++ b/processing/post/addPK2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addPole.py b/processing/post/addPole.py index 6cbd26880..291c5a712 100755 --- a/processing/post/addPole.py +++ b/processing/post/addPole.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 828132471..0bc529034 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index 2f8f32fd7..aa87e6f3c 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addStrainTensors.py b/processing/post/addStrainTensors.py index 654d7583a..ee760a65b 100755 --- a/processing/post/addStrainTensors.py +++ b/processing/post/addStrainTensors.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addTable.py b/processing/post/addTable.py index 53774b5d7..82799b4f5 100755 --- a/processing/post/addTable.py +++ b/processing/post/addTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/averageDown.py b/processing/post/averageDown.py index ec8e6e8ed..9ad1b7d0b 100755 --- a/processing/post/averageDown.py +++ b/processing/post/averageDown.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/averageTable.py b/processing/post/averageTable.py index b059404c9..25c09625c 100755 --- a/processing/post/averageTable.py +++ b/processing/post/averageTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/binXY.py b/processing/post/binXY.py index 693b71e59..4fd635120 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/blowUp.py b/processing/post/blowUp.py index 430a4f388..49156c8f4 100755 --- a/processing/post/blowUp.py +++ b/processing/post/blowUp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/filterTable.py b/processing/post/filterTable.py index 41a0634f3..231c52960 100755 --- a/processing/post/filterTable.py +++ b/processing/post/filterTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,re,sys,fnmatch diff --git a/processing/post/histogram.py b/processing/post/histogram.py index ea67aa770..0f7d73fdc 100755 --- a/processing/post/histogram.py +++ b/processing/post/histogram.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/imageData.py b/processing/post/imageData.py index b1afcb3de..41996a3c6 100755 --- a/processing/post/imageData.py +++ b/processing/post/imageData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/imageDataDeformed.py b/processing/post/imageDataDeformed.py index a15839b22..14c4df7c2 100755 --- a/processing/post/imageDataDeformed.py +++ b/processing/post/imageDataDeformed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/imageDataRGB.py b/processing/post/imageDataRGB.py index 4d4aa1f8d..4f124507e 100755 --- a/processing/post/imageDataRGB.py +++ b/processing/post/imageDataRGB.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/mentat_colorMap.py b/processing/post/mentat_colorMap.py index b72f48afe..d412890b6 100755 --- a/processing/post/mentat_colorMap.py +++ b/processing/post/mentat_colorMap.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/perceptualUniformColorMap.py b/processing/post/perceptualUniformColorMap.py index 0bf655f2a..85acd073b 100755 --- a/processing/post/perceptualUniformColorMap.py +++ b/processing/post/perceptualUniformColorMap.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os diff --git a/processing/post/permuteData.py b/processing/post/permuteData.py index 54a18576f..0cbf6039a 100755 --- a/processing/post/permuteData.py +++ b/processing/post/permuteData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/postResults.py b/processing/post/postResults.py index c81f561d5..7e23b7278 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math,re,time,struct diff --git a/processing/post/reLabel.py b/processing/post/reLabel.py index b704a2ee5..e5979122e 100755 --- a/processing/post/reLabel.py +++ b/processing/post/reLabel.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,re diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 32eaaad13..08958cc86 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/scaleData.py b/processing/post/scaleData.py index 18883eb0b..d33efa268 100755 --- a/processing/post/scaleData.py +++ b/processing/post/scaleData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/shiftData.py b/processing/post/shiftData.py index 4052d83d9..cac0e54f0 100755 --- a/processing/post/shiftData.py +++ b/processing/post/shiftData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/showTable.py b/processing/post/showTable.py index c65b4519f..918256af9 100755 --- a/processing/post/showTable.py +++ b/processing/post/showTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os diff --git a/processing/post/sortTable.py b/processing/post/sortTable.py index f1298af86..92fa81672 100755 --- a/processing/post/sortTable.py +++ b/processing/post/sortTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/vtk2ang.py b/processing/post/vtk2ang.py index bc8e23097..c315902ef 100755 --- a/processing/post/vtk2ang.py +++ b/processing/post/vtk2ang.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,string,math,sys diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 3590a436e..340ef700e 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,vtk diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index 76eed6aec..63e0bf783 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,vtk diff --git a/processing/post/vtk_pointcloud.py b/processing/post/vtk_pointcloud.py index 995f5a216..339ff2c17 100755 --- a/processing/post/vtk_pointcloud.py +++ b/processing/post/vtk_pointcloud.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,vtk diff --git a/processing/post/vtk_rectilinearGrid.py b/processing/post/vtk_rectilinearGrid.py index 32ea2c11c..73a64c4aa 100755 --- a/processing/post/vtk_rectilinearGrid.py +++ b/processing/post/vtk_rectilinearGrid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,vtk diff --git a/processing/pre/OIMlinear2linearODF.py b/processing/pre/OIMlinear2linearODF.py index cbcbcc7ec..d50c07a37 100755 --- a/processing/pre/OIMlinear2linearODF.py +++ b/processing/pre/OIMlinear2linearODF.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/pre/abq_addUserOutput.py b/processing/pre/abq_addUserOutput.py index 4528537d9..fea8d57b4 100755 --- a/processing/pre/abq_addUserOutput.py +++ b/processing/pre/abq_addUserOutput.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os,re diff --git a/processing/pre/geom_addPrimitive.py b/processing/pre/geom_addPrimitive.py index 8976a9e3d..952ba0c4b 100755 --- a/processing/pre/geom_addPrimitive.py +++ b/processing/pre/geom_addPrimitive.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_canvas.py b/processing/pre/geom_canvas.py index 4b482d641..831a2b251 100755 --- a/processing/pre/geom_canvas.py +++ b/processing/pre/geom_canvas.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_clean.py b/processing/pre/geom_clean.py index 1409a1366..c61cf5ef9 100755 --- a/processing/pre/geom_clean.py +++ b/processing/pre/geom_clean.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_fromMinimalSurface.py b/processing/pre/geom_fromMinimalSurface.py index 1c4fc2eaa..a346aa11d 100755 --- a/processing/pre/geom_fromMinimalSurface.py +++ b/processing/pre/geom_fromMinimalSurface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_fromOsteonGeometry.py b/processing/pre/geom_fromOsteonGeometry.py index 9a24b3e2d..9f85f99aa 100755 --- a/processing/pre/geom_fromOsteonGeometry.py +++ b/processing/pre/geom_fromOsteonGeometry.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_fromTable.py b/processing/pre/geom_fromTable.py index 91b4c2670..4f786af9e 100755 --- a/processing/pre/geom_fromTable.py +++ b/processing/pre/geom_fromTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math,types,time diff --git a/processing/pre/geom_fromVPSC.py b/processing/pre/geom_fromVPSC.py index 3f76ffe2e..a1208170b 100755 --- a/processing/pre/geom_fromVPSC.py +++ b/processing/pre/geom_fromVPSC.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index fd334620f..d18e38b9c 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_grainGrowth.py b/processing/pre/geom_grainGrowth.py index 9184bd226..43e2e49d9 100755 --- a/processing/pre/geom_grainGrowth.py +++ b/processing/pre/geom_grainGrowth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index 168cfe1d6..cfa329698 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/pre/geom_rescale.py b/processing/pre/geom_rescale.py index 2c779f3d3..f2d9966d6 100755 --- a/processing/pre/geom_rescale.py +++ b/processing/pre/geom_rescale.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_rotate.py b/processing/pre/geom_rotate.py index bb6acd35c..1e570ca70 100755 --- a/processing/pre/geom_rotate.py +++ b/processing/pre/geom_rotate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_toTable.py b/processing/pre/geom_toTable.py index 680b218cf..d34d101e0 100755 --- a/processing/pre/geom_toTable.py +++ b/processing/pre/geom_toTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index 6c5eb5391..83c71aa8d 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_unpack.py b/processing/pre/geom_unpack.py index 508946d4e..530d3889e 100755 --- a/processing/pre/geom_unpack.py +++ b/processing/pre/geom_unpack.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_vicinityOffset.py b/processing/pre/geom_vicinityOffset.py index 8ef96608e..06cb482c6 100755 --- a/processing/pre/geom_vicinityOffset.py +++ b/processing/pre/geom_vicinityOffset.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/gmsh_identifySurfaces.py b/processing/pre/gmsh_identifySurfaces.py index e42e352c8..642b0a71e 100755 --- a/processing/pre/gmsh_identifySurfaces.py +++ b/processing/pre/gmsh_identifySurfaces.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,re diff --git a/processing/pre/hybridIA_linODFsampling.py b/processing/pre/hybridIA_linODFsampling.py index 9ee4470b9..a04b28e38 100755 --- a/processing/pre/hybridIA_linODFsampling.py +++ b/processing/pre/hybridIA_linODFsampling.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- from optparse import OptionParser diff --git a/processing/pre/marc_addUserOutput.py b/processing/pre/marc_addUserOutput.py index 6f61b2d26..9bc336fd6 100755 --- a/processing/pre/marc_addUserOutput.py +++ b/processing/pre/marc_addUserOutput.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- """ diff --git a/processing/pre/mentat_pbcOnBoxMesh.py b/processing/pre/mentat_pbcOnBoxMesh.py index b35d9ab62..07f8e4b70 100755 --- a/processing/pre/mentat_pbcOnBoxMesh.py +++ b/processing/pre/mentat_pbcOnBoxMesh.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os diff --git a/processing/pre/mentat_spectralBox.py b/processing/pre/mentat_spectralBox.py index 6ff6e51d7..681aca724 100755 --- a/processing/pre/mentat_spectralBox.py +++ b/processing/pre/mentat_spectralBox.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/pre/patchFromReconstructedBoundaries.py b/processing/pre/patchFromReconstructedBoundaries.py index 9167c7398..ada92b09d 100755 --- a/processing/pre/patchFromReconstructedBoundaries.py +++ b/processing/pre/patchFromReconstructedBoundaries.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os,math,re diff --git a/processing/pre/seeds_fromDistribution.py b/processing/pre/seeds_fromDistribution.py index 096fbdfd8..18b2712e7 100755 --- a/processing/pre/seeds_fromDistribution.py +++ b/processing/pre/seeds_fromDistribution.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import threading,time,os,sys,random diff --git a/processing/pre/seeds_fromGeom.py b/processing/pre/seeds_fromGeom.py index 1f1c2aeed..6a249065b 100755 --- a/processing/pre/seeds_fromGeom.py +++ b/processing/pre/seeds_fromGeom.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/pre/seeds_fromPokes.py b/processing/pre/seeds_fromPokes.py index bf26591c1..5d2cc212f 100755 --- a/processing/pre/seeds_fromPokes.py +++ b/processing/pre/seeds_fromPokes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,math,sys diff --git a/processing/pre/seeds_fromRandom.py b/processing/pre/seeds_fromRandom.py index cf3db1b36..038690df4 100755 --- a/processing/pre/seeds_fromRandom.py +++ b/processing/pre/seeds_fromRandom.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math,random From ef2c8479a7098d66f3bc438880dea03b7d24c58b Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 19 Jul 2016 04:19:09 +0200 Subject: [PATCH 042/139] updated version information after successful test of v2.0.0-396-g03bb0b8 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9b8617d3b..355497657 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.0-385-g1b30b18 +v2.0.0-396-g03bb0b8 From 6f527b2af831b0c3bba613d0aee4e5ee5e3b8d77 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 24 Jul 2016 19:18:48 -0400 Subject: [PATCH 043/139] fixed upperCase typo in vtk_addPointcloudData call --- processing/pre/seeds_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/pre/seeds_check.sh b/processing/pre/seeds_check.sh index a7d7f76ce..f24cd1c64 100755 --- a/processing/pre/seeds_check.sh +++ b/processing/pre/seeds_check.sh @@ -4,7 +4,7 @@ for seeds in "$@" do vtk_pointcloud $seeds - vtk_addPointCloudData $seeds \ + vtk_addPointcloudData $seeds \ --scalar microstructure,weight \ --inplace \ --vtk ${seeds%.*}.vtp \ From 4d01e826c5888a602daf8541425136d260dddc38 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 25 Jul 2016 00:46:11 -0400 Subject: [PATCH 044/139] fixed typo in usage msg --- examples/SpectralMethod/Makefile | 12 ++++++++++++ processing/post/addDisplacement.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 examples/SpectralMethod/Makefile diff --git a/examples/SpectralMethod/Makefile b/examples/SpectralMethod/Makefile new file mode 100644 index 000000000..3abb88f89 --- /dev/null +++ b/examples/SpectralMethod/Makefile @@ -0,0 +1,12 @@ +include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/variables +include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/rules + + +run16x16x16: + -@${MPIEXEC} -n 2 DAMASK_spectral -l tensionX.load -g 20grains16x16x16.geom + +run32x32x32: + -@${MPIEXEC} -n 4 DAMASK_spectral -l tensionX.load -g 20grains32x32x32.geom + +run64x64x64: + -@${MPIEXEC} -n 8 DAMASK_spectral -l tensionX.load -g 20grains64x64x64.geom diff --git a/processing/post/addDisplacement.py b/processing/post/addDisplacement.py index 2be5dcc21..a791a0e84 100755 --- a/processing/post/addDisplacement.py +++ b/processing/post/addDisplacement.py @@ -107,7 +107,7 @@ parser.add_option('-p', parser.add_option('--nodal', dest = 'nodal', action = 'store_true', - help = 'output nodal (instad of cell-centered) displacements') + help = 'output nodal (instead of cell-centered) displacements') parser.set_defaults(defgrad = 'f', pos = 'pos', From 9b6b32692d14536a2a9cac2ea8a1ddc6c6b0478e Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 25 Jul 2016 14:26:39 +0200 Subject: [PATCH 045/139] updated version information after successful test of v2.0.0-401-g4d01e82 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 355497657..dd087b4dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.0-396-g03bb0b8 +v2.0.0-401-g4d01e82 From 8235bf34227040b1e0f9a346f658b96904377667 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Mon, 25 Jul 2016 15:54:48 +0200 Subject: [PATCH 046/139] updated version to 2.0.1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index dd087b4dd..0ac852dde 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.0-401-g4d01e82 +v2.0.1 From 1195593233c565c39ba61af79bfb1ea30686ef2a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Jul 2016 19:39:09 +0200 Subject: [PATCH 047/139] some casting was needed, corrected header --- processing/pre/geom_clean.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/processing/pre/geom_clean.py b/processing/pre/geom_clean.py index c61cf5ef9..408178c32 100755 --- a/processing/pre/geom_clean.py +++ b/processing/pre/geom_clean.py @@ -11,7 +11,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) def mostFrequent(arr): - return np.argmax(np.bincount(arr)) + return np.argmax(np.bincount(arr.astype('int'))) #-------------------------------------------------------------------------------------------------- @@ -72,7 +72,13 @@ for name in filenames: # --- do work ------------------------------------------------------------------------------------ - microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,size=(options.stencil,)*3) + microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,size=(options.stencil,)*3).astype('int_') + newInfo = {'microstructures': microstructure.max()} + +# --- report --------------------------------------------------------------------------------------- + if ( newInfo['microstructures'] != info['microstructures']): + damask.util.croak('--> microstructures: %i'%newInfo['microstructures']) + info['microstructures'] == newInfo['microstructures'] # --- write header --------------------------------------------------------------------------------- From e4c590699f6ca9743b47e131e4a4f0bcb27b2799 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Jul 2016 20:07:12 +0200 Subject: [PATCH 048/139] removed numerical perturbation calculation --- code/crystallite.f90 | 468 +++++++++---------------------------------- 1 file changed, 97 insertions(+), 371 deletions(-) diff --git a/code/crystallite.f90 b/code/crystallite.f90 index 7abd737f3..399e63b0e 100644 --- a/code/crystallite.f90 +++ b/code/crystallite.f90 @@ -518,8 +518,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco) nCryst, & numerics_integrator, & numerics_integrationMode, & - numerics_timeSyncing, & - analyticJaco + numerics_timeSyncing use debug, only: & debug_level, & debug_crystallite, & @@ -582,23 +581,6 @@ subroutine crystallite_stressAndItsTangent(updateJaco) invFp, & ! inverse of the plastic deformation gradient Fe_guess, & ! guess for elastic deformation gradient Tstar ! 2nd Piola-Kirchhoff stress tensor - real(pReal), allocatable, dimension(:,:,:,:,:,:,:) :: & - dPdF_perturbation1, & - dPdF_perturbation2 - real(pReal), allocatable, dimension(:,:,:,:,:) :: & - F_backup, & - Fp_backup, & - InvFp_backup, & - Fi_backup, & - InvFi_backup, & - Fe_backup, & - Lp_backup, & - Li_backup, & - P_backup - real(pReal), allocatable, dimension(:,:,:,:) :: & - Tstar_v_backup - logical, allocatable, dimension(:,:,:) :: & - convergenceFlag_backup integer(pInt) :: & NiterationCrystallite, & ! number of iterations in crystallite loop c, & !< counter in integration point component loop @@ -1137,371 +1119,115 @@ subroutine crystallite_stressAndItsTangent(updateJaco) ! --+>> STIFFNESS CALCULATION <<+-- computeJacobian: if(updateJaco) then - jacobianMethod: if (analyticJaco) then + !$OMP PARALLEL DO PRIVATE(dSdF,dSdFe,dSdFi,dLpdS,dLpdFi,dFpinvdF,dLidS,dLidFi,dFidS,& + !$OMP rhs_3333,lhs_3333,temp_99,temp_33,temp_3333,myNcomponents,error) + elementLooping6: do e = FEsolving_execElem(1),FEsolving_execElem(2) + myNcomponents = homogenization_Ngrains(mesh_element(3,e)) + do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) ! iterate over IPs of this element to be processed + do c = 1_pInt,myNcomponents + call constitutive_TandItsTangent(temp_33,dSdFe,dSdFi,crystallite_Fe(1:3,1:3,c,i,e), & + crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate elastic stress tangent - ! --- ANALYTIC JACOBIAN --- + call constitutive_LiAndItsTangent(temp_33,dLidS,dLidFi,crystallite_Tstar_v(1:6,c,i,e), & + crystallite_Fi(1:3,1:3,c,i,e), & + c,i,e) ! call constitutive law to calculate Li tangent in lattice configuration + if (sum(abs(dLidS)) < tol_math_check) then + dFidS = 0.0_pReal + else + temp_33 = math_inv33(crystallite_subFi0(1:3,1:3,c,i,e)) + lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal + do o=1_pInt,3_pInt; do p=1_pInt,3_pInt + lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) + & + crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidFi(1:3,1:3,o,p)) + lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) + & + crystallite_invFi(1:3,1:3,c,i,e)*crystallite_invFi(p,o,c,i,e) + rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) - & + crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidS(1:3,1:3,o,p)) + enddo; enddo + call math_invert(9_pInt,math_Plain3333to99(lhs_3333),temp_99,error) + if (error) then + call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & + ext_msg='inversion error in analytic tangent calculation') + dFidS = 0.0_pReal + else + dFidS = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) + endif + dLidS = math_mul3333xx3333(dLidFi,dFidS) + dLidS + endif - !$OMP PARALLEL DO PRIVATE(dSdF,dSdFe,dSdFi,dLpdS,dLpdFi,dFpinvdF,dLidS,dLidFi,dFidS,& - !$OMP rhs_3333,lhs_3333,temp_99,temp_33,temp_3333,myNcomponents,error) - elementLooping6: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) ! iterate over IPs of this element to be processed - do c = 1_pInt,myNcomponents - call constitutive_TandItsTangent(temp_33,dSdFe,dSdFi,crystallite_Fe(1:3,1:3,c,i,e), & - crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate elastic stress tangent + call constitutive_LpAndItsTangent(temp_33,dLpdS,dLpdFi,crystallite_Tstar_v(1:6,c,i,e), & + crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate Lp tangent in lattice configuration + dLpdS = math_mul3333xx3333(dLpdFi,dFidS) + dLpdS - call constitutive_LiAndItsTangent(temp_33,dLidS,dLidFi,crystallite_Tstar_v(1:6,c,i,e), & - crystallite_Fi(1:3,1:3,c,i,e), & - c,i,e) ! call constitutive law to calculate Li tangent in lattice configuration - if (sum(abs(dLidS)) < tol_math_check) then - dFidS = 0.0_pReal - else - temp_33 = math_inv33(crystallite_subFi0(1:3,1:3,c,i,e)) - lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal - do o=1_pInt,3_pInt; do p=1_pInt,3_pInt - lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) + & - crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidFi(1:3,1:3,o,p)) - lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) + & - crystallite_invFi(1:3,1:3,c,i,e)*crystallite_invFi(p,o,c,i,e) - rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) - & - crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidS(1:3,1:3,o,p)) - enddo; enddo - call math_invert(9_pInt,math_Plain3333to99(lhs_3333),temp_99,error) - if (error) then - call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & - ext_msg='inversion error in analytic tangent calculation') - dFidS = 0.0_pReal - else - dFidS = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) - endif - dLidS = math_mul3333xx3333(dLidFi,dFidS) + dLidS - endif + temp_33 = math_transpose33(math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & + crystallite_invFi(1:3,1:3,c,i,e))) + rhs_3333 = 0.0_pReal + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + rhs_3333(p,o,1:3,1:3) = math_mul33x33(dSdFe(p,o,1:3,1:3),temp_33) - call constitutive_LpAndItsTangent(temp_33,dLpdS,dLpdFi,crystallite_Tstar_v(1:6,c,i,e), & - crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate Lp tangent in lattice configuration - dLpdS = math_mul3333xx3333(dLpdFi,dFidS) + dLpdS + temp_3333 = 0.0_pReal + temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + math_inv33(crystallite_subFp0(1:3,1:3,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + temp_3333(1:3,1:3,p,o) = math_mul33x33(math_mul33x33(temp_33,dLpdS(1:3,1:3,p,o)), & + crystallite_invFi(1:3,1:3,c,i,e)) - temp_33 = math_transpose33(math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & - crystallite_invFi(1:3,1:3,c,i,e))) - rhs_3333 = 0.0_pReal - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - rhs_3333(p,o,1:3,1:3) = math_mul33x33(dSdFe(p,o,1:3,1:3),temp_33) + temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + crystallite_invFp(1:3,1:3,c,i,e)), & + math_inv33(crystallite_subFi0(1:3,1:3,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + temp_3333(1:3,1:3,p,o) = temp_3333(1:3,1:3,p,o) + math_mul33x33(temp_33,dLidS(1:3,1:3,p,o)) - temp_3333 = 0.0_pReal - temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - math_inv33(crystallite_subFp0(1:3,1:3,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - temp_3333(1:3,1:3,p,o) = math_mul33x33(math_mul33x33(temp_33,dLpdS(1:3,1:3,p,o)), & - crystallite_invFi(1:3,1:3,c,i,e)) + lhs_3333 = crystallite_subdt(c,i,e)*math_mul3333xx3333(dSdFe,temp_3333) + & + math_mul3333xx3333(dSdFi,dFidS) - temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)), & - math_inv33(crystallite_subFi0(1:3,1:3,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - temp_3333(1:3,1:3,p,o) = temp_3333(1:3,1:3,p,o) + math_mul33x33(temp_33,dLidS(1:3,1:3,p,o)) + call math_invert(9_pInt,math_identity2nd(9_pInt)+math_Plain3333to99(lhs_3333),temp_99,error) + if (error) then + call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & + ext_msg='inversion error in analytic tangent calculation') + dSdF = rhs_3333 + else + dSdF = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) + endif - lhs_3333 = crystallite_subdt(c,i,e)*math_mul3333xx3333(dSdFe,temp_3333) + & - math_mul3333xx3333(dSdFi,dFidS) + dFpinvdF = 0.0_pReal + temp_3333 = math_mul3333xx3333(dLpdS,dSdF) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + dFpinvdF(1:3,1:3,p,o) = -crystallite_subdt(c,i,e)* & + math_mul33x33(math_inv33(crystallite_subFp0(1:3,1:3,c,i,e)), & + math_mul33x33(temp_3333(1:3,1:3,p,o), & + crystallite_invFi(1:3,1:3,c,i,e))) - call math_invert(9_pInt,math_identity2nd(9_pInt)+math_Plain3333to99(lhs_3333),temp_99,error) - if (error) then - call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & - ext_msg='inversion error in analytic tangent calculation') - dSdF = rhs_3333 - else - dSdF = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) - endif + crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = 0.0_pReal + temp_33 = math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & + math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & + math_transpose33(crystallite_invFp(1:3,1:3,c,i,e)))) + forall(p=1_pInt:3_pInt) & + crystallite_dPdF(p,1:3,p,1:3,c,i,e) = math_transpose33(temp_33) - dFpinvdF = 0.0_pReal - temp_3333 = math_mul3333xx3333(dLpdS,dSdF) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - dFpinvdF(1:3,1:3,p,o) = -crystallite_subdt(c,i,e)* & - math_mul33x33(math_inv33(crystallite_subFp0(1:3,1:3,c,i,e)), & - math_mul33x33(temp_3333(1:3,1:3,p,o), & - crystallite_invFi(1:3,1:3,c,i,e))) + temp_33 = math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & + math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & + math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e),dFpinvdF(1:3,1:3,p,o)),temp_33) - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = 0.0_pReal - temp_33 = math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & - math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & - math_transpose33(crystallite_invFp(1:3,1:3,c,i,e)))) - forall(p=1_pInt:3_pInt) & - crystallite_dPdF(p,1:3,p,1:3,c,i,e) = math_transpose33(temp_33) + temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + crystallite_invFp(1:3,1:3,c,i,e)) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & + math_mul33x33(math_mul33x33(temp_33,dSdF(1:3,1:3,p,o)), & + math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) - temp_33 = math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & - math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & - math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e),dFpinvdF(1:3,1:3,p,o)),temp_33) + temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + crystallite_invFp(1:3,1:3,c,i,e)), & + math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & + math_mul33x33(temp_33,math_transpose33(dFpinvdF(1:3,1:3,p,o))) - temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & - math_mul33x33(math_mul33x33(temp_33,dSdF(1:3,1:3,p,o)), & - math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) - - temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)), & - math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & - math_mul33x33(temp_33,math_transpose33(dFpinvdF(1:3,1:3,p,o))) - - enddo; enddo - enddo elementLooping6 - !$OMP END PARALLEL DO - - else jacobianMethod - - ! --- STANDARD (PERTURBATION METHOD) FOR JACOBIAN --- - - numerics_integrationMode = 2_pInt - - ! --- BACKUP --- - allocate(dPdF_perturbation1(3,3,3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(dPdF_perturbation2(3,3,3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(F_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Fp_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(InvFp_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Fi_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(InvFi_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Fe_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Lp_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Li_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(P_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Tstar_v_backup (6, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(convergenceFlag_backup (homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = .false.) - - !$OMP PARALLEL DO PRIVATE(myNcomponents) - elementLooping7: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state_backup(:,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state_backup(:,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) - enddo - - F_backup(1:3,1:3,c,i,e) = crystallite_subF(1:3,1:3,c,i,e) ! ... and kinematics - Fp_backup(1:3,1:3,c,i,e) = crystallite_Fp(1:3,1:3,c,i,e) - InvFp_backup(1:3,1:3,c,i,e) = crystallite_invFp(1:3,1:3,c,i,e) - Fi_backup(1:3,1:3,c,i,e) = crystallite_Fi(1:3,1:3,c,i,e) - InvFi_backup(1:3,1:3,c,i,e) = crystallite_invFi(1:3,1:3,c,i,e) - Fe_backup(1:3,1:3,c,i,e) = crystallite_Fe(1:3,1:3,c,i,e) - Lp_backup(1:3,1:3,c,i,e) = crystallite_Lp(1:3,1:3,c,i,e) - Li_backup(1:3,1:3,c,i,e) = crystallite_Li(1:3,1:3,c,i,e) - Tstar_v_backup(1:6,c,i,e) = crystallite_Tstar_v(1:6,c,i,e) - P_backup(1:3,1:3,c,i,e) = crystallite_P(1:3,1:3,c,i,e) - convergenceFlag_backup(c,i,e) = crystallite_converged(c,i,e) - enddo; enddo - enddo elementLooping7 - !$END PARALLEL DO - ! --- CALCULATE STATE AND STRESS FOR PERTURBATION --- - - dPdF_perturbation1 = crystallite_dPdF0 ! initialize stiffness with known good values from last increment - dPdF_perturbation2 = crystallite_dPdF0 ! initialize stiffness with known good values from last increment - pertubationLoop: do perturbation = 1,2 ! forward and backward perturbation - if (iand(pert_method,perturbation) > 0_pInt) then ! mask for desired direction - myPert = -pert_Fg * (-1.0_pReal)**perturbation ! set perturbation step - do k = 1,3; do l = 1,3 ! ...alter individual components - if (iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0_pInt & - .and. ((e == debug_e .and. i == debug_i .and. c == debug_g) & - .or. .not. iand(debug_level(debug_crystallite),debug_levelSelective) /= 0_pInt)) & - write(6,'(a,2(1x,i1),1x,a,/)') '<< CRYST >> [[[[[[ Stiffness perturbation',k,l,']]]]]]' - ! --- INITIALIZE UNPERTURBED STATE --- - - select case(numerics_integrator(numerics_integrationMode)) - case(1_pInt) -!why not OMP? ! Fix-point method: restore to last converged state at end of subinc, since this is probably closest to perturbed state - do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%state_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%state_backup(:,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) - enddo - - crystallite_Fp(1:3,1:3,c,i,e) = Fp_backup(1:3,1:3,c,i,e) - crystallite_invFp(1:3,1:3,c,i,e) = InvFp_backup(1:3,1:3,c,i,e) - crystallite_Fi(1:3,1:3,c,i,e) = Fi_backup(1:3,1:3,c,i,e) - crystallite_invFi(1:3,1:3,c,i,e) = InvFi_backup(1:3,1:3,c,i,e) - crystallite_Fe(1:3,1:3,c,i,e) = Fe_backup(1:3,1:3,c,i,e) - crystallite_Lp(1:3,1:3,c,i,e) = Lp_backup(1:3,1:3,c,i,e) - crystallite_Li(1:3,1:3,c,i,e) = Li_backup(1:3,1:3,c,i,e) - crystallite_Tstar_v(1:6,c,i,e) = Tstar_v_backup(1:6,c,i,e) - enddo; enddo - enddo - case(2_pInt,3_pInt) ! explicit Euler methods: nothing to restore (except for F), since we are only doing a stress integration step - case(4_pInt,5_pInt) -!why not OMP? ! explicit Runge-Kutta methods: restore to start of subinc, since we are doing a full integration of state and stress - do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%subState0(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%subState0(:,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) - enddo - - crystallite_Fp(1:3,1:3,c,i,e) = crystallite_subFp0(1:3,1:3,c,i,e) - crystallite_Fi(1:3,1:3,c,i,e) = crystallite_subFi0(1:3,1:3,c,i,e) - crystallite_Fe(1:3,1:3,c,i,e) = crystallite_subFe0(1:3,1:3,c,i,e) - crystallite_Lp(1:3,1:3,c,i,e) = crystallite_subLp0(1:3,1:3,c,i,e) - crystallite_Li(1:3,1:3,c,i,e) = crystallite_subLi0(1:3,1:3,c,i,e) - crystallite_Tstar_v(1:6,c,i,e) = crystallite_subTstar0_v(1:6,c,i,e) - enddo; enddo - enddo - end select - - ! --- PERTURB EITHER FORWARD OR BACKWARD --- -!why not OMP? - do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) - do c = 1,myNcomponents - crystallite_subF(1:3,1:3,c,i,e) = F_backup(1:3,1:3,c,i,e) - crystallite_subF(k,l,c,i,e) = crystallite_subF(k,l,c,i,e) + myPert - crystallite_todo(c,i,e) = crystallite_requested(c,i,e) & - .and. convergenceFlag_backup(c,i,e) - if (crystallite_todo(c,i,e)) crystallite_converged(c,i,e) = .false. ! start out non-converged - enddo; enddo; enddo - - - select case(numerics_integrator(numerics_integrationMode)) - case(1_pInt) - call crystallite_integrateStateFPI() - case(2_pInt) - call crystallite_integrateStateEuler() - case(3_pInt) - call crystallite_integrateStateAdaptiveEuler() - case(4_pInt) - call crystallite_integrateStateRK4() - case(5_pInt) - call crystallite_integrateStateRKCK45() - end select - !why not OMP? - elementLooping8: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - select case(perturbation) - case(1_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. crystallite_converged(c,i,e)) & ! converged state warrants stiffness update - dPdF_perturbation1(1:3,1:3,k,l,c,i,e) = & - (crystallite_P(1:3,1:3,c,i,e) - P_backup(1:3,1:3,c,i,e)) / myPert ! tangent dP_ij/dFg_kl - case(2_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. crystallite_converged(c,i,e)) & ! converged state warrants stiffness update - dPdF_perturbation2(1:3,1:3,k,l,c,i,e) = & - (crystallite_P(1:3,1:3,c,i,e) - P_backup(1:3,1:3,c,i,e)) / myPert ! tangent dP_ij/dFg_kl - end select - enddo elementLooping8 - - enddo; enddo ! k,l component perturbation loop - - endif - enddo pertubationLoop - - ! --- STIFFNESS ACCORDING TO PERTURBATION METHOD AND CONVERGENCE --- - - elementLooping9: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - select case(pert_method) - case(1_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. convergenceFlag_backup(c,i,e)) & ! perturbation mode 1: central solution converged - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = dPdF_perturbation1(1:3,1:3,1:3,1:3,c,i,e) - case(2_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. convergenceFlag_backup(c,i,e)) & ! perturbation mode 2: central solution converged - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = dPdF_perturbation2(1:3,1:3,1:3,1:3,c,i,e) - case(3_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. convergenceFlag_backup(c,i,e)) & ! perturbation mode 3: central solution converged - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = 0.5_pReal* ( dPdF_perturbation1(1:3,1:3,1:3,1:3,c,i,e) & - + dPdF_perturbation2(1:3,1:3,1:3,1:3,c,i,e)) - end select - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. .not. convergenceFlag_backup(c,i,e)) & ! for any pertubation mode: if central solution did not converge... - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = crystallite_fallbackdPdF(1:3,1:3,1:3,1:3,c,i,e) ! ...use (elastic) fallback - enddo elementLooping9 - - ! --- RESTORE --- -!why not OMP? - elementLooping10: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%state_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%state_backup(:,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) - enddo - - crystallite_subF(1:3,1:3,c,i,e) = F_backup(1:3,1:3,c,i,e) - crystallite_Fp(1:3,1:3,c,i,e) = Fp_backup(1:3,1:3,c,i,e) - crystallite_invFp(1:3,1:3,c,i,e) = InvFp_backup(1:3,1:3,c,i,e) - crystallite_Fi(1:3,1:3,c,i,e) = Fi_backup(1:3,1:3,c,i,e) - crystallite_invFi(1:3,1:3,c,i,e) = InvFi_backup(1:3,1:3,c,i,e) - crystallite_Fe(1:3,1:3,c,i,e) = Fe_backup(1:3,1:3,c,i,e) - crystallite_Lp(1:3,1:3,c,i,e) = Lp_backup(1:3,1:3,c,i,e) - crystallite_Li(1:3,1:3,c,i,e) = Li_backup(1:3,1:3,c,i,e) - crystallite_Tstar_v(1:6,c,i,e) = Tstar_v_backup(1:6,c,i,e) - crystallite_P(1:3,1:3,c,i,e) = P_backup(1:3,1:3,c,i,e) - crystallite_converged(c,i,e) = convergenceFlag_backup(c,i,e) - enddo; enddo - enddo elementLooping10 - - deallocate(dPdF_perturbation1) - deallocate(dPdF_perturbation2) - deallocate(F_backup ) - deallocate(Fp_backup ) - deallocate(InvFp_backup ) - deallocate(Fi_backup ) - deallocate(InvFi_backup ) - deallocate(Fe_backup ) - deallocate(Lp_backup ) - deallocate(Li_backup ) - deallocate(P_backup ) - deallocate(Tstar_v_backup ) - deallocate(convergenceFlag_backup) - - endif jacobianMethod + enddo; enddo + enddo elementLooping6 + !$OMP END PARALLEL DO endif computeJacobian !why not OMP? From faf44c07540739357a264b49f601df743e16051b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Jul 2016 20:12:00 +0200 Subject: [PATCH 049/139] removed allocation for (dot)state backup, simplified screen output handling for MPI --- code/plastic_disloUCLA.f90 | 12 ++---------- code/plastic_dislotwin.f90 | 12 ++---------- code/plastic_isotropic.f90 | 12 ++---------- code/plastic_none.f90 | 7 ++----- code/plastic_nonlocal.f90 | 12 ++---------- code/plastic_phenoplus.f90 | 12 ++---------- code/plastic_phenopowerlaw.f90 | 12 ++---------- code/plastic_titanmod.f90 | 12 ++---------- code/source_damage_anisoBrittle.f90 | 12 ++---------- code/source_damage_anisoDuctile.f90 | 12 ++---------- code/source_damage_isoBrittle.f90 | 12 ++---------- code/source_damage_isoDuctile.f90 | 12 ++---------- code/source_thermal_dissipation.f90 | 12 ++---------- code/source_thermal_externalheat.f90 | 12 ++---------- code/source_vacancy_irradiation.f90 | 12 ++---------- code/source_vacancy_phenoplasticity.f90 | 12 ++---------- code/source_vacancy_thermalfluc.f90 | 12 ++---------- 17 files changed, 34 insertions(+), 165 deletions(-) diff --git a/code/plastic_disloUCLA.f90 b/code/plastic_disloUCLA.f90 index 0e7105c70..e91883173 100644 --- a/code/plastic_disloUCLA.f90 +++ b/code/plastic_disloUCLA.f90 @@ -152,8 +152,6 @@ subroutine plastic_disloUCLA_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -173,11 +171,9 @@ subroutine plastic_disloUCLA_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_DISLOUCLA_ID),pInt) if (maxNinstance == 0_pInt) return @@ -498,10 +494,6 @@ subroutine plastic_disloUCLA_init(fileUnit) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/plastic_dislotwin.f90 b/code/plastic_dislotwin.f90 index 0902ecad6..e205f5abb 100644 --- a/code/plastic_dislotwin.f90 +++ b/code/plastic_dislotwin.f90 @@ -238,8 +238,6 @@ subroutine plastic_dislotwin_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -261,11 +259,9 @@ subroutine plastic_dislotwin_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip, tempPerTwin, tempPerTrans - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_DISLOTWIN_ID),pInt) if (maxNinstance == 0_pInt) return @@ -930,10 +926,6 @@ subroutine plastic_dislotwin_init(fileUnit) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/plastic_isotropic.f90 b/code/plastic_isotropic.f90 index 7d3e1aa7c..9f8129fac 100644 --- a/code/plastic_isotropic.f90 +++ b/code/plastic_isotropic.f90 @@ -94,8 +94,6 @@ subroutine plastic_isotropic_init(fileUnit) debug_constitutive, & debug_levelBasic use numerics, only: & - analyticJaco, & - worldrank, & numerics_integrator use math, only: & math_Mandel3333to66, & @@ -145,11 +143,9 @@ subroutine plastic_isotropic_init(fileUnit) outputtag = '' integer(pInt) :: NipcMyPhase - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_ISOTROPIC_ID),pInt) if (maxNinstance == 0_pInt) return @@ -316,10 +312,6 @@ subroutine plastic_isotropic_init(fileUnit) allocate(plasticState(phase)%state ( sizeState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase),source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) diff --git a/code/plastic_none.f90 b/code/plastic_none.f90 index a9007667f..34570ceab 100644 --- a/code/plastic_none.f90 +++ b/code/plastic_none.f90 @@ -34,7 +34,6 @@ subroutine plastic_none_init use IO, only: & IO_timeStamp use numerics, only: & - worldrank, & numerics_integrator use material, only: & phase_plasticity, & @@ -53,11 +52,9 @@ subroutine plastic_none_init sizeDotState, & sizeDeltaState - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONE_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONE_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_none_ID),pInt) if (maxNinstance == 0_pInt) return diff --git a/code/plastic_nonlocal.f90 b/code/plastic_nonlocal.f90 index a6c7acad1..cb2b31772 100644 --- a/code/plastic_nonlocal.f90 +++ b/code/plastic_nonlocal.f90 @@ -295,8 +295,6 @@ use material, only: phase_plasticity, & material_phase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator @@ -332,11 +330,9 @@ integer(pInt) :: phase, & integer(pInt) :: NofMyPhase - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstances = int(count(phase_plasticity == PLASTICITY_NONLOCAL_ID),pInt) if (maxNinstances == 0) return ! we don't have to do anything if there's no instance for this constitutive law @@ -1310,10 +1306,6 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/plastic_phenoplus.f90 b/code/plastic_phenoplus.f90 index 5df3d490b..b9d09fb3d 100644 --- a/code/plastic_phenoplus.f90 +++ b/code/plastic_phenoplus.f90 @@ -145,8 +145,6 @@ subroutine plastic_phenoplus_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -168,11 +166,9 @@ subroutine plastic_phenoplus_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPLUS_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPLUS_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_PHENOPLUS_ID),pInt) if (maxNinstance == 0_pInt) return @@ -589,10 +585,6 @@ subroutine plastic_phenoplus_init(fileUnit) allocate(plasticState(phase)%state ( sizeState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) diff --git a/code/plastic_phenopowerlaw.f90 b/code/plastic_phenopowerlaw.f90 index 12debbb23..0db6a6072 100644 --- a/code/plastic_phenopowerlaw.f90 +++ b/code/plastic_phenopowerlaw.f90 @@ -157,8 +157,6 @@ subroutine plastic_phenopowerlaw_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -181,11 +179,9 @@ subroutine plastic_phenopowerlaw_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID),pInt) if (maxNinstance == 0_pInt) return @@ -587,10 +583,6 @@ subroutine plastic_phenopowerlaw_init(fileUnit) allocate(plasticState(phase)%state ( sizeState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) diff --git a/code/plastic_titanmod.f90 b/code/plastic_titanmod.f90 index 24bf543b7..ac80af82b 100644 --- a/code/plastic_titanmod.f90 +++ b/code/plastic_titanmod.f90 @@ -216,8 +216,6 @@ subroutine plastic_titanmod_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -241,11 +239,9 @@ subroutine plastic_titanmod_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_TITANMOD_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_TITANMOD_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_TITANMOD_ID),pInt) if (maxNinstance == 0_pInt) return @@ -859,10 +855,6 @@ subroutine plastic_titanmod_init(fileUnit) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_damage_anisoBrittle.f90 b/code/source_damage_anisoBrittle.f90 index efd76091e..53cc411af 100644 --- a/code/source_damage_anisoBrittle.f90 +++ b/code/source_damage_anisoBrittle.f90 @@ -92,8 +92,6 @@ subroutine source_damage_anisoBrittle_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator use lattice, only: & lattice_maxNcleavageFamily, & @@ -111,11 +109,9 @@ subroutine source_damage_anisoBrittle_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoBrittle_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoBrittle_LABEL//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_anisoBrittle_ID),pInt) if (maxNinstance == 0_pInt) return @@ -268,10 +264,6 @@ subroutine source_damage_anisoBrittle_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_damage_anisoDuctile.f90 b/code/source_damage_anisoDuctile.f90 index 72480382a..1a79e3b34 100644 --- a/code/source_damage_anisoDuctile.f90 +++ b/code/source_damage_anisoDuctile.f90 @@ -96,8 +96,6 @@ subroutine source_damage_anisoDuctile_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator use lattice, only: & lattice_maxNslipFamily, & @@ -115,11 +113,9 @@ subroutine source_damage_anisoDuctile_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoDuctile_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoDuctile_LABEL//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_anisoDuctile_ID),pInt) if (maxNinstance == 0_pInt) return @@ -270,10 +266,6 @@ subroutine source_damage_anisoDuctile_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_damage_isoBrittle.f90 b/code/source_damage_isoBrittle.f90 index 1603ecf48..18194618e 100644 --- a/code/source_damage_isoBrittle.f90 +++ b/code/source_damage_isoBrittle.f90 @@ -82,8 +82,6 @@ subroutine source_damage_isoBrittle_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -97,11 +95,9 @@ subroutine source_damage_isoBrittle_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoBrittle_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoBrittle_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_isoBrittle_ID),pInt) if (maxNinstance == 0_pInt) return @@ -222,10 +218,6 @@ subroutine source_damage_isoBrittle_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_damage_isoDuctile.f90 b/code/source_damage_isoDuctile.f90 index 3a85bab24..f30f9a72e 100644 --- a/code/source_damage_isoDuctile.f90 +++ b/code/source_damage_isoDuctile.f90 @@ -82,8 +82,6 @@ subroutine source_damage_isoDuctile_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -97,11 +95,9 @@ subroutine source_damage_isoDuctile_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoDuctile_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoDuctile_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_isoDuctile_ID),pInt) if (maxNinstance == 0_pInt) return @@ -222,10 +218,6 @@ subroutine source_damage_isoDuctile_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_thermal_dissipation.f90 b/code/source_thermal_dissipation.f90 index dd6453db0..d649549ad 100644 --- a/code/source_thermal_dissipation.f90 +++ b/code/source_thermal_dissipation.f90 @@ -68,8 +68,6 @@ subroutine source_thermal_dissipation_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -83,11 +81,9 @@ subroutine source_thermal_dissipation_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_dissipation_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_dissipation_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_thermal_dissipation_ID),pInt) if (maxNinstance == 0_pInt) return @@ -163,10 +159,6 @@ subroutine source_thermal_dissipation_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_thermal_externalheat.f90 b/code/source_thermal_externalheat.f90 index 203826205..e2b14d45d 100644 --- a/code/source_thermal_externalheat.f90 +++ b/code/source_thermal_externalheat.f90 @@ -73,8 +73,6 @@ subroutine source_thermal_externalheat_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -89,11 +87,9 @@ subroutine source_thermal_externalheat_init(fileUnit) line = '' real(pReal), allocatable, dimension(:,:) :: temp_time, temp_rate - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_thermal_externalheat_ID),pInt) if (maxNinstance == 0_pInt) return @@ -189,10 +185,6 @@ subroutine source_thermal_externalheat_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_vacancy_irradiation.f90 b/code/source_vacancy_irradiation.f90 index fd7220020..986c229ff 100644 --- a/code/source_vacancy_irradiation.f90 +++ b/code/source_vacancy_irradiation.f90 @@ -70,8 +70,6 @@ subroutine source_vacancy_irradiation_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -85,11 +83,9 @@ subroutine source_vacancy_irradiation_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_irradiation_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_irradiation_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_vacancy_irradiation_ID),pInt) if (maxNinstance == 0_pInt) return @@ -169,10 +165,6 @@ subroutine source_vacancy_irradiation_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_vacancy_phenoplasticity.f90 b/code/source_vacancy_phenoplasticity.f90 index 2690cf691..924490637 100644 --- a/code/source_vacancy_phenoplasticity.f90 +++ b/code/source_vacancy_phenoplasticity.f90 @@ -68,8 +68,6 @@ subroutine source_vacancy_phenoplasticity_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -83,11 +81,9 @@ subroutine source_vacancy_phenoplasticity_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_phenoplasticity_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_phenoplasticity_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_vacancy_phenoplasticity_ID),pInt) if (maxNinstance == 0_pInt) return @@ -163,10 +159,6 @@ subroutine source_vacancy_phenoplasticity_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/code/source_vacancy_thermalfluc.f90 b/code/source_vacancy_thermalfluc.f90 index 5891ff764..b835e8bce 100644 --- a/code/source_vacancy_thermalfluc.f90 +++ b/code/source_vacancy_thermalfluc.f90 @@ -72,8 +72,6 @@ subroutine source_vacancy_thermalfluc_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -87,11 +85,9 @@ subroutine source_vacancy_thermalfluc_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_thermalfluc_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_thermalfluc_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_vacancy_thermalfluc_ID),pInt) if (maxNinstance == 0_pInt) return @@ -170,10 +166,6 @@ subroutine source_vacancy_thermalfluc_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) From d1b777a47c4c54f92260d20a97620945a957610c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Jul 2016 20:12:56 +0200 Subject: [PATCH 050/139] flag for analytic tangent not needed anymore --- code/numerics.f90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/numerics.f90 b/code/numerics.f90 index 9b3449e95..9840630db 100644 --- a/code/numerics.f90 +++ b/code/numerics.f90 @@ -64,7 +64,6 @@ module numerics charLength = 1.0_pReal, & !< characteristic length scale for gradient problems residualStiffness = 1.0e-6_pReal !< non-zero residual damage logical, protected, public :: & - analyticJaco = .true., & !< use analytic Jacobian or perturbation, Default for Spectral solver .true.: usePingPong = .true., & numerics_timeSyncing = .false. !< flag indicating if time synchronization in crystallite is used for nonlocal plasticity @@ -315,8 +314,6 @@ subroutine numerics_init numerics_integrator(1) = IO_intValue(line,chunkPos,2_pInt) case ('integratorstiffness') numerics_integrator(2) = IO_intValue(line,chunkPos,2_pInt) - case ('analyticjaco') - analyticJaco = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('usepingpong') usepingpong = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('timesyncing') @@ -528,7 +525,6 @@ subroutine numerics_init write(6,'(a24,1x,es8.1)') ' aTol_crystalliteStress: ',aTol_crystalliteStress write(6,'(a24,2(1x,i8))') ' integrator: ',numerics_integrator write(6,'(a24,1x,L8)') ' timeSyncing: ',numerics_timeSyncing - write(6,'(a24,1x,L8)') ' analytic Jacobian: ',analyticJaco write(6,'(a24,1x,L8)') ' use ping pong scheme: ',usepingpong write(6,'(a24,1x,es8.1,/)')' unitlength: ',numerics_unitlength From d0544a69dd88b5bce04c334ea30b83a27ac5b627 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Jul 2016 20:16:27 +0200 Subject: [PATCH 051/139] removed some remainders of state perturbation --- code/plastic_none.f90 | 2 -- code/prec.f90 | 2 -- 2 files changed, 4 deletions(-) diff --git a/code/plastic_none.f90 b/code/plastic_none.f90 index 34570ceab..7a7589774 100644 --- a/code/plastic_none.f90 +++ b/code/plastic_none.f90 @@ -81,11 +81,9 @@ subroutine plastic_none_init allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase)) allocate(plasticState(phase)%subState0 (sizeState,NofMyPhase)) allocate(plasticState(phase)%state (sizeState,NofMyPhase)) - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase)) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase)) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase)) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase)) if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase)) allocate(plasticState(phase)%previousDotState2(sizeDotState,NofMyPhase)) diff --git a/code/prec.f90 b/code/prec.f90 index 0ded23528..190aca02b 100644 --- a/code/prec.f90 +++ b/code/prec.f90 @@ -67,11 +67,9 @@ module prec real(pReal), allocatable, dimension(:,:) :: & partionedState0, & subState0, & - state_backup, & deltaState, & previousDotState, & !< state rate of previous xxxx previousDotState2, & !< state rate two xxxx ago - dotState_backup, & !< backup of state rate RK4dotState real(pReal), allocatable, dimension(:,:,:) :: & RKCK45dotState From 23541a713db1844c839d4a4f1345bbb3140f2f73 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Jul 2016 22:26:18 +0200 Subject: [PATCH 052/139] material parameters from paper --- .../ConfigFiles/Phase_Nonlocal_Nickel.config | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100755 examples/ConfigFiles/Phase_Nonlocal_Nickel.config diff --git a/examples/ConfigFiles/Phase_Nonlocal_Nickel.config b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config new file mode 100755 index 000000000..1e9ce28fa --- /dev/null +++ b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config @@ -0,0 +1,146 @@ +##################### +# $Id: material.config 477 2009-12-15 10:22:17Z MPIE\c.kords $ +##################### + +##################### + +[SX] +type isostrain +Ngrains 1 + + + +##################### + +##################### + +[Cu_nonlocal] +crystallite 1 +(constituent) phase 1 texture 1 fraction 1.0 + + +##################### + +##################### + +[ori] +(output) eulerangles +(output) grainrotation +(output) grainrotationX +(output) grainrotationY +(output) grainrotationZ +(output) f +(output) fe +(output) p +(output) ee # elastic strain as Green-Lagrange tensor + + +##################### + +##################### + +/echo/ + +[Ni_nonlocal] + +elasticity hooke +plasticity nonlocal +/nonlocal/ + +(output) rho +(output) rho_sgl_mobile +(output) rho_sgl_immobile +(output) rho_sgl_edge_pos +(output) rho_sgl_edge_neg +(output) rho_sgl_screw_pos +(output) rho_sgl_screw_neg +(output) rho_dip_edge +(output) rho_dip_screw +(output) rho_forest +(output) excess_rho_edge +(output) excess_rho_screw +(output) accumulatedshear +(output) shearrate +(output) resolvedstress +(output) resistance +(output) velocity_edge_pos +(output) rho_dot_gen +(output) rho_dot_sgl2dip_edge +(output) rho_dot_sgl2dip_screw +(output) rho_dot_ann_ath +(output) rho_dot_ann_the_edge +(output) rho_dot_ann_the_screw +(output) rho_dot_edgejogs +(output) rho_dot_flux_edge +(output) rho_dot_flux_screw +(output) slipdirection.x +(output) slipdirection.y +(output) slipdirection.z +(output) slipnormal.x +(output) slipnormal.y +(output) slipnormal.z +(output) fluxdensity_edge_pos.x +(output) fluxdensity_edge_pos.y +(output) fluxdensity_edge_pos.z +(output) fluxdensity_edge_neg.x +(output) fluxdensity_edge_neg.y +(output) fluxdensity_edge_neg.z +(output) fluxdensity_screw_pos.x +(output) fluxdensity_screw_pos.y +(output) fluxdensity_screw_pos.z +(output) fluxdensity_screw_neg.x +(output) fluxdensity_screw_neg.y +(output) fluxdensity_screw_neg.z + +lattice_structure fcc +Nslip 12 # number of slip systems per family +c11 246.5e9 +c12 147.3e9 +c44 124.7e9 +burgers 2.48e-10 0 0 0 # Burgers vector in m +rhoSglEdgePos0 6e10 # Initial positive edge single dislocation density in m/m**3 +rhoSglEdgeNeg0 6e10 # Initial negative edge single dislocation density in m/m**3 +rhoSglScrewPos0 6e10 # Initial positive screw single dislocation density in m/m**3 +rhoSglScrewNeg0 6e10 # Initial negative screw single dislocation density in m/m**3 +rhoDipEdge0 0 # Initial edge dipole dislocation density in m/m**3 +rhoDipScrew0 0 # Initial screw dipole dislocation density in m/m**3 +rhoSglScatter 0 +minimumDipoleHeightEdge 2.6e-9 # 3.0e-9 # minimum distance for stable edge dipoles in m +minimumDipoleHeightScrew 12.0e-9 # 50e-9 # minimum distance for stable screw dipoles in m +lambda0 45 # 33 # prefactor for mean free path +edgeMultiplication 0.1 +randomMultiplication 0 +atomicVolume 1.2e-29 +selfdiffusionPrefactor 1.9e-4 # Gottstein p.168 # prefactor for self-diffusion coefficient +selfdiffusionEnergy 5.1e-19 # Gottstein p.168 # activation energy self-diffusion +solidSolutionEnergy 1.8e-19 # activation energy of solid solution particles in J +solidSolutionConcentration 5e-7 # 1e-7 +solidSolutionSize 1.0 +peierlsStressEdge 1e5 # Peierls stress for edges in Pa (per slip family) +peierlsStressScrew 1e5 # Peierls stress for screws in Pa (per slip family) +doublekinkWidth 10 # width of double kinks in multiples of burgers vector length b +viscosity 1e-3 # viscosity for dislocation glide in Pa s +p 1 # exponent for thermal barrier profile +q 1 # exponent for thermal barrier profile +attackFrequency 50e9 # attack frequency in Hz +surfaceTransmissivity 1.0 # transmissivity of free surfaces for dislocation flux +grainBoundaryTransmissivity 0.0 +aTol_rho 1e100 # absolute tolerance for dislocation density in m/m**3 +aTol_shear 1e10 # absolute tolerance for dislocation density in m/m**3 +significantRho 1e8 # dislocation density considered relevant in m/m**3 +significantN 1 +shortRangeStressCorrection 0 +CFLfactor 1.1 # safety factor for CFL flux check (numerical parameter) +r 1 +interaction_SlipSlip 0 0 0.625 0.07 0.137 0.122 # Dislocation interaction coefficient +linetension 0.8 +edgejog 0.01 # 0.2 + + +##################### + +##################### + +[111] +(gauss) phi1 315 Phi 0 phi2 0 scatter 0.000 fraction 1.000 + From 10897bcaaeac3fad132a46457f1941b50d5615bb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Jul 2016 09:18:13 +0200 Subject: [PATCH 053/139] not needed anymore --- code/damask.core.pyf | 126 ------------------------------------------- 1 file changed, 126 deletions(-) delete mode 100644 code/damask.core.pyf diff --git a/code/damask.core.pyf b/code/damask.core.pyf deleted file mode 100644 index e6396ee1d..000000000 --- a/code/damask.core.pyf +++ /dev/null @@ -1,126 +0,0 @@ -! $Id$ -! -*- f90 -*- -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! Note: the syntax of this file is case sensitive. -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! This file was auto-generated with f2py (version:2_5972). -! See http://cens.ioc.ee/projects/f2py2e/ -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! The auto-generated file is quite heavily corrected -! For modifying, notice the following hints: -! - if the dimension of an array depend on a array that is itself an input, use the C-Syntax: (1) becomes [0] etc. -! - be sure that the precision defined is integer, real*8, and complex*16 -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -python module core ! in - interface ! in :core - - module prec - subroutine prec_init - end subroutine prec_init - end module prec - - module damask_interface ! in :damask_interface:DAMASK_spectral_interface.f90 - subroutine DAMASK_interface_init(loadcaseParameterIn,geometryParameterIn) ! in :damask_interface:DAMASK_spectral_interface.f90 - character(len=1024), intent(in) :: loadcaseParameterIn - character(len=1024), intent(in) :: geometryParameterIn - end subroutine DAMASK_interface_init - end module damask_interface - - module io - subroutine IO_init - end subroutine IO_init - end module io - - module numerics - subroutine numerics_init - end subroutine numerics_init - end module numerics - - module debug - subroutine debug_init - end subroutine debug_init - end module debug - - module math ! in :math:math.f90 - subroutine math_init - end subroutine math_init - - function math_tensorAvg(field) ! in :math:math.f90 - ! input variables - real*8 dimension(:,:,:,:,:), intent(in), :: field - ! function definition - real*8 dimension(3,3), :: math_tensorAvg - end function math_tensorAvg - - end module math - - module fesolving - subroutine FE_init - end subroutine FE_init - end module fesolving - - module mesh ! in :mesh:mesh.f90 - subroutine mesh_init(ip,element) - integer, parameter :: ip = 1 - integer, parameter :: element = 1 - end subroutine mesh_init - - function mesh_nodesAroundCentres(gDim,Favg,centres) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:), intent(in) :: centres - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(3,3), intent(in) :: Favg - real*8, dimension(3,size(centres,2)+1,size(centres,3)+1,size(centres,4)+1), depend(centres) :: mesh_nodesAroundCentres - real*8, dimension(3,size(centres,2)+1,size(centres,3)+1,size(centres,4)+1), depend(centres) :: wrappedCentres - end function mesh_nodesAroundCentres - - function mesh_deformedCoordsFFT(gDim,F,FavgIn,scalingIn) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:,:), intent(in) :: F - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(3,3), intent(in), optional :: FavgIn = -1.0 - real*8, dimension(3), intent(in), optional :: scalingIn = -1.0 - real*8, dimension(3,size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_deformedCoordsFFT - end function mesh_deformedCoordsFFT - - function mesh_volumeMismatch(gDim,F,nodes) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:,:), intent(in) :: F - real*8, dimension(:,:,:,:), intent(in) :: nodes - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_volumeMismatch - end function mesh_volumeMismatch - - function mesh_shapeMismatch(gDim,F,nodes,centres) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:,:), intent(in) :: F - real*8, dimension(:,:,:,:), intent(in) :: nodes - real*8, dimension(:,:,:,:), intent(in) :: centres - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_shapeMismatch - end function mesh_shapeMismatch - - function mesh_init_postprocessing(filepath) ! in :mesh:mesh.f90 - character(len=*), intent(in) :: filepath - end function mesh_init_postprocessing - - function mesh_build_cellnodes(nodes,Ncellnodes) ! in :mesh:mesh.f90 - integer, intent(in) :: Ncellnodes - real*8, dimension(3,:), intent(in) :: nodes - real*8, dimension(3,Ncellnodes), depend(Ncellnodes) :: mesh_build_cellnodes - end function mesh_build_cellnodes - - function mesh_get_Ncellnodes() ! in :mesh:mesh.f90 - integer :: mesh_get_Ncellnodes - end function mesh_get_Ncellnodes - - function mesh_get_unitlength() ! in :mesh:mesh.f90 - real*8 :: mesh_get_unitlength - end function mesh_get_unitlength - - function mesh_get_nodeAtIP(elemtypeFE,ip) ! in :mesh:mesh.f90 - character(len=*), intent(in) :: elemtypeFE - integer, intent(in) :: ip - integer :: mesh_get_nodeAtIP - end function mesh_get_nodeAtIP - - end module mesh - end interface -end python module core - From 920cf2c849a1e5a1022f72fe3a51e4f834aa04d1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Jul 2016 09:20:06 +0200 Subject: [PATCH 054/139] removed non-phase parts --- .../ConfigFiles/Phase_Nonlocal_Nickel.config | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/examples/ConfigFiles/Phase_Nonlocal_Nickel.config b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config index 1e9ce28fa..4d4c2d1df 100755 --- a/examples/ConfigFiles/Phase_Nonlocal_Nickel.config +++ b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config @@ -1,46 +1,3 @@ -##################### -# $Id: material.config 477 2009-12-15 10:22:17Z MPIE\c.kords $ -##################### - -##################### - -[SX] -type isostrain -Ngrains 1 - - - -##################### - -##################### - -[Cu_nonlocal] -crystallite 1 -(constituent) phase 1 texture 1 fraction 1.0 - - -##################### - -##################### - -[ori] -(output) eulerangles -(output) grainrotation -(output) grainrotationX -(output) grainrotationY -(output) grainrotationZ -(output) f -(output) fe -(output) p -(output) ee # elastic strain as Green-Lagrange tensor - - -##################### - -##################### - -/echo/ - [Ni_nonlocal] elasticity hooke @@ -135,12 +92,3 @@ r 1 interaction_SlipSlip 0 0 0.625 0.07 0.137 0.122 # Dislocation interaction coefficient linetension 0.8 edgejog 0.01 # 0.2 - - -##################### - -##################### - -[111] -(gauss) phi1 315 Phi 0 phi2 0 scatter 0.000 fraction 1.000 - From f411405da65096fef951dd09d506311c3c3f9057 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Jul 2016 14:29:16 +0200 Subject: [PATCH 055/139] wrong comment --- code/prec.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/prec.f90 b/code/prec.f90 index 0ded23528..778bd0b90 100644 --- a/code/prec.f90 +++ b/code/prec.f90 @@ -83,7 +83,7 @@ module prec nTwin = 0_pInt, & nTrans = 0_pInt logical :: & - nonlocal = .false. !< absolute tolerance for state integration + nonlocal = .false. real(pReal), pointer, dimension(:,:), contiguous :: & slipRate, & !< slip rate accumulatedSlip !< accumulated plastic slip From e68b06f1cb942fe5b23b4f1f4550e9a8eb3eb492 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Jul 2016 14:32:03 +0200 Subject: [PATCH 056/139] might be helpful --- code/math.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/math.f90 b/code/math.f90 index 8694e30ee..87b232575 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -158,7 +158,8 @@ module math math_areaTriangle, & math_rotate_forward33, & math_rotate_backward33, & - math_rotate_forward3333 + math_rotate_forward3333, & + math_limit private :: & math_partition, & halton, & From 53b94ddf59ea4ce283f53931c631de53358b941a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Jul 2016 20:37:54 +0200 Subject: [PATCH 057/139] not needed (hides complexity) --- examples/SpectralMethod/Makefile | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 examples/SpectralMethod/Makefile diff --git a/examples/SpectralMethod/Makefile b/examples/SpectralMethod/Makefile deleted file mode 100644 index 3abb88f89..000000000 --- a/examples/SpectralMethod/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/variables -include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/rules - - -run16x16x16: - -@${MPIEXEC} -n 2 DAMASK_spectral -l tensionX.load -g 20grains16x16x16.geom - -run32x32x32: - -@${MPIEXEC} -n 4 DAMASK_spectral -l tensionX.load -g 20grains32x32x32.geom - -run64x64x64: - -@${MPIEXEC} -n 8 DAMASK_spectral -l tensionX.load -g 20grains64x64x64.geom From 360daf9394f7bdc891be664979d9aa218d1ed4d7 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 28 Jul 2016 16:43:38 +0200 Subject: [PATCH 058/139] updated version information after successful test of v2.0.1-5-g920cf2c --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0ac852dde..5af1fb958 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1 +v2.0.1-5-g920cf2c From 12d13fb2fa888529d2cfcae4ec54d0bee7dd9f7a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 29 Jul 2016 16:27:27 +0200 Subject: [PATCH 059/139] giving unit --- code/spectral_thermal.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/spectral_thermal.f90 b/code/spectral_thermal.f90 index ab980e091..bb5747574 100644 --- a/code/spectral_thermal.f90 +++ b/code/spectral_thermal.f90 @@ -245,7 +245,7 @@ type(tSolutionState) function spectral_thermal_solution(guess,timeinc,timeinc_ol if (worldrank == 0) then if (spectral_thermal_solution%converged) & write(6,'(/,a)') ' ... thermal conduction converged ..................................' - write(6,'(/,a,f8.4,2x,f8.4,2x,f8.4,/)',advance='no') ' Minimum|Maximum|Delta Temperature = ',& + write(6,'(/,a,f8.4,2x,f8.4,2x,f8.4,/)',advance='no') ' Minimum|Maximum|Delta Temperature / K = ',& minTemperature, maxTemperature, stagNorm write(6,'(/,a)') ' ===========================================================================' flush(6) From a6ee4216d6f33d8ff907cc4fa68f8138d7ba523b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 29 Jul 2016 16:34:51 +0200 Subject: [PATCH 060/139] commenting --- code/DAMASK_spectral.f90 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/code/DAMASK_spectral.f90 b/code/DAMASK_spectral.f90 index 0be78083b..c363393d8 100644 --- a/code/DAMASK_spectral.f90 +++ b/code/DAMASK_spectral.f90 @@ -156,11 +156,9 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) call CPFEM_initAll(el = 1_pInt, ip = 1_pInt) - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- DAMASK_spectral init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- DAMASK_spectral init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !-------------------------------------------------------------------------------------------------- ! initialize field solver information @@ -199,14 +197,14 @@ program DAMASK_spectral allocate(loadCases(i)%ID(nActiveFields)) field = 1 loadCases(i)%ID(field) = FIELD_MECH_ID ! mechanical active by default - if (any(thermal_type == THERMAL_conduction_ID)) then ! thermal field active + thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then field = field + 1 loadCases(i)%ID(field) = FIELD_THERMAL_ID - endif - if (any(damage_type == DAMAGE_nonlocal_ID)) then ! damage field active + endif thermalActive + damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then field = field + 1 loadCases(i)%ID(field) = FIELD_DAMAGE_ID - endif + endif damageActive enddo !-------------------------------------------------------------------------------------------------- From 0aadda4cc3c46db849a9e1e94bebe2558f02548b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 29 Jul 2016 17:45:37 -0400 Subject: [PATCH 061/139] improved cross-platform robustness of DAMASK_env(s) --- DAMASK_env.csh | 28 ++++++++++++++++------------ DAMASK_env.sh | 46 +++++++++++++++++++++++++--------------------- DAMASK_env.zsh | 46 ++++++++++++++++++++-------------------------- 3 files changed, 61 insertions(+), 59 deletions(-) diff --git a/DAMASK_env.csh b/DAMASK_env.csh index 7e3bf128d..78f8922cd 100644 --- a/DAMASK_env.csh +++ b/DAMASK_env.csh @@ -23,25 +23,29 @@ endif # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size -set FREE=`which free` -set FREE='' -if ( "x$FREE" != "x" ) then +if ( `which free` != "free: Command not found." ) then set freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` - set heap=`expr $freeMem / 2` set stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` + set heap=` expr $freeMem / 2` # http://superuser.com/questions/220059/what-parameters-has-ulimit limit stacksize $stack # maximum stack size (kB) - limit datasize $heap # maximum heap size (kB) + limit datasize $heap # maximum heap size (kB) +endif +if ( `limit | grep coredumpsize` != "" ) then + limit coredumpsize 0 # prevent core dumping +endif +if ( `limit | grep memoryuse` != "" ) then + limit memoryuse unlimited # maximum physical memory size +endif +if ( `limit | grep vmemoryuse` != "" ) then + limit vmemoryuse unlimited # maximum virtual memory size endif -limit coredumpsize 2000 # core file size (512-byte blocks) -limit vmemoryuse unlimited # maximum virtual memory size -limit memoryuse unlimited # maximum physical memory size # disable output in case of scp -if($?prompt) then +if ( $?prompt ) then echo '' - echo Düsseldorf Advanced Materials Simulation Kit - DAMASK - echo Max-Planck-Institut für Eisenforschung, Düsseldorf + echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK + echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf echo https://damask.mpie.de echo echo Using environment with ... @@ -59,8 +63,8 @@ if($?prompt) then echo "MSC.Marc/Mentat $MSC_ROOT" endif echo - echo `limit stacksize` echo `limit datasize` + echo `limit stacksize` endif setenv DAMASK_NUM_THREADS $DAMASK_NUM_THREADS diff --git a/DAMASK_env.sh b/DAMASK_env.sh index 8536a36ca..d9b5b004f 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -5,8 +5,8 @@ if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]; then DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$(dirname $BASH_SOURCE)") else - [[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="`pwd`/" - STAT=$(stat "`dirname $BASE$BASH_SOURCE`") + [[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="$(pwd)/" + STAT=$(stat "$(dirname $BASE$BASH_SOURCE)") DAMASK_ROOT=${STAT##* } fi @@ -17,16 +17,16 @@ set() { source $DAMASK_ROOT/CONFIG unset -f set -# if DAMASK_BIN is present and not in $PATH, add it -if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then +# add DAMASK_BIN if present but not yet in $PATH +if [[ "x$DAMASK_BIN" != "x" && ! $(echo ":$PATH:" | grep $DAMASK_BIN:) ]]; then export PATH=$DAMASK_BIN:$PATH fi -SOLVER=`which DAMASK_spectral 2>/dev/null` +SOLVER=$(which DAMASK_spectral 2>/dev/null) if [ "x$SOLVER" == "x" ]; then SOLVER='Not found!' fi -PROCESSING=`which postResults 2>/dev/null` +PROCESSING=$(which postResults 2>/dev/null) if [ "x$PROCESSING" == "x" ]; then PROCESSING='Not found!' fi @@ -36,25 +36,22 @@ fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size -FREE=`which free 2>/dev/null` +FREE=$(which free 2>/dev/null) if [ "x$FREE" != "x" ]; then - freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` - heap=`expr $freeMem / 2` - stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` - + freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}') # http://superuser.com/questions/220059/what-parameters-has-ulimit - ulimit -s $stack 2>/dev/null # maximum stack size (kB) - ulimit -d $heap 2>/dev/null # maximum heap size (kB) + ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) + ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB) fi -ulimit -c 2000 2>/dev/null # core file size (512-byte blocks) +ulimit -c 0 2>/dev/null # core file size (512-byte blocks) ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size # disable output in case of scp if [ ! -z "$PS1" ]; then echo - echo Düsseldorf Advanced Materials Simulation Kit - DAMASK - echo Max-Planck-Institut für Eisenforschung, Düsseldorf + echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK + echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf echo https://damask.mpie.de echo echo Using environment with ... @@ -64,14 +61,21 @@ if [ ! -z "$PS1" ]; then echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" if [ "x$PETSC_DIR" != "x" ]; then echo "PETSc location $PETSC_DIR" - [[ `python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR"` == $PETSC_DIR ]] \ - || echo " ~~> "`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR"` + [[ $(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") == $PETSC_DIR ]] \ + || echo " ~~> "$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") fi - [[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH" + [[ "x$PETSC_ARCH" == "x" ]] \ + || echo "PETSc architecture $PETSC_ARCH" echo "MSC.Marc/Mentat $MSC_ROOT" echo - echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc - echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc + echo -n "heap size " + [[ "$(ulimit -d)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c "import math; size=$(( 1024*$(ulimit -d) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") + echo -n "stack size " + [[ "$(ulimit -s)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c "import math; size=$(( 1024*$(ulimit -s) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") fi export DAMASK_NUM_THREADS diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index e434a97cf..082fa8007 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -1,12 +1,7 @@ # sets up an environment for DAMASK on zsh # usage: source DAMASK_env.zsh - -if [ "$OSTYPE" = "linux-gnu" ] || [ "$OSTYPE" = 'linux' ]; then - DAMASK_ROOT=$(readlink -f "`dirname ${(%):-%N}`") -else - print 'Not done yet' -fi +DAMASK_ROOT=${0:a:h} # defining set() allows to source the same file for tcsh and zsh, with and without space around = set() { @@ -15,45 +10,36 @@ set() { source $DAMASK_ROOT/CONFIG unset -f set -# if DAMASK_BIN is present and not in $PATH, add it +# add DAMASK_BIN if present but not yet in $PATH MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:` if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then export PATH=$DAMASK_BIN:$PATH fi SOLVER=`which DAMASK_spectral 2>/dev/null` -if [ "x$SOLVER" = "x" ]; then - export SOLVER='Not found!' -fi PROCESSING=`which postResults 2>/dev/null` -if [ "x$PROCESSING" = "x" ]; then - export PROCESSING='Not found!' -fi if [ "x$DAMASK_NUM_THREADS" = "x" ]; then DAMASK_NUM_THREADS=1 fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size -FREE=`which free 2>/dev/null` -if [ "x$FREE" != "x" ]; then +if [ "`which free 2>/dev/null`" != "free not found" ]; then freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` - heap=`expr $freeMem / 2` - stack=`expr $freeMem / 2` # http://superuser.com/questions/220059/what-parameters-has-ulimit - ulimit -s $stack 2>/dev/null # maximum stack size (kB) - ulimit -d $heap 2>/dev/null # maximum heap size (kB) + ulimit -s `expr $freeMem / $DAMASK_NUM_THREADS / 2` 2>/dev/null # maximum stack size (kB) + ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB) fi -ulimit -c 2000 2>/dev/null # core file size (512-byte blocks) +ulimit -c 0 2>/dev/null # core file size (512-byte blocks) ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size # disable output in case of scp if [ ! -z "$PS1" ]; then echo - echo Düsseldorf Advanced Materials Simulation Kit - DAMASK - echo Max-Planck-Institut für Eisenforschung, Düsseldorf + echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK + echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf echo https://damask.mpie.de echo echo Using environment with ... @@ -63,13 +49,21 @@ if [ ! -z "$PS1" ]; then echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" if [ "x$PETSC_DIR" != "x" ]; then echo "PETSc location $PETSC_DIR" - [[ `readlink -f $PETSC_DIR` == $PETSC_DIR ]] || echo " ~~> "`readlink -f $PETSC_DIR` + [[ $(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") == $PETSC_DIR ]] \ + || echo " ~~> "$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") fi - [[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH" + [[ "x$PETSC_ARCH" == "x" ]] \ + || echo "PETSc architecture $PETSC_ARCH" echo "MSC.Marc/Mentat $MSC_ROOT" echo - echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc - echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc + echo -n "heap size " + [[ "$(ulimit -d)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c "import math; size=$(( 1024*$(ulimit -d) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") + echo -n "stack size " + [[ "$(ulimit -s)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c "import math; size=$(( 1024*$(ulimit -s) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") fi export DAMASK_NUM_THREADS From 5e1cac2e5e6456794149b3a9d62a7e6f036369ed Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 29 Jul 2016 17:46:22 -0400 Subject: [PATCH 062/139] pretty-printing of CONFIG --- CONFIG | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CONFIG b/CONFIG index b701ec3c7..9be3a95fb 100644 --- a/CONFIG +++ b/CONFIG @@ -1,10 +1,11 @@ # "set"-syntax needed only for tcsh (but works with bash and zsh) # DAMASK_ROOT will be expanded -set DAMASK_BIN=${DAMASK_ROOT}/bin -set DAMASK_NUM_THREADS = 4 +set DAMASK_BIN = ${DAMASK_ROOT}/bin -set MSC_ROOT=/opt/MSC -set MARC_VERSION=2015 +set DAMASK_NUM_THREADS = 4 -set ABAQUS_VERSION=6.14-5 +set MSC_ROOT = /opt/MSC +set MARC_VERSION = 2015 + +set ABAQUS_VERSION = 6.14-5 From afff0b86143c534f480c34bd5c35081eca19629d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 29 Jul 2016 17:48:40 -0400 Subject: [PATCH 063/139] fixed STDOUT error no files on command line translate to "filename" being empty list. Cannot test for filename[0] then... --- processing/post/perceptualUniformColorMap.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/processing/post/perceptualUniformColorMap.py b/processing/post/perceptualUniformColorMap.py index 85acd073b..96e676337 100755 --- a/processing/post/perceptualUniformColorMap.py +++ b/processing/post/perceptualUniformColorMap.py @@ -49,7 +49,7 @@ parser.set_defaults(right = (0.0,0.0,0.0)) (options,filename) = parser.parse_args() if options.format not in outtypes: - parser.error('invalid format: "%s" (can be %s).'%(options.format,', '.join(outtypes))) + parser.error('invalid format: "{}" (choices: {}).'.format(options.format,', '.join(outtypes))) if options.N < 2: parser.error('too few steps (need at least 2).') @@ -59,10 +59,9 @@ if options.trim[0] < -1.0 or \ options.trim[0] >= options.trim[1]: parser.error('invalid trim range (-1 +1).') - -name = options.format if filename[0] is None\ +name = options.format if filename == [] \ else filename[0] -output = sys.stdout if filename[0] is None\ +output = sys.stdout if filename == [] \ else open(os.path.basename(filename[0])+extensions[outtypes.index(options.format)],'w') colorLeft = damask.Color(options.colormodel.upper(), list(options.left)) From 0bbf54e0e46fbb021661b3b15ab4260dcf3cea39 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 29 Jul 2016 17:49:29 -0400 Subject: [PATCH 064/139] switched to string.format() method --- processing/post/addCauchy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addCauchy.py b/processing/post/addCauchy.py index 2f69cb043..2d366b198 100755 --- a/processing/post/addCauchy.py +++ b/processing/post/addCauchy.py @@ -68,7 +68,7 @@ for name in filenames: # ------------------------------------------ assemble header -------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(['%i_Cauchy'%(i+1) for i in xrange(9)]) # extend ASCII header with new labels + table.labels_append(['{}_Cauchy'.format(i+1) for i in xrange(9)]) # extend ASCII header with new labels table.head_write() # ------------------------------------------ process data ------------------------------------------ From 1503cc19fdd346276caa2787e34c6c5ff41931d3 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 29 Jul 2016 20:40:40 -0400 Subject: [PATCH 065/139] fixed excessive line length --- DAMASK_env.sh | 12 ++++++++++-- DAMASK_env.zsh | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/DAMASK_env.sh b/DAMASK_env.sh index d9b5b004f..da033afbe 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -71,11 +71,19 @@ if [ ! -z "$PS1" ]; then echo -n "heap size " [[ "$(ulimit -d)" == "unlimited" ]] \ && echo "unlimited" \ - || echo $(python -c "import math; size=$(( 1024*$(ulimit -d) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -d) )); \ + print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") echo -n "stack size " [[ "$(ulimit -s)" == "unlimited" ]] \ && echo "unlimited" \ - || echo $(python -c "import math; size=$(( 1024*$(ulimit -s) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -s) )); \ + print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") fi export DAMASK_NUM_THREADS diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index 082fa8007..fa9a33987 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -59,11 +59,19 @@ if [ ! -z "$PS1" ]; then echo -n "heap size " [[ "$(ulimit -d)" == "unlimited" ]] \ && echo "unlimited" \ - || echo $(python -c "import math; size=$(( 1024*$(ulimit -d) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -d) )); \ + print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") echo -n "stack size " [[ "$(ulimit -s)" == "unlimited" ]] \ && echo "unlimited" \ - || echo $(python -c "import math; size=$(( 1024*$(ulimit -s) )); print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'EiB', 'ZiB'][int(math.log(size,2) / 10) if size else 0])") + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -s) )); \ + print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") fi export DAMASK_NUM_THREADS From 304fdf1ebe47da15eba1e85e46ee786eced6d194 Mon Sep 17 00:00:00 2001 From: Aritra Chakraborty Date: Fri, 29 Jul 2016 20:41:15 -0400 Subject: [PATCH 066/139] can deal with "veterans" and "newbies" meaning over ride existing with new --- processing/post/addCalculation.py | 80 ++++++++++++++----------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 5e8c155b1..1d603e9fb 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python2 # -*- coding: UTF-8 no BOM -*- import os,re,sys @@ -6,10 +6,15 @@ import math import numpy as np from optparse import OptionParser import damask +import collections scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) +def listify(x): + return (x if isinstance(x, collections.Iterable) else [x]) + + # -------------------------------------------------------------------- # MAIN # -------------------------------------------------------------------- @@ -55,13 +60,9 @@ for i in xrange(len(options.formulas)): if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) - output = damask.ASCIItable(name = name, - buffered = False) - except: - continue + try: table = damask.ASCIItable(name = name, + buffered = False) + except: continue damask.util.report(scriptName,name) # ------------------------------------------ read header ------------------------------------------- @@ -129,53 +130,46 @@ for name in filenames: while outputAlive and table.data_read(): # read next data line of ASCII table specials['_row_'] += 1 # count row - output.data_clear() # ------------------------------------------ calculate one result to get length of labels --------- if firstLine: firstLine = False - labelDim = {} - for label in [x for x in options.labels]: - labelDim[label] = np.size(eval(evaluator[label])) - if labelDim[label] == 0: options.labels.remove(label) + resultDim = {} + for label in list(options.labels): # iterate over stable copy + resultDim[label] = np.size(eval(evaluator[label])) # get dimension of formula[label] + if resultDim[label] == 0: options.labels.remove(label) # remove label if invalid result + + veterans = list(set(options.labels)&set(table.labels(raw=False)+table.labels(raw=True)) ) # intersection of requested and existing + newbies = list(set(options.labels)-set(table.labels(raw=False)+table.labels(raw=True)) ) # requested but not existing + + for veteran in list(veterans): + if resultDim[veteran] != table.label_dimension(veteran): + damask.util.croak('{} is ignored due to inconsistent dimension...'.format(veteran)) + veterans.remove(veteran) # ignore culprit + for newby in newbies: + table.labels_append(['{}_{}'.format(i+1,newby) for i in xrange(resultDim[newby])] + if resultDim[newby] > 1 else newby) # ------------------------------------------ assemble header --------------------------------------- - output.labels_clear() - tabLabels = table.labels() - for label in tabLabels: - dim = labelDim[label] if label in options.labels \ - else table.label_dimension(label) - output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(dim)] if dim > 1 else label) - - for label in options.labels: - if label in tabLabels: continue - output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])] - if labelDim[label] > 1 - else label) - - output.info = table.info - output.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - output.head_write() + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) + table.head_write() # ------------------------------------------ process data ------------------------------------------ - for label in output.labels(): - oldIndices = table.label_indexrange(label) - Nold = max(1,len(oldIndices)) # Nold could be zero for new columns - Nnew = len(output.label_indexrange(label)) - output.data_append(eval(evaluator[label]) if label in options.labels and - (options.condition is None or eval(eval(evaluator_condition))) - else np.tile([table.data[i] for i in oldIndices] - if label in tabLabels - else np.nan, - np.ceil(float(Nnew)/Nold))[:Nnew]) # spread formula result into given number of columns + if options.condition is None or eval(eval(evaluator_condition)): # condition for veteran replacement fulfilled + for veteran in veterans: # evaluate formulae that overwrite + table.data[table.label_index(veteran): + table.label_index(veteran)+table.label_dimension(veteran)] = \ + listify(eval(evaluator[veteran])) + + for newby in newbies: # evaluate formulae that append + table.data_append(listify(eval(evaluator[newby]))) - outputAlive = output.data_write() # output processed line + outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- - table.input_close() # close ASCII tables - output.close() # close ASCII tables - + table.close() # close ASCII table + From cc27b4ba59fe8b5c97994c26c860633aa9b2658e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 30 Jul 2016 08:17:47 +0200 Subject: [PATCH 067/139] analytic tangent option not supported anymore --- examples/AbaqusStandard/numerics.config | 1 - examples/ConfigFiles/numerics.config | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/AbaqusStandard/numerics.config b/examples/AbaqusStandard/numerics.config index 2b0b8a96e..47091bf7f 100644 --- a/examples/AbaqusStandard/numerics.config +++ b/examples/AbaqusStandard/numerics.config @@ -1,2 +1 @@ fixed_seed 1697667030 -analyticJaco 1 diff --git a/examples/ConfigFiles/numerics.config b/examples/ConfigFiles/numerics.config index 85e3592b4..580b58e57 100644 --- a/examples/ConfigFiles/numerics.config +++ b/examples/ConfigFiles/numerics.config @@ -8,7 +8,6 @@ pert_Fg 1.0e-7 # deformation gradient perturbation for g pert_method 1 # perturbation method (1 = forward, 2 = backward or 3 = central) integrator 1 # integration method (1 = Fixed Point Iteration, 2 = Euler, 3 = Adaptive Euler, 4 = classical 4th order Runge-Kutta, 5 = 5th order Runge-Kutta Cash-Karp) integratorStiffness 1 # integration method used for stiffness (1 = Fixed Point Iteration, 2 = Euler, 3 = Adaptive Euler, 4 = classical 4th order Runge-Kutta, 5 = 5th order Runge-Kutta Cash-Karp) -analyticJaco 1 # use analytic Jacobian or perturbation (0 = perturbations, 1 = analytic) unitlength 1 # physical length of one computational length unit usepingpong 1 # use the ping pong (collect <-> calc) scheme (always off for Abaqus exp, must be on for Spectral Solver) From c3650a1b00ac2396ea09de3cf4f12347d1b021be Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 30 Jul 2016 08:20:57 +0200 Subject: [PATCH 068/139] shebang got reverted --- processing/post/addCalculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 1d603e9fb..3c219d480 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,re,sys From 25ee7781c562134c225d39318607b564dc0569e8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 30 Jul 2016 08:49:11 +0200 Subject: [PATCH 069/139] DAMASK has no special requirement on core size, just keep the system configuration --- DAMASK_env.csh | 3 --- DAMASK_env.sh | 1 - DAMASK_env.zsh | 1 - 3 files changed, 5 deletions(-) diff --git a/DAMASK_env.csh b/DAMASK_env.csh index 78f8922cd..8c2d783d1 100644 --- a/DAMASK_env.csh +++ b/DAMASK_env.csh @@ -31,9 +31,6 @@ if ( `which free` != "free: Command not found." ) then limit stacksize $stack # maximum stack size (kB) limit datasize $heap # maximum heap size (kB) endif -if ( `limit | grep coredumpsize` != "" ) then - limit coredumpsize 0 # prevent core dumping -endif if ( `limit | grep memoryuse` != "" ) then limit memoryuse unlimited # maximum physical memory size endif diff --git a/DAMASK_env.sh b/DAMASK_env.sh index da033afbe..ffff7e7d8 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -43,7 +43,6 @@ if [ "x$FREE" != "x" ]; then ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB) fi -ulimit -c 0 2>/dev/null # core file size (512-byte blocks) ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index fa9a33987..d0ac0e8f1 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -31,7 +31,6 @@ if [ "`which free 2>/dev/null`" != "free not found" ]; then ulimit -s `expr $freeMem / $DAMASK_NUM_THREADS / 2` 2>/dev/null # maximum stack size (kB) ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB) fi -ulimit -c 0 2>/dev/null # core file size (512-byte blocks) ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size From 7de1899884133b3d2c8f9bda4153428c69ee69fc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 30 Jul 2016 08:53:42 +0200 Subject: [PATCH 070/139] print statement not existing in python3, use print function --- DAMASK_env.sh | 8 ++++---- DAMASK_env.zsh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DAMASK_env.sh b/DAMASK_env.sh index ffff7e7d8..19d2c627d 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -73,16 +73,16 @@ if [ ! -z "$PS1" ]; then || echo $(python -c \ "import math; \ size=$(( 1024*$(ulimit -d) )); \ - print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ - ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") echo -n "stack size " [[ "$(ulimit -s)" == "unlimited" ]] \ && echo "unlimited" \ || echo $(python -c \ "import math; \ size=$(( 1024*$(ulimit -s) )); \ - print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ - ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") fi export DAMASK_NUM_THREADS diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index d0ac0e8f1..2ce2351cd 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -61,16 +61,16 @@ if [ ! -z "$PS1" ]; then || echo $(python -c \ "import math; \ size=$(( 1024*$(ulimit -d) )); \ - print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ - ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") echo -n "stack size " [[ "$(ulimit -s)" == "unlimited" ]] \ && echo "unlimited" \ || echo $(python -c \ "import math; \ size=$(( 1024*$(ulimit -s) )); \ - print '{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ - ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0])") + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") fi export DAMASK_NUM_THREADS From ab3415d44e7049c0a93cd4b29df95a39380b5497 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 30 Jul 2016 12:46:00 -0400 Subject: [PATCH 071/139] polishing and rearrangement of code snippets --- processing/post/addCalculation.py | 49 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 3c219d480..7e6b75d21 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -1,18 +1,16 @@ #!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -import os,re,sys -import math # noqa +import os,re,sys,math,collections import numpy as np from optparse import OptionParser import damask -import collections scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) def listify(x): - return (x if isinstance(x, collections.Iterable) else [x]) + return x if isinstance(x, collections.Iterable) else [x] # -------------------------------------------------------------------- @@ -22,10 +20,12 @@ def listify(x): parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add or alter column(s) with derived values according to user-defined arithmetic operation between column(s). Column labels are tagged by '#label#' in formulas. Use ';' for ',' in functions. -Numpy is available as np. +Numpy is available as 'np'. Special variables: #_row_# -- row index -Examples: (1) magnitude of vector -- "np.linalg.norm(#vec#)" (2) rounded root of row number -- "round(math.sqrt(#_row_#);3)" +Examples: +(1) magnitude of vector -- "np.linalg.norm(#vec#)" +(2) rounded root of row number -- "round(math.sqrt(#_row_#);3)" """, version = scriptID) @@ -55,7 +55,7 @@ if len(options.labels) != len(options.formulas): for i in xrange(len(options.formulas)): options.formulas[i] = options.formulas[i].replace(';',',') -# --- loop over input files ------------------------------------------------------------------------- +# ------------------------------------- loop over input files -------------------------------------- if filenames == []: filenames = [None] @@ -69,12 +69,12 @@ for name in filenames: table.head_read() -# ----------------------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------------- specials = { \ '_row_': 0, } -# ------------------------------------------ Evaluate condition --------------------------------------- +# --------------------------------------- evaluate condition --------------------------------------- if options.condition is not None: interpolator = [] condition = options.condition # copy per file, since might be altered inline @@ -99,7 +99,7 @@ for name in filenames: evaluator_condition = "'" + condition + "'.format(" + ','.join(interpolator) + ")" -# ------------------------------------------ build formulae ---------------------------------------- +# ------------------------------------------ build formulas ---------------------------------------- evaluator = {} @@ -122,6 +122,10 @@ for name in filenames: evaluator[label] = formula +# ---------------------------- separate requested labels into old and new -------------------------- + + veterans = list(set(options.labels)&set(table.labels(raw=False)+table.labels(raw=True)) ) # intersection of requested and existing + newbies = list(set(options.labels)-set(table.labels(raw=False)+table.labels(raw=True)) ) # requested but not existing # ------------------------------------------ process data ------------------------------------------ @@ -131,45 +135,44 @@ for name in filenames: while outputAlive and table.data_read(): # read next data line of ASCII table specials['_row_'] += 1 # count row -# ------------------------------------------ calculate one result to get length of labels --------- - if firstLine: firstLine = False + +# ---------------------------- line 1: determine dimension of formulas ----------------------------- + resultDim = {} for label in list(options.labels): # iterate over stable copy resultDim[label] = np.size(eval(evaluator[label])) # get dimension of formula[label] if resultDim[label] == 0: options.labels.remove(label) # remove label if invalid result - - veterans = list(set(options.labels)&set(table.labels(raw=False)+table.labels(raw=True)) ) # intersection of requested and existing - newbies = list(set(options.labels)-set(table.labels(raw=False)+table.labels(raw=True)) ) # requested but not existing for veteran in list(veterans): if resultDim[veteran] != table.label_dimension(veteran): - damask.util.croak('{} is ignored due to inconsistent dimension...'.format(veteran)) - veterans.remove(veteran) # ignore culprit + damask.util.croak('skipping {} due to inconsistent dimension...'.format(veteran)) + veterans.remove(veteran) # discard culprit + +# ----------------------------------- line 1: assemble header -------------------------------------- + for newby in newbies: table.labels_append(['{}_{}'.format(i+1,newby) for i in xrange(resultDim[newby])] if resultDim[newby] > 1 else newby) -# ------------------------------------------ assemble header --------------------------------------- - table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) table.head_write() -# ------------------------------------------ process data ------------------------------------------ +# -------------------------------------- evaluate formulas ----------------------------------------- if options.condition is None or eval(eval(evaluator_condition)): # condition for veteran replacement fulfilled - for veteran in veterans: # evaluate formulae that overwrite + for veteran in veterans: # evaluate formulas that overwrite table.data[table.label_index(veteran): table.label_index(veteran)+table.label_dimension(veteran)] = \ listify(eval(evaluator[veteran])) - for newby in newbies: # evaluate formulae that append + for newby in newbies: # evaluate formulas that append table.data_append(listify(eval(evaluator[newby]))) outputAlive = table.data_write() # output processed line -# ------------------------------------------ output finalization ----------------------------------- +# ------------------------------------- output finalization ---------------------------------------- table.close() # close ASCII table From 23a57ec78fb46af221431e45c5246bfe8dc10e44 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 30 Jul 2016 12:52:49 -0400 Subject: [PATCH 072/139] reinstalled "NOQA" keyword for "import math" --- processing/post/addCalculation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 7e6b75d21..2a728578b 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -1,7 +1,8 @@ #!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -import os,re,sys,math,collections +import os,re,sys,collections +import math # noqa import numpy as np from optparse import OptionParser import damask From 79ff040426ef5d920daa1a3baa5995ce32fd69f9 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 30 Jul 2016 15:07:44 -0400 Subject: [PATCH 073/139] sorting and clarification of help, shortening of output labels --- processing/post/addOrientations.py | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 3c1f6dabc..17f3d9da6 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -24,24 +24,23 @@ outputChoices = ['quaternion','rodrigues','eulers'] parser.add_option('-o', '--output', dest = 'output', action = 'extend', metavar = '', - help = 'output orientation formats {%s}'%(','.join(outputChoices))) -parser.add_option('-r', '--rotation', - dest='rotation', - type = 'float', nargs = 4, metavar = ' '.join(['float']*4), - help = 'angle and axis to (pre)rotate orientation') - + help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices))) parser.add_option('-s', '--symmetry', dest = 'symmetry', type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string', help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:]))) +parser.add_option('-d', '--degrees', + dest = 'degrees', + action = 'store_true', + help = 'angles are given in degrees [%default]') +parser.add_option('-r', '--rotation', + dest='rotation', + type = 'float', nargs = 4, metavar = ' '.join(['float']*4), + help = 'angle and axis to (pre)rotate orientation') parser.add_option('-e', '--eulers', dest = 'eulers', type = 'string', metavar = 'string', help = 'Euler angles label') -parser.add_option('-d', '--degrees', - dest = 'degrees', - action = 'store_true', - help = 'Euler angles are given in degrees [%default]') parser.add_option('-m', '--matrix', dest = 'matrix', type = 'string', metavar = 'string', @@ -98,9 +97,8 @@ r = damask.Quaternion().fromAngleAxis(toRadians*options.rotation[0],options.rota if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) + try: table = damask.ASCIItable(name = name, + buffered = False) except: continue damask.util.report(scriptName,name) @@ -126,9 +124,9 @@ for name in filenames: table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for output in options.output: - if output == 'quaternion': table.labels_append(['{}_quat({})'.format( i+1,options.symmetry) for i in xrange(4)]) - if output == 'rodrigues': table.labels_append(['{}_rodrigues({})'.format(i+1,options.symmetry) for i in xrange(3)]) - if output == 'eulers': table.labels_append(['{}_eulers({})'.format( i+1,options.symmetry) for i in xrange(3)]) + if output == 'quaternion': table.labels_append(['{}_{}_{}({})'.format(i+1,'quat',options.symmetry,label) for i in xrange(4)]) + elif output == 'rodrigues': table.labels_append(['{}_{}_{}({})'.format(i+1,'rodr',options.symmetry,label) for i in xrange(3)]) + elif output == 'eulers': table.labels_append(['{}_{}_{}({})'.format(i+1,'eulr',options.symmetry,label) for i in xrange(3)]) table.head_write() # ------------------------------------------ process data ------------------------------------------ @@ -153,9 +151,9 @@ for name in filenames: o.quaternion = r*o.quaternion for output in options.output: - if output == 'quaternion': table.data_append(o.asQuaternion()) - if output == 'rodrigues': table.data_append(o.asRodrigues()) - if output == 'eulers': table.data_append(o.asEulers('Bunge', degrees=options.degrees)) + if output == 'quaternion': table.data_append(o.asQuaternion()) + elif output == 'rodrigues': table.data_append(o.asRodrigues()) + elif output == 'eulers': table.data_append(o.asEulers('Bunge', degrees=options.degrees)) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- From b02bbc77d89d8d883108e58deb8322da96c64011 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 31 Jul 2016 15:20:44 +0200 Subject: [PATCH 074/139] correctly handling whitespace --- lib/damask/environment.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/damask/environment.py b/lib/damask/environment.py index 4d24c6c6e..d301a5498 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -1,7 +1,6 @@ # -*- coding: UTF-8 no BOM -*- - -import os,subprocess,shlex,re +import os,subprocess,shlex,re,string class Environment(): __slots__ = [ \ @@ -23,7 +22,7 @@ class Environment(): for line in configFile: l = re.sub('^set ', '', line).strip() # remove "set" (tcsh) when setting variables if l and not l.startswith('#'): - items = l.split('=') + items = map(string.strip,l.split('=')) if len(items) == 2: self.options[items[0].upper()] = \ re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT From 0d1dfc153e1d25fb878837715061fd56831156a1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 31 Jul 2016 21:30:23 +0200 Subject: [PATCH 075/139] without ticks, zsh expands ... to ../.. for some strange reasons --- DAMASK_env.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index 2ce2351cd..3bbab82df 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -41,7 +41,7 @@ if [ ! -z "$PS1" ]; then echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf echo https://damask.mpie.de echo - echo Using environment with ... + echo "Using environment with ..." echo "DAMASK $DAMASK_ROOT" echo "Spectral Solver $SOLVER" echo "Post Processing $PROCESSING" From 0056f05b9d0ee6d99cf7d2d6711df155b522c8ff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 31 Jul 2016 19:33:26 -0400 Subject: [PATCH 076/139] all functions using angles now feature logical "degrees" --- lib/damask/orientation.py | 50 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 414db52a1..15a63fdec 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -413,11 +413,15 @@ class Quaternion: @classmethod - def fromAngleAxis(cls, angle, axis): + def fromAngleAxis(cls, + angle, + axis, + degrees = False): if not isinstance(axis, np.ndarray): axis = np.array(axis,dtype='d') axis = axis.astype(float)/np.linalg.norm(axis) - s = math.sin(angle / 2.0) - w = math.cos(angle / 2.0) + angle = np.radians(angle) if degrees else angle + s = math.sin(0.5 * angle) + w = math.cos(0.5 * angle) x = axis[0] * s y = axis[1] * s z = axis[2] * s @@ -425,27 +429,26 @@ class Quaternion: @classmethod - def fromEulers(cls, eulers, type = 'Bunge'): + def fromEulers(cls, + eulers, + type = 'Bunge', + degrees = False): + if not isinstance(eulers, np.ndarray): eulers = np.array(eulers,dtype='d') + eulers = np.radians(eulers) if degrees else eulers - eulers *= 0.5 # reduce to half angles - - c1 = math.cos(eulers[0]) - s1 = math.sin(eulers[0]) - c2 = math.cos(eulers[1]) - s2 = math.sin(eulers[1]) - c3 = math.cos(eulers[2]) - s3 = math.sin(eulers[2]) + c = np.cos(0.5 * eulers) + s = np.sin(0.5 * eulers) if type.lower() == 'bunge' or type.lower() == 'zxz': - w = c1 * c2 * c3 - s1 * c2 * s3 - x = c1 * s2 * c3 + s1 * s2 * s3 - y = - c1 * s2 * s3 + s1 * s2 * c3 - z = c1 * c2 * s3 + s1 * c2 * c3 + w = c[0] * c[1] * c[2] - s[0] * c[1] * s[2] + x = c[0] * s[1] * c[2] + s[0] * s[1] * s[2] + y = - c[0] * s[1] * s[2] + s[0] * s[1] * c[2] + z = c[0] * c[1] * s[2] + s[0] * c[1] * c[2] else: - w = c1 * c2 * c3 - s1 * s2 * s3 - x = s1 * s2 * c3 + c1 * c2 * s3 - y = s1 * c2 * c3 + c1 * s2 * s3 - z = c1 * s2 * c3 - s1 * c2 * s3 + w = c[0] * c[1] * c[2] - s[0] * s[1] * s[2] + x = s[0] * s[1] * c[2] + c[0] * c[1] * s[2] + y = s[0] * c[1] * c[2] + c[0] * s[1] * s[2] + z = c[0] * s[1] * c[2] - s[0] * c[1] * s[2] return cls([w,x,y,z]) @@ -819,6 +822,7 @@ class Orientation: Eulers = None, random = False, # integer to have a fixed seed or True for real random symmetry = None, + degrees = False, ): if random: # produce random orientation if isinstance(random, bool ): @@ -826,16 +830,16 @@ class Orientation: else: self.quaternion = Quaternion.fromRandom(randomSeed=random) elif isinstance(Eulers, np.ndarray) and Eulers.shape == (3,): # based on given Euler angles - self.quaternion = Quaternion.fromEulers(Eulers,'bunge') + self.quaternion = Quaternion.fromEulers(Eulers,type='bunge',degrees=degrees) elif isinstance(matrix, np.ndarray) : # based on given rotation matrix self.quaternion = Quaternion.fromMatrix(matrix) elif isinstance(angleAxis, np.ndarray) and angleAxis.shape == (4,): # based on given angle and rotation axis - self.quaternion = Quaternion.fromAngleAxis(angleAxis[0],angleAxis[1:4]) + self.quaternion = Quaternion.fromAngleAxis(angleAxis[0],angleAxis[1:4],degrees=degrees) elif isinstance(Rodrigues, np.ndarray) and Rodrigues.shape == (3,): # based on given Rodrigues vector self.quaternion = Quaternion.fromRodrigues(Rodrigues) elif isinstance(quaternion, Quaternion): # based on given quaternion self.quaternion = quaternion.homomorphed() - elif isinstance(quaternion, np.ndarray) and quaternion.shape == (4,): # based on given quaternion + elif isinstance(quaternion, np.ndarray) and quaternion.shape == (4,): # based on given quaternion-like array self.quaternion = Quaternion(quaternion).homomorphed() self.symmetry = Symmetry(symmetry) From fa3387486d4defe80535e4f5d6676b21ae54206c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 31 Jul 2016 19:35:10 -0400 Subject: [PATCH 077/139] clarified meaning of possible (global) rotation (lab/crystal frame) --- processing/post/addOrientations.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 17f3d9da6..6a6219a5a 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -17,6 +17,7 @@ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options Add quaternion and/or Bunge Euler angle representation of crystal lattice orientation. Orientation is given by quaternion, Euler angles, rotation matrix, or crystal frame coordinates (i.e. component vectors of rotation matrix). +Additional (globally fixed) rotations of the lab frame and/or crystal frame can be applied. """, version = scriptID) @@ -33,10 +34,14 @@ parser.add_option('-d', '--degrees', dest = 'degrees', action = 'store_true', help = 'angles are given in degrees [%default]') -parser.add_option('-r', '--rotation', - dest='rotation', +parser.add_option('-R', '--labrotation', + dest='labrotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4), - help = 'angle and axis to (pre)rotate orientation') + help = 'angle and axis of additional lab frame rotation') +parser.add_option('-r', '--crystalrotation', + dest='crystalrotation', + type = 'float', nargs = 4, metavar = ' '.join(['float']*4), + help = 'angle and axis of additional crystal frame rotation') parser.add_option('-e', '--eulers', dest = 'eulers', type = 'string', metavar = 'string', @@ -90,7 +95,8 @@ if np.sum(input) != 1: parser.error('needs exactly one input format.') (options.quaternion,4,'quaternion'), ][np.where(input)[0][0]] # select input label that was requested toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians -r = damask.Quaternion().fromAngleAxis(toRadians*options.rotation[0],options.rotation[1:]) # pre-rotation +r = damask.Quaternion().fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation +R = damask.Quaternion().fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation # --- loop over input files ------------------------------------------------------------------------ @@ -148,7 +154,7 @@ for name in filenames: o = damask.Orientation(quaternion = np.array(map(float,table.data[column:column+4])), symmetry = options.symmetry).reduced() - o.quaternion = r*o.quaternion + o.quaternion = r*o.quaternion*R # apply additional lab and crystal frame rotations for output in options.output: if output == 'quaternion': table.data_append(o.asQuaternion()) From 6c826417132f6b3a04b504198a9f184368e7fae3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 1 Aug 2016 16:43:14 +0200 Subject: [PATCH 078/139] added defaults (bugfix) --- processing/post/addOrientations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 6a6219a5a..c778e67b0 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -69,7 +69,8 @@ parser.add_option('-q', '--quaternion', parser.set_defaults(output = [], symmetry = damask.Symmetry.lattices[-1], - rotation = (0.,1.,1.,1.), # no rotation about 1,1,1 + labrotation = (0.,1.,1.,1.), # no rotation about 1,1,1 + crystalrotation = (0.,1.,1.,1.), # no rotation about 1,1,1 degrees = False, ) From 0219a5f0e3c53a3d239f2280ea4b65a842ce7f4c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 1 Aug 2016 17:01:13 +0200 Subject: [PATCH 079/139] regex match --- lib/damask/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/damask/environment.py b/lib/damask/environment.py index d301a5498..fedc22e36 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -22,7 +22,7 @@ class Environment(): for line in configFile: l = re.sub('^set ', '', line).strip() # remove "set" (tcsh) when setting variables if l and not l.startswith('#'): - items = map(string.strip,l.split('=')) + items = re.split(r'\s*=\s*',l) if len(items) == 2: self.options[items[0].upper()] = \ re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT From 6b003c6ea81878a05000b4a896c0cd63cc3ed757 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 2 Aug 2016 04:27:21 +0200 Subject: [PATCH 080/139] updated version information after successful test of v2.0.1-35-g6c82641 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5af1fb958..1ec9fb2d4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-5-g920cf2c +v2.0.1-35-g6c82641 From 22d275b009b8b1f27f98ebbcdcdae504c877c4b6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 8 Aug 2016 10:36:34 +0200 Subject: [PATCH 081/139] initialization also needed for "empty" phase to allocate state arrays seems to be safe --- code/plastic_nonlocal.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/plastic_nonlocal.f90 b/code/plastic_nonlocal.f90 index cb2b31772..f7b36897a 100644 --- a/code/plastic_nonlocal.f90 +++ b/code/plastic_nonlocal.f90 @@ -1115,7 +1115,7 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), initializeInstances: do phase = 1_pInt, size(phase_plasticity) NofMyPhase=count(material_phase==phase) - myPhase2: if (phase_plasticity(phase) == PLASTICITY_NONLOCAL_ID .and. NofMyPhase/=0) then + myPhase2: if (phase_plasticity(phase) == PLASTICITY_NONLOCAL_ID) then instance = phase_plasticityInstance(phase) !*** Inverse lookup of my slip system family and the slip system in lattice From 535f8be76ac99c2ba68c955f9095e3269af2113f Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 8 Aug 2016 16:27:05 +0200 Subject: [PATCH 082/139] updated version information after successful test of v2.0.1-39-g22d275b --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1ec9fb2d4..5a316242f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-35-g6c82641 +v2.0.1-39-g22d275b From d239cab3aea994a651033b5d6d807cc86679a13e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 11 Aug 2016 13:48:15 +0200 Subject: [PATCH 083/139] corrected help --- processing/misc/OIMgrainFile_toTable.py | 2 +- processing/misc/ang_toTable.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/processing/misc/OIMgrainFile_toTable.py b/processing/misc/OIMgrainFile_toTable.py index 74d5d1819..c936d92e6 100755 --- a/processing/misc/OIMgrainFile_toTable.py +++ b/processing/misc/OIMgrainFile_toTable.py @@ -12,7 +12,7 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN #-------------------------------------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [file[s]]', description = """ Adds header to OIM grain file to make it accesible as ASCII table """, version = scriptID) diff --git a/processing/misc/ang_toTable.py b/processing/misc/ang_toTable.py index 177955f17..19fdcd55b 100755 --- a/processing/misc/ang_toTable.py +++ b/processing/misc/ang_toTable.py @@ -13,7 +13,7 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN #-------------------------------------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog [geomfile[s]]', description = """ +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [angfile[s]]', description = """ Convert TSL/EDAX *.ang file to ASCIItable """, version = scriptID) @@ -30,7 +30,7 @@ for name in filenames: outname = os.path.splitext(name)[0]+'.txt' if name else name, buffered = False, labeled = False) except: continue - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) + damask.util.report(scriptName,name) # --- interpret header ----------------------------------------------------------------------------- From 6bdce9b3320fa3505c2d6e077a84f80ec9d526b0 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 11 Aug 2016 14:22:07 -0400 Subject: [PATCH 084/139] fixed error for completely empty label list in read_array --- lib/damask/asciitable.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 4fe4f9156..145b87974 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -501,10 +501,10 @@ class ASCIItable(): columns = [] for i,(c,d) in enumerate(zip(indices[present],dimensions[present])): # for all valid labels ... # ... transparently add all components unless column referenced by number or with explicit dimension - columns += range(c,c + \ - (d if str(c) != str(labels[present[i]]) else \ + columns += range(c,c + + (d if str(c) != str(labels[present[i]]) else 1)) - use = np.array(columns) + use = np.array(columns) if len(columns) > 0 else None self.tags = list(np.array(self.tags)[use]) # update labels with valid subset From 600731b15ca2fd90ffedbb5c284114082589a5b0 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 11 Aug 2016 14:23:29 -0400 Subject: [PATCH 085/139] modernized, gracefully add NaN for out-of-bounds mapping --- processing/post/addMapped.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/processing/post/addMapped.py b/processing/post/addMapped.py index c57e62d8b..f67d88d15 100755 --- a/processing/post/addMapped.py +++ b/processing/post/addMapped.py @@ -2,6 +2,7 @@ # -*- coding: UTF-8 no BOM -*- import os,sys +import numpy as np from optparse import OptionParser import damask @@ -28,7 +29,7 @@ parser.add_option('-o','--offset', parser.add_option('-l','--label', dest = 'label', action = 'extend', metavar = '', - help='heading of column(s) to be mapped') + help='column label(s) to be mapped') parser.add_option('-a','--asciitable', dest = 'asciitable', type = 'string', metavar = 'string', @@ -49,12 +50,13 @@ if options.map is None: if options.asciitable is not None and os.path.isfile(options.asciitable): mappedTable = damask.ASCIItable(name = options.asciitable, - buffered = False, readonly = True) + buffered = False, + readonly = True) mappedTable.head_read() # read ASCII header info of mapped table missing_labels = mappedTable.data_readArray(options.label) if len(missing_labels) > 0: - mappedTable.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) + damask.util.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) else: parser.error('no mapped ASCIItable given.') @@ -64,9 +66,8 @@ else: if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) + try: table = damask.ASCIItable(name = name, + buffered = False) except: continue damask.util.report(scriptName,name) @@ -96,7 +97,10 @@ for name in filenames: outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - table.data_append(mappedTable.data[int(round(float(table.data[mappedColumn])))+options.offset-1]) # add all mapped data types + try: + table.data_append(mappedTable.data[int(round(float(table.data[mappedColumn])))+options.offset-1]) # add all mapped data types + except IndexError: + table.data_append(np.nan*np.ones_like(mappedTable.data[0])) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- From 64ac05fc26374c12b1dc46a35b82d842740eaf4f Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 11 Aug 2016 14:24:40 -0400 Subject: [PATCH 086/139] removed left-over debug output --- processing/post/addSchmidfactors.py | 1 - 1 file changed, 1 deletion(-) diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 0bc529034..067c3036a 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -167,7 +167,6 @@ force = np.array(options.force) force /= np.linalg.norm(force) if options.normal: - damask.util.croak('got normal') normal = np.array(options.normal) normal /= np.linalg.norm(normal) if abs(np.dot(force,normal)) > 1e-3: From 49f94a1cb57e09ab23b6c0ff4abe08dc4784f62b Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 12 Aug 2016 04:27:00 +0200 Subject: [PATCH 087/139] updated version information after successful test of v2.0.1-43-g64ac05f --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5a316242f..921b19cbd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-39-g22d275b +v2.0.1-43-g64ac05f From c28649d348395bd01c3284ec21fecafdcc04aea2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 16 Aug 2016 13:30:11 +0200 Subject: [PATCH 088/139] error check for mpi parallelization --- code/mesh.f90 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/mesh.f90 b/code/mesh.f90 index 0562ab218..32f94d66b 100644 --- a/code/mesh.f90 +++ b/code/mesh.f90 @@ -481,6 +481,7 @@ subroutine mesh_init(ip,el) #endif #ifdef Spectral IO_open_file, & + IO_error, & #else IO_open_InputFile, & #endif @@ -507,7 +508,8 @@ subroutine mesh_init(ip,el) implicit none #ifdef Spectral - integer(C_INTPTR_T) :: gridMPI(3), alloc_local, local_K, local_K_offset + integer(C_INTPTR_T) :: devNull, local_K, local_K_offset + integer :: ierr, worldsize #endif integer(pInt), parameter :: FILEUNIT = 222_pInt integer(pInt), intent(in) :: el, ip @@ -547,10 +549,13 @@ subroutine mesh_init(ip,el) call IO_open_file(FILEUNIT,geometryFile) ! parse info from geometry file... if (myDebug) write(6,'(a)') ' Opened geometry file'; flush(6) grid = mesh_spectral_getGrid(fileUnit) + call MPI_comm_size(MPI_COMM_WORLD, worldsize, ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_comm_size') + if(worldsize>grid(3)) call IO_error(894_pInt, ext_msg='number of processes exceeds grid(3)') + geomSize = mesh_spectral_getSize(fileUnit) - gridMPI = int(grid,C_INTPTR_T) - alloc_local = fftw_mpi_local_size_3d(gridMPI(3), gridMPI(2), gridMPI(1)/2 +1, & - MPI_COMM_WORLD, local_K, local_K_offset) + devNull = fftw_mpi_local_size_3d(int(grid(3),C_INTPTR_T),int(grid(2),C_INTPTR_T),& + int(grid(1),C_INTPTR_T)/2+1,MPI_COMM_WORLD,local_K,local_K_offset) grid3 = int(local_K,pInt) grid3Offset = int(local_K_offset,pInt) size3 = geomSize(3)*real(grid3,pReal) /real(grid(3),pReal) From 2738415b348a618fbbb7dde0111f2cef6fe6d4b8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 20 Aug 2016 06:59:50 +0200 Subject: [PATCH 089/139] removed twinning parameters --- .../Phase_Phenopowerlaw_BCC-Ferrite.config | 26 ++++++------------- .../Phase_Phenopowerlaw_BCC-Martensite.config | 25 ++++++------------ 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config index 7344ef455..6efd84f65 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config @@ -1,35 +1,25 @@ # Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 International Journal of Plasticity # Diehl et.al. 2015 Meccanica -[BCC_Ferrite] +[BCC-Ferrite] + elasticity hooke plasticity phenopowerlaw lattice_structure bcc -Nslip 12 12 # per family -Ntwin 0 # per family +Nslip 12 12 # per family +Ntwin 0 # per family c11 233.3e9 c12 135.5e9 c44 118.0e9 gdot0_slip 0.001 n_slip 20 -tau0_slip 95.e6 97.e6 0 0 # per family, optimization long simplex 109 -tausat_slip 222.e6 412.7e6 0 0 # per family, optimization long simplex 109 -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31.0e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 -h0_slipslip 1000.0e6 # opti -h0_twinslip 0 -h0_twintwin 0 +tau0_slip 95.e6 97.e6 # per family, optimization long simplex 109 +tausat_slip 222.e6 412.7e6 # per family, optimization long simplex 109 +h0_slipslip 1000.0e6 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -w0_slip 2.0 # opti -atol_resistance 1 +w0_slip 2.0 (output) totalshear diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config index b9960d325..89ae0339b 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config @@ -1,34 +1,25 @@ # Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 International Journal of Plasticity # Diehl et.al. 2015 Meccanica -[BCC_Martensite] -plasticity phenopowerlaw +[BCC-Martensite] + elasticity hooke +plasticity phenopowerlaw + lattice_structure bcc -Nslip 12 12 # per family -Ntwin 0 # per family +Nslip 12 12 # per family +Ntwin 0 # per family c11 417.4e9 c12 242.4e9 c44 211.1e9 gdot0_slip 0.001 n_slip 20 -tau0_slip 405.8e6 456.7e6 0 0 # per family -tausat_slip 872.9e6 971.2e6 0 0 # per family -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31.0e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 +tau0_slip 405.8e6 456.7e6 # per family +tausat_slip 872.9e6 971.2e6 # per family h0_slipslip 563.0e9 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 w0_slip 2.0 -atol_resistance 1 (output) totalshear From 59e7a41aa2093da5a7bcd75d661f89ed60f4fbf6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 20 Aug 2016 07:14:18 +0200 Subject: [PATCH 090/139] now longer write empty file if file given in {} not existing --- code/IO.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/IO.f90 b/code/IO.f90 index db0c056fe..22b56d819 100644 --- a/code/IO.f90 +++ b/code/IO.f90 @@ -129,6 +129,7 @@ recursive function IO_read(fileUnit,reset) result(line) !-------------------------------------------------------------------------------------------------- ! normal case if (input == '') return ! regular line + !-------------------------------------------------------------------------------------------------- ! recursion case if (stack >= 10_pInt) call IO_error(104_pInt,ext_msg=input) ! recursion limit reached @@ -141,7 +142,7 @@ recursive function IO_read(fileUnit,reset) result(line) pathOn(stack) = path(1:scan(path,SEP,.true.))//input ! glue include to current file's dir endif - open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack)) ! open included file + open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack),action=read) ! open included file if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=pathOn(stack)) line = IO_read(fileUnit) From 4dfc8d0132e8155da1fa531a6c28e12b8c8017de Mon Sep 17 00:00:00 2001 From: zhangc43 Date: Mon, 22 Aug 2016 10:27:49 -0400 Subject: [PATCH 091/139] add MPI_finalize() following Martin & Philip suggestions; --- code/DAMASK_spectral.f90 | 118 ++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 56 deletions(-) diff --git a/code/DAMASK_spectral.f90 b/code/DAMASK_spectral.f90 index c363393d8..96b3c1451 100644 --- a/code/DAMASK_spectral.f90 +++ b/code/DAMASK_spectral.f90 @@ -81,7 +81,7 @@ program DAMASK_spectral use spectral_mech_Polarisation use spectral_damage use spectral_thermal - + implicit none @@ -93,9 +93,9 @@ program DAMASK_spectral logical, dimension(9) :: temp_maskVector = .false. !< temporarily from loadcase file when reading in tensors integer(pInt), parameter :: FILEUNIT = 234_pInt !< file unit, DAMASK IO does not support newunit feature integer(pInt), allocatable, dimension(:) :: chunkPos - + integer(pInt) :: & - N_t = 0_pInt, & !< # of time indicators found in load case file + N_t = 0_pInt, & !< # of time indicators found in load case file N_n = 0_pInt, & !< # of increment specifiers found in load case file N_def = 0_pInt !< # of rate of deformation specifiers found in load case file character(len=65536) :: & @@ -105,7 +105,7 @@ program DAMASK_spectral ! loop variables, convergence etc. real(pReal), dimension(3,3), parameter :: & ones = 1.0_pReal, & - zeros = 0.0_pReal + zeros = 0.0_pReal integer(pInt), parameter :: & subStepFactor = 2_pInt !< for each substep, divide the last time increment by 2.0 real(pReal) :: & @@ -150,6 +150,7 @@ program DAMASK_spectral MPI_file_get_position, & MPI_file_write, & MPI_abort, & + MPI_finalize, & MPI_allreduce, & PETScFinalize @@ -159,7 +160,7 @@ program DAMASK_spectral write(6,'(/,a)') ' <<<+- DAMASK_spectral init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - + !-------------------------------------------------------------------------------------------------- ! initialize field solver information nActiveFields = 1 @@ -192,14 +193,14 @@ program DAMASK_spectral call IO_error(error_ID=837_pInt,ext_msg = trim(loadCaseFile)) ! error message for incomplete loadcase allocate (loadCases(N_n)) ! array of load cases loadCases%P%myType='p' - + do i = 1, size(loadCases) allocate(loadCases(i)%ID(nActiveFields)) field = 1 loadCases(i)%ID(field) = FIELD_MECH_ID ! mechanical active by default thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then field = field + 1 - loadCases(i)%ID(field) = FIELD_THERMAL_ID + loadCases(i)%ID(field) = FIELD_THERMAL_ID endif thermalActive damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then field = field + 1 @@ -231,11 +232,11 @@ program DAMASK_spectral do j = 1_pInt, 9_pInt temp_maskVector(j) = IO_stringValue(line,chunkPos,i+j) /= '*' ! true if not a * enddo - do j = 1_pInt,9_pInt + do j = 1_pInt,9_pInt if (temp_maskVector(j)) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) ! read value where applicable enddo loadCases(currentLoadCase)%deformation%maskLogical = & ! logical mask in 3x3 notation - transpose(reshape(temp_maskVector,[ 3,3])) + transpose(reshape(temp_maskVector,[ 3,3])) loadCases(currentLoadCase)%deformation%maskFloat = & ! float (1.0/0.0) mask in 3x3 notation merge(ones,zeros,loadCases(currentLoadCase)%deformation%maskLogical) loadCases(currentLoadCase)%deformation%values = math_plain9to33(temp_valueVector) ! values in 3x3 notation @@ -259,10 +260,10 @@ program DAMASK_spectral loadCases(currentLoadCase)%incs = IO_intValue(line,chunkPos,i+1_pInt) loadCases(currentLoadCase)%logscale = 1_pInt case('freq','frequency','outputfreq') ! frequency of result writings - loadCases(currentLoadCase)%outputfrequency = IO_intValue(line,chunkPos,i+1_pInt) + loadCases(currentLoadCase)%outputfrequency = IO_intValue(line,chunkPos,i+1_pInt) case('r','restart','restartwrite') ! frequency of writing restart information loadCases(currentLoadCase)%restartfrequency = & - max(0_pInt,IO_intValue(line,chunkPos,i+1_pInt)) + max(0_pInt,IO_intValue(line,chunkPos,i+1_pInt)) case('guessreset','dropguessing') loadCases(currentLoadCase)%followFormerTrajectory = .false. ! do not continue to predict deformation along former trajectory case('euler') ! rotation of currentLoadCase given in euler angles @@ -271,10 +272,10 @@ program DAMASK_spectral k = 1_pInt ! assuming keyword indicating degree/radians present select case (IO_lc(IO_stringValue(line,chunkPos,i+1_pInt))) case('deg','degree') - case('rad','radian') ! don't convert from degree to radian + case('rad','radian') ! don't convert from degree to radian l = 0_pInt - case default - k = 0_pInt + case default + k = 0_pInt end select do j = 1_pInt, 3_pInt temp_valueVector(j) = IO_floatValue(line,chunkPos,i+k+j) @@ -289,7 +290,7 @@ program DAMASK_spectral loadCases(currentLoadCase)%rotation = math_plain9to33(temp_valueVector) end select enddo; enddo - close(FILEUNIT) + close(FILEUNIT) !-------------------------------------------------------------------------------------------------- ! consistency checks and output of load case @@ -323,7 +324,7 @@ program DAMASK_spectral enddo if (any(loadCases(currentLoadCase)%P%maskLogical .eqv. & loadCases(currentLoadCase)%deformation%maskLogical)) errorID = 831_pInt ! exclusive or masking only - if (any(loadCases(currentLoadCase)%P%maskLogical .and. & + if (any(loadCases(currentLoadCase)%P%maskLogical .and. & transpose(loadCases(currentLoadCase)%P%maskLogical) .and. & reshape([ .false.,.true.,.true.,.true.,.false.,.true.,.true.,.true.,.false.],[ 3,3]))) & errorID = 838_pInt ! no rotation is allowed by stress BC @@ -358,7 +359,7 @@ program DAMASK_spectral endif !-------------------------------------------------------------------------------------------------- -! doing initialization depending on selected solver +! doing initialization depending on selected solver call Utilities_init() do field = 1, nActiveFields select case (loadCases(1)%ID(field)) @@ -370,26 +371,26 @@ program DAMASK_spectral if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0 .and. worldrank == 0_pInt) & call IO_warning(42_pInt, ext_msg='debug Divergence') call AL_init - + case (DAMASK_spectral_SolverPolarisation_label) if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0 .and. worldrank == 0_pInt) & call IO_warning(42_pInt, ext_msg='debug Divergence') call Polarisation_init - + case default call IO_error(error_ID = 891, ext_msg = trim(spectral_solver)) - - end select - + + end select + case(FIELD_THERMAL_ID) call spectral_thermal_init - + case(FIELD_DAMAGE_ID) call spectral_damage_init() end select enddo - + !-------------------------------------------------------------------------------------------------- ! write header of output file if (worldrank == 0) then @@ -408,7 +409,7 @@ program DAMASK_spectral write(resUnit) 'logscales:', loadCases%logscale write(resUnit) 'increments:', loadCases%incs ! one entry per LoadCase write(resUnit) 'startingIncrement:', restartInc - 1_pInt ! start with writing out the previous inc - write(resUnit) 'eoh' + write(resUnit) 'eoh' close(resUnit) ! end of header open(newunit=statUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& '.sta',form='FORMATTED',status='REPLACE') @@ -458,7 +459,7 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! loopping over loadcases loadCaseLooping: do currentLoadCase = 1_pInt, size(loadCases) - time0 = time ! currentLoadCase start time + time0 = time ! currentLoadCase start time guess = loadCases(currentLoadCase)%followFormerTrajectory ! change of load case? homogeneous guess for the first inc !-------------------------------------------------------------------------------------------------- @@ -472,9 +473,9 @@ program DAMASK_spectral if (loadCases(currentLoadCase)%logscale == 0_pInt) then ! linear scale timeinc = loadCases(currentLoadCase)%time/real(loadCases(currentLoadCase)%incs,pReal) ! only valid for given linear time scale. will be overwritten later in case loglinear scale is used else - if (currentLoadCase == 1_pInt) then ! 1st currentLoadCase of logarithmic scale + if (currentLoadCase == 1_pInt) then ! 1st currentLoadCase of logarithmic scale if (inc == 1_pInt) then ! 1st inc of 1st currentLoadCase of logarithmic scale - timeinc = loadCases(1)%time*(2.0_pReal**real( 1_pInt-loadCases(1)%incs ,pReal)) ! assume 1st inc is equal to 2nd + timeinc = loadCases(1)%time*(2.0_pReal**real( 1_pInt-loadCases(1)%incs ,pReal)) ! assume 1st inc is equal to 2nd else ! not-1st inc of 1st currentLoadCase of logarithmic scale timeinc = loadCases(1)%time*(2.0_pReal**real(inc-1_pInt-loadCases(1)%incs ,pReal)) endif @@ -492,12 +493,12 @@ program DAMASK_spectral stepFraction = 0_pInt !-------------------------------------------------------------------------------------------------- -! loop over sub incs +! loop over sub incs subIncLooping: do while (stepFraction/subStepFactor**cutBackLevel <1_pInt) time = time + timeinc ! forward time - stepFraction = stepFraction + 1_pInt + stepFraction = stepFraction + 1_pInt remainingLoadCaseTime = time0 - time + loadCases(currentLoadCase)%time + timeInc - + !-------------------------------------------------------------------------------------------------- ! report begin of new increment if (worldrank == 0) then @@ -515,7 +516,7 @@ program DAMASK_spectral ',a,'//IO_intOut(stepFraction)//',a,'//IO_intOut(subStepFactor**cutBackLevel)//')') & 'Increment ',totalIncsCounter,'/',sum(loadCases%incs),& '-',stepFraction, '/', subStepFactor**cutBackLevel - endif + endif !-------------------------------------------------------------------------------------------------- ! forward fields @@ -541,18 +542,18 @@ program DAMASK_spectral F_BC = loadCases(currentLoadCase)%deformation, & P_BC = loadCases(currentLoadCase)%P, & rotation_BC = loadCases(currentLoadCase)%rotation) - end select - + end select + case(FIELD_THERMAL_ID) call spectral_thermal_forward (& guess,timeinc,timeIncOld,remainingLoadCaseTime) - + case(FIELD_DAMAGE_ID) call spectral_damage_forward (& guess,timeinc,timeIncOld,remainingLoadCaseTime) end select - enddo - + enddo + !-------------------------------------------------------------------------------------------------- ! solve fields stagIter = 0_pInt @@ -568,27 +569,27 @@ program DAMASK_spectral P_BC = loadCases(currentLoadCase)%P, & F_BC = loadCases(currentLoadCase)%deformation, & rotation_BC = loadCases(currentLoadCase)%rotation) - + case (DAMASK_spectral_SolverAL_label) solres(field) = AL_solution (& incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & P_BC = loadCases(currentLoadCase)%P, & F_BC = loadCases(currentLoadCase)%deformation, & rotation_BC = loadCases(currentLoadCase)%rotation) - + case (DAMASK_spectral_SolverPolarisation_label) solres(field) = Polarisation_solution (& incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & P_BC = loadCases(currentLoadCase)%P, & F_BC = loadCases(currentLoadCase)%deformation, & rotation_BC = loadCases(currentLoadCase)%rotation) - - end select - + + end select + case(FIELD_THERMAL_ID) solres(field) = spectral_thermal_solution (& guess,timeinc,timeIncOld,remainingLoadCaseTime) - + case(FIELD_DAMAGE_ID) solres(field) = spectral_damage_solution (& guess,timeinc,timeIncOld,remainingLoadCaseTime) @@ -600,11 +601,11 @@ program DAMASK_spectral stagIterate = stagIter < stagItMax .and. & all(solres(:)%converged) .and. & .not. all(solres(:)%stagConverged) - enddo + enddo !-------------------------------------------------------------------------------------------------- -! check solution - cutBack = .False. +! check solution + cutBack = .False. if(solres(1)%termIll .or. .not. all(solres(:)%converged .and. solres(:)%stagConverged)) then ! no solution found if (cutBackLevel < maxCutBack) then ! do cut back if (worldrank == 0) write(6,'(/,a)') ' cut back detected' @@ -617,8 +618,8 @@ program DAMASK_spectral call IO_warning(850_pInt) call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written elseif (continueCalculation == 1_pInt) then - guess = .true. ! accept non converged BVP solution - else ! default behavior, exit if spectral solver does not converge + guess = .true. ! accept non converged BVP solution + else ! default behavior, exit if spectral solver does not converge call IO_warning(850_pInt) call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written endif @@ -630,8 +631,8 @@ program DAMASK_spectral write(statUnit,*) totalIncsCounter, time, cutBackLevel, & solres%converged, solres%iterationsNeeded ! write statistics about accepted solution flush(statUnit) - endif - endif + endif + endif enddo subIncLooping cutBackLevel = max(0_pInt, cutBackLevel - 1_pInt) ! try half number of subincs next inc if(all(solres(:)%converged)) then ! report converged inc @@ -662,11 +663,11 @@ program DAMASK_spectral enddo fileOffset = fileOffset + sum(outputSize) ! forward to current file position endif - if( loadCases(currentLoadCase)%restartFrequency > 0_pInt .and. & ! at frequency of writing restart information set restart parameter for FEsolving - mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! first call to CPFEM_general will write? + if( loadCases(currentLoadCase)%restartFrequency > 0_pInt .and. & ! at frequency of writing restart information set restart parameter for FEsolving + mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! first call to CPFEM_general will write? restartWrite = .true. lastRestartWritten = inc - endif + endif else forwarding time = time + timeinc guess = .true. @@ -698,7 +699,7 @@ program DAMASK_spectral call AL_destroy() case (DAMASK_spectral_SolverPolarisation_label) call Polarisation_destroy() - end select + end select case(FIELD_THERMAL_ID) call spectral_thermal_destroy() case(FIELD_DAMAGE_ID) @@ -709,6 +710,11 @@ program DAMASK_spectral call PETScFinalize(ierr); CHKERRQ(ierr) + #ifdef _OPENMP + call MPI_finalize(i) + if (i /= 0_pInt) call IO_error(error_ID=894, el=i, ext_msg="Finalize()") + #endif + if (notConvergedCounter > 0_pInt) call quit(3_pInt) ! error if some are not converged call quit(0_pInt) ! no complains ;) @@ -719,7 +725,7 @@ end program DAMASK_spectral !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @brief quit subroutine to mimic behavior of FEM solvers !> @details exits the Spectral solver and reports time and duration. Exit code 0 signals -!> everything went fine. Exit code 1 signals an error, message according to IO_error. Exit code +!> everything went fine. Exit code 1 signals an error, message according to IO_error. Exit code !> 2 signals no converged solution and increment of last saved restart information is written to !> stderr. Exit code 3 signals no severe problems, but some increments did not converge !-------------------------------------------------------------------------------------------------- @@ -739,7 +745,7 @@ subroutine quit(stop_id) write(6,'(a,2(i2.2,a),i2.2)') 'Time: ',dateAndTime(5),':',& dateAndTime(6),':',& dateAndTime(7) - + if (stop_id == 0_pInt) stop 0 ! normal termination if (stop_id < 0_pInt) then ! terminally ill, restart might help write(0,'(a,i6)') 'restart information available at ', stop_id*(-1_pInt) From 3d0e19de0a3632daf1908652913abf02868466de Mon Sep 17 00:00:00 2001 From: zhangc43 Date: Mon, 22 Aug 2016 17:45:05 -0400 Subject: [PATCH 092/139] syntax polish for ifdef --- code/DAMASK_spectral.f90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/DAMASK_spectral.f90 b/code/DAMASK_spectral.f90 index 96b3c1451..1d3a0a0cb 100644 --- a/code/DAMASK_spectral.f90 +++ b/code/DAMASK_spectral.f90 @@ -711,8 +711,10 @@ program DAMASK_spectral call PETScFinalize(ierr); CHKERRQ(ierr) #ifdef _OPENMP - call MPI_finalize(i) - if (i /= 0_pInt) call IO_error(error_ID=894, el=i, ext_msg="Finalize()") + call MPI_finalize(i) + if (i /= 0_pInt) then + call IO_error(error_ID=894, el=i, ext_msg="Finalize()") + endif #endif if (notConvergedCounter > 0_pInt) call quit(3_pInt) ! error if some are not converged From af10f920419506b97f7abf6d3c1119bfb5e8723b Mon Sep 17 00:00:00 2001 From: zhangc43 Date: Tue, 23 Aug 2016 08:29:42 -0400 Subject: [PATCH 093/139] remove space before preprocessor --- code/DAMASK_spectral.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/DAMASK_spectral.f90 b/code/DAMASK_spectral.f90 index 1d3a0a0cb..2793b502c 100644 --- a/code/DAMASK_spectral.f90 +++ b/code/DAMASK_spectral.f90 @@ -710,12 +710,12 @@ program DAMASK_spectral call PETScFinalize(ierr); CHKERRQ(ierr) - #ifdef _OPENMP +#ifdef _OPENMP call MPI_finalize(i) if (i /= 0_pInt) then call IO_error(error_ID=894, el=i, ext_msg="Finalize()") endif - #endif +#endif if (notConvergedCounter > 0_pInt) call quit(3_pInt) ! error if some are not converged call quit(0_pInt) ! no complains ;) From 7710f4d444556116f8da91c8189b763efab1c942 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 23 Aug 2016 17:21:17 +0200 Subject: [PATCH 094/139] hybridIA (stand alone script and DAMASK) need standard ASCII table export of TSL OIM is similar to standard ASCII table, simply add correct header including labels --- processing/pre/OIMlinear2linearODF.py | 106 -------------------------- 1 file changed, 106 deletions(-) delete mode 100755 processing/pre/OIMlinear2linearODF.py diff --git a/processing/pre/OIMlinear2linearODF.py b/processing/pre/OIMlinear2linearODF.py deleted file mode 100755 index d50c07a37..000000000 --- a/processing/pre/OIMlinear2linearODF.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python2.7 -# -*- coding: UTF-8 no BOM -*- - -import os,sys -from optparse import OptionParser -import numpy as np -import damask - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -sampleSym = { 'Orthotropic' : (90,90,90), - 'Triclinic' : (360,180,360) - } - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Transform the binned texture data from "TSL OIM Analysis" into linear ODF data, - -""", version = scriptID) - -parser.add_option('-s', '--symmetry', dest='symmetry', choices=sampleSym.keys(), - metavar = 'string', - help='Sample symmetry {%s} [Triclinic]'%(' '.join(sampleSym.keys()))) - -parser.set_defaults(symmetry = 'Triclinic') - -(options,filenames) = parser.parse_args() - -#--- setup file handles --------------------------------------------------------------------------- -files = [] -if filenames == []: - files.append({'name':'STDIN', - 'input':sys.stdin, - 'output':sys.stdout, - 'croak':sys.stderr, - }) -else: - for name in filenames: - if os.path.exists(name): - files.append({'name':name, - 'input':open(name), - 'output':open(name+'_tmp','w'), - 'croak':sys.stdout, - }) - -#--- loop over input files ------------------------------------------------------------------------ -for file in files: - file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n') - - while True: # read header (forward and get bin Size) - line = file['input'].readline() - words = line.split() - if len(words)>=3: - if words[1]=='Bin' and words[2]=='Size:': binSize=float(words[3][:-1]) - if not line.startswith('#'): break - - delta = [sampleSym[options.symmetry][i]/binSize for i in xrange(3)] - - nPhi1,nPHI,nPhi2 = map(int,delta) - dPhi1,dPHI,dPhi2 = [sampleSym[options.symmetry][i]/delta[i] for i in xrange(3)] - - N = (nPhi1-1)*(nPHI-1)*(nPhi2-1) - - - ODF = [[[[None] for k in range(nPhi2)] for j in range(nPHI)] for i in range(nPhi1)] - linear = [None]*N - - ODF = np.empty([nPhi1,nPHI,nPhi2],'d') - - for iPhi1 in range(nPhi1): - for iPHI in range(nPHI): - for iPhi2 in range(nPhi2): - ODF[iPhi1,iPHI,iPhi2] = float(line.split()[3])*0.125 # extract intensity (in column 4) and weight by 1/8 - line = file['input'].readline() - - for iPhi1 in range(nPhi1-1): - for iPHI in range(nPHI-1): - for iPhi2 in range(nPhi2-1): - linear[iPhi1*(nPHI-1)*(nPhi2-1)+iPHI*(nPhi2-1)+iPhi2] =\ - ODF[iPhi1 ,iPHI ,iPhi2 ] +\ - ODF[iPhi1 ,iPHI ,iPhi2+1] +\ - ODF[iPhi1 ,iPHI+1,iPhi2 ] +\ - ODF[iPhi1 ,iPHI+1,iPhi2+1] +\ - ODF[iPhi1+1,iPHI ,iPhi2 ] +\ - ODF[iPhi1+1,iPHI ,iPhi2+1] +\ - ODF[iPhi1+1,iPHI+1,iPhi2 ] +\ - ODF[iPhi1+1,iPHI+1,iPhi2+1] - - - file['output'].write('4 header\n') - file['output'].write('limit phi1 %-6.2f Phi %-6.2f phi2 %-6.2f\n'%sampleSym[options.symmetry]) - file['output'].write('delta phi1 %-6.2f Phi %-6.2f phi2 %-6.2f\n'%(dPhi1,dPHI,dPhi2)) - file['output'].write('centration cell-centered\n') - file['output'].write('density\n') - - for i in range(N): - file['output'].write('%g\n'%(linear[i])) - -#--- output finalization -------------------------------------------------------------------------- - if file['name'] != 'STDIN': - file['output'].close() - os.rename(file['name']+'_tmp',os.path.splitext(file['name'])[0] +'.linearODF') From 5b6f41cb6b7c73976c5cf74922a17e31ed7833c1 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 24 Aug 2016 04:27:41 +0200 Subject: [PATCH 095/139] updated version information after successful test of v2.0.1-47-gaf10f92 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 921b19cbd..a4ea1f3b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-43-g64ac05f +v2.0.1-47-gaf10f92 From f984f1ebea85ff8dc502330684b628945aa95b62 Mon Sep 17 00:00:00 2001 From: Zhuowen Zhao Date: Wed, 24 Aug 2016 16:05:50 -0400 Subject: [PATCH 096/139] enable floating point data and corrected counting of microstructures --- processing/pre/geom_translate.py | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index 83c71aa8d..f0d39e66f 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -30,30 +30,37 @@ parser.add_option('-s', '--substitute', dest = 'substitute', action = 'extend', metavar = '', help = 'substitutions of microstructure indices from,to,from,to,...') +parser.add_option('--float', + dest = 'real', + action = 'store_true', + help = 'use float input') parser.set_defaults(origin = (0.0,0.0,0.0), microstructure = 0, substitute = [], + real = False, ) (options, filenames) = parser.parse_args() +datatype = 'f' if options.real else 'i' + sub = {} -for i in xrange(len(options.substitute)/2): # split substitution list into "from" -> "to" +for i in xrange(len(options.substitute)/2): # split substitution list into "from" -> "to" sub[int(options.substitute[i*2])] = int(options.substitute[i*2+1]) -# --- loop over input files ------------------------------------------------------------------------- +# --- loop over input files ---------------------------------------------------------------------- if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False, labeled = False) + try: table = damask.ASCIItable(name = name, + buffered = False, + labeled = False) except: continue damask.util.report(scriptName,name) -# --- interpret header ---------------------------------------------------------------------------- +# --- interpret header --------------------------------------------------------------------------- table.head_read() info,extra_header = table.head_getGeom() @@ -73,9 +80,9 @@ for name in filenames: table.close(dismiss = True) continue -# --- read data ------------------------------------------------------------------------------------ +# --- read data ---------------------------------------------------------------------------------- - microstructure = table.microstructure_read(info['grid']) # read microstructure + microstructure = table.microstructure_read(info['grid'],datatype) # read microstructure # --- do work ------------------------------------------------------------------------------------ @@ -90,9 +97,9 @@ for name in filenames: substituted += options.microstructure # shift microstructure indices newInfo['origin'] = info['origin'] + options.origin - newInfo['microstructures'] = substituted.max() + newInfo['microstructures'] = len(np.unique(substituted)) -# --- report --------------------------------------------------------------------------------------- +# --- report ------------------------------------------------------------------------------------- remarks = [] if (any(newInfo['origin'] != info['origin'])): @@ -101,7 +108,7 @@ for name in filenames: remarks.append('--> microstructures: %i'%newInfo['microstructures']) if remarks != []: damask.util.croak(remarks) -# --- write header --------------------------------------------------------------------------------- +# --- write header ------------------------------------------------------------------------------- table.labels_clear() table.info_clear() @@ -116,12 +123,12 @@ for name in filenames: ]) table.head_write() -# --- write microstructure information ------------------------------------------------------------ +# --- write microstructure information ----------------------------------------------------------- - formatwidth = int(math.floor(math.log10(microstructure.max())+1)) + format = '%g' if options.real else '%{}i'.format(int(math.floor(math.log10(microstructure.max())+1))) table.data = substituted.reshape((info['grid'][0],info['grid'][1]*info['grid'][2]),order='F').transpose() - table.data_writeArray('%%%ii'%(formatwidth),delimiter = ' ') + table.data_writeArray(format,delimiter = ' ') -# --- output finalization -------------------------------------------------------------------------- +# --- output finalization ------------------------------------------------------------------------ - table.close() # close ASCII table + table.close() # close ASCII table From 64db098e2a0701589926278c81b7c998f87eadea Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 25 Aug 2016 04:27:12 +0200 Subject: [PATCH 097/139] updated version information after successful test of v2.0.1-49-gf984f1e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a4ea1f3b9..a0ee30953 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-47-gaf10f92 +v2.0.1-49-gf984f1e From 60765067389f77f21bbedcbfac0655fc71899c4f Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 11:57:19 -0400 Subject: [PATCH 098/139] general polishing and removal of redundant do-loop --- code/DAMASK_spectral.f90 | 53 +++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/code/DAMASK_spectral.f90 b/code/DAMASK_spectral.f90 index 2793b502c..67e3f4042 100644 --- a/code/DAMASK_spectral.f90 +++ b/code/DAMASK_spectral.f90 @@ -231,8 +231,6 @@ program DAMASK_spectral endif do j = 1_pInt, 9_pInt temp_maskVector(j) = IO_stringValue(line,chunkPos,i+j) /= '*' ! true if not a * - enddo - do j = 1_pInt,9_pInt if (temp_maskVector(j)) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) ! read value where applicable enddo loadCases(currentLoadCase)%deformation%maskLogical = & ! logical mask in 3x3 notation @@ -244,8 +242,6 @@ program DAMASK_spectral temp_valueVector = 0.0_pReal do j = 1_pInt, 9_pInt temp_maskVector(j) = IO_stringValue(line,chunkPos,i+j) /= '*' ! true if not an asterisk - enddo - do j = 1_pInt,9_pInt if (temp_maskVector(j)) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) ! read value where applicable enddo loadCases(currentLoadCase)%P%maskLogical = transpose(reshape(temp_maskVector,[ 3,3])) @@ -302,14 +298,14 @@ program DAMASK_spectral write(6,'(1x,a,i6)') 'load case: ', currentLoadCase if (.not. loadCases(currentLoadCase)%followFormerTrajectory) & write(6,'(2x,a)') 'drop guessing along trajectory' - if (loadCases(currentLoadCase)%deformation%myType=='l') then + if (loadCases(currentLoadCase)%deformation%myType == 'l') then do j = 1_pInt, 3_pInt if (any(loadCases(currentLoadCase)%deformation%maskLogical(j,1:3) .eqv. .true.) .and. & any(loadCases(currentLoadCase)%deformation%maskLogical(j,1:3) .eqv. .false.)) & errorID = 832_pInt ! each row should be either fully or not at all defined enddo write(6,'(2x,a)') 'velocity gradient:' - else if (loadCases(currentLoadCase)%deformation%myType=='f') then + else if (loadCases(currentLoadCase)%deformation%myType == 'f') then write(6,'(2x,a)') 'deformation gradient at end of load case:' else write(6,'(2x,a)') 'deformation gradient rate:' @@ -318,13 +314,13 @@ program DAMASK_spectral if(loadCases(currentLoadCase)%deformation%maskLogical(i,j)) then write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%deformation%values(i,j) else - write(6,'(2x,12a)',advance='no') ' * ' + write(6,'(2x,12a)',advance='no') ' * ' endif enddo; write(6,'(/)',advance='no') enddo if (any(loadCases(currentLoadCase)%P%maskLogical .eqv. & - loadCases(currentLoadCase)%deformation%maskLogical)) errorID = 831_pInt ! exclusive or masking only - if (any(loadCases(currentLoadCase)%P%maskLogical .and. & + loadCases(currentLoadCase)%deformation%maskLogical)) errorID = 831_pInt ! exclusive or masking only + if (any(loadCases(currentLoadCase)%P%maskLogical .and. & transpose(loadCases(currentLoadCase)%P%maskLogical) .and. & reshape([ .false.,.true.,.true.,.true.,.false.,.true.,.true.,.true.,.false.],[ 3,3]))) & errorID = 838_pInt ! no rotation is allowed by stress BC @@ -333,12 +329,12 @@ program DAMASK_spectral if(loadCases(currentLoadCase)%P%maskLogical(i,j)) then write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%P%values(i,j)*1e-9_pReal else - write(6,'(2x,12a)',advance='no') ' * ' + write(6,'(2x,12a)',advance='no') ' * ' endif enddo; write(6,'(/)',advance='no') enddo if (any(abs(math_mul33x33(loadCases(currentLoadCase)%rotation, & - math_transpose33(loadCases(currentLoadCase)%rotation))-math_I3) >& + math_transpose33(loadCases(currentLoadCase)%rotation))-math_I3) > & reshape(spread(tol_math_check,1,9),[ 3,3]))& .or. abs(math_det33(loadCases(currentLoadCase)%rotation)) > & 1.0_pReal + tol_math_check) errorID = 846_pInt ! given rotation matrix contains strain @@ -378,10 +374,10 @@ program DAMASK_spectral call Polarisation_init case default - call IO_error(error_ID = 891, ext_msg = trim(spectral_solver)) - - end select - + call IO_error(error_ID = 891_pInt, ext_msg = trim(spectral_solver)) + + end select + case(FIELD_THERMAL_ID) call spectral_thermal_init @@ -428,29 +424,30 @@ program DAMASK_spectral allocate(outputSize(worldsize), source = 0_MPI_OFFSET_KIND) outputSize(worldrank+1) = size(materialpoint_results,kind=MPI_OFFSET_KIND)*int(pReal,MPI_OFFSET_KIND) call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_allreduce') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_allreduce') call MPI_file_open(PETSC_COMM_WORLD, & trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.spectralOut', & MPI_MODE_WRONLY + MPI_MODE_APPEND, & MPI_INFO_NULL, & resUnit, & ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_open') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_open') call MPI_file_get_position(resUnit,fileOffset,ierr) ! get offset from header - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_get_position') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_get_position') fileOffset = fileOffset + sum(outputSize(1:worldrank)) ! offset of my process in file (header + processes before me) call MPI_file_seek (resUnit,fileOffset,MPI_SEEK_SET,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_seek') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_seek') if (.not. appendToOutFile) then ! if not restarting, write 0th increment - do i=1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output - outputIndex=int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & - min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) - call MPI_file_write(resUnit,reshape(materialpoint_results(:,:,outputIndex(1):outputIndex(2)),& - [(outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults]), & - (outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults,& + do i = 1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output + outputIndex = int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & + min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) + call MPI_file_write(resUnit, & + reshape(materialpoint_results(:,:,outputIndex(1):outputIndex(2)), & + [(outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults]), & + (outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults, & MPI_DOUBLE, MPI_STATUS_IGNORE, ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_write') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_write') enddo fileOffset = fileOffset + sum(outputSize) ! forward to current file position if (worldrank == 0) & @@ -489,7 +486,7 @@ program DAMASK_spectral endif timeinc = timeinc / 2.0_pReal**real(cutBackLevel,pReal) ! depending on cut back level, decrease time step - forwarding: if(totalIncsCounter >= restartInc) then + forwarding: if (totalIncsCounter >= restartInc) then stepFraction = 0_pInt !-------------------------------------------------------------------------------------------------- @@ -595,7 +592,7 @@ program DAMASK_spectral guess,timeinc,timeIncOld,remainingLoadCaseTime) end select - if(.not. solres(field)%converged) exit ! no solution found + if (.not. solres(field)%converged) exit ! no solution found enddo stagIter = stagIter + 1_pInt stagIterate = stagIter < stagItMax .and. & From f9c3d335fcf60a1bba377215191a0ff98668e902 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 11:59:04 -0400 Subject: [PATCH 099/139] two new methods to convey deemphasis and deletion --- lib/damask/util.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index cfc44f26c..4aec363c5 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -20,6 +20,7 @@ class bcolors: FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' + DIM = '\033[2m' UNDERLINE = '\033[4m' def disable(self): @@ -70,9 +71,19 @@ def report_geom(info, # ----------------------------- def emph(what): - """emphasizes string on screen""" + """boldens string""" return bcolors.BOLD+srepr(what)+bcolors.ENDC +# ----------------------------- +def deemph(what): + """dims string""" + return bcolors.DIM+srepr(what)+bcolors.ENDC + +# ----------------------------- +def delete(what): + """dims string""" + return bcolors.DIM+srepr(what)+bcolors.ENDC + # ----------------------------- def execute(cmd, streamIn = None, From d3eb3451e3c9bca2e97fb75537737c7670a2029d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 12:00:10 -0400 Subject: [PATCH 100/139] improved readability by splitting to one file per line --- code/Makefile | 113 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 85 insertions(+), 28 deletions(-) diff --git a/code/Makefile b/code/Makefile index 7e5a130b1..331feec27 100644 --- a/code/Makefile +++ b/code/Makefile @@ -257,10 +257,10 @@ COMPILE_OPTIONS_gfortran :=-DDAMASKVERSION=\"${DAMASKVERSION}\"\ #-Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions. #-Wstrict-overflow: -DEBUG_OPTIONS_gfortran :=-g\ - -fbacktrace\ - -fdump-core\ - -fcheck=all\ +DEBUG_OPTIONS_gfortran :=-g \ + -fbacktrace \ + -fdump-core \ + -fcheck=all \ -ffpe-trap=invalid,zero,overflow ################################################################################################### @@ -300,37 +300,60 @@ COMPILE =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$ COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) ################################################################################################### SOURCE_FILES = \ - source_thermal_dissipation.o source_thermal_externalheat.o \ - source_damage_isoBrittle.o source_damage_isoDuctile.o source_damage_anisoBrittle.o source_damage_anisoDuctile.o \ - source_vacancy_phenoplasticity.o source_vacancy_irradiation.o source_vacancy_thermalfluc.o + source_thermal_dissipation.o \ + source_thermal_externalheat.o \ + source_damage_isoBrittle.o \ + source_damage_isoDuctile.o \ + source_damage_anisoBrittle.o \ + source_damage_anisoDuctile.o \ + source_vacancy_phenoplasticity.o \ + source_vacancy_irradiation.o \ + source_vacancy_thermalfluc.o KINEMATICS_FILES = \ - kinematics_cleavage_opening.o kinematics_slipplane_opening.o \ + kinematics_cleavage_opening.o \ + kinematics_slipplane_opening.o \ kinematics_thermal_expansion.o \ - kinematics_vacancy_strain.o kinematics_hydrogen_strain.o + kinematics_vacancy_strain.o \ + kinematics_hydrogen_strain.o PLASTIC_FILES = \ - plastic_dislotwin.o plastic_disloUCLA.o plastic_isotropic.o \ - plastic_phenopowerlaw.o plastic_titanmod.o plastic_nonlocal.o plastic_none.o \ + plastic_dislotwin.o \ + plastic_disloUCLA.o \ + plastic_isotropic.o \ + plastic_phenopowerlaw.o \ + plastic_titanmod.o \ + plastic_nonlocal.o \ + plastic_none.o \ plastic_phenoplus.o THERMAL_FILES = \ - thermal_isothermal.o thermal_adiabatic.o thermal_conduction.o + thermal_isothermal.o \ + thermal_adiabatic.o \ + thermal_conduction.o DAMAGE_FILES = \ - damage_none.o damage_local.o damage_nonlocal.o + damage_none.o \ + damage_local.o \ + damage_nonlocal.o VACANCYFLUX_FILES = \ - vacancyflux_isoconc.o vacancyflux_isochempot.o vacancyflux_cahnhilliard.o + vacancyflux_isoconc.o \ + vacancyflux_isochempot.o \ + vacancyflux_cahnhilliard.o POROSITY_FILES = \ - porosity_none.o porosity_phasefield.o + porosity_none.o \ + porosity_phasefield.o HYDROGENFLUX_FILES = \ - hydrogenflux_isoconc.o hydrogenflux_cahnhilliard.o + hydrogenflux_isoconc.o \ + hydrogenflux_cahnhilliard.o HOMOGENIZATION_FILES = \ - homogenization_RGC.o homogenization_isostrain.o homogenization_none.o + homogenization_RGC.o \ + homogenization_isostrain.o \ + homogenization_none.o ##################### # Spectral Solver @@ -351,11 +374,28 @@ DAMASK_spectral.o: INTERFACENAME := spectral_interface.f90 SPECTRAL_SOLVER_FILES = spectral_mech_AL.o spectral_mech_Basic.o spectral_mech_Polarisation.o \ spectral_thermal.o spectral_damage.o -SPECTRAL_FILES = C_routines.o system_routines.o prec.o DAMASK_interface.o IO.o numerics.o debug.o math.o \ - FEsolving.o mesh.o material.o lattice.o \ - $(SOURCE_FILES) $(KINEMATICS_FILES) $(PLASTIC_FILES) constitutive.o \ +SPECTRAL_FILES = C_routines.o \ + system_routines.o \ + prec.o \ + DAMASK_interface.o \ + IO.o \ + numerics.o \ + debug.o \ + math.o \ + FEsolving.o \ + mesh.o \ + material.o \ + lattice.o \ + $(SOURCE_FILES) \ + $(KINEMATICS_FILES) \ + $(PLASTIC_FILES) \ + constitutive.o \ crystallite.o \ - $(THERMAL_FILES) $(DAMAGE_FILES) $(VACANCYFLUX_FILES) $(HYDROGENFLUX_FILES) $(POROSITY_FILES) \ + $(THERMAL_FILES) \ + $(DAMAGE_FILES) \ + $(VACANCYFLUX_FILES) \ + $(HYDROGENFLUX_FILES) \ + $(POROSITY_FILES) \ $(HOMOGENIZATION_FILES) homogenization.o \ CPFEM2.o \ spectral_utilities.o \ @@ -401,14 +441,31 @@ DAMASK_FEM.exe: INCLUDE_DIRS += -I./ FEM_SOLVER_FILES = FEM_mech.o FEM_thermal.o FEM_damage.o FEM_vacancyflux.o FEM_porosity.o FEM_hydrogenflux.o -FEM_FILES = prec.o DAMASK_interface.o FEZoo.o IO.o numerics.o debug.o math.o \ - FEsolving.o mesh.o material.o lattice.o \ - $(SOURCE_FILES) $(KINEMATICS_FILES) $(PLASTIC_FILES) constitutive.o \ +FEM_FILES = prec.o \ + DAMASK_interface.o \ + FEZoo.o \ + IO.o \ + numerics.o \ + debug.o \ + math.o \ + FEsolving.o \ + mesh.o \ + material.o \ + lattice.o \ + $(SOURCE_FILES) \ + $(KINEMATICS_FILES) \ + $(PLASTIC_FILES) \ + constitutive.o \ crystallite.o \ - $(THERMAL_FILES) $(DAMAGE_FILES) $(VACANCYFLUX_FILES) $(HYDROGENFLUX_FILES) $(POROSITY_FILES) \ + $(THERMAL_FILES) \ + $(DAMAGE_FILES) \ + $(VACANCYFLUX_FILES) \ + $(HYDROGENFLUX_FILES) \ + $(POROSITY_FILES) \ $(HOMOGENIZATION_FILES) homogenization.o \ CPFEM.o \ - FEM_utilities.o $(FEM_SOLVER_FILES) + FEM_utilities.o \ + $(FEM_SOLVER_FILES) DAMASK_FEM.exe: DAMASK_FEM_driver.o $(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \ @@ -658,8 +715,8 @@ tidy: @rm -rf *.inst.f90 # for instrumentation @rm -rf *.pomp.f90 # for instrumentation @rm -rf *.pp.f90 # for instrumentation - @rm -rf *.pdb # for instrumnentation - @rm -rf *.opari.inc # for instrumnentation + @rm -rf *.pdb # for instrumentation + @rm -rf *.opari.inc # for instrumentation .PHONY: cleanDAMASK cleanDAMASK: From eb9f6c939c4b83e746a4a4293937e6255f32cdf3 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 12:08:19 -0400 Subject: [PATCH 101/139] condensed output, DAMASK_marc symlinks are relative, add symlink pruning --- installation/symlink_Code.py | 56 +++++++++++++++++++++--------- installation/symlink_Processing.py | 40 ++++++++++++++++----- 2 files changed, 71 insertions(+), 25 deletions(-) diff --git a/installation/symlink_Code.py b/installation/symlink_Code.py index 1e67c8a7b..933f31c8e 100755 --- a/installation/symlink_Code.py +++ b/installation/symlink_Code.py @@ -11,7 +11,15 @@ bin_link = { \ ], } -MarcReleases =[2011,2012,2013,2013.1,2014,2014.2,2015] +MarcReleases =[ \ + '2011', + '2012', + '2013', + '2013.1', + '2014', + '2014.2', + '2015', + ] damaskEnv = damask.Environment() baseDir = damaskEnv.relPath('code/') @@ -20,27 +28,41 @@ binDir = damaskEnv.options['DAMASK_BIN'] if not os.path.isdir(binDir): os.mkdir(binDir) -for dir in bin_link: - for file in bin_link[dir]: - src = os.path.abspath(os.path.join(baseDir,dir,file)) - if os.path.exists(src): - sym_link = os.path.abspath(os.path.join(binDir,\ - {True: dir, - False:os.path.splitext(file)[0]}[file == ''])) - if os.path.lexists(sym_link): os.remove(sym_link) - os.symlink(src,sym_link) - sys.stdout.write(sym_link+' -> '+src+'\n') +sys.stdout.write('\nsymbolic linking...\n') +for subDir in bin_link: + theDir = os.path.abspath(os.path.join(baseDir,subDir)) + sys.stdout.write('\n'+binDir+' ->\n'+theDir+damask.util.deemph(' ...')+'\n') + + for theFile in bin_link[subDir]: + theName,theExt = os.path.splitext(theFile) + src = os.path.abspath(os.path.join(theDir,theFile)) + + if os.path.exists(src): + sym_link = os.path.abspath(os.path.join(binDir,subDir if theFile == '' else theName)) + + if os.path.lexists(sym_link): + os.remove(sym_link) + output = theName+damask.util.deemph(theExt) + else: + output = damask.util.emph(theName)+damask.util.deemph(theExt) + + sys.stdout.write(damask.util.deemph('... ')+output+'\n') + os.symlink(src,sym_link) + + +sys.stdout.write('\nMSC.Marc versioning...\n\n') +theMaster = 'DAMASK_marc.f90' for version in MarcReleases: - src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90')) + src = os.path.abspath(os.path.join(baseDir,theMaster)) if os.path.exists(src): - sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90')) + sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc{}.f90'.format(version))) if os.path.lexists(sym_link): os.remove(sym_link) - sys.stdout.write(sym_link) + output = version else: - sys.stdout.write(damask.util.emph(sym_link)) + output = damask.util.emph(version) - os.symlink(src,sym_link) - sys.stdout.write(' -> '+src+'\n') + sys.stdout.write(' '+output+'\n') + os.symlink(theMaster,sym_link) diff --git a/installation/symlink_Processing.py b/installation/symlink_Processing.py index 6cb8f9135..d10b5af55 100755 --- a/installation/symlink_Processing.py +++ b/installation/symlink_Processing.py @@ -13,23 +13,47 @@ if not os.path.isdir(binDir): os.mkdir(binDir) #define ToDo list -processing_subDirs = ['pre','post','misc',] -processing_extensions = ['.py','.sh',] - +processing_subDirs = ['pre', + 'post', + 'misc', + ] +processing_extensions = ['.py', + '.sh', + ] + +sys.stdout.write('\nsymbolic linking...\n') + for subDir in processing_subDirs: theDir = os.path.abspath(os.path.join(baseDir,subDir)) + sys.stdout.write('\n'+binDir+' ->\n'+theDir+damask.util.deemph(' ...')+'\n') + for theFile in os.listdir(theDir): - if os.path.splitext(theFile)[1] in processing_extensions: # only consider files with proper extensions + theName,theExt = os.path.splitext(theFile) + if theExt in processing_extensions: # only consider files with proper extensions src = os.path.abspath(os.path.join(theDir,theFile)) - sym_link = os.path.abspath(os.path.join(binDir,os.path.splitext(theFile)[0])) + sym_link = os.path.abspath(os.path.join(binDir,theName)) if os.path.lexists(sym_link): os.remove(sym_link) - sys.stdout.write(sym_link) + output = theName+damask.util.deemph(theExt) else: - sys.stdout.write(damask.util.emph(sym_link)) + output = damask.util.emph(theName)+damask.util.deemph(theExt) + sys.stdout.write(damask.util.deemph('... ')+output+'\n') os.symlink(src,sym_link) - sys.stdout.write(' -> '+src+'\n') + + +sys.stdout.write('\npruning broken links...\n') + +brokenLinks = 0 + +for filename in os.listdir(binDir): + path = os.path.join(binDir,filename) + if os.path.islink(path) and not os.path.exists(path): + sys.stdout.write(' '+damask.util.delete(path)+'\n') + os.remove(path) + brokenLinks += 1 + +sys.stdout.write(('none.' if brokenLinks == 0 else '')+'\n') From 85abf84186cd89c9d2e8fd2444b1117fa12b14b7 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 12:15:03 -0400 Subject: [PATCH 102/139] generalized to user-specified mapping function instead of hardwired avg --- processing/post/averageTable.py | 47 ++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/processing/post/averageTable.py b/processing/post/averageTable.py index 25c09625c..f9c6693ed 100755 --- a/processing/post/averageTable.py +++ b/processing/post/averageTable.py @@ -2,6 +2,7 @@ # -*- coding: UTF-8 no BOM -*- import os,sys +import math # noqa import numpy as np from optparse import OptionParser import damask @@ -14,7 +15,7 @@ scriptID = ' '.join([scriptName,damask.version]) # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Replace all rows for which column 'label' has identical values by a single row containing their average. +Apply a user-specified function to condense all rows for which column 'label' has identical values into a single row. Output table will contain as many rows as there are different (unique) values in the grouping column. Examples: @@ -25,11 +26,33 @@ parser.add_option('-l','--label', dest = 'label', type = 'string', metavar = 'string', help = 'column label for grouping rows') +parser.add_option('-f','--function', + dest = 'function', + type = 'string', metavar = 'string', + help = 'mapping function [%default]') +parser.add_option('-a','--all', + dest = 'all', + action = 'store_true' + help = 'apply mapping function also to grouping column') + +parser.set_defaults(function = 'np.average') (options,filenames) = parser.parse_args() +funcModule,funcName = options.function.split('.') + +try: + mapFunction = getattr(locals().get(funcModule) or + globals().get(funcModule) or + __import__(funcModule), + funcName) +except: + mapFunction = None + if options.label is None: parser.error('no grouping column specified.') +if not hasattr(mapFunction,'__call__'): + parser.error('function "{}" is not callable.'.format(options.function)) # --- loop over input files ------------------------------------------------------------------------- @@ -38,10 +61,6 @@ if filenames == []: filenames = [None] for name in filenames: try: table = damask.ASCIItable(name = name, - outname = os.path.join( - os.path.split(name)[0], - options.label+'_averaged_'+os.path.split(name)[1] - ) if name else name, buffered = False) except: continue damask.util.report(scriptName,name) @@ -53,6 +72,8 @@ for name in filenames: damask.util.croak('column {} is not of scalar dimension.'.format(options.label)) table.close(dismiss = True) # close ASCIItable and remove empty file continue + else: + grpColumn = table.label_index(options.label) # ------------------------------------------ assemble info --------------------------------------- @@ -64,17 +85,17 @@ for name in filenames: table.data_readArray() rows,cols = table.data.shape - table.data = table.data[np.lexsort([table.data[:,table.label_index(options.label)]])] + table.data = table.data[np.lexsort([table.data[:,grpColumn]])] # sort data by grpColumn - values,index = np.unique(table.data[:,table.label_index(options.label)], return_index = True) - index = np.append(index,rows) - avgTable = np.empty((len(values), cols)) + values,index = np.unique(table.data[:,grpColumn], return_index = True) # unique grpColumn values and their positions + index = np.append(index,rows) # add termination position + grpTable = np.empty((len(values), cols)) # initialize output - for j in xrange(cols) : - for i in xrange(len(values)) : - avgTable[i,j] = np.average(table.data[index[i]:index[i+1],j]) + for i in xrange(len(values)): # iterate over groups (unique values in grpColumn) + grpTable[i] = np.apply_along_axis(mapFunction,0,table.data[index[i]:index[i+1]]) # apply mapping function + if not options.all: grpTable[i,grpColumn] = table.data[index[i],grpColumn] # restore grouping column value - table.data = avgTable + table.data = grpTable # ------------------------------------------ output result ------------------------------- From 55d6adf1b84e5164143e08b0f7f5ad252ef9b9dc Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 12:15:41 -0400 Subject: [PATCH 103/139] renamed to reflect more general nature of script --- processing/post/{averageTable.py => groupTable.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename processing/post/{averageTable.py => groupTable.py} (100%) diff --git a/processing/post/averageTable.py b/processing/post/groupTable.py similarity index 100% rename from processing/post/averageTable.py rename to processing/post/groupTable.py From 891ac4d5855800d40ff5bac96dc0e8598eddfe34 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 25 Aug 2016 12:17:27 -0400 Subject: [PATCH 104/139] fixed comma syntax error --- processing/post/groupTable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/groupTable.py b/processing/post/groupTable.py index f9c6693ed..924105fba 100755 --- a/processing/post/groupTable.py +++ b/processing/post/groupTable.py @@ -32,7 +32,7 @@ parser.add_option('-f','--function', help = 'mapping function [%default]') parser.add_option('-a','--all', dest = 'all', - action = 'store_true' + action = 'store_true', help = 'apply mapping function also to grouping column') parser.set_defaults(function = 'np.average') From 2d43dbc88156cbde1751ca91a065cec533aab09e Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 26 Aug 2016 04:27:18 +0200 Subject: [PATCH 105/139] updated version information after successful test of v2.0.1-57-g891ac4d --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a0ee30953..ea7f6e12c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-49-gf984f1e +v2.0.1-57-g891ac4d From 4b02a55f4d34f45986ccf9e3e9312eb6e9d86b1f Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 30 Aug 2016 16:08:47 -0400 Subject: [PATCH 106/139] explicit type casting from boolean to int --- processing/post/vtk_rectilinearGrid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processing/post/vtk_rectilinearGrid.py b/processing/post/vtk_rectilinearGrid.py index 73a64c4aa..dfe376b3f 100755 --- a/processing/post/vtk_rectilinearGrid.py +++ b/processing/post/vtk_rectilinearGrid.py @@ -79,9 +79,9 @@ for name in filenames: coords = [np.unique(table.data[:,i]) for i in xrange(3)] if options.mode == 'cell': - coords = [0.5 * np.array([3.0 * coords[i][0] - coords[i][0 + len(coords[i]) > 1]] + \ + coords = [0.5 * np.array([3.0 * coords[i][0] - coords[i][0 + int(len(coords[i]) > 1)]] + \ [coords[i][j-1] + coords[i][j] for j in xrange(1,len(coords[i]))] + \ - [3.0 * coords[i][-1] - coords[i][-1 - (len(coords[i]) > 1)]]) for i in xrange(3)] + [3.0 * coords[i][-1] - coords[i][-1 - int(len(coords[i]) > 1)]]) for i in xrange(3)] grid = np.array(map(len,coords),'i') N = grid.prod() if options.mode == 'point' else (grid-1).prod() From 22e7d6d4e129a9dd46a9c9c9c8b02cb7c81d029d Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 31 Aug 2016 04:26:22 +0200 Subject: [PATCH 107/139] updated version information after successful test of v2.0.1-59-g4b02a55 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ea7f6e12c..8a765d7c8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-57-g891ac4d +v2.0.1-59-g4b02a55 From d529eae4a44598626badb64d5d9af9dedb8a5e8c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 31 Aug 2016 22:54:00 -0400 Subject: [PATCH 108/139] fixed MPI_reduce hiccup see http://stackoverflow.com/questions/17741574/in-place-mpi-reduce-crashes-with-openmpi --- code/spectral_utilities.f90 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/code/spectral_utilities.f90 b/code/spectral_utilities.f90 index b9ed5245d..bb11ff294 100644 --- a/code/spectral_utilities.f90 +++ b/code/spectral_utilities.f90 @@ -237,7 +237,7 @@ subroutine utilities_init() grid1Red = grid(1)/2_pInt + 1_pInt wgt = 1.0/real(product(grid),pReal) - if (worldrank == 0) then + if (worldrank == 0_pInt) then write(6,'(a,3(i12 ))') ' grid a b c: ', grid write(6,'(a,3(es12.5))') ' size x y z: ', geomSize endif @@ -1015,10 +1015,19 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & defgradDetMax = max(defgradDetMax,defgradDet) defgradDetMin = min(defgradDetMin,defgradDet) end do - call MPI_reduce(MPI_IN_PLACE,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,0,PETSC_COMM_WORLD,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') - call MPI_reduce(MPI_IN_PLACE,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,0,PETSC_COMM_WORLD,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') + + if (worldrank == 0_pInt) then + call MPI_reduce(MPI_IN_PLACE,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,0,PETSC_COMM_WORLD,ierr) + else + call MPI_reduce(defgradDetMax,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,0,PETSC_COMM_WORLD,ierr) + endif + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') + if (worldrank == 0_pInt) then + call MPI_reduce(MPI_IN_PLACE,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,0,PETSC_COMM_WORLD,ierr) + else + call MPI_reduce(defgradDetMin,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,0,PETSC_COMM_WORLD,ierr) + endif + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') if (worldrank == 0_pInt) then write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin From 6db0a42eaef45ff7b65da7006bd5140377fb76a0 Mon Sep 17 00:00:00 2001 From: Chen Date: Thu, 1 Sep 2016 12:47:26 -0400 Subject: [PATCH 109/139] addvtk data now support tensor type (9 components) --- processing/post/vtk_addPointcloudData.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 340ef700e..cd767d5f4 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -37,12 +37,17 @@ parser.add_option('-v', '--vector', dest = 'vector', action = 'extend', metavar = '', help = 'vector value label(s)') +parser.add_option('-t', '--tensor', + dest = 'tensor', + action = 'extend', metavar = '', + help = 'tensor (3x3) value label(s)') parser.add_option('-c', '--color', dest='color', action='extend', metavar ='', help = 'RGB color tuples') parser.set_defaults(scalar = [], vector = [], + tensor = [], color = [], inplace = False, render = False, @@ -94,9 +99,10 @@ for name in filenames: errors = [] VTKarray = {} active = defaultdict(list) - + for datatype,dimension,label in [['scalar',1,options.scalar], ['vector',3,options.vector], + ['tensor',9,options.tensor], ['color',3,options.color], ]: for i,dim in enumerate(table.label_dimension(label)): @@ -107,7 +113,7 @@ for name in filenames: remarks.append('adding {} "{}"...'.format(datatype,me)) active[datatype].append(me) - if datatype in ['scalar','vector']: VTKarray[me] = vtk.vtkDoubleArray() + if datatype in ['scalar','vector', 'tensor']: VTKarray[me] = vtk.vtkDoubleArray() elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray() VTKarray[me].SetNumberOfComponents(dimension) @@ -119,20 +125,21 @@ for name in filenames: table.close(dismiss = True) continue -# ------------------------------------------ process data --------------------------------------- +# ------------------------------------------ process data --------------------------------------- while table.data_read(): # read next data line of ASCII table - + for datatype,labels in active.items(): # loop over scalar,color for me in labels: # loop over all requested items theData = [table.data[i] for i in table.label_indexrange(me)] # read strings if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) + elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*map(float,theData)) elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) table.input_close() # close input ASCII table -# ------------------------------------------ add data --------------------------------------- +# ------------------------------------------ add data --------------------------------------- for datatype,labels in active.items(): # loop over scalar,color if datatype == 'color': @@ -145,7 +152,7 @@ for name in filenames: Polydata.Modified() if vtk.VTK_MAJOR_VERSION <= 5: Polydata.Update() -# ------------------------------------------ output result --------------------------------------- +# ------------------------------------------ output result --------------------------------------- writer = vtk.vtkXMLPolyDataWriter() writer.SetDataModeToBinary() @@ -155,7 +162,7 @@ for name in filenames: else: writer.SetInputData(Polydata) writer.Write() -# ------------------------------------------ render result --------------------------------------- +# ------------------------------------------ render result --------------------------------------- if options.render: mapper = vtk.vtkDataSetMapper() @@ -179,7 +186,7 @@ if options.render: iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) - + iren.Initialize() renWin.Render() iren.Start() From 32c4a20a46c5e7b9d0e1a3c4d8e5bd2203d57d8e Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 1 Sep 2016 15:37:49 -0400 Subject: [PATCH 110/139] clean up, added --debug to base class, renamed testPossible to feasible --- lib/damask/test/test.py | 69 +++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index c05a6474d..b54615c3a 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -17,40 +17,47 @@ class Test(): variants = [] - def __init__(self,test_description): + def __init__(self,description = ''): - logger = logging.getLogger() - logger.setLevel(0) fh = logging.FileHandler('test.log') # create file handler which logs even debug messages fh.setLevel(logging.DEBUG) - full = logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s') - fh.setFormatter(full) + fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s')) + ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level ch.setLevel(logging.INFO) -# create formatter and add it to the handlers - plain = logging.Formatter('%(message)s') - ch.setFormatter(plain) -# add the handlers to the logger + ch.setFormatter(logging.Formatter('%(message)s')) + + logger = logging.getLogger() logger.addHandler(fh) logger.addHandler(ch) + logger.setLevel(0) - logging.info('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n' \ - +'----------------------------------------------------------------\n' \ - +'| '+test_description+'\n' \ - +'----------------------------------------------------------------') + logging.info('\n'.join(['+'*40, + '-'*40, + '| '+description, + '-'*40, + ])) self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) - self.parser = OptionParser( - description = test_description+' (using class: {})'.format(damask.version), - usage='./test.py [options]') - self.updateRequested = False - self.parser.add_option("-d", "--debug", action="store_true",\ - dest="debug",\ - help="debug run, don't calculate but use existing results") - self.parser.add_option("-p", "--pass", action="store_true",\ - dest="accept",\ - help="calculate results but always consider test as successfull") - self.parser.set_defaults(debug=False, - accept=False) + + self.parser = OptionParser(description = '{} (using class: {})'.format(description,damask.version), + usage = './test.py [options]') + self.parser.add_option("-d", "--debug", + action = "store_true", + dest = "debug", + help = "debug run, don't calculate but use existing results") + self.parser.add_option("-p", "--pass", + action = "store_true", + dest = "accept", + help = "calculate results but always consider test as successfull") + self.parser.add_option("-u", "--update", + action = "store_true", + dest = "update", + help = "use current test results as new reference" + ) + self.parser.set_defaults(debug = False, + accept = False, + update = False, + ) def execute(self): """Run all variants and report first failure.""" @@ -65,15 +72,17 @@ class Test(): return variant+1 # return culprit return 0 else: - if not self.testPossible(): return -1 + if not self.feasible(): return -1 + self.clean() self.prepareAll() - for variant in xrange(len(self.variants)): + + for variant,name in enumerate(self.variants): try: self.prepare(variant) self.run(variant) self.postprocess(variant) - if self.updateRequested: # update requested + if self.options.update: # update requested self.update(variant) elif not (self.options.accept or self.compare(variant)): # no update, do comparison return variant+1 # return culprit @@ -82,8 +91,8 @@ class Test(): return variant+1 # return culprit return 0 - def testPossible(self): - """Check if test is possible or not (e.g. no license available).""" + def feasible(self): + """Check whether test is possible or not (e.g. no license available).""" return True def clean(self): From 20d1164e5d8ed5ac2b7cd44132b9c765ecb63dfc Mon Sep 17 00:00:00 2001 From: Chen Date: Thu, 1 Sep 2016 16:57:29 -0400 Subject: [PATCH 111/139] add tensor support for vtk_addRectlinearGridData --- processing/post/vtk_addRectilinearGridData.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index 63e0bf783..283a076c7 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -38,6 +38,10 @@ parser.add_option('-v', '--vector', dest = 'vector', action = 'extend', metavar = '', help = 'vector value label(s)') +parser.add_option('-t', '--tensor', + dest = 'tensor', + action = 'extend', metavar = '', + help = 'tensor (3x3) value label(s)') parser.add_option('-c', '--color', dest = 'color', action = 'extend', metavar = '', @@ -45,6 +49,7 @@ parser.add_option('-c', '--color', parser.set_defaults(scalar = [], vector = [], + tensor = [], color = [], inplace = False, render = False, @@ -92,9 +97,10 @@ for name in filenames: errors = [] VTKarray = {} active = defaultdict(list) - + for datatype,dimension,label in [['scalar',1,options.scalar], ['vector',3,options.vector], + ['tensor',9,options.tensor], ['color',3,options.color], ]: for i,dim in enumerate(table.label_dimension(label)): @@ -105,7 +111,7 @@ for name in filenames: remarks.append('adding {} "{}"...'.format(datatype,me)) active[datatype].append(me) - if datatype in ['scalar','vector']: VTKarray[me] = vtk.vtkDoubleArray() + if datatype in ['scalar','vector','tensor']: VTKarray[me] = vtk.vtkDoubleArray() elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray() VTKarray[me].SetNumberOfComponents(dimension) @@ -117,7 +123,7 @@ for name in filenames: table.close(dismiss = True) continue -# ------------------------------------------ process data --------------------------------------- +# ------------------------------------------ process data --------------------------------------- datacount = 0 @@ -129,11 +135,12 @@ for name in filenames: theData = [table.data[i] for i in table.label_indexrange(me)] # read strings if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) + elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*map(float,theData)) elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) table.close() # close input ASCII table -# ------------------------------------------ add data --------------------------------------- +# ------------------------------------------ add data --------------------------------------- if datacount == Npoints: mode = 'point' elif datacount == Ncells: mode = 'cell' @@ -154,7 +161,7 @@ for name in filenames: rGrid.Modified() if vtk.VTK_MAJOR_VERSION <= 5: rGrid.Update() -# ------------------------------------------ output result --------------------------------------- +# ------------------------------------------ output result --------------------------------------- writer = vtk.vtkXMLRectilinearGridWriter() writer.SetDataModeToBinary() @@ -164,7 +171,7 @@ for name in filenames: else: writer.SetInputData(rGrid) writer.Write() -# ------------------------------------------ render result --------------------------------------- +# ------------------------------------------ render result --------------------------------------- if options.render: mapper = vtk.vtkDataSetMapper() @@ -188,7 +195,7 @@ if options.render: iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) - + iren.Initialize() renWin.Render() iren.Start() From d9077805e497e05f929b759ab24ddc1abb2e9997 Mon Sep 17 00:00:00 2001 From: chen Date: Fri, 2 Sep 2016 09:30:49 -0400 Subject: [PATCH 112/139] Forced symetric tensor when adding tensor to vtk VTK addTensor by default using the lower triangle to populate its tensor object. Enforcing the tensor to be symmetric to avoid necessary confusion when adding data (most stress/strain tensor should symmetric by default, so it should not affect the results) --- processing/post/vtk_addPointcloudData.py | 13 ++++++++----- processing/post/vtk_addRectilinearGridData.py | 7 +++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index cd767d5f4..557b9fdd3 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -131,11 +131,14 @@ for name in filenames: for datatype,labels in active.items(): # loop over scalar,color for me in labels: # loop over all requested items - theData = [table.data[i] for i in table.label_indexrange(me)] # read strings - if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) - elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) - elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*map(float,theData)) - elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) + theData = [float(table.data[i]) for i in table.label_indexrange(me)] # read strings + if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*x),theData)) + elif datatype == 'scalar': VTKarray[me].InsertNextValue(theData[0]) + elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*theData) + elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*0.5*(np.array(theData)+ + np.array(theData) \ + .reshape(3,3).T \ + .reshape(9))) table.input_close() # close input ASCII table diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index 283a076c7..8f639711b 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -134,9 +134,12 @@ for name in filenames: for me in labels: # loop over all requested items theData = [table.data[i] for i in table.label_indexrange(me)] # read strings if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) - elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) - elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*map(float,theData)) elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) + elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) + elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*0.5*(np.array(theData)+ + np.array(theData) \ + .reshape(3,3).T \ + .reshape(9))) table.close() # close input ASCII table From 2b3faf204c4e745a605ce52c4d6c4691899e9712 Mon Sep 17 00:00:00 2001 From: Chen Date: Fri, 2 Sep 2016 14:30:08 -0400 Subject: [PATCH 113/139] make table compare normalize data by type (scaler, vector, tensor) --- lib/damask/test/test.py | 169 ++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 84 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index b54615c3a..023e7cb87 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -5,6 +5,7 @@ import os,sys,shutil import logging,logging.config import damask import numpy as np +import itertools from collections import Iterable from optparse import OptionParser @@ -16,7 +17,7 @@ class Test(): """ variants = [] - + def __init__(self,description = ''): fh = logging.FileHandler('test.log') # create file handler which logs even debug messages @@ -90,11 +91,11 @@ class Test(): logging.critical('\nWARNING:\n {}\n'.format(e)) return variant+1 # return culprit return 0 - + def feasible(self): """Check whether test is possible or not (e.g. no license available).""" return True - + def clean(self): """Delete directory tree containing current results.""" status = True @@ -112,7 +113,7 @@ class Test(): status = status and False return status - + def prepareAll(self): """Do all necessary preparations for the whole test""" return True @@ -120,7 +121,7 @@ class Test(): def prepare(self,variant): """Do all necessary preparations for the run of each test variant""" return True - + def run(self,variant): """Execute the requested test variant.""" @@ -152,17 +153,17 @@ class Test(): """Directory containing current results of the test.""" return os.path.normpath(os.path.join(self.dirBase,'current/')) - + def dirProof(self): """Directory containing human readable proof of correctness for the test.""" return os.path.normpath(os.path.join(self.dirBase,'proof/')) - + def fileInRoot(self,dir,file): """Path to a file in the root directory of DAMASK.""" return os.path.join(damask.Environment().rootDir(),dir,file) - + def fileInReference(self,file): """Path to a file in the refrence directory for the test.""" return os.path.join(self.dirReference(),file) @@ -172,7 +173,7 @@ class Test(): """Path to a file in the current results directory for the test.""" return os.path.join(self.dirCurrent(),file) - + def fileInProof(self,file): """Path to a file in the proof directory for the test.""" return os.path.join(self.dirProof(),file) @@ -189,58 +190,58 @@ class Test(): for source,target in zip(map(mapA,A),map(mapB,B)): try: - shutil.copy2(source,target) + shutil.copy2(source,target) except: logging.critical('error copying {} to {}'.format(source,target)) def copy_Reference2Current(self,sourcefiles=[],targetfiles=[]): - + if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) except: logging.critical('Reference2Current: Unable to copy file "{}"'.format(file)) - + def copy_Base2Current(self,sourceDir,sourcefiles=[],targetfiles=[]): - + source=os.path.normpath(os.path.join(self.dirBase,'../../..',sourceDir)) if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(os.path.join(source,file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(os.path.join(source,file),self.fileInCurrent(targetfiles[i])) except: logging.error(os.path.join(source,file)) logging.critical('Base2Current: Unable to copy file "{}"'.format(file)) def copy_Current2Reference(self,sourcefiles=[],targetfiles=[]): - + if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInCurrent(file),self.fileInReference(targetfiles[i])) + shutil.copy2(self.fileInCurrent(file),self.fileInReference(targetfiles[i])) except: logging.critical('Current2Reference: Unable to copy file "{}"'.format(file)) - + def copy_Proof2Current(self,sourcefiles=[],targetfiles=[]): - + if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInProof(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInProof(file),self.fileInCurrent(targetfiles[i])) except: logging.critical('Proof2Current: Unable to copy file "{}"'.format(file)) - + def copy_Current2Current(self,sourcefiles=[],targetfiles=[]): - + for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) except: logging.critical('Current2Current: Unable to copy file "{}"'.format(file)) @@ -252,11 +253,11 @@ class Test(): logging.info(error) logging.debug(out) - - return out,error - - + return out,error + + + def compare_Array(self,File1,File2): import numpy as np @@ -287,28 +288,28 @@ class Test(): def compare_ArrayRefCur(self,ref,cur=''): - + if cur =='': cur = ref refName = self.fileInReference(ref) curName = self.fileInCurrent(cur) return self.compare_Array(refName,curName) - + def compare_ArrayCurCur(self,cur0,cur1): - + cur0Name = self.fileInCurrent(cur0) cur1Name = self.fileInCurrent(cur1) return self.compare_Array(cur0Name,cur1Name) def compare_Table(self,headings0,file0,headings1,file1,normHeadings='',normType=None, absoluteTolerance=False,perLine=False,skipLines=[]): - + import numpy as np logging.info('\n '.join(['comparing ASCII Tables',file0,file1])) if normHeadings == '': normHeadings = headings0 # check if comparison is possible and determine lenght of columns - if len(headings0) == len(headings1) == len(normHeadings): + if len(headings0) == len(headings1) == len(normHeadings): dataLength = len(headings0) length = [1 for i in xrange(dataLength)] shape = [[] for i in xrange(dataLength)] @@ -316,14 +317,14 @@ class Test(): maxError = [0.0 for i in xrange(dataLength)] absTol = [absoluteTolerance for i in xrange(dataLength)] column = [[1 for i in xrange(dataLength)] for j in xrange(2)] - + norm = [[] for i in xrange(dataLength)] normLength = [1 for i in xrange(dataLength)] normShape = [[] for i in xrange(dataLength)] normColumn = [1 for i in xrange(dataLength)] for i in xrange(dataLength): - if headings0[i]['shape'] != headings1[i]['shape']: + if headings0[i]['shape'] != headings1[i]['shape']: raise Exception('shape mismatch between {} and {} '.format(headings0[i]['label'],headings1[i]['label'])) shape[i] = headings0[i]['shape'] for j in xrange(np.shape(shape[i])[0]): @@ -339,7 +340,7 @@ class Test(): table0 = damask.ASCIItable(name=file0,readonly=True) table0.head_read() table1 = damask.ASCIItable(name=file1,readonly=True) - table1.head_read() + table1.head_read() for i in xrange(dataLength): key0 = ('1_' if length[i]>1 else '') + headings0[i]['label'] @@ -355,7 +356,7 @@ class Test(): column[0][i] = table0.label_index(key0) column[1][i] = table1.label_index(key1) normColumn[i] = table0.label_index(normKey) - + line0 = 0 while table0.data_read(): # read next data line of ASCII table if line0 not in skipLines: @@ -370,7 +371,7 @@ class Test(): else: norm[i] = np.append(norm[i],np.linalg.norm(np.reshape(normData,normShape[i]),normType)) line0 += 1 - + for i in xrange(dataLength): if not perLine: norm[i] = [np.max(norm[i]) for j in xrange(line0-len(skipLines))] data[i] = np.reshape(data[i],[line0-len(skipLines),length[i]]) @@ -441,14 +442,14 @@ class Test(): logging.info(files[i]+':'+','.join(columns[i])) if len(files) < 2: return True # single table is always close to itself... - + data = [] for table,labels in zip(tables,columns): table.data_readArray(labels) data.append(table.data) table.close() - - + + for i in xrange(1,len(data)): delta = data[i]-data[i-1] normBy = (np.abs(data[i]) + np.abs(data[i-1]))*0.5 @@ -457,7 +458,7 @@ class Test(): std = np.amax(np.std(normedDelta,0)) logging.info('mean: {:f}'.format(mean)) logging.info('std: {:f}'.format(std)) - + return (mean0.0, maximum, 1) # avoid div by zero for empty columns + + maximum = np.where(maximum > 0.0, maximum, 1) # avoid div by zero for empty columns + + + # normalize each table for i in xrange(len(data)): data[i] /= maximum - - mask = np.zeros_like(table.data,dtype='bool') - for table in data: - mask |= np.where(np.abs(table) Date: Fri, 2 Sep 2016 14:31:00 -0400 Subject: [PATCH 114/139] remove unused import for test.py --- lib/damask/test/test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index 023e7cb87..cffc318a6 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -5,7 +5,6 @@ import os,sys,shutil import logging,logging.config import damask import numpy as np -import itertools from collections import Iterable from optparse import OptionParser From 4c6b8c490f015b66a25d57820e3917f9c14fe3d4 Mon Sep 17 00:00:00 2001 From: Chen Date: Fri, 2 Sep 2016 14:34:35 -0400 Subject: [PATCH 115/139] change one-line docstring to fit in one line. --- lib/damask/test/test.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index cffc318a6..b64485234 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -468,9 +468,7 @@ class Test(): rtol = 1e-5, atol = 1e-8, debug = False): - """ - compare tables with np.allclose - """ + """ compare tables with np.allclose """ if not (isinstance(files, Iterable) and not isinstance(files, str)): # check whether list of files is requested files = [str(files)] From d41ac4e46354abd134fb65c65d0dbc6f8f9b8969 Mon Sep 17 00:00:00 2001 From: Chen Date: Fri, 2 Sep 2016 14:35:23 -0400 Subject: [PATCH 116/139] remove white space in docstring --- lib/damask/test/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index b64485234..10fb993e2 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -468,7 +468,7 @@ class Test(): rtol = 1e-5, atol = 1e-8, debug = False): - """ compare tables with np.allclose """ + """compare tables with np.allclose""" if not (isinstance(files, Iterable) and not isinstance(files, str)): # check whether list of files is requested files = [str(files)] From a2f3839ca84a1f6ee006b796dcecf409b1c2d2bd Mon Sep 17 00:00:00 2001 From: Chen Date: Fri, 2 Sep 2016 14:37:15 -0400 Subject: [PATCH 117/139] add missing numpy import --- processing/post/vtk_addPointcloudData.py | 1 + processing/post/vtk_addRectilinearGridData.py | 1 + 2 files changed, 2 insertions(+) diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 557b9fdd3..9736e54d0 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -3,6 +3,7 @@ import os,vtk import damask +import numpy as np from collections import defaultdict from optparse import OptionParser diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index 8f639711b..df85288af 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -3,6 +3,7 @@ import os,vtk import damask +import numpy as np from collections import defaultdict from optparse import OptionParser From 9512231d49ed3cb9fad38ed5b57af52a843dbcd1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Sep 2016 13:53:41 +0200 Subject: [PATCH 118/139] cleaning --- code/debug.f90 | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/code/debug.f90 b/code/debug.f90 index 21a5443fe..03a0d6f08 100644 --- a/code/debug.f90 +++ b/code/debug.f90 @@ -104,7 +104,6 @@ contains subroutine debug_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) use numerics, only: & - worldrank, & nStress, & nState, & nCryst, & @@ -130,47 +129,27 @@ subroutine debug_init integer(pInt), allocatable, dimension(:) :: chunkPos character(len=65536) :: tag, line - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- debug init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- debug init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - if (allocated(debug_StressLoopLpDistribution)) & - deallocate(debug_StressLoopLpDistribution) - allocate(debug_StressLoopLpDistribution(nStress+1,2)) - debug_StressLoopLpDistribution = 0_pInt - if (allocated(debug_StressLoopLiDistribution)) & - deallocate(debug_StressLoopLiDistribution) - allocate(debug_StressLoopLiDistribution(nStress+1,2)) - debug_StressLoopLiDistribution = 0_pInt - if (allocated(debug_StateLoopDistribution)) & - deallocate(debug_StateLoopDistribution) - allocate(debug_StateLoopDistribution(nState+1,2)) - debug_StateLoopDistribution = 0_pInt - if (allocated(debug_CrystalliteLoopDistribution)) & - deallocate(debug_CrystalliteLoopDistribution) - allocate(debug_CrystalliteLoopDistribution(nCryst+1)) - debug_CrystalliteLoopDistribution = 0_pInt - if (allocated(debug_MaterialpointStateLoopDistribution)) & - deallocate(debug_MaterialpointStateLoopDistribution) - allocate(debug_MaterialpointStateLoopDistribution(nMPstate)) - debug_MaterialpointStateLoopDistribution = 0_pInt - if (allocated(debug_MaterialpointLoopDistribution)) & - deallocate(debug_MaterialpointLoopDistribution) - allocate(debug_MaterialpointLoopDistribution(nHomog+1)) - debug_MaterialpointLoopDistribution = 0_pInt + allocate(debug_StressLoopLpDistribution(nStress+1,2), source=0_pInt) + allocate(debug_StressLoopLiDistribution(nStress+1,2), source=0_pInt) + allocate(debug_StateLoopDistribution(nState+1,2), source=0_pInt) + allocate(debug_CrystalliteLoopDistribution(nCryst+1), source=0_pInt) + allocate(debug_MaterialpointStateLoopDistribution(nMPstate), source=0_pInt) + allocate(debug_MaterialpointLoopDistribution(nHomog+1), source=0_pInt) !-------------------------------------------------------------------------------------------------- ! try to open the config file line = '' fileExists: if(IO_open_file_stat(FILEUNIT,debug_configFile)) then - do while (trim(line) /= IO_EOF) ! read thru sections of phase part + do while (trim(line) /= IO_EOF) ! read thru sections of phase part line = IO_read(FILEUNIT) if (IO_isBlank(line)) cycle ! skip empty lines chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key + tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key select case(tag) case ('element','e','el') debug_e = IO_intValue(line,chunkPos,2_pInt) From 6207f1e7d918d0f8e3e45670608941de5d3ceb67 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Sep 2016 14:25:45 +0200 Subject: [PATCH 119/139] reporting MPI processes --- code/spectral_interface.f90 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/spectral_interface.f90 b/code/spectral_interface.f90 index 31b198806..d49a54411 100644 --- a/code/spectral_interface.f90 +++ b/code/spectral_interface.f90 @@ -57,7 +57,8 @@ subroutine DAMASK_interface_init() integer :: & i, & threadLevel, & - worldrank = 0 + worldrank = 0, & + worldsize = 0 integer, allocatable, dimension(:) :: & chunkPos integer, dimension(8) :: & @@ -66,6 +67,7 @@ subroutine DAMASK_interface_init() external :: & quit,& MPI_Comm_rank,& + MPI_Comm_size,& PETScInitialize, & MPI_Init_Thread, & MPI_abort @@ -77,17 +79,17 @@ subroutine DAMASK_interface_init() #ifdef _OPENMP call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr) ! in case of OpenMP, don't rely on PETScInitialize doing MPI init if (threadLevel>>' #include "compilation_info.f90" From 0d43dfb2f7eef0cfb13e2f1e85b70836312702bb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Sep 2016 14:27:56 +0200 Subject: [PATCH 120/139] allreduce makes sense here as for all other processes, worldrank check not needed anymore --- code/spectral_utilities.f90 | 97 +++++++++++++------------------------ 1 file changed, 34 insertions(+), 63 deletions(-) diff --git a/code/spectral_utilities.f90 b/code/spectral_utilities.f90 index b9ed5245d..326d7eabb 100644 --- a/code/spectral_utilities.f90 +++ b/code/spectral_utilities.f90 @@ -172,8 +172,7 @@ subroutine utilities_init() memory_efficient, & petsc_defaultOptions, & petsc_options, & - divergence_correction, & - worldrank + divergence_correction use debug, only: & debug_level, & debug_SPECTRAL, & @@ -212,11 +211,9 @@ subroutine utilities_init() vecSize = 3_C_INTPTR_T, & tensorSize = 9_C_INTPTR_T - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- spectral_utilities init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- spectral_utilities init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !-------------------------------------------------------------------------------------------------- ! set debugging parameters @@ -224,11 +221,11 @@ subroutine utilities_init() debugRotation = iand(debug_level(debug_SPECTRAL),debug_SPECTRALROTATION) /= 0 debugPETSc = iand(debug_level(debug_SPECTRAL),debug_SPECTRALPETSC) /= 0 - if(debugPETSc .and. worldrank == 0_pInt) write(6,'(3(/,a),/)') & + if(debugPETSc) write(6,'(3(/,a),/)') & ' Initializing PETSc with debug options: ', & trim(PETScDebug), & - ' add more using the PETSc_Options keyword in numerics.config ' - flush(6) + ' add more using the PETSc_Options keyword in numerics.config '; flush(6) + call PetscOptionsClear(ierr); CHKERRQ(ierr) if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr); CHKERRQ(ierr) call PetscOptionsInsertString(trim(petsc_defaultOptions),ierr); CHKERRQ(ierr) @@ -237,10 +234,8 @@ subroutine utilities_init() grid1Red = grid(1)/2_pInt + 1_pInt wgt = 1.0/real(product(grid),pReal) - if (worldrank == 0) then - write(6,'(a,3(i12 ))') ' grid a b c: ', grid - write(6,'(a,3(es12.5))') ' size x y z: ', geomSize - endif + write(6,'(a,3(i12 ))') ' grid a b c: ', grid + write(6,'(a,3(es12.5))') ' size x y z: ', geomSize select case (spectral_derivative) case ('continuous') ! default, no weighting @@ -342,8 +337,7 @@ subroutine utilities_init() if (pReal /= C_DOUBLE .or. pInt /= C_INT) call IO_error(0_pInt,ext_msg='Fortran to C') ! check for correct precision in C call fftw_set_timelimit(fftw_timelimit) ! set timelimit for plan creation - if (debugGeneral .and. worldrank == 0_pInt) write(6,'(/,a)') ' FFTW initialized' - flush(6) + if (debugGeneral) write(6,'(/,a)') ' FFTW initialized'; flush(6) !-------------------------------------------------------------------------------------------------- ! calculation of discrete angular frequencies, ordered as in FFTW (wrap around) @@ -527,8 +521,6 @@ subroutine utilities_fourierGammaConvolution(fieldAim) use math, only: & math_det33, & math_invert - use numerics, only: & - worldrank use mesh, only: & grid3, & grid, & @@ -545,10 +537,8 @@ subroutine utilities_fourierGammaConvolution(fieldAim) logical :: err - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... doing gamma convolution ...............................................' - flush(6) - endif + write(6,'(/,a)') ' ... doing gamma convolution ...............................................' + flush(6) !-------------------------------------------------------------------------------------------------- ! do the actual spectral method calculation (mechanical equilibrium) @@ -624,8 +614,6 @@ end subroutine utilities_fourierGreenConvolution real(pReal) function utilities_divergenceRMS() use IO, only: & IO_error - use numerics, only: & - worldrank use mesh, only: & geomSize, & grid, & @@ -638,10 +626,9 @@ real(pReal) function utilities_divergenceRMS() external :: & MPI_Allreduce - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... calculating divergence ................................................' - flush(6) - endif + write(6,'(/,a)') ' ... calculating divergence ................................................' + flush(6) + rescaledGeom = cmplx(geomSize/scaledGeomSize,0.0_pReal) !-------------------------------------------------------------------------------------------------- @@ -680,8 +667,6 @@ end function utilities_divergenceRMS real(pReal) function utilities_curlRMS() use IO, only: & IO_error - use numerics, only: & - worldrank use mesh, only: & geomSize, & grid, & @@ -693,13 +678,11 @@ real(pReal) function utilities_curlRMS() complex(pReal), dimension(3) :: rescaledGeom external :: & - MPI_Reduce, & MPI_Allreduce - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... calculating curl ......................................................' - flush(6) - endif + write(6,'(/,a)') ' ... calculating curl ......................................................' + flush(6) + rescaledGeom = cmplx(geomSize/scaledGeomSize,0.0_pReal) !-------------------------------------------------------------------------------------------------- @@ -757,8 +740,6 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) prec_isNaN use IO, only: & IO_error - use numerics, only: & - worldrank use math, only: & math_Plain3333to99, & math_plain99to3333, & @@ -790,7 +771,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) allocate (sTimesC(size_reduced,size_reduced), source =0.0_pReal) temp99_Real = math_Plain3333to99(math_rotate_forward3333(C,rot_BC)) - if(debugGeneral .and. worldrank == 0_pInt) then + if(debugGeneral) then write(6,'(/,a)') ' ... updating masked compliance ............................................' write(6,'(/,a,/,9(9(2x,f12.7,1x)/))',advance='no') ' Stiffness C (load) / GPa =',& transpose(temp99_Real)/1.e9_pReal @@ -831,7 +812,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) if(m/=n .and. abs(sTimesC(m,n)) > (0.0_pReal + 10.0e-12_pReal)) errmatinv = .true. ! off diagonal elements of S*C should be 0 enddo enddo - if((debugGeneral .or. errmatinv) .and. (worldrank == 0_pInt)) then ! report + if(debugGeneral .or. errmatinv) then write(formatString, '(I16.16)') size_reduced formatString = '(/,a,/,'//trim(formatString)//'('//trim(formatString)//'(2x,es9.2,1x)/))' write(6,trim(formatString),advance='no') ' C * S (load) ', & @@ -845,7 +826,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) else temp99_real = 0.0_pReal endif - if(debugGeneral .and. worldrank == 0_pInt) & ! report + if(debugGeneral) & write(6,'(/,a,/,9(9(2x,f12.7,1x)/),/)',advance='no') ' Masked Compliance (load) * GPa =', & transpose(temp99_Real*1.e9_pReal) flush(6) @@ -938,15 +919,11 @@ end subroutine utilities_fourierTensorDivergence !-------------------------------------------------------------------------------------------------- subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & P,C_volAvg,C_minmaxAvg,P_av,forwardData,rotation_BC) - use prec, only: & - dNeq use IO, only: & IO_error use debug, only: & debug_reset, & debug_info - use numerics, only: & - worldrank use math, only: & math_transpose33, & math_rotate_forward33, & @@ -974,7 +951,7 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & real(pReal),intent(out), dimension(3,3,3,3) :: C_volAvg, C_minmaxAvg !< average stiffness real(pReal),intent(out), dimension(3,3) :: P_av !< average PK stress - real(pReal),intent(out), dimension(3,3,grid(1),grid(2),grid3) :: P !< PK stress + real(pReal),intent(out), dimension(3,3,grid(1),grid(2),grid3) :: P !< PK stress logical :: & age @@ -985,13 +962,10 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & real(pReal) :: max_dPdF_norm, min_dPdF_norm, defgradDetMin, defgradDetMax, defgradDet external :: & - MPI_Reduce, & MPI_Allreduce - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... evaluating constitutive response ......................................' - flush(6) - endif + write(6,'(/,a)') ' ... evaluating constitutive response ......................................' + flush(6) age = .False. if (forwardData) then ! aging results @@ -1015,15 +989,14 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & defgradDetMax = max(defgradDetMax,defgradDet) defgradDetMin = min(defgradDetMin,defgradDet) end do - call MPI_reduce(MPI_IN_PLACE,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,0,PETSC_COMM_WORLD,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') - call MPI_reduce(MPI_IN_PLACE,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,0,PETSC_COMM_WORLD,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') - if (worldrank == 0_pInt) then - write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax - write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin - flush(6) - endif + + call MPI_Allreduce(MPI_IN_PLACE,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,PETSC_COMM_WORLD,ierr) + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') + call MPI_Allreduce(MPI_IN_PLACE,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,PETSC_COMM_WORLD,ierr) + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') + write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax + write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin + flush(6) endif call CPFEM_general(age,timeinc) @@ -1061,15 +1034,13 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & P = reshape(materialpoint_P, [3,3,grid(1),grid(2),grid3]) P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt ! average of P call MPI_Allreduce(MPI_IN_PLACE,P_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - if (debugRotation .and. worldrank == 0_pInt) & + if (debugRotation) & write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',& math_transpose33(P_av)*1.e-6_pReal P_av = math_rotate_forward33(P_av,rotation_BC) - if (worldrank == 0_pInt) then - write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& + write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& math_transpose33(P_av)*1.e-6_pReal - flush(6) - endif + flush(6) end subroutine utilities_constitutiveResponse From a6940ab84f0ea0b3e30f37926015b0a221376cf4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Sep 2016 14:29:39 +0200 Subject: [PATCH 121/139] did not compile --- code/IO.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/IO.f90 b/code/IO.f90 index 22b56d819..f5db5c1f1 100644 --- a/code/IO.f90 +++ b/code/IO.f90 @@ -142,7 +142,7 @@ recursive function IO_read(fileUnit,reset) result(line) pathOn(stack) = path(1:scan(path,SEP,.true.))//input ! glue include to current file's dir endif - open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack),action=read) ! open included file + open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack),action='read') ! open included file if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=pathOn(stack)) line = IO_read(fileUnit) From d94db61534340eecceab407961e438403f13bba5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Sep 2016 17:01:10 +0200 Subject: [PATCH 122/139] update only supported by minority of the tests --- lib/damask/test/test.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index 10fb993e2..f2d000ab0 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -49,14 +49,8 @@ class Test(): action = "store_true", dest = "accept", help = "calculate results but always consider test as successfull") - self.parser.add_option("-u", "--update", - action = "store_true", - dest = "update", - help = "use current test results as new reference" - ) self.parser.set_defaults(debug = False, accept = False, - update = False, ) def execute(self): @@ -82,7 +76,7 @@ class Test(): self.prepare(variant) self.run(variant) self.postprocess(variant) - if self.options.update: # update requested + if self.updateRequested: # update requested self.update(variant) elif not (self.options.accept or self.compare(variant)): # no update, do comparison return variant+1 # return culprit From 5fec85a159ec5bc39d9cab262cef91c371c1087a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Sep 2016 17:01:39 +0200 Subject: [PATCH 123/139] not needed any more --- code/math.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/code/math.f90 b/code/math.f90 index 8694e30ee..fba431a56 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -178,7 +178,6 @@ subroutine math_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) use prec, only: tol_math_check use numerics, only: & - worldrank, & fixedSeed use IO, only: IO_error, IO_timeStamp From 6ea7eeee08bec19f12adaa59fc5699d079bc71fc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 4 Sep 2016 07:34:58 +0200 Subject: [PATCH 124/139] bugfix when restoring old behavior --- lib/damask/test/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index f2d000ab0..78af62e95 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -41,6 +41,7 @@ class Test(): self.parser = OptionParser(description = '{} (using class: {})'.format(description,damask.version), usage = './test.py [options]') + self.updateRequested = False self.parser.add_option("-d", "--debug", action = "store_true", dest = "debug", From cde7de4e9fbbb57aa8e5095b67101179a3474460 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 4 Sep 2016 18:46:53 -0400 Subject: [PATCH 125/139] improved superclass handling and compare_Tables --- lib/damask/test/test.py | 167 +++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 86 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index b54615c3a..f98f572fa 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -17,8 +17,16 @@ class Test(): variants = [] - def __init__(self,description = ''): + def __init__(self, **kwargs): + defaults = {'description': '', + 'keep': False, + 'accept': False, + 'update': False, + } + for arg in defaults.keys(): + setattr(self,arg,kwargs.get(arg) if kwargs.get(arg) else defaults[arg]) + fh = logging.FileHandler('test.log') # create file handler which logs even debug messages fh.setLevel(logging.DEBUG) fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s')) @@ -34,62 +42,53 @@ class Test(): logging.info('\n'.join(['+'*40, '-'*40, - '| '+description, + '| '+self.description, '-'*40, ])) + self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) - self.parser = OptionParser(description = '{} (using class: {})'.format(description,damask.version), + self.parser = OptionParser(description = '{} (Test class version: {})'.format(self.description,damask.version), usage = './test.py [options]') - self.parser.add_option("-d", "--debug", + self.parser.add_option("-k", "--keep", action = "store_true", - dest = "debug", - help = "debug run, don't calculate but use existing results") - self.parser.add_option("-p", "--pass", + dest = "keep", + help = "keep current results, just run postprocessing") + self.parser.add_option("--ok", "--accept", action = "store_true", dest = "accept", help = "calculate results but always consider test as successfull") - self.parser.add_option("-u", "--update", - action = "store_true", - dest = "update", - help = "use current test results as new reference" - ) - self.parser.set_defaults(debug = False, - accept = False, - update = False, + + self.parser.set_defaults(keep = self.keep, + accept = self.accept, + update = self.update, ) + def execute(self): """Run all variants and report first failure.""" - if self.options.debug: - for variant in xrange(len(self.variants)): - try: - self.postprocess(variant) - if not self.compare(variant): - return variant+1 # return culprit - except Exception as e : - logging.critical('\nWARNING:\n {}\n'.format(e)) - return variant+1 # return culprit - return 0 - else: + if not self.options.keep: if not self.feasible(): return -1 - self.clean() self.prepareAll() - for variant,name in enumerate(self.variants): - try: + for variant,name in enumerate(self.variants): + try: + if not self.options.keep: self.prepare(variant) self.run(variant) - self.postprocess(variant) - if self.options.update: # update requested - self.update(variant) - elif not (self.options.accept or self.compare(variant)): # no update, do comparison - return variant+1 # return culprit - except Exception as e : - logging.critical('\nWARNING:\n {}\n'.format(e)) - return variant+1 # return culprit - return 0 + + self.postprocess(variant) + + if self.options.update and not self.update(variant): + logging.critical('update for "{}" failed.'.format(name)) + elif not (self.options.accept or self.compare(variant)): # no update, do comparison + return variant+1 # return culprit + + except Exception as e : + logging.critical('exception during variant execution: {}'.format(e)) + return variant+1 # return culprit + return 0 def feasible(self): """Check whether test is possible or not (e.g. no license available).""" @@ -97,21 +96,18 @@ class Test(): def clean(self): """Delete directory tree containing current results.""" - status = True try: shutil.rmtree(self.dirCurrent()) except: logging.warning('removal of directory "{}" not possible...'.format(self.dirCurrent())) - status = status and False try: os.mkdir(self.dirCurrent()) + return True except: - logging.critical('creation of directory "{}" failed...'.format(self.dirCurrent())) - status = status and False - - return status + logging.critical('creation of directory "{}" failed.'.format(self.dirCurrent())) + return False def prepareAll(self): """Do all necessary preparations for the whole test""" @@ -139,8 +135,8 @@ class Test(): def update(self,variant): """Update reference with current results.""" - logging.debug('Update not necessary') - return True + logging.critical('update not supported.') + return False def dirReference(self): @@ -463,21 +459,17 @@ class Test(): def compare_Tables(self, - files = [None,None], # list of file names + files = [None,None], # list of file names columns = [None], # list of list of column labels (per file) - rtol = 1e-5, - atol = 1e-8, - preFilter = -1.0, - postFilter = -1.0, - debug = False): - """ - compare tables with np.allclose - - threshold can be used to ignore small values (a negative number disables this feature) - """ + rtol = 1e-5, + atol = 1e-8, + debug = False): + """compare multiple tables with np.allclose""" if not (isinstance(files, Iterable) and not isinstance(files, str)): # check whether list of files is requested files = [str(files)] + if len(files) < 2: return True # single table is always close to itself... + tables = [damask.ASCIItable(name = filename,readonly = True) for filename in files] for table in tables: table.head_read() @@ -486,7 +478,7 @@ class Test(): columns = columns[:len(files)] # truncate to same length as files for i,column in enumerate(columns): - if column is None: columns[i] = tables[i].labels(raw = True) # if no column is given, read all + if column is None: columns[i] = tables[i].labels(raw = False) # if no column is given, use all logging.info('comparing ASCIItables') for i in xrange(len(columns)): @@ -494,39 +486,42 @@ class Test(): ([columns[i]] if not (isinstance(columns[i], Iterable) and not isinstance(columns[i], str)) else \ columns[i] ) - logging.info(files[i]+':'+','.join(columns[i])) + logging.info(files[i]+': '+','.join(columns[i])) + + dimensions = tables[0].label_dimension(columns[0]) # width of each requested column + maximum = np.zeros_like(columns[0],dtype=float) # one magnitude per column entry + data = [] # list of feature table extracted from each file (ASCII table) + + for i,(table,labels) in enumerate(zip(tables,columns)): + if np.any(dimensions != table.label_dimension(labels)): # check data object consistency + logging.critical('Table {} differs in data layout.'.format(files[i])) + return False + table.data_readArray(labels) # read data, ... + data.append(table.data) # ... store, ... + table.close() # ... close + + for j,label in enumerate(labels): # iterate over object labels + maximum[j] = np.maximum(\ + maximum[j], + np.amax(np.linalg.norm(table.data[:,table.label_indexrange(label)], + axis=1)) + ) # find maximum Euclidean norm across rows + + maximum = np.where(maximum > 0.0, maximum, 1.0) # avoid div by zero for zero columns + maximum = np.repeat(maximum,dimensions) # spread maximum over columns of each object - if len(files) < 2: return True # single table is always close to itself... - - maximum = np.zeros(len(columns[0]),dtype='f') - data = [] - for table,labels in zip(tables,columns): - table.data_readArray(labels) - data.append(np.where(np.abs(table.data)0.0, maximum, 1) # avoid div by zero for empty columns for i in xrange(len(data)): - data[i] /= maximum - - mask = np.zeros_like(table.data,dtype='bool') + data[i] /= maximum # normalize each table + + if debug: + logging.debug(str(maximum)) + allclose = np.absolute(data[0]-data[1]) <= (atol + rtol*np.absolute(data[1])) + for ok,valA,valB in zip(allclose,data[0],data[1]): + logging.debug('{}:\n{}\n{}'.format(ok,valA,valB)) - for table in data: - mask |= np.where(np.abs(table) Date: Mon, 5 Sep 2016 14:26:54 +0200 Subject: [PATCH 126/139] not needed any more --- code/FEsolving.f90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/FEsolving.f90 b/code/FEsolving.f90 index bc7588ff0..8e09a1524 100644 --- a/code/FEsolving.f90 +++ b/code/FEsolving.f90 @@ -60,8 +60,6 @@ subroutine FE_init IO_warning, & IO_timeStamp use DAMASK_interface - use numerics, only: & - worldrank implicit none #if defined(Marc4DAMASK) || defined(Abaqus) From 1fc653ca861b644637eed87566259f30e7637ef0 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 7 Sep 2016 22:14:27 +0200 Subject: [PATCH 127/139] updated version information after successful test of v2.0.1-75-g6f843ce --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8a765d7c8..e317ce9f1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-59-g4b02a55 +v2.0.1-75-g6f843ce From c8f832e12f569f87d58d9c887ce91a9f0c31f7c5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 8 Sep 2016 08:43:15 +0200 Subject: [PATCH 128/139] communication in code only run with a certain debug option on will not work debug only happens at rank 0! --- code/spectral_utilities.f90 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/code/spectral_utilities.f90 b/code/spectral_utilities.f90 index 326d7eabb..7b116e264 100644 --- a/code/spectral_utilities.f90 +++ b/code/spectral_utilities.f90 @@ -957,13 +957,10 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & age integer(pInt) :: & - j,k,ierr + j,k real(pReal), dimension(3,3,3,3) :: max_dPdF, min_dPdF real(pReal) :: max_dPdF_norm, min_dPdF_norm, defgradDetMin, defgradDetMax, defgradDet - external :: & - MPI_Allreduce - write(6,'(/,a)') ' ... evaluating constitutive response ......................................' flush(6) age = .False. @@ -990,10 +987,6 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & defgradDetMin = min(defgradDetMin,defgradDet) end do - call MPI_Allreduce(MPI_IN_PLACE,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,PETSC_COMM_WORLD,ierr) - if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') - call MPI_Allreduce(MPI_IN_PLACE,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,PETSC_COMM_WORLD,ierr) - if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin flush(6) From 1e16ebe2efd81a277e63315cb8494ea3aba88dd6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 8 Sep 2016 08:45:46 +0200 Subject: [PATCH 129/139] not used any more --- lib/damask/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/damask/environment.py b/lib/damask/environment.py index fedc22e36..040e705b3 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 no BOM -*- -import os,subprocess,shlex,re,string +import os,subprocess,shlex,re class Environment(): __slots__ = [ \ From 59e8109ced4110960a8f21408b8c4df86235c3f8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 8 Sep 2016 08:51:07 +0200 Subject: [PATCH 130/139] some comments, missing ierr --- code/spectral_utilities.f90 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/code/spectral_utilities.f90 b/code/spectral_utilities.f90 index 7b116e264..1a86b7648 100644 --- a/code/spectral_utilities.f90 +++ b/code/spectral_utilities.f90 @@ -957,7 +957,7 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & age integer(pInt) :: & - j,k + j,k,ierr real(pReal), dimension(3,3,3,3) :: max_dPdF, min_dPdF real(pReal) :: max_dPdF_norm, min_dPdF_norm, defgradDetMin, defgradDetMax, defgradDet @@ -969,12 +969,10 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & age = .True. materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) endif - if (cutBack) then ! restore saved variables - age = .False. - endif + if (cutBack) age = .False. ! restore saved variables materialpoint_F = reshape(F,[3,3,1,product(grid(1:2))*grid3]) - call debug_reset() + call debug_reset() ! this has no effect on rank >0 !-------------------------------------------------------------------------------------------------- ! calculate bounds of det(F) and report @@ -1019,7 +1017,7 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & call MPI_Allreduce(MPI_IN_PLACE,C_volAvg,81,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - call debug_info() + call debug_info() ! this has no effect on rank >0 restartWrite = .false. ! reset restartWrite status cutBack = .false. ! reset cutBack status From da538fbce9a9a72a55ca1e36f93ee14b1a6068d2 Mon Sep 17 00:00:00 2001 From: chen Date: Thu, 8 Sep 2016 18:05:49 -0400 Subject: [PATCH 131/139] speed up of VTK data transformation --- processing/post/vtk_addPointcloudData.py | 72 +++++++++---------- processing/post/vtk_addRectilinearGridData.py | 43 ++++++----- 2 files changed, 55 insertions(+), 60 deletions(-) diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 9736e54d0..6a8324567 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -6,6 +6,7 @@ import damask import numpy as np from collections import defaultdict from optparse import OptionParser +from vtk.util import numpy_support scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) @@ -14,10 +15,10 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN # -------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add scalar and RGB tuples from ASCIItable to existing VTK point cloud (.vtp). - -""", version = scriptID) +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description = """Add scalar and RGB tuples from ASCIItable to existing VTK point cloud (.vtp).""", + version = scriptID) parser.add_option( '--vtk', dest = 'vtk', @@ -104,60 +105,57 @@ for name in filenames: for datatype,dimension,label in [['scalar',1,options.scalar], ['vector',3,options.vector], ['tensor',9,options.tensor], - ['color',3,options.color], + ['color' ,3,options.color], ]: for i,dim in enumerate(table.label_dimension(label)): me = label[i] - if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) - elif dim > dimension: remarks.append('"{}" not of dimension {}...'.format(me,dimension)) + if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) + elif dim > dimension: remarks.append('"{}" not of dimension {}...'.format(me,dimension)) else: remarks.append('adding {} "{}"...'.format(datatype,me)) active[datatype].append(me) - if datatype in ['scalar','vector', 'tensor']: VTKarray[me] = vtk.vtkDoubleArray() - elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray() - - VTKarray[me].SetNumberOfComponents(dimension) - VTKarray[me].SetName(label[i]) - if remarks != []: damask.util.croak(remarks) if errors != []: damask.util.croak(errors) table.close(dismiss = True) continue -# ------------------------------------------ process data --------------------------------------- +# --------------------------------------- process and add data ----------------------------------- - while table.data_read(): # read next data line of ASCII table + table.data_readArray([item for sublist in active.values() for item in sublist]) # read all requested data - for datatype,labels in active.items(): # loop over scalar,color - for me in labels: # loop over all requested items - theData = [float(table.data[i]) for i in table.label_indexrange(me)] # read strings - if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*x),theData)) - elif datatype == 'scalar': VTKarray[me].InsertNextValue(theData[0]) - elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*theData) - elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*0.5*(np.array(theData)+ - np.array(theData) \ - .reshape(3,3).T \ - .reshape(9))) + for datatype,labels in active.items(): # loop over scalar,color + for me in labels: # loop over all requested items + VTKtype = vtk.VTK_DOUBLE + VTKdata = table.data[:, table.label_indexrange(me)].copy() # copy to force contiguous layout - table.input_close() # close input ASCII table + if datatype == 'color': + VTKtype = vtk.VTK_UNSIGNED_CHAR + VTKdata = (VTKdata*255).astype(int) # translate to 0..255 UCHAR + elif datatype == 'tensor': + VTKdata[:,1] = VTKdata[:,3] = 0.5*(VTKdata[:,1]+VTKdata[:,3]) + VTKdata[:,2] = VTKdata[:,6] = 0.5*(VTKdata[:,2]+VTKdata[:,6]) + VTKdata[:,5] = VTKdata[:,7] = 0.5*(VTKdata[:,5]+VTKdata[:,7]) -# ------------------------------------------ add data --------------------------------------- + VTKarray[me] = numpy_support.numpy_to_vtk(num_array=VTKdata,array_type=VTKtype) + VTKarray[me].SetName(me) - for datatype,labels in active.items(): # loop over scalar,color - if datatype == 'color': - Polydata.GetPointData().SetScalars(VTKarray[active['color'][0]]) - Polydata.GetCellData().SetScalars(VTKarray[active['color'][0]]) - for me in labels: # loop over all requested items - Polydata.GetPointData().AddArray(VTKarray[me]) - Polydata.GetCellData().AddArray(VTKarray[me]) + if datatype == 'color': + Polydata.GetPointData().SetScalars(VTKarray[me]) + Polydata.GetCellData().SetScalars(VTKarray[me]) + else: + Polydata.GetPointData().AddArray(VTKarray[me]) + Polydata.GetCellData().AddArray(VTKarray[me]) + + + table.input_close() # close input ASCII table + +# ------------------------------------------ output result --------------------------------------- Polydata.Modified() if vtk.VTK_MAJOR_VERSION <= 5: Polydata.Update() -# ------------------------------------------ output result --------------------------------------- - writer = vtk.vtkXMLPolyDataWriter() writer.SetDataModeToBinary() writer.SetCompressorTypeToZLib() @@ -175,7 +173,7 @@ if options.render: actor.SetMapper(mapper) # Create the graphics structure. The renderer renders into the -# render window. The render window interactor captures mouse events +# render window. The render window interactively captures mouse events # and will perform appropriate camera or actor manipulation # depending on the nature of the events. diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index df85288af..f8d483bf0 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -4,6 +4,7 @@ import os,vtk import damask import numpy as np +from vtk.util import numpy_support from collections import defaultdict from optparse import OptionParser @@ -102,22 +103,16 @@ for name in filenames: for datatype,dimension,label in [['scalar',1,options.scalar], ['vector',3,options.vector], ['tensor',9,options.tensor], - ['color',3,options.color], + ['color' ,3,options.color], ]: for i,dim in enumerate(table.label_dimension(label)): me = label[i] - if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) + if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) elif dim > dimension: remarks.append('"{}" not of dimension {}...'.format(me,dimension)) else: remarks.append('adding {} "{}"...'.format(datatype,me)) active[datatype].append(me) - if datatype in ['scalar','vector','tensor']: VTKarray[me] = vtk.vtkDoubleArray() - elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray() - - VTKarray[me].SetNumberOfComponents(dimension) - VTKarray[me].SetName(label[i]) - if remarks != []: damask.util.croak(remarks) if errors != []: damask.util.croak(errors) @@ -126,28 +121,30 @@ for name in filenames: # ------------------------------------------ process data --------------------------------------- - datacount = 0 + table.data_readArray([item for sublist in active.values() for item in sublist]) # read all requested data - while table.data_read(): # read next data line of ASCII table + for datatype,labels in active.items(): # loop over scalar,color + for me in labels: # loop over all requested items + VTKtype = vtk.VTK_DOUBLE + VTKdata = table.data[:, table.label_indexrange(me)].copy() # copy to force contiguous layout - datacount += 1 # count data lines - for datatype,labels in active.items(): # loop over scalar,color - for me in labels: # loop over all requested items - theData = [table.data[i] for i in table.label_indexrange(me)] # read strings - if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) - elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) - elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) - elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*0.5*(np.array(theData)+ - np.array(theData) \ - .reshape(3,3).T \ - .reshape(9))) + if datatype == 'color': + VTKtype = vtk.VTK_UNSIGNED_CHAR + VTKdata = (VTKdata*255).astype(int) # translate to 0..255 UCHAR + elif datatype == 'tensor': + VTKdata[:,1] = VTKdata[:,3] = 0.5*(VTKdata[:,1]+VTKdata[:,3]) + VTKdata[:,2] = VTKdata[:,6] = 0.5*(VTKdata[:,2]+VTKdata[:,6]) + VTKdata[:,5] = VTKdata[:,7] = 0.5*(VTKdata[:,5]+VTKdata[:,7]) + + VTKarray[me] = numpy_support.numpy_to_vtk(num_array=VTKdata,array_type=VTKtype) + VTKarray[me].SetName(me) table.close() # close input ASCII table # ------------------------------------------ add data --------------------------------------- - if datacount == Npoints: mode = 'point' - elif datacount == Ncells: mode = 'cell' + if len(table.data) == Npoints: mode = 'point' + elif len(table.data) == Ncells: mode = 'cell' else: damask.util.croak('Data count is incompatible with grid...') continue From da08ea70785d21ff316dfac7a870ecbc249d7eff Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 9 Sep 2016 04:41:06 +0200 Subject: [PATCH 132/139] updated version information after successful test of v2.0.1-103-g59e8109 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e317ce9f1..aa0e19262 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-75-g6f843ce +v2.0.1-103-g59e8109 From 017c08a7bb31512b492c6033de55e3f71b3d23cc Mon Sep 17 00:00:00 2001 From: Chen Date: Fri, 9 Sep 2016 07:28:31 -0400 Subject: [PATCH 133/139] syntax fix --- processing/post/vtk_addPointcloudData.py | 1 - 1 file changed, 1 deletion(-) diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 6a8324567..b9f66e684 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -3,7 +3,6 @@ import os,vtk import damask -import numpy as np from collections import defaultdict from optparse import OptionParser from vtk.util import numpy_support From 8c4767d58cd31c074b52197ed0d905e3d36ce58a Mon Sep 17 00:00:00 2001 From: Chen Date: Fri, 9 Sep 2016 07:28:54 -0400 Subject: [PATCH 134/139] syntax fix --- processing/post/vtk_addRectilinearGridData.py | 1 - 1 file changed, 1 deletion(-) diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index f8d483bf0..7d7c39123 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -3,7 +3,6 @@ import os,vtk import damask -import numpy as np from vtk.util import numpy_support from collections import defaultdict from optparse import OptionParser From ee322be870726c89889e77a49ef0d500e23db79f Mon Sep 17 00:00:00 2001 From: chen Date: Fri, 9 Sep 2016 16:17:00 -0400 Subject: [PATCH 135/139] use np.histogram2d, fixed list.append bug when using weight column --- processing/post/binXY.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/processing/post/binXY.py b/processing/post/binXY.py index 4fd635120..2c02b8dcb 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -20,7 +20,7 @@ Produces a binned grid of two columns from an ASCIItable, i.e. a two-dimensional parser.add_option('-d','--data', dest = 'data', - type='string', nargs = 2, metavar = 'string string', + type = 'string', nargs = 2, metavar = 'string string', help = 'column labels containing x and y ') parser.add_option('-w','--weight', dest = 'weight', @@ -49,15 +49,15 @@ parser.add_option('-z','--zrange', parser.add_option('-i','--invert', dest = 'invert', action = 'store_true', - help = 'invert probability density [%default]') + help = 'invert probability density') parser.add_option('-r','--rownormalize', dest = 'normRow', action = 'store_true', - help = 'normalize probability density in each row [%default]') + help = 'normalize probability density in each row') parser.add_option('-c','--colnormalize', dest = 'normCol', action = 'store_true', - help = 'normalize probability density in each column [%default]') + help = 'normalize probability density in each column') parser.set_defaults(bins = (10,10), type = ('linear','linear','linear'), @@ -79,7 +79,8 @@ result = np.zeros((options.bins[0],options.bins[1],3),'f') if options.data is None: parser.error('no data columns specified.') -labels = options.data +labels = list(options.data) + if options.weight is not None: labels += [options.weight] # prevent character splitting of single string value @@ -106,7 +107,7 @@ for name in filenames: # ------------------------------------------ sanity checks ---------------------------------------- missing_labels = table.data_readArray(labels) - + if len(missing_labels) > 0: damask.util.croak('column{} {} not found.'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) table.close(dismiss = True) @@ -119,12 +120,11 @@ for name in filenames: minmax[c] = np.log(minmax[c]) # change minmax to log, too delta = minmax[:,1]-minmax[:,0] - - for i in xrange(len(table.data)): - x = int(options.bins[0]*(table.data[i,0]-minmax[0,0])/delta[0]) - y = int(options.bins[1]*(table.data[i,1]-minmax[1,0])/delta[1]) - if x >= 0 and x < options.bins[0] and y >= 0 and y < options.bins[1]: - grid[x,y] += 1. if options.weight is None else table.data[i,2] # count (weighted) occurrences + + (grid,xedges,yedges) = np.histogram2d(table.data[:,0],table.data[:,1], + bins=options.bins, + range=minmax, + weights=None if options.weight is None else table.data[:,2]) if options.normCol: for x in xrange(options.bins[0]): @@ -136,7 +136,7 @@ for name in filenames: sum = np.sum(grid[:,y]) if sum > 0.0: grid[:,y] /= sum - + if (minmax[2] == 0.0).all(): minmax[2] = [grid.min(),grid.max()] # auto scale from data if minmax[2,0] == minmax[2,1]: minmax[2,0] -= 1. @@ -147,7 +147,7 @@ for name in filenames: if options.type[2].lower() == 'log': grid = np.log(grid) minmax[2] = np.log(minmax[2]) - + delta[2] = minmax[2,1]-minmax[2,0] for x in xrange(options.bins[0]): From 0b4e75c20162c0cc4403cd783ab8a4c0e32ec709 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 10 Sep 2016 20:44:46 +0200 Subject: [PATCH 136/139] update function was not working due to name clash for self.update --- lib/damask/test/test.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index 5cc6d1210..f2c05efd6 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -20,18 +20,18 @@ class Test(): def __init__(self, **kwargs): defaults = {'description': '', - 'keep': False, - 'accept': False, - 'update': False, + 'keep': False, + 'accept': False, + 'updateRequest': False, } for arg in defaults.keys(): setattr(self,arg,kwargs.get(arg) if kwargs.get(arg) else defaults[arg]) - fh = logging.FileHandler('test.log') # create file handler which logs even debug messages + fh = logging.FileHandler('test.log') # create file handler which logs even debug messages fh.setLevel(logging.DEBUG) fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s')) - ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level + ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level ch.setLevel(logging.INFO) ch.setFormatter(logging.Formatter('%(message)s')) @@ -61,7 +61,7 @@ class Test(): self.parser.set_defaults(keep = self.keep, accept = self.accept, - update = self.update, + update = self.updateRequest, ) @@ -80,10 +80,10 @@ class Test(): self.postprocess(variant) - if self.options.update and not self.update(variant): - logging.critical('update for "{}" failed.'.format(name)) - elif not (self.options.accept or self.compare(variant)): # no update, do comparison - return variant+1 # return culprit + if self.options.update: + if self.update(variant) != 0: logging.critical('update for "{}" failed.'.format(name)) + elif not (self.options.accept or self.compare(variant)): # no update, do comparison + return variant+1 # return culprit except Exception as e : logging.critical('exception during variant execution: {}'.format(e)) @@ -135,7 +135,7 @@ class Test(): def update(self,variant): """Update reference with current results.""" logging.critical('update not supported.') - return False + return 1 def dirReference(self): From 2daad7542eb20c5cba101a9a4a72a796f43c077a Mon Sep 17 00:00:00 2001 From: tiasmaiti Date: Sat, 10 Sep 2016 16:33:28 -0400 Subject: [PATCH 137/139] added option for periodic averaging --- processing/post/groupTable.py | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/processing/post/groupTable.py b/processing/post/groupTable.py index 924105fba..cb1359c78 100755 --- a/processing/post/groupTable.py +++ b/processing/post/groupTable.py @@ -4,9 +4,18 @@ import os,sys import math # noqa import numpy as np -from optparse import OptionParser +from optparse import OptionParser, OptionGroup import damask +#"https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions" +def periodicAverage(Points, Box): + theta = (Points/Box[1]) * (2.0*np.pi) + xi = np.cos(theta) + zeta = np.sin(theta) + theta_avg = np.arctan2(-1.0*zeta.mean(), -1.0*xi.mean()) + np.pi + Pmean = Box[1] * theta_avg/(2.0*np.pi) + return Pmean + scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) @@ -35,7 +44,23 @@ parser.add_option('-a','--all', action = 'store_true', help = 'apply mapping function also to grouping column') -parser.set_defaults(function = 'np.average') +group = OptionGroup(parser, "periodic averaging", "") + +group.add_option('-p','--periodic', + dest = 'periodic', + action = 'store_true', + help = 'calculate average in periodic space defined by periodic length [%default]') +group.add_option('--boundary', + dest = 'boundary', metavar = 'MIN MAX', + type = 'float', nargs = 2, + help = 'define periodic box end points %default') + +parser.add_option_group(group) + +parser.set_defaults(function = 'np.average', + all = False, + periodic = False, + boundary = [0.0, 1.0]) (options,filenames) = parser.parse_args() @@ -92,7 +117,10 @@ for name in filenames: grpTable = np.empty((len(values), cols)) # initialize output for i in xrange(len(values)): # iterate over groups (unique values in grpColumn) - grpTable[i] = np.apply_along_axis(mapFunction,0,table.data[index[i]:index[i+1]]) # apply mapping function + if options.periodic : + grpTable[i] = periodicAverage(table.data[index[i]:index[i+1]],options.boundary) # apply periodicAverage mapping function + else : + grpTable[i] = np.apply_along_axis(mapFunction,0,table.data[index[i]:index[i+1]]) # apply mapping function if not options.all: grpTable[i,grpColumn] = table.data[index[i],grpColumn] # restore grouping column value table.data = grpTable From 06405bc2514de01aa04b33e5ff4384e57baab54c Mon Sep 17 00:00:00 2001 From: tiasmaiti Date: Sat, 10 Sep 2016 16:35:50 -0400 Subject: [PATCH 138/139] fixed coordinate system convention to be right handed always instead of random left and right handed assignment --- processing/post/addSpectralDecomposition.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index aa87e6f3c..ba039758a 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -78,6 +78,8 @@ for name in filenames: for type, data in items.iteritems(): for column in data['column']: (u,v) = np.linalg.eigh(np.array(map(float,table.data[column:column+data['dim']])).reshape(data['shape'])) + if np.dot(np.cross(v[:,0], v[:,1]), v[:,2]) < 0.0 : + v[:, 2] *= -1.0 table.data_append(list(u)) table.data_append(list(v.transpose().reshape(data['dim']))) outputAlive = table.data_write() # output processed line From 77729f39e32d6f282e1be2810a51e275890bee0a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 11 Sep 2016 14:41:48 +0200 Subject: [PATCH 139/139] commenting last commit --- processing/post/addSpectralDecomposition.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index ba039758a..f65e8ac76 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -78,8 +78,7 @@ for name in filenames: for type, data in items.iteritems(): for column in data['column']: (u,v) = np.linalg.eigh(np.array(map(float,table.data[column:column+data['dim']])).reshape(data['shape'])) - if np.dot(np.cross(v[:,0], v[:,1]), v[:,2]) < 0.0 : - v[:, 2] *= -1.0 + if np.dot(np.cross(v[:,0], v[:,1]), v[:,2]) < 0.0 : v[:, 2] *= -1.0 # ensure right-handed coordinate system table.data_append(list(u)) table.data_append(list(v.transpose().reshape(data['dim']))) outputAlive = table.data_write() # output processed line