Thread Subject: 2d unstructured mesh generation

Subject: 2d unstructured mesh generation

From: dulip

Date: 25 Nov, 2009 15:46:07

Message: 1 of 3

Here is my problem. I want to mesh 1x1 square domain using some
unstructured mesh technique. I'm trying to do it using triangular
elements. The problem is I haven't played much with matlab and hence
facing difficulties doing this. I tried to play with 'delaunay'
command and ended up with some triangles over the region. However for
my problem still I need to vertex locations of each triangle which I
don't know yet(to find the location of triangle to apply BCs). Also
I'm not clear with the out put of this command whether there is any
order for triangles or not. I appreciate if you could help me to get
this done. I don't mind if you have any other better mesh generator
which gives the same(able to run in matlab).
Thanks!
Dulip

Subject: 2d unstructured mesh generation

From: Florian

Date: 25 Nov, 2009 17:06:18

Message: 2 of 3

Hi Dulip,

"However for my problem still I need to vertex locations of each triangle which I don't know yet"
The data you use for the delaunay triangulation ARE the vertex points for your triangles

dalaunay() returns the "indices" of your vectors for each triangle (google for vector indexing Matlab).

% Some x y coordinates on an intiger grid
x = [6 4 8 5 4 9 3 10 2 1];
y = [2 3 5 4 8 6 7 9 10 14];
% Plot them
figure(1)
clf %clear figure
plot(x,y,'.r','MarkerSize',15)
% Hold the figure
hold on
% Do the triangulation
tri = delaunay(x,y);
% Plot the triangulation
triplot(tri,x,y)

the first line of tri is [9 8 10] this means that your first triangle is made up of the vertices xy pair in the 9th column [2 10], the 8th column [10 9] and the 10th column [1 14]

use this code to print all of them out:
for i = 1:size(tri,1)
    Triangle = [x(tri(i,:)); y(tri(i,:))]
end

Hope this helps,
Florian


dulip <dulipsa@gmail.com> wrote in message <8a9c4648-ae0e-4844-a36a-e112eaab3220@f16g2000yqm.googlegroups.com>...
> Here is my problem. I want to mesh 1x1 square domain using some
> unstructured mesh technique. I'm trying to do it using triangular
> elements. The problem is I haven't played much with matlab and hence
> facing difficulties doing this. I tried to play with 'delaunay'
> command and ended up with some triangles over the region. However for
> my problem still I need to vertex locations of each triangle which I
> don't know yet(to find the location of triangle to apply BCs). Also
> I'm not clear with the out put of this command whether there is any
> order for triangles or not. I appreciate if you could help me to get
> this done. I don't mind if you have any other better mesh generator
> which gives the same(able to run in matlab).
> Thanks!
> Dulip

Subject: 2d unstructured mesh generation

From: dulip

Date: 25 Nov, 2009 17:28:44

Message: 3 of 3

On Nov 25, 12:06 pm, "Florian" <flowwiththe...@hotmail.com> wrote:
> Hi Dulip,
>
> "However for my problem still I need to vertex locations of each triangle which I don't know yet"
> The data you use for the delaunay triangulation ARE the vertex points for your triangles
>
> dalaunay() returns the "indices" of your vectors for each triangle (google for vector indexing Matlab).
>
> % Some x y coordinates on an intiger grid
> x = [6 4 8 5 4 9 3 10 2 1];
> y = [2 3 5 4 8 6 7 9 10 14];
> % Plot them
> figure(1)
> clf %clear figure
> plot(x,y,'.r','MarkerSize',15)
> % Hold the figure
> hold on
> % Do the triangulation
> tri = delaunay(x,y);
> % Plot the triangulation
> triplot(tri,x,y)
>
> the first line of tri is [9 8 10] this means that your first triangle is made up of the vertices xy pair in the 9th column [2 10], the 8th column [10 9] and the 10th column [1 14]
>
> use this code to print all of them out:
> for i = 1:size(tri,1)
>     Triangle = [x(tri(i,:)); y(tri(i,:))]
> end
>
> Hope this helps,
> Florian
>
> dulip <duli...@gmail.com> wrote in message <8a9c4648-ae0e-4844-a36a-e112eaab3...@f16g2000yqm.googlegroups.com>...
> > Here is my problem. I want to mesh 1x1 square domain using some
> > unstructured mesh technique. I'm trying to do it using triangular
> > elements. The problem is I haven't played much with matlab and hence
> > facing difficulties doing this. I tried to play with 'delaunay'
> > command and ended up with some triangles over the region. However for
> > my problem still I need to vertex locations of each triangle which I
> > don't know yet(to find the location of triangle to apply BCs).  Also
> > I'm not clear with the out put of this command whether there is any
> > order for triangles or not. I appreciate if you could help me to get
> > this done. I don't mind if you have any other better mesh generator
> > which gives the same(able to run in matlab).
> > Thanks!
> > Dulip

Thank you very much florian!

This is really helpful

Dulip

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com