PressureElemCompute

PURPOSE ^

PRESSUREELEMCOMPUTE - compute the pressure over each element

SYNOPSIS ^

function pressure=PressureElemCompute(m,inputs,type);

DESCRIPTION ^

PRESSUREELEMCOMPUTE - compute the pressure over each element

   return a vector of size (numberofelements,1), holding the pressure for 
   every element

   Usage:
      pressure=PressureElemCompute(m,inputs,type)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pressure=PressureElemCompute(m,inputs,type);
0002 %PRESSUREELEMCOMPUTE - compute the pressure over each element
0003 %
0004 %   return a vector of size (numberofelements,1), holding the pressure for
0005 %   every element
0006 %
0007 %   Usage:
0008 %      pressure=PressureElemCompute(m,inputs,type)
0009 
0010 %global variables
0011 global cluster gridset
0012 
0013 %recover fem model fields
0014 elements=m.elements;
0015 grids=m.grids;
0016 materials=m.materials;
0017 loads=m.loads;
0018 gridset=m.gridset;
0019 
0020 %figure out active elements that will take part in the stiffness and load generation
0021 [n1,n2]=GetNumberOfActiveElements(elements);
0022 
0023 %initialization
0024 pressure=zeros((n2-n1)+1,1);
0025 
0026 %Check 3d
0027 if strcmpi(type,'2d')
0028     disp('pressure not computed for 2d meshes')
0029     return
0030 end    
0031 
0032 %Go through elements and build pressure defined as P=-1/3*tr(stress)
0033 for n=n1:n2,
0034     if ~isempty(elements(n).element),
0035         stress_tensor=Stress(elements(n).element,grids,materials,inputs);    
0036         trace=stress_tensor(1)+stress_tensor(2)+stress_tensor(3);
0037         pressure(n)=-1/3*trace;
0038     end
0039 end

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