[912] | 1 | function varargout=runme(varargin)
|
---|
[913] | 2 | %RUNME - test deck for ISSM nightly runs
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
| 5 | % varargout=runme(varargin);
|
---|
| 6 | %
|
---|
[996] | 7 | % Examples:
|
---|
[913] | 8 | % runme;
|
---|
| 9 | % runme({'ice'});
|
---|
[996] | 10 | % runme({'ice','cielo_serial'},{'diagnostic'});
|
---|
[913] | 11 | % md=runme({'cielo_parallel'});
|
---|
| 12 | %
|
---|
| 13 | % See Also: UPDATEARCHIVE
|
---|
| 14 |
|
---|
[220] | 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 with icefront for a 3d 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 |
|
---|
[996] | 26 | %check arguments
|
---|
| 27 | if (nargin>2 | nargout>1)
|
---|
| 28 | help runme
|
---|
| 29 | error('runme error message: bad usage');
|
---|
| 30 | end
|
---|
| 31 |
|
---|
[482] | 32 | %packages and analysis_types to be tested
|
---|
[996] | 33 | if nargin==2,
|
---|
| 34 | solutions=varargin{2};
|
---|
| 35 | else
|
---|
| 36 | solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'};
|
---|
| 37 | end
|
---|
| 38 | if nargin,
|
---|
[482] | 39 | packages=varargin{1};
|
---|
| 40 | else
|
---|
| 41 | packages={'macayeal','ice','cielo_serial'};
|
---|
| 42 | end
|
---|
[220] | 43 |
|
---|
| 44 | %Initialize log message for nightly runs.
|
---|
| 45 | testname='IceShelfIceFrontMPS3d_4';
|
---|
| 46 |
|
---|
| 47 | %go through the solutions requested
|
---|
| 48 | for i=1:length(packages),
|
---|
| 49 | package=packages{i};
|
---|
| 50 |
|
---|
| 51 | for j=1:length(solutions),
|
---|
| 52 | solution=solutions{j};
|
---|
| 53 |
|
---|
| 54 | %check solution requested
|
---|
[830] | 55 | if ((~strcmpi(package,'ice') & (strcmpi(solution,'thermaltransient') | strcmpi(solution,'diagnostic')))...
|
---|
[725] | 56 | | (~strcmpi(package,'ice') & strcmpi(solution,'diagnostic'))...
|
---|
| 57 | | strcmpi(package,'macayeal')...
|
---|
| 58 | | strcmpi(solution,'transient')),
|
---|
[220] | 59 | disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
|
---|
| 60 | continue
|
---|
| 61 | end
|
---|
| 62 |
|
---|
| 63 | %initialize model
|
---|
| 64 | md=model;
|
---|
| 65 | md=mesh(md,'DomainOutline.exp',100000);
|
---|
| 66 | md=geography(md,'all','');
|
---|
| 67 | md=parameterize(md,'Square.par');
|
---|
| 68 | md=extrude(md,8,4);
|
---|
| 69 | md=setelementstype(md,'pattyn','Pattyn.exp','fill','macayeal','stokes','Stokes.exp');
|
---|
| 70 | if md.numberofgrids==832
|
---|
| 71 | load Velocities; md.vx=0.8*vx; md.vy=0.8*vy; md.vz=0.8*vz; md.temperature=temperature-1; md.pressure=pressure;
|
---|
| 72 | end
|
---|
| 73 |
|
---|
| 74 | %compute solution
|
---|
[519] | 75 | [analysis_type sub_analysis_type]=testsgetanalysis(solution);
|
---|
| 76 | [md packagefinal]=testsgetpackage(md,package);
|
---|
[520] | 77 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
|
---|
[220] | 78 |
|
---|
[519] | 79 | %compute fields to be checked
|
---|
| 80 | fields=testsgetfields(md.type,solution);
|
---|
[220] | 81 |
|
---|
| 82 | %load archive
|
---|
| 83 | eval(['load Archive' package solution ]);
|
---|
| 84 |
|
---|
| 85 | for k=1:length(fields),
|
---|
[777] | 86 |
|
---|
| 87 | %Get field and tolerance
|
---|
[220] | 88 | field=fields{k};
|
---|
[777] | 89 | tolerance=testsgettolerance(md,package,solution,field);
|
---|
[220] | 90 |
|
---|
| 91 | %compare to archive
|
---|
| 92 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
[745] | 93 | eval(['error_diff=full(max(abs(Archive-md.results.' field '))/(max(abs(Archive))+eps));']);
|
---|
[220] | 94 |
|
---|
| 95 | %disp test result
|
---|
| 96 | if (error_diff>tolerance);
|
---|
[883] | 97 | 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));
|
---|
[220] | 98 | else
|
---|
[883] | 99 | 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));
|
---|
[220] | 100 | end
|
---|
| 101 |
|
---|
| 102 | end
|
---|
| 103 | end
|
---|
| 104 | end
|
---|
[912] | 105 | if nargout==1,
|
---|
| 106 | varargout{1}=md;
|
---|
| 107 | end
|
---|