Grid Generation: Few Tips on Mesh Generation in 3D Using Matlab

Wednesday, November 01, 2006

Few Tips on Mesh Generation in 3D Using Matlab

3D meshes/girds can be made from different type of mesh elements.

1.) Hexahedral Mesh elements.
2.) Tetrahedral Mesh elements.
3.) Pyramid Shape Mesh elements.
4.) Prism Types of Mesh elements.

Now if you can visualize it is always possible to decompose a basic hexahedral element into 3-Pyramid element, 2-Prism elements, 6-Tetra hedral elements and offcourse Hex is there as always.

So this means that it is always possible to create different kind of meshes using a Basic Hex mesh element. In MATLAB it is very easy to make a hex mesh u can follow these simple steps and u will get a Hex mesh.

x = [0:1/numx:1];
y = [0:1/numy:1];
z = [0:1/numz:1];

%Where numx, numy and numz are the number of basic hex elements u want in x, y and z %Direction.

%then follow the following step

[X Y Z] = meshgrid(x,y,z);

X = X(:);Y=Y(:);Z=Z(:);
%and then to plot the mesh you need following lines of code

node = [X Y Z];


if sloped==1
view(3); axis square

title(['Cartesian Mesh ', num2str(numx,3),'x',num2str(numy,3),'x',num2str(numz,3)])

% Now here one thing which you need to Compute is the Face connectivites which shoud %be fed into the function Patch which basically patches the different faces of the %hex and there by makes a complete Hexa Hedra. Now to get the Face connectivties you %need to use the following piece of code.

function faces = face_connectivity(num_u,num_v,num_w)

numx = num_u;
numy = num_v;
numz = num_w;

nnodex = numx+1;
nnodey = numy+1;
nnodez = numz+1;

face_pattern = [1 2 nnodex+2 nnodex+1]; % This is your face connectivity Pattern

nnx = numx+1 ;
nny = (nnodex)*(nnodey) ;
inc_u = 1;
inc_v = nnx;
inc_w = nny;
node_pattern=[ 1 2 nnx+2 nnx+1 nny+1 nny+2 nny+nnx+2 nny+nnx+1 ]; % Node connectivity
element = zeros(numx*numy*numz,8);
element = make_elem_hexa(node_pattern,numx,numy,numz,inc_u,inc_v,inc_w,nnx);

% ThisFunction gives the element connectivity.

faces = zeros(1,4);
face = zeros(6,4);
face1 = [1 2 3 4];
face2 = [4 3 7 8];
face3 = [5 6 7 8];
face4 = [2 6 7 3];
face5 = [1 5 8 4];
face6 = [1 2 6 5];

[m,n] = size(element);

for i = 1:size(element,1)

face = [element(i,face1);element(i,face2);element(i,face3);element(i,face4);element(i,face5);element(i,face6)];
faces = cat(1,faces,face);

faces(1,:) = [];
faces = faces;


Anonymous said...

Unlimited Earnings Potential -

Our company is rapidly growing and offers you an extraordinary income helping others succeed. The primary requirement is to follow up on client inquiries and point them in the right direction. It is stress free, rewarding and straightforward work.

For complete details:

(Please feel free to delete this post if you don't want it on your blog. Thanks for the informative blog and opportunity to post.)

Free Webmail Program said...

Webmail program for the major free email sites -

My Mail 1.0 is configured to work with AOL, Gmail, Hotmail, Linuxmail, and Yahoo. With My Mail 1.0 you get the benefit of premium services without having to pay site fees. My Mail 1.0 completely automates the process of sending and receiving mail from the major sites, saving you time and trouble.

My Mail 1.0 eliminates the need to visit web sites to send and receive mail, which increases the speed of sending and receiving email by over 80%, even if they do not offer what is known as POP3, IMAP and SMTP. My Mail 1.0's look is also fully customizable. One you use it, you'll never want to go back to the web site again to get your mail.

For complete details:

(Please feel free to delete this post if you don't want it on your blog. Thanks for the informative blog and opportunity to post.)

stev4n said...

3d scanning from Surfdev, a specialist scanning service performed by a reverse engineering company.
Vaccum forming and CAD/CAM, APHWEB provide high specification work, working from drawings and models using modern and traditional methods.