[CIG-SHORT] stress at points and h5 output

Brad Aagaard baagaard at usgs.gov
Mon Oct 29 07:44:28 PDT 2012


Scott,

At this point, OutputSolnPoints only works with the solution: 
displacement or velocity field.

Here is a simple procedure to extract values from the closest cell to a 
target location. This is a vectorized calculation so it is relatively fast.

1. compute the centroids of all of the cells
   For 4 vertices per cell:
     centroids = 1.0/4.0*(vertices[cells[:,0]] +
                 vertices[cells[:,1]] +
                 vertices[cells[:,2]] +
                 vertices[cells[:,3]])
2. calculate the distance of the centroids from the target point
   dist = ((centroids[:,0]-targetX)**2 +
           (centroids[:,1]-targetY)**2 +
           (centroids[:,2]-targetZ)**2)**0.5
3. get the index of the cell with the minimum distance
   mindist = numpy.min(dist)
   index = numpy.where(dist <= mindist + 0.001)[0][0]
4. extract the values using the index
   stressTarget = stress[index,:]

Brad

On 10/28/12 4:01 PM, Scott Henderson wrote:
> Hello,
>
> I'm using Pylith for a simple 2D fracture mechanics problem. I'm
> wondering if it's possible to output average stress solutions at
> specified points with the OutputSolnPoints utility? If not, is there an
> easy way to extract stress from the element that contains a particular
> (x,y) coordinate (with h5py)? Or maybe it is possible to have Pylith
> output the coordinates of quadrature points?
>
> Any tips would be appreciated,
>
> Thanks,
> Scott
>
>
>
> _______________________________________________
> CIG-SHORT mailing list
> CIG-SHORT at geodynamics.org
> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
>



More information about the CIG-SHORT mailing list