/[MITgcm]/MITgcm_contrib/shelfice_remeshing/CLEAN/input/rdmds_init_pig.m
ViewVC logotype

Contents of /MITgcm_contrib/shelfice_remeshing/CLEAN/input/rdmds_init_pig.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Mon Jan 18 10:37:22 2016 UTC (9 years, 6 months ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +125 -151 lines
Grounding line fix

1 %This program creates open boundary prescription files for the PIG
2 %experiment based on the 10 yrs spin-up run using OBCS with
3 %U,V = 0, Tref, Sref
4
5 %following variables
6 %-----3D fields-----
7 % T Temperature (C)
8 % S Salinity (psu)
9 % U u-velocity (m/s)
10 % PH ocean pressure (or atm geopotential)
11
12
13
14
15 %Set the grid size;
16 nx = 3; delx = 1; X = nx*delx;
17 ny = 400; dely = 1; Y = ny*dely;
18 nz = 100; delz = 10; Z = nz*delz;
19
20 %x axis
21 x = 1:delx:X;
22 %y axis
23 y = 1:dely:Y;
24 %z axis [m]
25 z = delz:delz:Z;
26
27
28 %Note:
29 %Ensure that the volume flux is zero at the open boundary
30
31
32 %% ________________________________________________________________________
33 % First try: linear velocity profile.
34 % From U = -0.025 ms-1 (outwards) to 0.025 ms-1
35 % Constant in y direction (meridionally)
36 % Do not take exactly Umin and Umax from the OBC of the original
37 % experiment: Take modified numbers to that Umin = -Umax and volume is conserved
38
39 % Initialize variable
40 V_OBC(1:nx,1:nz) = NaN;
41
42
43 v_sfc = 0.025; %U at sfc
44 v_bottom = -0.025; %U at bottom
45 del_v = (v_bottom - v_sfc)/((nz-1)*delz); %delu/delz
46
47 for iz = 1:nz;
48 V_OBC(1:nx,iz) = v_sfc + del_v*((iz-1)*delz);
49 end
50
51
52 % Linear T profile
53 % From Tmin at sfc increasing to Tmax at bottom
54 % Take Tmin and Tmax from the OBC of the original PIG experiment
55
56 % Initialize variable
57 T_OBC(1:nx,1:nz) = NaN;
58
59
60 T_sfc = -1.9;
61 T_bottom = 1.1967;
62 del_T = (T_bottom - T_sfc)/((nz-1)*delz);
63
64 for iz = 1:nz;
65 T_OBC(1:nx,iz) = T_sfc + del_T*((iz-1)*delz);
66 end
67
68
69 % Linear S profile
70 % From Smin at sfc increasing to Smax at bottom
71 % Take Smin and Smax from the OBC of the original PIG experiment
72
73 % Initialize variable
74 S_OBC(1:nx,1:nz) = NaN;
75
76 S_sfc = 34.2050;
77 S_bottom = 34.6967;
78 del_S = (S_bottom - S_sfc)/((nz-1)*delz);
79
80 for iz = 1:nz;
81 S_OBC(1:nx,iz) = S_sfc + del_S*((iz-1)*delz);
82 end
83
84
85
86 %% Initial T & S conditions
87
88 % Take western open boundary conditions for T & S
89 % and assume no change in x-direction
90
91 T_init = zeros(nx,ny,nz);
92 S_init = zeros(nx,ny,nz);
93
94 for iy = 1:ny;
95 T_init(:,iy,:) = T_OBC;
96 S_init(:,iy,:) = S_OBC;
97 end
98
99
100
101 %% Print OBCS files for T, S
102
103 % fid=fopen('uvel.obw','w','b'); fprintf(fid,'%10.4f',U_OBC);fclose(fid);
104 fid=fopen('vvel.obw','w','b'); fwrite(fid,V_OBC,'real*8'); fclose(fid);
105 % fid=fopen('uvel.obw','w','b'); fwrite(fid,U_OBC,'real*8'); fclose(fid);
106 fid=fopen('theta.obw','w','b'); fwrite(fid,T_OBC,'real*8'); fclose(fid);
107 fid=fopen('salt.obw','w','b'); fwrite(fid,S_OBC,'real*8'); fclose(fid);
108 % fid=fopen('theta.obw','w'); fprintf(fid,'%10.4f',T_OBC);fclose(fid);
109 % fid=fopen('salt.obw','w'); fprintf(fid,'%10.4f',S_OBC);fclose(fid);
110
111
112
113 %% Print init files for T, S
114
115 fid_T=fopen('theta.init','w','b');fwrite(fid,T_init,'real*8');fclose(fid);
116 fid_T=fopen('salt.init','w','b');fwrite(fid,S_init,'real*8');fclose(fid);
117
118
119 % for iz = 1:nz;
120 % fprintf(fid_T,'%10.4f',T_init(:,:,iz));
121 % fprintf(fid_S,'%10.4f',S_init(:,:,iz));
122 % end
123 %
124 % fclose(fid_T);
125 % fclose(fid_S);

  ViewVC Help
Powered by ViewVC 1.1.22