Merge branch 'development' of magit1.mpie.de:damask/DAMASK into development
This commit is contained in:
commit
be99018ce3
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sys
|
#import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import h5py
|
import h5py
|
||||||
except (ImportError) as e:
|
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():
|
class Result():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -336,16 +336,16 @@ class Test():
|
||||||
key0 = ('1_' if length[i]>1 else '') + headings0[i]['label']
|
key0 = ('1_' if length[i]>1 else '') + headings0[i]['label']
|
||||||
key1 = ('1_' if length[i]>1 else '') + headings1[i]['label']
|
key1 = ('1_' if length[i]>1 else '') + headings1[i]['label']
|
||||||
normKey = ('1_' if normLength[i]>1 else '') + normHeadings[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))
|
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))
|
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))
|
raise Exception('column {} not found in 1. table...\n'.format(normKey))
|
||||||
else:
|
else:
|
||||||
column[0][i] = table0.labels.index(key0)
|
column[0][i] = table0.label_index(key0)
|
||||||
column[1][i] = table1.labels.index(key1)
|
column[1][i] = table1.label_index(key1)
|
||||||
normColumn[i] = table0.labels.index(normKey)
|
normColumn[i] = table0.label_index(normKey)
|
||||||
|
|
||||||
line0 = 0
|
line0 = 0
|
||||||
while table0.data_read(): # read next data line of ASCII table
|
while table0.data_read(): # read next data line of ASCII table
|
||||||
|
@ -421,7 +421,7 @@ class Test():
|
||||||
columns = columns[:len(files)] # truncate to same length as files
|
columns = columns[:len(files)] # truncate to same length as files
|
||||||
|
|
||||||
for i,column in enumerate(columns):
|
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')
|
logging.info('comparing ASCIItables statistically')
|
||||||
for i in xrange(len(columns)):
|
for i in xrange(len(columns)):
|
||||||
|
@ -477,7 +477,7 @@ class Test():
|
||||||
columns = columns[:len(files)] # truncate to same length as files
|
columns = columns[:len(files)] # truncate to same length as files
|
||||||
|
|
||||||
for i,column in enumerate(columns):
|
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')
|
logging.info('comparing ASCIItables')
|
||||||
for i in xrange(len(columns)):
|
for i in xrange(len(columns)):
|
||||||
|
|
|
@ -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
|
return np.array([np.dot(dSdI[:,:,i],dIdc[:,:,i]).T for i in xrange(num)]).T
|
||||||
|
|
||||||
def invariant(sigmas):
|
def invariant(sigmas):
|
||||||
I=np.zeros(3)
|
I = np.zeros(3)
|
||||||
s11,s22,s33,s12,s23,s31 = sigmas
|
s11,s22,s33,s12,s23,s31 = sigmas
|
||||||
I[0] = s11 + s22 + s33
|
I[0] = s11 + s22 + s33
|
||||||
I[1] = s11*s22 + s22*s33 + s33*s11 - s12**2 - s23**2 - s31**2
|
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 = damask.ASCIItable(refFile,readonly=True)
|
||||||
table.head_read()
|
table.head_read()
|
||||||
|
|
||||||
if options.fitting =='equivalentStrain':
|
thresholdKey = {'equivalentStrain':'Mises(ln(V))',
|
||||||
thresholdKey = 'Mises(ln(V))'
|
'totalshear': 'totalshear',
|
||||||
elif options.fitting =='totalshear':
|
}[options.fitting]
|
||||||
thresholdKey = 'totalshear'
|
|
||||||
|
|
||||||
for l in [thresholdKey,'1_Cauchy']:
|
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()
|
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)])
|
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',
|
parser.add_option('-u', '--uniaxial', dest='eqStress', type='float',
|
||||||
help='Equivalent stress', metavar='float')
|
help='Equivalent stress', metavar='float')
|
||||||
|
|
||||||
parser.set_defaults(min = 12)
|
parser.set_defaults(min = 12,
|
||||||
parser.set_defaults(max = 30)
|
max = 30,
|
||||||
parser.set_defaults(threads = 4)
|
threads = 4,
|
||||||
parser.set_defaults(yieldValue = (0.002,0.004,2))
|
yieldValue = (0.002,0.004,2),
|
||||||
parser.set_defaults(load = (0.010,100,100.0))
|
load = (0.010,100,100.0),
|
||||||
parser.set_defaults(criterion = 'vonmises')
|
criterion = 'vonmises',
|
||||||
parser.set_defaults(fitting = 'totalshear')
|
fitting = 'totalshear',
|
||||||
parser.set_defaults(geometry = '20grains16x16x16')
|
geometry = '20grains16x16x16',
|
||||||
parser.set_defaults(bounds = None)
|
bounds = None,
|
||||||
parser.set_defaults(dimension = '3')
|
dimension = '3',
|
||||||
parser.set_defaults(exponent = -1.0)
|
exponent = -1.0,
|
||||||
|
)
|
||||||
|
|
||||||
options = parser.parse_args()[0]
|
options = parser.parse_args()[0]
|
||||||
|
|
||||||
if not os.path.isfile(options.geometry+'.geom'):
|
if options.threads < 1:
|
||||||
parser.error('geometry file %s.geom not found'%options.geometry)
|
parser.error('invalid number of threads {}'.format(options.threads))
|
||||||
if not os.path.isfile('material.config'):
|
if options.min < 0:
|
||||||
parser.error('material.config file not found')
|
parser.error('invalid minimum number of simulations {}'.format(options.min))
|
||||||
if options.threads<1:
|
if options.max < options.min:
|
||||||
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:
|
|
||||||
parser.error('invalid maximum number of simulations (below minimum)')
|
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)')
|
parser.error('invalid yield start (below yield end)')
|
||||||
if options.yieldValue[2] != int(options.yieldValue[2]):
|
if options.yieldValue[2] != int(options.yieldValue[2]):
|
||||||
parser.error('count must be an integer')
|
parser.error('count must be an integer')
|
||||||
|
|
||||||
if not os.path.isfile('numerics.config'):
|
for check in [options.geometry+'.geom','numerics.config','material.config']:
|
||||||
damask.util.croak('numerics.config file not found')
|
if not os.path.isfile(check):
|
||||||
if not os.path.isfile('material.config'):
|
damask.util.croak('"{}" file not found'.format(check))
|
||||||
damask.util.croak('material.config file not found')
|
|
||||||
|
|
||||||
options.dimension = int(options.dimension)
|
options.dimension = int(options.dimension)
|
||||||
|
|
||||||
if options.criterion == 'hill1948': stressUnit = 1.0e9
|
stressUnit = 1.0e9 if options.criterion == 'hill1948' else 1.0e6
|
||||||
else : stressUnit = 1.0e6
|
|
||||||
|
|
||||||
|
|
||||||
if options.dimension not in fitCriteria[options.criterion]['dimen']:
|
if options.dimension not in fitCriteria[options.criterion]['dimen']:
|
||||||
parser.error('invalid dimension for selected criterion')
|
parser.error('invalid dimension for selected criterion')
|
||||||
|
|
||||||
if options.criterion not in ['vonmises','tresca','drucker','hill1984'] and options.eqStress is None:
|
if options.criterion not in ['vonmises','tresca','drucker','hill1948'] and options.eqStress is None:
|
||||||
parser.error('please specifie an equivalent stress (e.g. fitting to von Mises)')
|
parser.error('please specify an equivalent stress (e.g. fitting to von Mises)')
|
||||||
|
|
||||||
run = runFit(options.exponent, options.eqStress, options.dimension, options.criterion)
|
run = runFit(options.exponent, options.eqStress, options.dimension, options.criterion)
|
||||||
|
|
||||||
|
|
|
@ -29,33 +29,30 @@ parser.add_option('-a', '--add','--table',
|
||||||
if filenames == []: filenames = [None]
|
if filenames == []: filenames = [None]
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
try:
|
try: table = damask.ASCIItable(name = name,
|
||||||
table = damask.ASCIItable(name = name,
|
buffered = False)
|
||||||
buffered = False)
|
|
||||||
except: continue
|
except: continue
|
||||||
|
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
tables = []
|
tables = []
|
||||||
for addTable in options.table:
|
for addTable in options.table:
|
||||||
try:
|
try: tables.append(damask.ASCIItable(name = addTable,
|
||||||
tables.append(damask.ASCIItable(name = addTable,
|
buffered = False,
|
||||||
buffered = False,
|
readonly = True)
|
||||||
readonly = True)
|
)
|
||||||
)
|
|
||||||
except: continue
|
except: continue
|
||||||
|
|
||||||
# ------------------------------------------ read headers ------------------------------------------
|
# ------------------------------------------ read headers ------------------------------------------
|
||||||
|
|
||||||
table.head_read()
|
table.head_read()
|
||||||
for addTable in tables:
|
for addTable in tables: addTable.head_read()
|
||||||
addTable.head_read()
|
|
||||||
|
|
||||||
# ------------------------------------------ assemble header --------------------------------------
|
# ------------------------------------------ assemble header --------------------------------------
|
||||||
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
for addTable in tables:
|
for addTable in tables: table.labels_append(addTable.labels(raw = True)) # extend ASCII header with new labels
|
||||||
table.labels_append(addTable.labels) # extend ASCII header with new labels
|
|
||||||
|
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@ if options.label is None:
|
||||||
if filenames == []: filenames = [None]
|
if filenames == []: filenames = [None]
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
damask.util.croak(name)
|
|
||||||
|
|
||||||
try: table = damask.ASCIItable(name = name,
|
try: table = damask.ASCIItable(name = name,
|
||||||
outname = os.path.join(
|
outname = os.path.join(
|
||||||
os.path.split(name)[0],
|
os.path.split(name)[0],
|
||||||
|
|
|
@ -91,11 +91,11 @@ for name in filenames:
|
||||||
if type == '':
|
if type == '':
|
||||||
table.data = []
|
table.data = []
|
||||||
elif type == '.':
|
elif type == '.':
|
||||||
table.data = [str(former)]
|
table.data = [former]
|
||||||
elif type == 'to':
|
elif type == 'to':
|
||||||
table.data = ['{0} to {1}'.format(former-reps+1,former)]
|
table.data = [former-reps+1,'to',former]
|
||||||
elif type == 'of':
|
elif type == 'of':
|
||||||
table.data = ['{0} of {1}'.format(reps,former)]
|
table.data = [reps,'of',former]
|
||||||
|
|
||||||
outputAlive = table.data_write(delimiter = ' ') # output processed line
|
outputAlive = table.data_write(delimiter = ' ') # output processed line
|
||||||
|
|
||||||
|
@ -106,9 +106,9 @@ for name in filenames:
|
||||||
former = current
|
former = current
|
||||||
|
|
||||||
table.data = {
|
table.data = {
|
||||||
'.' : [str(former)],
|
'.' : [former],
|
||||||
'to': ['%i to %i'%(former-reps+1,former)],
|
'to': [former-reps+1,'to',former],
|
||||||
'of': ['%i of %i'%(reps,former)],
|
'of': [reps,'of',former],
|
||||||
}[type]
|
}[type]
|
||||||
|
|
||||||
outputAlive = table.data_write(delimiter = ' ') # output processed line
|
outputAlive = table.data_write(delimiter = ' ') # output processed line
|
||||||
|
|
Loading…
Reference in New Issue