5.1 FE mesh and the feplot interface
Three kinds of manipulations are possible using the feplot GUI
-
viewing the model and post-processing the responses,
- setting and displaying the mechanical problem (model properties and cases),
- setting the view properties.
5.1.1 The main feplot figure
feplot figures are used to view FE models and hold all the data needed to run simulations. Data in the model can be viewed in the property figure (see section 5.1.3). Data in the figure can be accessed from the command line through pointers as detailed in section 5.1.2. The feplot help gives architecture information, while fecomlists available commands. Most demonstrations linked to finite element modeling (see section 1.2 for a list) give examples of how to use feplot and fecom.
Figure 5.1: Main feplot figure.
The first step of most analyzes is to display a model in the main feplot figure. Examples of possible commands are (see fecom load for more details)
-
feplot(model) (display the model in a variable) .
- cf=feplot;cf.model=model; (get a figure pointer cf and redefine the model displayed in this figure), cf=feplot;cf.model={node,elt}; will work for just nodes and elements. Note that cf.model is a method to define the model and is not a pointer.
- feplot('load','File.mat') load a model from a .mat file.
As an example, you can load the data from the gartfe demo, get cf a SDT handle for a feplot figure, set the model for this figure and get the standard 3D view of the structure
model=demosdt('demogartfe')
cf=feplot; % open FEPLOT and define a pointer CF to the figure
cf.model=model;
The main capabilities the feplot figure are accessible using the figure toolbar, the keyboard shortcuts, the right mouse button (to open context menus) and the menus.
Toolbar
List of icons used in GUIs
 |
Model properties used to edit the properties of your model. |
 |
Start/stop animation |
 |
Previous Channel/Deformation |
 |
Next Channel/Deformation |
 |
Zoom |
Keyboard shortcuts
At this level note how you can zoom by selecting a region of interest with your mouse (double click or press the i key to zoom back). You can make the axis active by clicking on it and then use any of the u, U, v, V, w, W, 3, 2 keys to rotate the plot (press the ? key for a list of iimousekey shortcuts).
Menus and context menu
The contextmenu associated with your plot may be opened using the right mouse button and select Cursor. See how the cursor allows you to know node numbers and positions. Use the left mouse button to get more info on the current node (when you have more than one object, the n key is used to go to the next object). Use the right button to exit the cursor mode.
Notice the other things you can do with the ContextMenu (associated with the figure, the axes and objects). A few important functionalities and the associated commands are
-
Cursor Node tracks mouse movements and displays information about pointed object. This is equivalent to the iimouse('cursor') command line.
- Cursor...[Elt,Sel,Off] selects what information to display when tracking the mouse. The iimouse('cursor[onElt,onSel,Off]') command lines are possible.
- TextNode activates the node labeling. It is equivalent to the fecom('textnode') command line.
- Triax displays the orientation triax. It is equivalent to the fecom('triax') command line.
- Undef shows the undeformed structure. Other options are accessible with the fecom('undef[dot,line]') command line.
- Views... [View n+x,...] selects default plot orientation. The
iimouse('[vn+x,...]') command lines are available.
- colorbar on shows the colorbar and is equivalent to cingui('ColorBarOn' command line.
- Zoom Reset is the same as the iimouse('resetvie') command line to reset the zoom.
- setlines is the same as the setlines command line
The figure Feplot menu gives you access to the following commands (accessible by fecom)
-
Feplot:Feplot/Model properties opens the property figure (see section 5.1.3).
- Feplot:Sub commands:Sub IsoViews (same as iicom('subiso')) gets a plot with four views of the same mode. Use iicom('sub2 2 step') to get four views of different modes.
- Feplot:Show menu generates standard plots. For FE analyses one will generally use surface plots color-coded surface plots using patch objects) or wire-frame plots (use Feplot:Show menu to switch).
- Feplot:Misc shows a Triax or opens the channel selector.
- Feplot:Undef is used to show or not the undeformed structure.
- Feplot:Colordata shows structure with standard colors.
- Feplot:Selection shows available selections.
- Feplot:Renderer is used to choose the graphical rendering. Continuous animation in OpenGL rendering is possible for models that are not too large. The fecom SelReduce can be use to coarsen the mesh otherwise.
- Feplot:Anim chooses the animation mode.
- Feplot:View defaults changes the orientation view.
5.1.2 Pointers to the figure and the model
cf1=feplot returns a pointer to the current feplot figure. The handle is used to provide simplified calling formats for data initialization and text information on the current configuration. You can create more than one feplot figure with cf=feplot(FigHandle). If many feplot figures are open, one can define the target giving an feplot figure handle cf as a first argument to fecom commands.
The model is stored in a graphical object. cf.model is a method that calls fecom InitModel. cf1.mdl is a method that returns a pointer to the model. Modifications to the pointer are reflected to the data stored in the figure. However mo1=cf.mdl;mo1=model makes a copy of the variable model into a new variable mo1.
cf.Stack gives access to the model stack as would cf.mdl.Stack but allows text based access. Thus cf.Stack{'EigOpt'} searches for a name with that entry and returns an empty matrix if it does not exist. If the entry may not exist a type must be given, for example cf.Stack{'info','EigOpt'}=[5 10 1].
cf.CStack gives access to the case stack as would calls of the form
Case=fe_case(cf.mdl,'getcase');stack_get(Case,'FixDof','base')
but it allows more convenient string based selection of the entries.
5.1.3 The property figure
Finite element models are described by a data structures with the following main fields (for a full list of possible fields see section 7.6)
The model content can be viewed using the feplot property figure. This figure is opened using the
icon, or fecom('ProInit').
Figure 5.2: Model property interface.
This figure has the following tabs
-
Model tab gives general information on the model nodes and elements You can declare those by hand as shown in section 5.1.4, trough structured mesh manipulations with femesh see section 5.1.6, or through import see section 5.1.7.
(see section 5.3 and Figure 5.2). You can visualize one or more groups by selecting them in the left group list of this tab.
- Mat tab lists and edits all the material. In the
mode, associated elements in selection are shown. See section 5.3.1.
- ElProp tab lists and edits all the properties. See section 5.3.1.
- Stack tab lists and edits general information stored in the model (see section 7.7 for possible entries). You can access the model stack with the cf.Stack method.
- Cases tab lists and edits load and boundary conditions (see section 5.3.3 and Figure 5.9). You can access the case stack with the cf.CStack method.
- Simulate tab allows to launch the static and dynamic simulation (see section 5.5 and Figure 5.10).
The figure icons have the following uses
 |
