FEATool  v1.8
Finite Element Analysis Toolbox
 All Files Functions Pages
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 quadrilateral 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
nsm         integer {20}              Number of grid smoothing steps
igobj       integer {1}               Geometry object for which to create grid
fid         scalar  {1}               File identifier for output ([]=no output)
Examples
  1) Circle

  fea.geom.objects = { gobj_circle() };
  fea.grid = gridgen_quad( fea, <tt>hmax</tt>, 0.1 );
  plotgrid( fea )

  2) Square with circular hole

  fea.geom.objects = { gobj_rectangle() gobj_circle([0.5 0.5],0.25) };
  fea = geom_apply_formula( fea, <tt>R1 - C1</tt> );
  fea.grid = gridgen_quad( fea, <tt>hmax</tt>, 0.025 );
  plotgrid( fea )

  3) 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, <tt>hmax</tt>, 0.05 );
  plotgrid( fea )

  4) Ellipse

  fea.geom.objects = { gobj_ellipse( [0 0], 2, 1 ) };
  fea.grid = gridgen_quad( fea, <tt>hmax</tt>, 0.1 );
  plotgrid( fea )

  5) 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, <tt>P1 + E1</tt> );
  fea.grid = gridgen_quad( fea, <tt>hmax</tt>, 0.05 );
  plotgrid( fea )

  6) 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, <tt>P1 - C1 - R1</tt> );
  fea.grid = gridgen_quad( fea, <tt>hmax</tt>, 0.05 );
  plotgrid( fea )
See also
quadmesh, gridalign2