| 1 | % function tide_bc_empty(nx, ny, cbdry_used, tide_num) | 
| 2 | % | 
| 3 | % | 
| 4 | %  Make a dummy tidal bc for cbdry_used {'s', 'n', 'w', 'e'} | 
| 5 | %  based on the size on nx and ny  with zero amplitude and phase | 
| 6 | % | 
| 7 | % Input:  nx, first   dimension of MITgcm | 
| 8 | %         ny, second  dimension of MITgcm | 
| 9 | %   tide_num, used to decide the dimension of boundary bc file [length, num of tidal constituent] | 
| 10 | % cddry_used, boundary {'s', 'n', 'w', 'e'} to generate empty tidal bc file | 
| 11 | % | 
| 12 | % | 
| 13 | % | 
| 14 | %         tide_num[nc<10], Which tide to include, | 
| 15 | %                          m2  s2  n2  k2  k1  o1  p1  q1  mf  mm | 
| 16 | %                          1   2   3   4   5   6   7   8   9   10 | 
| 17 | % | 
| 18 | % OB[N,S,E,W][am,ph]File :: Files with boundary conditions, | 
| 19 | %                           the letter combinations mean: | 
| 20 | %              N/S/E/W   :: northern/southern/eastern/western boundary | 
| 21 | %              am/ph     :: tidal amplitude (m/s) / radian | 
| 22 | % | 
| 23 | % | 
| 24 | %  XC WANG /12/12/2012 | 
| 25 | % | 
| 26 | %addpath /data17/home/xiao/CAT/Tool/TMD2.03 | 
| 27 | function tide_bc_empty(nx, ny, cbdry_used, tide_num) | 
| 28 |  | 
| 29 | % addpath /data17/home/xiao/CAT/Tool/TMD2.03 | 
| 30 |  | 
| 31 | %model_file =['Model_CATS2008a_opt']; | 
| 32 | model_file =['Model_CATS2008b_km']; | 
| 33 |  | 
| 34 | % Dimension of Boundary files | 
| 35 | % NX, grid points in horizontal direction | 
| 36 | % NH, grid points in vertical direction | 
| 37 | % Use the first records to create tidal BC | 
| 38 | %NX=640; NY=640; NH=70;  month_in = 1; | 
| 39 | NX = nx; NY=ny ; | 
| 40 |  | 
| 41 | % | 
| 42 | rad2deg = 180/pi ; | 
| 43 | deg2rad = pi/180 ; | 
| 44 |  | 
| 45 | % Set the Boundary to add tides | 
| 46 | % AngleCS_bc, AngleSN_bc are the Cos and Sin and angle of U axis of MITgcm | 
| 47 | % from due east | 
| 48 | %ibc = 3 ; | 
| 49 | % ibc = 4 ; | 
| 50 | c_bdry3 = cbdry_used ; | 
| 51 |  | 
| 52 | for ibc =length(c_bdry3) | 
| 53 |  | 
| 54 | c_bdry=c_bdry3{ibc} ; | 
| 55 |  | 
| 56 |  | 
| 57 | % Characters for Model Tidal BC file | 
| 58 | cob=upper(c_bdry) ; | 
| 59 | fld={'am','ph'}  ; | 
| 60 |  | 
| 61 |  | 
| 62 | if any(strcmp(cob, {'N','S'})) | 
| 63 | OBlength = NX ; | 
| 64 | else | 
| 65 | OBlength = NY ; | 
| 66 | end | 
| 67 |  | 
| 68 |  | 
| 69 | %  Try for one tides only | 
| 70 | % tide_num = 1:c8 ; | 
| 71 | %tide_num = 5 ; | 
| 72 |  | 
| 73 | amp_all = zeros(OBlength, length(tide_num)) ; | 
| 74 | pha_all = zeros(OBlength, length(tide_num)) ; | 
| 75 |  | 
| 76 |  | 
| 77 |  | 
| 78 | % Write to file | 
| 79 | cfld = fld{1} ; | 
| 80 | fnm=['OB' cob cfld '.seaice_obcs']; | 
| 81 | %fnm=['OB' cob cfld '.seaice_obcs.k1']; | 
| 82 | writebin(fnm, amp_all) ; | 
| 83 |  | 
| 84 |  | 
| 85 | cfld = fld{2} ; | 
| 86 | fnm=['OB' cob cfld '.seaice_obcs']; | 
| 87 | %fnm=['OB' cob cfld '.seaice_obcs.k1']; | 
| 88 | writebin(fnm, pha_all) ; | 
| 89 |  | 
| 90 | end | 
| 91 |  | 
| 92 | return |