Contents     Functions     Index     Previous Next     PDF

femesh, feutil

Purpose

Finite element mesh handling utilities.

Syntax

femesh CommandString
femesh('CommandString')
[out,out1] = femesh('CommandString',in1,in2)

Description

femesh and feutil provide a number of tools for mesh creation and manipulation. feutil requires all arguments to be provided while femesh uses global variables to define the proper object of which to apply a command. femesh uses the following standard global variables which are declared as global in your workspace when you call femesh


FEnodemain set of nodes
FEn0selected set of nodes
FEn1alternate set of nodes
FEeltmain finite element model description matrix
FEel0selected finite element model description matrix
FEel1alternate finite element model description matrix

By default, femesh automatically uses base workspace definitions of the standard global variables (even if they are not declared as global). When using the standard global variables within functions, you should always declare them as global at the beginning of your function. If you don't declare them as global modifications that you perform will not be taken into account, unless you call femesh from your function which will declare the variables as global there too. The only thing that you should avoid is to use clear (instead of clear global) within a function and then reinitialize the variable to something non-zero. In such cases the global variable is used and a warning is passed.

Available femesh commands are

;

Command chaining. Commands with no input (other than the command) or output argument, can be chained using a call of the form femesh(';Com1;Com2'). commode is then used for command parsing.

Add FEeli FEelj, AddSel

Combine two FE model description matrices. The characters i and j can specify any of the main t, selected 0 and alternate 1 finite element model description matrices. The elements in the model matrix FEelj are appended to those of FEeli.

AddSel is equivalent to AddFEeltFEel0 which adds the selection FEel0 to the main model FEelt.

This is an example of the creation of FEelt using 2 selections (FEel0 and FEel1)

femesh('reset');
femesh('testquad4');                    % one quad4 created
femesh('divide',[0 .1 .2 1],[0 .3 1]);  % divisions
FEel0=FEel0(1:end-1,:);                 % suppress 1 element in FEel0
femesh('addsel');                       % add FEel0 into FEelt
FEel1=[Inf abs('tria3');9 10 12  1 1 0];% create FEel1 
femesh('add FEelt FEel1');              % add FEel1 into FEelt
femesh plotelt                          % plot FEelt

AddNode [,New] [, From i] [,epsl val]

Combine, append (without/with new) FEn0 to FEnode. Additional uses of AddNode are provided using the format

[AllNode,ind]=femesh('AddNode',OldNode,NewNode);

which combines NewNode to OldNode. AddNode finds nodes in NewNode that coincide with nodes in OldNode and appends other nodes to form AllNode. ind gives the indices of the NewNode nodes in the AllNode matrix.

This function is also accessible using feutil. For example

[AllNode,ind]=feutil('AddNode',OldNode,NewNode);

NewNode can be specified as a matrix with three columns giving xyz coordinates. The minimal distance below which two nodes are considered identical is given by sdtdef epsl (default 1e-6).

[AllNode,ind]=feutil('AddNode From 10000',OldNode,NewNode); gives node numbers starting at 10000 for nodes in NewNode that are not in OldNode.

SDT uses an optimized algorithm available in feutilb.

By default, nodes that repeated in NewNode are coalesced onto the same node (a single new node is added). If there is not need for that coalescence, you can get faster results with AddNode-nocoal.

ind=feutilb('AddNode -near epsl value',n1,n2); returns a sparse matrix with non zero values in a given colum indicating of n1 nodes that are within epsl of each n2 node (rows/columns correspond to n1/n2 node numbers).

ind=feutilb('AddNode -nearest epsl value',n1,n2); returns vector giving the nearest n1 node index to each n2 node the search area being limited to epsl.

AddSet [NodeId, EltId, FaceId]

model=feutil('AddSetNodeId',model,'name','FindNodeString') adds the selection SelNodeString as a set of nodes name to model. Syntax is the same for AddSetEltId with a FindEltString selection.
The string -id value can be added to the command to specify a set ID.

Following example defines a set of each type on the ubeam model:

model=demosdt('demo ubeam'); 
cf=feplot
model=feutil('AddSetNodeId',model,'nodeset','z==1');
model=feutil('AddSetEltId -id18',model,'eltset','WithNode{z==0}');
[elt,ind]=feutil('findelt setname  eltset',model); % findelt based on set name
r1=cf.Stack{'eltset'};r1.type='FaceId';r1.data(:,2)=1;
cf.Stack{'set','faceset'}=r1;
r1=cf.Stack{'nodeset'};r1.type='DOF';r1.data=r1.data+0.02;
cf.Stack{'set','dofset'}=r1;
fecom(cf,'curtab Stack','eltset');

AddTest [,-EGID i][,NodeShift,Merge,Combine]

Combine test and analysis models. When combining test and analysis models you typically want to overlay a detailed finite element mesh with a coarse wire-frame representation of the test configuration. These models coming from different origins you will want combine the two models in FEelt.

By default the node sets are considered to be disjoint. New nodes are added starting from max(FEnode(:,1))+1 or from NodeShift+1 if the argument is specified. Thus femesh('addtest NodeShift',TNode,TElt) adds test nodes TNode to FEnode while adding NodeShift to their initial identification number. The same NodeShift is added to node numbers in TElt which is appended to FEelt. TElt can be a wire frame matrix read with ufread.

With merge it is assumed that some nodes are common but their numbering is not coherent. femesh('addtest merge',NewNode,NewElt) can also be used to merge to FEM models. Non coincident nodes (as defined by the AddNode command) are added to FEnode and NewElt is renumbered according to the new FEnode.

With combine it is assumed that some nodes are common and their numbering is coherent. Nodes with new NodeId values are added to FEnode while common NodeId values are assumed to be located at the same positions.

You can specify an EGID value for the elements that are added using AddTest -EGID -1. In particular negative EGID values are display groups so that they will be ignored in model assembly operations.

The combined models can then be used to create the test/analysis correlation using fe_sens. An application is given in the gartte demo, where a procedure to match initially different test and FE coordinate frames is outlined.

model=feutil('addtest',model1,model2) is a higher level command that attempts to merge two models and retain as much information as possible (nodes, elements, materials, etc.)

Divide div1 div2 div3

Mesh refinement by division of elements. Divide applies to all groups in FEel0 (or to the full model with the feutil call). To apply the division to a selection within the model use feutil ObjectDivide. Currently supported divisions are

If your elements have a different name but the same topological structure declare the proper parent name or use the SetGroupName command before and after divide. The division preserves properties other than the node numbers.

You can obtain unequal divisions by declaring additional arguments whose lines give the relative positions of dividers. For example, an unequal 2 by 3 division of a quad4 element would be obtained using femesh('divide',[0 .1 1],[0 .5 .75 1]) (see also the gartfe demo).

% Example 1 : beam1
femesh('reset');
femesh(';testbeam1;divide 3;plotel0'); % divide by 3
fecom textnode

% Example 2 : you may create a command string
number=3;
st=sprintf(';testbeam1;divide %f;plotel0',number);
femesh('reset');
femesh(st);
fecom textnode

% Example 3 : you may use uneven division
femesh('reset');
model=femesh('testquad4'); % one quad4 created
model=feutil('divideelt',model,[0 .1 .2 1],[0 .3 1]); 
feplot(model);

An inconsistency in division for quad elements was fixed with version 1.105, you can obtain the consistent behaviour (first division along element x by adding -new anywhere in the divide command.

DivideInGroups

Finds groups of FEel0 elements that are not connected (no common node) and places each of these groups in a single element group.

DivideGroup i ElementSelectors

Divides a single group i of FEelt in two element groups. The first new element group is defined based on the element selectors (see section 7.12).

This function is also accessible using feutil. For example

elt=feutil('divide group 1 withnode{x>10}',model)

EltId

[EltId]=feutil('eltid',elt) returns the element identifier for each element in elt. It currently does not fill EltId for elements which do not support it.
[EltId,elt]=feutil('eltidfix',elt) returns an elt where the element identifiers have been made unique.
Command modifier -elt can be used to set new EltId.

model=femesh('testhexa8')
[EltId,model.Elt]=feutil('EltIdFix',model.Elt); % Fix and get EltId
[model.Elt,EltIdPos]=feutil('eltid-elt',model,EltId*18); % Set new EltId
model.Elt(EltIdPos>0,EltIdPos(EltIdPos>0)) % New EltId

Extrude nRep tx ty tz

Extrusion. Nodes, lines or surfaces that are currently selected (put in FEel0) are extruded nRep times with global translations tx ty tz. Elements with a mass1 parent are extruded into beams, element with a beam1 parent are extruded into quad4 elements, quad4 are extruded into hexa8, and quadb are extruded into hexa20.

You can create irregular extrusions. For example, femesh('extrude 0 0 0 1',[0 logspace(-1,1,5)]) will create an exponentially spaced mesh in the z direction. The second femesh argument gives the positions of the sections for an axis such that tx ty tz is the unit vector.

% Example 1 : beam
femesh('reset');
femesh('testbeam1'); % one beam1 created
femesh(';extrude 2 1 0 0;plotel0'); % 2 extrusions in x direction

% Example 2 : you may create the command string
number=2;step=[1 0 0];
st=sprintf(';testbeam1;extrude %f %f %f %f',[number step]);
femesh('reset');
femesh(st);  femesh plotel0

% Example 3 : you may uneven extrusions in z direction
femesh('reset');
femesh('testquad4')
femesh('extrude 0 0 0 1', [0 .1 .2 .5 1]); % 
% 0 0 0 1        :  1 extrusion in z direction
% [0 .1 .2 .5 1] :  where extrusions are made
femesh plotel0

GetDof, FindDof ElementSelectors

The nominal call to get DOFs used by a model is mdof=feutil('GetDOF',model). These calls are performed during assembly phases (fe_mk, fe_load, ...). This supports elements with variable DOF numbers defined through the element rows or the element property rows. To find DOFs of a part of the model, you should build a sub-model as follows

 model=femesh;
 model.Elt=feutil('selelt Group1:3',model);
 mdof=feutil('GetDof',model);

Note that node numbers set to zero are ignored by feutil to allow elements with variable number of nodes.

FindElt ElementSelectors

Find elements based on a number of selectors described in section 7.12. The calling format is

[ind,elt] = femesh('findelt withnode 1:10')

where ind gives the row numbers of the elements (but not the header rows except for unique superelements which are only associated to a header row) and elt the associated element description matrix. FindEl0 applies to elements in FEel0. This command can be accessed directly with feutil. The example above is equivalent to

[ind,elt]=feutil('findelt eltid 1:10 ',model)

When operators are accepted, equality and inequality operators can be used. Thus group~=[3 7] or pro < 5 are acceptable commands. See also SelElt, RemoveElt and DivideGroup, the gartfe demo, fecom selections.

FindNode Selectors

Find node numbers based on a number of selectors listed in section 7.11.

Different selectors can be chained using the logical operations & (finds nodes that verify both conditions), | (finds nodes that verify one or both conditions). Condition combinations are always evaluated from left to right (parentheses are not accepted).

Output arguments are the numbers NodeID of the selected nodes and the selected nodes node as a second optional output argument. This command is equivalent to the feutil call

[NodeID,node]=feutil(['findnode ...'],FEnode, FEelt,FEel0).

As a example you can show node numbers on the right half of the z==0 plane using the commands

fecom('TextNode',femesh('findnode z==0 & x>0'))

Following example puts markers on selected nodes

demosdt('demo ubeam'); cf=feplot; % load U-Beam model
fecom('ShowNodeMark',feutil('FindNode z>1.25',cf.mdl),'color','r')
fecom('ShowNodeMark',feutil('FindNode x>0.2*z|x<-0.2*z',cf.mdl),...
    'color','g','marker','o')

Note that you can give numeric arguments to the command as additional femesh arguments. Thus the command above could also have been written

fecom('TextNode',femesh('findnode z== & x>=',0,0)))

See also the gartfe demo.

GetEdge[Line,Patch]

These feutil commands are used to create a mode containing the 1D edges or 2D faces of a model. A typical call is

 femesh('reset');model=femesh('testubeam');
 elt=feutil('getedgeline',model);feutil('infoelt',elt)

GetEdgeLine supports the following variants MatId retains inter material edges, ProId retains inter property edges, Group retains inter group edges, all does not eliminate internal edges, InNode only retains edges whose node numbers are in a list given as an additional feutil argument.

These commands are used for SelEdge and SelFace element selection commands. Selface preserves the EltId and adds the FaceId after it to allow face set recovery.

GetElemF

Header row parsing. In an element description matrix, element groups are separated by header rows (see section 7.2) which for the current group jGroup is given by elt(EGroup(jGroup),:). The GetElemF command, whose proper calling format is

[ElemF,opt,ElemP] = feutil('getelemf',elt(EGroup(jGroup),:),[jGroup])

returns the element/superelement name ElemF, element options opt and the parent element name ElemP. It is expected that opt(1) is the EGID (element group identifier) when defined.

GetLine

Line=feutil('get Line',node,elt) returns a matrix of lines where each row has the form [length(ind)+1 ind] plus trailing zeros, and ind gives node indices (if the argument node is not empty) or node numbers (if node is empty). elt can be an element description matrix or a connectivity line matrix (see feplot). Each row of the Line matrix corresponds to an element group or a line of a connectivity line matrix. For element description matrices, redundant lines are eliminated.

GetNode Selectors

node=femesh('get node Selectors') returns a matrix containing nodes rather than node indices obtained with the feutil FindNode command. This command is equivalent to the feutil call

node=feutil(['findnode ...'],FEnode, FEelt,FEel0).

GetNormal[Elt,Node][,Map],GetCG

[normal,cg]=feutil('getNormal[elt,node]',node,elt) returns normals to elements/nodes in model node, elt. CG=feutil('GetCg',model) returns the CG locations. MAP=feutil('getNormal Map',model) returns a data structure with the following fields

IDidentifier. One integer per vector in the field map. Typically node numbers or EltId.
vertexN× 3 matrix giving vertex positions if the map is not associated with nodes
normalN× 3 where each row specifies a vector at ID or vertex
opt1 for MAP at element center, 2 for map at nodes.

The MAP data structure may be viewed using

fecom('ShowMap',MAP);fecom('scaleone');

GetPatch

Patch=feutil('get Patch',node,elt) returns a patch matrix where each row (except the first which serves as a header) has the form [n1 n2 n3 n4 EltN GroupN]. The ni give node indices (if the argument node is not empty) or node numbers (if node is empty). elt must be an element description matrix. Internal patches (it is assumed that a patch declared more than once is internal) are eliminated.

Info [ ,FEeli, Nodei]

Information on global variables. Info by itself gives information on all variables. The additional arguments FEelt ... can be used to specify any of the main t, selected 0 and alternate 1 finite element model description matrices. InfoNodei gives information about all elements that are connected to node i. To get information in FEelt and in FEnode, you may write

femesh('InfoElt') or femesh('InfoNode')

The equivalent feutil calls would be

feutil('InfoElt',model) or feutil('InfoNode',model)

Join [,el0] [group i, EName]

Join the groups i or all the groups of type EName. By default this operation is applied to FEelt but you can apply it to FEel0 by adding the el0 modifier to the command. Note that with the selection by group number, you can only join groups of the same type (with the same element name).

You may join groups using there ID

femesh('reset');
femesh(';test2bay;plotelt');
femesh('infoelt');   % 2 groups at this step
femesh joingroup1:2  % 1 group now

or using elements type

femesh('reset');
femesh('test2bay;plotelt');
femesh joinbeam1     % 1 group now

This command can be accessed directly with feutil. For example

elt=feutil('joingroup1:2',model.Elt)

model [,0]

model=femesh('model') returns the FEM structure (see section 7.6) with fields model.Node=FEnode and model.Elt=FEelt as well as other fields that may be stored in the FE variable that is persistent in femesh. model=femesh('model0') uses model.Elt=FEel0.

Matid,ProId,MPID

[MatId]=feutil('matid',elt) returns the element material identifier for each element in elt. The ProId command works similarly. MPId returns a matrix with three columns MatId, ProId and group numbers.
elt=feutil('mpid',elt,mpid) can be used to set properties.

ObjectBeamLine i, ObjectMass i

Create a group of beam1 elements. The node numbers i define a series of nodes that form a continuous beam (for discontinuities use 0), that is placed in FEel0 as a single group of beam1 elements.

For example femesh('ObjectBeamLine 1:3 0 4 5') creates a group of three beam1 elements between nodes 1 2, 2 3, and 4 5.

An alternate call is femesh('ObjectBeamLine',ind) where ind is a vector containing the node numbers. You can also specify a element name other than beam1 and properties to be placed in columns 3 and more using femesh('ObjectBeamLine -EltName',ind,prop).

femesh('ObjectMass 1:3') creates a group of concentrated mass1 elements at the declared nodes.

FEnode = [1 0 0 0  0  0 0;   2 0 0 0  0  0 .15; ... 
          3 0 0 0 .4  1 .176;4 0 0 0 .4 .9 .176];
femesh(';objectbeamline 1 2 0 2 3 0 3 4');
% or femesh('objectbeamline',1:4);
femesh('object mass',3,[1.1 1.1 1.1])
femesh plotel0;fecom textnode

ObjectHoleInPlate

Create a quad4 mesh of a hole in a plate. The format is 'ObjectHoleInPlate N0 N1 N2 r1 r2 ND1 ND2 NQ' giving the center node, two nodes to define the edge direction and distance, two radiuses in the direction of the two edge nodes (for elliptical holes), the number of divisions along a half quadrant of edge 1 and edge 2, the number of quadrants to fill (the figure shows 2.5 quadrants filled).
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');
femesh('divide 3 4'); % 3 divisions around, 4 divisions along radii
femesh plotel0
% You could also use the call
FEnode = [1 0 0 0  0 0 0;  2 0 0 0  1 0 0; 3 0 0 0  0 2 0];
%   n1 n2 n3 r1 r2 nd1 nd2 nq
r1=[ 1  2  3 .5 .5  3   4   4];
st=sprintf(';objectholeinplate %f %f %f %f %f %f %f %f',r1);
femesh(st);femesh('plotel0')

Object[Quad,Beam,Hexa] MatId ProId

Create or add a model containing quad4 elements. The user must define a rectangular domain delimited by four nodes and the division in each direction. The result is a regular mesh.

For example feutil('ObjectQuad 10 11',nodes,4,2) returns model with 4 and 2 divisions in each direction with a MatId 10 and a ProId 11.

An alternate call is model=feutil('ObjectQuad 1 1',model,nodes,4,2) : the quadrangular mesh is added to the model.

node = [0  0  0; 2  0  0; 2  3  0; 0  3  0];
model=feutil('Objectquad 1 1',node,4,3); % creates model 

node = [3  0  0; 5  0  0; 5  2  0; 3  2  0];
model=feutil('Objectquad 2 3',model,node,3,2); % matid=2, proid=3
feplot(model);

Divisions may be specified using a vector between [0,1] :

node = [0  0  0; 2  0  0; 2  3  0; 0  3  0];
model=feutil('Objectquad 1 1',node,[0 .2 .6 1],linspace(0,1,10)); 
feplot(model);

Other supported object topologies are beams and hexaedrons. For example

node = [0  0  0; 2  0  0;1  3  0; 1  3  1];
model=feutil('Objectbeam 3 10',node(1:2,:),4); % creates model 
model=feutil('Objecthexa 4 11',model,node,3,2,5); % creates model 
feutil('infoelt',model)

Object[Arc, Annulus, Circle,Cylinder,Disk]

These object constructors follow the format

model=feutil('ObjectAnnulus x y z r1 r2 nx ny nz Nseg NsegR',model)

model=feutil('ObjectArc xc yc zc x1 y1 z1 x2 y2 z2 Nseg obt',model)

model=feutil('ObjectCircle x y z r nx ny nz Nseg',model)

model=feutil('ObjectCylinder x1 y1 z1 x2 y2 z2 r divT divZ',model)

model=feutil('ObjectDisk x y z r nx ny nz Nseg NsegR',model)

model=feutil('object arc 0 0 0 1 0 0 0 1 0 30 1');
model=feutil('object arc 0 0 0 1 0 0 0 1 0 30 1',model);
model=feutil('object circle 1 1 1 2 0 0 1 30',model);
model=feutil('object circle 1 1 3 2 0 0 1 30',model);
model=feutil('object cylinder 0 0 0  0 0 4 2 10 20',model);
model=feutil('object disk 0 0 0 3 0 0 1 10 3',model);
model=feutil('object annulus 0 0 0 2 3 0 0 1 10 3',model);
feplot(model)

ObjectDivide

Applies a divide command to a selection within the model

node = [0  0  0; 2  0  0; 2  3  0; 0  3  0];
model=feutil('Objectquad 1 1',node,4,3); % creates model 
model=feutil('objectDivide 3 2',model,'withnode 1');
feplot(model);

Optim [Model, NodeNum, EltCheck]

OptimModel removes nodes unused in FEelt from FEnode.

OptimNodeNum does a permutation of nodes in FEnode such that the expected matrix bandwidth is smaller. This is only useful to export models, since here DOF renumbering is performed by fe_mk.

OptimEltCheck attempts to fix geometry pathologies (warped elements) in quad4, hexa8 and penta6 elements.

Orient, Orient i [ , n nx ny nz]

Orient elements. For volumes and 2-D elements which have a defined orientation. femesh('orient') or the equivalent elt=feutil('orient',FEnode,FEelt) call element functions with standard material properties to determine negative volume orientation and permute nodes if needed. This is in particular needed when generating models via extrude or divide operations which do not necessarily result in appropriate orientation (see integrules). When elements are too distorted, you may have a locally negative volume. A warning about warped volumes is then passed. You should then correct your mesh. Note that for 2D meshes you need to use 2D topology holders q4p, t3p, ....

Orient normal of shell elements. For plate/shell elements (elements with parents of type quad4, quadb or tria3) in groups i of FEelt, this command computes the local normal and checks whether it is directed towards the node located at nx ny nz. If not, the element nodes are permuted to that a proper orientation is achieved. A -neg can be added at the end of the command to force orientation away rather than towards the nearest node.

femesh('orient i',node) can also be used to specify a list of orientation nodes. For each element, the closest node in node is then used for the orientation. node can be a standard 7 column node matrix or just have 3 columns with global positions.

For example

% Init example
femesh('reset');
femesh(';testquad4;divide 2 3;')
FEelt=FEel0;femesh('dividegroup1 withnode1'); 
model=femesh;
% Orient elements in group 2 away from [0 0 -1]
model.Elt=feutil('orient 2 n 0 0 -1 -neg',model);
MAP=feutil('getnormal MAP',model);MAP.normal

Plot [Elt, El0]

Plot selected model. PlotElt calls feplot to initialize a plot of the model contained in FEelt. PlotEl0 does the same for FEel0. This command is really just the declaration of a new model using feplot('initmodel',femesh('model')).

Once the plot initialized you can modify it using feplot and fecom.

Lin2quad, Quad2Tria, quad42quadb, etc.

Basic element type transformations. Quad2Tria searches FEel0 for quad4 element groups and replaces them with equivalent tria3 element groups. The result is stored in FEel0. The inverse operation can be performed using feutilbfirstorder.

[model.Node,model.Elt]=feutil('lin2quad epsl .01',model); is the generic command to generate second order meshes. Lin2QuadCyl places the mid-nodes on cylindrical arcs. Lin2QuadKnowNew can be used to get much faster results if it is known that none of the new mid-edge nodes is coincident with an existing node.

Obsolete calls are Quad42Quadb places nodes at the mid-sides of quad4 elements to form 8 node quadb elements. Penta62Penta15 (resp. Tetra42Tetra10) transforms penta6(resp. ) elements to penta15(resp. tetra10) elements. Hexa82Hexa20 places nodes at the mid-sides of hexa8 elements to form hexa20 elements.

