[157] | 1 | % This file can be run to check that the current version of issm is giving
|
---|
| 2 | % coherent results. This test deals with an icesheet with icefront for a 3d model. The geometry
|
---|
| 3 | % is square. Just run this file in Matlab, with a properly setup ISSM code.
|
---|
| 4 | % The results of this test will indicate if there is a difference between current computations
|
---|
| 5 | % and archived results.
|
---|
| 6 |
|
---|
| 7 | % Errors between archived results and the current version will get flagged if they are not within
|
---|
| 8 | % a certain tolerance. The current tolerance is 10^-12. If you have good reasons to believe this
|
---|
| 9 | % tolerance should be lowered (for example, if you are running single precision compilers?), feel
|
---|
| 10 | % free to tweak the tolerance variable.
|
---|
| 11 |
|
---|
| 12 | %packages and solutions to be tested
|
---|
[259] | 13 | packages={'macayeal','ice','cielo_serial'};
|
---|
[157] | 14 | solutions={'diagnostic','thermalsteady','thermaltransient','prognostic','transient'};
|
---|
| 15 |
|
---|
| 16 | %Initialize log message for nightly runs.
|
---|
| 17 | testname='IceShelfIceFrontM3d_2';
|
---|
| 18 | tolerance=10^-12;
|
---|
| 19 |
|
---|
| 20 | %go through the solutions requested
|
---|
| 21 | for i=1:length(packages),
|
---|
| 22 | package=packages{i};
|
---|
| 23 |
|
---|
| 24 | for j=1:length(solutions),
|
---|
| 25 | solution=solutions{j};
|
---|
| 26 |
|
---|
| 27 | %check package
|
---|
| 28 | if ~(strcmpi(package,'macayeal') | strcmpi(package,'ice') | strcmpi(package,'cielo_serial') | strcmpi(package,'cielo_parallel'));
|
---|
| 29 | error(['package: ' package ' in test: ' testname ' not supported yet']);
|
---|
| 30 | %check solution
|
---|
| 31 | elseif ~(strcmpi(solution,'diagnostic') | strcmpi(solution,'thermalsteady') | strcmpi(solution,'thermaltransient') |...
|
---|
| 32 | strcmpi(solution,'prognostic') | strcmpi(solution,'transient'));
|
---|
| 33 | error(['solution: ' solution ' in test: ' testname ' not supported yet']);
|
---|
| 34 | end
|
---|
| 35 | %check solution requested
|
---|
[288] | 36 | if (~(strcmpi(package,'ice') | (strcmpi(package,'cielo_serial') & strcmpi(solution,'diagnostic'))) | strcmpi(solution,'transient')),
|
---|
[157] | 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,'macayeal','all');
|
---|
| 48 | if strcmpi(package,'cielo_parallel'), md.cluster='wilkes'; end
|
---|
| 49 | if md.numberofgrids==832
|
---|
| 50 | load Velocities; md.vx=0.8*vx; md.vy=0.8*vy; md.vz=0.8*vz; md.temperature=temperature-1; md.pressure=pressure;
|
---|
| 51 | end
|
---|
| 52 |
|
---|
| 53 | %compute solution
|
---|
[451] | 54 | if (strcmpi(package,'cielo_serial') | strcmpi(package,'cielo_parallel')),
|
---|
| 55 | md=solve(md,solution,'cielo');
|
---|
[157] | 56 | else
|
---|
[451] | 57 | md=solve(md,solution,package);
|
---|
[157] | 58 | end
|
---|
| 59 |
|
---|
| 60 | %compute field to be checked
|
---|
| 61 | if strcmpi(solution,'diagnostic'),
|
---|
| 62 | fields={'vy','vz'};
|
---|
| 63 | elseif strcmpi(solution,'thermalsteady'),
|
---|
| 64 | fields={'temperature','melting'};
|
---|
| 65 | elseif strcmpi(solution,'thermaltransient'),
|
---|
| 66 | fields={'thermaltransient_results(end).temperature','thermaltransient_results(end).melting'};
|
---|
| 67 | elseif strcmpi(solution,'prognostic'),
|
---|
| 68 | fields={'new_thickness'};
|
---|
| 69 | elseif strcmpi(solution,'transient'),
|
---|
| 70 | fields={'transient_results(end).vy','transient_results(end).vz','transient_results(end).temperature','transient_results(end).melting','transient_results(end).thickness'};
|
---|
| 71 | end
|
---|
| 72 |
|
---|
| 73 | %load archive
|
---|
| 74 | eval(['load Archive' package solution ]);
|
---|
| 75 |
|
---|
| 76 | for k=1:length(fields),
|
---|
| 77 | field=fields{k};
|
---|
| 78 |
|
---|
| 79 | %compare to archive
|
---|
| 80 | eval(['Archive=Archive' package solution '_field' num2str(k) ';']);
|
---|
| 81 | eval(['error_diff=abs(norm((Archive(find(Archive))-md.' field '(find(Archive)))./Archive(find(Archive)),2));']);
|
---|
| 82 |
|
---|
| 83 | %disp test result
|
---|
| 84 | if (error_diff>tolerance);
|
---|
[259] | 85 | disp(sprintf(['\n\nERROR (difference=%-7.2g > %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[157] | 86 | else
|
---|
[259] | 87 | disp(sprintf(['\n\nSUCCESS (difference=%-7.2g < %g) --> test: %-25s solution: %-16s package: %-14s field: ' field '.\n\n'],error_diff,tolerance,testname,solution,package));
|
---|
[157] | 88 | end
|
---|
| 89 |
|
---|
| 90 | end
|
---|
| 91 | end
|
---|
| 92 | end
|
---|