Merge branch 'development' of magit1.mpie.de:damask/DAMASK into development

This commit is contained in:
Philip Eisenlohr 2016-05-17 09:52:18 -04:00
commit 9103ee544b
160 changed files with 433 additions and 681 deletions

View File

@ -1,4 +1,3 @@
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief material subroutine for phenomenological crystal plasticity formulation using a powerlaw
@ -60,6 +59,7 @@ module plastic_phenopowerlaw
plastic_phenopowerlaw_tau0_slip, & !< initial critical shear stress for slip (input parameter, per family)
plastic_phenopowerlaw_tau0_twin, & !< initial critical shear stress for twin (input parameter, per family)
plastic_phenopowerlaw_tausat_slip, & !< maximum critical shear stress for slip (input parameter, per family)
plastic_phenopowerlaw_H_int, & !< per family hardening activity(input parameter(optional), per family)
plastic_phenopowerlaw_nonSchmidCoeff, &
plastic_phenopowerlaw_interaction_SlipSlip, & !< interaction factors slip - slip (input parameter)
@ -209,6 +209,7 @@ subroutine plastic_phenopowerlaw_init(fileUnit)
allocate(plastic_phenopowerlaw_n_slip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tau0_slip(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_tausat_slip(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_H_int(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_gdot0_twin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_n_twin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tau0_twin(lattice_maxNtwinFamily,maxNinstance), source=0.0_pReal)
@ -340,7 +341,7 @@ subroutine plastic_phenopowerlaw_init(fileUnit)
do j = 1_pInt, Nchunks_SlipFamilies
plastic_phenopowerlaw_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j)
enddo
case ('tausat_slip','tau0_slip')
case ('tausat_slip','tau0_slip','H_int')
tempPerSlip = 0.0_pReal
do j = 1_pInt, Nchunks_SlipFamilies
if (plastic_phenopowerlaw_Nslip(j,instance) > 0_pInt) &
@ -351,6 +352,8 @@ subroutine plastic_phenopowerlaw_init(fileUnit)
plastic_phenopowerlaw_tausat_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
case ('tau0_slip')
plastic_phenopowerlaw_tau0_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
case ('H_int')
plastic_phenopowerlaw_H_int(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
end select
!--------------------------------------------------------------------------------------------------
! parameters depending on number of twin families
@ -967,7 +970,6 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
offset_accshear_twin = nSlip + nTwin + 2_pInt + nSlip
plasticState(ph)%dotState(:,of) = 0.0_pReal
!--------------------------------------------------------------------------------------------------
! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices
c_SlipSlip = plastic_phenopowerlaw_h0_SlipSlip(instance)*&
@ -986,7 +988,7 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family
slipSystems1: do i = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance)
j = j+1_pInt
left_SlipSlip(j) = 1.0_pReal ! no system-dependent left part
left_SlipSlip(j) = 1.0_pReal + plastic_phenopowerlaw_H_int(f,instance) ! modified no system-dependent left part
left_SlipTwin(j) = 1.0_pReal ! no system-dependent left part
right_SlipSlip(j) = abs(1.0_pReal-plasticState(ph)%state(j,of) / &
(plastic_phenopowerlaw_tausat_slip(f,instance)+ssat_offset)) &
@ -1013,6 +1015,7 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
enddo slipFamilies1
j = 0_pInt
twinFamilies1: do f = 1_pInt,lattice_maxNtwinFamily
index_myFamily = sum(lattice_NtwinSystem(1:f-1_pInt,ph)) ! at which index starts my family

View File

@ -1,4 +1,3 @@
### $Id$ ###
[all]
(output) phase
(output) texture

View File

@ -1,2 +1 @@
### $Id$ ###
[none]

View File

@ -1,4 +1,3 @@
### $Id$ ###
[aLittleSomething]
(output) f
(output) p

View File

@ -1,4 +1,3 @@
### $Id$ ###
damage nonlocal
initialDamage 1.0
(output) damage

View File

@ -1,4 +1,3 @@
### $Id$ ###
hydrogenflux cahnhilliard
initialHydrogenConc 0.0
(output) hydrogenconc

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Parallel3]
type isostrain
Ngrains 3

View File

@ -1,4 +1,3 @@
### $Id$ ###
[SX]
type isostrain
Ngrains 1

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Taylor2]
type isostrain
Ngrains 2

View File

