Changeset 11003
- Timestamp:
- 12/01/11 14:03:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/model/setflowequation.m
r9733 r11003 67 67 end 68 68 69 %add in model who is who70 md.flowequation.element_equation=zeros(md.mesh.numberofelements,1);71 72 69 %1: Hutter elements 73 70 nodeonhutter=zeros(md.mesh.numberofvertices,1); 74 71 nodeonhutter(md.mesh.elements(find(hutterflag),:))=1; 75 md.flowequation.element_equation(find(hutterflag))=1;76 72 77 73 %2: MacAyeal elements 78 74 nodeonmacayeal=zeros(md.mesh.numberofvertices,1); 79 75 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 80 md.flowequation.bordermacayeal=nodeonmacayeal;81 md.flowequation.element_equation(find(macayealflag))=2;82 76 83 77 %3: Pattyn elements 84 78 nodeonpattyn=zeros(md.mesh.numberofvertices,1); 85 79 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 86 md.flowequation.borderpattyn=nodeonpattyn;87 md.flowequation.element_equation(find(pattynflag))=3;88 80 89 81 %4: Stokes elements … … 98 90 nodeonstokes=zeros(md.mesh.numberofvertices,1); 99 91 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 100 md.flowequation.borderstokes=nodeonstokes; 101 md.flowequation.element_equation(find(stokesflag))=4; 92 93 %5: None elements 94 noneflag=zeros(md.mesh.numberofelements,1); 102 95 103 96 %Then complete with NoneApproximation or the other model used if there is no stokes … … 106 99 pattynflag(~stokesflag)=1; 107 100 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 108 md.flowequation.borderpattyn=nodeonpattyn;109 md.flowequation.element_equation(find(~stokesflag))=3;110 101 elseif any(macayealflag), %fill with macayeal 111 102 macayealflag(~stokesflag)=1; 112 103 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 113 md.flowequation.bordermacayeal=nodeonmacayeal;114 md.flowequation.element_equation(find(~stokesflag))=2;115 104 else %fill with none 116 %5: None elements (non Stokes) 117 md.flowequation.element_equation(find(~stokesflag))=0; 105 noneflag(find(~stokesflag))=1; 118 106 end 119 107 end … … 124 112 nodeonpattynstokes=zeros(md.mesh.numberofvertices,1); 125 113 nodeonmacayealstokes=zeros(md.mesh.numberofvertices,1); 114 macayealpattynflag=zeros(md.mesh.numberofelements,1); 115 macayealstokesflag=zeros(md.mesh.numberofelements,1); 116 pattynstokesflag=zeros(md.mesh.numberofelements,1); 126 117 if strcmpi(coupling_method,'penalties'), 127 118 %Create the border nodes between Pattyn and MacAyeal and extrude them … … 147 138 commonelements(find(pattynflag))=0; %only one layer: the elements previously in macayeal 148 139 macayealflag(find(commonelements))=0; %these elements are now macayealpattynelements 149 macayealpattynflag=zeros(md.mesh.numberofelements,1);150 140 macayealpattynflag(find(commonelements))=1; 151 141 nodeonmacayeal=zeros(md.mesh.numberofvertices,1); 152 142 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 153 md.flowequation.bordermacayeal=nodeonmacayeal; 154 155 %Create MacaAyealPattynApproximation where needed 156 md.flowequation.element_equation(find(macayealpattynflag))=5; 157 158 %Now recreate nodeonmacayeal and nodeonmacayealpattyn 143 144 %rule out elements that don't touch the 2 boundaries 145 pos=find(macayealpattynflag); 146 list=zeros(length(pos),1); 147 list = list + any(sum(nodeonmacayeal(md.mesh.elements(pos,:)),2),2); 148 list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:)) ,2),2); 149 pos1=find(list==1); 150 pattynflag(pos(pos1))=0; 151 macayealflag(pos(pos1))=1; 152 macayealpattynflag(pos(pos1))=0; 153 pos2=find(list==-1); 154 pattynflag(pos(pos2))=1; 155 macayealflag(pos(pos2))=0; 156 macayealpattynflag(pos(pos2))=0; 157 158 nodeonmacayeal(:)=0; 159 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 160 nodeonpattyn(:)=0; 161 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 162 nodeonmacayealpattyn(:)=0; 159 163 nodeonmacayealpattyn(md.mesh.elements(find(macayealpattynflag),:))=1; 164 160 165 elseif any(pattynflag) & any(stokesflag), %coupling pattyn stokes 161 166 %Find node at the border … … 166 171 commonelements(find(pattynflag))=0; %only one layer: the elements previously in macayeal 167 172 stokesflag(find(commonelements))=0; %these elements are now macayealpattynelements 168 pattynstokesflag=zeros(md.mesh.numberofelements,1);169 173 pattynstokesflag(find(commonelements))=1; 170 174 nodeonstokes=zeros(md.mesh.numberofvertices,1); 171 175 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 172 md.flowequation.borderstokes=nodeonstokes;173 174 %Create MacaAyealPattynApproximation where needed175 md.flowequation.element_equation(find(pattynstokesflag))=7;176 176 177 177 %Now recreate nodeonpattynstokes … … 186 186 commonelements(find(macayealflag))=0; %only one layer: the elements previously in macayeal 187 187 stokesflag(find(commonelements))=0; %these elements are now macayealmacayealelements 188 macayealstokesflag=zeros(md.mesh.numberofelements,1);189 188 macayealstokesflag(find(commonelements))=1; 190 189 nodeonstokes=zeros(md.mesh.numberofvertices,1); 191 190 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 192 md.flowequation.borderstokes=nodeonstokes;193 194 %Create MacaAyeal Approximation where needed195 md.flowequation.element_equation(find(macayealstokesflag))=6;196 191 197 192 %Now recreate nodeonmacayealstokes … … 202 197 end 203 198 end 199 200 %Create MacaAyealPattynApproximation where needed 201 md.flowequation.element_equation=zeros(md.mesh.numberofelements,1); 202 md.flowequation.element_equation(find(noneflag))=0; 203 md.flowequation.element_equation(find(hutterflag))=1; 204 md.flowequation.element_equation(find(macayealflag))=2; 205 md.flowequation.element_equation(find(pattynflag))=3; 206 md.flowequation.element_equation(find(stokesflag))=4; 207 md.flowequation.element_equation(find(macayealpattynflag))=5; 208 md.flowequation.element_equation(find(macayealstokesflag))=6; 209 md.flowequation.element_equation(find(pattynstokesflag))=7; 210 211 %border 212 md.flowequation.borderpattyn=nodeonpattyn; 213 md.flowequation.bordermacayeal=nodeonmacayeal; 214 md.flowequation.borderstokes=nodeonstokes; 204 215 205 216 %Create vertices_type … … 213 224 pos=find(nodeonhutter); 214 225 md.flowequation.vertex_equation(pos)=1; 215 pos=find(nodeonpattyn & nodeonmacayeal);216 md.flowequation.vertex_equation(pos)=3;217 226 pos=find(nodeonmacayealpattyn); 218 227 md.flowequation.vertex_equation(pos)=5; … … 235 244 md.flowequation.isstokes=double(any(md.flowequation.element_equation==4)); 236 245 237 end 246 return 247 248 %Check that tiling can work: 249 if any(md.flowequation.bordermacayeal) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.bordermacayeal ~=1), 250 error('error coupling domain too irregular'); 251 end 252 if any(md.flowequation.bordermacayeal) & any(md.flowequation.borderstokes) & any(md.flowequation.borderstokes + md.flowequation.bordermacayeal ~=1), 253 error('error coupling domain too irregular'); 254 end 255 if any(md.flowequation.borderstokes) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.borderstokes~=1), 256 error('error coupling domain too irregular'); 257 end
Note:
See TracChangeset
for help on using the changeset viewer.