Back to home page

MITgcm

 
 

    


Warning, /verification/tutorial_baroclinic_gyre/input/gendata.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 3bb0c0ba on 2021-09-23 16:31:24 UTC
ce0d9af5ea Jeff*0001 ieee = 'b';           % big-endian format
                0002 accuracy = 'float32'; % this is single-precision (='real*4')
72445f86f9 Jean*0003 
ce0d9af5ea Jeff*0004 Ho = 1800;  % depth of ocean (m)
                0005 nx = 62;    % gridpoints in x
                0006 ny = 62;    % gridpoints in y
                0007 xo = 0;     % origin in x,y for ocean domain
                0008 yo = 15;    % (i.e. southwestern corner of ocean domain)
                0009 dx = 1;     % grid spacing in x (degrees longitude)
                0010 dy = 1;     % grid spacing in y (degrees latitude)
                0011 xeast  = xo + (nx-2)*dx;   % eastern extent of ocean domain
                0012 ynorth = yo + (ny-2)*dy;   % northern extent of ocean domain
72445f86f9 Jean*0013 
                0014 % Flat bottom at z=-Ho
ce0d9af5ea Jeff*0015 h = -Ho * ones(nx, ny);
                0016 
94151a9b18 Jeff*0017 % create a border ring of walls around edge of domain
ce0d9af5ea Jeff*0018 h([1 end], :) = 0;   % set ocean depth to zero at east and west walls
                0019 h(:, [1 end]) = 0;   % set ocean depth to zero at south and north walls
                0020 fid=fopen('bathy.bin', 'w', ieee);
                0021 fwrite(fid, h, accuracy);
                0022 fclose(fid);
                0023 
                0024 % ocean domain extends from (xo,yo) to (xeast,ynorth)
                0025 % (i.e. the ocean spans nx-2, ny-2 grid cells)
                0026 % out-of-box-config: xo=0, yo=15, dx=dy=1 deg, ocean extent (0E,15N)-(60E,75N)
                0027 % model domain includes a land cell surrounding the ocean domain
                0028 % The full model domain cell centers are located at:
                0029 %    XC(:,1) = -0.5, +0.5, ..., +60.5 (degrees longitiude)
                0030 %    YC(1,:) = 14.5, 15.5, ..., 75.5 (degrees latitude)
                0031 % and full model domain cell corners are located at:
                0032 %    XG(:,1) = -1,  0, ..., 60 [, 61] (degrees longitiude)
                0033 %    YG(1,:) = 14, 15, ..., 75 [, 76] (degrees latitude)
                0034 % where the last value in brackets is not included 
                0035 % in the MITgcm grid variables XG,YG (but is in variables Xp1,Yp1)
                0036 % and reflects the eastern and northern edge of the model domain respectively.
                0037 % See section 2.11.4 of the MITgcm users manual.
72445f86f9 Jean*0038 
ce0d9af5ea Jeff*0039 % Zonal wind-stress
                0040 tauMax = 0.1;
                0041 x = (xo-dx) : dx : xeast;
                0042 y = (yo-dy/2) : dy : (ynorth+dy/2); 
                0043 [X,Y] = ndgrid(x, y);  % zonal wind-stress on (XG,YC) points
                0044 tau = -tauMax * cos(2*pi*((Y-yo)/(ny-2)/dy)); % ny-2 accounts for walls at N,S boundaries
                0045 fid=fopen('windx_cosy.bin', 'w', ieee);
                0046 fwrite(fid, tau, accuracy);
                0047 fclose(fid);
94151a9b18 Jeff*0048 
3bb0c0ba57 Jeff*0049 % Restoring temperature (function of y only,
                0050 % from Tmax at southern edge to Tmin at northern edge)
ce0d9af5ea Jeff*0051 Tmax = 30;
                0052 Tmin = 0;
3bb0c0ba57 Jeff*0053 Trest = (Tmax-Tmin)/(ny-2)/dy * (ynorth-Y) + Tmin; % located and computed at YC points
ce0d9af5ea Jeff*0054 fid=fopen('SST_relax.bin', 'w', ieee);
                0055 fwrite(fid, Trest, accuracy);
                0056 fclose(fid);