3 SUBROUTINE limit_slab(itime, dtime, jour, lmt_bils, lmt_foce, diff_sst)
15 include
"dimensions.h"
19 INTEGER,
INTENT(IN) ::
itime
20 INTEGER,
INTENT(IN) :: jour
21 REAL ,
INTENT(IN) ::
dtime
22 REAL,
DIMENSION(klon),
INTENT(OUT) :: lmt_bils, lmt_foce, diff_sst
26 REAL,
DIMENSION(:),
ALLOCATABLE,
SAVE :: bils_save, foce_save
32 INTEGER :: nvarid, nid, ierr,
i
33 INTEGER,
DIMENSION(2) :: start, epais
34 REAL,
DIMENSION(klon_glo):: bils_glo, foce_glo, sst_l_glo, sst_lp1_glo, diff_sst_glo
35 CHARACTER (len = 20) :: modname =
'limit_slab'
41 lmt_pas = nint(86400./
dtime)
43 IF (mod(
itime-1, lmt_pas) == 0)
THEN
46 print*,
'in limit_slab time to read, itime=',
itime
48 ierr = nf90_open(
'limit_slab.nc', nf90_nowrite, nid)
49 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,&
50 'Pb in opening file limit_slab.nc',1)
64 ierr = nf90_inq_varid(nid,
'BILS_OCE', nvarid)
65 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'The variable <BILS_OCE> is abstent',1)
67 ierr = nf90_get_var(nid,nvarid,bils_glo,start,epais)
68 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'Reading of <BILS_OCE> failed',1)
71 ierr = nf90_inq_varid(nid,
'FOCE', nvarid)
72 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'The variable <FOCE> is abstent',1)
74 ierr = nf90_get_var(nid,nvarid,foce_glo,start,epais)
75 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'Reading of <FOCE> failed',1)
78 ierr = nf90_inq_varid(nid,
'SST', nvarid)
79 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'The variable <SST> is abstent',1)
81 ierr = nf90_get_var(nid,nvarid,sst_l_glo,start,epais)
82 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'Reading of <SST> failed',1)
86 IF (start(2) > 360) start(2)=1
87 ierr = nf90_get_var(nid,nvarid,sst_lp1_glo,start,epais)
88 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'Reading of <SST> day+1 failed',1)
92 diff_sst_glo(
i) = sst_lp1_glo(
i) - sst_l_glo(
i)
94 diff_sst_glo(klon_glo) = sst_lp1_glo(klon_glo) - sst_l_glo(1)
100 ierr = nf90_close(nid)
101 IF (ierr /= nf90_noerr) CALL
abort_gcm(modname,
'Pb when closing file', 1)
106 IF (.NOT.
ALLOCATED(bils_save))
THEN
107 ALLOCATE(bils_save(klon), foce_save(klon), stat=ierr)
108 IF (ierr /= 0) CALL
abort_gcm(
'limit_slab',
'pb in allocation',1)
111 CALL
scatter(bils_glo, bils_save)
112 CALL
scatter(foce_glo, foce_save)
113 CALL
scatter(diff_sst_glo, diff_sst)
119 lmt_bils(:) = bils_save(:)
120 lmt_foce(:) = foce_save(:)