[912] | 1 | function varargout=runme(varargin)
|
---|
[913] | 2 | %RUNME - test deck for ISSM nightly runs
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
| 5 | % varargout=runme(varargin);
|
---|
| 6 | %
|
---|
| 7 | % Example:
|
---|
| 8 | % runme;
|
---|
| 9 | % runme({'ice'});
|
---|
| 10 | % runme({'ice','cielo_serial'});
|
---|
| 11 | % md=runme({'cielo_parallel'});
|
---|
| 12 | %
|
---|
| 13 | % See Also: UPDATEARCHIVE
|
---|
| 14 |
|
---|
[143] | 15 | % This file can be run to check that the current version of issm is giving
|
---|
| 16 | % coherent results. This test deals with an icesheet without icefront for a 2d model. The geometry
|
---|
| 17 | % is square. Just run this file in Matlab, with a properly setup ISSM code.
|
---|
| 18 | % The results of this test will indicate if there is a difference between current computations
|
---|
| 19 | % and archived results.
|
---|
| 20 |
|
---|
| 21 | % Errors between archived results and the current version will get flagged if they are not within
|
---|
| 22 | % a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this
|
---|
| 23 | % tolerance should be lowered (for example, if you are running single precision compilers?), feel
|
---|
| 24 | % free to tweak the tolerance variable.
|
---|
| 25 |
|
---|
[482] | 26 | %packages and analysis_types to be tested
|
---|
| 27 | if nargin==1,
|
---|
| 28 | packages=varargin{1};
|
---|
| 29 | else
|
---|
[625] | 30 | packages={'macayeal','ice','cielo_serial','cielo_parallel'};
|
---|
[482] | 31 | end
|
---|
[756] | 32 | solutions={'diagnostic','prognostic','transient'};
|
---|
[143] | 33 |
|
---|
| 34 | %Initialize log message for nightly runs.
|
---|
| 35 | testname='IceSheetNoIceFrontHM2d_14';
|
---|
| 36 |
|
---|
| 37 | %go through the solutions requested
|
---|
| 38 | for i=1:length(packages),
|
---|
| 39 | package=packages{i};
|
---|
| 40 |
|
---|
| 41 | for j=1:length(solutions),
|
---|
| 42 | solution=solutions{j};
|
---|
| 43 |
|
---|
| 44 | %check solution requested
|
---|
[921] | 45 | if strcmpi(package,'macayeal'),
|
---|
[143] | 46 | disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
|
---|
| 47 | continue
|
---|
| 48 | end
|
---|
| 49 |
|
---|
| 50 | %initialize model
|
---|
| 51 | md=model;
|
---|
| 52 | md=mesh(md,'DomainOutline.exp',50000);
|
---|
| 53 | md=geography(md,'','');
|
---|
| 54 | md=parameterize(md,'Square.par');
|
---|
| 55 | md=setelementstype(md,'hutter','Hutter.exp','fill','MacAyeal');
|
---|
| 56 | if md.numberofgrids==388
|
---|
| 57 | load Velocities; md.vx=0.5*vx; md.vy=0.5*vy;
|
---|
| 58 | end
|
---|
| 59 |
|
---|
| 60 | %compute solution
|
---|
[519] | 61 | [analysis_type sub_analysis_type]=testsgetanalysis(solution);
|
---|
| 62 | [md packagefinal]=testsgetpackage(md,package);
|
---|
[520] | 63 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
|
---|
[143] | 64 |
|
---|
[519] | 65 | %compute fields to be checked
|
---|
| 66 | fields=testsgetfields(md.type,solution);
|
---|
[143] | 67 |
|
---|
| 68 | %load archive
|
---|
| 69 | eval(['load Archive' package solution ]);
|
---|
| 70 |
|
---|
[148] | 71 | for k=1:length(fields),
|
---|
[777] | 72 |
|
---|
| 73 | %Get field and tolerance
|
---|
[148] | 74 | field=fields{k};
|
---|
[777] | 75 | tolerance=testsgettolerance(md,package,solution,field);
|
---|
[143] | 76 |
|
---|
[148] | 77 | %compare to archive
|
---|
| 78 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
[745] | 79 | eval(['error_diff=full(max(abs(Archive-md.results.' field '))/(max(abs(Archive))+eps));']);
|
---|
[148] | 80 |
|
---|
| 81 | %disp test result
|
---|
| 82 | if (error_diff>tolerance);
|
---|
[883] | 83 | disp(sprintf(['\n\nERROR difference: %-7.2g > %7.2g test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[148] | 84 | else
|
---|
[883] | 85 | disp(sprintf(['\n\nSUCCESS difference: %-7.2g < %7.2g test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[148] | 86 | end
|
---|
| 87 |
|
---|
[143] | 88 | end
|
---|
| 89 | end
|
---|
| 90 | end
|
---|
[912] | 91 | if nargout==1,
|
---|
| 92 | varargout{1}=md;
|
---|
| 93 | end
|
---|