[123] | 1 | % This file can be run to check that the current version of issm is giving
|
---|
[16] | 2 | % coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry
|
---|
[44] | 3 | % is square. Just run this file in Matlab, with a properly setup ISSM code.
|
---|
[16] | 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
|
---|
[123] | 8 | % a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this
|
---|
[16] | 9 | % tolerance should be lowered (for example, if you are running single precision compilers?), feel
|
---|
| 10 | % free to tweak the tolerance variable.
|
---|
| 11 |
|
---|
[115] | 12 | %packages and solutions to be tested
|
---|
| 13 | packages={'macayeal','ice','cielo_serial','cielo_parallel'};
|
---|
[123] | 14 | solutions={'diagnostic','prognostic'};
|
---|
[115] | 15 |
|
---|
[16] | 16 | %Initialize log message for nightly runs.
|
---|
[123] | 17 | testname='IceSheetNoIceFrontM2d_16';
|
---|
[115] | 18 | tolerance=10^-12;
|
---|
[16] | 19 |
|
---|
[115] | 20 | %go through the solutions requested
|
---|
| 21 | for i=1:length(packages),
|
---|
| 22 | package=packages{i};
|
---|
[16] | 23 |
|
---|
[123] | 24 | for j=1:length(solutions),
|
---|
| 25 | solution=solutions{j};
|
---|
[16] | 26 |
|
---|
[123] | 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
|
---|
[16] | 39 |
|
---|
[123] | 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;
|
---|
[115] | 49 | end
|
---|
[16] | 50 |
|
---|
[123] | 51 | %compute solution
|
---|
| 52 | if strcmpi(package,'cielo_parallel') & strcmpi(solution,'diagnostic'),
|
---|
| 53 | md=solve(md,'diagnostic_horiz','cielo');
|
---|
| 54 | elseif strcmpi(package,'cielo_serial'),
|
---|
| 55 | eval(['md=solve(md,''' solution ''',''cielo'');']);
|
---|
[115] | 56 | else
|
---|
[123] | 57 | eval(['md=solve(md,''' solution ''',''' package ''');']);
|
---|
[115] | 58 | end
|
---|
[16] | 59 |
|
---|
[123] | 60 | %compute field to be checked
|
---|
| 61 | if strcmpi(solution,'diagnostic'),
|
---|
| 62 | fieldtest=md.vel;
|
---|
| 63 | elseif strcmpi(solution,'prognostic'),
|
---|
| 64 | fieldtest=md.new_thickness';
|
---|
[115] | 65 | end
|
---|
[16] | 66 |
|
---|
[123] | 67 | %load archive
|
---|
| 68 | eval(['load Archive' package solution ]);
|
---|
[16] | 69 |
|
---|
[123] | 70 | %compare to archive
|
---|
| 71 | eval(['pos=find(Archive' package solution ');']);
|
---|
| 72 | eval(['error_diff=abs(norm((Archive' package solution '(pos)-fieldtest(pos))./Archive' package solution '(pos),2));']);
|
---|
| 73 |
|
---|
| 74 | %disp test result
|
---|
| 75 | if (error_diff>tolerance);
|
---|
| 76 | disp(['test: ' testname ', solution: ' solution ', package: ' package ' -> ERROR (difference=' num2str(error_diff) ' > ' num2str(tolerance) ')'])
|
---|
[115] | 77 | else
|
---|
[123] | 78 | disp(['test: ' testname ', solution: ' solution ', package: ' package ' -> SUCCESS (difference=' num2str(error_diff) ' < ' num2str(tolerance) ')'])
|
---|
[115] | 79 | end
|
---|
| 80 | end
|
---|
[16] | 81 | end
|
---|