Merge remote-tracking branch 'origin/development' into even-more-HDF5-postprocessing
This commit is contained in:
commit
de316f1afe
|
@ -13,7 +13,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|||
scriptID = ' '.join([scriptName,damask.version])
|
||||
|
||||
def operator(stretch,strain,eigenvalues):
|
||||
"""Albrecht Bertram: Elasticity and Plasticity of Large Deformations An Introduction (3rd Edition, 2012), p. 102"""
|
||||
"""Albrecht Bertram: Elasticity and Plasticity of Large Deformations An Introduction (3rd Edition, 2012), p. 102."""
|
||||
return {
|
||||
'V#ln': np.log(eigenvalues) ,
|
||||
'U#ln': np.log(eigenvalues) ,
|
||||
|
@ -88,7 +88,7 @@ for name in filenames:
|
|||
try:
|
||||
table = damask.ASCIItable(name = name,
|
||||
buffered = False)
|
||||
except: continue
|
||||
except IOError: continue
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
# ------------------------------------------ read header ------------------------------------------
|
||||
|
@ -136,23 +136,19 @@ for name in filenames:
|
|||
for column in items['tensor']['column']: # loop over all requested defgrads
|
||||
F = np.array(list(map(float,table.data[column:column+items['tensor']['dim']])),'d').reshape(items['tensor']['shape'])
|
||||
(U,S,Vh) = np.linalg.svd(F) # singular value decomposition
|
||||
R_inv = np.linalg.inv(np.dot(U,Vh)) # inverse rotation of polar decomposition
|
||||
R_inv = np.dot(U,Vh).T # rotation of polar decomposition
|
||||
stretch['U'] = np.dot(R_inv,F) # F = RU
|
||||
stretch['V'] = np.dot(F,R_inv) # F = VR
|
||||
|
||||
for theStretch in stretches:
|
||||
stretch[theStretch] = np.where(abs(stretch[theStretch]) < 1e-12, 0, stretch[theStretch]) # kill nasty noisy data
|
||||
(D,V) = np.linalg.eig(stretch[theStretch]) # eigen decomposition (of symmetric matrix)
|
||||
(D,V) = np.linalg.eigh((stretch[theStretch]+stretch[theStretch].T)*0.5) # eigen decomposition (of symmetric(ed) matrix)
|
||||
neg = np.where(D < 0.0) # find negative eigenvalues ...
|
||||
D[neg] *= -1. # ... flip value ...
|
||||
V[:,neg] *= -1. # ... and vector
|
||||
for i,eigval in enumerate(D):
|
||||
if np.dot(V[:,i],V[:,(i+1)%3]) != 0.0: # check each vector for orthogonality
|
||||
V[:,(i+1)%3] = np.cross(V[:,(i+2)%3],V[:,i]) # correct next vector
|
||||
V[:,(i+1)%3] /= np.sqrt(np.dot(V[:,(i+1)%3],V[:,(i+1)%3].conj())) # and renormalize (hyperphobic?)
|
||||
for theStrain in strains:
|
||||
for theStrain in strains:
|
||||
d = operator(theStretch,theStrain,D) # operate on eigenvalues of U or V
|
||||
eps = (np.dot(V,np.dot(np.diag(d),V.T)).real).reshape(9) # build tensor back from eigenvalue/vector basis
|
||||
eps = np.dot(V,np.dot(np.diag(d),V.T)).reshape(9) # build tensor back from eigenvalue/vector basis
|
||||
|
||||
table.data_append(list(eps))
|
||||
|
||||
|
|
Loading…
Reference in New Issue