Changeset 11004


Ignore:
Timestamp:
12/01/11 14:24:41 (13 years ago)
Author:
seroussi
Message:

extended better setflowequation to macayealstokes and pattynstokes coupling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/model/setflowequation.m

    r11003 r11004  
    6767end
    6868
    69 %1: Hutter elements
     69%Initialize node fields
    7070nodeonhutter=zeros(md.mesh.numberofvertices,1);
    7171nodeonhutter(md.mesh.elements(find(hutterflag),:))=1;
    72 
    73 %2: MacAyeal elements
    7472nodeonmacayeal=zeros(md.mesh.numberofvertices,1);
    7573nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
    76 
    77 %3: Pattyn elements
    7874nodeonpattyn=zeros(md.mesh.numberofvertices,1);
    7975nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1;
    80 
    81 %4: Stokes elements
     76nodeonstokes=zeros(md.mesh.numberofvertices,1);
     77nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
     78noneflag=zeros(md.mesh.numberofelements,1);
     79
    8280%First modify stokesflag to get rid of elements contrained everywhere (spc + border with pattyn or macayeal)
    8381if any(stokesflag),
    84         nodeonstokes=zeros(md.mesh.numberofvertices,1);
    85         nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
    8682        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
    8783        fullspcelems=double(sum(fullspcnodes(md.mesh.elements),2)==6);         %find all the nodes on the boundary of the domain without icefront
    8884        stokesflag(find(fullspcelems))=0;
    89 end
    90 nodeonstokes=zeros(md.mesh.numberofvertices,1);
    91 nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
    92 
    93 %5: None elements
    94 noneflag=zeros(md.mesh.numberofelements,1);
     85        nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
     86end
    9587
    9688%Then complete with NoneApproximation or the other model used if there is no stokes
     
    139131                macayealflag(find(commonelements))=0; %these elements are now macayealpattynelements
    140132                macayealpattynflag(find(commonelements))=1;
    141                 nodeonmacayeal=zeros(md.mesh.numberofvertices,1);
     133                nodeonmacayeal(:)=0;
    142134                nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
    143135
     
    148140                list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:))  ,2),2);
    149141                pos1=find(list==1);
    150                 pattynflag(pos(pos1))=0;
    151142                macayealflag(pos(pos1))=1;
    152143                macayealpattynflag(pos(pos1))=0;
    153144                pos2=find(list==-1);
    154145                pattynflag(pos(pos2))=1;
    155                 macayealflag(pos(pos2))=0;
    156146                macayealpattynflag(pos(pos2))=0;
    157147
     148                %Recompute nodes associated to these elements
    158149                nodeonmacayeal(:)=0;
    159150                nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
     
    175166                nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
    176167
    177                 %Now recreate nodeonpattynstokes
    178                 nodeonpattynstokes=zeros(md.mesh.numberofvertices,1);
     168                %rule out elements that don't touch the 2 boundaries
     169                pos=find(pattynstokesflag);
     170                list=zeros(length(pos),1);
     171                list = list + any(sum(nodeonstokes(md.mesh.elements(pos,:)),2),2);
     172                list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:)),2),2);
     173                pos1=find(list==1);
     174                stokesflag(pos(pos1))=1;
     175                pattynstokesflag(pos(pos1))=0;
     176                pos2=find(list==-1);
     177                pattynflag(pos(pos2))=1;
     178                pattynstokesflag(pos(pos2))=0;
     179
     180                %Recompute nodes associated to these elements
     181                nodeonstokes(:)=0;
     182                nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
     183                nodeonpattyn(:)=0;
     184                nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1;
     185                nodeonpattynstokes(:)=0;
    179186                nodeonpattynstokes(md.mesh.elements(find(pattynstokesflag),:))=1;
     187
    180188        elseif any(stokesflag) & any(macayealflag),
    181189                %Find node at the border
     
    190198                nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
    191199
    192                 %Now recreate nodeonmacayealstokes
    193                 nodeonmacayealstokes=zeros(md.mesh.numberofvertices,1);
     200                %rule out elements that don't touch the 2 boundaries
     201                pos=find(macayealstokesflag);
     202                list=zeros(length(pos),1);
     203                list = list + any(sum(nodeonmacayeal(md.mesh.elements(pos,:)),2),2);
     204                list = list - any(sum(nodeonstokes(md.mesh.elements(pos,:))  ,2),2);
     205                pos1=find(list==1);
     206                macayealflag(pos(pos1))=1;
     207                macayealstokesflag(pos(pos1))=0;
     208                pos2=find(list==-1);
     209                stokesflag(pos(pos2))=1;
     210                macayealstokesflag(pos(pos2))=0;
     211
     212                %Recompute nodes associated to these elements
     213                nodeonmacayeal(:)=0;
     214                nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
     215                nodeonstokes(:)=0;
     216                nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
     217                nodeonmacayealstokes(:)=0;
    194218                nodeonmacayealstokes(md.mesh.elements(find(macayealstokesflag),:))=1;
     219
    195220        elseif any(stokesflag) & any(hutterflag),
    196221                error('type of coupling not supported yet');
Note: See TracChangeset for help on using the changeset viewer.