FEATool includes and per default uses the distmesh grid generation routines to automatically generate simplical triangular or tetrahedral grids for implicit geometries. However, the computational finite element library in FEATool also supports FEM shape functions for structured grids (quadrilaterals in 2D and hexahedra in 3D). Although more difficult to generate automatically, structured grids are often computationally superior, allowing for higher accuracy with a smaller number of cells.

In FEATool, structured tensor-product grids of basic geometric shapes can easily be generated on the command line with the following Octave/Matlab m-script functions

Function NameDescription
linegrid1D structured grid for a line
rectgrid2D structured grid for a rectangle/square
circgrid2D structured grid for a circle
ringgrid2D structured grid for a ring or ring segment shape
holegrid2D structured grid for a rectangle with hole
blockgrid3D structured grid for a block/cube
cylgrid3D structured grid for a cylinder
spheregrid3D structured grid for a sphere

Moreover, the grid utility functions delcells, selcells, gridextrude, gridmerge, gridrevolve, gridrotate, and gridscale, can be used to manually modify, transform, and join grids to more complex structures.

The figure below shows three examples of more complex grids created by using these functions.

The first cylinder benchmark grid is for example created with the following commands

``````grid1 = ringgrid( [0.05 0.06 0.08 0.11 0.15], 32, [], [], [0.2;0.2] );
grid2 = holegrid( 8, 1, [0 0.41;0 0.41], 0.15, [0.2;0.2] );
grid2 = gridmerge( grid1, 5:8, grid2, 1:4 );
grid3 = rectgrid( [0.41 0.5 0.7 1 1.4 1.8 2.2], 8, [0.41 2.2;0 0.41] );
grid  = gridmerge( grid3, 4, grid2, 6 );
``````

And the second revolved grid with these commands

``````grid = rectgrid();
grid = gridscale( grid, {'1-(y>0.5).*(y-0.5)' 1} );
grid = delcells( selcells( '((x<=0.8).*(x>=0.2)).*(y<=0.2)', grid ), grid );
grid = gridrevolve( grid, 20, 0, 1/4, 2, pi/2, 0 );
``````

After, the grids have been created on the command line they can also be imported into the FEATool GUI (by using the File > Import > Variables From Main Workspace option, after which the command `fea.grid = grid` needs to be entered at the FEATool command prompt).

Finally, the grid conversion functions tri2quad and tet2hex can also be used to convert simplical grids to structured ones.

Tags:

Categories:

Published: