1 | % This file can be run to check that the current version of macayeal and issm models are 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^-14. 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 | %Initialize log message for nightly runs.
|
---|
13 | logstring='Verification/test1_icesheet_noicefront: ';
|
---|
14 |
|
---|
15 | % Create model;
|
---|
16 |
|
---|
17 | tolerance=10^-13;
|
---|
18 |
|
---|
19 |
|
---|
20 | md=model;
|
---|
21 | md=mesh(md,'DomainOutline.exp',50000);
|
---|
22 | md=geography(md,'','');
|
---|
23 | md=parameterize(md,'Square.par');
|
---|
24 | md=setelementstype(md,'macayeal','all');
|
---|
25 |
|
---|
26 | %Compute solution with MacAyeal's model
|
---|
27 | md=solve(md,'diagnostic','macayeal');
|
---|
28 | vel_macayeal=md.vel;
|
---|
29 |
|
---|
30 | %Compute solution with Ice model
|
---|
31 | md=solve(md,'diagnostic','ice');
|
---|
32 | vel_ice=md.vel;
|
---|
33 |
|
---|
34 | %Compute solution with Hutter elements in Ice model
|
---|
35 | md=setelementstype(md,'hutter','all');
|
---|
36 | md=solve(md,'diagnostic','ice');
|
---|
37 | vel_hutter=md.vel;
|
---|
38 |
|
---|
39 |
|
---|
40 | %Load old velocities and compare with the new model
|
---|
41 |
|
---|
42 | %Macayeal
|
---|
43 | load archive_macayeal
|
---|
44 | pos=find(archive_macayeal-vel_macayeal);
|
---|
45 | error_vel=abs(norm((archive_macayeal(pos)-vel_macayeal(pos))./archive_macayeal(pos),2));
|
---|
46 |
|
---|
47 | disp(sprintf('numerical difference between old and new version of MacAyeal is : %d', error_vel));
|
---|
48 |
|
---|
49 | if (error_vel>tolerance);
|
---|
50 | logoutput(logstring,sprintf('%s\n',' ERROR. Results from MacAyeal model differ from the archive version'));
|
---|
51 | else
|
---|
52 | logoutput(logstring,sprintf('%s\n',' SUCCESS. Results from MacAyeal model are comform with the archive version'));
|
---|
53 | end
|
---|
54 |
|
---|
55 | %Ice
|
---|
56 | load archive_ice
|
---|
57 | pos=find(archive_ice-vel_ice);
|
---|
58 | error_vel=abs(norm((archive_ice(pos)-vel_ice(pos))./archive_ice(pos),2));
|
---|
59 |
|
---|
60 | disp(sprintf('numerical difference between old and new version of Ice is : %d', error_vel));
|
---|
61 |
|
---|
62 | if (error_vel>tolerance);
|
---|
63 | logoutput(logstring,sprintf('%s\n',' ERROR. Results from Ice model differ from the archive version'));
|
---|
64 | else
|
---|
65 | logoutput(logstring,sprintf('%s\n',' SUCCESS. Results from Ice model are comform with the archive version'));
|
---|
66 | end
|
---|
67 |
|
---|
68 | %Ice with Hutter elements
|
---|
69 | load archive_hutter
|
---|
70 | pos=find(archive_hutter-vel_hutter);
|
---|
71 | error_vel=abs(norm((archive_hutter(pos)-vel_hutter(pos))./archive_hutter(pos),2));
|
---|
72 |
|
---|
73 | disp(sprintf('numerical difference between old and new version of Ice is : %d', error_vel));
|
---|
74 |
|
---|
75 | if (error_vel>tolerance);
|
---|
76 | logoutput(logstring,sprintf('%s\n',' ERROR. Results from Ice model with Hutter elements differ from the archive version'));
|
---|
77 | else
|
---|
78 | logoutput(logstring,sprintf('%s\n',' SUCCESS. Results from Ice model with Hutter elements are comform with the archive version'));
|
---|
79 | end
|
---|
80 |
|
---|