[482] | 1 | function runme(varargin)
|
---|
[143] | 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 |
|
---|
[482] | 13 | %packages and analysis_types to be tested
|
---|
| 14 | if nargin==1,
|
---|
| 15 | packages=varargin{1};
|
---|
| 16 | else
|
---|
[625] | 17 | packages={'macayeal','ice','cielo_serial','cielo_parallel'};
|
---|
[482] | 18 | end
|
---|
[756] | 19 | solutions={'diagnostic','prognostic','transient'};
|
---|
[143] | 20 |
|
---|
| 21 | %Initialize log message for nightly runs.
|
---|
| 22 | testname='IceSheetNoIceFrontHM2d_14';
|
---|
| 23 |
|
---|
| 24 | %go through the solutions requested
|
---|
| 25 | for i=1:length(packages),
|
---|
| 26 | package=packages{i};
|
---|
| 27 |
|
---|
| 28 | for j=1:length(solutions),
|
---|
| 29 | solution=solutions{j};
|
---|
| 30 |
|
---|
| 31 | %check solution requested
|
---|
[756] | 32 | if ((~strcmpi(package,'ice') & strcmpi(solution,'transient'))...
|
---|
| 33 | | strcmpi(package,'macayeal')),
|
---|
[143] | 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
|
---|
[519] | 49 | [analysis_type sub_analysis_type]=testsgetanalysis(solution);
|
---|
| 50 | [md packagefinal]=testsgetpackage(md,package);
|
---|
[520] | 51 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
|
---|
[143] | 52 |
|
---|
[519] | 53 | %compute fields to be checked
|
---|
| 54 | fields=testsgetfields(md.type,solution);
|
---|
[143] | 55 |
|
---|
| 56 | %load archive
|
---|
| 57 | eval(['load Archive' package solution ]);
|
---|
| 58 |
|
---|
[148] | 59 | for k=1:length(fields),
|
---|
[777] | 60 |
|
---|
| 61 | %Get field and tolerance
|
---|
[148] | 62 | field=fields{k};
|
---|
[777] | 63 | tolerance=testsgettolerance(md,package,solution,field);
|
---|
[143] | 64 |
|
---|
[148] | 65 | %compare to archive
|
---|
| 66 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
[745] | 67 | eval(['error_diff=full(max(abs(Archive-md.results.' field '))/(max(abs(Archive))+eps));']);
|
---|
[148] | 68 |
|
---|
| 69 | %disp test result
|
---|
| 70 | if (error_diff>tolerance);
|
---|
[259] | 71 | disp(sprintf(['\n\nERROR (difference=%-7.2g > %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[148] | 72 | else
|
---|
[259] | 73 | disp(sprintf(['\n\nSUCCESS (difference=%-7.2g < %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[148] | 74 | end
|
---|
| 75 |
|
---|
[143] | 76 | end
|
---|
| 77 | end
|
---|
| 78 | end
|
---|