<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:14pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>I have the following script for a Paraview Programmable filter:<br>
</p>
<p><br>
</p>
<div>import math</div>
<div>import numpy</div>
<div><br>
</div>
<div>#</div>
<div># Gdyr_Principal_Strains_ProgFilter</div>
<div># Rev 0</div>
<div># Aug 1, 2014</div>
<div># Dennis Conklin - Engineering Mechanics</div>
<div># </div>
<div># Paraview 4.0.1 Progammable Filter</div>
<div># Adds Cell Variables:</div>
<div># Principal Strains: str_P1, str_P2, str_P3</div>
<div># max shear strain: tau_max</div>
<div># These can be used for coloring, Spreadsheet view, formulas, threshold, etc</div>
<div>#</div>
<div>def process_block(block):</div>
<div> #</div>
<div> # Global coordinate strains</div>
<div> # Assume strains loaded in Paraview</div>
<div> xx = block.CellData['USTRTOTXX']</div>
<div> yy = block.CellData['USTRTOTYY']</div>
<div> zz = block.CellData['USTRTOTZZ']</div>
<div> xy = block.CellData['USTRTOTXY']</div>
<div> xz = block.CellData['USTRTOTZX']</div>
<div> yz = block.CellData['USTRTOTYZ']</div>
<div><br>
</div>
<div> for i in range(block.GetNumberOfCells()</div>
<div> sigma = numpy.array([ [xx[i],xy[i],xz[i]],</div>
<div> [xy[i],yy[i],yz[i]],</div>
<div> [xz[i],yz[i],zz[i]]</div>
<div> ])</div>
<div><br>
</div>
<div> # isotropic strain matrix</div>
<div> iso = 1.0/3.0*numpy.trace(sigma)*numpy.eye(3)</div>
<div> # deviatoric strain matrix</div>
<div> dev = sigma - iso</div>
<div> </div>
<div> #principal strains</div>
<div> eigvals = list(numpy.linalg.eigvalsh(sigma))</div>
<div> eigvals.sort()</div>
<div> eigvals.reverse()</div>
<div> P1[i] = eigvals[0]</div>
<div> P2[i] = eigvals[1]</div>
<div> P3[i] = eigvals[2]</div>
<div> # max shear</div>
<div> max_shear[i] = (max(eigvals)-min(eigvals))/2.0</div>
<div> </div>
<div> block.CellData.append(P1,"P1_strain")</div>
<div> block.CellData.append(P2,"P2_strain")</div>
<div> block.CellData.append(P3,"P3_strain")</div>
<div> block.CellData.append(max_shear,"tauMax") </div>
<div><br>
</div>
<div><br>
</div>
<div># Loop over blocks in composite (Exodus) data set</div>
<div>for block in output:</div>
<div> # process each block</div>
<div> process_block(block) </div>
<div><br>
After running this script, no errors or warnings are issued but the additional quantites (taumax, Px_strain) are not present as element quantities. <br>
</div>
<div><br>
</div>
<div>Any hints as to what I'm doing wrong.<br>
</div>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
Dennis Conklin, PE<br>
RDE&Q Senior Engineer<br>
Goodyear Innovation Center, 5th Floor South, Pillar M34<br>
Phone: 330-796-5701<br>
Email: dennis_conklin@goodyear.com<br>
</div>
</div>
</body>
</html>