SDT-base         Contents     Functions         Previous Next     PDF Index

4.3  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


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


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

%% Step1 Declare nodes and build single bay
 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

%% Step2 Put in main model, translate seclection and add to 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)

%% Step3 Create a 3D struss based on a single 2D bay
 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 tutorial scripts listed using d_mesh('Tuto') or in scripts beambar, d_ubeam, gartfe.

4.3.1  Automated meshing capabilities

While this is not the toolbox focus, SDT supports some free meshing capabilities.

fe_gmsh is an interface to the open source 3D mesher GMSH. Calls to this external program can be used to generate meshes by direct calls from MATLAB. Examples are given in the function reference.

fe_tetgen is an interface to the open source 3D tetrahedral mesh generator. See help fe_tetgen for commands.

fe_fmesh('qmesh') implements a 2D quad mesher which meshes a coarse mesh containing triangles or quads into quads of a target size. All nodes existing in the rough mesh are preserved. The -noTest option removes the initial mesh.

% build rough mesh
model=feutil('Objectquad 1 1',[0 0 0;2 0 0; 2 3 0; 0 3 0],1,1);
model=feutil('Objectquad 1 1',model,[2 0 0;8 0 0; 8 1 0; 2 1 0],1,1);
% start the mesher with characteristic length of .1
model=fe_fmesh('qmesh .1',model.Node,model.Elt);
feplot(model);

Other resources in the MATLAB environment are initmesh from the PDE toolbox and the Mesh2D package.

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.

To open the FEMLink GUI use sdtroot('InitFEMLink'). for a reference on the FEMLink Tab, see section 8.2.2. You will find an up to date list of interfaces with other FEM codes at www.sdtools.com/tofromfem.html). Import of model matrices, assembled or element wise, is discussed in section 4.3.3. Superelement import is uses sdtm.nodeLoadSE as discussed in section 6.4.

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


ans2sdtreads ANSYS binary files, reads and writes .cdb input (see FEMLink)
abaqusreads ABAQUS binary output .fil files, reads and writes input and matrix files (.inp,.mtx) (see FEMLink)
nasreadreads the MSC/NASTRAN [35] .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).
naswritewrites formatted input to the bulk data deck of MSC/NASTRAN (part of SDT), FEMLink adds support for case writing.
nopoThis OpenFEM function reads MODULEF models in binary format.
perm2sdtreads PERMAS ASCII files (this function is part of FEMLink)
samcefreads SAMCEF text input and binary output .u18, .u11 , .u12 files (see FEMLink)
ufreadreads 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.
ufwritewrites results in the Universal File format. SDT supports writing of test related datasets. FEMLink supports FEM model writing.

4.3.3  Importing model matrices from other codes

FEMLink handles importing element matrices for NASTRAN (nasread BuildUp), ANSYS (ans2sdt Build), SAMCEF (samcef read) and ABAQUS (abaqus read).

Reading of full matrices is supported for NASTRAN in the binary .op2 and .op4 formats (writing to .op4 is also available). For ANSYS, reading of .matrix ASCII format is supported. For ABAQUS, reading of ASCII .mtx format is supported.

Note that numerical precision is very important when importing model matrices. Storing matrices in 8 digit ASCII format is very often not sufficient.

To incorporate full FEM matrices in a SDT model, you can proceed as follows. A full FEM model matrix is most appropriately integrated as a superelement. The model would typically be composed of

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]); % Matrix types, sdtweb secms#SeStruct
% 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).

% Define weighting coefficients for mass and stiffness matrices
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.


©1991-2024 by SDTools
Previous Up Next