107 CHARACTER(LEN=3) :: donst
108 INTEGER :: idim, jdim, lsoil, lugb, iy, im, id, ih, ialb
109 INTEGER :: isot, ivegsrc, lensfc, zsea1_mm, zsea2_mm, ierr
110 INTEGER :: nprocs, myrank, num_threads,
num_parthds, max_tasks
111 REAL :: fh, deltsfc, zsea1, zsea2
112 LOGICAL :: use_ufo, do_nsst, do_lndinc, do_sfccycle
114 NAMELIST/namcyc/ idim,jdim,lsoil,lugb,iy,im,id,ih,fh,&
115 deltsfc,ialb,use_ufo,donst, &
116 do_sfccycle,isot,ivegsrc,zsea1_mm, &
117 zsea2_mm, max_tasks, do_lndinc
119 DATA idim,jdim,lsoil/96,96,4/
120 DATA iy,im,id,ih,fh/1997,8,2,0,0./
121 DATA lugb/51/, deltsfc/0.0/, ialb/1/, max_tasks/99999/
122 DATA isot/1/, ivegsrc/2/, zsea1_mm/0/, zsea2_mm/0/
125 CALL mpi_comm_size(mpi_comm_world, nprocs, ierr)
126 CALL mpi_comm_rank(mpi_comm_world, myrank, ierr)
128 if (myrank==0)
call w3tagb(
'GLOBAL_CYCLE',2018,0179,0055,
'NP20')
133 print*,
"STARTING CYCLE PROGRAM ON RANK ", myrank
134 print*,
"RUNNING WITH ", nprocs,
"TASKS" 135 print*,
"AND WITH ", num_threads,
" THREADS." 143 print*,
"READ NAMCYC NAMELIST." 145 CALL baopenr(36,
"fort.36", ierr)
149 IF (max_tasks < 99999 .AND. myrank > (max_tasks - 1))
THEN 150 print*,
"USER SPECIFIED MAX NUMBER OF TASKS: ", max_tasks
151 print*,
"WILL NOT RUN CYCLE PROGRAM ON RANK: ", myrank
157 zsea1 = float(zsea1_mm) / 1000.0
158 zsea2 = float(zsea2_mm) / 1000.0
160 IF (donst ==
"YES")
THEN 167 IF (myrank==0) print*,
"LUGB,IDIM,JDIM,ISOT,IVEGSRC,LSOIL,DELTSFC,IY,IM,ID,IH,FH: ", &
168 lugb,idim,jdim,isot,ivegsrc,lsoil,deltsfc,iy,im,id,ih,fh
170 CALL sfcdrv(lugb,idim,jdim,lensfc,lsoil,deltsfc, &
171 iy,im,id,ih,fh,ialb, &
172 use_ufo,do_nsst,do_sfccycle,do_lndinc, &
173 zsea1,zsea2,isot,ivegsrc,myrank)
176 print*,
'CYCLE PROGRAM COMPLETED NORMALLY ON RANK: ', myrank
180 CALL mpi_barrier(mpi_comm_world, ierr)
182 if (myrank==0)
call w3tage(
'GLOBAL_CYCLE')
184 CALL mpi_finalize(ierr)
297 SUBROUTINE sfcdrv(LUGB, IDIM,JDIM,LENSFC,LSOIL,DELTSFC, &
298 IY,IM,ID,IH,FH,IALB, &
299 USE_UFO,DO_NSST,DO_SFCCYCLE,DO_LNDINC,&
300 ZSEA1,ZSEA2,ISOT,IVEGSRC,MYRANK)
305 USE land_increments,
ONLY: add_increment_soil, &
306 add_increment_snow, &
307 calculate_landinc_mask, &
308 apply_land_da_adjustments_soil, &
309 apply_land_da_adjustments_snd, &
314 INTEGER,
INTENT(IN) :: IDIM, JDIM, LENSFC, LSOIL, IALB
315 INTEGER,
INTENT(IN) :: LUGB, IY, IM, ID, IH
316 INTEGER,
INTENT(IN) :: ISOT, IVEGSRC, MYRANK
318 LOGICAL,
INTENT(IN) :: USE_UFO, DO_NSST,DO_SFCCYCLE
319 LOGICAL,
INTENT(IN) :: DO_LNDINC
321 REAL,
INTENT(IN) :: FH, DELTSFC, ZSEA1, ZSEA2
323 INTEGER,
PARAMETER :: NLUNIT=35
324 INTEGER,
PARAMETER :: SZ_NML=1
326 CHARACTER(LEN=5) :: TILE_NUM
327 CHARACTER(LEN=500) :: NST_FILE
328 CHARACTER(LEN=500) :: LND_SOI_FILE
329 CHARACTER(LEN=4) :: INPUT_NML_FILE(SZ_NML)
332 INTEGER :: I_INDEX(LENSFC), J_INDEX(LENSFC)
333 INTEGER :: IDUM(IDIM,JDIM)
334 integer :: num_parthds, num_threads
339 real(kind=kind_io8) :: min_ice(lensfc)
341 REAL :: SLMASK(LENSFC), OROG(LENSFC)
342 REAL :: SIHFCS(LENSFC), SICFCS(LENSFC)
343 REAL :: SITFCS(LENSFC), TSFFCS(LENSFC)
344 REAL :: SWEFCS(LENSFC), ZORFCS(LENSFC)
345 REAL :: ALBFCS(LENSFC,4), TG3FCS(LENSFC)
346 REAL :: CNPFCS(LENSFC), SMCFCS(LENSFC,LSOIL)
347 REAL :: STCFCS(LENSFC,LSOIL), SLIFCS(LENSFC)
348 REAL :: AISFCS(LENSFC), F10M(LENSFC)
349 REAL :: VEGFCS(LENSFC), VETFCS(LENSFC)
350 REAL :: SOTFCS(LENSFC), ALFFCS(LENSFC,2)
351 REAL :: CVFCS(LENSFC), CVTFCS(LENSFC)
352 REAL :: CVBFCS(LENSFC), TPRCP(LENSFC)
353 REAL :: SRFLAG(LENSFC), SNDFCS(LENSFC)
354 REAL :: SLCFCS(LENSFC,LSOIL), VMXFCS(LENSFC)
355 REAL :: VMNFCS(LENSFC), T2M(LENSFC)
356 REAL :: Q2M(LENSFC), SLPFCS(LENSFC)
357 REAL :: ABSFCS(LENSFC), OROG_UF(LENSFC)
358 REAL :: USTAR(LENSFC)
359 REAL :: FMM(LENSFC), FHH(LENSFC)
360 REAL :: RLA(LENSFC), RLO(LENSFC)
361 REAL(KIND=4) :: ZSOIL(LSOIL)
362 REAL :: SIG1T(LENSFC)
365 REAL,
ALLOCATABLE :: STC_BCK(:,:), SMC_BCK(:,:), SLC_BCK(:,:)
366 REAL,
ALLOCATABLE :: SLIFCS_FG(:)
367 INTEGER,
ALLOCATABLE :: LANDINC_MASK_FG(:), LANDINC_MASK(:)
368 REAL,
ALLOCATABLE :: SND_BCK(:), SND_INC(:), SWE_BCK(:)
369 REAL(KIND=KIND_IO8),
ALLOCATABLE :: SLMASKL(:), SLMASKW(:)
371 TYPE(NSST_DATA) :: NSST
372 real,
dimension(idim,jdim) :: tf_clm,tf_trd,sal_clm
373 real,
dimension(lensfc) :: tf_clm_tile,tf_trd_tile,sal_clm_tile
374 INTEGER :: veg_type_landice
375 INTEGER,
DIMENSION(LENSFC) :: STC_UPDATED, SLC_UPDATED
377 LOGICAL :: FILE_EXISTS, DO_SOI_INC, DO_SNO_INC
384 NAMELIST/namsfcd/ nst_file, lnd_soi_file, do_sno_inc
386 DATA nst_file/
'NULL'/
387 DATA lnd_soi_file/
'NULL'/
395 input_nml_file =
"NULL" 397 CALL baopenr(37,
"fort.37", ierr)
398 READ (37, nml=namsfcd)
401 print*,
'IN ROUTINE SFCDRV,IDIM=',idim,
'JDIM=',jdim,
'FH=',fh
407 CALL read_lat_lon_orog(rla,rlo,orog,orog_uf,tile_num,idim,jdim,lensfc)
413 i_index = reshape(idum, (/lensfc/))
419 j_index = reshape(idum, (/lensfc/) )
423 print*,
"WILL PROCESS NSST RECORDS." 424 ALLOCATE(nsst%C_0(lensfc))
425 ALLOCATE(nsst%C_D(lensfc))
426 ALLOCATE(nsst%D_CONV(lensfc))
427 ALLOCATE(nsst%DT_COOL(lensfc))
428 ALLOCATE(nsst%IFD(lensfc))
429 ALLOCATE(nsst%QRAIN(lensfc))
430 ALLOCATE(nsst%TREF(lensfc))
431 ALLOCATE(nsst%TFINC(lensfc))
432 ALLOCATE(nsst%W_0(lensfc))
433 ALLOCATE(nsst%W_D(lensfc))
434 ALLOCATE(nsst%XS(lensfc))
435 ALLOCATE(nsst%XT(lensfc))
436 ALLOCATE(nsst%XTTS(lensfc))
437 ALLOCATE(nsst%XU(lensfc))
438 ALLOCATE(nsst%XV(lensfc))
439 ALLOCATE(nsst%XZ(lensfc))
440 ALLOCATE(nsst%XZTS(lensfc))
441 ALLOCATE(nsst%Z_C(lensfc))
442 ALLOCATE(nsst%ZM(lensfc))
443 ALLOCATE(slifcs_fg(lensfc))
448 IF (trim(lnd_soi_file) .NE.
"NULL")
THEN 451 print*,
" APPLYING SOIL INCREMENTS FROM THE GSI" 452 ALLOCATE(stc_bck(lensfc, lsoil), smc_bck(lensfc, lsoil), slc_bck(lensfc,lsoil))
453 ALLOCATE(landinc_mask_fg(lensfc))
461 print*,
" APPLYING SNOW INCREMENTS FROM JEDI" 462 ALLOCATE(snd_bck(lensfc), snd_inc(lensfc), swe_bck(lensfc))
465 ALLOCATE(landinc_mask(lensfc))
466 if (ivegsrc == 2)
then 477 CALL read_data(lsoil,lensfc,do_nsst,.false.,is_noahmp=is_noahmp, &
478 tsffcs=tsffcs,smcfcs=smcfcs, &
479 swefcs=swefcs,stcfcs=stcfcs,tg3fcs=tg3fcs,zorfcs=zorfcs, &
480 cvfcs=cvfcs, cvbfcs=cvbfcs,cvtfcs=cvtfcs,albfcs=albfcs, &
481 vegfcs=vegfcs,slifcs=slifcs,cnpfcs=cnpfcs,f10m=f10m , &
482 vetfcs=vetfcs,sotfcs=sotfcs,alffcs=alffcs,ustar=ustar , &
483 fmm=fmm ,fhh=fhh ,sihfcs=sihfcs,sicfcs=sicfcs, &
484 sitfcs=sitfcs,tprcp=tprcp ,srflag=srflag,sndfcs=sndfcs, &
485 vmnfcs=vmnfcs,vmxfcs=vmxfcs,slcfcs=slcfcs,slpfcs=slpfcs, &
486 absfcs=absfcs,t2m=t2m ,q2m=q2m ,slmask=slmask, &
487 zsoil=zsoil, nsst=nsst)
497 print*,
'USE UNFILTERED OROGRAPHY.' 504 IF(nint(slifcs(i)).EQ.2) aisfcs(i) = 1.
508 IF (.NOT. do_sfccycle )
THEN 510 print*,
"FIRST GUESS MASK ADJUSTED BY IFD RECORD" 512 WHERE(nint(nsst%IFD) == 3) slifcs_fg = 2.0
515 print*,
"SAVE FIRST GUESS MASK" 522 CALL calculate_landinc_mask(smcfcs(:,1),swefcs, vetfcs, &
523 lensfc,veg_type_landice, landinc_mask)
533 IF (do_sfccycle)
THEN 534 ALLOCATE(slmaskl(lensfc), slmaskw(lensfc))
537 IF(nint(slmask(i)) == 1)
THEN 538 slmaskl(i) = 1.0_kind_io8
539 slmaskw(i) = 1.0_kind_io8
541 slmaskl(i) = 0.0_kind_io8
542 slmaskw(i) = 0.0_kind_io8
544 if(nint(slmask(i)) == 0)
then 545 min_ice(i) = 0.15_kind_io8
547 min_ice(i) = 0.0_kind_io8
550 num_threads = num_parthds()
552 print*,
"CALL SFCCYCLE TO UPDATE SURFACE FIELDS." 553 CALL sfccycle(lugb,lensfc,lsoil,sig1t,deltsfc, &
554 iy,im,id,ih,fh,rla,rlo, &
555 slmaskl,slmaskw, orog, orog_uf, use_ufo, do_nsst, &
556 sihfcs,sicfcs,sitfcs,sndfcs,slcfcs, &
557 vmnfcs,vmxfcs,slpfcs,absfcs, &
558 tsffcs,swefcs,zorfcs,albfcs,tg3fcs, &
559 cnpfcs,smcfcs,stcfcs,slifcs,aisfcs, &
560 vegfcs,vetfcs,sotfcs,alffcs, &
561 cvfcs,cvbfcs,cvtfcs,myrank,num_threads, nlunit, &
562 sz_nml, input_nml_file, &
564 ialb,isot,ivegsrc,tile_num,i_index,j_index)
565 DEALLOCATE(slmaskl, slmaskw)
575 IF (nst_file ==
"NULL")
THEN 577 print*,
"NO GSI FILE. ADJUST IFD FOR FORMER ICE POINTS." 579 IF (nint(slifcs_fg(i)) == 2 .AND. nint(slifcs(i)) == 0)
THEN 586 print*,
"ADJUST TREF FROM GSI INCREMENT" 590 call get_tf_clm(rla,rlo,jdim,idim,iy,im,id,ih,tf_clm,tf_trd)
591 tf_clm_tile(:) = reshape(tf_clm, (/lensfc/) )
592 tf_trd_tile(:) = reshape(tf_trd, (/lensfc/) )
596 call get_sal_clm(rla,rlo,jdim,idim,iy,im,id,ih,sal_clm)
597 sal_clm_tile(:) = reshape(sal_clm, (/lensfc/) )
601 CALL read_gsi_data(nst_file,
'NST')
605 CALL adjust_nsst(rla,rlo,slifcs,slifcs_fg,tsffcs,sitfcs,sicfcs,stcfcs, &
606 nsst,lensfc,lsoil,idim,jdim,zsea1,zsea2,im,id,deltsfc, &
607 tf_clm_tile,tf_trd_tile,sal_clm_tile)
629 CALL read_data(lsoil,lensfc,.false.,.true.,sndfcs=snd_inc)
639 CALL add_increment_snow(snd_inc,landinc_mask,lensfc,sndfcs)
645 CALL apply_land_da_adjustments_snd(lsm, lensfc, landinc_mask, swe_bck, snd_bck, &
657 landinc_mask_fg = landinc_mask
659 IF (do_sfccycle .OR. do_sno_inc)
THEN 660 CALL calculate_landinc_mask(smcfcs(:,1),swefcs, vetfcs, lensfc, &
661 veg_type_landice, landinc_mask )
668 INQUIRE(file=trim(lnd_soi_file), exist=file_exists)
669 IF (.not. file_exists)
then 670 print *,
'FATAL ERROR: land increment update requested, but file does not exist: ', &
672 call mpi_abort(mpi_comm_world, 10, ierr)
675 CALL read_gsi_data(lnd_soi_file,
'LND', lsoil=lsoil)
691 CALL add_increment_soil(rla,rlo,stcfcs,smcfcs,slcfcs,stc_updated, slc_updated, &
692 landinc_mask,landinc_mask_fg,lensfc,lsoil,idim,jdim,lsm,myrank)
699 CALL apply_land_da_adjustments_soil(lsm, isot, ivegsrc,lensfc, lsoil, &
700 sotfcs, landinc_mask_fg, stc_bck, stcfcs, smcfcs, slcfcs, stc_updated, &
710 IF(
ALLOCATED(landinc_mask_fg))
DEALLOCATE(landinc_mask_fg)
711 IF(
ALLOCATED(landinc_mask))
DEALLOCATE(landinc_mask)
712 IF(
ALLOCATED(stc_bck))
DEALLOCATE(stc_bck)
713 IF(
ALLOCATED(smc_bck))
DEALLOCATE(smc_bck)
714 IF(
ALLOCATED(slc_bck))
DEALLOCATE(slc_bck)
715 IF(
ALLOCATED(snd_bck))
DEALLOCATE(snd_bck)
716 IF(
ALLOCATED(swe_bck))
DEALLOCATE(swe_bck)
717 IF(
ALLOCATED(snd_inc))
DEALLOCATE(snd_inc)
724 IF (lsm==lsm_noahmp)
THEN 726 CALL write_data(lensfc,idim,jdim,lsoil,do_nsst,nsst,vegfcs=vegfcs, &
727 slcfcs=slcfcs,smcfcs=smcfcs,stcfcs=stcfcs)
729 ELSEIF (lsm==lsm_noah)
THEN 731 CALL write_data(lensfc,idim,jdim,lsoil, &
732 do_nsst,nsst,slifcs=slifcs,tsffcs=tsffcs,vegfcs=vegfcs, &
733 swefcs=swefcs,tg3fcs=tg3fcs,zorfcs=zorfcs, &
734 albfcs=albfcs,alffcs=alffcs,cnpfcs=cnpfcs, &
735 f10m=f10m,t2m=t2m,q2m=q2m,vetfcs=vetfcs, &
736 sotfcs=sotfcs,ustar=ustar,fmm=fmm,fhh=fhh, &
737 sicfcs=sicfcs,sihfcs=sihfcs,sitfcs=sitfcs,tprcp=tprcp, &
738 srflag=srflag,swdfcs=sndfcs,vmnfcs=vmnfcs, &
739 vmxfcs=vmxfcs,slpfcs=slpfcs,absfcs=absfcs, &
740 slcfcs=slcfcs,smcfcs=smcfcs,stcfcs=stcfcs)
747 DEALLOCATE(nsst%D_CONV)
748 DEALLOCATE(nsst%DT_COOL)
750 DEALLOCATE(nsst%QRAIN)
751 DEALLOCATE(nsst%TREF)
752 DEALLOCATE(nsst%TFINC)
757 DEALLOCATE(nsst%XTTS)
761 DEALLOCATE(nsst%XZTS)
764 DEALLOCATE(slifcs_fg)
769 END SUBROUTINE sfcdrv
802 SUBROUTINE adjust_nsst(RLA,RLO,SLMSK_TILE,SLMSK_FG_TILE,SKINT_TILE,&
803 SICET_TILE,sice_tile,SOILT_TILE,NSST,LENSFC,LSOIL, &
804 IDIM,JDIM,ZSEA1,ZSEA2,MON,DAY,DELTSFC, &
805 tf_clm_tile,tf_trd_tile,sal_clm_tile)
809 USE read_write_data,
ONLY : idim_gaus, jdim_gaus, &
810 slmsk_gaus, dtref_gaus, &
817 INTEGER,
INTENT(IN) :: LENSFC, LSOIL, IDIM, JDIM, MON, DAY
819 REAL,
INTENT(IN) :: SLMSK_TILE(LENSFC), SLMSK_FG_TILE(LENSFC)
820 real,
intent(in) :: tf_clm_tile(lensfc),tf_trd_tile(lensfc),sal_clm_tile(lensfc)
821 REAL,
INTENT(IN) :: ZSEA1, ZSEA2, DELTSFC
822 REAL,
INTENT(INOUT) :: RLA(LENSFC), RLO(LENSFC), SKINT_TILE(LENSFC)
823 REAL,
INTENT(INOUT) :: SICET_TILE(LENSFC),sice_tile(lensfc),SOILT_TILE(LENSFC,LSOIL)
825 TYPE(NSST_DATA) :: NSST
827 REAL,
PARAMETER :: TMAX=313.0,tzero=273.16
829 INTEGER :: IOPT, NRET, KGDS_GAUS(200)
830 INTEGER :: IGAUS, JGAUS, IJ, II, JJ, III, JJJ, KRAD
831 INTEGER :: ISTART, IEND, JSTART, JEND
832 INTEGER :: MASK_TILE, MASK_FG_TILE
833 INTEGER :: ITILE, JTILE
834 INTEGER :: MAX_SEARCH, J, IERR
835 INTEGER :: IGAUSP1, JGAUSP1
836 integer :: nintp,nsearched,nice,nland
837 integer :: nfill,nfill_tice,nfill_clm
838 integer :: nset_thaw,nset_thaw_s,nset_thaw_i,nset_thaw_c
840 INTEGER,
ALLOCATABLE :: ID1(:,:), ID2(:,:), JDC(:,:)
845 REAL :: TREF_SAVE,WSUM,tf_ice,tf_thaw
846 REAL :: FILL, DTZM, GAUS_RES_KM, DTREF
847 REAL,
ALLOCATABLE :: XPTS(:), YPTS(:), LATS(:), LONS(:)
848 REAL,
ALLOCATABLE :: DUM2D(:,:), LATS_RAD(:), LONS_RAD(:)
849 REAL,
ALLOCATABLE :: AGRID(:,:,:), S2C(:,:,:)
853 kgds_gaus(2) = idim_gaus
854 kgds_gaus(3) = jdim_gaus
858 kgds_gaus(7) = -90000
859 kgds_gaus(8) = nint(-360000./float(idim_gaus))
860 kgds_gaus(9) = nint((360.0 / float(idim_gaus))*1000.0)
862 kgds_gaus(10) = jdim_gaus/2
867 print*,
'ADJUST NSST USING GSI INCREMENTS ON GAUSSIAN GRID' 875 ALLOCATE(xpts(idim_gaus*jdim_gaus))
876 ALLOCATE(ypts(idim_gaus*jdim_gaus))
877 ALLOCATE(lats(idim_gaus*jdim_gaus))
878 ALLOCATE(lons(idim_gaus*jdim_gaus))
884 CALL gdswzd(kgds_gaus,iopt,(idim_gaus*jdim_gaus),fill,xpts,ypts,lons,lats,nret)
886 IF (nret /= (idim_gaus*jdim_gaus))
THEN 887 print*,
'FATAL ERROR: PROBLEM IN GDSWZD. STOP.' 888 CALL mpi_abort(mpi_comm_world, 12, ierr)
891 DEALLOCATE (xpts, ypts)
893 ALLOCATE(dum2d(idim_gaus,jdim_gaus))
894 dum2d = reshape(lats, (/idim_gaus,jdim_gaus/) )
897 ALLOCATE(lats_rad(jdim_gaus))
899 lats_rad(j) = dum2d(1,jdim_gaus-j+1) * 3.1415926 / 180.0
902 dum2d = reshape(lons, (/idim_gaus,jdim_gaus/) )
904 ALLOCATE(lons_rad(idim_gaus))
905 lons_rad = dum2d(:,1) * 3.1415926 / 180.0
909 ALLOCATE(agrid(idim,jdim,2))
910 agrid(:,:,1) = reshape(rlo, (/idim,jdim/) )
911 agrid(:,:,2) = reshape(rla, (/idim,jdim/) )
912 agrid = agrid * 3.1415926 / 180.0
914 ALLOCATE(id1(idim,jdim))
915 ALLOCATE(id2(idim,jdim))
916 ALLOCATE(jdc(idim,jdim))
917 ALLOCATE(s2c(idim,jdim,4))
925 CALL remap_coef( 1, idim, 1, jdim, idim_gaus, jdim_gaus, &
926 lons_rad, lats_rad, id1, id2, jdc, s2c, agrid )
928 DEALLOCATE(lons_rad, lats_rad, agrid)
935 gaus_res_km = 360.0 / idim_gaus * 111.0
936 max_search = ceiling(500.0/gaus_res_km)
939 print*,
'MAXIMUM SEARCH IS ',max_search,
' GAUSSIAN POINTS.' 962 ij_loop :
DO ij = 1, lensfc
964 mask_tile = nint(slmsk_tile(ij))
965 mask_fg_tile = nint(slmsk_fg_tile(ij))
970 tf_ice = tfreez(sal_clm_tile(ij)) + tzero
975 IF (mask_tile == 1)
THEN 983 if (mask_tile == 2)
then 985 skint_tile(ij)=(1.0-sice_tile(ij))*nsst%tref(ij)+sice_tile(ij)*sicet_tile(ij)
993 jtile = (ij-1) / idim + 1
995 IF (itile==0) itile = idim
1003 IF (mask_fg_tile == 2 .AND. mask_tile == 0)
THEN 1007 call tf_thaw_set(nsst%tref,nint(slmsk_fg_tile),itile,jtile,tf_ice,tf_clm_tile(ij),tf_thaw,idim,jdim, &
1008 nset_thaw_s,nset_thaw_i,nset_thaw_c)
1010 nset_thaw = nset_thaw + 1
1026 igaus = id1(itile,jtile)
1027 jgaus = jdc(itile,jtile)
1028 igausp1 = id2(itile,jtile)
1029 jgausp1 = jdc(itile,jtile)+1
1031 IF (slmsk_gaus(igaus,jgaus) == 0 .OR. &
1032 slmsk_gaus(igausp1,jgaus) == 0 .OR. &
1033 slmsk_gaus(igausp1,jgausp1) == 0 .OR. &
1034 slmsk_gaus(igaus,jgausp1) == 0)
THEN 1039 IF (slmsk_gaus(igaus,jgaus) == 0)
THEN 1040 dtref = dtref + (s2c(itile,jtile,1) * dtref_gaus(igaus,jgaus))
1041 wsum = wsum + s2c(itile,jtile,1)
1044 IF (slmsk_gaus(igausp1,jgaus) == 0)
THEN 1045 dtref = dtref + (s2c(itile,jtile,2) * dtref_gaus(igausp1,jgaus))
1046 wsum = wsum + s2c(itile,jtile,2)
1049 IF (slmsk_gaus(igausp1,jgausp1) == 0)
THEN 1050 dtref = dtref + (s2c(itile,jtile,3) * dtref_gaus(igausp1,jgausp1))
1051 wsum = wsum + s2c(itile,jtile,3)
1054 IF (slmsk_gaus(igaus,jgausp1) == 0)
THEN 1055 dtref = dtref + (s2c(itile,jtile,4) * dtref_gaus(igaus,jgausp1))
1056 wsum = wsum + s2c(itile,jtile,4)
1060 dtref = dtref / wsum
1062 tref_save = nsst%TREF(ij)
1063 nsst%TREF(ij) = nsst%TREF(ij) + dtref
1064 nsst%TREF(ij) = max(nsst%TREF(ij), tf_ice)
1065 nsst%TREF(ij) = min(nsst%TREF(ij), tmax)
1066 nsst%TFINC(ij) = nsst%TREF(ij) - tref_save
1068 CALL dtzm_point(nsst%XT(ij),nsst%XZ(ij),nsst%DT_COOL(ij), &
1069 nsst%Z_C(ij),zsea1,zsea2,dtzm)
1071 skint_tile(ij) = nsst%TREF(ij) + dtzm
1072 skint_tile(ij) = max(skint_tile(ij), tf_ice)
1073 skint_tile(ij) = min(skint_tile(ij), tmax)
1075 sicet_tile(ij) = skint_tile(ij)
1076 soilt_tile(ij,:) = skint_tile(ij)
1087 DO krad = 1, max_search
1089 istart = igaus - krad
1091 jstart = jgaus - krad
1094 DO jj = jstart, jend
1095 DO ii = istart, iend
1097 IF((jj == jstart) .OR. (jj == jend) .OR. &
1098 (ii == istart) .OR. (ii == iend))
THEN 1100 IF ((jj >= 1) .AND. (jj <= jdim_gaus))
THEN 1104 iii = idim_gaus + ii
1105 ELSE IF (ii >= (idim_gaus+1))
THEN 1106 iii = ii - idim_gaus
1117 IF (krad <= 2 .AND. slmsk_gaus(iii,jjj) == 2) is_ice = .true.
1119 IF (slmsk_gaus(iii,jjj) == 0)
THEN 1123 nsearched = nsearched + 1
1125 tref_save = nsst%TREF(ij)
1126 nsst%TREF(ij ) = nsst%TREF(ij) + dtref_gaus(iii,jjj)
1127 nsst%TREF(ij) = max(nsst%TREF(ij), tf_ice)
1128 nsst%TREF(ij) = min(nsst%TREF(ij), tmax)
1129 nsst%TFINC(ij) = nsst%TREF(ij) - tref_save
1131 CALL dtzm_point(nsst%XT(ij),nsst%XZ(ij),nsst%DT_COOL(ij), &
1132 nsst%Z_C(ij),zsea1,zsea2,dtzm)
1134 skint_tile(ij) = nsst%TREF(ij) + dtzm
1135 skint_tile(ij) = max(skint_tile(ij), tf_ice)
1136 skint_tile(ij) = min(skint_tile(ij), tmax)
1138 sicet_tile(ij) = skint_tile(ij)
1139 soilt_tile(ij,:) = skint_tile(ij)
1162 nsst%TREF(ij) = tf_ice
1164 nfill_tice = nfill_tice + 1
1166 tref_save = nsst%TREF(ij)
1167 nsst%TREF(ij) = nsst%TREF(ij) + tf_trd_tile(ij)
1168 nsst%TREF(ij) = max(nsst%TREF(ij), tf_ice)
1169 nsst%TREF(ij) = min(nsst%TREF(ij), tmax)
1170 nsst%TFINC(ij) = nsst%TREF(ij) - tref_save
1172 nfill_clm = nfill_clm + 1
1175 CALL dtzm_point(nsst%XT(ij),nsst%XZ(ij),nsst%DT_COOL(ij), &
1176 nsst%Z_C(ij),zsea1,zsea2,dtzm)
1178 skint_tile(ij) = nsst%TREF(ij) + dtzm
1179 skint_tile(ij) = max(skint_tile(ij), tf_ice)
1180 skint_tile(ij) = min(skint_tile(ij), tmax)
1182 sicet_tile(ij) = skint_tile(ij)
1183 soilt_tile(ij,:) = skint_tile(ij)
1189 write(*,
'(a)')
'statistics of grids number processed for tile : ' 1190 write(*,
'(a,I8)')
' nintp = ',nintp
1191 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
1192 write(*,
'(a,I8)')
' nsearched = ',nsearched
1193 write(*,
'(a,3I6)')
' nfill,nfill_tice,nfill_clm = ',nfill,nfill_tice,nfill_clm
1194 write(*,
'(a,I8)')
' nice = ',nice
1195 write(*,
'(a,I8)')
' nland = ',nland
1197 DEALLOCATE(id1, id2, jdc, s2c)
1199 END SUBROUTINE adjust_nsst
1211 SUBROUTINE climo_trend(LATITUDE, MON, DAY, DELTSFC, DTREF)
1214 INTEGER,
INTENT(IN) :: MON, DAY
1216 REAL,
INTENT(IN) :: LATITUDE, DELTSFC
1217 REAL,
INTENT(OUT) :: DTREF
1219 INTEGER :: NUM_DAYS(12), MON2, MON1
1221 REAL,
TARGET :: SST_80_90(12)
1222 REAL,
TARGET :: SST_70_80(12)
1223 REAL,
TARGET :: SST_60_70(12)
1224 REAL,
TARGET :: SST_50_60(12)
1225 REAL,
TARGET :: SST_40_50(12)
1226 REAL,
TARGET :: SST_30_40(12)
1227 REAL,
TARGET :: SST_20_30(12)
1228 REAL,
TARGET :: SST_10_20(12)
1229 REAL,
TARGET :: SST_00_10(12)
1230 REAL,
TARGET :: SST_M10_00(12)
1231 REAL,
TARGET :: SST_M20_M10(12)
1232 REAL,
TARGET :: SST_M30_M20(12)
1233 REAL,
TARGET :: SST_M40_M30(12)
1234 REAL,
TARGET :: SST_M50_M40(12)
1235 REAL,
TARGET :: SST_M60_M50(12)
1236 REAL,
TARGET :: SST_M70_M60(12)
1237 REAL,
TARGET :: SST_M80_M70(12)
1238 REAL,
TARGET :: SST_M90_M80(12)
1240 REAL,
POINTER :: SST(:)
1242 DATA num_days /31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/
1244 DATA sst_80_90 /271.466, 271.458, 271.448, 271.445, 271.519, 271.636, &
1245 272.023, 272.066, 272.001, 271.698, 271.510, 271.472/
1247 DATA sst_70_80 /272.149, 272.103, 272.095, 272.126, 272.360, 272.988, &
1248 274.061, 274.868, 274.415, 273.201, 272.468, 272.268/
1250 DATA sst_60_70 /274.240, 274.019, 273.988, 274.185, 275.104, 276.875, &
1251 279.005, 280.172, 279.396, 277.586, 275.818, 274.803/
1253 DATA sst_50_60 /277.277, 276.935, 277.021, 277.531, 279.100, 281.357, &
1254 283.735, 285.171, 284.399, 282.328, 279.918, 278.199/
1256 DATA sst_40_50 /281.321, 280.721, 280.850, 281.820, 283.958, 286.588, &
1257 289.195, 290.873, 290.014, 287.652, 284.898, 282.735/
1259 DATA sst_30_40 /289.189, 288.519, 288.687, 289.648, 291.547, 293.904, &
1260 296.110, 297.319, 296.816, 295.225, 292.908, 290.743/
1262 DATA sst_20_30 /294.807, 294.348, 294.710, 295.714, 297.224, 298.703, &
1263 299.682, 300.127, 300.099, 299.455, 297.953, 296.177/
1265 DATA sst_10_20 /298.878, 298.720, 299.033, 299.707, 300.431, 300.709, &
1266 300.814, 300.976, 301.174, 301.145, 300.587, 299.694/
1268 DATA sst_00_10 /300.415, 300.548, 300.939, 301.365, 301.505, 301.141, &
1269 300.779, 300.660, 300.818, 300.994, 300.941, 300.675/
1271 DATA sst_m10_00 /300.226, 300.558, 300.914, 301.047, 300.645, 299.870, &
1272 299.114, 298.751, 298.875, 299.294, 299.721, 299.989/
1274 DATA sst_m20_m10 /299.547, 299.985, 300.056, 299.676, 298.841, 297.788, &
1275 296.893, 296.491, 296.687, 297.355, 298.220, 298.964/
1277 DATA sst_m30_m20 /297.524, 298.073, 297.897, 297.088, 295.846, 294.520, &
1278 293.525, 293.087, 293.217, 293.951, 295.047, 296.363/
1280 DATA sst_m40_m30 /293.054, 293.765, 293.468, 292.447, 291.128, 289.781, &
1281 288.773, 288.239, 288.203, 288.794, 289.947, 291.553/
1283 DATA sst_m50_m40 /285.052, 285.599, 285.426, 284.681, 283.761, 282.826, &
1284 282.138, 281.730, 281.659, 281.965, 282.768, 283.961/
1286 DATA sst_m60_m50 /277.818, 278.174, 277.991, 277.455, 276.824, 276.229, &
1287 275.817, 275.585, 275.560, 275.687, 276.142, 276.968/
1289 DATA sst_m70_m60 /273.436, 273.793, 273.451, 272.813, 272.349, 272.048, &
1290 271.901, 271.838, 271.845, 271.889, 272.080, 272.607/
1292 DATA sst_m80_m70 /271.579, 271.578, 271.471, 271.407, 271.392, 271.391, &
1293 271.390, 271.391, 271.394, 271.401, 271.422, 271.486/
1295 DATA sst_m90_m80 /271.350, 271.350, 271.350, 271.350, 271.350, 271.350, &
1296 271.350, 271.350, 271.350, 271.350, 271.350, 271.350/
1299 IF (latitude > 80.0)
THEN 1301 ELSEIF (latitude > 70.0)
THEN 1303 ELSEIF (latitude > 60.0)
THEN 1305 ELSEIF (latitude > 50.0)
THEN 1307 ELSEIF (latitude > 40.0)
THEN 1309 ELSEIF (latitude > 30.0)
THEN 1311 ELSEIF (latitude > 20.0)
THEN 1313 ELSEIF (latitude > 10.0)
THEN 1315 ELSEIF (latitude > 0.0)
THEN 1317 ELSEIF (latitude > -10.0)
THEN 1319 ELSEIF (latitude > -20.0)
THEN 1321 ELSEIF (latitude > -30.0)
THEN 1323 ELSEIF (latitude > -40.0)
THEN 1325 ELSEIF (latitude > -50.0)
THEN 1327 ELSEIF (latitude > -60.0)
THEN 1329 ELSEIF (latitude > -70.0)
THEN 1331 ELSEIF (latitude > -80.0)
THEN 1339 IF(mon2 == 13) mon2 = 1
1341 dtref = (sst(mon2) - sst(mon1)) / num_days(mon1)
1344 IF (mon1 == 0) mon1=12
1346 dtref = (sst(mon2) - sst(mon1)) / num_days(mon1)
1349 dtref = dtref * (deltsfc / 24.0)
1351 END SUBROUTINE climo_trend
1364 SUBROUTINE dtzm_point(XT,XZ,DT_COOL,ZC,Z1,Z2,DTZM)
1367 real,
intent(in) :: xt,xz,dt_cool,zc,z1,z2
1368 real,
intent(out) :: dtzm
1370 real,
parameter :: zero = 0.0
1371 real,
parameter :: one = 1.0
1372 real,
parameter :: half = 0.5
1373 real :: dt_warm,dtw,dtc
1378 if ( xt > zero )
then 1379 dt_warm = (xt+xt)/xz
1382 dtw = dt_warm*(one-(z1+z2)/(xz+xz))
1383 elseif ( z1 < xz .and. z2 >= xz )
then 1384 dtw = half*(one-z1/xz)*dt_warm*(xz-z1)/(z2-z1)
1386 elseif ( z1 == z2 )
then 1388 dtw = dt_warm*(one-z1/xz)
1396 if ( zc > zero )
then 1399 dtc = dt_cool*(one-(z1+z2)/(zc+zc))
1400 elseif ( z1 < zc .and. z2 >= zc )
then 1401 dtc = half*(one-z1/zc)*dt_cool*(zc-z1)/(z2-z1)
1403 elseif ( z1 == z2 )
then 1405 dtc = dt_cool*(one-z1/zc)
1415 END SUBROUTINE dtzm_point
1436 subroutine tf_thaw_set(tf_ij,mask_ij,itile,jtile,tice,tclm,tf_thaw,nx,ny, &
1437 nset_thaw_s,nset_thaw_i,nset_thaw_c)
1439 real,
dimension(nx*ny),
intent(in) :: tf_ij
1440 integer,
dimension(nx*ny),
intent(in) :: mask_ij
1441 real,
intent(in) :: tice,tclm
1442 integer,
intent(in) :: itile,jtile,nx,ny
1443 real,
intent(out) :: tf_thaw
1444 integer,
intent(inout) :: nset_thaw_s,nset_thaw_i,nset_thaw_c
1446 real,
parameter :: bmiss = -999.0
1447 real,
dimension(nx,ny) :: tf
1448 integer,
dimension(nx,ny) :: mask
1449 integer :: krad,max_search,istart,iend,jstart,jend
1450 integer :: ii,jj,iii,jjj
1455 mask(:,:) = reshape(mask_ij,(/nx,ny/) )
1456 tf(:,:) = reshape(tf_ij,(/nx,ny/) )
1460 do krad = 1, max_search
1462 istart = itile - krad
1464 jstart = jtile - krad
1467 do jj = jstart, jend
1468 do ii = istart, iend
1471 if ((jj == jstart) .or. (jj == jend) .or. &
1472 (ii == istart) .or. (ii == iend))
then 1474 if ((jj >= 1) .and. (jj <= ny))
then 1478 else if (ii >= (nx+1))
then 1489 if (krad <= 2 .and. mask(iii,jjj) == 2) is_ice = .true.
1491 if (mask(iii,jjj) == 0)
then 1492 tf_thaw = tf(iii,jjj)
1493 nset_thaw_s = nset_thaw_s + 1
1494 write(*,
'(a,I4,2F9.3)')
'nset_thaw_s,tf(iii,jjj),tclm : ',nset_thaw_s,tf(iii,jjj),tclm
1506 if ( tf_thaw == bmiss )
then 1509 nset_thaw_i = nset_thaw_i + 1
1510 write(*,
'(a,I4,F9.3)')
'nset_thaw_i,tf_ice : ',nset_thaw_i,tice
1512 tf_thaw = 0.8*tice+0.2*tclm
1513 nset_thaw_c = nset_thaw_c + 1
1514 write(*,
'(a,I4,2F9.3)')
'nset_thaw_c,tf_ice,tclm : ',nset_thaw_c,tice,tclm
1528 use read_write_data,
only : nsst_data
1531 integer,
intent(in) :: ij
1533 real,
intent(in) :: tf_thaw
1535 type(nsst_data),
intent(inout) :: nsst
1539 nsst%d_conv(ij) = 0.0
1540 nsst%dt_cool(ij) = 0.0
1542 nsst%qrain(ij) = 0.0
1543 nsst%tref(ij) = tf_thaw
1573 subroutine get_tf_clm(xlats_ij,xlons_ij,ny,nx,iy,im,id,ih,tf_clm,tf_trd)
1574 use read_write_data,
only : get_tf_clm_dim
1578 real,
dimension(nx*ny),
intent(in) :: xlats_ij
1579 real,
dimension(nx*ny),
intent(in) :: xlons_ij
1580 real,
dimension(nx,ny),
intent(out) :: tf_clm
1581 real,
dimension(nx,ny),
intent(out) :: tf_trd
1582 integer,
intent(in) :: iy,im,id,ih,nx,ny
1584 real,
allocatable,
dimension(:,:) :: tf_clm0
1585 real,
allocatable,
dimension(:,:) :: tf_trd0
1586 real,
allocatable,
dimension(:) :: cxlats
1587 real,
allocatable,
dimension(:) :: cxlons
1589 real,
dimension(nx*ny) :: tf_clm_ij
1590 real,
dimension(nx*ny) :: tf_trd_ij
1592 integer :: nxc,nyc,mon1,mon2,i,j
1593 character (len=6),
parameter :: fin_tf_clm=
'sstclm' 1601 call get_tf_clm_dim(fin_tf_clm,nyc,nxc)
1602 allocate( tf_clm0(nxc,nyc),tf_trd0(nxc,nyc),cxlats(nyc),cxlons(nxc) )
1606 call get_tf_clm_ta(tf_clm0,tf_trd0,cxlats,cxlons,nyc,nxc,mon1,mon2,wei1,wei2)
1610 if ( nx == nxc .and. ny == nyc )
then 1611 tf_clm(:,:) = tf_clm0(:,:)
1612 tf_trd(:,:) = tf_trd0(:,:)
1616 call intp_tile(tf_clm0, cxlats, cxlons, nyc, nxc, &
1617 tf_clm_ij,xlats_ij,xlons_ij,ny, nx)
1618 call intp_tile(tf_trd0, cxlats, cxlons, nyc, nxc, &
1619 tf_trd_ij,xlats_ij,xlons_ij,ny, nx)
1622 tf_clm(:,:) = reshape(tf_clm_ij, (/nx,ny/) )
1623 tf_trd(:,:) = reshape(tf_trd_ij, (/nx,ny/) )
1642 subroutine get_tf_clm_ta(tf_clm_ta,tf_clm_trend,xlats,xlons,nlat,nlon,mon1,mon2,wei1,wei2)
1643 use read_write_data,
only : read_tf_clim_grb
1647 integer,
intent(in) :: nlat,nlon,mon1,mon2
1648 real,
intent(in) :: wei1,wei2
1650 real,
dimension(nlon,nlat),
intent(out) :: tf_clm_ta,tf_clm_trend
1651 real,
dimension(nlat),
intent(out) :: xlats
1652 real,
dimension(nlon),
intent(out) :: xlons
1655 character (len=6),
parameter :: fin_tf_clm=
'sstclm' 1658 real,
dimension(nlon,nlat) :: tf_clm1,tf_clm2
1663 call read_tf_clim_grb(trim(fin_tf_clm),tf_clm1,xlats,xlons,nlat,nlon,mon1)
1664 call read_tf_clim_grb(trim(fin_tf_clm),tf_clm2,xlats,xlons,nlat,nlon,mon2)
1668 tf_clm_ta(:,:) = wei1*tf_clm1(:,:)+wei2*tf_clm2(:,:)
1672 tf_clm_trend(:,:) = (tf_clm2(:,:)-tf_clm1(:,:))/120.0
1674 write(*,
'(a,2f9.3)')
'tf_clm_ta, min, max : ',minval(tf_clm_ta),maxval(tf_clm_ta)
1675 write(*,
'(a,2f9.3)')
'tf_clm_trend, min, max : ',minval(tf_clm_trend),maxval(tf_clm_trend)
1690 subroutine get_sal_clm(xlats_ij,xlons_ij,ny,nx,iy,im,id,ih,sal_clm)
1691 use read_write_data,
only : get_dim_nc
1694 real,
dimension(nx*ny),
intent(in) :: xlats_ij
1695 real,
dimension(nx*ny),
intent(in) :: xlons_ij
1696 real,
dimension(nx,ny),
intent(out) :: sal_clm
1697 integer,
intent(in) :: iy,im,id,ih,nx,ny
1699 real,
allocatable,
dimension(:,:) :: sal_clm0
1700 real,
allocatable,
dimension(:) :: cxlats
1701 real,
allocatable,
dimension(:) :: cxlons
1703 real,
dimension(nx*ny) :: sal_clm_ij
1705 integer :: nxc,nyc,mon1,mon2,i,j
1706 character (len=6),
parameter :: fin_sal_clm=
'salclm' 1714 call get_dim_nc(fin_sal_clm,nyc,nxc)
1715 allocate( sal_clm0(nxc,nyc),cxlats(nyc),cxlons(nxc) )
1719 call get_sal_clm_ta(sal_clm0,cxlats,cxlons,nyc,nxc,mon1,mon2,wei1,wei2)
1723 if ( nx == nxc .and. ny == nyc )
then 1724 sal_clm(:,:) = sal_clm0(:,:)
1728 call intp_tile(sal_clm0, cxlats, cxlons, nyc, nxc, &
1729 sal_clm_ij,xlats_ij,xlons_ij,ny, nx)
1733 sal_clm(:,:) = reshape(sal_clm_ij, (/nx,ny/) )
1750 subroutine get_sal_clm_ta(sal_clm_ta,xlats,xlons,nlat,nlon,mon1,mon2,wei1,wei2)
1752 use read_write_data,
only : read_salclm_gfs_nc
1756 integer,
intent(in) :: nlat,nlon,mon1,mon2
1757 real,
intent(in) :: wei1,wei2
1759 real,
dimension(nlon,nlat),
intent(out) :: sal_clm_ta
1760 real,
dimension(nlat),
intent(out) :: xlats
1761 real,
dimension(nlon),
intent(out) :: xlons
1764 character (len=6),
parameter :: fin_sal_clm=
'salclm' 1767 real,
dimension(nlon,nlat) :: sal_clm1,sal_clm2
1772 call read_salclm_gfs_nc(trim(fin_sal_clm),sal_clm1,xlats,xlons,nlat,nlon,mon1)
1773 call read_salclm_gfs_nc(trim(fin_sal_clm),sal_clm2,xlats,xlons,nlat,nlon,mon2)
1777 sal_clm_ta(:,:) = wei1*sal_clm1(:,:)+wei2*sal_clm2(:,:)
1778 write(*,
'(a,2f9.3)')
'sal_clm_ta, min, max : ',minval(sal_clm_ta),maxval(sal_clm_ta)
1795 subroutine intp_tile(tf_lalo,dlats_lalo,dlons_lalo,jdim_lalo,idim_lalo, &
1796 tf_tile,xlats_tile,xlons_tile,jdim_tile,idim_tile)
1803 real,
dimension(idim_lalo,jdim_lalo),
intent(in) :: tf_lalo
1804 real,
dimension(jdim_lalo),
intent(in) :: dlats_lalo
1805 real,
dimension(idim_lalo),
intent(in) :: dlons_lalo
1806 real,
dimension(jdim_tile*idim_tile),
intent(in) :: xlats_tile
1807 real,
dimension(jdim_tile*idim_tile),
intent(in) :: xlons_tile
1808 integer,
intent(in) :: jdim_lalo,idim_lalo,jdim_tile,idim_tile
1809 real,
dimension(jdim_tile*idim_tile),
intent(out) :: tf_tile
1812 real,
parameter :: deg2rad=3.1415926/180.0
1813 real,
dimension(jdim_lalo) :: xlats_lalo
1814 real,
dimension(idim_lalo) :: xlons_lalo
1815 real :: tf,wsum,res_km
1816 integer :: itile,jtile
1817 integer :: ii,jj,ij,iii,jjj
1818 integer :: ilalo,jlalo,ilalop1,jlalop1
1819 integer :: istart,iend,jstart,jend,krad
1821 integer,
allocatable,
dimension(:,:) :: id1,id2,jdc
1822 real,
allocatable,
dimension(:,:,:) :: agrid,s2c
1825 print*,
'interpolate from lat/lon grids to any one grid with known lat/lon' 1827 xlats_lalo = dlats_lalo*deg2rad
1828 xlons_lalo = dlons_lalo*deg2rad
1830 allocate(agrid(idim_tile,jdim_tile,2))
1831 agrid(:,:,1) = reshape(xlons_tile, (/idim_tile,jdim_tile/) )
1832 agrid(:,:,2) = reshape(xlats_tile, (/idim_tile,jdim_tile/) )
1833 agrid = agrid*deg2rad
1835 allocate(id1(idim_tile,jdim_tile))
1836 allocate(id2(idim_tile,jdim_tile))
1837 allocate(jdc(idim_tile,jdim_tile))
1838 allocate(s2c(idim_tile,jdim_tile,4))
1846 call remap_coef( 1, idim_tile, 1, jdim_tile, idim_lalo, jdim_lalo, &
1847 xlons_lalo, xlats_lalo, id1, id2, jdc, s2c, agrid )
1849 do ij = 1, jdim_tile*idim_tile
1851 jtile = (ij-1)/idim_tile + 1
1852 itile = mod(ij,idim_tile)
1853 if (itile==0) itile = idim_tile
1855 ilalo = id1(itile,jtile)
1856 ilalop1 = id2(itile,jtile)
1857 jlalo = jdc(itile,jtile)
1858 jlalop1 = jdc(itile,jtile) + 1
1860 wsum = s2c(itile,jtile,1) + s2c(itile,jtile,2) + &
1861 s2c(itile,jtile,3) + s2c(itile,jtile,4)
1863 tf_tile(ij) = ( s2c(itile,jtile,1)*tf_lalo(ilalo,jlalo) + &
1864 s2c(itile,jtile,2)*tf_lalo(ilalop1,jlalo) + &
1865 s2c(itile,jtile,3)*tf_lalo(ilalop1,jlalop1) + &
1866 s2c(itile,jtile,4)*tf_lalo(ilalo,jlalop1) )/wsum
1869 deallocate(id1, id2, jdc, s2c)
1885 subroutine get_tim_wei(iy,im,id,ih,mon1,mon2,wei1,wei2)
1889 integer,
intent(in) :: iy,im,id,ih
1891 integer,
intent(out) :: mon1,mon2
1892 real,
intent(out) :: wei1,wei2
1896 integer :: mon,monend,monm,monp,jdow,jdoy,jday
1901 real,
dimension(13) :: dayhf
1902 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/
1915 call w3doxdat(jda,jdow,jdoy,jday)
1916 rjday=jdoy+jda(5)/24.
1917 if(rjday.lt.dayhf(1)) rjday=rjday+365.
1923 if( rjday >= dayhf(monm) .and. rjday < dayhf(monp) )
then 1930 print *,
'FATAL ERROR in get_tim_wei, wrong rjday',rjday
1934 wei1 = (dayhf(mon2)-rjday)/(dayhf(mon2)-dayhf(mon1))
1935 wei2 = (rjday-dayhf(mon1))/(dayhf(mon2)-dayhf(mon1))
1937 if( mon2 == 13 ) mon2=1
1939 write(*,
'(a,2i4,3f9.3)')
'mon1,mon2,rjday,wei1,wei2=',mon1,mon2,rjday,wei1,wei2
1952 real function tfreez(salinity)
1958 parameter(a1 = -0.0575)
1959 parameter(a2 = 1.710523e-3)
1960 parameter(a3 = -2.154996e-4)
1962 IF (salinity .LT. 0.)
THEN 1967 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.