[482] | 1 | function runme(varargin)
|
---|
[220] | 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 with icefront for a 3d 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
|
---|
| 17 | packages={'macayeal','ice','cielo_serial'};
|
---|
| 18 | end
|
---|
[220] | 19 | solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'};
|
---|
| 20 |
|
---|
| 21 | %Initialize log message for nightly runs.
|
---|
| 22 | testname='IceShelfIceFrontMPS3d_4';
|
---|
| 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
|
---|
[830] | 32 | if ((~strcmpi(package,'ice') & (strcmpi(solution,'thermaltransient') | strcmpi(solution,'diagnostic')))...
|
---|
[725] | 33 | | (~strcmpi(package,'ice') & strcmpi(solution,'diagnostic'))...
|
---|
| 34 | | strcmpi(package,'macayeal')...
|
---|
| 35 | | strcmpi(solution,'transient')),
|
---|
[220] | 36 | disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
|
---|
| 37 | continue
|
---|
| 38 | end
|
---|
| 39 |
|
---|
| 40 | %initialize model
|
---|
| 41 | md=model;
|
---|
| 42 | md=mesh(md,'DomainOutline.exp',100000);
|
---|
| 43 | md=geography(md,'all','');
|
---|
| 44 | md=parameterize(md,'Square.par');
|
---|
| 45 | md=extrude(md,8,4);
|
---|
| 46 | md=setelementstype(md,'pattyn','Pattyn.exp','fill','macayeal','stokes','Stokes.exp');
|
---|
| 47 | if md.numberofgrids==832
|
---|
| 48 | load Velocities; md.vx=0.8*vx; md.vy=0.8*vy; md.vz=0.8*vz; md.temperature=temperature-1; md.pressure=pressure;
|
---|
| 49 | end
|
---|
| 50 |
|
---|
| 51 | %compute solution
|
---|
[519] | 52 | [analysis_type sub_analysis_type]=testsgetanalysis(solution);
|
---|
| 53 | [md packagefinal]=testsgetpackage(md,package);
|
---|
[520] | 54 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
|
---|
[220] | 55 |
|
---|
[519] | 56 | %compute fields to be checked
|
---|
| 57 | fields=testsgetfields(md.type,solution);
|
---|
[220] | 58 |
|
---|
| 59 | %load archive
|
---|
| 60 | eval(['load Archive' package solution ]);
|
---|
| 61 |
|
---|
| 62 | for k=1:length(fields),
|
---|
[777] | 63 |
|
---|
| 64 | %Get field and tolerance
|
---|
[220] | 65 | field=fields{k};
|
---|
[777] | 66 | tolerance=testsgettolerance(md,package,solution,field);
|
---|
[220] | 67 |
|
---|
| 68 | %compare to archive
|
---|
| 69 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
[745] | 70 | eval(['error_diff=full(max(abs(Archive-md.results.' field '))/(max(abs(Archive))+eps));']);
|
---|
[220] | 71 |
|
---|
| 72 | %disp test result
|
---|
| 73 | if (error_diff>tolerance);
|
---|
[259] | 74 | disp(sprintf(['\n\nERROR (difference=%-7.2g > %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[220] | 75 | else
|
---|
[259] | 76 | disp(sprintf(['\n\nSUCCESS (difference=%-7.2g < %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[220] | 77 | end
|
---|
| 78 |
|
---|
| 79 | end
|
---|
| 80 | end
|
---|
| 81 | end
|
---|