Changeset 9840


Ignore:
Timestamp:
09/19/11 14:24:27 (14 years ago)
Author:
jschierm
Message:

Fix errors in model.structtomodel for conversion of older models.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/model/model.m

    r9786 r9840  
    133133                         if isfield(structmd,'accumulation'), md.surfaceforcings.mass_balance=structmd.accumulation; end
    134134                         if isfield(structmd,'accumulation_rate'), md.surfaceforcings.mass_balance=structmd.accumulation_rate; end
    135                          if isfield(structmd,'numberofgrids'), md.mesh.numberofverticess=structmd.numberofgrids; end
    136                          if isfield(structmd,'numberofgrids2d'), md.mesh.numberofverticess2d=structmd.numberofgrids2d; end
    137                          if isfield(structmd,'uppergrids'), md.uppernodes=structmd.uppergrids; end
    138                          if isfield(structmd,'lowergrids'), md.lowernodes=structmd.lowergrids; end
    139                          if isfield(structmd,'gridonbed'), md.nodeonbed=structmd.gridonbed; end
    140                          if isfield(structmd,'gridonsurface'), md.nodeonsurface=structmd.gridonsurface; end
     135                         if isfield(structmd,'numberofgrids'), md.mesh.numberofvertices=structmd.numberofgrids; end
     136                         if isfield(structmd,'numberofgrids2d'), md.mesh.numberofvertices2d=structmd.numberofgrids2d; end
     137                         if isfield(structmd,'uppergrids'), md.mesh.uppervertex=structmd.uppergrids; end
     138                         if isfield(structmd,'lowergrids'), md.mesh.lowervertex=structmd.lowergrids; end
     139                         if isfield(structmd,'gridonbed'), md.mesh.vertexonbed=structmd.gridonbed; end
     140                         if isfield(structmd,'gridonsurface'), md.mesh.vertexonsurface=structmd.gridonsurface; end
    141141                         if isfield(structmd,'extractedgrids'), md.mesh.extractedvertices=structmd.extractedgrids; end
    142142                         if isfield(structmd,'gridoniceshelf'), md.mask.vertexonfloatingice=structmd.gridoniceshelf; end
     
    205205                         if isfield(structmd,'ishutter'), md.flowequation.ishutter=structmd.ishutter; end
    206206                         if isfield(structmd,'isstokes'), md.flowequation.isstokes=structmd.isstokes; end
    207                          if isfield(structmd,'elements_type'), md.flowequation.element_equation=structmd.mesh.elements_type; end
     207                         if isfield(structmd,'elements_type'), md.flowequation.element_equation=structmd.elements_type; end
    208208                         if isfield(structmd,'vertices_type'), md.flowequation.vertex_equation=structmd.vertices_type; end
    209209                         if isfield(structmd,'eps_rel'), md.steadystate.reltol=structmd.eps_rel; end
     
    260260                         if isfield(structmd,'nodeonsurface'), md.mesh.vertexonsurface=structmd.nodeonsurface; end
    261261                         if isfield(structmd,'nodeonbed'), md.mesh.vertexonbed=structmd.nodeonbed; end
    262                          if isfield(structmd,'elements2d'), md.mesh.elements2d=structmd.mesh.elements2d; end
     262                         if isfield(structmd,'elements2d'), md.mesh.elements2d=structmd.elements2d; end
    263263                         if isfield(structmd,'y2d'), md.mesh.y2d=structmd.y2d; end
    264264                         if isfield(structmd,'x2d'), md.mesh.x2d=structmd.x2d; end
    265                          if isfield(structmd,'elements'), md.mesh.elements=structmd.mesh.elements; end
    266                          if isfield(structmd,'edges'), md.mesh.edges=structmd.mesh.edges; end
     265                         if isfield(structmd,'elements'), md.mesh.elements=structmd.elements; end
     266                         if isfield(structmd,'edges'), md.mesh.edges=structmd.edges; end
    267267                         if isfield(structmd,'y'), md.mesh.y=structmd.y; end
    268268                         if isfield(structmd,'x'), md.mesh.x=structmd.x; end
     
    278278                         end
    279279                         if isfield(structmd,'spcvelocity'),
    280                                  md.spcvx=NaN*ones(md.mesh.numberofvertices,1);
    281                                  md.spcvy=NaN*ones(md.mesh.numberofvertices,1);
    282                                  md.spcvz=NaN*ones(md.mesh.numberofvertices,1);
    283                                  pos=find(structmd.spcvelocity(:,1)); md.spcvx(pos)=structmd.spcvelocity(pos,4);
    284                                  pos=find(structmd.spcvelocity(:,2)); md.spcvy(pos)=structmd.spcvelocity(pos,5);
    285                                  pos=find(structmd.spcvelocity(:,3)); md.spcvz(pos)=structmd.spcvelocity(pos,6);
     280                                 md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1);
     281                                 md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
     282                                 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
     283                                 pos=find(structmd.spcvelocity(:,1)); md.diagnostic.spcvx(pos)=structmd.spcvelocity(pos,4);
     284                                 pos=find(structmd.spcvelocity(:,2)); md.diagnostic.spcvy(pos)=structmd.spcvelocity(pos,5);
     285                                 pos=find(structmd.spcvelocity(:,3)); md.diagnostic.spcvz(pos)=structmd.spcvelocity(pos,6);
    286286                         end
    287287                         if isfield(structmd,'spcvelocity'),
    288                                  md.spcvx=NaN*ones(md.numberofnodes,1);
    289                                  md.spcvy=NaN*ones(md.numberofnodes,1);
    290                                  md.spcvz=NaN*ones(md.numberofnodes,1);
    291                                  pos=find(structmd.spcvelocity(:,1)); md.spcvx(pos)=structmd.spcvelocity(pos,4);
    292                                  pos=find(structmd.spcvelocity(:,2)); md.spcvy(pos)=structmd.spcvelocity(pos,5);
    293                                  pos=find(structmd.spcvelocity(:,3)); md.spcvz(pos)=structmd.spcvelocity(pos,6);
     288                                 md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1);
     289                                 md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
     290                                 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
     291                                 pos=find(structmd.spcvelocity(:,1)); md.diagnostic.spcvx(pos)=structmd.spcvelocity(pos,4);
     292                                 pos=find(structmd.spcvelocity(:,2)); md.diagnostic.spcvy(pos)=structmd.spcvelocity(pos,5);
     293                                 pos=find(structmd.spcvelocity(:,3)); md.diagnostic.spcvz(pos)=structmd.spcvelocity(pos,6);
    294294                         end
    295295                         if ismember(structmd.pressureload(end,end),[118 119 120]),
     
    298298                                 pos=find(structmd.pressureload(:,end)==119); md.pressureload(pos,end)=2;
    299299                         end
    300                          if (structmd.mesh.elements_type(end,end)>100),
    301                                  pos=find(structmd.mesh.elements_type==59); md.mesh.elements_type(pos,end)=0;
    302                                  pos=find(structmd.mesh.elements_type==55); md.mesh.elements_type(pos,end)=1;
    303                                  pos=find(structmd.mesh.elements_type==56); md.mesh.elements_type(pos,end)=2;
    304                                  pos=find(structmd.mesh.elements_type==60); md.mesh.elements_type(pos,end)=3;
    305                                  pos=find(structmd.mesh.elements_type==62); md.mesh.elements_type(pos,end)=4;
    306                                  pos=find(structmd.mesh.elements_type==57); md.mesh.elements_type(pos,end)=5;
    307                                  pos=find(structmd.mesh.elements_type==58); md.mesh.elements_type(pos,end)=6;
    308                                  pos=find(structmd.mesh.elements_type==61); md.mesh.elements_type(pos,end)=7;
     300                         if (structmd.elements_type(end,end)>100),
     301                                 pos=find(structmd.elements_type==59); md.mesh.elements_type(pos,end)=0;
     302                                 pos=find(structmd.elements_type==55); md.mesh.elements_type(pos,end)=1;
     303                                 pos=find(structmd.elements_type==56); md.mesh.elements_type(pos,end)=2;
     304                                 pos=find(structmd.elements_type==60); md.mesh.elements_type(pos,end)=3;
     305                                 pos=find(structmd.elements_type==62); md.mesh.elements_type(pos,end)=4;
     306                                 pos=find(structmd.elements_type==57); md.mesh.elements_type(pos,end)=5;
     307                                 pos=find(structmd.elements_type==58); md.mesh.elements_type(pos,end)=6;
     308                                 pos=find(structmd.elements_type==61); md.mesh.elements_type(pos,end)=7;
    309309                         end
    310310                         if isfield(structmd,'rheology_law') & isnumeric(structmd.rheology_law),
     
    345345                         end
    346346                         if ~isfield(structmd,'diagnostic_ref');
    347                                  md.diagnostic_ref=NaN*ones(md.mesh.numberofvertices2d,6);
     347                                 md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices2d,6);
    348348                         end
    349349                 end% }}}
Note: See TracChangeset for help on using the changeset viewer.