FEATool  v1.6 Finite Element Analysis Toolbox
gridgen_quad.m File Reference

## Description

GRIDGEN_QUAD Generate quadrilateral grid for a geometry object.

[ GRID ] = GRIDGEN_QUAD( SIN, VARARGIN ) Function to generate a grid with quadrialteral cells for geometry objects. SIN is a valid fea problem struct or cell array or geometry objects. Accepts the following property/value pairs.

```Property    Value/{Default}           Description
-----------------------------------------------------------------------------------
hmax        scalar  {0.1}             Target grid size
htol        scalar  {0.2}             Cell size width fraction in grid snapping
ncoff       integer {2}               Number of extra cells to offset in
surrounding rectangular grid construction
nsmooth     integer {20}              Number of grid smoothing steps
igobj       integer {1}               Geometry object for which to create grid
```

Example: (Circle) fea.geom.objects = { gobj_circle() }; fea.grid = gridgen_quad( fea, `hmax`, 0.1 ); plotgrid( fea )

Example: (Square with circular hole) fea.geom.objects = { gobj_rectangle() gobj_circle([0.5 0.5],0.25) }; fea = geom_apply_formula( fea, `R1 - C1` ); fea.grid = gridgen_quad( fea, `hmax`, 0.025 ); plotgrid( fea )

Example: (Star shaped polygon) pv = [ -0.4 -0.5;0.4 -0.2;0.4 -0.7;1.5 -0.4; 0.9 0.1 ; 1.6 0.8;0.5 0.5;0.2 1.0;0.1 0.4;-0.7 0.7 ]; fea.geom.objects = { gobj_polygon( pv ) }; fea.grid = gridgen_quad( fea, `hmax`, 0.05 ); plotgrid( fea )

Example: (Ellipse) fea.geom.objects = { gobj_ellipse( [0 0], 2, 1 ) }; fea.grid = gridgen_quad( fea, `hmax`, 0.1 ); plotgrid( fea )

Example: (Polygon with ellipse) g1 = gobj_polygon( [-0.77 1.1 1 0 -1; -1 -1.2 1 2 1]' ); g2 = gobj_ellipse( [0 0], 2, 0.5 ); fea.geom.objects = { g1 g2 }; fea = geom_apply_formula( fea, `P1 + E1` ); fea.grid = gridgen_quad( fea, `hmax`, 0.05 ); plotgrid( fea )

Example: (Polygon with rounded corner and rectangular hole) g1 = gobj_polygon( [0.2 1 1 0 -0.1 0 0.3; 0 0 1 1 1 0.2 0.3]' ); g2 = gobj_circle( [1 1], 0.4 ); g3 = gobj_rectangle( 0.1, 0.4, 0.6, 0.8 ); fea.geom.objects = { g1 g2 g3 }; fea = geom_apply_formula( fea, `P1 - C1 - R1` ); fea.grid = gridgen_quad( fea, `hmax`, 0.05 ); plotgrid( fea )

See also
QUADMESH, GRIDALIGN2.
Required fields of sin:
Generated fields of grid: