Changeset 9001


Ignore:
Timestamp:
07/14/11 16:31:16 (14 years ago)
Author:
Mathieu Morlighem
Message:

updated consistency for surfacemassbalance

File:
1 edited

Legend:

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

    r8930 r9001  
    9595%}}}
    9696%SIZE NUMBEROFNODES {{{1
    97 fields={'x','y','z','rheology_B','drag_coefficient','basal_melting_rate','surface_mass_balance','surface','thickness','bed','nodeonbed','nodeonsurface'};
     97fields={'x','y','z','rheology_B','drag_coefficient','basal_melting_rate','surface','thickness','bed','nodeonbed','nodeonsurface'};
    9898checksize(md,fields,[md.numberofnodes 1]);
    9999%}}}
     
    295295        if ~ismember(md.isthermal,[0 1]),
    296296                message('model not consistent: isthermal should be a scalar (1 or 0)');
    297         end
    298 
    299         %Check that all forcings have length numberofnodes+1
    300         forcingnames=fieldnames(md.forcings);
    301         forcingfields={};
    302         for i=1:length(forcingnames),
    303                 forcingfields{end+1}=['forcings.' forcingnames{i}];
    304         end
    305         checksize(md,forcingfields,[md.numberofnodes+1 NaN])
    306 
    307         %Check that forcing columns are properly ordered
    308         for i=1:length(forcingnames),
    309                 if any(md.forcings.(forcingnames{i})(end,:)~=sort(md.forcings.(forcingnames{i})(end,:))),
    310                         message(['model not consistent: model ' md.name ' forcings.' forcingnames{i} ' columns should be chronological']);
    311                 end
    312                 if any(md.forcings.(forcingnames{i})(end,1:end-1)==md.forcings.(forcingnames{i})(end,2:end)),
    313                         message(['model not consistent: model ' md.name ' forcings.' forcingnames{i} ' columns must not contain duplicate timesteps']);
    314                 end
    315297        end
    316298end
     
    744726end
    745727%}}}
     728%checkforcing {{{1
     729function checkforcing(md,fieldname)
     730
     731        eval(['field=md.' fieldname ';']);
     732        checksize(md,{fieldname},[md.numberofnodes+1 NaN])
     733
     734        if any(field(end,:)~=sort(field(end,:))),
     735                message(['model not consistent: model ' md.name ': ' fieldname ' columns should be chronological']);
     736        end
     737        if any(field(end,1:end-1)==field(end,2:end)),
     738                message(['model not consistent: model ' md.name ': ' fieldname ' columns must not contain duplicate timesteps']);
     739        end
     740end
     741%}}}
    746742
    747743%error messages
Note: See TracChangeset for help on using the changeset viewer.