# [MITgcm-support] periodic channel

Yuan Lian lian at U.Arizona.EDU
Tue Feb 22 15:03:50 EST 2005

```On Tue, 22 Feb 2005, Baylor Fox-Kemper wrote:
Hi, Baylor,

Can the following configuration be extended to atmospheric model? It would
be nice to setup a periodic boundary condition for atmosphere.

-Yuan

> Hi Kelvin and Mike,
>    I have a bunch of runs set up like this.  I don't specify anything
> about reentrance, only give a topography file that has depth zero at
> the northernmost gridpoint.  It seems to work fine.
>    Cheers,
>      -Baylor
>
> Relevant lines from a matlab topography generation program...
>
> %-- Grid: z  These are a number of ways of generating variable vertical
> grid spacing
> %dh=[10*ones(1,20), 20, 40, 80, 160, 320, 640];
> %dh=[20*ones(1,10), 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100,
> 120, 140, 160, 180];
>
> dh=5*ones(1,38);  % This gives 5 m resolution at top
> for i=21:38
>    dh(i)=dh(i-1)*1.1917;   % This stretches out coords toward the bottom
> end
>
> zf=-round(cumsum([0 dh])/1)*1;   % Face z points
> zf(end)=zf(end)-1; % This makes the last one an even 800 m
> dh=-diff(zf);
> zc=(zf(1:end-1)+zf(2:end))/2;  % centered z points
> nz=length(dh);
> H=sum(dh)   %  This ensures that the depth is the sum of the specified
> grid points
>
> % Bathymetry is on Xc, Yc
> hh=ones(size(XB));
>
> % Variable Bathymetry  (This gives sloping walls approaching the sides)
> hh(:,:)=hh(:,:)-2*max(0,abs(YB/L-1/2)-3/8);
>
> hh(:,end)=0*hh(:,end);
>
>
> hh=-H*hh;  % This makes the bottom the correct depth
>
>    % This saves to a file that can be opened by the model
> fid=fopen('topo_sl.bin','w','b'); fwrite(fid,hh,'real*8'); fclose(fid);
>
>
>  From the data file, you now need to specify:
>
> # Input datasets
>   &PARM05
>   bathyFile='topo_sl.bin',
>   /
>
> And make sure delR, dx and dy are defined correctly.  This can be done
> with a .bin file or just by specifying delR in the data file, or by
> setting the defaults that are called in ini_parms.F  (I think they are
> dxSpacing and dySpacing )
>
> # Gridding parameters
>   &PARM04
>   usingCartesianGrid=.TRUE.,
>   usingSphericalPolarGrid=.FALSE.,
>    delR=  5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      5.0000,
>      6.0000,
>      7.0000,
>      9.0000,
>     10.0000,
>     12.0000,
>     14.0000,
>     17.0000,
>     20.0000,
>     25.0000,
>     28.0000,
>     35.0000,
>     41.0000,
>     49.0000,
>     58.0000,
>     69.0000,
>     83.0000,
>     99.0000,
>    118.0000,
>   delXfile='dx_variable.bin',
>   delYfile='dy_variable.bin',
>   /
>
> For the simple case of a dx, dy cartesian in a specified domain size:
> dx=ones(1,nx);                                  % uniform resolution
> dx=dx*Lx/sum(dx);
> xf=cumsum([0 dx]); % Face x points
> xc=(xf(1:end-1)+xf(2:end))/2; % Centered x points
>
> %-- Grid: y
> dy_ratio=30; dy_trans=.02; dy_min=100;
> yn=(0.5:ny)/ny;
> dy=ones(1,ny);                                  % uniform resolution
> dy=dy*Ly/sum(dy);
> yf=cumsum([0 dy]);  % Face y-points
> yc=(yf(1:end-1)+yf(2:end))/2;  %Centered y-points
>
> L=yc(end)-yc(1);	% this takes into account the wall of topography!!!
>
> fid=fopen('dx_variable.bin','w','b'); fwrite(fid,dx,'real*8');
> fclose(fid);
> fid=fopen('dy_variable.bin','w','b'); fwrite(fid,dy,'real*8');
> fclose(fid);
>
> Cheers,
>     -Baylor
>
>
> On Feb 22, 2005, at 1:48 PM, Mike Spall wrote:
>

```