[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 | 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
|
---|
[756] | 33 | if ((~strcmpi(package,'ice') & strcmpi(solution,'transient'))...
|
---|
| 34 | | strcmpi(package,'macayeal')),
|
---|
[143] | 35 | disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
|
---|
| 36 | continue
|
---|
| 37 | end
|
---|
| 38 |
|
---|
| 39 | %initialize model
|
---|
| 40 | md=model;
|
---|
| 41 | md=mesh(md,'DomainOutline.exp',50000);
|
---|
| 42 | md=geography(md,'','');
|
---|
| 43 | md=parameterize(md,'Square.par');
|
---|
| 44 | md=setelementstype(md,'hutter','Hutter.exp','fill','MacAyeal');
|
---|
| 45 | if md.numberofgrids==388
|
---|
| 46 | load Velocities; md.vx=0.5*vx; md.vy=0.5*vy;
|
---|
| 47 | end
|
---|
| 48 |
|
---|
| 49 | %compute solution
|
---|
[519] | 50 | [analysis_type sub_analysis_type]=testsgetanalysis(solution);
|
---|
| 51 | [md packagefinal]=testsgetpackage(md,package);
|
---|
[520] | 52 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
|
---|
[143] | 53 |
|
---|
[519] | 54 | %compute fields to be checked
|
---|
| 55 | fields=testsgetfields(md.type,solution);
|
---|
[143] | 56 |
|
---|
| 57 | %load archive
|
---|
| 58 | eval(['load Archive' package solution ]);
|
---|
| 59 |
|
---|
[148] | 60 | for k=1:length(fields),
|
---|
| 61 | field=fields{k};
|
---|
[143] | 62 |
|
---|
[148] | 63 | %compare to archive
|
---|
| 64 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
[745] | 65 | eval(['error_diff=full(max(abs(Archive-md.results.' field '))/(max(abs(Archive))+eps));']);
|
---|
[148] | 66 |
|
---|
| 67 | %disp test result
|
---|
| 68 | if (error_diff>tolerance);
|
---|
[259] | 69 | 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] | 70 | else
|
---|
[259] | 71 | 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] | 72 | end
|
---|
| 73 |
|
---|
[143] | 74 | end
|
---|
| 75 | end
|
---|
| 76 | end
|
---|