source: issm/trunk/test/Verification/IceShelfIceFrontMPS3d_4/runme.m@ 745

Last change on this file since 745 was 745, checked in by Mathieu Morlighem, 16 years ago

avoid NaN values in tests

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1function 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
14if nargin==1,
15 packages=varargin{1};
16else
17 packages={'macayeal','ice','cielo_serial'};
18end
19solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'};
20
21%Initialize log message for nightly runs.
22testname='IceShelfIceFrontMPS3d_4';
23tolerance=10^-12;
24
25%go through the solutions requested
26for 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,'cielo_parallel') & (strcmpi(solution,'thermaltransient') | strcmpi(solution,'diagnostic')))...
34 | (~strcmpi(package,'ice') & strcmpi(solution,'diagnostic'))...
35 | strcmpi(package,'macayeal')...
36 | strcmpi(solution,'transient')),
37 disp(sprintf(['\nsolution: ' solution ', with package: ' package ', in test: ' testname ', not supported yet.\n']));
38 continue
39 end
40
41 %initialize model
42 md=model;
43 md=mesh(md,'DomainOutline.exp',100000);
44 md=geography(md,'all','');
45 md=parameterize(md,'Square.par');
46 md=extrude(md,8,4);
47 md=setelementstype(md,'pattyn','Pattyn.exp','fill','macayeal','stokes','Stokes.exp');
48 if md.numberofgrids==832
49 load Velocities; md.vx=0.8*vx; md.vy=0.8*vy; md.vz=0.8*vz; md.temperature=temperature-1; md.pressure=pressure;
50 end
51
52 %compute solution
53 [analysis_type sub_analysis_type]=testsgetanalysis(solution);
54 [md packagefinal]=testsgetpackage(md,package);
55 md=solve(md,'analysis_type',analysis_type,'sub_analysis_type',sub_analysis_type,'package',packagefinal);
56
57 %compute fields to be checked
58 fields=testsgetfields(md.type,solution);
59
60 %load archive
61 eval(['load Archive' package solution ]);
62
63 for k=1:length(fields),
64 field=fields{k};
65
66 %compare to archive
67 eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
68 eval(['error_diff=full(max(abs(Archive-md.results.' field '))/(max(abs(Archive))+eps));']);
69
70 %disp test result
71 if (error_diff>tolerance);
72 disp(sprintf(['\n\nERROR (difference=%-7.2g > %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
73 else
74 disp(sprintf(['\n\nSUCCESS (difference=%-7.2g < %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
75 end
76
77 end
78 end
79end
Note: See TracBrowser for help on using the repository browser.