subroutine wad_real C ********************************************************************** C * * C * FUNCTION : Sets up for real topodata problem w/wad. * C * * C ********************************************************************** C implicit none C include 'pom08.c' C real delx,elejmid,elwjmid,ra,vel,hland,dely !lyo:!wad:define hland integer nvar !lyo:!wad:define nvar integer i,j,k,m real rad,re,dlat,dlon,cff rad=0.01745329 re=6371.E3 !lyo:!wad:Define variable or uniform grid option: nvar=1 !=1 for variable grid; =0 otherwise !lyo:!wad:Special test case for smaller delx=4km: C C Current velocity: C vel=0.0e0 C C Read Ocean Topography dataset C Open(40,file='POM08_Topo.dat',form='formatted') do j=jm,1,-1 do i=1,im read(40,*) east_e(i,j),north_e(i,j),h(i,j) enddo enddo close(40) ! !lyo:_20080415:Move "calc. Coriolis etc" through "call areas_masks" ! from below (after call dens) to here; otherwise, fsm will not ! be defined but is used in subroutine dens. (This is a pom2k_bug). C C --- calc. Coriolis Parameter C do j=1,jm do i=1,im cor(i,j)=2.*7.29E-5*sin(north_e(i,j)*rad) ! aam2d(i,j)=aam(i,j,1) !lyo:_20080415:pom2k_bug:aam not defined elb(i,j)=0. etb(i,j)=0. dt(i,j)=h(i,j) end do end do C do j=1,jm do i=2,im-1 dx(i,j)=0.5*rad*re*sqrt(((east_e(i+1,j)-east_e(i-1,j)) 1 *cos(north_e(i,j)*rad))**2+(north_e(i+1,j)-north_e(i-1,j))**2) end do dx(1,j)=dx(2,j) dx(im,j)=dx(im-1,j) end do do i=1,im do j=2,jm-1 dy(i,j)=0.5*rad*re*sqrt(((east_e(i,j+1)-east_e(i,j-1)) 1 *cos(north_e(i,j)*rad))**2+(north_e(i,j+1)-north_e(i,j-1))**2) end do dy(i,1)=dy(i,2) dy(i,jm)=dy(i,jm-1) end do C C --- the following grids are needed only for netcdf plotting C C Corner of cell points: C do j=2,jm do i=2,im east_c(i,j)=(east_e(i,j)+east_e(i-1,j) $ +east_e(i,j-1)+east_e(i-1,j-1))/4.e0 north_c(i,j)=(north_e(i,j)+north_e(i-1,j) $ +north_e(i,j-1)+north_e(i-1,j-1))/4.e0 end do end do C C C Extrapolate ends (approx.): C do i=2,im east_c(i,1)=2.*east_c(i,2)-east_c(i,3) north_c(i,1)=2.*north_c(i,2)-north_c(i,3) end do east_c(1,1)=2.*east_c(2,1)-east_c(3,1) C do j=2,jm east_c(1,j)=2.*east_c(2,j)-east_c(3,j) north_c(1,j)=2.*north_c(2,j)-north_c(3,j) end do north_c(1,1)=2.*north_c(1,2)-north_c(1,3) C C u-points: C do j=1,jm-1 do i=1,im east_u(i,j)=(east_c(i,j)+east_c(i,j+1))/2.e0 north_u(i,j)=(north_c(i,j)+north_c(i,j+1))/2.e0 end do end do C C Extrapolate ends: C do i=1,im east_u(i,jm)=(east_c(i,jm)*3.e0-east_c(i,jm-1))/2.e0 north_u(i,jm)=(north_c(i,jm)*3.e0-north_c(i,jm-1))/2.e0 end do C C v-points: C do j=1,jm do i=1,im-1 east_v(i,j)=(east_c(i,j)+east_c(i+1,j))/2.e0 north_v(i,j)=(north_c(i,j)+north_c(i+1,j))/2.e0 end do end do C C Extrapolate ends: C do j=1,jm east_v(im,j)=(east_c(im,j)*3.e0-east_c(im-1,j))/2.e0 north_v(im,j)=(north_c(im,j)*3.e0-north_c(im-1,j))/2.e0 end do C C rot is the angle (radians, anticlockwise) of the i-axis relative C to east, averaged to a cell centre: C C (NOTE that the following calculation of rot only works properly C for this particular rectangular grid) C do j=1,jm do i=1,im rot(i,j)=0.e0 end do end do C C Define LANDSEA COVER C !tne:!wad:!lyo:!wad: ! Note that unlike original seamount, h<0 is now water below MSL, and ! h>0 is above the MSL and is either land (if h>hland, see below) ! or is potential wet-and-dry region ! hland=5.e0 !note all pnts are potential WAD if we set ! !hland >= -hmax*(1.e0-delh) (=7.5m); ! !i.e. "if" below is NOT satisfied do j=1,jm do i=1,im if(h(i,j).gt.hland) h(i,j) = hhi + 1.e0 enddo enddo C C Calculate areas and masks: C !lyo:!wad:Define "h" consistent with WAD and calculate wetmask, cell areas ! and fsm etc. call wadh C C Adjust bottom topography so that cell to cell variations C in h do not exceed parameter slmax: C ! if(slmax.lt.1.e0) call slpmax !lyo:wad:now done in wadh above C C Set initial conditions: C do k=1,kbm1 do j=1,jm do i=1,im !lyo:wad: tb(i,j,k)=5.e0+15.e0*exp(zz(k)*h(i,j)/1000.e0)-tbias if (h(i,j).gt.hhi) then !lyo:wad:stratified water below MSL: tb(i,j,k)=5.e0+15.e0*exp(zz(k)*(h(i,j)-hhi)/1000.e0) else !lyo:wad:well-mixed water above MSL: tb(i,j,k)=5.e0+15.e0 endif tb(i,j,k)=tb(i,j,k)-tbias ! sb(i,j,k)=35.e0-sbias tclim(i,j,k)=tb(i,j,k) sclim(i,j,k)=sb(i,j,k) ub(i,j,k)=vel*dum(i,j) end do end do end do C C Initialise uab and vab as necessary C (NOTE that these have already been initialised to zero in the C main program): C do j=1,jm do i=1,im uab(i,j)=vel*dum(i,j) end do end do C C Set surface boundary conditions, e_atmos, vflux, wusurf, C wvsurf, wtsurf, wssurf and swrad, as necessary C (NOTE: C 1. These have all been initialised to zero in the main program. C 2. The temperature and salinity of inflowing water must be C defined relative to tbias and sbias.): C do j=1,jm do i=1,im C No conditions necessary for this problem ! !lyo:!wad:!pom2k_bug:tsurf and ssurf were never defined, but should be: tsurf(i,j)=tb(i,j,1) ssurf(i,j)=sb(i,j,1) ! end do end do C C Initialise elb, etb, dt and aam2d: C do j=1,jm do i=1,im elb(i,j)=(-e_atmos(i,j)-hhi)*fsm(i,j) !lyo:!wad: !lyo:!wad:note:The following "if" is not satisfied if nwad=0 since ! ! then fsm=wetmask at all cells ! ! if (fsm(i,j).ne.0.0.and.wetmask(i,j).eq.0.0) ! dry but not land if (fsm(i,j).ne.wetmask(i,j)) ! dry but not land &elb(i,j)=-h(i,j)+hco !note slightly smaller hco