1 | % This file can be run to check that the current version of Pattyn model is giving
|
---|
2 | % coherent results. This test deals with an iceshelf with icefront for a 3d model. The geometry
|
---|
3 | % is square. Just run this file in Matlab, with a properly setup Ice 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^-14. 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 | %Initialize log message for nightly runs.
|
---|
13 | logstring='Verification/test10_iceshelf_icefront_stokes: ';
|
---|
14 |
|
---|
15 | % Create model;
|
---|
16 |
|
---|
17 | tolerance=10^-13;
|
---|
18 |
|
---|
19 |
|
---|
20 | md=model;
|
---|
21 | md=mesh(md,'DomainOutline.exp',100000);
|
---|
22 | md=geography(md,'all','');
|
---|
23 | md=parameterize(md,'Square.par');
|
---|
24 | md=extrude(md,10,3);
|
---|
25 | md=setelementstype(md,'pattyn','all','stokes','all');
|
---|
26 |
|
---|
27 | %Compute solution with Ice model
|
---|
28 | md=solve(md,'diagnostic','ice');
|
---|
29 | vel_stokes=md.vel;
|
---|
30 |
|
---|
31 | %Load old velocities and compare with the new model
|
---|
32 | load archive_stokes
|
---|
33 | pos=find(archive_stokes-vel_stokes);
|
---|
34 | error_vel=abs(norm((archive_stokes(pos)-vel_stokes(pos))./archive_stokes(pos),2));
|
---|
35 |
|
---|
36 | disp(sprintf('numerical difference between old and new version of Ice is : %d', error_vel));
|
---|
37 |
|
---|
38 | if (error_vel>tolerance);
|
---|
39 | logoutput(logstring,sprintf('%s\n',' ERROR. Results from Stokes model differ from the archive version'));
|
---|
40 | else
|
---|
41 | logoutput(logstring,sprintf('%s\n',' SUCCESS. Results from Stokes model are comform with the archive version'));
|
---|
42 | end
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 | %Compute solution with Ice model
|
---|
47 | md=solve(md,'thermalsteady','ice');
|
---|
48 | temp_stokes=md.temperature;
|
---|
49 | melting_stokes=md.melting;
|
---|
50 |
|
---|
51 | %Load old velocities and compare with the new model
|
---|
52 | load archive_temperature
|
---|
53 | post=find(archive_temperature-temp_stokes);
|
---|
54 | error_temp=abs(norm((archive_temperature(post)-temp_stokes(post))./archive_temperature(post),2));
|
---|
55 |
|
---|
56 | disp(sprintf('numerical difference between old and new version of Ice is : %d', error_temp));
|
---|
57 |
|
---|
58 | if (error_temp>tolerance);
|
---|
59 | logoutput(logstring,sprintf('%s\n',' ERROR. Results from thermal model differ from the archive version'));
|
---|
60 | else
|
---|
61 | logoutput(logstring,sprintf('%s\n',' SUCCESS. Results from thermal model are comform with the archive version'));
|
---|
62 | end
|
---|
63 |
|
---|
64 | %Load old velocities and compare with the new model
|
---|
65 | load archive_melting
|
---|
66 | post=find(archive_melting-melting_stokes);
|
---|
67 | error_melting=abs(norm((archive_melting(post)-melting_stokes(post))./archive_melting(post),2));
|
---|
68 |
|
---|
69 | disp(sprintf('numerical difference between old and new version of Ice is : %d', error_melting));
|
---|
70 |
|
---|
71 | if (error_melting>tolerance);
|
---|
72 | logoutput(logstring,sprintf('%s\n',' ERROR. Results from melting model differ from the archive version'));
|
---|
73 | else
|
---|
74 | logoutput(logstring,sprintf('%s\n',' SUCCESS. Results from melting model are comform with the archive version'));
|
---|
75 | end
|
---|