Contents     Functions         Previous Next     PDF Index

fe_mknl, fe_mk

Purpose

Assembly of finite element model matrices.

Syntax

 [m,k,mdof] = fe_mknl(model);
 [Case,model.DOF]=fe_mknl('init',model); 
 mat=fe_mknl('assemble',model,Case,def,MatType);

Description

The exact procedure used for assembly often needs to be optimized in detail to avoid repetition of unnecessary steps. SDT typically calls an internal procedure implemented in fe_caseg Assemble and detailed in section 4.8.8. This documentation is meant for low level calls.

fe_mknl (and the obsolete fe_mk) take models and return assembled matrices and/or right hand side vectors.

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

% Low level assembly call with or without constraint resolution
 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.14.

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.14, resolution calls fe_case GetT, 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.15.3 for details).

Command options are the following

The initialization phase is decomposed into the following steps

  1. Generation of a complete list of DOFs using the feutil('getdof',model) call.
  2. get the material and element property tables in a robust manner (since some data can be replicated between the pl,il fields and the mat,pro stack entries. Generate node positions in a global reference frame.
  3. For each element group, build the GroupInfo data (DOF positions).
  4. For each element group, determine the unique pairs of [MatId ProId] values in the current group of elements and build a separate integ and constit for each pair. One then has the constitutive parameters for each type of element in the current group. pointers rows 6 and 7 give for each element the location of relevant information in the integ and constit tables.

    This is typically done using an [integ,constit,ElMap]=ElemF('integinfo') command, which in most cases is really being passed directly to a p_fun('BuildConstit') command.

    ElMap can be a structure with fields beginning by RunOpt_, Case_ and eval which allows execution of specific callbacks at this stage.

  5. For each element group, perform other initializations as defined by evaluating the callback string obtained using elem('GroupInit'). For example, initialize integration rule data structures EltConst, define local bases or normal maps in InfoAtNode, allocate memory for internal state variables in gstate, ...
  6. If requested (call without NoCon), preallocate a sparse matrix to store the assembled model. This topology assumes non zero values at all components of element matrices so that it is identical for all possible matrices and constant during non-linear iterations.

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

% Low level assembly calls
 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 identifiers

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

NodePos

NodePos=fe_mknl('NodePos',NNode,elt,cEGI,ElemF) is used to build the node position index matrix for a given group. ElemF can be omitted. NNode can be replaced by node.

nd

nd=fe_mknl('nd',DOF); is used to build and optimized object to get indices of DOF in a DOF list.

OrientMap

This command is used to build the InfoAtNode entry. The 'Info','EltOrient' field is a possible stack entry containing appropriate information before step 5 of the init command. The preferred mechanism is to define an material map associated to an element property as illustrated in section 7.13.

of_mk

of_mk is the mex file supporting assembly operations. You can set the number of threads used with of_mk('setomppro',8).

obsolete

Syntax

 model      = fe_mk(model,'Options',Opt)
 [m,k,mdof] = fe_mk( ... ,[0       OtherOptions])
 [mat,mdof] = fe_mk( ... ,[MatType OtherOptions])

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 sdtdef tempname command. 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.

[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 9, fe_c, feplot, fe_eig, upcom, fe_mat, femesh, etc.


©1991-2019 by SDTools
Previous Up Next