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