setup_control

PURPOSE ^

SETUP_CONTROL - compute the viscosity derivative with respect to the velocity

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

SETUP_CONTROL - compute the viscosity derivative with respect to the velocity 

   This script is used in control methods it builds the mass matrix of the system

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %SETUP_CONTROL - compute the viscosity derivative with respect to the velocity
0002 %
0003 %   This script is used in control methods it builds the mass matrix of the system
0004 
0005 
0006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%we want the number of non zero elements in the connectivity matrix.
0007 row=zeros(nel*9,1);
0008 col=zeros(nel*9,1);
0009 value=zeros(nel*9,1);
0010 count=-nel+1;
0011 for l=1:3
0012    for m=1:3 
0013       count=count+nel;
0014       col(count:count+nel-1)=index(:,l);
0015       row(count:count+nel-1)=index(:,m);
0016       value(count:count+nel-1)=1 ;
0017    end
0018 end
0019 Connect=sparse(row,col,value,nods,nods);
0020 numnz=nnz(Connect);
0021 clear row col value Connect
0022 
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 
0026 
0027 Zeros=spalloc(nods,nods,0);
0028 
0029 Elint=zeros(3,3);
0030 row=zeros(3,1);
0031 col=zeros(3,1);
0032 
0033 S=spalloc(nods,nods,numnz);
0034 for n=1:nel
0035    row=[index(n,1) index(n,2) index(n,3)]';
0036    col=[index(n,1) index(n,2) index(n,3)]';
0037    Elint=area(n)*[2 1 1
0038       1 2 1
0039       1 1 2]/12;
0040    S(row,col)=S(row,col)+Elint;
0041    
0042 end
0043 
0044 S=[S Zeros
0045    Zeros S];

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003