Contents     Functions     Index     Previous Next     PDF

fe_gmsh

Purpose

Information about GMSH can be found at http://www.geuz.org/gmsh/

To call the GMSH mesher from SDT.

Syntax

  model=fe_gmsh(command,model,...);

Description

The main operation is the automatic meshing of surfaces.

Example

This example illustrates the automatic meshing of a plate

 FEnode = [1 0 0 0  0 0 0; 2 0 0 0  1 0 0; 3 0 0 0  0 2 0];
 femesh('objectholeinplate 1 2 3 .5 .5 3 4 4');
 model=femesh('model0');
 model.Elt=feutil('selelt seledge ',model);
 model.Node=feutil('getnode groupall',model);
 model=fe_gmsh('addline',model,'groupall');
 model.Node(:,4)=0; % reset default length
 mo1=fe_gmsh('write temp.msh -lc .3 -run -2 -v 0',model);delete('temp.msh')

This other example makes a circular hole in a plate

% Hole in plate :
model=feutil('Objectquad 1 1',[0 0 0; 1 0 0;1 1 0;0 1 0],1,1); %
model=fe_gmsh('addline',model,[1 2; 2 4; 4 3; 3 1]);
model=fe_gmsh('AddFullCircle',model,[.5 .5 0; .4 .5 0; 0 0 1]);
 
model.Stack{3}.LineLoop={'Line',[1 2 3 4];'Circle',[1 2 3 4]};
model.Stack{3}.PlaneSurface=[1 2];
 
mo2=fe_gmsh('write holeinplate.geo -lc .02 -run -2 -v 0',model)
feplot(mo2)

To allow automated running of GMSH from MATLAB, this function uses a info,GMSH stack entry with the following fields


.Lineone line per row referencing NodeId. Can be defined using addline commands.
.Circledefine properties of circles
.LineLooprows define a closed line as combination of elementary lines. Values are row indices in the .Line field. One can also define LineLoop from circle arcs (or mixed arcs and lines) using a cell array whose each row describes a lineloop as {'LineType',LineInd,...} where LineType can be Circle or Line and LineInd row indices in corresponding .Line or .Circle field.
.PlaneSurfacerows define surfaces as a combination of line loops, values are row indices in the .LineLoop field. Negative values are used to reverse the line orientation.
.SurfaceLooprows define a closed surface as combination of elementary surfaces. Values are row indices in the .PlaneSurface field.

The local mesh size is defined at nodes by GMSH. This is stored in column 4 of the model.Node. The -lc .3 in the command resets the value for all nodes that do not have a prior value.

Add...

mdl=fe_gmsh('AddFullCircle',mdl,data) can be used to add to geometry in mdl the circle defined in data. First row of data is the center coordinates, second row is an edge node coordinates and the third row is the normal. 4 arcs of circle are added. One can then define the full circle as a row in the LineLoop field with {'Circle',[ind1 ind2 ind3 ind4]} where indi are the row indices of the 4 arcs of circle created in .Circle field.

mdl=fe_gmsh('AddDisk',mdl,data) ...
mdl=fe_gmsh('AddLine',mdl,data) can be used to add to geometry in mdl the lines defined in data. data can be a 2 column matrix whose each row defines a couple of points from their NodeId. data can also be a 2 by 3 matrix defining the 2 extremities coordinates. data can also be a string defining a line selection.

config

The fe_gmsh function uses the OpenFEM preference to launch the GMSH mesher.

 setpref('OpenFEM','gmsh','$HOME_GMSH/gmsh.exe')

Read

fe_gmsh('read FileName.msh') reads a mesh from the GMSH output format.

See also

missread

©1991-2008 by SDTools
Previous Up Next