112 CHARACTER(LEN=3) :: donst
113 INTEGER :: idim, jdim, lsm, lsoil, lugb, iy, im, id, ih, ialb
114 INTEGER :: isot, ivegsrc, lensfc, zsea1_mm, zsea2_mm, ierr
115 INTEGER :: nprocs, myrank, num_threads,
num_parthds, max_tasks
116 REAL :: fh, deltsfc, zsea1, zsea2
117 LOGICAL :: use_ufo, do_nsst, do_lndinc, do_sfccycle
119 NAMELIST/namcyc/ idim,jdim,lsm,lsoil,lugb,iy,im,id,ih,fh,&
120 deltsfc,ialb,use_ufo,donst, &
121 do_sfccycle,isot,ivegsrc,zsea1_mm, &
122 zsea2_mm, max_tasks, do_lndinc
124 DATA idim,jdim,lsm,lsoil/96,96,1,4/
125 DATA iy,im,id,ih,fh/1997,8,2,0,0./
126 DATA lugb/51/, deltsfc/0.0/, ialb/1/, max_tasks/99999/
127 DATA isot/1/, ivegsrc/2/, zsea1_mm/0/, zsea2_mm/0/
130 CALL mpi_comm_size(mpi_comm_world, nprocs, ierr)
131 CALL mpi_comm_rank(mpi_comm_world, myrank, ierr)
133 if (myrank==0)
call w3tagb(
'GLOBAL_CYCLE',2018,0179,0055,
'NP20')
138 print*,
"STARTING CYCLE PROGRAM ON RANK ", myrank
139 print*,
"RUNNING WITH ", nprocs,
"TASKS" 140 print*,
"AND WITH ", num_threads,
" THREADS." 148 print*,
"READ NAMCYC NAMELIST." 150 CALL baopenr(36,
"fort.36", ierr)
154 IF (max_tasks < 99999 .AND. myrank > (max_tasks - 1))
THEN 155 print*,
"USER SPECIFIED MAX NUMBER OF TASKS: ", max_tasks
156 print*,
"WILL NOT RUN CYCLE PROGRAM ON RANK: ", myrank
162 zsea1 = float(zsea1_mm) / 1000.0
163 zsea2 = float(zsea2_mm) / 1000.0
165 IF (donst ==
"YES")
THEN 172 IF (myrank==0) print*,
"LUGB,IDIM,JDIM,LSM,ISOT,IVEGSRC,LSOIL,DELTSFC,IY,IM,ID,IH,FH: ", &
173 lugb,idim,jdim,lsm,isot,ivegsrc,lsoil,deltsfc,iy,im,id,ih,fh
175 CALL sfcdrv(lugb,idim,jdim,lsm,lensfc,lsoil,deltsfc, &
176 iy,im,id,ih,fh,ialb, &
177 use_ufo,do_nsst,do_sfccycle,do_lndinc, &
178 zsea1,zsea2,isot,ivegsrc,myrank)
181 print*,
'CYCLE PROGRAM COMPLETED NORMALLY ON RANK: ', myrank
185 CALL mpi_barrier(mpi_comm_world, ierr)
187 if (myrank==0)
call w3tage(
'GLOBAL_CYCLE')
189 CALL mpi_finalize(ierr)
304 SUBROUTINE sfcdrv(LUGB, IDIM,JDIM,LSM,LENSFC,LSOIL,DELTSFC, &
305 IY,IM,ID,IH,FH,IALB, &
306 USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LNDINC,&
307 ZSEA1,ZSEA2,ISOT,IVEGSRC,MYRANK)
312 USE land_increments,
ONLY: add_increment_soil, &
313 add_increment_snow, &
314 calculate_landinc_mask, &
315 apply_land_da_adjustments_stc, &
316 apply_land_da_adjustments_snd
320 INTEGER,
INTENT(IN) :: IDIM, JDIM, LSM,LENSFC, LSOIL, IALB
321 INTEGER,
INTENT(IN) :: LUGB, IY, IM, ID, IH
322 INTEGER,
INTENT(IN) :: ISOT, IVEGSRC, MYRANK
324 LOGICAL,
INTENT(IN) :: USE_UFO, DO_NSST,DO_SFCCYCLE
325 LOGICAL,
INTENT(IN) :: DO_LNDINC
327 REAL,
INTENT(IN) :: FH, DELTSFC, ZSEA1, ZSEA2
329 INTEGER,
PARAMETER :: NLUNIT=35
330 INTEGER,
PARAMETER :: SZ_NML=1
332 CHARACTER(LEN=5) :: TILE_NUM
333 CHARACTER(LEN=500) :: NST_FILE
334 CHARACTER(LEN=500) :: LND_SOI_FILE
335 CHARACTER(LEN=4) :: INPUT_NML_FILE(SZ_NML)
338 INTEGER :: I_INDEX(LENSFC), J_INDEX(LENSFC)
339 INTEGER :: IDUM(IDIM,JDIM)
340 integer :: num_parthds, num_threads
342 LOGICAL :: IS_NOAHMP=.false.
344 real(kind=kind_io8) :: min_ice(lensfc)
346 REAL :: SLMASK(LENSFC), OROG(LENSFC)
347 REAL :: SIHFCS(LENSFC), SICFCS(LENSFC)
348 REAL :: SITFCS(LENSFC), TSFFCS(LENSFC)
349 REAL :: SWEFCS(LENSFC), ZORFCS(LENSFC)
350 REAL :: ALBFCS(LENSFC,4), TG3FCS(LENSFC)
351 REAL :: CNPFCS(LENSFC), SMCFCS(LENSFC,LSOIL)
352 REAL :: STCFCS(LENSFC,LSOIL), SLIFCS(LENSFC)
353 REAL :: AISFCS(LENSFC), F10M(LENSFC)
354 REAL :: VEGFCS(LENSFC), VETFCS(LENSFC)
355 REAL :: SOTFCS(LENSFC), ALFFCS(LENSFC,2)
356 REAL :: CVFCS(LENSFC), CVTFCS(LENSFC)
357 REAL :: CVBFCS(LENSFC), TPRCP(LENSFC)
358 REAL :: SRFLAG(LENSFC), SNDFCS(LENSFC)
359 REAL :: SLCFCS(LENSFC,LSOIL), VMXFCS(LENSFC)
360 REAL :: VMNFCS(LENSFC), T2M(LENSFC)
361 REAL :: Q2M(LENSFC), SLPFCS(LENSFC)
362 REAL :: ABSFCS(LENSFC), OROG_UF(LENSFC)
363 REAL :: USTAR(LENSFC)
364 REAL :: FMM(LENSFC), FHH(LENSFC)
365 REAL :: RLA(LENSFC), RLO(LENSFC)
366 REAL(KIND=4) :: ZSOIL(LSOIL)
367 REAL :: SIG1T(LENSFC)
370 REAL,
ALLOCATABLE :: STC_BCK(:,:), SMC_BCK(:,:), SLC_BCK(:,:)
371 REAL,
ALLOCATABLE :: SLIFCS_FG(:)
372 INTEGER,
ALLOCATABLE :: LANDINC_MASK_FG(:), LANDINC_MASK(:)
373 REAL,
ALLOCATABLE :: SND_BCK(:), SND_INC(:), SWE_BCK(:)
374 REAL(KIND=KIND_IO8),
ALLOCATABLE :: SLMASKL(:), SLMASKW(:)
376 TYPE(NSST_DATA) :: NSST
377 real,
dimension(idim,jdim) :: tf_clm,tf_trd,sal_clm
378 real,
dimension(lensfc) :: tf_clm_tile,tf_trd_tile,sal_clm_tile
379 INTEGER :: veg_type_landice
381 LOGICAL :: FILE_EXISTS, DO_SOI_INC, DO_SNO_INC
387 NAMELIST/namsfcd/ nst_file, lnd_soi_file, do_sno_inc
389 DATA nst_file/
'NULL'/
390 DATA lnd_soi_file/
'NULL'/
398 input_nml_file =
"NULL" 400 CALL baopenr(37,
"fort.37", ierr)
401 READ (37, nml=namsfcd)
404 print*,
'IN ROUTINE SFCDRV,IDIM=',idim,
'JDIM=',jdim,
'FH=',fh
410 CALL read_lat_lon_orog(rla,rlo,orog,orog_uf,tile_num,idim,jdim,lensfc)
416 i_index = reshape(idum, (/lensfc/))
422 j_index = reshape(idum, (/lensfc/) )
426 print*,
"WILL PROCESS NSST RECORDS." 427 ALLOCATE(nsst%C_0(lensfc))
428 ALLOCATE(nsst%C_D(lensfc))
429 ALLOCATE(nsst%D_CONV(lensfc))
430 ALLOCATE(nsst%DT_COOL(lensfc))
431 ALLOCATE(nsst%IFD(lensfc))
432 ALLOCATE(nsst%QRAIN(lensfc))
433 ALLOCATE(nsst%TREF(lensfc))
434 ALLOCATE(nsst%TFINC(lensfc))
435 ALLOCATE(nsst%W_0(lensfc))
436 ALLOCATE(nsst%W_D(lensfc))
437 ALLOCATE(nsst%XS(lensfc))
438 ALLOCATE(nsst%XT(lensfc))
439 ALLOCATE(nsst%XTTS(lensfc))
440 ALLOCATE(nsst%XU(lensfc))
441 ALLOCATE(nsst%XV(lensfc))
442 ALLOCATE(nsst%XZ(lensfc))
443 ALLOCATE(nsst%XZTS(lensfc))
444 ALLOCATE(nsst%Z_C(lensfc))
445 ALLOCATE(nsst%ZM(lensfc))
446 ALLOCATE(slifcs_fg(lensfc))
451 IF (trim(lnd_soi_file) .NE.
"NULL")
THEN 454 print*,
" APPLYING SOIL INCREMENTS FROM THE GSI" 455 ALLOCATE(stc_bck(lensfc, lsoil), smc_bck(lensfc, lsoil), slc_bck(lensfc,lsoil))
456 ALLOCATE(landinc_mask_fg(lensfc))
464 print*,
" APPLYING SNOW INCREMENTS FROM JEDI" 465 ALLOCATE(snd_bck(lensfc), snd_inc(lensfc), swe_bck(lensfc))
468 ALLOCATE(landinc_mask(lensfc))
469 if (ivegsrc == 2)
then 480 CALL read_data(lsoil,lensfc,do_nsst,.false.,is_noahmp=is_noahmp, &
481 tsffcs=tsffcs,smcfcs=smcfcs, &
482 swefcs=swefcs,stcfcs=stcfcs,tg3fcs=tg3fcs,zorfcs=zorfcs, &
483 cvfcs=cvfcs, cvbfcs=cvbfcs,cvtfcs=cvtfcs,albfcs=albfcs, &
484 vegfcs=vegfcs,slifcs=slifcs,cnpfcs=cnpfcs,f10m=f10m , &
485 vetfcs=vetfcs,sotfcs=sotfcs,alffcs=alffcs,ustar=ustar , &
486 fmm=fmm ,fhh=fhh ,sihfcs=sihfcs,sicfcs=sicfcs, &
487 sitfcs=sitfcs,tprcp=tprcp ,srflag=srflag,sndfcs=sndfcs, &
488 vmnfcs=vmnfcs,vmxfcs=vmxfcs,slcfcs=slcfcs,slpfcs=slpfcs, &
489 absfcs=absfcs,t2m=t2m ,q2m=q2m ,slmask=slmask, &
490 zsoil=zsoil, nsst=nsst)
494 print*,
'USE UNFILTERED OROGRAPHY.' 501 IF(nint(slifcs(i)).EQ.2) aisfcs(i) = 1.
505 IF (.NOT. do_sfccycle )
THEN 507 print*,
"FIRST GUESS MASK ADJUSTED BY IFD RECORD" 509 WHERE(nint(nsst%IFD) == 3) slifcs_fg = 2.0
512 print*,
"SAVE FIRST GUESS MASK" 519 CALL calculate_landinc_mask(slcfcs(:,1),swefcs, vetfcs, &
520 lensfc,veg_type_landice, landinc_mask)
530 IF (do_sfccycle)
THEN 531 ALLOCATE(slmaskl(lensfc), slmaskw(lensfc))
534 IF(nint(slmask(i)) == 1)
THEN 535 slmaskl(i) = 1.0_kind_io8
536 slmaskw(i) = 1.0_kind_io8
538 slmaskl(i) = 0.0_kind_io8
539 slmaskw(i) = 0.0_kind_io8
541 if(nint(slmask(i)) == 0)
then 542 min_ice(i) = 0.15_kind_io8
544 min_ice(i) = 0.0_kind_io8
547 num_threads = num_parthds()
549 print*,
"CALL SFCCYCLE TO UPDATE SURFACE FIELDS." 550 CALL sfccycle(lugb,lensfc,lsoil,sig1t,deltsfc, &
551 iy,im,id,ih,fh,rla,rlo, &
552 slmaskl,slmaskw, orog, orog_uf, use_ufo, do_nsst, &
553 sihfcs,sicfcs,sitfcs,sndfcs,slcfcs, &
554 vmnfcs,vmxfcs,slpfcs,absfcs, &
555 tsffcs,swefcs,zorfcs,albfcs,tg3fcs, &
556 cnpfcs,smcfcs,stcfcs,slifcs,aisfcs, &
557 vegfcs,vetfcs,sotfcs,alffcs, &
558 cvfcs,cvbfcs,cvtfcs,myrank,num_threads, nlunit, &
559 sz_nml, input_nml_file, &
561 ialb,isot,ivegsrc,tile_num,i_index,j_index)
562 DEALLOCATE(slmaskl, slmaskw)
572 IF (nst_file ==
"NULL")
THEN 574 print*,
"NO GSI FILE. ADJUST IFD FOR FORMER ICE POINTS." 576 IF (nint(slifcs_fg(i)) == 2 .AND. nint(slifcs(i)) == 0)
THEN 583 print*,
"ADJUST TREF FROM GSI INCREMENT" 587 call get_tf_clm(rla,rlo,jdim,idim,iy,im,id,ih,tf_clm,tf_trd)
588 tf_clm_tile(:) = reshape(tf_clm, (/lensfc/) )
589 tf_trd_tile(:) = reshape(tf_trd, (/lensfc/) )
593 call get_sal_clm(rla,rlo,jdim,idim,iy,im,id,ih,sal_clm)
594 sal_clm_tile(:) = reshape(sal_clm, (/lensfc/) )
598 CALL read_gsi_data(nst_file,
'NST')
602 CALL adjust_nsst(rla,rlo,slifcs,slifcs_fg,tsffcs,sitfcs,sicfcs,stcfcs, &
603 nsst,lensfc,lsoil,idim,jdim,zsea1,zsea2,im,id,deltsfc, &
604 tf_clm_tile,tf_trd_tile,sal_clm_tile)
626 CALL read_data(lsoil,lensfc,.false.,.true.,sndfcs=snd_inc)
636 CALL add_increment_snow(snd_inc,landinc_mask,lensfc,sndfcs)
642 CALL apply_land_da_adjustments_snd(lsm, lensfc, landinc_mask, swe_bck, snd_bck, &
654 landinc_mask_fg = landinc_mask
656 IF (do_sfccycle .OR. do_sno_inc)
THEN 657 CALL calculate_landinc_mask(slcfcs(:,1),swefcs, vetfcs, lensfc, &
658 veg_type_landice, landinc_mask )
665 INQUIRE(file=trim(lnd_soi_file), exist=file_exists)
666 IF (.not. file_exists)
then 667 print *,
'FATAL ERROR: land increment update requested, but file does not exist: ', &
669 call mpi_abort(mpi_comm_world, 10, ierr)
672 CALL read_gsi_data(lnd_soi_file,
'LND', lsoil=lsoil)
687 CALL add_increment_soil(rla,rlo,stcfcs,landinc_mask,landinc_mask_fg, &
688 lensfc,lsoil,idim,jdim, myrank)
694 CALL apply_land_da_adjustments_stc(lsm, isot, ivegsrc,lensfc, lsoil, &
695 sotfcs, landinc_mask_fg, stc_bck, stcfcs, smcfcs, slcfcs)
704 IF(
ALLOCATED(landinc_mask_fg))
DEALLOCATE(landinc_mask_fg)
705 IF(
ALLOCATED(landinc_mask))
DEALLOCATE(landinc_mask)
706 IF(
ALLOCATED(stc_bck))
DEALLOCATE(stc_bck)
707 IF(
ALLOCATED(smc_bck))
DEALLOCATE(smc_bck)
708 IF(
ALLOCATED(slc_bck))
DEALLOCATE(slc_bck)
709 IF(
ALLOCATED(snd_bck))
DEALLOCATE(snd_bck)
710 IF(
ALLOCATED(swe_bck))
DEALLOCATE(swe_bck)
711 IF(
ALLOCATED(snd_inc))
DEALLOCATE(snd_inc)
720 CALL write_data(lensfc,idim,jdim,lsoil,do_nsst,nsst,vegfcs=vegfcs)
724 CALL write_data(lensfc,idim,jdim,lsoil, &
725 do_nsst,nsst,slifcs=slifcs,tsffcs=tsffcs,vegfcs=vegfcs, &
726 swefcs=swefcs,tg3fcs=tg3fcs,zorfcs=zorfcs, &
727 albfcs=albfcs,alffcs=alffcs,cnpfcs=cnpfcs, &
728 f10m=f10m,t2m=t2m,q2m=q2m,vetfcs=vetfcs, &
729 sotfcs=sotfcs,ustar=ustar,fmm=fmm,fhh=fhh, &
730 sicfcs=sicfcs,sihfcs=sihfcs,sitfcs=sitfcs,tprcp=tprcp, &
731 srflag=srflag,swdfcs=sndfcs,vmnfcs=vmnfcs, &
732 vmxfcs=vmxfcs,slpfcs=slpfcs,absfcs=absfcs, &
733 slcfcs=slcfcs,smcfcs=smcfcs,stcfcs=stcfcs)
740 DEALLOCATE(nsst%D_CONV)
741 DEALLOCATE(nsst%DT_COOL)
743 DEALLOCATE(nsst%QRAIN)
744 DEALLOCATE(nsst%TREF)
745 DEALLOCATE(nsst%TFINC)
750 DEALLOCATE(nsst%XTTS)
754 DEALLOCATE(nsst%XZTS)
757 DEALLOCATE(slifcs_fg)
762 END SUBROUTINE sfcdrv
795 SUBROUTINE adjust_nsst(RLA,RLO,SLMSK_TILE,SLMSK_FG_TILE,SKINT_TILE,&
796 SICET_TILE,sice_tile,SOILT_TILE,NSST,LENSFC,LSOIL, &
797 IDIM,JDIM,ZSEA1,ZSEA2,MON,DAY,DELTSFC, &
798 tf_clm_tile,tf_trd_tile,sal_clm_tile)
802 USE read_write_data,
ONLY : idim_gaus, jdim_gaus, &
803 slmsk_gaus, dtref_gaus, &
810 INTEGER,
INTENT(IN) :: LENSFC, LSOIL, IDIM, JDIM, MON, DAY
812 REAL,
INTENT(IN) :: SLMSK_TILE(LENSFC), SLMSK_FG_TILE(LENSFC)
813 real,
intent(in) :: tf_clm_tile(lensfc),tf_trd_tile(lensfc),sal_clm_tile(lensfc)
814 REAL,
INTENT(IN) :: ZSEA1, ZSEA2, DELTSFC
815 REAL,
INTENT(INOUT) :: RLA(LENSFC), RLO(LENSFC), SKINT_TILE(LENSFC)
816 REAL,
INTENT(INOUT) :: SICET_TILE(LENSFC),sice_tile(lensfc),SOILT_TILE(LENSFC,LSOIL)
818 TYPE(NSST_DATA) :: NSST
820 REAL,
PARAMETER :: TMAX=313.0,tzero=273.16
822 INTEGER :: IOPT, NRET, KGDS_GAUS(200)
823 INTEGER :: IGAUS, JGAUS, IJ, II, JJ, III, JJJ, KRAD
824 INTEGER :: ISTART, IEND, JSTART, JEND
825 INTEGER :: MASK_TILE, MASK_FG_TILE
826 INTEGER :: ITILE, JTILE
827 INTEGER :: MAX_SEARCH, J, IERR
828 INTEGER :: IGAUSP1, JGAUSP1
829 integer :: nintp,nsearched,nice,nland
830 integer :: nfill,nfill_tice,nfill_clm
831 integer :: nset_thaw,nset_thaw_s,nset_thaw_i,nset_thaw_c
833 INTEGER,
ALLOCATABLE :: ID1(:,:), ID2(:,:), JDC(:,:)
838 REAL :: TREF_SAVE,WSUM,tf_ice,tf_thaw
839 REAL :: FILL, DTZM, GAUS_RES_KM, DTREF
840 REAL,
ALLOCATABLE :: XPTS(:), YPTS(:), LATS(:), LONS(:)
841 REAL,
ALLOCATABLE :: DUM2D(:,:), LATS_RAD(:), LONS_RAD(:)
842 REAL,
ALLOCATABLE :: AGRID(:,:,:), S2C(:,:,:)
846 kgds_gaus(2) = idim_gaus
847 kgds_gaus(3) = jdim_gaus
851 kgds_gaus(7) = -90000
852 kgds_gaus(8) = nint(-360000./float(idim_gaus))
853 kgds_gaus(9) = nint((360.0 / float(idim_gaus))*1000.0)
855 kgds_gaus(10) = jdim_gaus/2
860 print*,
'ADJUST NSST USING GSI INCREMENTS ON GAUSSIAN GRID' 868 ALLOCATE(xpts(idim_gaus*jdim_gaus))
869 ALLOCATE(ypts(idim_gaus*jdim_gaus))
870 ALLOCATE(lats(idim_gaus*jdim_gaus))
871 ALLOCATE(lons(idim_gaus*jdim_gaus))
877 CALL gdswzd(kgds_gaus,iopt,(idim_gaus*jdim_gaus),fill,xpts,ypts,lons,lats,nret)
879 IF (nret /= (idim_gaus*jdim_gaus))
THEN 880 print*,
'FATAL ERROR: PROBLEM IN GDSWZD. STOP.' 881 CALL mpi_abort(mpi_comm_world, 12, ierr)
884 DEALLOCATE (xpts, ypts)
886 ALLOCATE(dum2d(idim_gaus,jdim_gaus))
887 dum2d = reshape(lats, (/idim_gaus,jdim_gaus/) )
890 ALLOCATE(lats_rad(jdim_gaus))
892 lats_rad(j) = dum2d(1,jdim_gaus-j+1) * 3.1415926 / 180.0
895 dum2d = reshape(lons, (/idim_gaus,jdim_gaus/) )
897 ALLOCATE(lons_rad(idim_gaus))
898 lons_rad = dum2d(:,1) * 3.1415926 / 180.0
902 ALLOCATE(agrid(idim,jdim,2))
903 agrid(:,:,1) = reshape(rlo, (/idim,jdim/) )
904 agrid(:,:,2) = reshape(rla, (/idim,jdim/) )
905 agrid = agrid * 3.1415926 / 180.0
907 ALLOCATE(id1(idim,jdim))
908 ALLOCATE(id2(idim,jdim))
909 ALLOCATE(jdc(idim,jdim))
910 ALLOCATE(s2c(idim,jdim,4))
918 CALL remap_coef( 1, idim, 1, jdim, idim_gaus, jdim_gaus, &
919 lons_rad, lats_rad, id1, id2, jdc, s2c, agrid )
921 DEALLOCATE(lons_rad, lats_rad, agrid)
928 gaus_res_km = 360.0 / idim_gaus * 111.0
929 max_search = ceiling(500.0/gaus_res_km)
932 print*,
'MAXIMUM SEARCH IS ',max_search,
' GAUSSIAN POINTS.' 955 ij_loop :
DO ij = 1, lensfc
957 mask_tile = nint(slmsk_tile(ij))
958 mask_fg_tile = nint(slmsk_fg_tile(ij))
963 tf_ice = tfreez(sal_clm_tile(ij)) + tzero
968 IF (mask_tile == 1)
THEN 976 if (mask_tile == 2)
then 978 skint_tile(ij)=(1.0-sice_tile(ij))*nsst%tref(ij)+sice_tile(ij)*sicet_tile(ij)
986 jtile = (ij-1) / idim + 1
988 IF (itile==0) itile = idim
996 IF (mask_fg_tile == 2 .AND. mask_tile == 0)
THEN 1000 call tf_thaw_set(nsst%tref,nint(slmsk_fg_tile),itile,jtile,tf_ice,tf_clm_tile(ij),tf_thaw,idim,jdim, &
1001 nset_thaw_s,nset_thaw_i,nset_thaw_c)
1003 nset_thaw = nset_thaw + 1
1019 igaus = id1(itile,jtile)
1020 jgaus = jdc(itile,jtile)
1021 igausp1 = id2(itile,jtile)
1022 jgausp1 = jdc(itile,jtile)+1
1024 IF (slmsk_gaus(igaus,jgaus) == 0 .OR. &
1025 slmsk_gaus(igausp1,jgaus) == 0 .OR. &
1026 slmsk_gaus(igausp1,jgausp1) == 0 .OR. &
1027 slmsk_gaus(igaus,jgausp1) == 0)
THEN 1032 IF (slmsk_gaus(igaus,jgaus) == 0)
THEN 1033 dtref = dtref + (s2c(itile,jtile,1) * dtref_gaus(igaus,jgaus))
1034 wsum = wsum + s2c(itile,jtile,1)
1037 IF (slmsk_gaus(igausp1,jgaus) == 0)
THEN 1038 dtref = dtref + (s2c(itile,jtile,2) * dtref_gaus(igausp1,jgaus))
1039 wsum = wsum + s2c(itile,jtile,2)
1042 IF (slmsk_gaus(igausp1,jgausp1) == 0)
THEN 1043 dtref = dtref + (s2c(itile,jtile,3) * dtref_gaus(igausp1,jgausp1))
1044 wsum = wsum + s2c(itile,jtile,3)
1047 IF (slmsk_gaus(igaus,jgausp1) == 0)
THEN 1048 dtref = dtref + (s2c(itile,jtile,4) * dtref_gaus(igaus,jgausp1))
1049 wsum = wsum + s2c(itile,jtile,4)
1053 dtref = dtref / wsum
1055 tref_save = nsst%TREF(ij)
1056 nsst%TREF(ij) = nsst%TREF(ij) + dtref
1057 nsst%TREF(ij) = max(nsst%TREF(ij), tf_ice)
1058 nsst%TREF(ij) = min(nsst%TREF(ij), tmax)
1059 nsst%TFINC(ij) = nsst%TREF(ij) - tref_save
1061 CALL dtzm_point(nsst%XT(ij),nsst%XZ(ij),nsst%DT_COOL(ij), &
1062 nsst%Z_C(ij),zsea1,zsea2,dtzm)
1064 skint_tile(ij) = nsst%TREF(ij) + dtzm
1065 skint_tile(ij) = max(skint_tile(ij), tf_ice)
1066 skint_tile(ij) = min(skint_tile(ij), tmax)
1068 sicet_tile(ij) = skint_tile(ij)
1069 soilt_tile(ij,:) = skint_tile(ij)
1080 DO krad = 1, max_search
1082 istart = igaus - krad
1084 jstart = jgaus - krad
1087 DO jj = jstart, jend
1088 DO ii = istart, iend
1090 IF((jj == jstart) .OR. (jj == jend) .OR. &
1091 (ii == istart) .OR. (ii == iend))
THEN 1093 IF ((jj >= 1) .AND. (jj <= jdim_gaus))
THEN 1097 iii = idim_gaus + ii
1098 ELSE IF (ii >= (idim_gaus+1))
THEN 1099 iii = ii - idim_gaus
1110 IF (krad <= 2 .AND. slmsk_gaus(iii,jjj) == 2) is_ice = .true.
1112 IF (slmsk_gaus(iii,jjj) == 0)
THEN 1116 nsearched = nsearched + 1
1118 tref_save = nsst%TREF(ij)
1119 nsst%TREF(ij ) = nsst%TREF(ij) + dtref_gaus(iii,jjj)
1120 nsst%TREF(ij) = max(nsst%TREF(ij), tf_ice)
1121 nsst%TREF(ij) = min(nsst%TREF(ij), tmax)
1122 nsst%TFINC(ij) = nsst%TREF(ij) - tref_save
1124 CALL dtzm_point(nsst%XT(ij),nsst%XZ(ij),nsst%DT_COOL(ij), &
1125 nsst%Z_C(ij),zsea1,zsea2,dtzm)
1127 skint_tile(ij) = nsst%TREF(ij) + dtzm
1128 skint_tile(ij) = max(skint_tile(ij), tf_ice)
1129 skint_tile(ij) = min(skint_tile(ij), tmax)
1131 sicet_tile(ij) = skint_tile(ij)
1132 soilt_tile(ij,:) = skint_tile(ij)
1155 nsst%TREF(ij) = tf_ice
1157 nfill_tice = nfill_tice + 1
1159 tref_save = nsst%TREF(ij)
1160 nsst%TREF(ij) = nsst%TREF(ij) + tf_trd_tile(ij)
1161 nsst%TREF(ij) = max(nsst%TREF(ij), tf_ice)
1162 nsst%TREF(ij) = min(nsst%TREF(ij), tmax)
1163 nsst%TFINC(ij) = nsst%TREF(ij) - tref_save
1165 nfill_clm = nfill_clm + 1
1168 CALL dtzm_point(nsst%XT(ij),nsst%XZ(ij),nsst%DT_COOL(ij), &
1169 nsst%Z_C(ij),zsea1,zsea2,dtzm)
1171 skint_tile(ij) = nsst%TREF(ij) + dtzm
1172 skint_tile(ij) = max(skint_tile(ij), tf_ice)
1173 skint_tile(ij) = min(skint_tile(ij), tmax)
1175 sicet_tile(ij) = skint_tile(ij)
1176 soilt_tile(ij,:) = skint_tile(ij)
1182 write(*,
'(a)')
'statistics of grids number processed for tile : ' 1183 write(*,
'(a,I8)')
' nintp = ',nintp
1184 write(*,
'(a,4I8)')
'nset_thaw,nset_thaw_s,nset_thaw_i,nset_thaw_c =',nset_thaw,nset_thaw_s,nset_thaw_i,nset_thaw_c
1185 write(*,
'(a,I8)')
' nsearched = ',nsearched
1186 write(*,
'(a,3I6)')
' nfill,nfill_tice,nfill_clm = ',nfill,nfill_tice,nfill_clm
1187 write(*,
'(a,I8)')
' nice = ',nice
1188 write(*,
'(a,I8)')
' nland = ',nland
1190 DEALLOCATE(id1, id2, jdc, s2c)
1192 END SUBROUTINE adjust_nsst
1204 SUBROUTINE climo_trend(LATITUDE, MON, DAY, DELTSFC, DTREF)
1207 INTEGER,
INTENT(IN) :: MON, DAY
1209 REAL,
INTENT(IN) :: LATITUDE, DELTSFC
1210 REAL,
INTENT(OUT) :: DTREF
1212 INTEGER :: NUM_DAYS(12), MON2, MON1
1214 REAL,
TARGET :: SST_80_90(12)
1215 REAL,
TARGET :: SST_70_80(12)
1216 REAL,
TARGET :: SST_60_70(12)
1217 REAL,
TARGET :: SST_50_60(12)
1218 REAL,
TARGET :: SST_40_50(12)
1219 REAL,
TARGET :: SST_30_40(12)
1220 REAL,
TARGET :: SST_20_30(12)
1221 REAL,
TARGET :: SST_10_20(12)
1222 REAL,
TARGET :: SST_00_10(12)
1223 REAL,
TARGET :: SST_M10_00(12)
1224 REAL,
TARGET :: SST_M20_M10(12)
1225 REAL,
TARGET :: SST_M30_M20(12)
1226 REAL,
TARGET :: SST_M40_M30(12)
1227 REAL,
TARGET :: SST_M50_M40(12)
1228 REAL,
TARGET :: SST_M60_M50(12)
1229 REAL,
TARGET :: SST_M70_M60(12)
1230 REAL,
TARGET :: SST_M80_M70(12)
1231 REAL,
TARGET :: SST_M90_M80(12)
1233 REAL,
POINTER :: SST(:)
1235 DATA num_days /31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/
1237 DATA sst_80_90 /271.466, 271.458, 271.448, 271.445, 271.519, 271.636, &
1238 272.023, 272.066, 272.001, 271.698, 271.510, 271.472/
1240 DATA sst_70_80 /272.149, 272.103, 272.095, 272.126, 272.360, 272.988, &
1241 274.061, 274.868, 274.415, 273.201, 272.468, 272.268/
1243 DATA sst_60_70 /274.240, 274.019, 273.988, 274.185, 275.104, 276.875, &
1244 279.005, 280.172, 279.396, 277.586, 275.818, 274.803/
1246 DATA sst_50_60 /277.277, 276.935, 277.021, 277.531, 279.100, 281.357, &
1247 283.735, 285.171, 284.399, 282.328, 279.918, 278.199/
1249 DATA sst_40_50 /281.321, 280.721, 280.850, 281.820, 283.958, 286.588, &
1250 289.195, 290.873, 290.014, 287.652, 284.898, 282.735/
1252 DATA sst_30_40 /289.189, 288.519, 288.687, 289.648, 291.547, 293.904, &
1253 296.110, 297.319, 296.816, 295.225, 292.908, 290.743/
1255 DATA sst_20_30 /294.807, 294.348, 294.710, 295.714, 297.224, 298.703, &
1256 299.682, 300.127, 300.099, 299.455, 297.953, 296.177/
1258 DATA sst_10_20 /298.878, 298.720, 299.033, 299.707, 300.431, 300.709, &
1259 300.814, 300.976, 301.174, 301.145, 300.587, 299.694/
1261 DATA sst_00_10 /300.415, 300.548, 300.939, 301.365, 301.505, 301.141, &
1262 300.779, 300.660, 300.818, 300.994, 300.941, 300.675/
1264 DATA sst_m10_00 /300.226, 300.558, 300.914, 301.047, 300.645, 299.870, &
1265 299.114, 298.751, 298.875, 299.294, 299.721, 299.989/
1267 DATA sst_m20_m10 /299.547, 299.985, 300.056, 299.676, 298.841, 297.788, &
1268 296.893, 296.491, 296.687, 297.355, 298.220, 298.964/
1270 DATA sst_m30_m20 /297.524, 298.073, 297.897, 297.088, 295.846, 294.520, &
1271 293.525, 293.087, 293.217, 293.951, 295.047, 296.363/
1273 DATA sst_m40_m30 /293.054, 293.765, 293.468, 292.447, 291.128, 289.781, &
1274 288.773, 288.239, 288.203, 288.794, 289.947, 291.553/
1276 DATA sst_m50_m40 /285.052, 285.599, 285.426, 284.681, 283.761, 282.826, &
1277 282.138, 281.730, 281.659, 281.965, 282.768, 283.961/
1279 DATA sst_m60_m50 /277.818, 278.174, 277.991, 277.455, 276.824, 276.229, &
1280 275.817, 275.585, 275.560, 275.687, 276.142, 276.968/
1282 DATA sst_m70_m60 /273.436, 273.793, 273.451, 272.813, 272.349, 272.048, &
1283 271.901, 271.838, 271.845, 271.889, 272.080, 272.607/
1285 DATA sst_m80_m70 /271.579, 271.578, 271.471, 271.407, 271.392, 271.391, &
1286 271.390, 271.391, 271.394, 271.401, 271.422, 271.486/
1288 DATA sst_m90_m80 /271.350, 271.350, 271.350, 271.350, 271.350, 271.350, &
1289 271.350, 271.350, 271.350, 271.350, 271.350, 271.350/
1292 IF (latitude > 80.0)
THEN 1294 ELSEIF (latitude > 70.0)
THEN 1296 ELSEIF (latitude > 60.0)
THEN 1298 ELSEIF (latitude > 50.0)
THEN 1300 ELSEIF (latitude > 40.0)
THEN 1302 ELSEIF (latitude > 30.0)
THEN 1304 ELSEIF (latitude > 20.0)
THEN 1306 ELSEIF (latitude > 10.0)
THEN 1308 ELSEIF (latitude > 0.0)
THEN 1310 ELSEIF (latitude > -10.0)
THEN 1312 ELSEIF (latitude > -20.0)
THEN 1314 ELSEIF (latitude > -30.0)
THEN 1316 ELSEIF (latitude > -40.0)
THEN 1318 ELSEIF (latitude > -50.0)
THEN 1320 ELSEIF (latitude > -60.0)
THEN 1322 ELSEIF (latitude > -70.0)
THEN 1324 ELSEIF (latitude > -80.0)
THEN 1332 IF(mon2 == 13) mon2 = 1
1334 dtref = (sst(mon2) - sst(mon1)) / num_days(mon1)
1337 IF (mon1 == 0) mon1=12
1339 dtref = (sst(mon2) - sst(mon1)) / num_days(mon1)
1342 dtref = dtref * (deltsfc / 24.0)
1344 END SUBROUTINE climo_trend
1357 SUBROUTINE dtzm_point(XT,XZ,DT_COOL,ZC,Z1,Z2,DTZM)
1360 real,
intent(in) :: xt,xz,dt_cool,zc,z1,z2
1361 real,
intent(out) :: dtzm
1363 real,
parameter :: zero = 0.0
1364 real,
parameter :: one = 1.0
1365 real,
parameter :: half = 0.5
1366 real :: dt_warm,dtw,dtc
1371 if ( xt > zero )
then 1372 dt_warm = (xt+xt)/xz
1375 dtw = dt_warm*(one-(z1+z2)/(xz+xz))
1376 elseif ( z1 < xz .and. z2 >= xz )
then 1377 dtw = half*(one-z1/xz)*dt_warm*(xz-z1)/(z2-z1)
1379 elseif ( z1 == z2 )
then 1381 dtw = dt_warm*(one-z1/xz)
1389 if ( zc > zero )
then 1392 dtc = dt_cool*(one-(z1+z2)/(zc+zc))
1393 elseif ( z1 < zc .and. z2 >= zc )
then 1394 dtc = half*(one-z1/zc)*dt_cool*(zc-z1)/(z2-z1)
1396 elseif ( z1 == z2 )
then 1398 dtc = dt_cool*(one-z1/zc)
1408 END SUBROUTINE dtzm_point
1429 subroutine tf_thaw_set(tf_ij,mask_ij,itile,jtile,tice,tclm,tf_thaw,nx,ny, &
1430 nset_thaw_s,nset_thaw_i,nset_thaw_c)
1432 real,
dimension(nx*ny),
intent(in) :: tf_ij
1433 integer,
dimension(nx*ny),
intent(in) :: mask_ij
1434 real,
intent(in) :: tice,tclm
1435 integer,
intent(in) :: itile,jtile,nx,ny
1436 real,
intent(out) :: tf_thaw
1437 integer,
intent(inout) :: nset_thaw_s,nset_thaw_i,nset_thaw_c
1439 real,
parameter :: bmiss = -999.0
1440 real,
dimension(nx,ny) :: tf
1441 integer,
dimension(nx,ny) :: mask
1442 integer :: krad,max_search,istart,iend,jstart,jend
1443 integer :: ii,jj,iii,jjj
1448 mask(:,:) = reshape(mask_ij,(/nx,ny/) )
1449 tf(:,:) = reshape(tf_ij,(/nx,ny/) )
1453 do krad = 1, max_search
1455 istart = itile - krad
1457 jstart = jtile - krad
1460 do jj = jstart, jend
1461 do ii = istart, iend
1464 if ((jj == jstart) .or. (jj == jend) .or. &
1465 (ii == istart) .or. (ii == iend))
then 1467 if ((jj >= 1) .and. (jj <= ny))
then 1471 else if (ii >= (nx+1))
then 1482 if (krad <= 2 .and. mask(iii,jjj) == 2) is_ice = .true.
1484 if (mask(iii,jjj) == 0)
then 1485 tf_thaw = tf(iii,jjj)
1486 nset_thaw_s = nset_thaw_s + 1
1487 write(*,
'(a,I4,2F9.3)')
'nset_thaw_s,tf(iii,jjj),tclm : ',nset_thaw_s,tf(iii,jjj),tclm
1499 if ( tf_thaw == bmiss )
then 1502 nset_thaw_i = nset_thaw_i + 1
1503 write(*,
'(a,I4,F9.3)')
'nset_thaw_i,tf_ice : ',nset_thaw_i,tice
1505 tf_thaw = 0.8*tice+0.2*tclm
1506 nset_thaw_c = nset_thaw_c + 1
1507 write(*,
'(a,I4,2F9.3)')
'nset_thaw_c,tf_ice,tclm : ',nset_thaw_c,tice,tclm
1521 use read_write_data,
only : nsst_data
1524 integer,
intent(in) :: ij
1526 real,
intent(in) :: tf_thaw
1528 type(nsst_data),
intent(inout) :: nsst
1532 nsst%d_conv(ij) = 0.0
1533 nsst%dt_cool(ij) = 0.0
1535 nsst%qrain(ij) = 0.0
1536 nsst%tref(ij) = tf_thaw
1566 subroutine get_tf_clm(xlats_ij,xlons_ij,ny,nx,iy,im,id,ih,tf_clm,tf_trd)
1567 use read_write_data,
only : get_tf_clm_dim
1571 real,
dimension(nx*ny),
intent(in) :: xlats_ij
1572 real,
dimension(nx*ny),
intent(in) :: xlons_ij
1573 real,
dimension(nx,ny),
intent(out) :: tf_clm
1574 real,
dimension(nx,ny),
intent(out) :: tf_trd
1575 integer,
intent(in) :: iy,im,id,ih,nx,ny
1577 real,
allocatable,
dimension(:,:) :: tf_clm0
1578 real,
allocatable,
dimension(:,:) :: tf_trd0
1579 real,
allocatable,
dimension(:) :: cxlats
1580 real,
allocatable,
dimension(:) :: cxlons
1582 real,
dimension(nx*ny) :: tf_clm_ij
1583 real,
dimension(nx*ny) :: tf_trd_ij
1585 integer :: nxc,nyc,mon1,mon2,i,j
1586 character (len=6),
parameter :: fin_tf_clm=
'sstclm' 1594 call get_tf_clm_dim(fin_tf_clm,nyc,nxc)
1595 allocate( tf_clm0(nxc,nyc),tf_trd0(nxc,nyc),cxlats(nyc),cxlons(nxc) )
1599 call get_tf_clm_ta(tf_clm0,tf_trd0,cxlats,cxlons,nyc,nxc,mon1,mon2,wei1,wei2)
1603 if ( nx == nxc .and. ny == nyc )
then 1604 tf_clm(:,:) = tf_clm0(:,:)
1605 tf_trd(:,:) = tf_trd0(:,:)
1609 call intp_tile(tf_clm0, cxlats, cxlons, nyc, nxc, &
1610 tf_clm_ij,xlats_ij,xlons_ij,ny, nx)
1611 call intp_tile(tf_trd0, cxlats, cxlons, nyc, nxc, &
1612 tf_trd_ij,xlats_ij,xlons_ij,ny, nx)
1615 tf_clm(:,:) = reshape(tf_clm_ij, (/nx,ny/) )
1616 tf_trd(:,:) = reshape(tf_trd_ij, (/nx,ny/) )
1635 subroutine get_tf_clm_ta(tf_clm_ta,tf_clm_trend,xlats,xlons,nlat,nlon,mon1,mon2,wei1,wei2)
1636 use read_write_data,
only : read_tf_clim_grb
1640 integer,
intent(in) :: nlat,nlon,mon1,mon2
1641 real,
intent(in) :: wei1,wei2
1643 real,
dimension(nlon,nlat),
intent(out) :: tf_clm_ta,tf_clm_trend
1644 real,
dimension(nlat),
intent(out) :: xlats
1645 real,
dimension(nlon),
intent(out) :: xlons
1648 character (len=6),
parameter :: fin_tf_clm=
'sstclm' 1651 real,
dimension(nlon,nlat) :: tf_clm1,tf_clm2
1656 call read_tf_clim_grb(trim(fin_tf_clm),tf_clm1,xlats,xlons,nlat,nlon,mon1)
1657 call read_tf_clim_grb(trim(fin_tf_clm),tf_clm2,xlats,xlons,nlat,nlon,mon2)
1661 tf_clm_ta(:,:) = wei1*tf_clm1(:,:)+wei2*tf_clm2(:,:)
1665 tf_clm_trend(:,:) = (tf_clm2(:,:)-tf_clm1(:,:))/120.0
1667 write(*,
'(a,2f9.3)')
'tf_clm_ta, min, max : ',minval(tf_clm_ta),maxval(tf_clm_ta)
1668 write(*,
'(a,2f9.3)')
'tf_clm_trend, min, max : ',minval(tf_clm_trend),maxval(tf_clm_trend)
1683 subroutine get_sal_clm(xlats_ij,xlons_ij,ny,nx,iy,im,id,ih,sal_clm)
1684 use read_write_data,
only : get_dim_nc
1687 real,
dimension(nx*ny),
intent(in) :: xlats_ij
1688 real,
dimension(nx*ny),
intent(in) :: xlons_ij
1689 real,
dimension(nx,ny),
intent(out) :: sal_clm
1690 integer,
intent(in) :: iy,im,id,ih,nx,ny
1692 real,
allocatable,
dimension(:,:) :: sal_clm0
1693 real,
allocatable,
dimension(:) :: cxlats
1694 real,
allocatable,
dimension(:) :: cxlons
1696 real,
dimension(nx*ny) :: sal_clm_ij
1698 integer :: nxc,nyc,mon1,mon2,i,j
1699 character (len=6),
parameter :: fin_sal_clm=
'salclm' 1707 call get_dim_nc(fin_sal_clm,nyc,nxc)
1708 allocate( sal_clm0(nxc,nyc),cxlats(nyc),cxlons(nxc) )
1712 call get_sal_clm_ta(sal_clm0,cxlats,cxlons,nyc,nxc,mon1,mon2,wei1,wei2)
1716 if ( nx == nxc .and. ny == nyc )
then 1717 sal_clm(:,:) = sal_clm0(:,:)
1721 call intp_tile(sal_clm0, cxlats, cxlons, nyc, nxc, &
1722 sal_clm_ij,xlats_ij,xlons_ij,ny, nx)
1726 sal_clm(:,:) = reshape(sal_clm_ij, (/nx,ny/) )
1743 subroutine get_sal_clm_ta(sal_clm_ta,xlats,xlons,nlat,nlon,mon1,mon2,wei1,wei2)
1745 use read_write_data,
only : read_salclm_gfs_nc
1749 integer,
intent(in) :: nlat,nlon,mon1,mon2
1750 real,
intent(in) :: wei1,wei2
1752 real,
dimension(nlon,nlat),
intent(out) :: sal_clm_ta
1753 real,
dimension(nlat),
intent(out) :: xlats
1754 real,
dimension(nlon),
intent(out) :: xlons
1757 character (len=6),
parameter :: fin_sal_clm=
'salclm' 1760 real,
dimension(nlon,nlat) :: sal_clm1,sal_clm2
1765 call read_salclm_gfs_nc(trim(fin_sal_clm),sal_clm1,xlats,xlons,nlat,nlon,mon1)
1766 call read_salclm_gfs_nc(trim(fin_sal_clm),sal_clm2,xlats,xlons,nlat,nlon,mon2)
1770 sal_clm_ta(:,:) = wei1*sal_clm1(:,:)+wei2*sal_clm2(:,:)
1771 write(*,
'(a,2f9.3)')
'sal_clm_ta, min, max : ',minval(sal_clm_ta),maxval(sal_clm_ta)
1788 subroutine intp_tile(tf_lalo,dlats_lalo,dlons_lalo,jdim_lalo,idim_lalo, &
1789 tf_tile,xlats_tile,xlons_tile,jdim_tile,idim_tile)
1796 real,
dimension(idim_lalo,jdim_lalo),
intent(in) :: tf_lalo
1797 real,
dimension(jdim_lalo),
intent(in) :: dlats_lalo
1798 real,
dimension(idim_lalo),
intent(in) :: dlons_lalo
1799 real,
dimension(jdim_tile*idim_tile),
intent(in) :: xlats_tile
1800 real,
dimension(jdim_tile*idim_tile),
intent(in) :: xlons_tile
1801 integer,
intent(in) :: jdim_lalo,idim_lalo,jdim_tile,idim_tile
1802 real,
dimension(jdim_tile*idim_tile),
intent(out) :: tf_tile
1805 real,
parameter :: deg2rad=3.1415926/180.0
1806 real,
dimension(jdim_lalo) :: xlats_lalo
1807 real,
dimension(idim_lalo) :: xlons_lalo
1808 real :: tf,wsum,res_km
1809 integer :: itile,jtile
1810 integer :: ii,jj,ij,iii,jjj
1811 integer :: ilalo,jlalo,ilalop1,jlalop1
1812 integer :: istart,iend,jstart,jend,krad
1814 integer,
allocatable,
dimension(:,:) :: id1,id2,jdc
1815 real,
allocatable,
dimension(:,:,:) :: agrid,s2c
1818 print*,
'interpolate from lat/lon grids to any one grid with known lat/lon' 1820 xlats_lalo = dlats_lalo*deg2rad
1821 xlons_lalo = dlons_lalo*deg2rad
1823 allocate(agrid(idim_tile,jdim_tile,2))
1824 agrid(:,:,1) = reshape(xlons_tile, (/idim_tile,jdim_tile/) )
1825 agrid(:,:,2) = reshape(xlats_tile, (/idim_tile,jdim_tile/) )
1826 agrid = agrid*deg2rad
1828 allocate(id1(idim_tile,jdim_tile))
1829 allocate(id2(idim_tile,jdim_tile))
1830 allocate(jdc(idim_tile,jdim_tile))
1831 allocate(s2c(idim_tile,jdim_tile,4))
1839 call remap_coef( 1, idim_tile, 1, jdim_tile, idim_lalo, jdim_lalo, &
1840 xlons_lalo, xlats_lalo, id1, id2, jdc, s2c, agrid )
1842 do ij = 1, jdim_tile*idim_tile
1844 jtile = (ij-1)/idim_tile + 1
1845 itile = mod(ij,idim_tile)
1846 if (itile==0) itile = idim_tile
1848 ilalo = id1(itile,jtile)
1849 ilalop1 = id2(itile,jtile)
1850 jlalo = jdc(itile,jtile)
1851 jlalop1 = jdc(itile,jtile) + 1
1853 wsum = s2c(itile,jtile,1) + s2c(itile,jtile,2) + &
1854 s2c(itile,jtile,3) + s2c(itile,jtile,4)
1856 tf_tile(ij) = ( s2c(itile,jtile,1)*tf_lalo(ilalo,jlalo) + &
1857 s2c(itile,jtile,2)*tf_lalo(ilalop1,jlalo) + &
1858 s2c(itile,jtile,3)*tf_lalo(ilalop1,jlalop1) + &
1859 s2c(itile,jtile,4)*tf_lalo(ilalo,jlalop1) )/wsum
1862 deallocate(id1, id2, jdc, s2c)
1878 subroutine get_tim_wei(iy,im,id,ih,mon1,mon2,wei1,wei2)
1882 integer,
intent(in) :: iy,im,id,ih
1884 integer,
intent(out) :: mon1,mon2
1885 real,
intent(out) :: wei1,wei2
1889 integer :: mon,monend,monm,monp,jdow,jdoy,jday
1894 real,
dimension(13) :: dayhf
1895 data dayhf/15.5,45.0,74.5,105.0,135.5,166.0,196.5,227.5,258.0,288.5,319.0,349.5,380.5/
1908 call w3doxdat(jda,jdow,jdoy,jday)
1909 rjday=jdoy+jda(5)/24.
1910 if(rjday.lt.dayhf(1)) rjday=rjday+365.
1916 if( rjday >= dayhf(monm) .and. rjday < dayhf(monp) )
then 1923 print *,
'FATAL ERROR in get_tim_wei, wrong rjday',rjday
1927 wei1 = (dayhf(mon2)-rjday)/(dayhf(mon2)-dayhf(mon1))
1928 wei2 = (rjday-dayhf(mon1))/(dayhf(mon2)-dayhf(mon1))
1930 if( mon2 == 13 ) mon2=1
1932 write(*,
'(a,2i4,3f9.3)')
'mon1,mon2,rjday,wei1,wei2=',mon1,mon2,rjday,wei1,wei2
1945 real function tfreez(salinity)
1951 parameter(a1 = -0.0575)
1952 parameter(a2 = 1.710523e-3)
1953 parameter(a3 = -2.154996e-4)
1955 IF (salinity .LT. 0.)
THEN 1960 tfreez = sal*(a1+a2*sqrt(sal)+a3*sal)
integer function num_parthds()
Return the number of omp threads.
subroutine get_tf_clm(xlats_ij, xlons_ij, ny, nx, iy, im, id, ih, tf_clm, tf_trd)
Get the sst climatology at the valid time and on the target grid.
subroutine get_tf_clm_ta(tf_clm_ta, tf_clm_trend, xlats, xlons, nlat, nlon, mon1, mon2, wei1, wei2)
Get the reference temperature/sst climatology and its trend at analysis time.
subroutine get_sal_clm_ta(sal_clm_ta, xlats, xlons, nlat, nlon, mon1, mon2, wei1, wei2)
Get climatological salinity at the analysis time.
subroutine tf_thaw_set(tf_ij, mask_ij, itile, jtile, tice, tclm, tf_thaw, nx, ny, nset_thaw_s, nset_thaw_i, nset_thaw_c)
Set the background reference temperature (tf) for points where the ice has just melted.
subroutine intp_tile(tf_lalo, dlats_lalo, dlons_lalo, jdim_lalo, idim_lalo, tf_tile, xlats_tile, xlons_tile, jdim_tile, idim_tile)
Interpolate lon/lat grid data to the fv3 native grid (tf_lalo => tf_tile).
Module containing utility routines.
real function tfreez(salinity)
Compute the freezing point of water as a function of salinity.
subroutine get_tim_wei(iy, im, id, ih, mon1, mon2, wei1, wei2)
For a given date, determine the bounding months and the linear time interpolation weights...
subroutine get_sal_clm(xlats_ij, xlons_ij, ny, nx, iy, im, id, ih, sal_clm)
Get salinity climatology at the valid time on the target grid.
subroutine nsst_water_reset(nsst, ij, tf_thaw)
If the first guess was sea ice, but the analysis is open water, reset all nsst variables.