@ -1,4 +1,3 @@
### $Id$ ###
[directSX]
type none

View File

@ -1,3 +1,2 @@
### $Id$ ###
porosity phasefield
(output) porosity

View File

@ -1,4 +1,3 @@
### $Id$ ###
[8Grains]
type RGC
Ngrains 8

View File

@ -1,4 +1,3 @@
### $Id$ ###
thermal conduction
initialT 300.0
(output) temperature

View File

@ -1,4 +1,3 @@
### $Id$ ###
vacancyflux cahnhilliard
initialVacancyConc 1e-6
(output) vacancyconc

View File

@ -1,4 +1,3 @@
### $Id$ ###
[SX]
type isostrain
Ngrains 1

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) vacancy_strain
vacancy_strain_coeff 0.006

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) thermal_expansion
thermal_expansion11 0.00231

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) hydrogen_strain
hydrogen_strain_coeff 0.06

View File

@ -1,4 +1,3 @@
### $Id$ ###
[DP_Steel]
/elementhomogeneous/
crystallite 1

View File

@ -1,4 +1,3 @@
### $Id$ ###
[ElementHomogeneous]
/elementhomogeneous/ # put this flag to set ips identical in one element (something like reduced integration)
crystallite 1

View File

@ -1,3 +1,2 @@
### $Id$ ###
damage_diffusion11 1.0
damage_mobility 0.001

View File

@ -1,4 +1,3 @@
### $Id$ ###
[TWIP_Steel_FeMnC]
elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Tungsten]
elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
hydrogenflux_diffusion11 1.0
hydrogenflux_mobility11 1.0
hydrogenVolume 1e-28

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum_Isotropic]
# Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079

View File

@ -1,4 +1,3 @@
### $Id$ ###
[IsotropicVolumePreservation]
elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Orthorombic]
elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum]
elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum]
elasticity hooke
plasticity phenopowerlaw

View File

@ -1,4 +1,3 @@
### $Id$ ###
# Tasan et.al. 2015 Acta Materalia
# Tasan et.al. 2015 International Journal of Plasticity
# Diehl et.al. 2015 Meccanica

View File

@ -1,4 +1,3 @@
### $Id$ ###
# Tasan et.al. 2015 Acta Materalia
# Tasan et.al. 2015 International Journal of Plasticity
# Diehl et.al. 2015 Meccanica

View File

@ -1,4 +1,3 @@
### $Id$ ###
# parameters fitted by D. Ma to:

View File

@ -1,4 +1,3 @@
### $Id$ ###
[cpTi-alpha]
plasticity phenopowerlaw
elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum]
elasticity hooke
plasticity phenopowerlaw

View File

@ -1,3 +1,2 @@
### $Id$ ###
porosity_diffusion11 1.0
porosity_mobility 0.001

View File

@ -1,4 +1,3 @@
### $Id$ ###
thermal_conductivity11 237.0
specific_heat 910.0
mass_density 2700.0

View File

@ -1,4 +1,3 @@
### $Id$ ###
vacancyflux_diffusion11 1.0
vacancyflux_mobility11 1.0
vacancyFormationEnergy 1e-19

View File

@ -1,4 +1,3 @@
### $Id$ ###
(source) damage_isoBrittle
isobrittle_criticalStrainEnergy 1400000.0
isobrittle_atol 0.01

View File

@ -1,3 +1,2 @@
### $Id$ ###
(source) thermal_dissipation
dissipation_ColdWorkCoeff 0.95

View File

@ -1,4 +1,3 @@
### $Id$ ###
(source) vacancy_irradiation
irradiation_cascadeprobability 0.00001
irradiation_cascadevolume 1000.0

View File

@ -1,3 +1,2 @@
### $Id$ ###
(source) vacancy_phenoplasticity
phenoplasticity_ratecoeff 0.01

View File

@ -1,4 +1,3 @@
### $Id$ ###
[FiberExample]
axes x y -z # model coordinate x-, y-, z-axes correspond to which axes during texture measurement? this was a left handed coordinate system!
# fiber axis in spherical coordinates: alpha crystal system, beta sample system

View File

