source: issm/trunk/test/Verification/IceSheetNoIceFrontM2d_16/runme.m@ 482

Last change on this file since 482 was 482, checked in by Mathieu Morlighem, 16 years ago

Now each package can be tested independentely

  • Property svn:executable set to *
File size: 3.2 KB
RevLine 
[482]1function runme(varargin)
[123]2% This file can be run to check that the current version of issm is giving
[16]3% coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry
[44]4% is square. Just run this file in Matlab, with a properly setup ISSM code.
[16]5% The results of this test will indicate if there is a difference between current computations
6% and archived results.
7
8% Errors between archived results and the current version will get flagged if they are not within
[123]9% a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this
[16]10% tolerance should be lowered (for example, if you are running single precision compilers?), feel
11% free to tweak the tolerance variable.
12
[482]13%packages and analysis_types to be tested
14if nargin==1,
15 packages=varargin{1};
16else
17 packages={'macayeal','ice','cielo_serial'};
18end
[123]19solutions={'diagnostic','prognostic'};
[115]20
[16]21%Initialize log message for nightly runs.
[123]22testname='IceSheetNoIceFrontM2d_16';
[115]23tolerance=10^-12;
[16]24
[115]25%go through the solutions requested
26for i=1:length(packages),
27 package=packages{i};
[16]28
[123]29 for j=1:length(solutions),
30 solution=solutions{j};
[16]31
[123]32 %check package
33 if ~(strcmpi(package,'macayeal') | strcmpi(package,'ice') | strcmpi(package,'cielo_serial') | strcmpi(package,'cielo_parallel'));
34 error(['package: ' package ' in test: ' testname ' not supported yet']);
35 %check solution
36 elseif ~(strcmpi(solution,'diagnostic') | strcmpi(solution,'prognostic'));
37 error(['solution: ' solution ' in test: ' testname ' not supported yet']);
38 end
39 %check solution requested
40 if (~strcmpi(package,'ice') & strcmpi(solution,'prognostic')),
41 disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
42 continue
43 end
[16]44
[123]45 %initialize model
46 md=model;
47 md=mesh(md,'DomainOutline.exp',50000);
48 md=geography(md,'','');
49 md=parameterize(md,'Square.par');
50 md=setelementstype(md,'macayeal','all');
51 if strcmpi(package,'cielo_parallel'), md.cluster='wilkes'; end
52 if md.numberofgrids==388
53 load Velocities; md.vx=0.5*vx; md.vy=0.5*vy;
[115]54 end
[16]55
[123]56 %compute solution
[451]57 if (strcmpi(package,'cielo_serial') | strcmpi(package,'cielo_parallel')),
[467]58 md=solve(md,'analysis_type',solution,'package','cielo');
[115]59 else
[467]60 md=solve(md,'analysis_type',solution,'package',package);
[115]61 end
[16]62
[123]63 %compute field to be checked
64 if strcmpi(solution,'diagnostic'),
[147]65 fields={'vel'};
[123]66 elseif strcmpi(solution,'prognostic'),
[147]67 fields={'new_thickness'};
[115]68 end
[16]69
[123]70 %load archive
71 eval(['load Archive' package solution ]);
[16]72
[147]73 for k=1:length(fields),
74 field=fields{k};
[123]75
[147]76 %compare to archive
77 eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
78 eval(['error_diff=abs(norm((Archive(find(Archive))-md.' field '(find(Archive)))./Archive(find(Archive)),2));']);
79
80 %disp test result
81 if (error_diff>tolerance);
[259]82 disp(sprintf(['\n\nERROR (difference=%-7.2g > %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
[147]83 else
[259]84 disp(sprintf(['\n\nSUCCESS (difference=%-7.2g < %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
[147]85 end
86
[115]87 end
88 end
[16]89end
Note: See TracBrowser for help on using the repository browser.