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 with icefront for a 3d 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','cielo_parallel'};
|
---|
14 | solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'};
|
---|
15 |
|
---|
16 | %Initialize log message for nightly runs.
|
---|
17 | testname='IceShelfIceFrontM3d_2';
|
---|
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,'thermalsteady') | strcmpi(solution,'thermaltransient') |...
|
---|
32 | strcmpi(solution,'prognostic') | strcmpi(solution,'transient'));
|
---|
33 | error(['solution: ' solution ' in test: ' testname ' not supported yet']);
|
---|
34 | end
|
---|
35 | %check solution requested
|
---|
36 | if (~strcmpi(package,'ice') | strcmpi(solution,'transient')),
|
---|
37 | disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
|
---|
38 | continue
|
---|
39 | end
|
---|
40 |
|
---|
41 | %initialize model
|
---|
42 | md=model;
|
---|
43 | md=mesh(md,'DomainOutline.exp',100000);
|
---|
44 | md=geography(md,'all','');
|
---|
45 | md=parameterize(md,'Square.par');
|
---|
46 | md=extrude(md,8,4);
|
---|
47 | md=setelementstype(md,'macayeal','all');
|
---|
48 | if strcmpi(package,'cielo_parallel'), md.cluster='wilkes'; end
|
---|
49 | if md.numberofgrids==832
|
---|
50 | load Velocities; md.vx=0.8*vx; md.vy=0.8*vy; md.vz=0.8*vz; md.temperature=temperature-1; md.pressure=pressure;
|
---|
51 | end
|
---|
52 |
|
---|
53 | %compute solution
|
---|
54 | if strcmpi(package,'cielo_parallel') & strcmpi(solution,'diagnostic'),
|
---|
55 | md=solve(md,'diagnostic_horiz','cielo');
|
---|
56 | elseif strcmpi(package,'cielo_serial'),
|
---|
57 | eval(['md=solve(md,''' solution ''',''cielo'');']);
|
---|
58 | else
|
---|
59 | eval(['md=solve(md,''' solution ''',''' package ''');']);
|
---|
60 | end
|
---|
61 |
|
---|
62 | %compute field to be checked
|
---|
63 | if strcmpi(solution,'diagnostic'),
|
---|
64 | fields={'vy','vz'};
|
---|
65 | elseif strcmpi(solution,'thermalsteady'),
|
---|
66 | fields={'temperature','melting'};
|
---|
67 | elseif strcmpi(solution,'thermaltransient'),
|
---|
68 | fields={'thermaltransient_results(end).temperature','thermaltransient_results(end).melting'};
|
---|
69 | elseif strcmpi(solution,'prognostic'),
|
---|
70 | fields={'new_thickness'};
|
---|
71 | elseif strcmpi(solution,'transient'),
|
---|
72 | fields={'transient_results(end).vy','transient_results(end).vz','transient_results(end).temperature','transient_results(end).melting','transient_results(end).thickness'};
|
---|
73 | end
|
---|
74 |
|
---|
75 | %load archive
|
---|
76 | eval(['load Archive' package solution ]);
|
---|
77 |
|
---|
78 | for k=1:length(fields),
|
---|
79 | field=fields{k};
|
---|
80 |
|
---|
81 | %compare to archive
|
---|
82 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
83 | eval(['error_diff=abs(norm((Archive(find(Archive))-md.' field '(find(Archive)))./Archive(find(Archive)),2));']);
|
---|
84 |
|
---|
85 | %disp test result
|
---|
86 | if (error_diff>tolerance);
|
---|
87 | disp(sprintf(['\n\nERROR (difference = %8.3g > %g) ---> test: ' testname ', solution: ' solution ', package: ' package ', field tested: ' field '.\n\n'],error_diff,tolerance));
|
---|
88 | else
|
---|
89 | disp(sprintf(['\n\nSUCCESS (difference = %8.3g < %g) ---> test: ' testname ', solution: ' solution ', package: ' package ', field tested: ' field '.\n\n'],error_diff,tolerance));
|
---|
90 | end
|
---|
91 |
|
---|
92 | end
|
---|
93 | end
|
---|
94 | end
|
---|