fix some syntax error

This commit is contained in:
chen 2016-10-17 16:58:04 -04:00
parent 8193747b83
commit 8e7f0c255b
1 changed files with 7 additions and 4 deletions

11
processing/post/h5_addStrainTensors.py Normal file → Executable file
View File

@ -32,8 +32,8 @@ def calcEPS(defgrads, stretchType, strainType):
# this loop can use some performance boost # this loop can use some performance boost
# (multi-threading?) # (multi-threading?)
for ri in xrange(defgrads.shape[0]): for ri in xrange(defgrads.shape[0]):
f = defgrads[ri, :, :].reshape(3, 3) f = defgrads[ri, :].reshape(3, 3)
U, S, Vh = np.lingalg.svd(f) U, S, Vh = np.linalg.svd(f)
R = np.dot(U, Vh) # rotation of polar decomposition R = np.dot(U, Vh) # rotation of polar decomposition
if stretchType == 'U': if stretchType == 'U':
stretch = np.dot(np.linalg.inv(R), f) # F = RU stretch = np.dot(np.linalg.inv(R), f) # F = RU
@ -94,6 +94,9 @@ parser.add_option('-2', '--green',
dest='green', dest='green',
action='store_true', action='store_true',
help='calculate green strain tensor') help='calculate green strain tensor')
# NOTE:
# It might be easier to just calculate one type of deformation gradient
# at a time.
msg = 'heading(s) of columns containing deformation tensor values' msg = 'heading(s) of columns containing deformation tensor values'
parser.add_option('-f', '--defgrad', parser.add_option('-f', '--defgrad',
dest='defgrad', dest='defgrad',
@ -103,7 +106,7 @@ parser.add_option('-f', '--defgrad',
parser.set_defaults(right=False, left=False, parser.set_defaults(right=False, left=False,
logarithmic=False, biot=False, green=False, logarithmic=False, biot=False, green=False,
defgrad=['f']) defgrad='f')
(options, filenames) = parser.parse_args() (options, filenames) = parser.parse_args()
@ -134,7 +137,7 @@ for name in filenames:
damask.util.report(scriptName, name) damask.util.report(scriptName, name)
# extract defgrads from HDF5 storage # extract defgrads from HDF5 storage
F = h5f.get_data(options.defgrads) F = h5f.get_data(options.defgrad)
# allow calculate multiple types of strain within the # allow calculate multiple types of strain within the
# same cmd call # same cmd call