ModelProcessorSlopeCompute

PURPOSE ^

MODELPROCESSORSLOPECOMPUTE - process model for a slope finite element computation

SYNOPSIS ^

function [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorSlopeCompute(md,solutiontype);

DESCRIPTION ^

MODELPROCESSORSLOPECOMPUTE - process model for a slope finite element computation

   This routine uses all the informations in the model md and put them
   into different structures (grids, elements, loads, constrained,materials)
   that will be used to create the stiffness matrix and load vector.
   After this routine, the model md should not be called until the end of the
   solution sequence.

   Usage:
      [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorSlopeCompute(md,solutiontype)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorSlopeCompute(md,solutiontype);
0002 %MODELPROCESSORSLOPECOMPUTE - process model for a slope finite element computation
0003 %
0004 %   This routine uses all the informations in the model md and put them
0005 %   into different structures (grids, elements, loads, constrained,materials)
0006 %   that will be used to create the stiffness matrix and load vector.
0007 %   After this routine, the model md should not be called until the end of the
0008 %   solution sequence.
0009 %
0010 %   Usage:
0011 %      [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorSlopeCompute(md,solutiontype)
0012 
0013 global cluster
0014 
0015 if cluster,
0016     %We are running in parallel, we need to partition the elements
0017     element_partitioning=MeshPartition(md,numlabs);
0018 else
0019     %We are running in serial, all elements belong to the same partition.
0020     element_partitioning=ones(md.numberofelements,1);
0021     labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.
0022 end
0023 
0024 %Allocate grids and elements
0025 elements=struct('element',cell(md.numberofelements,1));
0026 materials=struct('material',cell(0));
0027 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.
0028 
0029 %Build elements
0030 if strcmpi(md.type,'2d'),
0031     pos=find(element_partitioning==labindex);
0032     [elements(pos).element]=deal(triaelem);
0033 
0034     elements(pos)=SetStructureField(elements(pos),'element','type','triaelem');
0035     elements(pos)=SetStructureField(elements(pos),'element','id',pos);
0036     elements(pos)=SetStructureField(elements(pos),'element','g',md.elements(pos,:));
0037     elements(pos)=SetStructureField(elements(pos),'element','b',md.bed(md.elements(pos,1:3)));
0038     elements(pos)=SetStructureField(elements(pos),'element','s',md.surface(md.elements(pos,1:3)));
0039 
0040 else
0041     pos=find(element_partitioning==labindex);
0042     [elements(pos).element]=deal(pentaelem);
0043 
0044     elements(pos)=SetStructureField(elements(pos),'element','type','pentaelem');
0045     elements(pos)=SetStructureField(elements(pos),'element','id',pos);
0046     elements(pos)=SetStructureField(elements(pos),'element','g',md.elements(pos,1:6));
0047     elements(pos)=SetStructureField(elements(pos),'element','h',md.thickness(md.elements(pos,1:6)));
0048     elements(pos)=SetStructureField(elements(pos),'element','s',md.surface(md.elements(pos,1:6)));
0049     elements(pos)=SetStructureField(elements(pos),'element','b',md.bed(md.elements(pos,1:6)));
0050     elements(pos)=SetStructureField(elements(pos),'element','shelf',md.elementoniceshelf(pos));
0051     elements(pos)=SetStructureField(elements(pos),'element','onbed',md.elementonbed(pos));
0052     elements(pos)=SetStructureField(elements(pos),'element','onsurface',md.elementonsurface(pos));
0053     elements(pos)=SetStructureField(elements(pos),'element','acceleration',0);%acceleration 0 since no acceleration is posssible
0054     elements(pos)=SetStructureField(elements(pos),'element','collapse',1);
0055     elements(pos)=SetStructureField(elements(pos),'element','matid',pos);
0056     elements(pos)=SetStructureField(elements(pos),'element','melting',md.melting(md.elements(pos,1:6))/md.yts);
0057     elements(pos)=SetStructureField(elements(pos),'element','accumulation',md.accumulation(md.elements(pos,1:6))/md.yts);
0058 
0059 end
0060 
0061 if cluster, 
0062     %For elements, the corresponding grids belong to this cpu. Keep track of it.
0063     mygrids(md.elements(el3pos,:))=1;
0064     mygrids(md.elements(el6pos,:))=1;
0065     
0066     %Figure out which grids from the partitioning belong to different element partitions. We'll
0067     %call them 'border' grids.
0068     bordergrids=double(gplus(mygrids)>1);
0069 else
0070     bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.
0071 end
0072 
0073 %Get the grids set up:
0074 grids=struct('grid',cell(md.numberofgrids,1));
0075 
0076 pos=[1:md.numberofgrids]';
0077 [grids(pos).grid]=deal(node);
0078 grids(pos)=SetStructureField(grids(pos),'grid','id',pos);
0079 grids(pos)=SetStructureField(grids(pos),'grid','x',md.x(pos));
0080 grids(pos)=SetStructureField(grids(pos),'grid','y',md.y(pos));
0081 grids(pos)=SetStructureField(grids(pos),'grid','z',md.z(pos));
0082 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos));
0083 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));
0084 
0085 %spc degrees of freedom:
0086 %     for each grid, 6 degrees of freedom are allowed. These dofs are numbered from 1 to 6. The first 3
0087 %    deal with the (x,y,z) velocities, or deformations. The last 3 deal with the (x,y,z) rotations.
0088 %    If a certain degree of freedom i (1<=i<=6) is constrained to the value 0, the number i should be added to the
0089 %    gridset field of a grid.
0090 %    The gridset field holds all the numbers corresponding to the dofs that have been constrained to 0 value. Because
0091 %    we do not know firshand how many dofs have been constrained for a certain grid, we need a flexible way
0092 %    of keeping track of these constraints. Hence gridset is a string array, of no given size, with no given
0093 %    numerical order.
0094 %    Ex: if a grid has 0 values for the x and z deformations, and 0 values for the y rotation, we could add any of the
0095 %    following strings to the gridset: '135', '153', '315', etc ...
0096 grids(pos)=SetStructureField(grids(pos),'grid','gridset','123456');
0097 
0098 %for bed elements, free up the 3'rd dof for the first 3 grids
0099 if strcmpi(md.type,'3d'),
0100     for n=1:length(elements),
0101         %all dofs associated to this element are frozen, except if the element is on the bed, and acts as a 'fake' pentaelem,
0102         %and a true 'macayeal' tria element.
0103         if strcmpi(solutiontype,'bed_slope_compute'),
0104             if elements(n).element.onbed,
0105                 for j=1:3,
0106                     grids(elements(n).element.g(j)).grid.gridset='23456';
0107                 end
0108             end
0109         elseif strcmpi(solutiontype,'surface_slope_compute'),
0110             if elements(n).element.onsurface,
0111                 for j=4:6,
0112                     grids(elements(n).element.g(j)).grid.gridset='23456';
0113                 end
0114             end
0115         end
0116     end
0117 else
0118     for n=1:md.numberofgrids,
0119         grids(n).grid.gridset='23456';
0120     end
0121 end
0122             
0123 
0124 %Boundary conditions: no penalties to apply here
0125     
0126 loads=struct('load',cell([0,1]));
0127 
0128 %Single point constraints: none;
0129 constraints=struct('constraint',cell(0,0));
0130 
0131 %Last thing, return a partitioning vector, and its transpose.
0132 [part,tpart]=PartitioningVector(md,grids);
0133 
0134 end %end function

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