! JESSE 20130711 IGBP STASGO ! JESSE 20070501 ADD FORCING ZLEV, Z0, CH, T1 ! JESSE 20050406 FIX SNCOVR, ALBEDO ! JESSE 20050523 FIX ICE !------------------------------------------------------------------------- ! NASA GSFC Land Information Systems LIS 2.3 ! !------------------------------------------------------------------------- !BOP ! ! !ROUTINE: noah_main.F90 ! ! NOAH LAND-SURFACE MODEL, UNCOUPLED 1-D COLUMN: VERSION 2.5 OCT 2001 ! ! THIS MAIN PROGRAM AND ITS FAMILY OF SUBROUTINES COMPRISE VERSION 2.5 ! OF THE PUBLIC RELEASE OF THE UNCOUPLED 1-D COLUMN VERSION OF THE ! "NOAH" LAND-SURFACE MODEL (LSM). THE NOAH LSM IS A DESCENDANT OF AN ! EARLIER GENERATION OF THE OREGON STATE UNIVERSITY (OSU) LSM, BUT IT ! INCLUDES SUBSTANTIAL PHYSICS EXTENSIONS AND RECODING ACCOMPLISHED ! ALONG THE WAY BY NCEP, HL (NWS), AFGWC, AND AFGL/AFPL/AFRL. HENCE ! THE ACRONYM "NOAH" DENOTES N-NCEP, O-OSU, A-AIR FORCE, H-HYDRO LAB. ! ---------------------------------------------------------------------- ! FOR DOCUMENTATION OF THIS CODE AND INSTRUCTIONS ON ITS EXECUTION AND ! INPUT/OUTPUT FILES, SEE "NOAH LSM USERS GUIDE" IN FILE README$_-$2.5 ! IN THE SAME PUBLIC SERVER DIRECTORY AS THIS SOURCE CODE. ! ---------------------------------------------------------------------- ! PROGRAM HISTORY LOG ! VERSION 1.0 -- 01 MAR 1999\\ ! VERSION 1.1 -- 08 MAR 1999\\ ! VERSION 2.0 -- 27 JUL 1999\\ ! VERSION 2.1 -- 23 OCT 2000\\ ! VERSION 2.2 -- 07 FEB 2001\\ ! VERSION 2.3 -- 07 MAY 2001 = operational Eta implementation\\ ! VERSION 2.4 -- 27 JUN 2001 = ops Eta with NO physics changes\\ ! VERSION 2.5 -- 18 OCT 2001\\ ! LDAS VERSION -- 28 APR 2002 = NOAH Main added to LDAS Driver\\ ! (NASA GSFC)\\ ! VERSION 2.5.1-- 28 MAY 2002 = Updated changes in NOAH LSM along\\ ! with correction to SOILRZ and SOIL1M.\\ ! VERSION 2.6 -- 24 JUN 2003 = Updated to Noah LSM v2.6 \\ ! ! Physics changes:\\ ! in SUBROUTINE SFLX change CSOIL from 1.26E+6 to 2.00E+6\\ ! in SUBROUTINE SFLX change ZBOT from -3.0 to -8.0\\ ! Replaced de-bugged SUBROUTINE TDFCND\\ ! Removed SUBROUTINE REDPRM and moved the parameters to other\\ ! locations throughout noah$_-$main and noah$_-$physics subroutines.\\ ! VERSION 2.5.2 -- 31 MAY 2002\\ ! Fix in FUNCTION DEVAP related to FX calculation\\ ! VERSION 2.6 -- Includes changes to certain parameters and\\ ! snow-soil physics\\ ! revised for noahmp by Youlong Xia, 17 June 2019 ! !INTERFACE: subroutine noah_main() ! !USES: use lisdrv_module, only : lis, grid use noah_varder ! NOAH tile variables use tile_spmdMod use kwm_date_utilities !EOP implicit none integer, parameter :: c1=0 !NO PRINT ! integer, parameter :: c1=5600 ! PRINT ! integer, parameter :: c1=488216 ! PRINT ! -------------------------------------------------------------------- ! INPUT VARIAVLES ! ----------basic integers for soil layer and time -------------------- integer:: im ! number of x direction grids integer:: km ! numbers of soil layers (4) integer:: itime ! timestep loop integer:: imon ! ith month real:: djul ! Julian day of the year integer:: yearlen ! lengh of the year (365 for normal yr, 366 for leap yr) ! ----------- paramters for various model options ---------------------- integer:: idveg ! Dynamic vegeation(=2) integer:: iopt_crs ! Ball-berry canopy stomatal resistence(=1) integer:: iopt_btr ! Soil moisture factor for stomatal resistance(=1) integer:: iopt_run ! Topmodel with ground water(=1) integer:: iopt_sfc ! M-O surace coefficient (=1) integer:: iopt_frz ! No interation for supercooled liquid water(=1) integer:: iopt_inf ! Linear soil permeability(=1) integer:: iopt_rad ! Two-stream radiation transfer gap(=1) integer:: iopt_alb ! CLASS for ground snow surface albedo(=2) integer:: iopt_snf ! t1 .... ! ! Return a value valid for the day given in , as an interpolation from the 12 ! monthly values. ! use kwm_date_utilities implicit none real, dimension(12), intent(in) :: a12 ! 12 monthly values, taken to be valid on the 15th of ! ! the month character(len=12), intent(in) :: nowdate ! Date, in the form integer :: nowy, nowm, nowd integer :: prevm, postm real :: factor integer, dimension(12) :: ndays = (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /) ! ! Handle leap year by setting the number of days in February for the year in question. ! read(nowdate(1:8),'(I4,I2,I2)') nowy, nowm, nowd ndays(2) = nfeb(nowy) ! ! Do interpolation between the fifteenth of two successive months. ! if (nowd == 15) then nowval = a12(nowm) return else if (nowd < 15) then postm = nowm prevm = nowm - 1 if (prevm == 0) prevm = 12 factor = real(ndays(prevm)-15+nowd)/real(ndays(prevm)) else if (nowd > 15) then prevm = nowm postm = nowm + 1 if (postm == 13) postm = 1 factor = real(nowd-15)/real(ndays(prevm)) endif nowval = a12(prevm)*(1.0-factor) + a12(postm)*factor end function month_d SUBROUTINE calc_declin (nowdate, latitude, longitude, cosz, yearlen, julian) use kwm_date_utilities !--------------------------------------------------------------------- IMPLICIT NONE !--------------------------------------------------------------------- REAL, PARAMETER :: DEGRAD = 3.14159265/180. REAL, PARAMETER :: DPD = 360./365. ! !ARGUMENTS: character(len=19), intent(in) :: nowdate ! YYYY-MM-DD_HH:mm:ss real, intent(in) :: latitude real, intent(in) :: longitude real, intent(out) :: cosz integer, intent(out) :: yearlen real, intent(out) :: JULIAN REAL :: hrang real :: DECLIN real :: tloctim REAL :: OBECL REAL :: SINOB REAL :: SXLONG REAL :: ARG integer :: iyear integer :: iday integer :: ihour integer :: iminute integer :: isecond ! ! Determine the number of days in the year ! read(nowdate(1:4), '(I4)') iyear yearlen = 365 if (mod(iyear,4) == 0) then yearlen = 366 if (mod(iyear,100) == 0) then yearlen = 365 if (mod(iyear,400) == 0) then yearlen = 366 if (mod(iyear,3600) == 0) then yearlen = 365 endif endif endif endif ! ! Determine the Julian time (floating-point day of year). ! call geth_idts(nowdate(1:10), nowdate(1:4)//"-01-01", iday) read(nowdate(12:13), *) ihour read(nowdate(15:16), *) iminute read(nowdate(18:19), *) isecond julian = real(iday) + real(ihour)/24. ! ! for short wave radiation DECLIN=0. !-----OBECL : OBLIQUITY = 23.5 DEGREE. OBECL=23.5*DEGRAD SINOB=SIN(OBECL) !-----CALCULATE LONGITUDE OF THE SUN FROM VERNAL EQUINOX: IF(JULIAN.GE.80.)SXLONG=DPD*(JULIAN-80.)*DEGRAD IF(JULIAN.LT.80.)SXLONG=DPD*(JULIAN+285.)*DEGRAD ARG=SINOB*SIN(SXLONG) DECLIN=ASIN(ARG) TLOCTIM = REAL(IHOUR) + REAL(IMINUTE)/60.0 + REAL(ISECOND)/3600.0 + LONGITUDE/15.0 ! Local time in hours tloctim = AMOD(tloctim+24.0, 24.0) HRANG=15.*(TLOCTIM-12.)*DEGRAD COSZ=SIN(LATITUDE*DEGRAD)*SIN(DECLIN)+COS(LATITUDE*DEGRAD)*COS(DECLIN)*COS(HRANG) COSZ=MIN(COSZ,1.0); !Added by kwH 3/1/16 to address floating point roundoff errors COSZ=MAX(COSZ,-1.0); ! !KWM write(wrf_err_message,10)DECDEG/DEGRAD !KWM10 FORMAT(1X,'*** SOLAR DECLINATION ANGLE = ',F6.2,' DEGREES.',' ***') !KWM CALL wrf_debug (50, wrf_err_message) END SUBROUTINE calc_declin