Contents     Functions     Index     Previous Next     PDF

fe_mk, fe_mknl



Purpose

Assembly of finite element model matrices.

Syntax
 [m,k,mdof] = fe_mknl(model);
 model      = fe_mk(model,'Options',Opt)
 [m,k,mdof] = fe_mk( ... ,[0       OtherOptions])
 [mat,mdof] = fe_mk( ... ,[MatType OtherOptions])
 [Case,model.DOF]=fe_mknl('init',model); 
 mat=fe_mknl('assemble',model,Case,def,MatType);
Description

fe_mk and fe_mknl take models and return assembled matrices and/or right hand side vectors. fe_mknl is the most efficient but has some limitations in the support of superelements. It should be used by default.

Input arguments are Output formats are mdof is the DOF definition vector describing the DOFs of output matrices.

When fixed boundary conditions or linear constraints are considered, mdof is equal to the set of master or independent degrees of freedom Case.DOF which can also be obtained with fe_case(model,'gettdof'). Additional unused DOFs can then be eliminated unless Opt(2) is set to 1 to prevent that elimination. To prevent constraint elimination in fe_mknl use Assemble NoT.

In some cases, you may want to assemble the matrices but not go through the constraint elimination phase. This is done by setting Opt(2) to 2. mdof is then equal to model.DOF.

This is illustrated in the example below
 femesh('reset');
 model =femesh('testubeam');
 model.DOF=[];% an non empty model.DOF would eliminate all other DOFs
 model =fe_case(model,'fixdof','Base','z==0');
 model = fe_mk(model,'Options',[0 2]); 
 [k,mdof] = fe_mk(model,'options',[0 0]); 
 fprintf('With constraints %i DOFs\n',size(k,1)); 
 fprintf('Without          %i DOFs',size(model.K{1},1));
 Case=fe_case(model,'gett');
 isequal(Case.DOF,mdof) % mdof is the same as Case.DOF
For other information on constraint handling see section 7.13.

Assembly is decomposed in two phases. The initialization prepares everything that will stay constant during a non-linear run. The assembly call performs other operations.

Init

The fe_mknl Init phase initializes the Case.T (basis of vectors verifying linear constraints see section 7.13), Case.GroupInfo fields (detailed below) and Case.MatGraph (preallocated sparse matrix associated with the model topology for optimized (re)assembly). Case.GroupInfo is a cell array with rows giving information about each element group in the model (see section 7.14.1 for details).

Case = fe_mknl('initNoCon', model) can be used to initialize the case structure without building the matrix connectivity (sparse matrix with preallocation of all possible non zero values). InitKeep can be used to prevent changint the model.DOF DOF list. This is typically used for submodel assembly.

The initialization phase is decomposed into the following steps

Assemble [ , NoT]

The second phase, assembly, is optimized for speed and multiple runs (in non-linear sequences it is repeated as long as the element connectivity information does not change). In fe_mk the second phase is optimized for robustness. The following example illustrates the interest of multiple phase assembly
 femesh('reset');
 model =femesh('test hexa8 divide 100 10 10');
 % traditional FE_MK assembly
 tic;[m1,k1,mdof] = fe_mk(model);toc

 % Multi-step approach for NL operation
 tic;[Case,model.DOF]=fe_mknl('init',model);toc
 tic;
 m=fe_mknl('assemble',model,Case,2);
 k=fe_mknl('assemble',model,Case,1);
 toc

MatType

Matrix types are numeric indications of what needs to be computed during assembly. Currently defined types for OpenFEM are

Opt

fe_mk options are given by calls of the form fe_mk(model,'Options',Opt) or the obsolete fe_mk(node,elt,pl,il,[],adof,opt).


opt(1) MatType see above
opt(2) if active DOFs are specified using model.DOF (or the obsolete call with adof), DOFs in model.DOF but not used by the model (either linked to no element or with a zero on the matrix or both the mass and stiffness diagonals) are eliminated unless opt(2) is set to 1 (but case constraints are then still considered) or 2 (all constraints are ignored).
opt(3) Assembly method (0 default, 1 symmetric mass and stiffness (OBSOLETE), 2 disk (to be preferred for large problems)). The disk assembly method creates temporary files using the MATLAB tempname function. This minimizes memory usage so that it should be preferred for very large models.
opt(4) 0 (default) nothing done for less than 1000 DOF method 1 otherwise. 1 DOF numbering optimized using current ofact SymRenumber method. Since new solvers renumber at factorization time this option is no longer interesting.


Old formats

[m,k,mdof]=fe_mk(node,elt,pl,il) returns mass and stiffness matrices when given nodes, elements, material properties, element properties rather than the corresponding model data structure.

[mat,mdof]=fe_mk(node,elt,pl,il,[],adof,opt) lets you specify DOFs to be retained with adof (same as defining a Case entry with {'KeepDof', 'Retained', adof}).

These formats are kept for backward compatibility but they do not allow support of local coordinate systems, handling of boundary conditions through cases, ...



Notes

fe_mk no longer supports complex matrix assembly in order to allow a number of speed optimization steps. You are thus expected to assemble the real and imaginary parts successively.



See also

Element functions in chapter 8, fe_c, feplot, fe_eig, upcom, fe_mat, femesh, etc.



©1991-2007 by SDTools
Previous Up Next