2018-11-17 12:42:12 +05:30
|
|
|
#!/usr/bin/env python3
|
2014-04-02 00:11:14 +05:30
|
|
|
# -*- coding: UTF-8 no BOM -*-
|
2011-08-25 22:14:36 +05:30
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
import os
|
2016-06-27 23:08:12 +05:30
|
|
|
import math
|
2016-06-29 23:39:42 +05:30
|
|
|
import numpy as np
|
2016-06-27 23:08:12 +05:30
|
|
|
import scipy.ndimage
|
2014-07-10 14:57:51 +05:30
|
|
|
from optparse import OptionParser
|
|
|
|
import damask
|
2011-08-25 22:14:36 +05:30
|
|
|
|
2016-01-27 22:36:00 +05:30
|
|
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|
|
|
scriptID = ' '.join([scriptName,damask.version])
|
2011-08-25 22:14:36 +05:30
|
|
|
|
2016-06-27 23:08:12 +05:30
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
def cell2node(cellData,grid):
|
|
|
|
|
|
|
|
nodeData = 0.0
|
|
|
|
datalen = np.array(cellData.shape[3:]).prod()
|
|
|
|
|
2016-10-25 00:46:29 +05:30
|
|
|
for i in range(datalen):
|
2016-06-29 23:39:42 +05:30
|
|
|
node = scipy.ndimage.convolve(cellData.reshape(tuple(grid[::-1])+(datalen,))[...,i],
|
2016-06-27 23:08:12 +05:30
|
|
|
np.ones((2,2,2))/8., # 2x2x2 neighborhood of cells
|
|
|
|
mode = 'wrap',
|
|
|
|
origin = -1, # offset to have cell origin as center
|
|
|
|
) # now averaged at cell origins
|
|
|
|
node = np.append(node,node[np.newaxis,0,:,:,...],axis=0) # wrap along z
|
|
|
|
node = np.append(node,node[:,0,np.newaxis,:,...],axis=1) # wrap along y
|
|
|
|
node = np.append(node,node[:,:,0,np.newaxis,...],axis=2) # wrap along x
|
|
|
|
|
|
|
|
nodeData = node[...,np.newaxis] if i==0 else np.concatenate((nodeData,node[...,np.newaxis]),axis=-1)
|
|
|
|
|
|
|
|
return nodeData
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
2016-06-29 23:39:42 +05:30
|
|
|
def deformationAvgFFT(F,grid,size,nodal=False,transformed=False):
|
2016-10-25 00:46:29 +05:30
|
|
|
"""Calculate average cell center (or nodal) deformation for deformation gradient field specified in each grid cell"""
|
2016-06-27 23:08:12 +05:30
|
|
|
if nodal:
|
2016-06-29 23:39:42 +05:30
|
|
|
x, y, z = np.meshgrid(np.linspace(0,size[2],1+grid[2]),
|
2016-06-27 23:08:12 +05:30
|
|
|
np.linspace(0,size[1],1+grid[1]),
|
2016-06-29 23:39:42 +05:30
|
|
|
np.linspace(0,size[0],1+grid[0]),
|
2016-06-27 23:08:12 +05:30
|
|
|
indexing = 'ij')
|
|
|
|
else:
|
2016-06-29 23:39:42 +05:30
|
|
|
x, y, z = np.meshgrid(np.linspace(size[2]/grid[2]/2.,size[2]-size[2]/grid[2]/2.,grid[2]),
|
|
|
|
np.linspace(size[1]/grid[1]/2.,size[1]-size[1]/grid[1]/2.,grid[1]),
|
|
|
|
np.linspace(size[0]/grid[0]/2.,size[0]-size[0]/grid[0]/2.,grid[0]),
|
2016-06-27 23:08:12 +05:30
|
|
|
indexing = 'ij')
|
|
|
|
|
|
|
|
origCoords = np.concatenate((z[:,:,:,None],y[:,:,:,None],x[:,:,:,None]),axis = 3)
|
|
|
|
|
|
|
|
F_fourier = F if transformed else np.fft.rfftn(F,axes=(0,1,2)) # transform or use provided data
|
|
|
|
Favg = np.real(F_fourier[0,0,0,:,:])/grid.prod() # take zero freq for average
|
2016-06-29 23:39:42 +05:30
|
|
|
avgDeformation = np.einsum('ml,ijkl->ijkm',Favg,origCoords) # dX = Favg.X
|
2016-06-27 23:08:12 +05:30
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
return avgDeformation
|
2016-06-27 23:08:12 +05:30
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
def displacementFluctFFT(F,grid,size,nodal=False,transformed=False):
|
2016-10-25 00:46:29 +05:30
|
|
|
"""Calculate cell center (or nodal) displacement for deformation gradient field specified in each grid cell"""
|
2016-06-27 23:08:12 +05:30
|
|
|
integrator = 0.5j * size / math.pi
|
|
|
|
|
|
|
|
kk, kj, ki = np.meshgrid(np.where(np.arange(grid[2])>grid[2]//2,np.arange(grid[2])-grid[2],np.arange(grid[2])),
|
|
|
|
np.where(np.arange(grid[1])>grid[1]//2,np.arange(grid[1])-grid[1],np.arange(grid[1])),
|
|
|
|
np.arange(grid[0]//2+1),
|
|
|
|
indexing = 'ij')
|
|
|
|
k_s = np.concatenate((ki[:,:,:,None],kj[:,:,:,None],kk[:,:,:,None]),axis = 3)
|
|
|
|
k_sSquared = np.einsum('...l,...l',k_s,k_s)
|
|
|
|
k_sSquared[0,0,0] = 1.0 # ignore global average frequency
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
# integration in Fourier space
|
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
displacement_fourier = -np.einsum('ijkml,ijkl,l->ijkm',
|
2016-06-27 23:08:12 +05:30
|
|
|
F if transformed else np.fft.rfftn(F,axes=(0,1,2)),
|
|
|
|
k_s,
|
|
|
|
integrator,
|
2016-06-29 23:39:42 +05:30
|
|
|
) / k_sSquared[...,np.newaxis]
|
2016-06-27 23:08:12 +05:30
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
# backtransformation to real space
|
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
displacement = np.fft.irfftn(displacement_fourier,grid[::-1],axes=(0,1,2))
|
2016-06-27 23:08:12 +05:30
|
|
|
|
|
|
|
return cell2node(displacement,grid) if nodal else displacement
|
|
|
|
|
2016-03-24 17:05:33 +05:30
|
|
|
|
2016-03-24 18:49:00 +05:30
|
|
|
def volTetrahedron(coords):
|
2016-03-24 17:05:33 +05:30
|
|
|
"""
|
2016-04-15 04:02:30 +05:30
|
|
|
Return the volume of the tetrahedron with given vertices or sides.
|
|
|
|
|
|
|
|
Ifvertices are given they must be in a NumPy array with shape (4,3): the
|
2016-03-24 17:05:33 +05:30
|
|
|
position vectors of the 4 vertices in 3 dimensions; if the six sides are
|
|
|
|
given, they must be an array of length 6. If both are given, the sides
|
|
|
|
will be used in the calculation.
|
|
|
|
|
|
|
|
This method implements
|
|
|
|
Tartaglia's formula using the Cayley-Menger determinant:
|
|
|
|
|0 1 1 1 1 |
|
|
|
|
|1 0 s1^2 s2^2 s3^2|
|
|
|
|
288 V^2 = |1 s1^2 0 s4^2 s5^2|
|
|
|
|
|1 s2^2 s4^2 0 s6^2|
|
|
|
|
|1 s3^2 s5^2 s6^2 0 |
|
|
|
|
where s1, s2, ..., s6 are the tetrahedron side lengths.
|
|
|
|
|
|
|
|
from http://codereview.stackexchange.com/questions/77593/calculating-the-volume-of-a-tetrahedron
|
|
|
|
"""
|
|
|
|
# The indexes of rows in the vertices array corresponding to all
|
|
|
|
# possible pairs of vertices
|
|
|
|
vertex_pair_indexes = np.array(((0, 1), (0, 2), (0, 3),
|
|
|
|
(1, 2), (1, 3), (2, 3)))
|
|
|
|
|
|
|
|
# Get all the squares of all side lengths from the differences between
|
|
|
|
# the 6 different pairs of vertex positions
|
2016-03-24 18:49:00 +05:30
|
|
|
vertices = np.concatenate((coords[0],coords[1],coords[2],coords[3])).reshape([4,3])
|
2016-03-24 17:05:33 +05:30
|
|
|
vertex1, vertex2 = vertex_pair_indexes[:,0], vertex_pair_indexes[:,1]
|
|
|
|
sides_squared = np.sum((vertices[vertex1] - vertices[vertex2])**2,axis=-1)
|
|
|
|
|
|
|
|
|
|
|
|
# Set up the Cayley-Menger determinant
|
|
|
|
M = np.zeros((5,5))
|
|
|
|
# Fill in the upper triangle of the matrix
|
|
|
|
M[0,1:] = 1
|
|
|
|
# The squared-side length elements can be indexed using the vertex
|
|
|
|
# pair indices (compare with the determinant illustrated above)
|
|
|
|
M[tuple(zip(*(vertex_pair_indexes + 1)))] = sides_squared
|
|
|
|
|
|
|
|
# The matrix is symmetric, so we can fill in the lower triangle by
|
|
|
|
# adding the transpose
|
|
|
|
M = M + M.T
|
2016-03-24 18:49:00 +05:30
|
|
|
return np.sqrt(np.linalg.det(M) / 288)
|
2016-03-24 17:05:33 +05:30
|
|
|
|
|
|
|
|
2016-03-24 18:49:00 +05:30
|
|
|
def volumeMismatch(size,F,nodes):
|
2016-03-24 17:05:33 +05:30
|
|
|
"""
|
2016-10-25 00:46:29 +05:30
|
|
|
Calculates the volume mismatch
|
2016-04-15 04:02:30 +05:30
|
|
|
|
|
|
|
volume mismatch is defined as the difference between volume of reconstructed
|
|
|
|
(compatible) cube and determinant of defgrad at the FP
|
2016-03-24 17:05:33 +05:30
|
|
|
"""
|
2016-03-24 18:49:00 +05:30
|
|
|
coords = np.empty([8,3])
|
2016-06-29 23:39:42 +05:30
|
|
|
vMismatch = np.empty(grid[::-1])
|
2016-03-24 18:49:00 +05:30
|
|
|
volInitial = size.prod()/grid.prod()
|
2016-03-24 17:05:33 +05:30
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
# calculate actual volume and volume resulting from deformation gradient
|
2016-10-25 00:46:29 +05:30
|
|
|
for k in range(grid[2]):
|
|
|
|
for j in range(grid[1]):
|
|
|
|
for i in range(grid[0]):
|
2016-06-29 23:39:42 +05:30
|
|
|
coords[0,0:3] = nodes[k, j, i ,0:3]
|
|
|
|
coords[1,0:3] = nodes[k ,j, i+1,0:3]
|
|
|
|
coords[2,0:3] = nodes[k ,j+1,i+1,0:3]
|
|
|
|
coords[3,0:3] = nodes[k, j+1,i ,0:3]
|
|
|
|
coords[4,0:3] = nodes[k+1,j, i ,0:3]
|
|
|
|
coords[5,0:3] = nodes[k+1,j, i+1,0:3]
|
|
|
|
coords[6,0:3] = nodes[k+1,j+1,i+1,0:3]
|
|
|
|
coords[7,0:3] = nodes[k+1,j+1,i ,0:3]
|
|
|
|
vMismatch[k,j,i] = \
|
|
|
|
( abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[7,0:3],coords[3,0:3]])) \
|
2016-03-24 18:49:00 +05:30
|
|
|
+ abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[7,0:3],coords[4,0:3]])) \
|
|
|
|
+ abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[2,0:3],coords[3,0:3]])) \
|
|
|
|
+ abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[2,0:3],coords[1,0:3]])) \
|
|
|
|
+ abs(volTetrahedron([coords[6,0:3],coords[4,0:3],coords[1,0:3],coords[5,0:3]])) \
|
2016-06-29 23:39:42 +05:30
|
|
|
+ abs(volTetrahedron([coords[6,0:3],coords[4,0:3],coords[1,0:3],coords[0,0:3]]))) \
|
|
|
|
/np.linalg.det(F[k,j,i,0:3,0:3])
|
2016-03-24 18:49:00 +05:30
|
|
|
return vMismatch/volInitial
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def shapeMismatch(size,F,nodes,centres):
|
2016-03-24 17:05:33 +05:30
|
|
|
"""
|
2016-04-15 04:02:30 +05:30
|
|
|
Routine to calculate the shape mismatch
|
|
|
|
|
|
|
|
shape mismatch is defined as difference between the vectors from the central point to
|
2016-03-24 17:05:33 +05:30
|
|
|
the corners of reconstructed (combatible) volume element and the vectors calculated by deforming
|
|
|
|
the initial volume element with the current deformation gradient
|
|
|
|
"""
|
2016-03-24 18:49:00 +05:30
|
|
|
coordsInitial = np.empty([8,3])
|
2016-06-29 23:39:42 +05:30
|
|
|
sMismatch = np.empty(grid[::-1])
|
2016-03-24 17:05:33 +05:30
|
|
|
|
2016-03-24 18:49:00 +05:30
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
# initial positions
|
|
|
|
coordsInitial[0,0:3] = [-size[0]/grid[0],-size[1]/grid[1],-size[2]/grid[2]]
|
|
|
|
coordsInitial[1,0:3] = [+size[0]/grid[0],-size[1]/grid[1],-size[2]/grid[2]]
|
|
|
|
coordsInitial[2,0:3] = [+size[0]/grid[0],+size[1]/grid[1],-size[2]/grid[2]]
|
|
|
|
coordsInitial[3,0:3] = [-size[0]/grid[0],+size[1]/grid[1],-size[2]/grid[2]]
|
|
|
|
coordsInitial[4,0:3] = [-size[0]/grid[0],-size[1]/grid[1],+size[2]/grid[2]]
|
|
|
|
coordsInitial[5,0:3] = [+size[0]/grid[0],-size[1]/grid[1],+size[2]/grid[2]]
|
|
|
|
coordsInitial[6,0:3] = [+size[0]/grid[0],+size[1]/grid[1],+size[2]/grid[2]]
|
|
|
|
coordsInitial[7,0:3] = [-size[0]/grid[0],+size[1]/grid[1],+size[2]/grid[2]]
|
|
|
|
coordsInitial = coordsInitial/2.0
|
2016-03-24 17:05:33 +05:30
|
|
|
|
2016-03-24 18:49:00 +05:30
|
|
|
#--------------------------------------------------------------------------------------------------
|
|
|
|
# compare deformed original and deformed positions to actual positions
|
2016-10-25 00:46:29 +05:30
|
|
|
for k in range(grid[2]):
|
|
|
|
for j in range(grid[1]):
|
|
|
|
for i in range(grid[0]):
|
2016-06-29 23:39:42 +05:30
|
|
|
sMismatch[k,j,i] = \
|
|
|
|
+ np.linalg.norm(nodes[k, j, i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[0,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k, j, i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[1,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k, j+1,i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[2,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k, j+1,i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[3,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k+1,j, i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[4,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k+1,j, i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[5,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k+1,j+1,i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[6,0:3]))\
|
|
|
|
+ np.linalg.norm(nodes[k+1,j+1,i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[7,0:3]))
|
2016-03-24 18:49:00 +05:30
|
|
|
return sMismatch
|
|
|
|
|
2016-03-24 17:05:33 +05:30
|
|
|
|
2011-08-25 22:14:36 +05:30
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# MAIN
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
2019-02-16 22:11:56 +05:30
|
|
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """
|
2015-08-08 00:33:26 +05:30
|
|
|
Add column(s) containing the shape and volume mismatch resulting from given deformation gradient.
|
|
|
|
Operates on periodic three-dimensional x,y,z-ordered data sets.
|
2011-08-25 22:14:36 +05:30
|
|
|
|
2014-08-06 18:57:09 +05:30
|
|
|
""", version = scriptID)
|
|
|
|
|
2011-08-25 22:14:36 +05:30
|
|
|
|
2015-08-08 00:33:26 +05:30
|
|
|
parser.add_option('-c','--coordinates',
|
2016-04-27 02:19:58 +05:30
|
|
|
dest = 'pos',
|
2015-08-08 00:33:26 +05:30
|
|
|
type = 'string', metavar = 'string',
|
|
|
|
help = 'column heading of coordinates [%default]')
|
|
|
|
parser.add_option('-f','--defgrad',
|
|
|
|
dest = 'defgrad',
|
|
|
|
type = 'string', metavar = 'string ',
|
|
|
|
help = 'column heading of deformation gradient [%default]')
|
|
|
|
parser.add_option('--no-shape','-s',
|
|
|
|
dest = 'shape',
|
|
|
|
action = 'store_false',
|
|
|
|
help = 'omit shape mismatch')
|
|
|
|
parser.add_option('--no-volume','-v',
|
|
|
|
dest = 'volume',
|
|
|
|
action = 'store_false',
|
|
|
|
help = 'omit volume mismatch')
|
2016-04-27 02:19:58 +05:30
|
|
|
parser.set_defaults(pos = 'pos',
|
|
|
|
defgrad = 'f',
|
|
|
|
shape = True,
|
|
|
|
volume = True,
|
2015-08-08 00:33:26 +05:30
|
|
|
)
|
2011-08-25 22:14:36 +05:30
|
|
|
|
|
|
|
(options,filenames) = parser.parse_args()
|
|
|
|
|
2015-08-08 00:33:26 +05:30
|
|
|
# --- loop over input files -------------------------------------------------------------------------
|
|
|
|
|
2015-08-21 01:12:05 +05:30
|
|
|
if filenames == []: filenames = [None]
|
2015-08-08 00:33:26 +05:30
|
|
|
|
2014-07-22 01:25:05 +05:30
|
|
|
for name in filenames:
|
2015-08-21 01:12:05 +05:30
|
|
|
try:
|
|
|
|
table = damask.ASCIItable(name = name,
|
|
|
|
buffered = False)
|
|
|
|
except: continue
|
2015-09-24 14:54:42 +05:30
|
|
|
damask.util.report(scriptName,name)
|
2015-08-08 00:33:26 +05:30
|
|
|
|
|
|
|
# ------------------------------------------ read header ------------------------------------------
|
|
|
|
|
|
|
|
table.head_read()
|
|
|
|
|
|
|
|
# ------------------------------------------ sanity checks ----------------------------------------
|
|
|
|
|
|
|
|
errors = []
|
|
|
|
remarks = []
|
|
|
|
|
2016-05-17 05:39:00 +05:30
|
|
|
if table.label_dimension(options.defgrad) != 9:
|
2016-06-27 23:08:12 +05:30
|
|
|
errors.append('deformation gradient "{}" is not a 3x3 tensor.'.format(options.defgrad))
|
|
|
|
|
|
|
|
coordDim = table.label_dimension(options.pos)
|
|
|
|
if not 3 >= coordDim >= 1:
|
|
|
|
errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos))
|
|
|
|
elif coordDim < 3:
|
|
|
|
remarks.append('appending {} dimension{} to coordinates "{}"...'.format(3-coordDim,
|
|
|
|
's' if coordDim < 2 else '',
|
|
|
|
options.pos))
|
2015-08-08 00:33:26 +05:30
|
|
|
|
2015-09-24 14:54:42 +05:30
|
|
|
if remarks != []: damask.util.croak(remarks)
|
2015-08-08 00:33:26 +05:30
|
|
|
if errors != []:
|
2015-09-24 14:54:42 +05:30
|
|
|
damask.util.croak(errors)
|
2016-06-27 23:08:12 +05:30
|
|
|
table.close(dismiss=True)
|
2015-08-08 00:33:26 +05:30
|
|
|
continue
|
|
|
|
|
2014-08-06 20:55:18 +05:30
|
|
|
# --------------- figure out size and grid ---------------------------------------------------------
|
2015-08-08 00:33:26 +05:30
|
|
|
|
2016-06-27 23:08:12 +05:30
|
|
|
table.data_readArray([options.defgrad,options.pos])
|
|
|
|
table.data_rewind()
|
|
|
|
|
|
|
|
if table.data[:,9:].shape[1] < 3:
|
|
|
|
table.data = np.hstack((table.data,
|
|
|
|
np.zeros((table.data.shape[0],
|
|
|
|
3-table.data[:,9:].shape[1]),dtype='f'))) # fill coords up to 3D with zeros
|
2014-07-10 14:57:51 +05:30
|
|
|
|
2018-07-19 19:42:36 +05:30
|
|
|
grid,size = damask.util.coordGridAndSize(table.data[:,9:12])
|
2015-08-08 00:33:26 +05:30
|
|
|
N = grid.prod()
|
2016-06-27 23:08:12 +05:30
|
|
|
|
|
|
|
if N != len(table.data): errors.append('data count {} does not match grid {}x{}x{}.'.format(N,*grid))
|
|
|
|
if errors != []:
|
|
|
|
damask.util.croak(errors)
|
|
|
|
table.close(dismiss = True)
|
2015-09-01 02:52:44 +05:30
|
|
|
continue
|
2016-06-27 23:08:12 +05:30
|
|
|
|
|
|
|
# -----------------------------process data and assemble header -------------------------------------
|
|
|
|
|
|
|
|
F_fourier = np.fft.rfftn(table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),axes=(0,1,2)) # perform transform only once...
|
2016-06-29 23:39:42 +05:30
|
|
|
nodes = displacementFluctFFT(F_fourier,grid,size,True,transformed=True)\
|
|
|
|
+ deformationAvgFFT (F_fourier,grid,size,True,transformed=True)
|
|
|
|
|
2016-06-27 23:08:12 +05:30
|
|
|
if options.shape:
|
|
|
|
table.labels_append(['shapeMismatch({})'.format(options.defgrad)])
|
2016-06-29 23:39:42 +05:30
|
|
|
centres = displacementFluctFFT(F_fourier,grid,size,False,transformed=True)\
|
|
|
|
+ deformationAvgFFT (F_fourier,grid,size,False,transformed=True)
|
2016-06-27 23:08:12 +05:30
|
|
|
|
|
|
|
if options.volume:
|
|
|
|
table.labels_append(['volMismatch({})'.format(options.defgrad)])
|
2015-08-08 00:33:26 +05:30
|
|
|
|
2015-09-01 02:52:44 +05:30
|
|
|
table.head_write()
|
2016-06-29 23:39:42 +05:30
|
|
|
if options.shape:
|
|
|
|
shapeMismatch = shapeMismatch( size,table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),nodes,centres)
|
|
|
|
if options.volume:
|
|
|
|
volumeMismatch = volumeMismatch(size,table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),nodes)
|
2015-08-08 00:33:26 +05:30
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
# ------------------------------------------ output data -------------------------------------------
|
2016-10-25 00:46:29 +05:30
|
|
|
for i in range(grid[2]):
|
|
|
|
for j in range(grid[1]):
|
|
|
|
for k in range(grid[0]):
|
2016-06-29 23:39:42 +05:30
|
|
|
table.data_read()
|
|
|
|
if options.shape: table.data_append(shapeMismatch[i,j,k])
|
|
|
|
if options.volume: table.data_append(volumeMismatch[i,j,k])
|
|
|
|
table.data_write()
|
2015-08-08 00:33:26 +05:30
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
# ------------------------------------------ output finalization -----------------------------------
|
2016-06-27 23:08:12 +05:30
|
|
|
|
2016-06-29 23:39:42 +05:30
|
|
|
table.close() # close ASCII tables
|