Changeset 11027 for issm/trunk/src/m/model/setflowequation.m
- Timestamp:
- 12/09/11 20:36:51 (13 years ago)
- Location:
- issm/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 10982,10984-11018,11021,11024,11026
- Property svn:mergeinfo changed
-
issm/trunk/src/m/model/setflowequation.m
r9733 r11027 67 67 end 68 68 69 %add in model who is who 70 md.flowequation.element_equation=zeros(md.mesh.numberofelements,1); 71 72 %1: Hutter elements 69 %Initialize node fields 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 77 %2: MacAyeal elements78 72 nodeonmacayeal=zeros(md.mesh.numberofvertices,1); 79 73 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 80 md.flowequation.bordermacayeal=nodeonmacayeal;81 md.flowequation.element_equation(find(macayealflag))=2;82 83 %3: Pattyn elements84 74 nodeonpattyn=zeros(md.mesh.numberofvertices,1); 85 75 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 86 md.flowequation.borderpattyn=nodeonpattyn; 87 md.flowequation.element_equation(find(pattynflag))=3; 88 89 %4: Stokes elements 76 nodeonstokes=zeros(md.mesh.numberofvertices,1); 77 noneflag=zeros(md.mesh.numberofelements,1); 78 90 79 %First modify stokesflag to get rid of elements contrained everywhere (spc + border with pattyn or macayeal) 91 80 if any(stokesflag), 92 nodeonstokes=zeros(md.mesh.numberofvertices,1);93 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;94 81 fullspcnodes=double((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy)+~isnan(md.diagnostic.spcvz))==3 | (nodeonpattyn & nodeonstokes)); %find all the nodes on the boundary of the domain without icefront 95 82 fullspcelems=double(sum(fullspcnodes(md.mesh.elements),2)==6); %find all the nodes on the boundary of the domain without icefront 96 83 stokesflag(find(fullspcelems))=0; 97 end 98 nodeonstokes=zeros(md.mesh.numberofvertices,1); 99 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 100 md.flowequation.borderstokes=nodeonstokes; 101 md.flowequation.element_equation(find(stokesflag))=4; 84 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 85 end 102 86 103 87 %Then complete with NoneApproximation or the other model used if there is no stokes … … 106 90 pattynflag(~stokesflag)=1; 107 91 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 108 md.flowequation.borderpattyn=nodeonpattyn;109 md.flowequation.element_equation(find(~stokesflag))=3;110 92 elseif any(macayealflag), %fill with macayeal 111 93 macayealflag(~stokesflag)=1; 112 94 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 113 md.flowequation.bordermacayeal=nodeonmacayeal;114 md.flowequation.element_equation(find(~stokesflag))=2;115 95 else %fill with none 116 %5: None elements (non Stokes) 117 md.flowequation.element_equation(find(~stokesflag))=0; 96 noneflag(find(~stokesflag))=1; 118 97 end 119 98 end … … 124 103 nodeonpattynstokes=zeros(md.mesh.numberofvertices,1); 125 104 nodeonmacayealstokes=zeros(md.mesh.numberofvertices,1); 105 macayealpattynflag=zeros(md.mesh.numberofelements,1); 106 macayealstokesflag=zeros(md.mesh.numberofelements,1); 107 pattynstokesflag=zeros(md.mesh.numberofelements,1); 126 108 if strcmpi(coupling_method,'penalties'), 127 109 %Create the border nodes between Pattyn and MacAyeal and extrude them … … 147 129 commonelements(find(pattynflag))=0; %only one layer: the elements previously in macayeal 148 130 macayealflag(find(commonelements))=0; %these elements are now macayealpattynelements 149 macayealpattynflag=zeros(md.mesh.numberofelements,1);150 131 macayealpattynflag(find(commonelements))=1; 151 nodeonmacayeal=zeros(md.mesh.numberofvertices,1); 152 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 132 nodeonmacayeal(:)=0; 133 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 134 135 %rule out elements that don't touch the 2 boundaries 136 pos=find(macayealpattynflag); 137 list=zeros(length(pos),1); 138 list = list + any(sum(nodeonmacayeal(md.mesh.elements(pos,:)),2),2); 139 list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:)) ,2),2); 140 pos1=find(list==1); 141 macayealflag(pos(pos1))=1; 142 macayealpattynflag(pos(pos1))=0; 143 pos2=find(list==-1); 144 pattynflag(pos(pos2))=1; 145 macayealpattynflag(pos(pos2))=0; 146 147 %Recompute nodes associated to these elements 148 nodeonmacayeal(:)=0; 149 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 150 nodeonpattyn(:)=0; 151 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 152 nodeonmacayealpattyn(:)=0; 159 153 nodeonmacayealpattyn(md.mesh.elements(find(macayealpattynflag),:))=1; 154 160 155 elseif any(pattynflag) & any(stokesflag), %coupling pattyn stokes 161 156 %Find node at the border … … 166 161 commonelements(find(pattynflag))=0; %only one layer: the elements previously in macayeal 167 162 stokesflag(find(commonelements))=0; %these elements are now macayealpattynelements 168 pattynstokesflag=zeros(md.mesh.numberofelements,1);169 163 pattynstokesflag(find(commonelements))=1; 170 164 nodeonstokes=zeros(md.mesh.numberofvertices,1); 171 165 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 172 md.flowequation.borderstokes=nodeonstokes; 173 174 %Create MacaAyealPattynApproximation where needed 175 md.flowequation.element_equation(find(pattynstokesflag))=7; 176 177 %Now recreate nodeonpattynstokes 178 nodeonpattynstokes=zeros(md.mesh.numberofvertices,1); 166 167 %rule out elements that don't touch the 2 boundaries 168 pos=find(pattynstokesflag); 169 list=zeros(length(pos),1); 170 list = list + any(sum(nodeonstokes(md.mesh.elements(pos,:)),2),2); 171 list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:)),2),2); 172 pos1=find(list==1); 173 stokesflag(pos(pos1))=1; 174 pattynstokesflag(pos(pos1))=0; 175 pos2=find(list==-1); 176 pattynflag(pos(pos2))=1; 177 pattynstokesflag(pos(pos2))=0; 178 179 %Recompute nodes associated to these elements 180 nodeonstokes(:)=0; 181 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 182 nodeonpattyn(:)=0; 183 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1; 184 nodeonpattynstokes(:)=0; 179 185 nodeonpattynstokes(md.mesh.elements(find(pattynstokesflag),:))=1; 186 180 187 elseif any(stokesflag) & any(macayealflag), 181 188 %Find node at the border … … 186 193 commonelements(find(macayealflag))=0; %only one layer: the elements previously in macayeal 187 194 stokesflag(find(commonelements))=0; %these elements are now macayealmacayealelements 188 macayealstokesflag=zeros(md.mesh.numberofelements,1);189 195 macayealstokesflag(find(commonelements))=1; 190 196 nodeonstokes=zeros(md.mesh.numberofvertices,1); 191 197 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 192 md.flowequation.borderstokes=nodeonstokes; 193 194 %Create MacaAyeal Approximation where needed 195 md.flowequation.element_equation(find(macayealstokesflag))=6; 196 197 %Now recreate nodeonmacayealstokes 198 nodeonmacayealstokes=zeros(md.mesh.numberofvertices,1); 198 199 %rule out elements that don't touch the 2 boundaries 200 pos=find(macayealstokesflag); 201 list=zeros(length(pos),1); 202 list = list + any(sum(nodeonmacayeal(md.mesh.elements(pos,:)),2),2); 203 list = list - any(sum(nodeonstokes(md.mesh.elements(pos,:)) ,2),2); 204 pos1=find(list==1); 205 macayealflag(pos(pos1))=1; 206 macayealstokesflag(pos(pos1))=0; 207 pos2=find(list==-1); 208 stokesflag(pos(pos2))=1; 209 macayealstokesflag(pos(pos2))=0; 210 211 %Recompute nodes associated to these elements 212 nodeonmacayeal(:)=0; 213 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1; 214 nodeonstokes(:)=0; 215 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1; 216 nodeonmacayealstokes(:)=0; 199 217 nodeonmacayealstokes(md.mesh.elements(find(macayealstokesflag),:))=1; 218 200 219 elseif any(stokesflag) & any(hutterflag), 201 220 error('type of coupling not supported yet'); 202 221 end 203 222 end 223 224 %Create MacaAyealPattynApproximation where needed 225 md.flowequation.element_equation=zeros(md.mesh.numberofelements,1); 226 md.flowequation.element_equation(find(noneflag))=0; 227 md.flowequation.element_equation(find(hutterflag))=1; 228 md.flowequation.element_equation(find(macayealflag))=2; 229 md.flowequation.element_equation(find(pattynflag))=3; 230 md.flowequation.element_equation(find(stokesflag))=4; 231 md.flowequation.element_equation(find(macayealpattynflag))=5; 232 md.flowequation.element_equation(find(macayealstokesflag))=6; 233 md.flowequation.element_equation(find(pattynstokesflag))=7; 234 235 %border 236 md.flowequation.borderpattyn=nodeonpattyn; 237 md.flowequation.bordermacayeal=nodeonmacayeal; 238 md.flowequation.borderstokes=nodeonstokes; 204 239 205 240 %Create vertices_type … … 213 248 pos=find(nodeonhutter); 214 249 md.flowequation.vertex_equation(pos)=1; 215 pos=find(nodeonpattyn & nodeonmacayeal);216 md.flowequation.vertex_equation(pos)=3;217 250 pos=find(nodeonmacayealpattyn); 218 251 md.flowequation.vertex_equation(pos)=5; … … 235 268 md.flowequation.isstokes=double(any(md.flowequation.element_equation==4)); 236 269 237 end 270 return 271 272 %Check that tiling can work: 273 if any(md.flowequation.bordermacayeal) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.bordermacayeal ~=1), 274 error('error coupling domain too irregular'); 275 end 276 if any(md.flowequation.bordermacayeal) & any(md.flowequation.borderstokes) & any(md.flowequation.borderstokes + md.flowequation.bordermacayeal ~=1), 277 error('error coupling domain too irregular'); 278 end 279 if any(md.flowequation.borderstokes) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.borderstokes~=1), 280 error('error coupling domain too irregular'); 281 end
Note:
See TracChangeset
for help on using the changeset viewer.