


PENALTYCREATEKMATRIX - creates a penalty matrix for a particular grid
penpair is, as the name describes, a penalty load between two grids, for a certain degree of freedom.
This is the same as adding a infinitely stiff spring element between two grids, for a certain degree
of freedom. The goal is to make the value of that dof identical on both grids.
In order to do so, we add a stiffness matrix of the type [1 -1 ; -1 1]*lambda, where lambda is a penalty
Usage:
Ke=PenaltyCreateKMatrix(penpair,grids,materials,inputs,analysis_type,kmax)
See also CREATEPVECTOR, PENALTYCREATEPVECTOR, PENALTYCONTRAIN

0001 function Ke=PenaltyCreateKMatrix(penpair,grids,materials,inputs,analysis_type,kmax) 0002 %PENALTYCREATEKMATRIX - creates a penalty matrix for a particular grid 0003 % 0004 % penpair is, as the name describes, a penalty load between two grids, for a certain degree of freedom. 0005 % This is the same as adding a infinitely stiff spring element between two grids, for a certain degree 0006 % of freedom. The goal is to make the value of that dof identical on both grids. 0007 % In order to do so, we add a stiffness matrix of the type [1 -1 ; -1 1]*lambda, where lambda is a penalty 0008 % 0009 % Usage: 0010 % Ke=PenaltyCreateKMatrix(penpair,grids,materials,inputs,analysis_type,kmax) 0011 % 0012 % See also CREATEPVECTOR, PENALTYCREATEPVECTOR, PENALTYCONTRAIN 0013 0014 %parameters 0015 numgrids=2; 0016 0017 %initialize stiffness matrix 0018 Ke=elemmatrix(2); 0019 0020 %Build linear indices for elementary stiffness matrix. 0021 for i=1:numgrids, 0022 doflist=grids(penpair.grids(i)).grid.doflist; %list of dofs in the g-set 0023 dof=doflist(penpair.dof); 0024 Ke.row_indices(i)=dof; 0025 end 0026 0027 Ke.terms(1,1)=kmax*10^penpair.penalty_offset; 0028 Ke.terms(1,2)=-kmax*10^penpair.penalty_offset; 0029 Ke.terms(2,1)=-kmax*10^penpair.penalty_offset; 0030 Ke.terms(2,2)=kmax*10^penpair.penalty_offset;