Example 111: Defining a simple 2D FEM mesh

This example gives a short introduction of the CMISS environment and of how to construct a simple 2D mesh. You will use the 2D graphics window to create a simple finite element model. Nodes are located by clicking in the window and particular care must be taken when linking the nodes into elements. The order in which the nodes are selected is critical, but not initially intuitive! Incorrectly specifying this order will result in highly distorted geometries. In practice, mesh creation would be automated (or specified through files), but is manually done here to demonstrate the process.


The comfile run by this example is as follows:

#Example_111 Defining a simple 2D FEM mesh                           
                                                                    
fem                            #sets the environment to FEM
fem define window;c            #opens a graphical window for input/display
#                              !  "c" calculates appropriate size axes
fem draw axes                  #draws the axes in the graphical window
fem draw rule                  #draws a ruled grid
fem hide axes                  #'hide' and 'show' toggle the visibility
fem show axes                  #  of a segment or structure
fem define nodes;m;fem_mesh    #use the LH mouse button to define 6
#                              !  nodes in a double trapeziod (see manual)
#                              !  "m" indicates mouse input of nodal positions
#                              !   4           6
#                              !          5
#                              !         2
#                              !  1           3
#                              !Click the centre mouse button to finish
#                              !Note that this command also stores the
#                              !  nodal coordinates in a file called 
#                              !  FEM_MESH.IPNODE in your local
#                              !  directory
fem define bases;p;fem_mesh    #define a 2D_Bilinear basis function
#                              !  "p" indicates prompt for input
#                              !  Default all options except the question
#                              !  about the number of Xi coordinates. Define
#                              !  2 Xi coords. Note that file 
#                              !  FEM_MESH.IPBASE has now been 
#                              !  created in your local directory 
fem define elements;m          #define elements
#                              !  "m" indicates mouse input of element nodes
#                              !  Pick the four nodes 1,2,4,5 
#                              !  in that order, for element 1 
#                              !  (using the LH button) then the nodes 
#                              !  2,3,5,6. Click the centre button to 
#                              !  finish. Note that file 
#                              !  FEM_MESH.IPELEM has now been 
#                              !  created in your local directory 
fem hide elements              #hides the element numbers      
fem show elements              #makes the element numbers visible   
fem list nodes                 #lists the number of nodes and their 
#                              !  coordinates in the output pane
fem list bases                 #lists the defined bases             
fem list elements              #lists the elements                  
fem list node;fem_mesh         #list the nodal coordinates to file 
#                              !  FEM_MESH.OPNODE.       

Files used by this example are:

Name             Modified     Size

example_111.com 12-Feb-2004 2.9k fem_mesh.ipbase 10-Apr-2000 1.1k fem_mesh.ipelem 10-Apr-2000 611 fem_mesh.ipnode 10-Apr-2000 1.3k

Download the entire example:

Name                      Modified     Size

examples_1_11_111.tar.gz 18-Aug-2006 60k

Graphical output from this problem is given here.


Html last generated: Wed Mar 9 16:00:51 2016

Input last modified: Tue Feb 17 14:46:14 2004


CMISS Help / Examples / 1 / 11 / 111