[CIG-SHORT] stress at points and h5 output

Matthew Knepley knepley at mcs.anl.gov
Mon Oct 29 08:03:52 PDT 2012


On Mon, Oct 29, 2012 at 10:44 AM, Brad Aagaard <baagaard at usgs.gov> wrote:

> 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]
>

Note that you can use argmin() here:

http://www.scipy.org/Numpy_Example_List#head-c5cb8edfa80e6de8f6eb6b267253d29dff7f8369

  Thanks,

     Matt


> 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
> >
>
> _______________________________________________
> CIG-SHORT mailing list
> CIG-SHORT at geodynamics.org
> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://geodynamics.org/pipermail/cig-short/attachments/20121029/ff5e6aba/attachment.htm 


More information about the CIG-SHORT mailing list