Hexa2Tetra replaces each hexa8 elements by four tetra4 elements (this is really not a smart thing to do). Hexa2Penta replaces each hexa8 elements by six tetra4 elements (warning : this transformation may lead to incompatibilities on the triangular faces).

% create 4 quad4 
femesh(';testquad4;divide 2 3'); 
femesh(';quad2tria'); % conversion
femesh plotel0
% create a quad, transform to triangles, divide each triangle in 4
femesh(';testquad4;quad2tria;divide2;plotel0;info'); 
% example with feutil call  - - - - - - -  - - -
model=femesh('testhexa8');
[model.Node,model.Elt]=feutil('lin2quad epsl .01',model);
feutil('infoelt',model)

RefineBeam l

Mesh refinement. This function searches FEel0 for beam elements and divides elements so that no element is longer than l.

Remove[Elt,El0] ElementSelectors

Element removal. This function searches FEelt or FEel0 for elements which verify certain properties selected by ElementSelectors and removes these elements from the model description matrix. The functionality is actually handled by feutil. A sample call would be

% create 4 quad4 
femesh('reset');
femesh(';testquad4;divide 2 3'); 
[FEel0,RemovedElt] = feutil('removeelt withnode 1',FEnode,FEel0);
% same as femesh('removeel0 withnode 1')
femesh plotel0

Renumber

model=feutil('renumber',model,NewNodeNumbers) can be used to change the node numbers in the model. Currently nodes, elements, DOFs and deformations are renumbered. If NewNodeNumbers is not provided values 1:size(model.Node,1) are used. This command can be used to meet the OpenFEM requirement that node numbers be less than 2^31/100. Another application is to joint disjoint models with coincident nodes using

[r1,i2]=feutil('addnode',model.Node,model.Node);
model=feutil('renumber',model,r1(i2,1));

RepeatSel nITE tx ty tz

Element group translation/duplication. RepeatSel repeats the selected elements (FEel0) nITE times with global axis translations tx ty tz between each repetition of the group. If needed, new nodes are added to FEnode. An example is treated in the d_truss demo.

femesh('reset');
femesh(';testquad4;divide 2 3'); 
femesh(';repeatsel 3 2 0 0'); % 3 repetitions, translation x=2
femesh plotel0
% an alternate call would be
femesh(';testquad4;divide 2 3'); 
%                                      number, direction
femesh(sprintf(';repeatsel %f %f %f %f', 3,    [2 0 0]))
femesh plotel0

Rev nDiv OrigID Ang nx ny nz

Revolution. The selected elements FEel0 are taken to be the first meridian. Other meridians are created by rotating the selected group around an axis passing trough the node of number OrigID (or the origin of the global coordinate system) and of direction [nx ny nz] (the default is the z axis [0 0 1]). nDiv+1 (for closed circle cases ang=360, the first and last are the same) meridians are distributed on a sector of angular width Ang (in degrees). Meridians are linked by elements in a fashion similar to extrusion. Elements with a mass1 parent are extruded into beams, element with a beam1 parent are extruded into quad4 elements, quad4 are extruded into hexa8, and quadb are extruded into hexa20.

The origin can also be specified by the xyz values preceded by an o using a command like femesh('rev 10 o 1.0 0.0 0.0 360 1 0 0').

You can obtain an uneven distribution of angles using a second argument. For example femesh ('rev 0 101 40 0 0 1',[0 .25 .5 1]) will rotate around an axis passing by node 101 in direction z and place meridians at angles 0 10 20 and 40 degrees. Note that SDT 4.0 did not behave correctly for such calls.

FEnode = [1 0 0 0  .2 0   0;  2 0 0 0  .5 1 0; ...  
          3 0 0 0  .5 1.5 0;4 0 0 0  .3 2 0];
femesh('objectbeamline',1:4);
femesh('divide 3')
femesh(';rev 40 o 0 0 0 360 0 1 0');
femesh plotel0
fecom(';triax;view 3;showpatch')
% An alternate calling format would be
femesh(';objectbeamline 1:4;divide3');
%    divi origin angle direct
r1 = [40  0 0 0  360   0 1 0];
femesh(sprintf(';rev %f o %f %f %f %f %f %f %f',r1))
femesh plotel0
fecom(';triax;view 3;showpatch')

