Changeset 146


Ignore:
Timestamp:
04/30/09 08:11:54 (16 years ago)
Author:
seroussi
Message:

new Archives and rum to allow the comparison of several fields

Location:
issm/trunk/test/Verification/IceSheetNoIceFrontH2d_12
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/test/Verification/IceSheetNoIceFrontH2d_12/runme.m

    r141 r146  
    6060                %compute field to be checked
    6161                if strcmpi(solution,'diagnostic'),
    62                         fieldtest=md.vel;
     62                        fields={'vel'};
    6363                elseif strcmpi(solution,'prognostic'),
    64                         fieldtest=md.new_thickness';
     64                        fields={'new_thickness'};
    6565                end
    6666
     
    6868                eval(['load Archive' package solution ]);
    6969
    70                 %compare to archive
    71                 eval(['pos=find(Archive' package solution ');']);
    72                 eval(['error_diff=abs(norm((Archive' package solution '(pos)-fieldtest(pos))./Archive' package solution '(pos),2));']);
     70                for k=1:length(fields),
     71                        field=fields{k};
    7372
    74                 %disp test result
    75                 if (error_diff>tolerance);
    76                         disp(sprintf(['\n\nERROR (difference = %8.3g > %g)   --->   test: ' testname ', solution: ' solution  ', package: ' package '.\n\n'],error_diff,tolerance));
    77                 else
    78                         disp(sprintf(['\n\nSUCCESS (difference = %8.3g < %g)   --->   test: ' testname ', solution: ' solution  ', package: ' package '.\n\n'],error_diff,tolerance));
     73                        %compare to archive
     74                        eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
     75                        eval(['error_diff=abs(norm((Archive(find(Archive))-md.' field  '(find(Archive)))./Archive(find(Archive)),2));']);
     76
     77                        %disp test result
     78                        if (error_diff>tolerance);
     79                                disp(sprintf(['\n\nERROR (difference = %8.3g > %g)   --->   test: ' testname ', solution: ' solution  ', package: ' package ', field tested: ' field  '.\n\n'],error_diff,tolerance));
     80                        else
     81                                disp(sprintf(['\n\nSUCCESS (difference = %8.3g < %g)   --->   test: ' testname ', solution: ' solution  ', package: ' package ', field tested: ' field  '.\n\n'],error_diff,tolerance));
     82                        end
     83
    7984                end
    8085        end
  • issm/trunk/test/Verification/IceSheetNoIceFrontH2d_12/updatearchive.m

    r141 r146  
    5151                end
    5252
     53                %field to be saved
     54                if strcmpi(solution,'diagnostic'),
     55                        fields={'vel'};
     56                elseif strcmpi(solution,'prognostic'),
     57                        fields={'new_thickness'};
     58                end
     59
    5360                %save new archive
    54                 if strcmpi(solution,'diagnostic'),
    55                         fieldtest=md.vel;
    56                 elseif strcmpi(solution,'prognostic'),
    57                         fieldtest=md.new_thickness';
     61                for k=1:length(fields),
     62                        field=fields{k};
     63                        eval(['Archive' package solution '_field' num2str(k) '=md.' field  ';']);
    5864                end
    59                 eval(['Archive' package solution '=fieldtest;']);
    60                 eval(['save Archive' package solution ' Archive' package solution]);
     65                eval(['save Archive' package solution ' Archive' package solution '_field*']);
    6166        end
    6267end
Note: See TracChangeset for help on using the changeset viewer.