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 with icefront for a 3d 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'};
|
---|
18 | end
|
---|
19 | solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'};
|
---|
20 |
|
---|
21 | %Initialize log message for nightly runs.
|
---|
22 | testname='IceShelfIceFrontM3d_2';
|
---|
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,'ice') | strcmpi(solution,'diagnostic')) | strcmpi(solution,'transient')),
|
---|
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',100000);
|
---|
41 | md=geography(md,'all','');
|
---|
42 | md=parameterize(md,'Square.par');
|
---|
43 | md=extrude(md,8,4);
|
---|
44 | md=setelementstype(md,'macayeal','all');
|
---|
45 | if strcmpi(package,'cielo_parallel'), md.cluster='wilkes'; end
|
---|
46 | if md.numberofgrids==832
|
---|
47 | load Velocities; md.vx=0.8*vx; md.vy=0.8*vy; md.vz=0.8*vz; md.temperature=temperature-1; md.pressure=pressure;
|
---|
48 | end
|
---|
49 |
|
---|
50 | %compute solution
|
---|
51 | if (strcmpi(package,'cielo_serial') | strcmpi(package,'cielo_parallel')),
|
---|
52 | md=solve(md,'analysis_type',solution,'package','cielo');
|
---|
53 | else
|
---|
54 | md=solve(md,'analysis_type',solution,'package',package);
|
---|
55 | end
|
---|
56 |
|
---|
57 | %compute field to be checked
|
---|
58 | if strcmpi(solution,'diagnostic'),
|
---|
59 | fields={'vy','vz'};
|
---|
60 | elseif strcmpi(solution,'thermalsteady'),
|
---|
61 | fields={'temperature','melting'};
|
---|
62 | elseif strcmpi(solution,'thermaltransient'),
|
---|
63 | fields={'thermaltransient_results(end).temperature','thermaltransient_results(end).melting'};
|
---|
64 | elseif strcmpi(solution,'prognostic'),
|
---|
65 | fields={'new_thickness'};
|
---|
66 | elseif strcmpi(solution,'transient'),
|
---|
67 | fields={'transient_results(end).vy','transient_results(end).vz','transient_results(end).temperature','transient_results(end).melting','transient_results(end).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
|
---|
89 | end
|
---|