create_el2nod_matrices

PURPOSE ^

CREATE_EL2NOD_MATRICES - build some useful matrices

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CREATE_EL2NOD_MATRICES - build some useful matrices

   this script builds two matrices: el2nod and el2nodRhs. The first one is used to
   evaluate the value of a parameter over a grid when it is defined over the elements.
   The second matrix is used for the same purpose but with derivated parameters 
   (constant over the elements).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %CREATE_EL2NOD_MATRICES - build some useful matrices
0002 %
0003 %   this script builds two matrices: el2nod and el2nodRhs. The first one is used to
0004 %   evaluate the value of a parameter over a grid when it is defined over the elements.
0005 %   The second matrix is used for the same purpose but with derivated parameters
0006 %   (constant over the elements).
0007 
0008 row_location=zeros(nel*3*3,1);
0009 col_location=zeros(nel*3*3,1);
0010 value=zeros(nel*3*3,1);
0011 right_hand_side=zeros(nel*3*3,1);
0012 col_elements=zeros(nel*3*3,1);
0013 epsilon=1;
0014 count=-nel+1;
0015 for j=1:3
0016     for i=1:3
0017             count=count+nel;
0018             row_location(count:count+nel-1)=index(:,i);
0019             col_location(count:count+nel-1)=index(:,j);
0020             col_elements(count:count+nel-1)=[1:nel]';
0021             value(count:count+nel-1)=area.*(alpha(:,i).*alpha(:,j)*epsilon ...
0022             + beta(:,i).*beta(:,j)*epsilon ... 
0023             +( (i==j)/6 + (i~=j)/12 ) );
0024             right_hand_side(count:count+nel-1)=area/9;
0025     end
0026 end
0027 el2nod=sparse(row_location,col_location,value,nods,nods);
0028 el2nodRhs=sparse(row_location,col_elements,right_hand_side,nods,nel);

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