1 |
% Generate example tidal input files. |
2 |
|
3 |
% Tidal input files are real*4 IEEE big-endian binary |
4 |
% with dimenstion OBlength * tidalComponents, |
5 |
% where OBlength is the length of the open boundary |
6 |
% and tidalComponents is the number of tidal components |
7 |
% specified in OBCS_PARAMS.h. |
8 |
|
9 |
% OB[N,S,E,W][am,ph]File :: Files with boundary conditions, |
10 |
% the letter combinations mean: |
11 |
% N/S/E/W :: northern/southern/eastern/western boundary |
12 |
% am/ph :: tidal amplitude (m/s) / phase (s) |
13 |
|
14 |
% Tidal periods are specified using variable tidalPeriod in data.obcs |
15 |
% Tidal amplitude is the maximum tidal velocity in m/s. |
16 |
% Tidal phase indicates time in s of maximum positive tide relative |
17 |
% to model startTime=0. |
18 |
|
19 |
% readbin.m and writebin.m are in MITgcm/utils/matlab/cs_grid/read_cs |
20 |
|
21 |
% create tidal input files |
22 |
nx=10; ny=8; |
23 |
tidalComponents=10; |
24 |
for ob={'N','S','E','W'} |
25 |
OBlength=ny; |
26 |
if any(strcmp(ob,{'N','S'})) |
27 |
OBlength=nx; |
28 |
end |
29 |
for fld={'am','ph'} |
30 |
fnm=['OB' ob{1} fld{1} '.seaice_obcs']; |
31 |
tmp=randn(OBlength,tidalComponents)/1000; |
32 |
|
33 |
% specify (0.1 m/s, 2 hr) for North boundary tidal component 1 |
34 |
if strcmp(ob,'N') |
35 |
if strcmp(fld,'am') |
36 |
tmp(:,1) = tmp(:,1) + 0.1; |
37 |
else |
38 |
tmp(:,1) = tmp(:,1) + 2 * 3600; |
39 |
end |
40 |
end |
41 |
|
42 |
% specify (0.2 m/s, 4 hr) for South boundary tidal component 2 |
43 |
if strcmp(ob,'S') |
44 |
if strcmp(fld,'am') |
45 |
tmp(:,2) = tmp(:,2) + 0.2; |
46 |
else |
47 |
tmp(:,2) = tmp(:,2) + 4 * 3600; |
48 |
end |
49 |
end |
50 |
|
51 |
% specify (0.3 m/s, 6 hr) for East boundary tidal component 3 |
52 |
if strcmp(ob,'E') |
53 |
if strcmp(fld,'am') |
54 |
tmp(:,3) = tmp(:,3) + 0.3; |
55 |
else |
56 |
tmp(:,3) = tmp(:,3) + 6 * 3600; |
57 |
end |
58 |
end |
59 |
|
60 |
% specify (0.4 m/s, 8 hr) for West boundary tidal component 4 |
61 |
if strcmp(ob,'W') |
62 |
if strcmp(fld,'am') |
63 |
tmp(:,4) = tmp(:,4) + 0.4; |
64 |
else |
65 |
tmp(:,4) = tmp(:,4) + 8 * 3600; |
66 |
end |
67 |
end |
68 |
|
69 |
writebin(fnm,tmp) |
70 |
end |
71 |
end |