ModelProcessorDiagnosticHutter

PURPOSE ^

MODELPROCESSORDIAGNOSTICHUTTER - process model for a Hutter diagnostic solution

SYNOPSIS ^

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

DESCRIPTION ^

MODELPROCESSORDIAGNOSTICHUTTER - process model for a Hutter diagnostic solution

   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]=ModelProcessorDiagnosticHutter(md);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorDiagnosticHutter(md);
0002 %MODELPROCESSORDIAGNOSTICHUTTER - process model for a Hutter diagnostic solution
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]=ModelProcessorDiagnosticHutter(md);
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 if strcmpi(md.type,'2d'),
0026     pos=find(md.gridonhutter);
0027     count=[1:length(pos)]';
0028 
0029     elements=struct('element',cell(length(pos),1));
0030     materials=struct('material',cell(length(pos)+1,1));
0031     mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.
0032     [elements(count).element]=deal(singelem);
0033 
0034     elements(count)=SetStructureField(elements(count),'element','type','singelem');
0035     elements(count)=SetStructureField(elements(count),'element','id',count);
0036     elements(count)=SetStructureField(elements(count),'element','g',pos);
0037     elements(count)=SetStructureField(elements(count),'element','h',md.thickness(pos));
0038     elements(count)=SetStructureField(elements(count),'element','k',md.drag(pos));
0039     elements(count)=SetStructureField(elements(count),'element','matid',count);
0040 
0041     [materials(count).material]=deal(matice);
0042     materials(count)=SetStructureField(materials(count),'material','id',count);
0043     materials(count)=SetStructureField(materials(count),'material','B',md.B(pos));
0044     materials(count)=SetStructureField(materials(count),'material','n',3); %TO BE CHANGED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0045 
0046 else
0047     pos=find(1-md.gridonsurface);
0048     grids_el=[pos md.uppergrids(pos)];
0049     count=1:length(pos);
0050 
0051     elements=struct('element',cell(length(pos),1));
0052     materials=struct('material',cell(length(pos)+1,1));
0053     mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.
0054     [elements(count).element]=deal(beamelem);
0055 
0056     elements(count)=SetStructureField(elements(count),'element','type','beamelem');
0057     elements(count)=SetStructureField(elements(count),'element','id',count');
0058     elements(count)=SetStructureField(elements(count),'element','g',grids_el(count,1:2));
0059     elements(count)=SetStructureField(elements(count),'element','h',md.thickness(grids_el));
0060     elements(count)=SetStructureField(elements(count),'element','s',md.surface(grids_el));
0061     elements(count)=SetStructureField(elements(count),'element','b',md.bed(grids_el));
0062     elements(count)=SetStructureField(elements(count),'element','k',md.drag(grids_el));
0063     elements(count)=SetStructureField(elements(count),'element','onbed',md.gridonbed(grids_el(:,1)));
0064     elements(count)=SetStructureField(elements(count),'element','onsurface',md.gridonsurface(grids_el(:,2)));
0065     elements(count)=SetStructureField(elements(count),'element','matid',count');
0066 
0067     [materials(count).material]=deal(matice);
0068     materials(count)=SetStructureField(materials(count),'material','id',count');
0069     materials(count)=SetStructureField(materials(count),'material','B',md.B(grids_el)*[1;1]/2);
0070     materials(count)=SetStructureField(materials(count),'material','n',3); %TO BE CHANGED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0071 
0072 end
0073 
0074 %Add physical constants in materials
0075 [materials(end).constants]=deal(matpar);
0076 materials(end)=SetStructureField(materials(end),'constants','g',md.g);
0077 materials(end)=SetStructureField(materials(end),'constants','rho_ice',md.rho_ice);
0078 materials(end)=SetStructureField(materials(end),'constants','beta',md.beta);
0079 materials(end)=SetStructureField(materials(end),'constants','meltingpoint',md.meltingpoint);
0080 
0081 if cluster, 
0082     %For elements, the corresponding grids belong to this cpu. Keep track of it.
0083     mygrids(md.elements(el3pos,:))=1;
0084     mygrids(md.elements(el6pos,:))=1;
0085 end
0086 
0087 if cluster, 
0088     %Figure out which grids from the partitioning belong to different element partitions. We'll
0089     %call them 'border' grids.
0090     bordergrids=double(gplus(mygrids)>1);
0091 else
0092     bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.
0093 end
0094 
0095 %Get the grids set up:
0096 grids=struct('grid',cell(md.numberofgrids,1));
0097 
0098 pos=[1:md.numberofgrids]';
0099 [grids(pos).grid]=deal(node);
0100 grids(pos)=SetStructureField(grids(pos),'grid','id',pos);
0101 grids(pos)=SetStructureField(grids(pos),'grid','x',md.x(pos));
0102 grids(pos)=SetStructureField(grids(pos),'grid','y',md.y(pos));
0103 grids(pos)=SetStructureField(grids(pos),'grid','z',md.z(pos));
0104 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos));
0105 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));
0106 
0107 %spc degrees of freedom:
0108 %     for each grid, 6 degrees of freedom are allowed. These dofs are numbered from 1 to 6. The first 3
0109 %    deal with the (x,y,z) velocities, or deformations. The last 3 deal with the (x,y,z) rotations.
0110 %    If a certain degree of freedom i (1<=i<=6) is constrained to the value 0, the number i should be added to the
0111 %    gridset field of a grid.
0112 %    The gridset field holds all the numbers corresponding to the dofs that have been constrained to 0 value. Because
0113 %    we do not know firshand how many dofs have been constrained for a certain grid, we need a flexible way
0114 %    of keeping track of these constraints. Hence gridset is a string array, of no given size, with no given
0115 %    numerical order.
0116 %    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
0117 %    following strings to the gridset: '135', '153', '315', etc ...
0118 grids(pos)=SetStructureField(grids(pos),'grid','gridset','3456');
0119 
0120 %Boundary conditions:
0121 
0122 loads=struct('load',cell(0,0));
0123 
0124 %deal with mpcs for 2d-3d mesh transitions
0125 if strcmpi(md.type,'3d'),
0126     if ~isempty(md.penalties) & ~isnan(md.penalties),
0127         for i=1:size(md.penalties,1),
0128             for j=1:(md.numlayers-1),
0129 
0130                 %constrain first dof
0131                 constraints(count).constraint=rgb;
0132                 constraints(count).constraint.grid1=md.penalties(i,1);
0133                 constraints(count).constraint.grid2=md.penalties(i,j+1);
0134                 constraints(count).constraint.dof=1;
0135                 count=count+1;
0136                 
0137                 %constrain second dof
0138                 constraints(count).constraint=rgb;
0139                 constraints(count).constraint.grid1=md.penalties(i,1);
0140                 constraints(count).constraint.grid2=md.penalties(i,j+1);
0141                 constraints(count).constraint.dof=2;
0142                 count=count+1;
0143             end
0144         end
0145     end
0146 end
0147 
0148 
0149 %Single point constraints:
0150 spcs=find(~md.gridonhutter);
0151 constraints=struct('constraint',cell(2*length(spcs),1));
0152 
0153 count=1;
0154 for i=1:md.numberofgrids,
0155     if ~md.gridonhutter(i),
0156 
0157         %constrain first dof
0158         constraints(count).constraint=spc;
0159         constraints(count).constraint.grid=i;
0160         constraints(count).constraint.dof=1;
0161         constraints(count).constraint.value=0; %this will be change to vx in the solution sequences
0162         count=count+1;
0163 
0164         %constrain second dof
0165         constraints(count).constraint=spc;
0166         constraints(count).constraint.grid=i;
0167         constraints(count).constraint.dof=2;
0168         constraints(count).constraint.value=0; %this will be change to vy in the solution sequences
0169         count=count+1;
0170 
0171     end
0172 
0173 end
0174 
0175 
0176 %Last thing, return a partitioning vector, and its transpose.
0177 [part,tpart]=PartitioningVector(md,grids);
0178 end %end function

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