19 USE ioipsl
, ONLY: flininfo, flinopen, flinget, flinclo, &
20 ioconf_calendar, ioget_calendar, lock_calendar, ioget_mon_len, ioget_year_len
28 CHARACTER(LEN=20),
PARAMETER :: &
29 fsst(4)=[
'amipbc_sst_1x1.nc ',
'cpl_atm_sst.nc ',
'histmth_sst.nc '&
31 CHARACTER(LEN=20),
PARAMETER :: &
32 fsic(4)=[
'amipbc_sic_1x1.nc ',
'cpl_atm_sic.nc ',
'histmth_sic.nc '&
34 CHARACTER(LEN=10),
PARAMETER :: &
35 vsst(4)=[
'tosbcs ',
'SISUTESW ',
'tsol_oce ',
'sstk '], &
36 vsic(4)=[
'sicbcs ',
'SIICECOV ',
'pourc_sic ',
'ci ']
37 CHARACTER(LEN=10),
PARAMETER :: &
64 USE netcdf
, ONLY: nf90_open, nf90_create, nf90_close, &
65 nf90_def_dim, nf90_def_var, nf90_put_var, nf90_put_att, &
66 nf90_noerr, nf90_nowrite, nf90_double, nf90_global, &
67 nf90_clobber, nf90_enddef, nf90_unlimited, nf90_float
69 USE netcdf95, ONLY: nf95_def_var, nf95_put_att, nf95_put_var
74 include
"dimensions.h"
76 REAL,
DIMENSION(iip1,jjp1),
INTENT(INOUT) :: masque
77 REAL,
DIMENSION(iip1,jjp1),
INTENT(INOUT) :: phis
78 LOGICAL,
INTENT(IN) :: extrap
86 CHARACTER(LEN=20) :: icefile, sstfile, dumstr, fnam
87 CHARACTER(LEN=10) :: varname
91 REAL,
POINTER :: phy_rug(:,:)=>null(), phy_ice(:,:)=>null()
92 REAL,
POINTER :: phy_sst(:,:)=>null(), phy_alb(:,:)=>null()
93 REAL,
ALLOCATABLE :: phy_bil(:,:), pctsrf_t(:,:,:)
97 INTEGER :: ierr, nid, ndim, ntim, k, dims(2), ix_sic, ix_sst
98 INTEGER :: id_tim, id_SST, id_BILS, id_RUG, id_ALB
99 INTEGER :: id_FOCE, id_FSIC, id_FTER, id_FLIC, varid_longitude, varid_latitude
100 INTEGER :: NF90_FORMAT
105 nf90_format=nf90_double
107 nf90_format=nf90_float
112 IF(all(masque==-99999.))
THEN
123 CALL msg(1,
'Traitement de la rugosite')
127 CALL msg(1,
'Traitement de la glace oceanique')
131 DO ix_sic=1,
SIZE(
fsic)
132 IF ( nf90_open(trim(
fsic(ix_sic)),nf90_nowrite,nid)==nf90_noerr )
THEN
133 icefile=
fsic(ix_sic); varname=
vsic(ix_sic);
EXIT
136 IF(ix_sic==
SIZE(
fsic)+1)
THEN
137 WRITE(
lunout,*)
'ERROR! No sea-ice input file was found.'
138 WRITE(
lunout,*)
'One of following files must be available : '
140 CALL abort_physic(
'limit_netcdf',
'No sea-ice file was found',1)
142 CALL ncerr(nf90_close(nid),icefile)
143 CALL msg(-1,
'Fichier choisi pour la glace de mer:'//trim(icefile))
145 CALL get_2dfield(icefile,varname,
'SIC',ndays,phy_ice)
150 WHERE(fi_ice>=1.0 ) fi_ice=1.0
151 WHERE(fi_ice<
epsfra) fi_ice=0.0
158 pctsrf_t(:,
is_sic,k)=fi_ice(:)
178 nbad=count(pctsrf_t(:,
is_oce,k)<0.0)
179 IF(nbad>0)
WRITE(
lunout,*)
'pb sous maille pour nb points = ',nbad
180 nbad=count(abs(sum(pctsrf_t(:,:,k),dim=2)-1.0)>
epsfra)
181 IF(nbad>0)
WRITE(
lunout,*)
'pb sous surface pour nb points = ',nbad
186 CALL msg(1,
'Traitement de la sst')
190 DO ix_sst=1,
SIZE(
fsst)
191 IF ( nf90_open(trim(
fsst(ix_sst)),nf90_nowrite,nid)==nf90_noerr )
THEN
192 sstfile=
fsst(ix_sst); varname=
vsst(ix_sst);
EXIT
195 IF(ix_sst==
SIZE(
fsst)+1)
THEN
196 WRITE(
lunout,*)
'ERROR! No sst input file was found.'
197 WRITE(
lunout,*)
'One of following files must be available : '
199 CALL abort_physic(
'limit_netcdf',
'No sst file was found',1)
201 CALL ncerr(nf90_close(nid),sstfile)
202 CALL msg(-1,
'Fichier choisi pour la temperature de mer: '//trim(sstfile))
204 CALL get_2dfield(sstfile,varname,
'SST',ndays,phy_sst,flag=extrap)
207 CALL msg(1,
'Traitement de l albedo')
211 ALLOCATE(phy_bil(
klon,ndays)); phy_bil=0.0
214 CALL msg(5,
'Ecriture du fichier limit : debut')
218 CALL ncerr(nf90_create(fnam,nf90_clobber,nid),fnam)
219 CALL ncerr(nf90_put_att(nid,nf90_global,
"title",
"Fichier conditions aux limites"),fnam)
222 CALL ncerr(nf90_def_dim(nid,
"points_physiques",
klon,ndim),fnam)
223 CALL ncerr(nf90_def_dim(nid,
"time",nf90_unlimited,ntim),fnam)
228 CALL ncerr(nf90_def_var(nid,
"TEMPS",nf90_format,[ntim],id_tim),fnam)
229 CALL ncerr(nf90_def_var(nid,
"FOCE", nf90_format,dims,id_foce),fnam)
230 CALL ncerr(nf90_def_var(nid,
"FSIC", nf90_format,dims,id_fsic),fnam)
231 CALL ncerr(nf90_def_var(nid,
"FTER", nf90_format,dims,id_fter),fnam)
232 CALL ncerr(nf90_def_var(nid,
"FLIC", nf90_format,dims,id_flic),fnam)
233 CALL ncerr(nf90_def_var(nid,
"SST", nf90_format,dims,id_sst),fnam)
234 CALL ncerr(nf90_def_var(nid,
"BILS", nf90_format,dims,id_bils),fnam)
235 CALL ncerr(nf90_def_var(nid,
"ALB", nf90_format,dims,id_alb),fnam)
236 CALL ncerr(nf90_def_var(nid,
"RUG", nf90_format,dims,id_rug),fnam)
237 call nf95_def_var(nid,
"longitude", nf90_float, ndim, varid_longitude)
238 call nf95_def_var(nid,
"latitude", nf90_float, ndim, varid_latitude)
241 CALL ncerr(nf90_put_att(nid,id_tim,
"title",
"Jour dans l annee"),fnam)
242 CALL ncerr(nf90_put_att(nid,id_foce,
"title",
"Fraction ocean"),fnam)
243 CALL ncerr(nf90_put_att(nid,id_fsic,
"title",
"Fraction glace de mer"),fnam)
244 CALL ncerr(nf90_put_att(nid,id_fter,
"title",
"Fraction terre"),fnam)
245 CALL ncerr(nf90_put_att(nid,id_flic,
"title",
"Fraction land ice"),fnam)
246 CALL ncerr(nf90_put_att(nid,id_sst ,
"title",
"Temperature superficielle de la mer"),fnam)
247 CALL ncerr(nf90_put_att(nid,id_bils,
"title",
"Reference flux de chaleur au sol"),fnam)
248 CALL ncerr(nf90_put_att(nid,id_alb,
"title",
"Albedo a la surface"),fnam)
249 CALL ncerr(nf90_put_att(nid,id_rug,
"title",
"Rugosite"),fnam)
251 call nf95_put_att(nid, varid_longitude,
"standard_name",
"longitude")
252 call nf95_put_att(nid, varid_longitude,
"units",
"degrees_east")
254 call nf95_put_att(nid, varid_latitude,
"standard_name",
"latitude")
255 call nf95_put_att(nid, varid_latitude,
"units",
"degrees_north")
257 CALL ncerr(nf90_enddef(nid),fnam)
260 CALL ncerr(nf90_put_var(nid,id_tim,[(
REAL(k),k=1,ndays)]),fnam)
261 CALL ncerr(nf90_put_var(nid,id_foce,pctsrf_t(:,
is_oce,:),[1,1],[
klon,ndays]),fnam)
262 CALL ncerr(nf90_put_var(nid,id_fsic,pctsrf_t(:,
is_sic,:),[1,1],[
klon,ndays]),fnam)
263 CALL ncerr(nf90_put_var(nid,id_fter,pctsrf_t(:,
is_ter,:),[1,1],[
klon,ndays]),fnam)
264 CALL ncerr(nf90_put_var(nid,id_flic,pctsrf_t(:,
is_lic,:),[1,1],[
klon,ndays]),fnam)
265 CALL ncerr(nf90_put_var(nid,id_sst ,phy_sst(:,:),[1,1],[
klon,ndays]),fnam)
266 CALL ncerr(nf90_put_var(nid,id_bils,phy_bil(:,:),[1,1],[
klon,ndays]),fnam)
267 CALL ncerr(nf90_put_var(nid,id_alb ,phy_alb(:,:),[1,1],[
klon,ndays]),fnam)
268 CALL ncerr(nf90_put_var(nid,id_rug ,phy_rug(:,:),[1,1],[
klon,ndays]),fnam)
269 call nf95_put_var(nid, varid_longitude,
rlon)
270 call nf95_put_var(nid, varid_latitude,
rlat)
272 CALL ncerr(nf90_close(nid),fnam)
274 CALL msg(6,
'Ecriture du fichier limit : fin')
276 DEALLOCATE(pctsrf_t,phy_sst,phy_bil,phy_alb,phy_rug)
288 SUBROUTINE get_2dfield(fnam, varname, mode, ndays, champo, flag, mask)
297 USE netcdf
, ONLY: nf90_open, nf90_inq_varid, nf90_inquire_variable, &
298 nf90_close, nf90_inq_dimid, nf90_inquire_dimension, nf90_get_var, &
306 include
"dimensions.h"
311 CHARACTER(LEN=*),
INTENT(IN) :: fnam
312 CHARACTER(LEN=10),
INTENT(IN) :: varname
313 CHARACTER(LEN=3),
INTENT(IN) :: mode
314 INTEGER,
INTENT(IN) :: ndays
315 REAL,
POINTER,
DIMENSION(:, :) :: champo
316 LOGICAL,
OPTIONAL,
INTENT(IN) :: flag
317 REAL,
OPTIONAL,
DIMENSION(iim, jjp1),
INTENT(IN) :: mask
321 INTEGER :: ncid, varid
322 CHARACTER(LEN=30) :: dnam
325 REAL,
ALLOCATABLE :: dlon_ini(:)
326 REAL,
ALLOCATABLE :: dlat_ini(:)
327 REAL,
POINTER :: dlon(:), dlat(:)
329 INTEGER :: imdep, jmdep, lmdep
330 REAL,
ALLOCATABLE :: champ(:,:)
331 REAL,
ALLOCATABLE :: yder(:), timeyear(:)
333 REAL,
ALLOCATABLE :: champtime(:,:,:)
334 REAL,
ALLOCATABLE :: champan(:,:,:)
336 CHARACTER(LEN=20) :: cal_in
337 CHARACTER(LEN=20) :: unit_sic
340 INTEGER :: i, j, k, l
341 REAL,
ALLOCATABLE :: work(:,:)
342 CHARACTER(LEN=25) :: title
354 CASE(
'RUG'); title=
'Rugosite'
355 CASE(
'SIC'); title=
'Sea-ice'
356 CASE(
'SST'); title=
'SST'
357 CASE(
'ALB'); title=
'Albedo'
359 extrp=.
false.;
IF(
PRESENT(flag).AND.mode==
'SST') extrp=flag
362 CALL msg(5,
' Now reading file : '//trim(fnam))
363 CALL ncerr(nf90_open(fnam, nf90_nowrite, ncid),fnam)
364 CALL ncerr(nf90_inq_varid(ncid, trim(varname), varid),fnam)
365 CALL ncerr(nf90_inquire_variable(ncid, varid, dimids=dids),fnam)
368 IF (mode==
'SIC')
THEN
369 IF(nf90_get_att(ncid, varid,
'units', unit_sic)/=nf90_noerr)
THEN
370 CALL msg(5,
'No unit in sea-ice file. Take percentage as default value')
373 CALL msg(5,
'Sea-ice cover has unit='//trim(unit_sic))
378 CALL ncerr(nf90_inquire_dimension(ncid, dids(1), name=dnam, len=imdep),fnam)
379 ALLOCATE(dlon_ini(imdep), dlon(imdep))
380 CALL ncerr(nf90_inq_varid(ncid, dnam, varid), fnam)
381 CALL ncerr(nf90_get_var(ncid, varid, dlon_ini), fnam)
382 CALL msg(5,
'variable '//trim(dnam)//
' dimension ', imdep)
385 CALL ncerr(nf90_inquire_dimension(ncid, dids(2), name=dnam, len=jmdep),fnam)
386 ALLOCATE(dlat_ini(jmdep), dlat(jmdep))
387 CALL ncerr(nf90_inq_varid(ncid, dnam, varid), fnam)
388 CALL ncerr(nf90_get_var(ncid, varid, dlat_ini), fnam)
389 CALL msg(5,
'variable '//trim(dnam)//
' dimension ', jmdep)
392 CALL ncerr(nf90_inquire_dimension(ncid, dids(3), name=dnam, len=lmdep), fnam)
393 ALLOCATE(timeyear(lmdep))
394 CALL ncerr(nf90_inq_varid(ncid, dnam, varid), fnam)
396 IF(nf90_get_att(ncid, varid,
'calendar', cal_in)/=nf90_noerr)
THEN
398 CASE(
'RUG',
'ALB'); cal_in=
'360d'
399 CASE(
'SIC',
'SST'); cal_in=
'gregorian'
401 CALL msg(5,
'WARNING: missing "calendar" attribute for "time" in '&
402 &//trim(fnam)//
'. Choosing default value.')
404 CALL msg(5,
'var, calendar, dim: '//trim(dnam)//
' '//trim(cal_in), lmdep)
413 IF (lmdep /= 12)
WRITE(
lunout,*)
'Note : les fichiers de ', trim(mode), &
414 ' ne comportent pas 12, mais ', lmdep,
' enregistrements.'
417 ALLOCATE(champ(imdep, jmdep), champtime(
iim,
jjp1, lmdep))
418 IF(extrp)
ALLOCATE(work(imdep, jmdep))
420 CALL msg(5,
'LECTURE ET INTERPOLATION HORIZ. DE ', lmdep,
' CHAMPS.')
421 CALL ncerr(nf90_inq_varid(ncid, varname, varid), fnam)
423 CALL ncerr(nf90_get_var(ncid,varid,champ,[1,1,l],[imdep,jmdep,1]),fnam)
424 CALL conf_dat2d(title, dlon_ini, dlat_ini, dlon, dlat, champ, .
true.)
427 CALL msg(5,
"----------------------------------------------------------")
428 CALL msg(5,
"$$$ Interpolation barycentrique pour "//trim(title)//
" $$$")
429 CALL msg(5,
"----------------------------------------------------------")
431 IF(mode==
'RUG') champ=log(champ)
434 champint=exp(champint)
435 WHERE(nint(mask)/=1) champint=0.001
437 champtime(:, :, l)=champint
439 CALL ncerr(nf90_close(ncid), fnam)
441 DEALLOCATE(dlon_ini, dlat_ini, dlon, dlat, champ)
442 IF(extrp)
DEALLOCATE(work)
447 WRITE(
lunout, *)
'INTERPOLATION TEMPORELLE.'
448 WRITE(
lunout, *)
' Vecteur temps en entree: ', timeyear
449 WRITE(
lunout, *)
' Vecteur temps en sortie de 0 a ', ndays
452 ALLOCATE(yder(lmdep), champan(iip1,
jjp1, ndays))
457 yder =
pchsp_95(timeyear, champtime(i, j, :), ibeg=2, iend=2, &
458 vc_beg=0., vc_end=0.)
459 CALL pchfe_95(timeyear, champtime(i, j, :), yder, skip, &
460 arth(0.,
real(ndays_in) / ndays, ndays), champan(i, j, :), ierr)
462 n_extrap = n_extrap + ierr
465 if (n_extrap /= 0)
then
466 WRITE(
lunout,*)
"get_2Dfield pchfe_95: n_extrap = ", n_extrap
468 champan(iip1, :, :)=champan(1, :, :)
469 DEALLOCATE(yder, champtime, timeyear)
473 CALL minmax(iip1, champan(1, j, 10), chmin, chmax)
474 IF (
prt_level>5)
WRITE(
lunout, *)
' ',trim(title),
' au temps 10 ', chmin, chmax, j
479 CALL msg(5,
'Filtrage de la SST: SST >= 271.38')
480 WHERE(champan<271.38) champan=271.38
485 CALL msg(5,
'Filtrage de la SIC: 0.0 < Sea-ice < 1.0')
487 IF (unit_sic==
'1')
THEN
490 CALL msg(5,
'Sea-ice field already in fraction of 1')
493 CALL msg(5,
'Transformt sea-ice field from percentage to fraction of 1.')
494 champan(:, :, :)=champan(:, :, :)/100.
497 champan(iip1, :, :)=champan(1, :, :)
498 WHERE(champan>1.0) champan=1.0
499 WHERE(champan<0.0) champan=0.0
503 ALLOCATE(champo(
klon, ndays))
524 REAL,
INTENT(IN) :: lon_in(:), lat_in(:)
525 REAL,
INTENT(INOUT) :: phis(:,:), masque(:,:)
528 CHARACTER(LEN=256) :: modname=
"start_init_orog0"
529 INTEGER :: fid, llm_tmp,ttm_tmp, iml,jml, iml_rel,jml_rel, itau(1)
530 REAL :: lev(1), date, dt, deg2rad
531 REAL,
ALLOCATABLE :: lon_rad(:), lon_ini(:), lon_rel(:,:), relief_hi(:,:)
532 REAL,
ALLOCATABLE :: lat_rad(:), lat_ini(:), lat_rel(:,:)
534 iml=
assert_eq(
SIZE(lon_in),
SIZE(phis,1),
SIZE(masque,1),trim(modname)//
" iml")
535 jml=
assert_eq(
SIZE(lat_in),
SIZE(phis,2),
SIZE(masque,2),trim(modname)//
" jml")
536 IF(iml/=iip1)
CALL abort_gcm(trim(modname),
'iml/=iip1',1)
538 pi=2.0*asin(1.0); deg2rad=
pi/180.0
539 IF(any(phis/=-99999.))
RETURN
542 CALL flininfo(
frelf, iml_rel, jml_rel, llm_tmp, ttm_tmp, fid)
544 ALLOCATE(lat_rel(iml_rel,jml_rel),lon_rel(iml_rel,jml_rel))
545 CALL flinopen(
frelf, .
false., iml_rel, jml_rel, llm_tmp, lon_rel, lat_rel, &
546 lev, ttm_tmp, itau, date, dt, fid)
547 ALLOCATE(relief_hi(iml_rel,jml_rel))
548 CALL flinget(fid,
vrel, iml_rel, jml_rel, llm_tmp, ttm_tmp, 1, 1, relief_hi)
552 ALLOCATE(lon_ini(iml_rel),lat_ini(jml_rel))
553 lon_ini(:)=lon_rel(:,1);
IF(maxval(lon_rel)>
pi) lon_ini=lon_ini*deg2rad
554 lat_ini(:)=lat_rel(1,:);
IF(maxval(lat_rel)>
pi) lat_ini=lat_ini*deg2rad
557 ALLOCATE(lon_rad(iml_rel),lat_rad(jml_rel))
559 DEALLOCATE(lon_ini,lat_ini)
563 WRITE(
lunout,*)
'*** Compute surface geopotential ***'
566 CALL grid_noro0(lon_rad, lat_rad, relief_hi, lon_in, lat_in, phis, masque)
568 phis(iml,:) = phis(1,:)
569 DEALLOCATE(relief_hi,lon_rad,lat_rad)
587 REAL,
INTENT(IN) :: xd(:), yd(:)
588 REAL,
INTENT(IN) :: zd(:,:)
589 REAL,
INTENT(IN) :: x(:), y(:)
590 REAL,
INTENT(OUT) :: zphi(:,:)
591 REAL,
INTENT(INOUT):: mask(:,:)
594 CHARACTER(LEN=256) :: modname=
"grid_noro0"
595 REAL,
ALLOCATABLE :: xusn(:), yusn(:)
596 REAL,
ALLOCATABLE :: zusn(:,:)
597 REAL,
ALLOCATABLE :: weight(:,:)
598 REAL,
ALLOCATABLE :: mask_tmp(:,:), zmea(:,:)
599 REAL,
ALLOCATABLE :: num_tot(:,:), num_lan(:,:)
600 REAL,
ALLOCATABLE :: a(:), b(:)
601 REAL,
ALLOCATABLE :: c(:), d(:)
603 INTEGER :: i, ii, imdp, imar, iext
604 INTEGER :: j, jj, jmdp, jmar, nn
605 REAL :: xpi, zlenx, weighx, xincr, zbordnor, zmeanor, zweinor, zbordest
606 REAL :: rad, zleny, weighy, masque, zbordsud, zmeasud, zweisud, zbordoue
608 imdp=
assert_eq(
SIZE(xd),
SIZE(zd,1),trim(modname)//
" imdp")
609 jmdp=
assert_eq(
SIZE(yd),
SIZE(zd,2),trim(modname)//
" jmdp")
610 imar=
assert_eq(
SIZE(x),
SIZE(zphi,1),
SIZE(mask,1),trim(modname)//
" imar")-1
611 jmar=
assert_eq(
SIZE(y),
SIZE(zphi,2),
SIZE(mask,2),trim(modname)//
" jmar")
612 IF(imar/=
iim)
CALL abort_gcm(trim(modname),
'imar/=iim' ,1)
613 IF(jmar/=jjm+1)
CALL abort_gcm(trim(modname),
'jmar/=jjm+1',1)
619 masque_lu=any(mask/=-99999.);
IF(.NOT.masque_lu) mask=0.0
620 WRITE(
lunout,*)
'Masque lu: ',masque_lu
623 ALLOCATE(xusn(imdp+2*iext))
624 xusn(1 +iext:imdp +iext)=xd(:)
625 xusn(1 : iext)=xd(1+imdp-iext:imdp)-2.*xpi
626 xusn(1+imdp+iext:imdp+2*iext)=xd(1 :iext)+2.*xpi
628 ALLOCATE(yusn(jmdp+2))
629 yusn(1 )=yd(1) +(yd(1) -yd(2))
631 yusn( jmdp+2)=yd(jmdp)+(yd(jmdp)-yd(jmdp-1))
633 ALLOCATE(zusn(imdp+2*iext,jmdp+2))
634 zusn(1 +iext:imdp +iext,2:jmdp+1)=zd(: , :)
635 zusn(1 : iext,2:jmdp+1)=zd(imdp-iext+1:imdp , :)
636 zusn(1+imdp +iext:imdp+2*iext,2:jmdp+1)=zd(1:iext , :)
637 zusn(1 :imdp/2+iext, 1)=zusn(1+imdp/2:imdp +iext, 2)
638 zusn(1+imdp/2+iext:imdp+2*iext, 1)=zusn(1 :imdp/2+iext, 2)
639 zusn(1 :imdp/2+iext, jmdp+2)=zusn(1+imdp/2:imdp +iext,jmdp+1)
640 zusn(1+imdp/2+iext:imdp+2*iext, jmdp+2)=zusn(1 :imdp/2+iext,jmdp+1)
643 ALLOCATE(a(imar+1),b(imar+1))
644 b(1:imar)=(x(1:imar )+ x(2:imar+1))/2.0
645 b(imar+1)= x( imar+1)+(x( imar+1)-x(imar))/2.0
646 a(1)=x(1)-(x(2)-x(1))/2.0
647 a(2:imar+1)= b(1:imar)
649 ALLOCATE(c(jmar),d(jmar))
650 d(1:jmar-1)=(y(1:jmar-1)+ y(2:jmar))/2.0
651 d( jmar )= y( jmar )+(y( jmar)-y(jmar-1))/2.0
652 c(1)=y(1)-(y(2)-y(1))/2.0
653 c(2:jmar)=d(1:jmar-1)
656 ALLOCATE(weight(imar+1,jmar)); weight(:,:)= 0.0
657 ALLOCATE(zmea(imar+1,jmar)); zmea(:,:)= 0.0
660 zleny=xpi/
REAL(jmdp)*rad
661 xincr=xpi/
REAL(jmdp)/2.
662 ALLOCATE(num_tot(imar+1,jmar)); num_tot(:,:)=0.
663 ALLOCATE(num_lan(imar+1,jmar)); num_lan(:,:)=0.
667 zlenx =zleny *cos(yusn(j))
668 zbordnor=(xincr+c(jj)-yusn(j))*rad
669 zbordsud=(xincr-d(jj)+yusn(j))*rad
670 weighy=amax1(0.,amin1(zbordnor,zbordsud,zleny))
672 DO i = 2, imdp+2*iext-1
673 zbordest=(xusn(i)-a(ii)+xincr)*rad*cos(yusn(j))
674 zbordoue=(b(ii)+xincr-xusn(i))*rad*cos(yusn(j))
675 weighx=amax1(0.,amin1(zbordest,zbordoue,zlenx))
677 num_tot(ii,jj)=num_tot(ii,jj)+1.0
678 IF(zusn(i,j)>=1.)num_lan(ii,jj)=num_lan(ii,jj)+1.0
679 weight(ii,jj)=weight(ii,jj)+weighx*weighy
680 zmea(ii,jj)=zmea(ii,jj)+zusn(i,j)*weighx*weighy
689 IF(.NOT.masque_lu)
THEN
690 WHERE(weight(:,1:jmar-1)/=0.0) mask=num_lan(:,:)/num_tot(:,:)
692 nn=count(weight(:,1:jmar-1)==0.0)
693 IF(nn/=0)
WRITE(
lunout,*)
'Problem with weight ; vanishing occurrences: ',nn
694 WHERE(weight/=0.0) zmea(:,:)=zmea(:,:)/weight(:,:)
697 ALLOCATE(mask_tmp(imar+1,jmar)); mask_tmp(:,:)=0.0
698 WHERE(mask>=0.1) mask_tmp = 1.
699 WHERE(weight(:,:)/=0.0)
700 zphi(:,:)=mask_tmp(:,:)*zmea(:,:)
701 zmea(:,:)=mask_tmp(:,:)*zmea(:,:)
703 WRITE(
lunout,*)
' MEAN ORO:' ,maxval(zmea)
706 zphi(imar+1,:)=zphi(1,:)
708 zweinor=sum(weight(1:imar, 1),dim=1)
709 zweisud=sum(weight(1:imar,jmar),dim=1)
710 zmeanor=sum(weight(1:imar, 1)*zmea(1:imar, 1),dim=1)
711 zmeasud=sum(weight(1:imar,jmar)*zmea(1:imar,jmar),dim=1)
712 zphi(:,1)=zmeanor/zweinor; zphi(:,jmar)=zmeasud/zweisud
728 INTEGER,
INTENT(IN) :: y
729 CHARACTER(LEN=*),
INTENT(IN) :: cal_in
732 CHARACTER(LEN=20) :: cal_out
735 CALL ioget_calendar(cal_out)
738 CALL lock_calendar(.
false.);
CALL ioconf_calendar(trim(cal_in))
741 year_len=ioget_year_len(y)
744 CALL lock_calendar(.
false.);
CALL ioconf_calendar(trim(cal_out))
759 INTEGER,
INTENT(IN) :: y
760 CHARACTER(LEN=*),
INTENT(IN) :: cal_in
761 INTEGER,
INTENT(IN) :: nm
762 REAL,
DIMENSION(nm) :: mid_months
765 CHARACTER(LEN=99) :: mess
766 CHARACTER(LEN=20) :: cal_out
767 INTEGER,
DIMENSION(nm) :: mnth
776 CALL ioget_calendar(cal_out)
779 CALL lock_calendar(.
false.);
CALL ioconf_calendar(trim(cal_in))
782 DO m=1,nm; mnth(m)=ioget_mon_len(y,m);
END DO
785 CALL lock_calendar(.
false.);
CALL ioconf_calendar(trim(cal_out))
787 ELSE IF(modulo(nd,nm)/=0)
THEN
788 WRITE(mess,
'(a,i3,a,i3,a)')
'Unconsistent calendar: ',nd,
' days/year, but ',&
789 nm,
' months/year. Months number should divide days number.'
793 mnth=[(m,m=1,nm,nd/nm)]
797 mid_months(1)=0.5*
REAL(mnth(1))
799 mid_months(k)=mid_months(k-1)+0.5*
REAL(mnth(k-1)+mnth(k))
810 SUBROUTINE msg(lev,str1,i,str2)
814 INTEGER,
INTENT(IN) :: lev
815 CHARACTER(LEN=*),
INTENT(IN) :: str1
816 INTEGER,
OPTIONAL,
INTENT(IN) :: i
817 CHARACTER(LEN=*),
OPTIONAL,
INTENT(IN) :: str2
820 IF(
PRESENT(str2))
THEN
821 WRITE(
lunout,*) trim(str1), i, trim(str2)
822 ELSE IF(
PRESENT(i))
THEN
823 WRITE(
lunout,*) trim(str1), i
825 WRITE(
lunout,*) trim(str1)
836 SUBROUTINE ncerr(ncres,fnam)
841 USE netcdf
, ONLY : nf90_noerr, nf90_strerror
845 INTEGER,
INTENT(IN) :: ncres
846 CHARACTER(LEN=*),
INTENT(IN) :: fnam
848 IF(ncres/=nf90_noerr)
THEN
849 WRITE(
lunout,*)
'Problem with file '//trim(fnam)//
' in routine limit_netcdf.'
850 CALL abort_physic(
'limit_netcdf',nf90_strerror(ncres),1)
character(len=10), parameter valb
subroutine msg(lev, str1, i, str2)
integer, parameter is_ter
subroutine grid_noro0(xd, yd, zd, x, y, zphi, mask)
subroutine get_2dfield(fnam, varname, mode, ndays, champo, flag, mask)
real function, dimension(nm) mid_months(y, cal_in, nm)
subroutine, public conf_dat2d(title, xd, yd, xf, yf, champd, interbar)
character(len=10), parameter vrug
character(len=10), parameter vrel
subroutine, public conf_dat3d(title, xd, yd, zd, xf, yf, zf, champd, interbar)
character(len=10), dimension(4), parameter vsst
real function, dimension(size(x)) pchsp_95(x, f, ibeg, iend, vc_beg, vc_end)
subroutine limit_netcdf(masque, phis, extrap)
real, dimension(:,:), allocatable, save pctsrf
subroutine abort_gcm(modname, message, ierr)
character(len=20), dimension(4), parameter fsst
!$Id mode_top_bound COMMON comconstr && pi
!$Header!CDK comgeom COMMON comgeom rlatu
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL false
subroutine pchfe_95(X, F, D, SKIP, XE, FE, IERR)
real, dimension(:), allocatable, save zmasq
integer, parameter is_lic
real, dimension(:), allocatable, save rlon
character(len=10), parameter falbe
subroutine minmax(imax, xi, zmin, zmax)
!FH On elimine toutes les clefs physiques dans la dynamique prt_level
character(len=10), dimension(4), parameter vsic
!$Header!CDK comgeom COMMON comgeom rlonu
subroutine ncerr(ncres, fnam)
!$Header!CDK comgeom COMMON comgeom rlatv
character(len=10), parameter frelf
subroutine, public inter_barxy(dlonid, dlatid, champ, rlonimod, rlatimod, champint)
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL ulevSTD CALL &zphi philevSTD CALL &zx_rh rhlevSTD!DO klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon du jour ou toutes les read_climoz CALL true
subroutine gr_dyn_fi(nfield, im, jm, ngrid, pdyn, pfi)
character(len=10), parameter frugo
real, dimension(:), allocatable, save rlat
integer function year_len(y, cal_in)
c c zjulian c cym CALL iim cym klev iim
subroutine start_init_orog0(lon_in, lat_in, phis, masque)
character(len=20), dimension(4), parameter fsic
integer, parameter is_sic
subroutine abort_physic(modname, message, ierr)
subroutine, public start_init_subsurf(known_mask)
integer, parameter is_oce
!$Header!gestion des impressions de sorties et de débogage la sortie standard prt_level COMMON comprint lunout
!$Header!CDK comgeom COMMON comgeom rlonv