@ -1,3 +1,2 @@
### $Id$ ###
[001]
(gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[101]
(gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[111]
(gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[123]
(gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[RandomSingleCrystals]
(random) scatter 0.000 fraction 1.000

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Rolling]
hybridIA rollingTexture.linearODF
symmetry orthotropic # or monoclinic

View File

@ -1,4 +1,3 @@
### $Id$ ###
### debugging parameters ###
# example:

View File

@ -1,4 +1,3 @@
### $Id$ ###
### numerical parameters ###
# The material.config file needs to specify five parts:

View File

@ -1,4 +1,3 @@
### $Id$ ###
### numerical parameters ###
relevantStrain 1.0e-7 # strain increment considered significant (used by crystallite to determine whether strain inc is considered significant)

View File

@ -1,7 +1,3 @@
#####################
# $Id$
#####################
#-------------------#
<homogenization>
#-------------------#

View File

@ -1,7 +1,3 @@
#####################
# $Id$
#####################
#-------------------#
<homogenization>
#-------------------#

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,glob,string,subprocess,shlex
import os,sys,glob,subprocess,shlex
from damask import Environment
from damask import version as DAMASKVERSION
@ -47,9 +47,13 @@ compileOptions = ' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib -DDAMASKVERSION=\\\\\"\
#--- this saves the path of libraries to core.so, hence it is known during runtime ----------------
if options['F90'] == 'gfortran':
LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup' # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords" as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html
# solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords"
# as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html
LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup'
else:
LDFLAGS = ' -openmp -Wl' # some f2py versions/configurations compile with openMP, so linking against openMP is needed to prevent errors during loading of core module
# some f2py versions/configurations compile with openMP, so linking against openMP is needed
# to prevent errors during loading of core module
LDFLAGS = ' -openmp -Wl'
#--- run path of for fftw during runtime ----------------------------------------------------------
LDFLAGS += ',-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT'])

View File

@ -1,7 +1,6 @@
#
# DAMASK Abaqus Environment File
#
# $Id$
# ------------------------------------
# originally taken from Abaqus ver. 6.11.1
#

View File

@ -1,7 +1,6 @@
#
# DAMASK Abaqus Environment File
#
# $Id$
# ------------------------------------
# originally taken from Abaqus ver. 6.11.1
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
# Makes postprocessing routines acessible from everywhere.

View File

@ -1,7 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import os,sys
import numpy as np
@ -27,7 +25,7 @@ class ASCIItable():
self.__IO__ = {'output': [],
'buffered': buffered,
'labeled': labeled, # header contains labels
'labels': [], # labels according to file info
'tags': [], # labels according to file info
'readBuffer': [], # buffer to hold non-advancing reads
'dataStart': 0,
}
@ -51,7 +49,7 @@ class ASCIItable():
self.__IO__['out'] = outname
self.info = []
self.labels = []
self.tags = []
self.data = []
self.line = ''
@ -141,10 +139,10 @@ class ASCIItable():
# ------------------------------------------------------------------
def head_read(self):
"""
get column labels by either reading
get column labels
the first row or, if keyword "head[*]" is present,
the last line of the header
by either reading the first row or,
if keyword "head[*]" is present, the last line of the header
"""
import re,shlex
@ -161,7 +159,7 @@ class ASCIItable():
if self.__IO__['labeled']: # table features labels
self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))]
self.labels = shlex.split(self.__IO__['in'].readline()) # store labels found in last line
self.tags = shlex.split(self.__IO__['in'].readline()) # store tags found in last line
else:
@ -180,11 +178,11 @@ class ASCIItable():
else: break # last line of comments
if self.__IO__['labeled']: # table features labels
self.labels = self.data # get labels from last line in "header"...
self.tags = self.data # get tags from last line in "header"...
self.data_read() # ...and remove from buffer
if self.__IO__['labeled']: # table features labels
self.__IO__['labels'] = list(self.labels) # backup labels (make COPY, not link)
if self.__IO__['labeled']: # table features tags
self.__IO__['tags'] = list(self.tags) # backup tags (make COPY, not link)
try:
self.__IO__['dataStart'] = self.__IO__['in'].tell() # current file position is at start of data
@ -197,7 +195,7 @@ class ASCIItable():
"""write current header information (info + labels)"""
head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else []
head.append(self.info)
if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.labels)))
if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.tags)))
return self.output_write(head)
@ -261,19 +259,57 @@ class ASCIItable():
try:
for item in what: self.labels_append(item)
except:
self.labels += [self._removeCRLF(str(what))]
self.tags += [self._removeCRLF(str(what))]
else:
self.labels += [self._removeCRLF(what)]
self.tags += [self._removeCRLF(what)]
self.__IO__['labeled'] = True # switch on processing (in particular writing) of labels
if reset: self.__IO__['labels'] = list(self.labels) # subsequent data_read uses current labels as data size
self.__IO__['labeled'] = True # switch on processing (in particular writing) of tags
if reset: self.__IO__['tags'] = list(self.tags) # subsequent data_read uses current tags as data size
# ------------------------------------------------------------------
def labels_clear(self):
"""delete existing labels and switch to no labeling"""
self.labels = []
self.tags = []
self.__IO__['labeled'] = False
# ------------------------------------------------------------------
def labels(self,
tags = None,
raw = False):
"""
tell abstract labels.
"x" for "1_x","2_x",... unless raw output is requested.
operates on object tags or given list.
"""
from collections import Iterable
if tags is None: tags = self.tags
if isinstance(tags, Iterable) and not raw: # check whether list of tags is requested
id = 0
dim = 1
labelList = []
while id < len(tags):
if not tags[id].startswith('1_'):
labelList.append(tags[id])
else:
label = tags[id][2:] # get label
while id < len(tags) and tags[id] == '{}_{}'.format(dim,label): # check successors
id += 1 # next label...
dim += 1 # ...should be one higher dimension
labelList.append(label) # reached end --> store
id -= 1 # rewind one to consider again
id += 1
dim = 1
else:
labelList = self.tags
return labelList
# ------------------------------------------------------------------
def label_index(self,
labels):
@ -293,10 +329,10 @@ class ASCIItable():
idx.append(int(label)-1) # column given as integer number?
except ValueError:
try:
idx.append(self.labels.index(label)) # locate string in label list
idx.append(self.tags.index(label)) # locate string in label list
except ValueError:
try:
idx.append(self.labels.index('1_'+label)) # locate '1_'+string in label list
idx.append(self.tags.index('1_'+label)) # locate '1_'+string in label list
except ValueError:
idx.append(-1) # not found...
else:
@ -304,10 +340,10 @@ class ASCIItable():
idx = int(labels)-1 # offset for python array indexing
except ValueError:
try:
idx = self.labels.index(labels)
idx = self.tags.index(labels)
except ValueError:
try:
idx = self.labels.index('1_'+labels) # locate '1_'+string in label list
idx = self.tags.index('1_'+labels) # locate '1_'+string in label list
except ValueError:
idx = None if labels is None else -1
@ -332,16 +368,16 @@ class ASCIItable():
try: # column given as number?
idx = int(label)-1
myDim = 1 # if found has at least dimension 1
if self.labels[idx].startswith('1_'): # column has multidim indicator?
while idx+myDim < len(self.labels) and self.labels[idx+myDim].startswith("%i_"%(myDim+1)):
if self.tags[idx].startswith('1_'): # column has multidim indicator?
while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)):
myDim += 1 # add while found
except ValueError: # column has string label
if label in self.labels: # can be directly found?
if label in self.tags: # can be directly found?
myDim = 1 # scalar by definition
elif '1_'+label in self.labels: # look for first entry of possible multidim object
idx = self.labels.index('1_'+label) # get starting column
elif '1_'+label in self.tags: # look for first entry of possible multidim object
idx = self.tags.index('1_'+label) # get starting column
myDim = 1 # (at least) one-dimensional
while idx+myDim < len(self.labels) and self.labels[idx+myDim].startswith("%i_"%(myDim+1)):
while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)):
myDim += 1 # keep adding while going through object
dim.append(myDim)
@ -351,16 +387,16 @@ class ASCIItable():
try: # column given as number?
idx = int(labels)-1
dim = 1 # if found has at least dimension 1
if self.labels[idx].startswith('1_'): # column has multidim indicator?
while idx+dim < len(self.labels) and self.labels[idx+dim].startswith("%i_"%(dim+1)):
if self.tags[idx].startswith('1_'): # column has multidim indicator?
while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)):
dim += 1 # add as long as found
except ValueError: # column has string label
if labels in self.labels: # can be directly found?
if labels in self.tags: # can be directly found?
dim = 1 # scalar by definition
elif '1_'+labels in self.labels: # look for first entry of possible multidim object
idx = self.labels.index('1_'+labels) # get starting column
elif '1_'+labels in self.tags: # look for first entry of possible multidim object
idx = self.tags.index('1_'+labels) # get starting column
dim = 1 # is (at least) one-dimensional
while idx+dim < len(self.labels) and self.labels[idx+dim].startswith("%i_"%(dim+1)):
while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)):
dim += 1 # keep adding while going through object
return np.array(dim) if isinstance(dim,Iterable) else dim
@ -404,8 +440,8 @@ class ASCIItable():
def data_rewind(self):
self.__IO__['in'].seek(self.__IO__['dataStart']) # position file to start of data section
self.__IO__['readBuffer'] = [] # delete any non-advancing data reads
self.labels = list(self.__IO__['labels']) # restore label info found in header (as COPY, not link)
self.__IO__['labeled'] = len(self.labels) > 0
self.tags = list(self.__IO__['tags']) # restore label info found in header (as COPY, not link)
self.__IO__['labeled'] = len(self.tags) > 0
# ------------------------------------------------------------------
def data_skipLines(self,
@ -432,8 +468,8 @@ class ASCIItable():
self.line = self.line.rstrip('\n')
if self.__IO__['labeled'] and respectLabels: # if table has labels
items = shlex.split(self.line)[:len(self.__IO__['labels'])] # use up to label count (from original file info)
self.data = items if len(items) == len(self.__IO__['labels']) else [] # take entries if label count matches
items = shlex.split(self.line)[:len(self.__IO__['tags'])] # use up to label count (from original file info)
self.data = items if len(items) == len(self.__IO__['tags']) else [] # take entries if label count matches
else:
self.data = shlex.split(self.line) # otherwise take all
@ -470,7 +506,7 @@ class ASCIItable():
1))
use = np.array(columns)
self.labels = list(np.array(self.labels)[use]) # update labels with valid subset
self.tags = list(np.array(self.tags)[use]) # update labels with valid subset
self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2)

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import re
class Section():

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import os,subprocess,shlex

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import damask.geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
from .geometry import Geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
from .geometry import Geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import numpy as np
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
from distutils.core import setup

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import damask.solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import os,sys,shutil
import logging,logging.config
@ -41,7 +40,7 @@ class Test():
+'----------------------------------------------------------------')
self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__))
self.parser = OptionParser(
description = test_description+' (using class: $Id$)',
description = test_description+' (using class: {})'.format(damask.version),
usage='./test.py [options]')
self.updateRequested = False
self.parser.add_option("-d", "--debug", action="store_true",\

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os

View File

@ -1,4 +1,3 @@
#!/usr/bin/python
# -*- coding: UTF-8 no BOM -*-
import threading,os,string

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,string,scipy

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,string,vtk

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import threading,time,os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,re,fnmatch,vtk
@ -227,7 +227,7 @@ for filename in args:
locol = -1
for col,head in enumerate(headings):
if head == {True:'1_ipinitialcoord',False:'1_nodeinitialcoord'}[options.cell]:
if head == {True:'1_pos',False:'1_nodeinitialcoord'}[options.cell]:
locol = col
maxcol = max(maxcol,col+3)
break

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -10,16 +10,12 @@ import damask
scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version])
def unravel(item):
if hasattr(item,'__contains__'): return ' '.join(map(unravel,item))
else: return str(item)
# --------------------------------------------------------------------
# MAIN
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Add column(s) with derived values according to user-defined arithmetic operation between column(s).
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.
@ -37,6 +33,13 @@ parser.add_option('-f','--formula',
action = 'extend', metavar = '<string LIST>',
help = '(list of) formulas corresponding to labels')
parser.add_option('-c','--condition',
dest = 'condition', metavar='string',
help = 'condition to filter rows')
parser.set_defaults(condition = None,
)
(options,filenames) = parser.parse_args()
if options.labels is None or options.formulas is None:
@ -53,7 +56,10 @@ if filenames == []: filenames = [None]
for name in filenames:
try:
table = damask.ASCIItable(name = name, buffered = False)
table = damask.ASCIItable(name = name,
buffered = False)
output = damask.ASCIItable(name = name,
buffered = False)
except:
continue
damask.util.report(scriptName,name)
@ -62,14 +68,41 @@ for name in filenames:
table.head_read()
# ------------------------------------------ build formulae ----------------------------------------
# -----------------------------------------------------------------------------------------------------
specials = { \
'_row_': 0,
}
# ------------------------------------------ Evaluate condition ---------------------------------------
if options.condition:
interpolator = []
condition = options.condition # copy per file, since might be altered inline
breaker = False
for position,operand in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups
condition = condition.replace('#'+operand[0]+'#',
{ '': '{%i}'%position,
's#':'"{%i}"'%position}[operand[1]])
if operand[2] in specials: # special label
interpolator += ['specials["%s"]'%operand[2]]
else:
try:
interpolator += ['%s(table.data[%i])'%({ '':'float',
's#':'str'}[operand[1]],
table.label_index(operand[2]))] # ccould be generalized to indexrange as array lookup
except:
damask.util.croak('column "{}" not found.'.format(operand[2]))
breaker = True
if breaker: continue # found mistake in condition evaluation --> next file
evaluator_condition = "'" + condition + "'.format(" + ','.join(interpolator) + ")"
else: condition = ''
# ------------------------------------------ build formulae ----------------------------------------
evaluator = {}
brokenFormula = {}
for label,formula in zip(options.labels,options.formulas):
for column in re.findall(r'#(.+?)#',formula): # loop over column labels in formula
@ -82,15 +115,15 @@ for name in filenames:
elif dim > 1: # multidimensional input (vector, tensor, etc.)
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
else:
damask.util.croak('column {} not found...'.format(column))
brokenFormula[label] = True
damask.util.croak('column {} not found, skipping {}...'.format(column,label))
options.labels.remove(label)
break
formula = formula.replace('#'+column+'#',replacement)
if label not in brokenFormula:
evaluator[label] = formula
# ------------------------------------------ process data ------------------------------------------
firstLine = True
@ -98,32 +131,53 @@ 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 if x not in set(brokenFormula)]:
for label in [x for x in options.labels]:
labelDim[label] = np.size(eval(evaluator[label]))
if labelDim[label] == 0: brokenFormula[label] = True
if labelDim[label] == 0: options.labels.remove(label)
# ------------------------------------------ assemble header ---------------------------------------
if label not in brokenFormula:
table.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])] if labelDim[label] > 1
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)
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
table.head_write()
output.info = table.info
output.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
output.head_write()
# ------------------------------------------ process data ------------------------------------------
for label in [x for x in options.labels if x not in set(brokenFormula)]:
table.data_append(unravel(eval(evaluator[label])))
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
(condition == '' 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
outputAlive = table.data_write() # output processed line
outputAlive = output.data_write() # output processed line
# ------------------------------------------ output finalization -----------------------------------
table.close() # close ASCII tables
table.input_close() # close ASCII tables
output.close() # close ASCII tables

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys
@ -64,10 +64,12 @@ for name in filenames:
errors = []
remarks = []
if table.label_dimension(options.pos) != 3: errors.append('coordinates {} are not a vector.'.format(options.pos))
if table.label_dimension(options.pos) != 3:
errors.append('coordinates "{}" are not a vector.'.format(options.pos))
else: colCoord = table.label_index(options.pos)
if table.label_dimension(options.defgrad) != 9: errors.append('deformation gradient {} is not a tensor.'.format(options.defgrad))
if table.label_dimension(options.defgrad) != 9:
errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad))
else: colF = table.label_index(options.defgrad)
if remarks != []: damask.util.croak(remarks)
@ -91,21 +93,21 @@ for name in filenames:
maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # grid==1 spacing set to smallest among other ones
N = grid.prod()
# --------------- figure out columns to process ---------------------------------------------------
key = '1_%s'%options.defgrad
if key not in table.labels:
file['croak'].write('column %s not found...\n'%key)
key = '1_'+options.defgrad
if table.label_index(key) == -1:
damask.util.croak('column "{}" not found...'.format(key))
continue
else:
column = table.labels.index(key) # remember columns of requested data
column = table.label_index(key) # remember columns of requested data
# ------------------------------------------ assemble header ---------------------------------------
if options.shape: table.labels_append(['shapeMismatch(%s)' %options.defgrad])
if options.volume: table.labels_append(['volMismatch(%s)'%options.defgrad])
if options.shape: table.labels_append(['shapeMismatch({})'.format(options.defgrad)])
if options.volume: table.labels_append(['volMismatch({})'.format(options.defgrad)])
table.head_write()
# ------------------------------------------ read deformation gradient field -----------------------

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,itertools

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,time,copy
import numpy as np

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,math

Some files were not shown because too many files have changed in this diff Show More