1 | function 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
|
---|
14 | if nargin==1,
|
---|
15 | packages=varargin{1};
|
---|
16 | else
|
---|
17 | packages={'macayeal','ice','cielo_serial','cielo_parallel'};
|
---|
18 | end
|
---|
19 | solutions={'diagnostic','prognostic'};
|
---|
20 |
|
---|
21 | %Initialize log message for nightly runs.
|
---|
22 | testname='IceSheetNoIceFrontHM2d_14';
|
---|
23 | tolerance=10^-12;
|
---|
24 |
|
---|
25 | %go through the solutions requested
|
---|
26 | for i=1:length(packages),
|
---|
27 | package=packages{i};
|
---|
28 |
|
---|
29 | for j=1:length(solutions),
|
---|
30 | solution=solutions{j};
|
---|
31 |
|
---|
32 | %check solution requested
|
---|
33 | if ((strcmpi(package,'cielo_parallel') & strcmpi(solution,'diagnostic'))| strcmpi(solution,'transient') | strcmpi(package,'macayeal')),
|
---|
34 | disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
|
---|
35 | continue
|
---|
36 | end
|
---|
37 |
|
---|
38 | %initialize model
|
---|
39 | md=model;
|
---|
40 | md=mesh(md,'DomainOutline.exp',50000);
|
---|
41 | md=geography(md,'','');
|
---|
42 | md=parameterize(md,'Square.par');
|
---|
43 | md=setelementstype(md,'hutter','Hutter.exp','fill','MacAyeal');
|
---|
44 | if md.numberofgrids==388
|
---|
45 | load Velocities; md.vx=0.5*vx; md.vy=0.5*vy;
|
---|
46 | end
|
---|
47 |
|
---|
48 | %compute solution
|
---|
49 | [analysis_type sub_analysis_type]=testsgetanalysis(solution);
|
---|
50 | [md packagefinal]=testsgetpackage(md,package);
|
---|
51 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
|
---|
52 |
|
---|
53 | %compute fields to be checked
|
---|
54 | fields=testsgetfields(md.type,solution);
|
---|
55 |
|
---|
56 | %load archive
|
---|
57 | eval(['load Archive' package solution ]);
|
---|
58 |
|
---|
59 | for k=1:length(fields),
|
---|
60 | field=fields{k};
|
---|
61 |
|
---|
62 | %compare to archive
|
---|
63 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
64 | eval(['error_diff=full(max(abs(Archive-md.results.' field '))/max(abs(Archive)));']);
|
---|
65 |
|
---|
66 | %disp test result
|
---|
67 | if (error_diff>tolerance);
|
---|
68 | disp(sprintf(['\n\nERROR (difference=%-7.2g > %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
69 | else
|
---|
70 | disp(sprintf(['\n\nSUCCESS (difference=%-7.2g < %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
71 | end
|
---|
72 |
|
---|
73 | end
|
---|
74 | end
|
---|
75 | end
|
---|