Model properties used to edit the properties of your model. |
 |
Active display of current group, material, element property, stack or case entry. Activate with fecom('ProViewOn'); |
 |
Open the iiplot GUI. |
 |
Open/close feplot figure |
 |
Refresh the display, when the model has been modified from script. |
5.1.4 Direct declaration of geometry (truss example)
Hand declaration of a model can only be done for small models and later sections address more realistic problems. This example mostly illustrates the form of the model data structure.
Figure 5.3: FE model.
The geometry is declared in the model.Node matrix (see section 7.1 and section 7.1.2). In this case, one defines 6 nodes for the truss and an arbitrary reference node to distinguish principal bending axes (see beam1)
% NodeID unused x y z
model.Node=[ 1 0 0 0 0 1 0; ...
2 0 0 0 0 0 0; ...
3 0 0 0 1 1 0; ...
4 0 0 0 1 0 0; ...
5 0 0 0 2 0 0; ...
6 0 0 0 2 1 0; ...
7 0 0 0 1 1 1]; % reference node
The model description matrix (see section 7.1) describes 4 longerons, 2 diagonals and 2 battens. These can be declared using three groups of beam1 elements
model.Elt=[ ...
% declaration of element group for longerons
Inf abs('beam1') ; ...
%node1 node2 MatID ProID nodeR, zeros to fill the matrix
1 3 1 1 7 0 ; ...
3 6 1 1 7 0 ; ...
2 4 1 1 7 0 ; ...
4 5 1 1 7 0 ; ...
% declaration of element group for diagonals
Inf abs('beam1') ; ...
2 3 1 2 7 0 ; ...
4 6 1 2 7 0 ; ...
% declaration of element group for battens
Inf abs('beam1') ; ...
3 4 1 3 7 0 ; ...
5 6 1 3 7 0 ];
You may view the declared geometry
cf=feplot; cf.model=model; % create feplot axes
fecom(';view2;textnode;triax;'); % manipulate axes
The demo_fe script illustrates uses of this model.
5.1.5 Modal test geometry declaration
A wire-frame model is composed of node and connectivity declarations.
Figure 5.4: Test analysis : wire-frame model.
Starting from scratch (if you have not imported your geometry from universal files). You can declare nodes and wire frame lines using the fecom Add editors. Test wire frames are simply groups of beam1 elements with an EGID set to -1. For example in the two bay truss (see section 5.1.4)
cf=fecom;cf.model='reset';
% fecom('AddNode') would open a dialog box
fecom('AddNode',[0 1 0; 0 0 0]); % add nodes giving coordinates
fecom('AddNode',[3 1 1 0;4 1 0 0]); % NodId and xyz
fecom('AddNode',[5 0 0 0 2 0 0;
6 0 0 0 2 1 0]);
fecom('AddLine',[1 3 2 4 3]); % continous line in first group
fecom('AddLine',[3 6 0 6 5 0 4 5 0 4 6]); % 0 for discontinuities
fecom('ProInit');
%fecom('save') % will let you save the model to a mat file
Note that
-
After declaring nodes you can use cf.sel='groupall';fecom(cf,'AddLine') to start a cursor letting you build the wire-frame line graphically. Click on nodes continue the line, while the context menu allows breaks, last point removal, exit, and display of the ldraw building commands in the MATLAB command window. This procedure is particularly useful if you already have a FEM model of your test article.
- you can also use the femesh ObjectBeamLine command to define the experimental mesh.
- If you have a FE mesh, you can easily combine the FE and wire frame models using the femesh AddTest command (see gartte). The procedure to solve the common problem of matching coordinate systems when they initially have different scales / orientations / origins is discussed in section 4.1.1.
The feplot and fecom functions provide a number of tools that are designed to help in visualizing test results. You should take the time to go through the gartid, gartte and gartco demos to learn more about them.
5.1.6 Building models with femesh
Declaration by hand is clearly not the best way to proceed in general.femesh provides a number of commands for finite element model creation. The first input argument should be a string containing a single femesh command or a string of chained commands starting by a ; (parsed by commode which also provides a femesh command mode).
To understand the examples, you should remember that femesh uses the following standard global variables
| FEnode |
main set of nodes |
| FEn0 |
selected set of nodes |
| FEn1 |
alternate set of nodes |
| FEelt |
main finite element model description matrix |
| FEel0 |
selected finite element model description matrix |
| FEel1 |
alternate finite element model description matrix |
In the example of the previous section (see also the d_truss demo), you could use femesh as follows: initialize, declare the 4 nodes of a single bay by hand, declare the beams of this bay using the objectbeamline command
FEel0=[]; FEelt=[];
FEnode=[1 0 0 0 0 0 0;2 0 0 0 0 1 0; ...
3 0 0 0 1 0 0;4 0 0 0 1 1 0]; ...
femesh('objectbeamline 1 3 0 2 4 0 3 4 0 1 4');
The model of the first bay in is now selected (stored in FEel0). You can now put it in the main model, translate the selection by 1 in the x direction and add the new selection to the main model
femesh(';addsel;transsel 1 0 0;addsel;info');
model=femesh('model'); % export FEnode and FEelt geometry in model
cf=feplot; cf.model=model;
fecom(';view2;textnode;triax;');
You could also build more complex examples. For example, one could remove the second bay, make the diagonals a second group of bar1 elements, repeat the cell 10 times, rotate the planar truss thus obtained twice to create a 3-D triangular section truss and show the result (see d_truss)
femesh('reset');
femesh('test2bay');
femesh('removeelt group2');
femesh('divide group 1 InNode 1 4');
femesh('set group1 name bar1');
femesh(';selgroup2 1;repeatsel 10 1 0 0;addsel');
femesh(';rotatesel 1 60 1 0 0;addsel;');
femesh(';selgroup3:4;rotatesel 2 -60 1 0 0;addsel;');
femesh(';selgroup3:8');
model=femesh('model0'); % export FEnode and FEel0 in model
cf=feplot; cf.model=model;
fecom(';triaxon;view3;view y+180;view s-10');
femesh allows many other manipulations (translation, rotation, symmetry, extrusion, generation by revolution, refinement by division of elements, selection of groups, nodes, elements, edges, etc.) which are detailed in the Reference section.
Other more complex examples are treated in the following demonstration scripts
d_plate, beambar, d_ubeam, gartfe.
5.1.7 Importing models from other codes
The base SDT supports reading/writing of test related Universal files. All other interfaces are packaged in the FEMLink extension. FEMLink is installed within the base SDT but can only be accessed by licensed users.
You can get a list of currently supported interfaces trough the
comgui('FileExportInfo'). You will find an up to date list of interfaces with other FEM codes at www.sdtools.com/tofromfem.html). Import of model matrices in discussed in section 5.1.8.
These interfaces evolve with user needs. Please don't hesitate to ask for a patch even during an SDT evaluation by sending a test case to info@sdtools.com.
Interfaces available when this manual was revised were
| ans2sdt |
reads ANSYS binary files, reads and writes .cdb input (see FEMLink) |
| abaqus |
reads ABAQUS text input and binary output .fil files (see FEMLink) |
| nasread |
reads the MSC/NASTRAN [31] .f06
output file (matrices, tables, real modes, displacements, applied
loads, grid point stresses), input bulk file (nodes, elements, properties). FEMLink provides extensions of the basic nasread, output2 to model format conversion including element matrix reading, output4 file reading, advanced bulk reading capabilities). |
| naswrite |
writes formatted input to the bulk data deck of MSC/NASTRAN (part of SDT), FEMLink adds support for case writing. |
| nopo |
This OpenFEM function reads MODULEF models in binary format. |
| perm2sdt |
reads PERMAS ascii files (this function is part of FEMLink) |
| samcef |
reads SAMCEF text input and binary output .u18, .u11 , .u12 files (see FEMLink) |
| ufread |
reads results in the Universal File format (in particular,
types: 55 analysis data at nodes, 58 data at DOF, 15 grid point, 82 trace line). Reading of additional FEM related file types is supported by FEMLink through the uf_link function. |
| ufwrite |
writes results in the Universal File format. SDT supports writing of test related datasets. FEMLink supports FEM model writing. |
5.1.8 Importing model matrices from other codes
FEMLink handles importing element matrices for NASTRAN, ANSYS, SAMCEF and ABAQUS.
For NASTRAN, run an eigenvalue computation with the PARAM,POST,-4 card and load the superelement using
upcom('load UpcomFile');
Up=nasread(Up,'NastranOutput.op2');
For ANSYS, run an eigenvalue computation and use
Up=ans2sdt('buildup test1')
which reads the test1.rst and test1.emat binary files for model description and element matrices and generates the upcom superelement Up saved in file test1.mat.
For full FEM model matrices you can proceed as follows. A full FEM model matrix is most appropriately integrated as a superelement. The model would typically be composed of
-
a mass m and stiffness matrix k linked to DOFs mdof which you have imported with your own code (for example, using nasread output2 or output4 and appropriate manipulations to create mdof). Note that the ofact object provides translation from skyline to sparse format.
- an equivalent mesh defined using standard SDT elements. This mesh will be used to plot the imported model and possibly for repeating the model in a periodic structure.
Note that numerical precision is very important when importing model matrices. Storing matrices in 8 digit ASCII format is very often not sufficient.
fesuper provides functions to handle superelements.
In particular, fesuper SEAdd lets you define a superelement model, without explicitly defining nodes or elements (you can specify only DOFs and element matrices), and add it to another model.
Following example loads ubeam model, defines additional stiffness and mass matrices (that could have been imported) and a visualization mesh.
% Load ubeam model :
model=demosdt('demo ubeam-pro');
cf=feplot; model=cf.mdl;
% Define superelement from element matrices :
SE=struct('DOF',[180.01 189.01]',...
'K',{{[.1 0; 0 0.1] 4e10*[1 -1; -1 1]}},...
'Klab',{{'m','k'}},...
'Opt',[1 0;2 1]);
% Define visualization mesh :
SE.Node=feutil('GetNode 180 | 189',model);
SE.Elt=feutil('ObjectBeamLine 180 189 -egid -1');
% Add as a superelement to model :
model=fesuper('SEadd -unique 1 1 selt',model,SE);
You can easily define weighting coefficient associated to matrices of the superelement, by defining an element property (see p_super for more details). Following line defines a weighting coefficient of 1 for mass and 2 for stiffness (1001 is the MatId of the superelement).
model.il=[1001 fe_mat('p_super','SI',1) 1 2];
You may also want to repeat the superelement defined by element matrices. Following example shows how to define a model, from repeated superelement:
% Define matrices (can be imported from other codes) :
model=femesh('testhexa8');
[m,k,mdof]=fe_mk(model);
% Define the superelement:
SE=struct('DOF',[180.01 189.01]',...
'K',{{[.1 0; 0 0.1] 4e10*[1 -1; -1 1]}},...
'Klab',{{'m','k'}},...
'Opt',[1 0;2 1]);
SE.Node=model.Node; SE.Elt=model.Elt;
% Add as repeated superelement:
% (need good order of nodes for nodeshift)
model=fesuper('SEAdd -trans 10 0.0 0.0 1.0 4 1000 1000 cube',[],SE);
cf=feplot(model)
Superelement based substructuring is demonstrated in d_cms2 which gives you a working example where model matrices are stored in a generic superelement. Note that numerical precision is very important when importing model matrices. Storing matrices in 8 digit ASCII format is very often not sufficient.
5.1.9 feplot FAQ
feplot lets you define and save advanced views of your model, and export them as .png pictures.
- How do I keep group colors constant when I select part of a model?
One can define different types of color for selection using fecom ColorData. In particular one can color by groupId, by ProId or by MatId using respectively fecom colordatagroup, colordatapro or colordatamat. Without second argument, colors are attributed automatically. One can define a color map with each row of the form [ID Red Green Blue] as a second argument: fecom('colordata',colormap). All ID do not need to be present in colormap matrix (colors for missing ID are then automatically attributed).
Following example defines 3 color views of the same GART model:
cf=demosdt('demo gartFE plot');
% ID Red Green Blue
r1=[(1:10)' [ones(3,1); zeros(7,1)] ...
[zeros(3,1); ones(7,1)] zeros(10,1)]; % colormap
fecom('colordatagroup',r1) % all ID associated with color
% redefine groups 4,5 color
cf.Stack{'GroupColor'}(4:5,2:4)=[0 0 1;0 0 1];
fecom('colordatagroup');
% just some ID associated with color
fecom('colordatapro',[1 1 0 0; 3 1 0 0])
fecom('colordatamat') % no color map defined
cf.Stack
- How do I display part of the model as wire frame? (Advanced object handling)
What is displayed in a feplot figure is defined by a set of objects. Once you have plotted your model with cf=feplot(model), you can access to displayed objects through cf.o(i) (i is the number of the object). Each object is defined by a selection of model elements ('seli') associated to some other properties (see fecom SetObject). Selections are defined as FindElt strings through cf.sel(i). Displayed objects or selections can be removed using cf.o(i)=[] or cf.sel(i)=[].
Following example loads ubeam model, defines 2 complementary selections, and displays the second as a wire frame (ty2):
model=demosdt('demoubeam'); cf=feplot
% define visualisation :
cf.sel(1)='WithoutNode{z>1 & z<1.5}';
cf.sel(2)='WithNode{z>1 & z<1.5}';
cf.o(1)={'sel1 ty1','FaceColor',[1 0 0]}; % red patch
cf.o(3)={'sel2 ty2','EdgeColor',[0 0 1]}; % blue wire frame
% reinit visualisation :
cf.sel(1)='groupall';
cf.sel(2)=[]; cf.o(3)=[];
- Is feplot able to display very large models?
There is no theoretical size limitation for models to be displayed. However, due to the use of Matlab plot figure, and although optimization efforts have been done, feplot can be very slow for large models. To increase fluidity it is possible to reduce the number of displayed patches using fecom command SelReduce rp where rp is the ratio of patches to be kept. Adjusting rp, fluidity can be significantly improved with minor visual quality loss.
Following example draws a 50x50 patch, and uses fecom('ReduceSel') to keep only a patch out of 10:
model=feutil('ObjectQuad',[-1 -1 0;-1 1 0;1 1 0;1 -1 0],50,50);
cf=feplot(model); fecom(cf,'showpatch');
fecom(cf,'SelReduce .1'); % keep only 10% of patches.
- How do I save figures?
comgui imwrite FileName.ext can be used to generate a clean printout of SDT figures. The default extension is .png. If using the MATLAB print, you should use the -noui switch so that the GUI is not printed. Example print -noui -depsc2 FileName.eps
- MATLAB gives the warning Warning: RGB color data not yet supported in Painter's mode. This is due to the use of true colors for ColorDataMat and other flat colors. You should save your figure as a bitmap or use the fecom ShowLine mode.
©1991-2007 by SDTools