Changeset 1623
- Timestamp:
- 08/10/09 16:28:58 (16 years ago)
- Location:
- issm/trunk/src/m/solutions/ice
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/solutions/ice/BuildGridSets.m
r1 r1623 15 15 % BuildGridSets(grids,constraints) 16 16 17 global cluster18 17 global gridset 19 18 … … 56 55 if isempty(grid),continue;end; 57 56 58 if ~cluster, 59 %if dof 1 is spc'ed, put it in the sset, otherwise, in the fset 60 if ~isempty(findstr(grid.gridset,'1')), sset(grid.doflist(1))=1; else fset(grid.doflist(1))=1; end 61 if ~isempty(findstr(grid.gridset,'2')), sset(grid.doflist(2))=1; else fset(grid.doflist(2))=1; end 62 if ~isempty(findstr(grid.gridset,'3')), sset(grid.doflist(3))=1; else fset(grid.doflist(3))=1; end 63 if ~isempty(findstr(grid.gridset,'4')), sset(grid.doflist(4))=1; else fset(grid.doflist(4))=1; end 64 if ~isempty(findstr(grid.gridset,'5')), sset(grid.doflist(5))=1; else fset(grid.doflist(5))=1; end 65 if ~isempty(findstr(grid.gridset,'6')), sset(grid.doflist(6))=1; else fset(grid.doflist(6))=1; end 66 else 67 %same thing, except that if the grid is a border grid, we only carry out the inclusion on lab 1 68 if grid.border==1, 69 if labindex==1, 70 if ~isempty(findstr(grid.gridset,'1')), sset(grid.doflist(1))=1; else fset(grid.doflist(1))=1; end 71 if ~isempty(findstr(grid.gridset,'2')), sset(grid.doflist(2))=1; else fset(grid.doflist(2))=1; end 72 if ~isempty(findstr(grid.gridset,'3')), sset(grid.doflist(3))=1; else fset(grid.doflist(3))=1; end 73 if ~isempty(findstr(grid.gridset,'4')), sset(grid.doflist(4))=1; else fset(grid.doflist(4))=1; end 74 if ~isempty(findstr(grid.gridset,'5')), sset(grid.doflist(5))=1; else fset(grid.doflist(5))=1; end 75 if ~isempty(findstr(grid.gridset,'6')), sset(grid.doflist(6))=1; else fset(grid.doflist(6))=1; end 76 end 77 else 78 if ~isempty(findstr(grid.gridset,'1')), sset(grid.doflist(1))=1; else fset(grid.doflist(1))=1; end 79 if ~isempty(findstr(grid.gridset,'2')), sset(grid.doflist(2))=1; else fset(grid.doflist(2))=1; end 80 if ~isempty(findstr(grid.gridset,'3')), sset(grid.doflist(3))=1; else fset(grid.doflist(3))=1; end 81 if ~isempty(findstr(grid.gridset,'4')), sset(grid.doflist(4))=1; else fset(grid.doflist(4))=1; end 82 if ~isempty(findstr(grid.gridset,'5')), sset(grid.doflist(5))=1; else fset(grid.doflist(5))=1; end 83 if ~isempty(findstr(grid.gridset,'6')), sset(grid.doflist(6))=1; else fset(grid.doflist(6))=1; end 84 end 85 end 86 end 87 88 89 if cluster, 90 error('Not cool, broke it!'); 91 sset=gplus(sset); 92 fset=gplus(fset); 57 %if dof 1 is spc'ed, put it in the sset, otherwise, in the fset 58 if ~isempty(findstr(grid.gridset,'1')), sset(grid.doflist(1))=1; else fset(grid.doflist(1))=1; end 59 if ~isempty(findstr(grid.gridset,'2')), sset(grid.doflist(2))=1; else fset(grid.doflist(2))=1; end 60 if ~isempty(findstr(grid.gridset,'3')), sset(grid.doflist(3))=1; else fset(grid.doflist(3))=1; end 61 if ~isempty(findstr(grid.gridset,'4')), sset(grid.doflist(4))=1; else fset(grid.doflist(4))=1; end 62 if ~isempty(findstr(grid.gridset,'5')), sset(grid.doflist(5))=1; else fset(grid.doflist(5))=1; end 63 if ~isempty(findstr(grid.gridset,'6')), sset(grid.doflist(6))=1; else fset(grid.doflist(6))=1; end 93 64 end 94 65 -
issm/trunk/src/m/solutions/ice/DeviatoricStressCompute.m
r51 r1623 6 6 7 7 %global variables 8 global clustergridset8 global gridset 9 9 10 10 %recover fem model fields -
issm/trunk/src/m/solutions/ice/Dof.m
r1 r1623 12 12 % grids=Dof(grids) 13 13 14 global cluster15 16 14 dofcount=length(grids)*6; 17 15 18 if ~cluster, 19 dof=1; 20 for i=1:length(grids), 21 grids(i).grid.doflist=dof:1:(dof+5); 22 dof=dof+6; 23 end 24 else 25 borderdof=1; 26 dof=1; 27 for i=1:length(grids), 28 if ~isempty(grids(i).grid), 29 if ~grids(i).grid.border, 30 grids(i).grid.doflist=dof:1:(dof+5); 31 dof=dof+6; 32 else 33 grids(i).grid.doflist=borderdof:1:(borderdof+5); 34 borderdof=borderdof+6; 35 end 36 end 37 end 38 localdofcount=dof-1; 39 localborderdofcount=borderdof-1; 40 41 %Now, offset the border dofs so that they are lumped at the end of the dof list. 42 for i=1:length(grids), 43 if (~isempty(grids(i).grid) & grids(i).grid.border), 44 grids(i).grid.doflist=grids(i).grid.doflist+dofcount-localborderdofcount; 45 end 46 end 47 48 %Now, update the regular local grid dofs to account for other cpu grids. 49 alldofcounts=gcat(localdofcount); %this array holds the dof count for all cpus. 50 51 %Determine offset for all grid dofs 52 dofoffset=sum(alldofcounts(1:labindex-1)); 53 54 %offset all grid dofs. 55 for i=1:length(grids), 56 if (~isempty(grids(i).grid) & ~grids(i).grid.border), 57 grids(i).grid.doflist=grids(i).grid.doflist+dofoffset; 58 end 59 end 16 dof=1; 17 for i=1:length(grids), 18 grids(i).grid.doflist=dof:1:(dof+5); 19 dof=dof+6; 60 20 end -
issm/trunk/src/m/solutions/ice/ModelProcessor.m
r327 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessor(md,solutiontype) 12 12 13 global cluster14 13 if strcmpi(solutiontype,'diagnostic_horiz'), 15 14 [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorDiagnosticHoriz(md); -
issm/trunk/src/m/solutions/ice/ModelProcessorDiagnosticHoriz.m
r1299 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorDiagnosticHoriz(md) 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 if strcmpi(md.type,'2d'), … … 30 19 elements=struct('element',cell(numberofelements_horiz,1)); 31 20 materials=struct('material',cell(numberofelements_horiz+1,1)); 32 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.33 21 34 22 %Deal with 2d elements 35 23 if strcmpi(md.type,'2d'), 36 el3pos=find( (md.elements_type(:,1)==MacAyealEnum()) & (element_partitioning==labindex));24 el3pos=find(md.elements_type(:,1)==MacAyealEnum); 37 25 if ~isempty(el3pos), 38 26 pos=[1:length(el3pos)]'; … … 66 54 %3d elements 67 55 %First create penta elements (ie non hutter) 68 el6pos=find( (md.elements_type(:,1)==MacAyealEnum() | md.elements_type(:,1)==PattynEnum()) & (element_partitioning==labindex));56 el6pos=find(md.elements_type(:,1)==MacAyealEnum | md.elements_type(:,1)==PattynEnum); 69 57 70 58 if ~isempty(el6pos), … … 120 108 materials(end)=SetStructureField(materials(end),'constants','thermal_exchange_velocity',md.thermal_exchange_velocity); 121 109 122 if cluster,123 %For elements, the corresponding grids belong to this cpu. Keep track of it.124 mygrids(md.elements(el3pos,:))=1;125 mygrids(md.elements(el6pos,:))=1;126 end127 128 if cluster,129 %Figure out which grids from the partitioning belong to different element partitions. We'll130 %call them 'border' grids.131 bordergrids=double(gplus(mygrids)>1);132 else133 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.134 end135 136 110 %Get the grids set up: 137 111 grids=struct('grid',cell(md.numberofgrids,1)); … … 145 119 grids(pos)=SetStructureField(grids(pos),'grid','s',(md.z(pos)-md.bed(pos))./md.thickness(pos)); 146 120 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 147 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));148 121 149 122 %spc degrees of freedom: … … 190 163 for i=1:size(md.segmentonneumann_diag,1), 191 164 192 if (element_partitioning(md.segmentonneumann_diag(i,end))~=labindex), %this load does not belong to this cpu element partition.193 continue;194 end195 196 165 if strcmpi(md.type,'3d'), 197 166 if md.elements_type(md.segmentonneumann_diag(i,end))==MacAyealEnum(), -
issm/trunk/src/m/solutions/ice/ModelProcessorDiagnosticHutter.m
r1024 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorDiagnosticHutter(md); 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 if strcmpi(md.type,'2d'), … … 29 18 elements=struct('element',cell(length(pos),1)); 30 19 materials=struct('material',cell(length(pos)+1,1)); 31 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.32 20 [elements(count).element]=deal(singelem); 33 21 … … 51 39 elements=struct('element',cell(length(pos),1)); 52 40 materials=struct('material',cell(length(pos)+1,1)); 53 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.54 41 [elements(count).element]=deal(beamelem); 55 42 … … 79 66 materials(end)=SetStructureField(materials(end),'constants','meltingpoint',md.meltingpoint); 80 67 81 if cluster,82 %For elements, the corresponding grids belong to this cpu. Keep track of it.83 mygrids(md.elements(el3pos,:))=1;84 mygrids(md.elements(el6pos,:))=1;85 end86 87 if cluster,88 %Figure out which grids from the partitioning belong to different element partitions. We'll89 %call them 'border' grids.90 bordergrids=double(gplus(mygrids)>1);91 else92 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.93 end94 95 68 %Get the grids set up: 96 69 grids=struct('grid',cell(md.numberofgrids,1)); … … 104 77 grids(pos)=SetStructureField(grids(pos),'grid','s',(md.z(pos)-md.bed(pos))./md.thickness(pos)); 105 78 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 106 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));107 79 108 80 %spc degrees of freedom: -
issm/trunk/src/m/solutions/ice/ModelProcessorDiagnosticStokes.m
r1299 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorDiagnosticHoriz(md) 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 numberofstokeselements=size(find(md.elements_type(:,2)==StokesEnum()),1); 26 15 elements=struct('element',cell(numberofstokeselements,1)); 27 16 materials=struct('material',cell(numberofstokeselements+1,1)); 28 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.29 17 30 18 %3d elements 31 %pos=find(element_partitioning==labindex); 32 pos=find(md.elements_type(:,2)==StokesEnum()); 19 pos=find(md.elements_type(:,2)==StokesEnum); 33 20 stokesnewnumber=[1:numberofstokeselements]'; 34 21 [elements(stokesnewnumber).element]=deal(pentaelem); … … 75 62 76 63 77 if cluster,78 %For elements, the corresponding grids belong to this cpu. Keep track of it.79 mygrids(md.elements(pos,:))=1;80 end81 82 if cluster,83 %Figure out which grids from the partitioning belong to different element partitions. We'll84 %call them 'border' grids.85 bordergrids=double(gplus(mygrids)>1);86 else87 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.88 end89 90 64 %Get the grids set up: 91 65 grids=struct('grid',cell(md.numberofgrids,1)); … … 99 73 grids(pos)=SetStructureField(grids(pos),'grid','s',(md.z(pos)-md.bed(pos))./md.thickness(pos)); 100 74 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 101 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));102 75 103 76 %spc degrees of freedom: … … 140 113 for i=1:length_segmentonneumann_diag_stokes, 141 114 142 if (element_partitioning(segmentonneumann_diag_stokes(i,end))~=labindex), %this load does not belong to this cpu element partition.143 continue;144 end145 146 115 %build a quad ice front for the penta element 147 116 loads(i).load=icefront; -
issm/trunk/src/m/solutions/ice/ModelProcessorDiagnosticVert.m
r1040 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorDiagnosticVert(md); 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 elements=struct('element',cell(md.numberofelements,1)); 26 15 materials=struct('material',cell(md.numberofelements+1,1)); 27 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.28 16 29 17 %3d elements 30 pos= find(element_partitioning==labindex);18 pos=[1:md.numberofelements]'; 31 19 [elements(pos).element]=deal(pentaelem); 32 20 … … 72 60 materials(end)=SetStructureField(materials(end),'constants','thermal_exchange_velocity',md.thermal_exchange_velocity); 73 61 74 if cluster,75 %Figure out which grids from the partitioning belong to different element partitions. We'll76 %call them 'border' grids.77 bordergrids=double(gplus(mygrids)>1);78 else79 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.80 end81 82 62 %Get the grids set up: 83 63 grids=struct('grid',cell(md.numberofgrids,1)); … … 92 72 grids(pos)=SetStructureField(grids(pos),'grid','surface',md.surface(pos)); 93 73 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 94 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));95 74 96 75 %spc degrees of freedom: -
issm/trunk/src/m/solutions/ice/ModelProcessorMelting.m
r1040 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorMelting(md,solutiontype) 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 elements=struct('element',cell(md.numberofelements,1)); 26 15 materials=struct('material',cell(md.numberofelements+1,1)); 27 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.28 16 29 17 %Build elements … … 32 20 end 33 21 34 pos= find(element_partitioning==labindex);22 pos=[1:md.numberofelements]'; 35 23 [elements(pos).element]=deal(pentaelem); 36 24 … … 65 53 materials(end)=SetStructureField(materials(end),'constants','thermal_exchange_velocity',md.thermal_exchange_velocity); 66 54 67 if cluster,68 %For elements, the corresponding grids belong to this cpu. Keep track of it.69 mygrids(md.elements(el3pos,:))=1;70 mygrids(md.elements(el6pos,:))=1;71 72 %Figure out which grids from the partitioning belong to different element partitions. We'll73 %call them 'border' grids.74 bordergrids=double(gplus(mygrids)>1);75 else76 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.77 end78 79 55 %Get the grids set up: 80 56 grids=struct('grid',cell(md.numberofgrids,1)); … … 89 65 grids(pos)=SetStructureField(grids(pos),'grid','surface',md.surface(pos)); 90 66 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 91 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));92 67 93 68 %spc degrees of freedom: -
issm/trunk/src/m/solutions/ice/ModelProcessorPrognostic.m
r1040 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorPrognostic(md) 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 elements=struct('element',cell(md.numberofelements,1)); 26 15 materials=struct('material',cell(0,0)); 27 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.28 16 29 17 %Build elements 30 18 if strcmpi(md.type,'2d'), 31 pos= find(element_partitioning==labindex);19 pos=[1:md.numberofelements]'; 32 20 [elements(pos).element]=deal(triaelem); 33 21 … … 42 30 43 31 else 44 pos= find(element_partitioning==labindex);32 pos=[1:md.numberofelements]'; 45 33 [elements(pos).element]=deal(pentaelem); 46 34 … … 58 46 end 59 47 60 if cluster,61 %For elements, the corresponding grids belong to this cpu. Keep track of it.62 mygrids(md.elements(el3pos,:))=1;63 mygrids(md.elements(el6pos,:))=1;64 65 %Figure out which grids from the partitioning belong to different element partitions. We'll66 %call them 'border' grids.67 bordergrids=double(gplus(mygrids)>1);68 else69 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.70 end71 72 48 %Get the grids set up: 73 49 grids=struct('grid',cell(md.numberofgrids,1)); … … 82 58 grids(pos)=SetStructureField(grids(pos),'grid','surface',md.surface(pos)); 83 59 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 84 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));85 60 86 61 %spc degrees of freedom: -
issm/trunk/src/m/solutions/ice/ModelProcessorSlopeCompute.m
r1040 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorSlopeCompute(md,solutiontype) 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 elements=struct('element',cell(md.numberofelements,1)); 26 15 materials=struct('material',cell(0)); 27 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.28 16 29 17 %Build elements 30 18 if strcmpi(md.type,'2d'), 31 pos= find(element_partitioning==labindex);19 pos=[1:md.numberofelements]'; 32 20 [elements(pos).element]=deal(triaelem); 33 21 … … 39 27 40 28 else 41 pos= find(element_partitioning==labindex);29 pos=[1:md.numberofelements]'; 42 30 [elements(pos).element]=deal(pentaelem); 43 31 … … 58 46 end 59 47 60 if cluster,61 %For elements, the corresponding grids belong to this cpu. Keep track of it.62 mygrids(md.elements(el3pos,:))=1;63 mygrids(md.elements(el6pos,:))=1;64 65 %Figure out which grids from the partitioning belong to different element partitions. We'll66 %call them 'border' grids.67 bordergrids=double(gplus(mygrids)>1);68 else69 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.70 end71 72 48 %Get the grids set up: 73 49 grids=struct('grid',cell(md.numberofgrids,1)); … … 82 58 grids(pos)=SetStructureField(grids(pos),'grid','surface',md.surface(pos)); 83 59 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 84 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));85 60 86 61 %spc degrees of freedom: -
issm/trunk/src/m/solutions/ice/ModelProcessorThermal.m
r1299 r1623 11 11 % [elements,grids,loads,constraints,materials,part,tpart]=ModelProcessorThermal(md,solutiontype) 12 12 13 global cluster14 15 if cluster,16 %We are running in parallel, we need to partition the elements17 element_partitioning=MeshPartition(md,numlabs);18 else19 %We are running in serial, all elements belong to the same partition.20 element_partitioning=ones(md.numberofelements,1);21 labindex=1; %older versions of matlab do not include the parallel toolbox labindex variable.22 end23 24 13 %Allocate grids and elements 25 14 elements=struct('element',cell(md.numberofelements,1)); 26 15 materials=struct('material',cell(md.numberofelements+1,1)); 27 mygrids=zeros(md.numberofgrids,1); %this array determines grid partitioning.28 16 29 17 %Build 3d elements 30 pos= find(element_partitioning==labindex);18 pos=[1:md.numberofelements]'; 31 19 [elements(pos).element]=deal(pentaelem); 32 20 … … 51 39 %For penta elements where we want to implement MacAyeal's element, we need to collapse 52 40 %the formulation into trias: 53 el6pos=find( (md.elements_type(:,1)==MacAyealEnum() | md.elements_type(:,1)==PattynEnum()) & (element_partitioning==labindex));41 el6pos=find(md.elements_type(:,1)==MacAyealEnum | md.elements_type(:,1)==PattynEnum); 54 42 pos2=find(ismember(el6pos,find(md.elements_type(:,1)==MacAyealEnum()))); 55 43 elements(pos2)=SetStructureField(elements(pos2),'element','collapse',ones(length(pos2),1)); … … 80 68 materials(end)=SetStructureField(materials(end),'constants','thermal_exchange_velocity',md.thermal_exchange_velocity); 81 69 82 if cluster,83 %For elements, the corresponding grids belong to this cpu. Keep track of it.84 mygrids(md.elements(el3pos,:))=1;85 mygrids(md.elements(el6pos,:))=1;86 end87 88 if cluster,89 %Figure out which grids from the partitioning belong to different element partitions. We'll90 %call them 'border' grids.91 bordergrids=double(gplus(mygrids)>1);92 else93 bordergrids=zeros(md.numberofgrids,1); %no partitioning serially.94 end95 96 70 %Get the grids set up: 97 71 grids=struct('grid',cell(md.numberofgrids,1)); … … 106 80 grids(pos)=SetStructureField(grids(pos),'grid','surface',md.surface(pos)); 107 81 grids(pos)=SetStructureField(grids(pos),'grid','onbed',md.gridonbed(pos)); 108 grids(pos)=SetStructureField(grids(pos),'grid','border',bordergrids(pos));109 82 110 83 %spc degrees of freedom: -
issm/trunk/src/m/solutions/ice/PartitioningVector.m
r1 r1623 9 9 % [part tpart]=PartitioningVector(md,grids) 10 10 11 global cluster 12 13 if ~cluster, 14 part=1:1:md.numberofgrids; 15 tpart=1:1:md.numberofgrids; 16 else 17 part=zeros(md.numberofgrids,1); 18 %First deal with non border grids. 19 20 %How many grids for each lab? 21 count=0; 22 for i=1:md.numberofgrids, 23 if ((~isempty(grids(i).grid)) & (grids(i).grid.border==0)), 24 count=count+1; 25 end 26 end 27 28 %broacast 29 labcounts=gcat(count); 30 31 %create offset into partition vector 32 offset=0; 33 for i=1:(labindex-1), 34 offset=offset+labcounts(i); 35 end 36 37 %create partition vector 38 for i=1:md.numberofgrids, 39 if ((~isempty(grids(i).grid)) & (grids(i).grid.border==0)), 40 offset=offset+1; 41 part(offset)=i; 42 end 43 end 44 45 part=gplus(part); 46 47 %deal with border grids 48 count=gplus(count); 49 for i=1:md.numberofgrids, 50 if ((~isempty(grids(i).grid)) & (grids(i).grid.border==1)), 51 count=count+1; 52 part(count)=i; 53 end 54 end 55 56 %Build tpart: 57 tpart=zeros(md.numberofgrids,1); 58 for i=1:md.numberofgrids, 59 tpart(part(i))=i; 60 end 61 end 11 part=1:1:md.numberofgrids; 12 tpart=1:1:md.numberofgrids; 62 13 63 14 end %end function -
issm/trunk/src/m/solutions/ice/PressureElemCompute.m
r51 r1623 9 9 10 10 %global variables 11 global clustergridset11 global gridset 12 12 13 13 %recover fem model fields -
issm/trunk/src/m/solutions/ice/SpcGrids.m
r1 r1623 7 7 % [grids,y_g]=SpcGrids(grids,constraints) 8 8 9 global cluster10 11 9 %initialize y_g, vector of constraint values in the g-set: 12 10 y_g=sparse(getdofcount(grids),1); 13 14 if cluster,15 y_g_border=sparse(getdofcount(grids),1);16 end17 11 18 12 %Go through constraints and add constraint on gridset list of corresponding grid … … 23 17 constraint_grid=grids(constraint.grid).grid; 24 18 25 %On the cluster, grids are partitioned across cpus, but constraints are replicated across cpus. So26 %grids pointed to by certain constraints might not exist on the local cpu. In this case, skip the27 %constraint operations.28 if cluster & isempty(constraint_grid),29 continue;30 end31 32 19 %for the constrained grid, add the correct degree of freedom in the gridset list 33 20 constraint_grid.gridset=[constraint_grid.gridset num2str(constraint.dof)]; %concatenate two strings … … 38 25 %plug value of constraint in corresponding constraint vector y_g 39 26 dof=constraint_grid.doflist(constraint.dof); 40 if ~cluster, 41 y_g(dof)=constraint.value; 42 else 43 %for cluster, we add to y_g only if grid does not belong to border (we don't want to add constraint.value several times for each cpu). 44 if constraint_grid.border~=1, 45 y_g(dof)=constraint.value; 46 else 47 y_g_border(dof)=constraint.value; 48 end 49 end 27 y_g(dof)=constraint.value; 50 28 end 51 29 end 52 30 53 if cluster,54 %Add all the y_g from all the cpus55 y_g=gplus(y_g);56 %y_g_border is the same on all cpus, plug it into y_g57 y_g=y_g+y_g_border;58 end -
issm/trunk/src/m/solutions/ice/StrainRateCompute.m
r630 r1623 9 9 10 10 %global variables 11 global clustergridset11 global gridset 12 12 13 13 %recover fem model fields -
issm/trunk/src/m/solutions/ice/StressBedCompute.m
r51 r1623 9 9 10 10 %global variables 11 global clustergridset11 global gridset 12 12 13 13 %recover fem model fields -
issm/trunk/src/m/solutions/ice/StressCompute.m
r630 r1623 9 9 10 10 %global variables 11 global clustergridset11 global gridset 12 12 13 13 %recover fem model fields -
issm/trunk/src/m/solutions/ice/StressSurfaceCompute.m
r51 r1623 9 9 10 10 %global variables 11 global clustergridset11 global gridset 12 12 13 13 %recover fem model fields -
issm/trunk/src/m/solutions/ice/ViscousHeatingCompute.m
r51 r1623 9 9 10 10 %global variables 11 global clustergridset11 global gridset 12 12 13 13 %recover fem model fields -
issm/trunk/src/m/solutions/ice/diagnostic_core_linear.m
r329 r1623 11 11 12 12 %global variables 13 global clustergridset13 global gridset 14 14 15 15 if nargin==3, … … 29 29 params=m.params; 30 30 31 32 31 %recover parameters 33 32 sparsity=params.sparsity; … … 36 35 37 36 disp(sprintf('%s',' solving')); 38 39 37 % Generate system matrices (stiffness and load) 40 38 kflag=1; pflag=1; … … 43 41 [K_gg,p_g]=SystemMatrices(elements,grids,loads,materials,kflag, pflag, sparsity,inputs,analysis_type); 44 42 [K_gg,p_g]=PenaltySystemMatrices(grids,loads,materials,kflag, pflag, sparsity,inputs,analysis_type,K_gg,p_g); 45 46 if cluster,47 K_gg=distributed(gplus(K_gg),'convert');48 p_g=gplus(p_g);49 end50 43 51 44 % Reduce stiffness matrix from g set to f set (effectively rooting out the single point constraints), … … 62 55 end 63 56 64 65 57 % Add single point constraints back, ie increase f-set by s-set into the global g-set. 66 58 u_g= full(Mergesolution_g(uf,G_mn,ys)); -
issm/trunk/src/m/solutions/ice/diagnostic_core_nonlinear.m
r392 r1623 12 12 13 13 %global variables 14 global clustergridset element_debug element_debugid14 global gridset element_debug element_debugid 15 15 16 16 %recover fem model fields … … 87 87 end 88 88 89 if cluster,90 K_gg=distributed(gplus(K_gg),'convert');91 p_g=gplus(p_g);92 end93 94 89 % Reduce stiffness matrix from g set to f set (effectively rooting out the single point constraints), 95 90 % and compute modifications to loads from single point constraints. -
issm/trunk/src/m/solutions/ice/melting_core.m
r36 r1623 6 6 7 7 %global variables 8 global clustergridset8 global gridset 9 9 10 10 %recover fem model fields -
issm/trunk/src/m/solutions/ice/prognostic_core.m
r36 r1623 8 8 9 9 %global variables 10 global clustergridset10 global gridset 11 11 12 12 %recover fem model fields … … 40 40 [K_gg,p_g]=PenaltySystemMatrices(grids,loads,materials,kflag, pflag, sparsity,inputs,analysis_type,K_gg,p_g); 41 41 42 if cluster,43 K_gg=distributed(gplus(K_gg),'convert');44 p_g=gplus(p_g);45 end46 47 42 % Reduce stiffness matrix from g set to f set (effectively rooting out the single point constraints), 48 43 % and compute modifications to loads from single point constraints. -
issm/trunk/src/m/solutions/ice/slopecompute.m
r319 r1623 16 16 %Use package to set solution namespace 17 17 usenamespace('ice'); 18 19 %determine if run is parallel20 if strcmpi(md.cluster,'yes'), cluster=1; else cluster=0;end;21 22 %for now, only serial support is in23 if cluster,24 error('slopecompute error message: parallel support not implemented yet');25 end26 18 27 19 %First, build elements,grids,loads, etc ... for horizontal, base vertical and vertical model -
issm/trunk/src/m/solutions/ice/thermal_core.m
r36 r1623 6 6 7 7 %global variables 8 global clustergridset8 global gridset 9 9 10 10 %recover fem model fields
Note:
See TracChangeset
for help on using the changeset viewer.