| 1 | function runme(varargin) | 
|---|
| 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 |  | 
|---|
| 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 | 
|---|
| 19 | solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'}; | 
|---|
| 20 |  | 
|---|
| 21 | %Initialize log message for nightly runs. | 
|---|
| 22 | testname='IceShelfIceFrontM3d_2'; | 
|---|
| 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 | 
|---|
| 33 | if (~(strcmpi(package,'ice') | strcmpi(solution,'diagnostic'))... | 
|---|
| 34 | | strcmpi(package,'macayeal')... | 
|---|
| 35 | | strcmpi(solution,'transient')), | 
|---|
| 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,'macayeal','all'); | 
|---|
| 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 | 
|---|
| 52 | [analysis_type sub_analysis_type]=testsgetanalysis(solution); | 
|---|
| 53 | [md packagefinal]=testsgetpackage(md,package); | 
|---|
| 54 | md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',package); | 
|---|
| 55 |  | 
|---|
| 56 | %compute fields to be checked | 
|---|
| 57 | fields=testsgetfields(md.type,solution); | 
|---|
| 58 |  | 
|---|
| 59 | %load archive | 
|---|
| 60 | eval(['load Archive' package solution ]); | 
|---|
| 61 |  | 
|---|
| 62 | for k=1:length(fields), | 
|---|
| 63 | field=fields{k}; | 
|---|
| 64 |  | 
|---|
| 65 | %compare to archive | 
|---|
| 66 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']); | 
|---|
| 67 | eval(['error_diff=abs(norm((Archive(find(Archive))-md.' field  '(find(Archive)))./Archive(find(Archive)),2));']); | 
|---|
| 68 |  | 
|---|
| 69 | %disp test result | 
|---|
| 70 | if (error_diff>tolerance); | 
|---|
| 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)); | 
|---|
| 72 | else | 
|---|
| 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)); | 
|---|
| 74 | end | 
|---|
| 75 |  | 
|---|
| 76 | end | 
|---|
| 77 | end | 
|---|
| 78 | end | 
|---|