1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
|
#include "FIZHI_OPTIONS.h" |
5 |
subroutine update_ocean_exports (myTime, myIter, myThid) |
subroutine update_ocean_exports (myTime, myIter, myThid) |
6 |
c---------------------------------------------------------------------- |
c---------------------------------------------------------------------- |
7 |
c Subroutine update_ocean_exports - 'Wrapper' routine to update |
c Subroutine update_ocean_exports - 'Wrapper' routine to update |
12 |
c getsice (Return the current sea ice field-read data if needed) |
c getsice (Return the current sea ice field-read data if needed) |
13 |
c----------------------------------------------------------------------- |
c----------------------------------------------------------------------- |
14 |
implicit none |
implicit none |
|
#include "CPP_OPTIONS.h" |
|
15 |
#include "SIZE.h" |
#include "SIZE.h" |
16 |
#include "GRID.h" |
#include "GRID.h" |
17 |
#include "fizhi_ocean_coms.h" |
#include "fizhi_ocean_coms.h" |
18 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
19 |
#include "chronos.h" |
#include "chronos.h" |
20 |
|
|
21 |
integer myTime, myIter, myThid |
integer myIter, myThid |
22 |
|
_RL myTime |
23 |
|
|
24 |
integer i, j, bi, bj, biglobal, bjglobal |
integer i, j, bi, bj, biglobal, bjglobal |
25 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 |
71 |
end |
end |
72 |
|
|
73 |
subroutine getsice(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
subroutine getsice(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
74 |
. nSx,nSy,nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms,sice) |
. nSumx,nSumy,nPgx,nPgy,bi,bj,biglobal,bjglobal,nymd,nhms,sice) |
75 |
C************************************************************************ |
C************************************************************************ |
76 |
C |
C |
77 |
C!ROUTINE: GETSICE |
C!ROUTINE: GETSICE |
90 |
C! im2 End of x-direction span for filling sice |
C! im2 End of x-direction span for filling sice |
91 |
C! jm1 Begin of y-direction span for filling sice |
C! jm1 Begin of y-direction span for filling sice |
92 |
C! jm2 End of y-direction span for filling sice |
C! jm2 End of y-direction span for filling sice |
93 |
C! nSx Number of processors in x-direction (local processor) |
C! nSumx Number of processors in x-direction (local processor) |
94 |
C! nSy Number of processors in y-direction (local processor) |
C! nSumy Number of processors in y-direction (local processor) |
95 |
C! nPx Number of processors in x-direction (global) |
C! nPgx Number of processors in x-direction (global) |
96 |
C! nPy Number of processors in y-direction (global) |
C! nPgx Number of processors in y-direction (global) |
97 |
C! bi Processor number in x-direction (local to processor) |
C! bi Processor number in x-direction (local to processor) |
98 |
C! bj Processor number in y-direction (local to processor) |
C! bj Processor number in y-direction (local to processor) |
99 |
C! biglobal Processor number in x-direction (global) |
C! biglobal Processor number in x-direction (global) |
102 |
C! nhms HHMMSS of the model time |
C! nhms HHMMSS of the model time |
103 |
C |
C |
104 |
C!OUTPUT PARAMETERS: |
C!OUTPUT PARAMETERS: |
105 |
C! sice(idim1:idim2,jdim1:jdim2,nSx,nSy) Sea ice depth in meters |
C! sice(idim1:idim2,jdim1:jdim2,nSumx,nSumy) Sea ice depth in meters |
106 |
C |
C |
107 |
C!ROUTINES CALLED: |
C!ROUTINES CALLED: |
108 |
C |
C |
113 |
C-------------------------------------------------------------------------- |
C-------------------------------------------------------------------------- |
114 |
|
|
115 |
implicit none |
implicit none |
116 |
#include "CPP_EEOPTIONS.h" |
#include "SIZE.h" |
117 |
|
|
118 |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx,nSy |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSumx,nSumy |
119 |
integer nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms |
integer nPgx,nPgy,bi,bj,biglobal,bjglobal,nymd,nhms |
120 |
|
|
121 |
_RL sice(idim1:idim2,jdim1:jdim2,nSx,nSy) |
_RL sice(idim1:idim2,jdim1:jdim2,nSumx,nSumy) |
122 |
|
|
123 |
C Maximum number of dates in one year for the data |
C Maximum number of dates in one year for the data |
124 |
integer ndmax |
integer ndmax |
126 |
|
|
127 |
character*8 cname |
character*8 cname |
128 |
character*80 cdscrip |
character*80 cdscrip |
129 |
real fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
character*40 sicedata |
130 |
|
_RL fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
131 |
logical first, found, error |
logical first, found, error |
132 |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc,npxbc,npybc |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc,npxbc,npybc |
133 |
integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec |
integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec |
134 |
integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod |
integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod |
135 |
|
|
136 |
real sicebc1(im2,jm2,nPx,nPy),sicebc2(im2,jm2,nPx,nPy) |
_RL sicebc1(sNx,sNy,nSx*nPx,nSy*nPy) |
137 |
|
_RL sicebc2(sNx,sNy,nSx*nPx,nSy*nPy) |
138 |
|
|
139 |
C--------- Variable Initialization --------------------------------- |
C--------- Variable Initialization --------------------------------- |
140 |
|
|
142 |
data error /.false./ |
data error /.false./ |
143 |
|
|
144 |
c save header info |
c save header info |
145 |
c save imbc,jmbc,npxbc,npybc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc |
save imbc,jmbc,npxbc,npybc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc |
146 |
c save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2 |
save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2 |
147 |
c save first |
save first |
148 |
c save sicebc1, sicebc2 |
save sicebc1, sicebc2 |
149 |
|
|
150 |
c this only works for between 1950-2050 |
c this only works for between 1950-2050 |
151 |
if (nymd .lt. 500101) then |
if (nymd .lt. 500101) then |
156 |
nymdmod = nymd |
nymdmod = nymd |
157 |
endif |
endif |
158 |
|
|
159 |
|
sicedata='sice19232.weekly.clim' |
160 |
|
|
161 |
c initialize so that first time through they have values for the check |
c initialize so that first time through they have values for the check |
162 |
c these vaules make the iyear .ne. iyearbc true anyways for |
c these vaules make the iyear .ne. iyearbc true anyways for |
163 |
c for the first time so first isnt checked below. |
c for the first time so first isnt checked below. |
179 |
if( iyear.ne.iyearbc ) then |
if( iyear.ne.iyearbc ) then |
180 |
|
|
181 |
close(iunit) |
close(iunit) |
182 |
open (iunit,form='unformatted',access='direct', |
open (iunit,file=sicedata,form='unformatted',access='direct', |
183 |
. recl=im2*jm2*nPx*nPy*4) |
. recl=im2*jm2*nPgx*nPgy*4) |
184 |
nrec = 1 |
nrec = 1 |
185 |
call bcheader (iunit, ndmax, nrec, |
call bcheader (iunit, ndmax, nrec, |
186 |
. cname, cdscrip, imbc, jmbc, npxbc, npybc, lat0, lon0, |
. cname, cdscrip, imbc, jmbc, npxbc, npybc, lat0, lon0, |
195 |
endif |
endif |
196 |
|
|
197 |
C Check Horizontal Resolution |
C Check Horizontal Resolution |
198 |
if(.not.error .and. imbc*jmbc*npxbc*npybc.ne.im2*jm2*npx*npy)then |
if(.not.error.and.imbc*jmbc*npxbc*npybc.ne.im2*jm2*npgx*npgy)then |
199 |
write(6,*) ' B.C. Resolution DOES NOT match Model Resolution!' |
write(6,*) ' B.C. Resolution DOES NOT match Model Resolution!' |
200 |
write(6,*) ' B.C. Resolution: ',imbc*jmbc*npxbc*npybc |
write(6,*) ' B.C. Resolution: ',imbc*jmbc*npxbc*npybc |
201 |
write(6,*) 'Model Resolution: ',im2*jm2*npx*npy |
write(6,*) 'Model Resolution: ',im2*jm2*npgx*npgy |
202 |
error = .true. |
error = .true. |
203 |
endif |
endif |
204 |
|
|
268 |
nymdbc2 = nymdbc(nd) |
nymdbc2 = nymdbc(nd) |
269 |
nhmsbc1 = nhmsbc(nd-1) |
nhmsbc1 = nhmsbc(nd-1) |
270 |
nhmsbc2 = nhmsbc(nd) |
nhmsbc2 = nhmsbc(nd) |
271 |
call bcdata (iunit,imbc,jmbc,nPx,nPy,nd,nd+1,sicebc1,sicebc2) |
call bcdata (iunit,imbc,jmbc,nPgx,nPgy,nd,nd+1,sicebc1,sicebc2) |
272 |
found = .true. |
found = .true. |
273 |
else |
else |
274 |
nd = nd + 1 |
nd = nd + 1 |
320 |
return |
return |
321 |
end |
end |
322 |
subroutine getsst(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
subroutine getsst(iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2, |
323 |
. nSx,nSy,nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms,sst) |
. nSumx,nSumy,nPgx,nPgy,bi,bj,biglobal,bjglobal,nymd,nhms,sst) |
324 |
C************************************************************************ |
C************************************************************************ |
325 |
C |
C |
326 |
C!ROUTINE: GETSST |
C!ROUTINE: GETSST |
339 |
C! im2 End of x-direction span for filling sice |
C! im2 End of x-direction span for filling sice |
340 |
C! jm1 Begin of y-direction span for filling sice |
C! jm1 Begin of y-direction span for filling sice |
341 |
C! jm2 End of y-direction span for filling sice |
C! jm2 End of y-direction span for filling sice |
342 |
C! nSx Number of processors in x-direction (local processor) |
C! nSumx Number of processors in x-direction (local processor) |
343 |
C! nSy Number of processors in y-direction (local processor) |
C! nSumy Number of processors in y-direction (local processor) |
344 |
C! nPx Number of processors in x-direction (global) |
C! nPgx Number of processors in x-direction (global) |
345 |
C! nPy Number of processors in y-direction (global) |
C! nPgy Number of processors in y-direction (global) |
346 |
C! bi Processor number in x-direction (local to processor) |
C! bi Processor number in x-direction (local to processor) |
347 |
C! bj Processor number in y-direction (local to processor) |
C! bj Processor number in y-direction (local to processor) |
348 |
C! biglobal Processor number in x-direction (global) |
C! biglobal Processor number in x-direction (global) |
351 |
C! nhms HHMMSS of the model time |
C! nhms HHMMSS of the model time |
352 |
C |
C |
353 |
C!OUTPUT PARAMETERS: |
C!OUTPUT PARAMETERS: |
354 |
C! sst(idim1:idim2,jdim1:jdim2,nSx,nSy) Sea surface temperature (K) |
C! sst(idim1:idim2,jdim1:jdim2,nSumx,nSumy) Sea surface temperature (K) |
355 |
C |
C |
356 |
C!ROUTINES CALLED: |
C!ROUTINES CALLED: |
357 |
C |
C |
362 |
C-------------------------------------------------------------------------- |
C-------------------------------------------------------------------------- |
363 |
|
|
364 |
implicit none |
implicit none |
365 |
#include "CPP_EEOPTIONS.h" |
#include "SIZE.h" |
366 |
|
|
367 |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSx,nSy |
integer iunit,idim1,idim2,jdim1,jdim2,im1,im2,jm1,jm2,nSumx,nSumy |
368 |
integer nPx,nPy,bi,bj,biglobal,bjglobal,nymd,nhms |
integer nPgx,nPgy,bi,bj,biglobal,bjglobal,nymd,nhms |
369 |
|
|
370 |
_RL sst(idim1:idim2,jdim1:jdim2,nSx,nSy) |
_RL sst(idim1:idim2,jdim1:jdim2,nSumx,nSumy) |
371 |
|
|
372 |
C Maximum number of dates in one year for the data |
C Maximum number of dates in one year for the data |
373 |
integer ndmax |
integer ndmax |
375 |
|
|
376 |
character*8 cname |
character*8 cname |
377 |
character*80 cdscrip |
character*80 cdscrip |
378 |
real fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
character*20 sstdata |
379 |
|
_RL fac1, fac2, lat0, lon0, timebc1, timebc2, timemod, undef |
380 |
logical first, found, error |
logical first, found, error |
381 |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc,npxbc,npybc |
integer i,j,n,nn,iyear,iyearbc,nd,ndby3,imbc,jmbc,npxbc,npybc |
382 |
integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec |
integer ndatebc,nhmsbc(ndmax), nhmsbc1, nhmsbc2,nrec |
383 |
integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod |
integer nymdbc(ndmax),nymdbc1,nymdbc2,nymdmod |
384 |
|
|
385 |
real sstbc1(im2,jm2,nPx,nPy),sstbc2(im2,jm2,nPx,nPy) |
_RL sstbc1(sNx,sNy,nSx*nPx,nSy*nPy) |
386 |
|
_RL sstbc2(sNx,sNy,nSx*nPx,nSy*nPy) |
387 |
|
|
388 |
C--------- Variable Initialization --------------------------------- |
C--------- Variable Initialization --------------------------------- |
389 |
|
|
391 |
data error /.false./ |
data error /.false./ |
392 |
|
|
393 |
c save header info |
c save header info |
394 |
c save imbc,jmbc,npxbc,npybc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc |
save imbc,jmbc,npxbc,npybc,lat0,lon0,ndatebc,undef,nymdbc,nhmsbc |
395 |
c save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2 |
save nymdbc1, nymdbc2, nhmsbc1, nhmsbc2 |
396 |
c save first |
save first |
397 |
c save sstbc1, sstbc2 |
save sstbc1, sstbc2 |
398 |
|
|
399 |
c this only works for between 1950-2050 |
c this only works for between 1950-2050 |
400 |
if (nymd .lt. 500101) then |
if (nymd .lt. 500101) then |
405 |
nymdmod = nymd |
nymdmod = nymd |
406 |
endif |
endif |
407 |
|
|
408 |
|
sstdata='sst19232.weekly.clim' |
409 |
|
|
410 |
c initialize so that first time through they have values for the check |
c initialize so that first time through they have values for the check |
411 |
c these vaules make the iyear .ne. iyearbc true anyways for |
c these vaules make the iyear .ne. iyearbc true anyways for |
412 |
c for the first time so first isnt checked below. |
c for the first time so first isnt checked below. |
427 |
if( iyear.ne.iyearbc ) then |
if( iyear.ne.iyearbc ) then |
428 |
|
|
429 |
close(iunit) |
close(iunit) |
430 |
open (iunit,form='unformatted',access='direct', |
open (iunit,file=sstdata,form='unformatted',access='direct', |
431 |
. recl=im2*jm2*nPx*nPy*4) |
. recl=im2*jm2*nPgx*nPgy*4) |
432 |
nrec = 1 |
nrec = 1 |
433 |
call bcheader (iunit, ndmax, nrec, |
call bcheader (iunit, ndmax, nrec, |
434 |
. cname, cdscrip, imbc, jmbc, npxbc, npybc, lat0, lon0, |
. cname, cdscrip, imbc, jmbc, npxbc, npybc, lat0, lon0, |
443 |
endif |
endif |
444 |
|
|
445 |
C Check Horizontal Resolution |
C Check Horizontal Resolution |
446 |
if(.not.error .and. imbc*jmbc*npxbc*npybc.ne.im2*jm2*npx*npy)then |
if(.not.error.and.imbc*jmbc*npxbc*npybc.ne.im2*jm2*npgx*npgy)then |
447 |
write(6,*) ' B.C. Resolution DOES NOT match Model Resolution!' |
write(6,*) ' B.C. Resolution DOES NOT match Model Resolution!' |
448 |
write(6,*) ' B.C. Resolution: ',imbc*jmbc*npxbc*npybc |
write(6,*) ' B.C. Resolution: ',imbc*jmbc*npxbc*npybc |
449 |
write(6,*) 'Model Resolution: ',im2*jm2*npx*npy |
write(6,*) 'Model Resolution: ',im2*jm2*npgx*npgy |
450 |
error = .true. |
error = .true. |
451 |
endif |
endif |
452 |
|
|
517 |
nymdbc2 = nymdbc(nd) |
nymdbc2 = nymdbc(nd) |
518 |
nhmsbc1 = nhmsbc(nd-1) |
nhmsbc1 = nhmsbc(nd-1) |
519 |
nhmsbc2 = nhmsbc(nd) |
nhmsbc2 = nhmsbc(nd) |
520 |
call bcdata (iunit,imbc,jmbc,nPx,nPy,nd,nd+1,sstbc1,sstbc2) |
call bcdata (iunit,imbc,jmbc,nPgx,nPgy,nd,nd+1,sstbc1,sstbc2) |
521 |
found = .true. |
found = .true. |
522 |
else |
else |
523 |
nd = nd + 1 |
nd = nd + 1 |
575 |
C |
C |
576 |
C-------------------------------------------------------------------------- |
C-------------------------------------------------------------------------- |
577 |
implicit none |
implicit none |
|
#include "CPP_EEOPTIONS.h" |
|
578 |
|
|
579 |
integer iunit,im,jm,nPx,nPy,nrec1,nrec2 |
integer iunit,im,jm,nPx,nPy,nrec1,nrec2 |
580 |
|
|
581 |
real field1(im,jm,nPx,nPy) |
_RL field1(im,jm,nPx,nPy) |
582 |
real field2(im,jm,nPx,nPy) |
_RL field2(im,jm,nPx,nPy) |
583 |
|
|
584 |
integer i,j,n1,n2 |
integer i,j,n1,n2 |
585 |
real*4 f1(im,jm,nPx,nPy), f2(im,jm,nPx,nPy) |
real*4 f1(im,jm,nPx,nPy), f2(im,jm,nPx,nPy) |
590 |
|
|
591 |
do n2=1,nPy |
do n2=1,nPy |
592 |
do n1=1,nPx |
do n1=1,nPx |
593 |
|
#ifdef _BYTESWAPIO |
594 |
|
call MDS_BYTESWAPR4( im*jm, f1(1,1,n1,n2)) |
595 |
|
call MDS_BYTESWAPR4( im*jm, f2(1,1,n1,n2)) |
596 |
|
#endif |
597 |
do j=1,jm |
do j=1,jm |
598 |
do i=1,im |
do i=1,im |
599 |
field1(i,j,n1,n2) = f1(i,j,n1,n2) |
field1(i,j,n1,n2) = f1(i,j,n1,n2) |
635 |
C |
C |
636 |
C-------------------------------------------------------------------------- |
C-------------------------------------------------------------------------- |
637 |
implicit none |
implicit none |
|
#include "CPP_EEOPTIONS.h" |
|
638 |
|
|
639 |
integer iunit, ndmax, nrec |
integer iunit, ndmax, nrec |
640 |
|
|
641 |
character*8 cname |
character*8 cname |
642 |
character*80 cdscrip |
character*80 cdscrip |
643 |
integer im,jm,npx,npy,ndatebc,nymdbc(ndmax),nhmsbc(ndmax) |
integer im,jm,npx,npy,ndatebc,nymdbc(ndmax),nhmsbc(ndmax) |
644 |
real lat0,lon0,undef |
_RL lat0,lon0,undef |
645 |
logical error |
logical error |
646 |
|
|
647 |
integer i,n |
integer i |
648 |
integer*4 im_32,jm_32,npx_32,npy_32 |
integer*4 im_32,jm_32,npx_32,npy_32 |
649 |
integer*4 ndatebc_32,nhmsbc_32(ndmax),nymdbc_32(ndmax) |
integer*4 ndatebc_32,nhmsbc_32(ndmax),nymdbc_32(ndmax) |
650 |
real*4 lat0_32,lon0_32,undef_32 |
real*4 lat0_32,lon0_32,undef_32 |
655 |
. im_32, jm_32, npx_32, npy_32, lat0_32, lon0_32, |
. im_32, jm_32, npx_32, npy_32, lat0_32, lon0_32, |
656 |
. ndatebc_32, undef_32, |
. ndatebc_32, undef_32, |
657 |
. (nymdbc_32(i), nhmsbc_32(i), i=1,ndatebc_32) |
. (nymdbc_32(i), nhmsbc_32(i), i=1,ndatebc_32) |
658 |
|
#ifdef _BYTESWAPIO |
659 |
|
call MDS_BYTESWAPR4( 1, lat0_32) |
660 |
|
call MDS_BYTESWAPR4( 1, lon0_32) |
661 |
|
call MDS_BYTESWAPR4( 1, undef_32) |
662 |
|
#endif |
663 |
|
|
664 |
im = im_32 |
im = im_32 |
665 |
jm = jm_32 |
jm = jm_32 |