added scaling option for displacements

This commit is contained in:
Christoph Kords 2013-04-29 16:02:30 +00:00
parent 6b7a69fea6
commit 12ca2c1931
1 changed files with 4 additions and 1 deletions

View File

@ -42,10 +42,13 @@ parser.add_option('-r','--range', dest='range', type='int', nargs=3, \
help='range of positions (or increments) to output (start, end, step) [all]') help='range of positions (or increments) to output (start, end, step) [all]')
parser.add_option('--increments', action='store_true', dest='getIncrements', \ parser.add_option('--increments', action='store_true', dest='getIncrements', \
help='switch to increment range [%default]') help='switch to increment range [%default]')
parser.add_option('--scale', dest='scale', type='float', \
help='scaling factor for the nodal displacements [%default]')
parser.set_defaults(dir = 'vtk') parser.set_defaults(dir = 'vtk')
parser.set_defaults(getIncrements= False) parser.set_defaults(getIncrements= False)
parser.set_defaults(scale = 1)
(options, files) = parser.parse_args() (options, files) = parser.parse_args()
@ -128,7 +131,7 @@ for incCount,position in enumerate(locations): # walk through locations
node_displacement = [[0,0,0] for i in range(Nnodes)] node_displacement = [[0,0,0] for i in range(Nnodes)]
for n in range(Nnodes): for n in range(Nnodes):
if p.node_displacements(): if p.node_displacements():
node_displacement[n] = list(p.node_displacement(n)) node_displacement[n] = map(lambda x:x*options.scale,list(p.node_displacement(n)))
c = damask.core.mesh.mesh_build_cellnodes(numpy.array(node_displacement).T,Ncellnodes) c = damask.core.mesh.mesh_build_cellnodes(numpy.array(node_displacement).T,Ncellnodes)
cellnode_displacement = [[c[i][n] for i in range(3)] for n in range(Ncellnodes)] cellnode_displacement = [[c[i][n] for i in range(3)] for n in range(Ncellnodes)]