Merge branch 'development' into cmake

Conflicts:
	code/Makefile
This commit is contained in:
Martin Diehl 2016-05-21 14:56:57 +02:00
commit 0810295fe9
164 changed files with 650 additions and 815 deletions

View File

@ -1 +1 @@
v2.0.0-219-g297d5ca
v2.0.0-262-gbd1beb4

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
the first row or, if keyword "head[*]" is present,
the last line of the header
get column labels
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)
@ -545,8 +581,8 @@ class ASCIItable():
def datatype(item):
return int(item) if type.lower() == 'i' else float(item)
N = grid.prod() # expected number of microstructure indices in data
microstructure = np.zeros(N,type) # initialize as flat array
N = grid.prod() # expected number of microstructure indices in data
microstructure = np.zeros(N,type) # initialize as flat array
i = 0
while i < N and self.data_read():
@ -557,7 +593,7 @@ class ASCIItable():
else: items = map(datatype,items)
else: items = map(datatype,items)
s = min(len(items), N-i) # prevent overflow of microstructure array
s = min(len(items), N-i) # prevent overflow of microstructure array
microstructure[i:i+s] = items[:s]
i += len(items)

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,14 +1,13 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
import numpy as np
import sys
#import sys
try:
import h5py
except (ImportError) as e:
sys.stderr.write('\nREMARK: h5py module not available \n\n')
pass # sys.stderr.write('\nREMARK: h5py module not available \n\n')
class Result():
"""

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",\
@ -337,16 +336,16 @@ class Test():
key0 = ('1_' if length[i]>1 else '') + headings0[i]['label']
key1 = ('1_' if length[i]>1 else '') + headings1[i]['label']
normKey = ('1_' if normLength[i]>1 else '') + normHeadings[i]['label']
if key0 not in table0.labels:
if key0 not in table0.labels(raw = True):
raise Exception('column {} not found in 1. table...\n'.format(key0))
elif key1 not in table1.labels:
elif key1 not in table1.labels(raw = True):
raise Exception('column {} not found in 2. table...\n'.format(key1))
elif normKey not in table0.labels:
elif normKey not in table0.labels(raw = True):
raise Exception('column {} not found in 1. table...\n'.format(normKey))
else:
column[0][i] = table0.labels.index(key0)
column[1][i] = table1.labels.index(key1)
normColumn[i] = table0.labels.index(normKey)
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
@ -422,7 +421,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 # if no column is given, read all
if column is None: columns[i] = tables[i].labels(raw = True) # if no column is given, read all
logging.info('comparing ASCIItables statistically')
for i in xrange(len(columns)):
@ -478,7 +477,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 # if no column is given, read all
if column is None: columns[i] = tables[i].labels(raw = True) # if no column is given, read all
logging.info('comparing ASCIItables')
for i in xrange(len(columns)):

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
@ -138,7 +138,7 @@ def principalStrs_Der(p, (s1, s2, s3, s4, s5, s6), dim, Karafillis=False):
return np.array([np.dot(dSdI[:,:,i],dIdc[:,:,i]).T for i in xrange(num)]).T
def invariant(sigmas):
I=np.zeros(3)
I = np.zeros(3)
s11,s22,s33,s12,s23,s31 = sigmas
I[0] = s11 + s22 + s33
I[1] = s11*s22 + s22*s33 + s33*s11 - s12**2 - s23**2 - s31**2
@ -1271,13 +1271,12 @@ def doSim(thread):
table = damask.ASCIItable(refFile,readonly=True)
table.head_read()
if options.fitting =='equivalentStrain':
thresholdKey = 'Mises(ln(V))'
elif options.fitting =='totalshear':
thresholdKey = 'totalshear'
thresholdKey = {'equivalentStrain':'Mises(ln(V))',
'totalshear': 'totalshear',
}[options.fitting]
for l in [thresholdKey,'1_Cauchy']:
if l not in table.labels: damask.util.croak('%s not found'%l)
if l not in table.labels(raw = True): damask.util.croak('%s not found'%l)
s.release()
table.data_readArray(['%i_Cauchy'%(i+1) for i in xrange(9)]+[thresholdKey]+['%i_ln(V)'%(i+1) for i in xrange(9)])
@ -1380,51 +1379,46 @@ parser.add_option('-e', '--exponent', dest='exponent', type='float',
parser.add_option('-u', '--uniaxial', dest='eqStress', type='float',
help='Equivalent stress', metavar='float')
parser.set_defaults(min = 12)
parser.set_defaults(max = 30)
parser.set_defaults(threads = 4)
parser.set_defaults(yieldValue = (0.002,0.004,2))
parser.set_defaults(load = (0.010,100,100.0))
parser.set_defaults(criterion = 'vonmises')
parser.set_defaults(fitting = 'totalshear')
parser.set_defaults(geometry = '20grains16x16x16')
parser.set_defaults(bounds = None)
parser.set_defaults(dimension = '3')
parser.set_defaults(exponent = -1.0)
parser.set_defaults(min = 12,
max = 30,
threads = 4,
yieldValue = (0.002,0.004,2),
load = (0.010,100,100.0),
criterion = 'vonmises',
fitting = 'totalshear',
geometry = '20grains16x16x16',
bounds = None,
dimension = '3',
exponent = -1.0,
)
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')
if options.threads<1:
parser.error('invalid number of threads %i'%options.threads)
if options.min<0:
parser.error('invalid minimum number of simulations %i'%options.min)
if options.max<options.min:
if options.threads < 1:
parser.error('invalid number of threads {}'.format(options.threads))
if options.min < 0:
parser.error('invalid minimum number of simulations {}'.format(options.min))
if options.max < options.min:
parser.error('invalid maximum number of simulations (below minimum)')
if options.yieldValue[0]>options.yieldValue[1]:
if options.yieldValue[0] > options.yieldValue[1]:
parser.error('invalid yield start (below yield end)')
if options.yieldValue[2] != int(options.yieldValue[2]):
parser.error('count must be an integer')
if not os.path.isfile('numerics.config'):
damask.util.croak('numerics.config file not found')
if not os.path.isfile('material.config'):
damask.util.croak('material.config file not found')
for check in [options.geometry+'.geom','numerics.config','material.config']:
if not os.path.isfile(check):
damask.util.croak('"{}" file not found'.format(check))
options.dimension = int(options.dimension)
if options.criterion == 'hill1948': stressUnit = 1.0e9
else : stressUnit = 1.0e6
stressUnit = 1.0e9 if options.criterion == 'hill1948' else 1.0e6
if options.dimension not in fitCriteria[options.criterion]['dimen']:
parser.error('invalid dimension for selected criterion')
if options.criterion not in ['vonmises','tresca','drucker','hill1984'] and options.eqStress is None:
parser.error('please specifie an equivalent stress (e.g. fitting to von Mises)')
if options.criterion not in ['vonmises','tresca','drucker','hill1948'] and options.eqStress is None:
parser.error('please specify an equivalent stress (e.g. fitting to von Mises)')
run = runFit(options.exponent, options.eqStress, options.dimension, options.criterion)

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
@ -430,4 +430,4 @@ for filename in args:
vtk = open(os.path.join(head,what+'_'+os.path.splitext(tail)[0]+'.vtk'), 'w')
output(out[what],{'filepointer':vtk},'File')
vtk.close()
print
print

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys
@ -59,7 +59,7 @@ for name in filenames:
for label in datainfo['label']:
key = label
if key in table.labels:
if key in table.labels(raw = True):
active.append(label)
column[label] = table.labels.index(key) # remember columns of requested data
else:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,re,sys
@ -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
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
else label)
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)
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
table.head_write()
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()
# ------------------------------------------ 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 -----------------------------------
# ------------------------------------------ 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
@ -87,7 +87,7 @@ def displacementFluctFFT(F,grid,size,nodal=False,transformed=False):
# MAIN
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options file[s]', description = """
parser = OptionParser(option_class=damask.extendableOption, usage='%prog [options] [ASCIItable(s)]', description = """
Add displacments resulting from deformation gradient field.
Operates on periodic three-dimensional x,y,z-ordered data sets.
Outputs at cell centers or cell nodes (into separate file).
@ -98,7 +98,7 @@ parser.add_option('-f',
'--defgrad',
dest = 'defgrad',
metavar = 'string',
help = 'column label of deformation gradient [%default]')
help = 'label of deformation gradient [%default]')
parser.add_option('-p',
'--pos', '--position',
dest = 'pos',

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
@ -10,7 +11,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version])
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """
Add grain index based on similiarity of crystal lattice orientation.
""", version = scriptID)

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
@ -89,14 +89,14 @@ for name in filenames:
# ------------------------------------------ assemble header --------------------------------------
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
table.labels_append(mappedTable.labels) # extend ASCII header with new labels
table.labels_append(mappedTable.labels(raw = True)) # extend ASCII header with new labels
table.head_write()
# ------------------------------------------ process data ------------------------------------------
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
table.data_append(mappedTable.data[int(round(float(table.data[mappedColumn])))+options.offset-1]) # add all mapped data types
outputAlive = table.data_write() # output processed line
# ------------------------------------------ output finalization -----------------------------------

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