×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to determine certain point belongs to which element

How to determine certain point belongs to which element

How to determine certain point belongs to which element

(OP)
In 2-D case, I got all the node coordinates and I also know the matrix n(i,e),where the value of n(i,e)is global node number, i is local node number, and e is the local node number. Given a point with coordinate (x,y).How to determine which element this point belongs to?
Thanks very much!

RE: How to determine certain point belongs to which element

Do you mean, which element ist nearest to the given xyz coordinates?

RE: How to determine certain point belongs to which element

i'm sorry (wait a minute, no i'm not) ...

WTF ... an element joins two nodes, it's basic.  knowing where the nodes are (their co-ordinates) allows you to know where the elements are ...


???

RE: How to determine certain point belongs to which element

(OP)
I mean given a coodinate (x,y),how to determine the element number e so that (x,y) is inside this element.

And a mistake in my quesion post above. e should denote the element number,not the local node number. thx again.

RE: How to determine certain point belongs to which element

well that does make a little more sense ...
but this sounds much like a school problem (no?)

your matrix has rows that are your nodes, and columns that are your elements; so that a node can appear on multiple elements, but each element (column) should only have two entries).

a dumm way (which i'd probably do myself) would be the plot out the connectivity and then see where your point lies.  a more methodical approach would be to determine the equation of each of the elements (from their two nodes), and then you can calculate which element the point is on (which eaquation is satified by the point).

RE: How to determine certain point belongs to which element

These question is interesting.

Here my suggestion:

nsel,all
local,100,1, x, y, z ! cylidrical coordinate sistem at
                     ! your coordinates
etab, ecent, cent, x ! element table whith element centroids

esort, etab, ecent, 1 ! ascending sort of element table

*get, elemno, sort, 0, imin ! get the element no. whith the
                            ! smallest distance to x, y, z

please, tell me if it works!

Alex

RE: How to determine certain point belongs to which element

You must go before in /prep1, so:

/prep1
nsel,all
local,100,1, x, y, z
etab, ecent, cent, x
esort, etab, ecent, 1
*get, elemno, sort, 0, imin

Alex

RE: How to determine certain point belongs to which element

Sorry, I meant /post1:

/post1
nsel,all
local,100,1, x, y, z
etab, ecent, cent, x
esort, etab, ecent, 1
*get, elemno, sort, 0, imin

Alex

RE: How to determine certain point belongs to which element

mihaiupb - I think you're assuming that the poster is using ANSYS, but I'm not sure this is the case. Hence...

wseedling - which software are you using? We can't give you any information unless you tell us more details.


------------
See FAQ569-1083 for details on how to make best use of Eng-Tips.com

RE: How to determine certain point belongs to which element

(OP)
I am sorry I did not present the question clearly. I Use matlab to generate the codes.I am doing 2 dimensional case and the basic element is triangle.what rb1957 talked about is one dimensional case. using the same idea proposed by rb1957,we can determine which element the point belongs to.(for example, calculate the area of the three triangles formed by the lines connecting the certain point to three nodes in one element. If the area equal to the element triangle's area, it should be in this element ).  But I have so many elements and so many points need to be determined, if using this method, it would be time consuming. So I just want to find a simpler way to solve it.
I try to understand the idea of mihaiupb, since I do not know ansys. Thanks for your kind help.

RE: How to determine certain point belongs to which element

apologies if it's fussing, but you described the co-rodinates of the point as (x,y), not (x,y,z).

i think the same alogrithm still works, each element is defined by three nodes, there are three numbers in each column of your matrix.  this defines a limited plane, which can be tested to see if the point in question is on that plane.

RE: How to determine certain point belongs to which element

"this defines a limited plane, which can be tested to see if the point in question is on that plane."

I think the question was, how to do this.

This would get more complicated in 3D.

RE: How to determine certain point belongs to which element

you can calculate the equation of a plane through three points ...

actually, test the distance of the arbitary point from each of the three nodes defining one of (each of) your elements. if this is greater than the distance between any pair of nodes defining the element, then it can't be on that element, this will create a short list of potential elements.  

another check would be from the equation of the element (from the three corners) determine the normal (perpendicular to the plane), then the equation of the normal that passes thru the point (point, slope equation of a line), then point where this line pierces the plane, then the distance between these two points.  if the distance is zero then the point is on the plane of the element, but it might be outside the element ...

but this is a school problem isn't it ? (i can't imagine anyone doing this in the real world) ... if it is real world, take your model into an FE code or an FE front end (like PATRAN, FEMAP), and it will plot the model for you; the rest is simple

RE: How to determine certain point belongs to which element

My idea was to define a local cylindrical coordinate sistem at the (x,y) location. Then transform all the element centroid coordinates in this local coordinate sistem. That way, the centroid x coordinates are the element distances to the (x,y) point. Then sort these distances ascending. The element whith the first x-coordinate is the nearest element to (x,y). Very simple in ANSYS, a little bit more tricky in Matlab, but feasible...

regards
Alex

RE: How to determine certain point belongs to which element

(OP)
I found a build in function in matlab to solve this problem. Thank you for your kind help. I appreciate it.

RE: How to determine certain point belongs to which element

Could you tell us, please, what the name of the function is?
Thanks!
Alex

RE: How to determine certain point belongs to which element

(OP)
It is tsearch

RE: How to determine certain point belongs to which element

I actually think this might be a bit simpler than you think. (Provided that I understand the question correctly.)

You have two nodes for a line or three for a plane. Use them to determine the equation for the line, or the plane. Any basic linear algebra book should give this if you dont know it.

Next is to check if the point belong to the element. For a 2d case, use one coordinate to compute the second and check if the point is on the line. (Or two to compute a third coordinate.)

I don't mean to be rude but what surprices me is not that you found something useful in mathlab, it's that you need mathlab for this.

Regards

Thomas

RE: How to determine certain point belongs to which element

(OP)
sorry for the ambiguity in my statement.
You can see from my privious post, I know how to solve this using the method you gave, but since too many elements and too many points need to be determined,this is a little time consuming. I want to find a simpler way to do it.

Anyway, thank all for the discussion and help.

RE: How to determine certain point belongs to which element

FYI:  Pick two nodes of the element, and find the equation for the line between them.  Check if the point to be tested is above or below that line, and check the third node of the element for the same thing.  Do this for all three sides of the element.  If the point in question is on the same side of the three lines as the third node in each case, then it is in the element.  I believe if you had a spreadsheet with the node coordinates, you could automate this rather handily.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources