1 |
|
---|
2 |
function [] = sw_test() |
---|
3 |
|
---|
4 |
% SW_TEST Test SEAWATER Library Routines |
---|
5 |
%========================================================================= |
---|
6 |
% SW_TEST $Id: sw_test.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $ |
---|
7 |
% Copyright (C) CSIRO, Phil Morgan 1994 |
---|
8 |
% |
---|
9 |
% sw_test |
---|
10 |
% |
---|
11 |
% DESCRIPTION: |
---|
12 |
% Execute test routines to test and verify SEAWATER Library routines |
---|
13 |
% for your platform. Prints output to screen and to file sw_test.txt |
---|
14 |
% |
---|
15 |
% Use the "more" command to scroll results to screen |
---|
16 |
% |
---|
17 |
% OUTPUT: |
---|
18 |
% file sw_test.txt |
---|
19 |
% |
---|
20 |
% AUTHOR: Phil Morgan, Lindsay Pender (Lindsay.Pender@csiro.au) |
---|
21 |
% |
---|
22 |
% DISCLAIMER: |
---|
23 |
% This software is provided "as is" without warranty of any kind. |
---|
24 |
% See the file sw_copy.m for conditions of use and licence. |
---|
25 |
% |
---|
26 |
%========================================================================= |
---|
27 |
|
---|
28 |
% Modifications |
---|
29 |
% 03-12-12. Lindsay Pender, Converted to ITS-90. |
---|
30 |
|
---|
31 |
delete sw_test.txt |
---|
32 |
disp('OUTPUT FROM THIS TEST WILL ALSO BE SAVED IN FILE sw_test.txt') |
---|
33 |
disp(' <enter> to continue...') |
---|
34 |
pause |
---|
35 |
reply = input('Full listing of help for each routine (y/n) ? ','s'); |
---|
36 |
display_help = strcmp(reply,'y') | strcmp(reply,'Y'); |
---|
37 |
|
---|
38 |
format compact |
---|
39 |
echo off |
---|
40 |
diary sw_test.txt |
---|
41 |
|
---|
42 |
disp( '***********************') |
---|
43 |
disp( ' TEST REPORT ') |
---|
44 |
disp( ' ') |
---|
45 |
disp( ' SEA WATER LIBRARY ') |
---|
46 |
disp( ' ') |
---|
47 |
sw_ver |
---|
48 |
disp( ' ') |
---|
49 |
disp(['Matlab Version ' version ]) |
---|
50 |
disp( ' ') |
---|
51 |
disp([' ' date '']) |
---|
52 |
disp( '***********************') |
---|
53 |
|
---|
54 |
disp(' ') |
---|
55 |
|
---|
56 |
%-------------------------------- |
---|
57 |
% TEST MAIN MODULE sw_ptmp.m |
---|
58 |
% SUB-MODULES sw_atg.m |
---|
59 |
%-------------------------------- |
---|
60 |
module = 'sw_ptmp'; |
---|
61 |
submodules = 'sw_adtg.m'; |
---|
62 |
disp('*************************************') |
---|
63 |
disp(['** TESTING MODULE: ' module]) |
---|
64 |
disp(['** and SUB-MODULE: ' submodules]) |
---|
65 |
disp('*************************************') |
---|
66 |
if display_help |
---|
67 |
eval(['help ' module]) |
---|
68 |
eval(['help ' submodules]) |
---|
69 |
end %if |
---|
70 |
|
---|
71 |
% TEST 1 - data from Unesco 1983 p45 |
---|
72 |
|
---|
73 |
T = [ 0 0 0 0 0 0; |
---|
74 |
10 10 10 10 10 10; |
---|
75 |
20 20 20 20 20 20; |
---|
76 |
30 30 30 30 30 30; |
---|
77 |
40 40 40 40 40 40 ]/1.00024; |
---|
78 |
|
---|
79 |
S = [25 25 25 35 35 35; |
---|
80 |
25 25 25 35 35 35; |
---|
81 |
25 25 25 35 35 35 ; |
---|
82 |
25 25 25 35 35 35; |
---|
83 |
25 25 25 35 35 35 ]; |
---|
84 |
|
---|
85 |
P = [0 5000 10000 0 5000 10000; |
---|
86 |
0 5000 10000 0 5000 10000; |
---|
87 |
0 5000 10000 0 5000 10000 ; |
---|
88 |
0 5000 10000 0 5000 10000; |
---|
89 |
0 5000 10000 0 5000 10000 ]; |
---|
90 |
|
---|
91 |
Pr = [0 0 0 0 0 0]; |
---|
92 |
|
---|
93 |
UN_ptmp = [ 0 -0.3061 -0.9667 0 -0.3856 -1.0974; |
---|
94 |
10 9.3531 8.4684 10 9.2906 8.3643; |
---|
95 |
20 19.0438 17.9426 20 18.9985 17.8654; |
---|
96 |
30 28.7512 27.4353 30 28.7231 27.3851; |
---|
97 |
40 38.4607 36.9254 40 38.4498 36.9023]; |
---|
98 |
|
---|
99 |
ptmp = sw_ptmp(S,T,P,Pr)*1.00024; |
---|
100 |
|
---|
101 |
%---------------- |
---|
102 |
% DISPLAY RESULTS |
---|
103 |
%---------------- |
---|
104 |
disp(' ') |
---|
105 |
disp ('********************************************************') |
---|
106 |
disp ('Comparison of accepted values from UNESCO 1983 ') |
---|
107 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p45)') |
---|
108 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
109 |
disp ('********************************************************') |
---|
110 |
|
---|
111 |
for icol = 1:length(S(1,:)) |
---|
112 |
disp(' ') |
---|
113 |
disp (' Sal Temp Press PTMP sw_ptmp') |
---|
114 |
disp (' (psu) (C) (db) (C) (C)') |
---|
115 |
fprintf(1,' %4.0f %4.0f %5.0f %8.4f %11.5f\n', ... |
---|
116 |
[S(:,icol) T(:,icol) P(:,icol) UN_ptmp(:,icol) ptmp(:,icol)]'); |
---|
117 |
end %for |
---|
118 |
|
---|
119 |
%------------------------------------------------------------------------------- |
---|
120 |
% TEST MAIN MODULE sw_svan.m |
---|
121 |
% SUB-MODULES sw_dens.m sw_dens0.m sw_smow.m sw_seck.m sw_pden.m sw_ptmp.m |
---|
122 |
%------------------------------------------------------------------------------ |
---|
123 |
module = 'sw_svan.m'; |
---|
124 |
submodules = 'sw_dens.m sw_dens0.m sw_smow.m sw_seck.m sw_pden.m sw_ptmp.m'; |
---|
125 |
disp(' ') |
---|
126 |
disp('************************************************************************') |
---|
127 |
disp(['** TESTING MODULE: ' module]) |
---|
128 |
disp(['** and SUB-MODULE: ' submodules]) |
---|
129 |
disp('************************************************************************') |
---|
130 |
if display_help |
---|
131 |
eval(['help ' module]) |
---|
132 |
eval(['help ' submodules]) |
---|
133 |
end %if |
---|
134 |
|
---|
135 |
% TEST DATA FROM |
---|
136 |
% Unesco Tech. Paper in Marine Sci. No. 44, p22 |
---|
137 |
|
---|
138 |
s = [0 0 0 0 35 35 35 35]'; |
---|
139 |
p = [0 10000 0 10000 0 10000 0 10000]'; |
---|
140 |
t = ([0 0 30 30 0 0 30 30] / 1.00024)'; |
---|
141 |
|
---|
142 |
UN_svan = [2749.54 2288.61 3170.58 3147.85 ... |
---|
143 |
0.0 0.00 607.14 916.34]'; |
---|
144 |
|
---|
145 |
svan = sw_svan(s,t,p); |
---|
146 |
|
---|
147 |
%---------------- |
---|
148 |
% DISPLAY RESULTS |
---|
149 |
%---------------- |
---|
150 |
disp(' ') |
---|
151 |
disp ('********************************************************') |
---|
152 |
disp ('Comparison of accepted values from UNESCO 1983') |
---|
153 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p22)') |
---|
154 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
155 |
disp ('********************************************************') |
---|
156 |
disp(' ') |
---|
157 |
disp (' Sal Temp Press SVAN sw_svan') |
---|
158 |
disp (' (psu) (C) (db) (1e-8*m3/kg) (1e-8*m3/kg)') |
---|
159 |
fprintf(1,' %4.0f %4.0f %5.0f %11.2f %11.3f\n',[s t p UN_svan 1e+8*svan]'); |
---|
160 |
|
---|
161 |
%------------------------------------------------------------------------------- |
---|
162 |
% TEST MAIN MODULE |
---|
163 |
% SUB-MODULES |
---|
164 |
%------------------------------------------------------------------------------ |
---|
165 |
module = 'sw_salt.m'; |
---|
166 |
submodules = 'sw_salrt.m sw_salrp.m sw_sals.m'; |
---|
167 |
disp(' ') |
---|
168 |
disp('************************************************************************') |
---|
169 |
disp(['** TESTING MODULE: ' module]) |
---|
170 |
disp(['** and SUB-MODULE: ' submodules]) |
---|
171 |
disp('************************************************************************') |
---|
172 |
if display_help |
---|
173 |
eval(['help ' module]) |
---|
174 |
eval(['help ' submodules]) |
---|
175 |
end %if |
---|
176 |
|
---|
177 |
% TEST 1 - data from Unesco 1983 p9 |
---|
178 |
%*************************************************************************** |
---|
179 |
|
---|
180 |
R = [1 1.2 0.65]'; % cndr = R |
---|
181 |
T = ([15 20 5]/1.00024)'; |
---|
182 |
P = [0 2000 1500]'; |
---|
183 |
|
---|
184 |
Rt = [1 1.0568875 0.81705885]'; |
---|
185 |
UN_S = [35 37.245628 27.995347]'; |
---|
186 |
S = sw_salt(R,T,P); |
---|
187 |
|
---|
188 |
%---------------- |
---|
189 |
% DISPLAY RESULTS |
---|
190 |
%---------------- |
---|
191 |
disp(' ') |
---|
192 |
disp ('********************************************************') |
---|
193 |
disp ('Comparison of accepted values from UNESCO 1983 ') |
---|
194 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p9)') |
---|
195 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
196 |
disp ('********************************************************') |
---|
197 |
disp(' ') |
---|
198 |
disp (' Temp Press R S sw_salt') |
---|
199 |
disp (' (C) (db) (no units) (psu) (psu) ') |
---|
200 |
table = [T P R UN_S S]'; |
---|
201 |
fprintf(1,' %4.0f %4.0f %8.2f %11.6f %14.7f\n', table); |
---|
202 |
|
---|
203 |
%------------------------------------------------------------------------------- |
---|
204 |
% TEST MAIN MODULE |
---|
205 |
% SUB-MODULES |
---|
206 |
%------------------------------------------------------------------------------ |
---|
207 |
module = 'sw_cndr.m'; |
---|
208 |
submodules = 'sw_salds.m'; |
---|
209 |
disp(' ') |
---|
210 |
disp('************************************************************************') |
---|
211 |
disp(['** TESTING MODULE: ' module]) |
---|
212 |
disp(['** and SUB-MODULE: ' submodules]) |
---|
213 |
disp('************************************************************************') |
---|
214 |
if display_help |
---|
215 |
eval(['help ' module]) |
---|
216 |
eval(['help ' submodules]) |
---|
217 |
end %if |
---|
218 |
|
---|
219 |
% TEST 1 - data from Unesco 1983 p9 |
---|
220 |
|
---|
221 |
T = ([0 10 0 10 10 30]/1.00024)'; |
---|
222 |
P = [0 0 1000 1000 0 0]'; |
---|
223 |
S = [25 25 25 25 40 40]'; |
---|
224 |
UN_R = [ 0.498088 0.654990 0.506244 0.662975 1.000073 1.529967]'; |
---|
225 |
R = sw_cndr(S,T,P); |
---|
226 |
|
---|
227 |
%---------------- |
---|
228 |
% DISPLAY RESULTS |
---|
229 |
%---------------- |
---|
230 |
disp(' ') |
---|
231 |
disp ('********************************************************') |
---|
232 |
disp ('Comparison of accepted values from UNESCO 1983 ') |
---|
233 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p14)') |
---|
234 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
235 |
disp ('********************************************************') |
---|
236 |
disp(' ') |
---|
237 |
disp (' Temp Press S cndr sw_cndr') |
---|
238 |
disp (' (C) (db) (psu) (no units) (no units) ') |
---|
239 |
table = [T P S UN_R R]'; |
---|
240 |
fprintf(1,' %4.0f %4.0f %8.6f %11.6f %14.8f\n', table); |
---|
241 |
|
---|
242 |
%------------------------------------------------------------------------------- |
---|
243 |
% TEST MAIN MODULE |
---|
244 |
% SUB-MODULES |
---|
245 |
%------------------------------------------------------------------------------ |
---|
246 |
module = 'sw_dpth.m'; |
---|
247 |
disp(' ') |
---|
248 |
disp('************************************************************************') |
---|
249 |
disp(['** TESTING MODULE: ' module]) |
---|
250 |
disp('************************************************************************') |
---|
251 |
if display_help |
---|
252 |
eval(['help ' module]) |
---|
253 |
end %if |
---|
254 |
|
---|
255 |
% TEST DATA - matrix "pressure", vector "lat" Unesco 1983 data p30. |
---|
256 |
|
---|
257 |
lat = [0 30 45 90]; |
---|
258 |
P = [ 500 500 500 500; |
---|
259 |
5000 5000 5000 5000; |
---|
260 |
10000 10000 10000 10000]; |
---|
261 |
|
---|
262 |
UN_dpth = [ 496.65 496.00 495.34 494.03; |
---|
263 |
4915.04 4908.56 4902.08 4889.13; |
---|
264 |
9725.47 9712.65 9699.84 9674.23]; |
---|
265 |
|
---|
266 |
dpth = sw_dpth(P,lat); |
---|
267 |
|
---|
268 |
%---------------- |
---|
269 |
% DISPLAY RESULTS |
---|
270 |
%---------------- |
---|
271 |
disp(' ') |
---|
272 |
disp ('********************************************************') |
---|
273 |
disp ('Comparison of accepted values from Unesco 1983 ') |
---|
274 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p28)') |
---|
275 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
276 |
disp ('********************************************************') |
---|
277 |
|
---|
278 |
for irow = 1:3 |
---|
279 |
disp(' ') |
---|
280 |
disp (' Lat Press DPTH sw_dpth') |
---|
281 |
disp (' (degree) (db) (meter) (meter)') |
---|
282 |
table = [lat' P(irow,:)' UN_dpth(irow,:)' dpth(irow,:)']; |
---|
283 |
fprintf(1,' %6.3f %6.0f %8.2f %8.3f\n', table') |
---|
284 |
end %for |
---|
285 |
|
---|
286 |
%------------------------------------------------------------------------------- |
---|
287 |
% TEST MAIN MODULE |
---|
288 |
% SUB-MODULES |
---|
289 |
%------------------------------------------------------------------------------ |
---|
290 |
module = 'sw_fp.m'; |
---|
291 |
disp(' ') |
---|
292 |
disp('************************************************************************') |
---|
293 |
disp(['** TESTING MODULE: ' module]) |
---|
294 |
disp('************************************************************************') |
---|
295 |
if display_help |
---|
296 |
eval(['help ' module]) |
---|
297 |
end %if |
---|
298 |
|
---|
299 |
% TEST 1 - |
---|
300 |
% UNESCO DATA p.30 |
---|
301 |
%*************************************************************************** |
---|
302 |
S = [ 5 10 15 20 25 30 35 40; |
---|
303 |
5 10 15 20 25 30 35 40]; |
---|
304 |
|
---|
305 |
P = [ 0 0 0 0 0 0 0 0; |
---|
306 |
500 500 500 500 500 500 500 500]; |
---|
307 |
|
---|
308 |
|
---|
309 |
UN_fp = [-0.274 -0.542 -0.812 -1.083 -1.358 -1.638 -1.922 -2.212; |
---|
310 |
-0.650 -0.919 -1.188 -1.460 -1.735 -2.014 -2.299 -2.589]; |
---|
311 |
|
---|
312 |
fp = sw_fp(S,P); |
---|
313 |
|
---|
314 |
%---------------- |
---|
315 |
% DISPLAY RESULTS |
---|
316 |
%---------------- |
---|
317 |
disp(' ') |
---|
318 |
disp ('********************************************************') |
---|
319 |
disp ('Comparison of accepted values from UNESCO 1983 ') |
---|
320 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p30)') |
---|
321 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
322 |
disp ('********************************************************') |
---|
323 |
|
---|
324 |
for irow = 1:2 |
---|
325 |
disp(' ') |
---|
326 |
disp (' Sal Press fp sw_fp') |
---|
327 |
disp (' (psu) (db) (C) (C)') |
---|
328 |
table = [S(irow,:); P(irow,:); UN_fp(irow,:); fp(irow,:)]; |
---|
329 |
fprintf(1,' %4.0f %5.0f %8.3f %11.4f\n', table) |
---|
330 |
end %for |
---|
331 |
|
---|
332 |
%------------------------------------------------------------------------------- |
---|
333 |
% TEST MAIN MODULE |
---|
334 |
% SUB-MODULES |
---|
335 |
%------------------------------------------------------------------------------ |
---|
336 |
module = 'sw_cp.m'; |
---|
337 |
disp(' ') |
---|
338 |
disp('************************************************************************') |
---|
339 |
disp(['** TESTING MODULE: ' module]) |
---|
340 |
disp('************************************************************************') |
---|
341 |
if display_help |
---|
342 |
eval(['help ' module]) |
---|
343 |
end %if |
---|
344 |
|
---|
345 |
% TEST 1 - |
---|
346 |
% DATA FROM POND AND PICKARD INTRO. DYNAMICAL OCEANOGRAPHY 2ND ED. 1986 |
---|
347 |
%*************************************************************************** |
---|
348 |
|
---|
349 |
T = [ 0 0 0 0 0 0; |
---|
350 |
10 10 10 10 10 10; |
---|
351 |
20 20 20 20 20 20; |
---|
352 |
30 30 30 30 30 30; |
---|
353 |
40 40 40 40 40 40 ] / 1.00024; |
---|
354 |
|
---|
355 |
S = [25 25 25 35 35 35; |
---|
356 |
25 25 25 35 35 35; |
---|
357 |
25 25 25 35 35 35 ; |
---|
358 |
25 25 25 35 35 35; |
---|
359 |
25 25 25 35 35 35 ]; |
---|
360 |
|
---|
361 |
P = [0 5000 10000 0 5000 10000; |
---|
362 |
0 5000 10000 0 5000 10000; |
---|
363 |
0 5000 10000 0 5000 10000 ; |
---|
364 |
0 5000 10000 0 5000 10000; |
---|
365 |
0 5000 10000 0 5000 10000 ]; |
---|
366 |
|
---|
367 |
UN_cp = [ 4048.4 3896.3 3807.7 3986.5 3849.3 3769.1; |
---|
368 |
4041.8 3919.6 3842.3 3986.3 3874.7 3804.4; |
---|
369 |
4044.8 3938.6 3866.7 3993.9 3895.0 3828.3; |
---|
370 |
4049.1 3952.0 3883.0 4000.7 3909.2 3844.3; |
---|
371 |
4051.2 3966.1 3905.9 4003.5 3923.9 3868.3 ]; |
---|
372 |
|
---|
373 |
cp = sw_cp(S,T,P); |
---|
374 |
|
---|
375 |
%---------------- |
---|
376 |
% DISPLAY RESULTS |
---|
377 |
%---------------- |
---|
378 |
disp(' ') |
---|
379 |
disp ('********************************************************') |
---|
380 |
disp ('Comparison of accepted values from UNESCO 1983 ') |
---|
381 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p37)') |
---|
382 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
383 |
disp ('********************************************************') |
---|
384 |
|
---|
385 |
for icol = 1:length(S(1,:)) |
---|
386 |
disp(' ') |
---|
387 |
disp (' Sal Temp Press Cp sw_cp') |
---|
388 |
disp (' (psu) (C) (db) (J/kg.C) (J/kg.C)') |
---|
389 |
fprintf(1,' %4.0f %4.0f %5.0f %8.1f %11.2f\n', ... |
---|
390 |
[S(:,icol) T(:,icol) P(:,icol) UN_cp(:,icol) cp(:,icol)]'); |
---|
391 |
end %for |
---|
392 |
|
---|
393 |
%------------------------------------------------------------------------------- |
---|
394 |
% TEST MAIN MODULE |
---|
395 |
% SUB-MODULES |
---|
396 |
%------------------------------------------------------------------------------ |
---|
397 |
module = 'sw_svel.m'; |
---|
398 |
disp(' ') |
---|
399 |
disp('************************************************************************') |
---|
400 |
disp(['** TESTING MODULE: ' module]) |
---|
401 |
disp('************************************************************************') |
---|
402 |
if display_help |
---|
403 |
eval(['help ' module]) |
---|
404 |
end %if |
---|
405 |
|
---|
406 |
% TEST 1 - |
---|
407 |
% DATA FROM POND AND PICKARD INTRO. DYNAMICAL OCEANOGRAPHY 2ND ED. 1986 |
---|
408 |
%*************************************************************************** |
---|
409 |
|
---|
410 |
T = [ 0 0 0 0 0 0; |
---|
411 |
10 10 10 10 10 10; |
---|
412 |
20 20 20 20 20 20; |
---|
413 |
30 30 30 30 30 30; |
---|
414 |
40 40 40 40 40 40 ] / 1.00024; |
---|
415 |
|
---|
416 |
S = [25 25 25 35 35 35; |
---|
417 |
25 25 25 35 35 35; |
---|
418 |
25 25 25 35 35 35 ; |
---|
419 |
25 25 25 35 35 35; |
---|
420 |
25 25 25 35 35 35 ]; |
---|
421 |
|
---|
422 |
P = [0 5000 10000 0 5000 10000; |
---|
423 |
0 5000 10000 0 5000 10000; |
---|
424 |
0 5000 10000 0 5000 10000 ; |
---|
425 |
0 5000 10000 0 5000 10000; |
---|
426 |
0 5000 10000 0 5000 10000 ]; |
---|
427 |
|
---|
428 |
UN_svel = [1435.8 1520.4 1610.4 1449.1 1534.0 1623.2; |
---|
429 |
1477.7 1561.3 1647.4 1489.8 1573.4 1659.0; |
---|
430 |
1510.3 1593.6 1676.8 1521.5 1604.5 1687.2; |
---|
431 |
1535.2 1619.0 1700.6 1545.6 1629.0 1710.1; |
---|
432 |
1553.4 1638.0 1719.2 1563.2 1647.3 1727.8 ]; |
---|
433 |
|
---|
434 |
svel = sw_svel(S,T,P); |
---|
435 |
|
---|
436 |
%---------------- |
---|
437 |
% DISPLAY RESULTS |
---|
438 |
%---------------- |
---|
439 |
disp(' ') |
---|
440 |
disp ('********************************************************') |
---|
441 |
disp ('Comparison of accepted values from UNESCO 1983 ') |
---|
442 |
disp (' (Unesco Tech. Paper in Marine Sci. No. 44, p50)') |
---|
443 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
444 |
disp ('********************************************************') |
---|
445 |
|
---|
446 |
for icol = 1:length(S(1,:)) |
---|
447 |
disp(' ') |
---|
448 |
disp (' Sal Temp Press SVEL sw_svel') |
---|
449 |
disp (' (psu) (C) (db) (m/s) (m/s)') |
---|
450 |
fprintf(1,' %4.0f %4.0f %5.0f %8.1f %11.3f\n', ... |
---|
451 |
[S(:,icol) T(:,icol) P(:,icol) UN_svel(:,icol) svel(:,icol)]'); |
---|
452 |
end %for |
---|
453 |
|
---|
454 |
%---------------------------------------------------------------------------- |
---|
455 |
% TEST MAIN MODULE |
---|
456 |
% SUB-MODULES |
---|
457 |
%--------------------------------------------------------------------------- |
---|
458 |
submodules = 'sw_alpha.m sw_beta.m sw_aonb.m'; |
---|
459 |
disp(' ') |
---|
460 |
disp('**********************************************************************') |
---|
461 |
disp(['** TESTING MODULE: ' submodules]) |
---|
462 |
disp('**********************************************************************') |
---|
463 |
if display_help |
---|
464 |
eval(['help ' submodules]) |
---|
465 |
end %if |
---|
466 |
|
---|
467 |
% DATA FROM MCDOUOGALL 1987 |
---|
468 |
s = 40; |
---|
469 |
ptmp = 10; |
---|
470 |
p = 4000; |
---|
471 |
beta_lit = 0.72088e-03; |
---|
472 |
aonb_lit = 0.34763; |
---|
473 |
alpha_lit = aonb_lit*beta_lit; |
---|
474 |
|
---|
475 |
%$$$ % TEST ARGUMENT PASSING |
---|
476 |
%$$$ beta = sw_beta(s,ptmp,p,'ptmp') |
---|
477 |
%$$$ beta = sw_beta(s,ptmp,p,'temp') |
---|
478 |
%$$$ beta = sw_beta(s,ptmp,p) |
---|
479 |
%$$$ |
---|
480 |
%$$$ alpha = sw_alpha(s,ptmp,p,'ptmp') |
---|
481 |
%$$$ alpha = sw_alpha(s,ptmp,p,'temp') |
---|
482 |
%$$$ alpha = sw_alpha(s,ptmp,p) |
---|
483 |
%$$$ |
---|
484 |
%$$$ aonb = sw_aonb( s,ptmp,p,'ptmp') |
---|
485 |
%$$$ aonb = sw_aonb( s,ptmp,p,'temp') |
---|
486 |
%$$$ aonb = sw_aonb( s,ptmp,p) |
---|
487 |
%$$$ |
---|
488 |
beta = sw_beta( s,ptmp,p,'ptmp'); |
---|
489 |
alpha = sw_alpha(s,ptmp,p,'ptmp'); |
---|
490 |
aonb = sw_aonb( s,ptmp,p,'ptmp'); |
---|
491 |
|
---|
492 |
%---------------- |
---|
493 |
% DISPLAY RESULTS |
---|
494 |
%---------------- |
---|
495 |
disp(' ') |
---|
496 |
disp ('********************************************************') |
---|
497 |
disp ('Comparison of accepted values from MCDOUGALL 1987 ') |
---|
498 |
disp (['with computed results on ' computer ' computer']) |
---|
499 |
disp ('********************************************************') |
---|
500 |
|
---|
501 |
disp(' ') |
---|
502 |
disp (' Sal Temp Press BETA sw_beta') |
---|
503 |
disp (' (psu) (C) (db) (psu^-1) (psu^-1)') |
---|
504 |
fprintf(1,' %4.0f %4.0f %5.0f %11.4e %11.5e\n', ... |
---|
505 |
[s ptmp p beta_lit beta]'); |
---|
506 |
|
---|
507 |
disp(' ') |
---|
508 |
disp (' Sal Temp Press AONB sw_aonb') |
---|
509 |
disp (' (psu) (C) (db) (psu C^-1) (psu C^-1)') |
---|
510 |
fprintf(1,' %4.0f %4.0f %5.0f %8.5f %11.6f\n', ... |
---|
511 |
[s ptmp p aonb_lit aonb]'); |
---|
512 |
|
---|
513 |
disp(' ') |
---|
514 |
disp (' Sal Temp Press ALPHA sw_alpha') |
---|
515 |
disp (' (psu) (C) (db) (psu^-1) (psu^-1)') |
---|
516 |
fprintf(1,' %4.0f %4.0f %5.0f %11.4e %11.4e\n', ... |
---|
517 |
[s ptmp p alpha_lit alpha]'); |
---|
518 |
|
---|
519 |
%-------------------------------- |
---|
520 |
% TEST MAIN MODULE sw_satO2.m |
---|
521 |
% SUB-MODULES |
---|
522 |
%-------------------------------- |
---|
523 |
module = 'sw_satO2 sw_satN2 sw_satAr'; |
---|
524 |
disp(' ') |
---|
525 |
disp('*************************************') |
---|
526 |
disp(['** TESTING MODULE: ' module]) |
---|
527 |
disp(['** and SUB-MODULE: ' submodules]) |
---|
528 |
disp('*************************************') |
---|
529 |
if display_help |
---|
530 |
eval(['help ' module]) |
---|
531 |
end %if |
---|
532 |
|
---|
533 |
% Data from Weiss 1970 |
---|
534 |
|
---|
535 |
T = [-1 -1; |
---|
536 |
10 10; |
---|
537 |
20 20 ; |
---|
538 |
40 40 ] / 1.00024; |
---|
539 |
|
---|
540 |
S = [20 40; |
---|
541 |
20 40; |
---|
542 |
20 40 ; |
---|
543 |
20 40]; |
---|
544 |
|
---|
545 |
lit_O2= [ 9.162 7.984; |
---|
546 |
6.950 6.121; |
---|
547 |
5.644 5.015; |
---|
548 |
4.050 3.656]; |
---|
549 |
|
---|
550 |
lit_N2= [16.28 14.01; |
---|
551 |
12.64 11.01; |
---|
552 |
10.47 9.21; |
---|
553 |
7.78 6.95]; |
---|
554 |
|
---|
555 |
lit_Ar= [ 0.4456 0.3877; |
---|
556 |
0.3397 0.2989; |
---|
557 |
0.2766 0.2457; |
---|
558 |
0.1986 0.1794]; |
---|
559 |
|
---|
560 |
|
---|
561 |
satO2 = sw_satO2(S,T); |
---|
562 |
satN2 = sw_satN2(S,T); |
---|
563 |
satAr = sw_satAr(S,T); |
---|
564 |
|
---|
565 |
%---------------- |
---|
566 |
% DISPLAY RESULTS |
---|
567 |
%---------------- |
---|
568 |
disp(' ') |
---|
569 |
disp ('********************************************************') |
---|
570 |
disp ('Comparison of accepted values from Weiss, R.F. 1979 ') |
---|
571 |
disp ('"The solubility of nitrogen, oxygen and argon in water and seawater."') |
---|
572 |
disp (' Deap-Sea Research., 1970, Vol 17, pp721-735.') |
---|
573 |
disp (['with computed results from ' module ' on ' computer ' computer']) |
---|
574 |
disp ('********************************************************') |
---|
575 |
|
---|
576 |
for icol = 1:length(S(1,:)) |
---|
577 |
disp(' ') |
---|
578 |
disp (' Sal Temp O2 sw_satO2') |
---|
579 |
disp (' (psu) (C) (ml/l) (ml/l)') |
---|
580 |
fprintf(1,' %4.0f %4.0f %8.2f %9.3f\n', ... |
---|
581 |
[S(:,icol) T(:,icol) lit_O2(:,icol) satO2(:,icol)]'); |
---|
582 |
end %for |
---|
583 |
|
---|
584 |
for icol = 1:length(S(1,:)) |
---|
585 |
disp(' ') |
---|
586 |
disp (' Sal Temp N2 sw_satN2') |
---|
587 |
disp (' (psu) (C) (ml/l) (ml/l)') |
---|
588 |
fprintf(1,' %4.0f %4.0f %8.2f %9.3f\n', ... |
---|
589 |
[S(:,icol) T(:,icol) lit_N2(:,icol) satN2(:,icol)]'); |
---|
590 |
end %for |
---|
591 |
|
---|
592 |
for icol = 1:length(S(1,:)) |
---|
593 |
disp(' ') |
---|
594 |
disp (' Sal Temp Ar sw_satAr') |
---|
595 |
disp (' (psu) (C) (ml/l) (ml/l)') |
---|
596 |
fprintf(1,' %4.0f %4.0f %8.4f %9.4f\n', ... |
---|
597 |
[S(:,icol) T(:,icol) lit_Ar(:,icol) satAr(:,icol)]'); |
---|
598 |
end %for |
---|
599 |
|
---|
600 |
diary off |
---|
601 |
|
---|