RotateSel OrigID Ang nx ny nz

Rotation. The selected elements FEel0 are rotated by the angle Ang (degrees) around an axis passing trough the node of number OrigID (or the origin of the global coordinate system) and of direction [nx ny nz] (the default is the z axis [0 0 1]). The origin can also be specified by the xyz values preceded by an o

femesh('rotatesel o 2.0 2.0 2.0 90 1 0 0')

This is an example of the rotation of FEel0

femesh('reset');
femesh(';testquad4;divide 2 3'); 
% center is node 1, angle 30, aound axis z
%                                       Center angle dir
st=sprintf(';rotatesel %f %f %f %f %f',[1      30   0 0 1]);
femesh(st);  femesh plotel0
fecom(';triax;textnode'); axis on

Sel [Elt,El0] ElementSelectors

Element selection. SelElt places in the selected model FEel0 elements of FEelt that verify certain conditions. You can also select elements within FEel0 with the SelEl0 command. Available element selection commands are described under the FindElt command and section 7.12.

With arguments use elt=feutil('selelt ElementSelectors',model).

SelGroup i, SelNode i

Element group selection. The element group i of FEelt is placed in FEel0 (selected model). SelGroupi is equivalent to SelEltGroupi.

Node selection. The node(s) i of FEnode are placed in FEn0 (selected nodes).

SetGroup [i,name] [Mat j, Pro k, EGID e, Name s]

Set properties of a group. For group(s) of FEelt selector by number i, name name, or all you can modify the material property identifier j, the element property identifier k of all elements and/or the element group identifier e or name s. For example

 femesh('set group1:3 pro 4')
 femesh('set group rigid name celas') 

If you know the column of a set of element rows that you want to modify, calls of the form FEelt(femesh('findeltSelectors'),Column)= Value can also be used.

 model=femesh('testubeamplot');
 FEelt(femesh('findeltwithnode {x==-.5}'),9)=2;
 femesh plotelt; 
 cf.sel={'groupall','colordatamat'};

You can also use femesh('set groupa 1:3 pro 4') to modify properties in FEel0.

StringDOF

feutil('stringdof',sdof) returns a cell array with cells containing string descriptions of the DOFs in sdof.

SymSel OrigID nx ny nz

Plane symmetry. SymSel replaces elements in FEel0 by elements symmetric with respect to a plane going through the node of number OrigID (node 0 is taken to be the origin of the global coordinate system) and normal to the vector [nx ny nz]. If needed, new nodes are added to FEnode. Related commands are TransSel, RotateSel and RepeatSel.

TransSel tx ty tz

Translation of the selected element groups. TransSel replaces elements of FEel0 by their translation of a vector [tx ty tz] (in global coordinates). If needed, new nodes are added to FEnode. Related commands are SymSel, RotateSel and RepeatSel.

femesh('reset');
femesh(';testquad4;divide 2 3;addsel'); 
femesh(';transsel 3 1 0;addsel'); % Translation of [3 1 0]
femesh plotelt
fecom(';triax;textnode')

UnJoin Gp1 Gp2

Duplicate nodes that are common to two groups. To allow the creation of interfaces with partial coupling of nodal degrees of freedom, UnJoin determines which nodes are common to the element groups Gp1 and Gp2 of FEelt, duplicates them and changes the node numbers in Gp2 to correspond to the duplicate set of nodes. In the following call with output arguments, the columns of the matrix InterNode give the numbers of the interface nodes in each group InterNode = femesh('UnJoin 1 2').

 femesh('reset');
 femesh('test2bay');
 femesh('findnode group1 & group2') % nodes 3 4 are common
 femesh('unjoin 1 2');
 femesh('findnode group1 & group2') % no longer any common node

A more general call allows to separate nodes that are common to two sets of elements femesh('unjoin','Section1','Selection2'). Elements in Selection1 are left unchanged while nodes in Selection2 that are also in Selection1 are duplicated.

See also

fe_mk, fecom, feplot, section 4.2, demos gartfe, d_ubeam, beambar ...

©1991-2008 by SDTools
Previous Up Next