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
Line 
1function runme(varargin)
2% This file can be run to check that the current version of issm is giving
3% coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry
4% is square. Just run this file in Matlab, with a properly setup ISSM code.
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
9% a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this
10% tolerance should be lowered (for example, if you are running single precision compilers?), feel
11% free to tweak the tolerance variable.
12
13%packages and analysis_types to be tested
14if nargin==1,
15 packages=varargin{1};
16else
17 packages={'macayeal','ice','cielo_serial'};
18end
19solutions={'diagnostic','prognostic'};
20
21%Initialize log message for nightly runs.
22testname='IceSheetNoIceFrontM2d_16';
23tolerance=10^-12;
24
25%go through the solutions requested
26for i=1:length(packages),
27 package=packages{i};
28
29 for j=1:length(solutions),
30 solution=solutions{j};
31
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
44
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;
54 end
55
56 %compute solution
57 if (strcmpi(package,'cielo_serial') | strcmpi(package,'cielo_parallel')),
58 md=solve(md,'analysis_type',solution,'package','cielo');
59 else
60 md=solve(md,'analysis_type',solution,'package',package);
61 end
62
63 %compute field to be checked
64 if strcmpi(solution,'diagnostic'),
65 fields={'vel'};
66 elseif strcmpi(solution,'prognostic'),
67 fields={'new_thickness'};
68 end
69
70 %load archive
71 eval(['load Archive' package solution ]);
72
73 for k=1:length(fields),
74 field=fields{k};
75
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);
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));
83 else
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));
85 end
86
87 end
88 end
89end
Note: See TracBrowser for help on using the repository browser.