diff --git a/parallel/scripts/run-nacc-fv3.ksh b/parallel/scripts/run-nacc-fv3.ksh index 954d303..7a53abe 100755 --- a/parallel/scripts/run-nacc-fv3.ksh +++ b/parallel/scripts/run-nacc-fv3.ksh @@ -22,9 +22,9 @@ NTIMES=73 export NODES=12 APPL=aqm.t12z -InMetDir=/gpfs/hps2/ptmp/$USER/fv3gfs_v16_test/12z_hourly +InMetDir=/gpfs/hps2/ptmp/$USER/NACC-Fengsha-Test InGeoDir=$InMetDir -OutDir=/gpfs/hps2/ptmp/$USER/fv3gfs_v16_test/output +OutDir=/gpfs/hps2/ptmp/$USER/NACC-Fengsha-Test/output_nofengsha ProgDir=/gpfs/hps3/emc/naqfc/noscrub/Patrick.C.Campbell/NACC/parallel/src if [ ! -s $InMetDir ]; then @@ -70,8 +70,8 @@ cat>namelist.mcip< fld2dxyt(27) c_seaice => fld2dxyt(28) c_snowh => fld2dxyt(29) + c_clayf => fld2dxyt(30) + c_sandf => fld2dxyt(31) + c_drag => fld2dxyt(32) + c_ssm => fld2dxyt(33) + c_uthr => fld2dxyt(34) IF ( ifwr ) THEN - c_wr => fld2dxyt(29+nwr) + c_wr => fld2dxyt(34+nwr) ENDIF IF ( ifsoil ) THEN - c_soim1 => fld2dxyt(29+nwr+1) - c_soim2 => fld2dxyt(29+nwr+2) - c_soit1 => fld2dxyt(29+nwr+3) - c_soit2 => fld2dxyt(29+nwr+4) - c_sltyp => fld2dxyt(29+nwr+5) + c_soim1 => fld2dxyt(34+nwr+1) + c_soim2 => fld2dxyt(34+nwr+2) + c_soit1 => fld2dxyt(34+nwr+3) + c_soit2 => fld2dxyt(34+nwr+4) + c_sltyp => fld2dxyt(34+nwr+5) ENDIF IF ( ifpxwrf41 ) THEN - c_wsat_px => fld2dxyt(29+nwr+nsoil2d+1) - c_wfc_px => fld2dxyt(29+nwr+nsoil2d+2) - c_wwlt_px => fld2dxyt(29+nwr+nsoil2d+3) - c_csand_px => fld2dxyt(29+nwr+nsoil2d+4) - c_fmsand_px => fld2dxyt(29+nwr+nsoil2d+5) - c_clay_px => fld2dxyt(29+nwr+nsoil2d+6) + c_wsat_px => fld2dxyt(34+nwr+nsoil2d+1) + c_wfc_px => fld2dxyt(34+nwr+nsoil2d+2) + c_wwlt_px => fld2dxyt(34+nwr+nsoil2d+3) + c_csand_px => fld2dxyt(34+nwr+nsoil2d+4) + c_fmsand_px => fld2dxyt(34+nwr+nsoil2d+5) + c_clay_px => fld2dxyt(34+nwr+nsoil2d+6) ENDIF !------------------------------------------------------------------------------- diff --git a/parallel/src/alloc_met.f90 b/parallel/src/alloc_met.f90 index 3f93377..0b1897c 100644 --- a/parallel/src/alloc_met.f90 +++ b/parallel/src/alloc_met.f90 @@ -206,6 +206,26 @@ SUBROUTINE alloc_met ALLOCATE ( lai (ix, jy) ) ENDIF + IF ( ifclayf ) THEN ! clay fraction available + ALLOCATE ( clayf (met_nx, met_ny) ) + ENDIF + + IF ( ifsandf ) THEN ! sand fraction available + ALLOCATE ( sandf (met_nx, met_ny) ) + ENDIF + + IF ( ifdrag ) THEN ! drag paritiion available + ALLOCATE ( drag (met_nx, met_ny) ) + ENDIF + + IF ( ifssm ) THEN ! sediment supply map available + ALLOCATE ( ssm (met_nx, met_ny) ) + ENDIF + + IF ( ifuthr ) THEN ! threshold velocity available + ALLOCATE ( uthr (met_nx, met_ny) ) + ENDIF + IF ( ifmol ) THEN ! Monin-Obukhov length available ALLOCATE ( mol (ix, jy) ) ENDIF diff --git a/parallel/src/alloc_x.f90 b/parallel/src/alloc_x.f90 index c60fd90..09f6ba9 100644 --- a/parallel/src/alloc_x.f90 +++ b/parallel/src/alloc_x.f90 @@ -164,6 +164,11 @@ SUBROUTINE alloc_x ALLOCATE ( xrgrnd (ncols_x, nrows_x) ) ALLOCATE ( xwr (ncols_x, nrows_x) ) ALLOCATE ( xlai (ncols_x, nrows_x) ) + ALLOCATE ( xclayf (ncols_x, nrows_x) ) + ALLOCATE ( xsandf (ncols_x, nrows_x) ) + ALLOCATE ( xdrag (ncols_x, nrows_x) ) + ALLOCATE ( xssm (ncols_x, nrows_x) ) + ALLOCATE ( xuthr (ncols_x, nrows_x) ) ALLOCATE ( xveg (ncols_x, nrows_x) ) ALLOCATE ( xwstar (ncols_x, nrows_x) ) diff --git a/parallel/src/ctmproc.f90 b/parallel/src/ctmproc.f90 index 60c39f5..9116554 100644 --- a/parallel/src/ctmproc.f90 +++ b/parallel/src/ctmproc.f90 @@ -323,6 +323,11 @@ END SUBROUTINE collapx c_snocov%fld(col,row) = xsnocov(c,r) c_veg%fld(col,row) = xveg(c,r) c_lai%fld(col,row) = xlai(c,r) + c_clayf%fld(col,row) = xclayf(c,r) + c_sandf%fld(col,row) = xsandf(c,r) + c_drag%fld(col,row) = xdrag(c,r) + c_ssm%fld(col,row) = xssm(c,r) + c_uthr%fld(col,row) = xuthr(c,r) c_seaice%fld(col,row) = xseaice(c,r) c_snowh%fld(col,row) = xsnowh(c,r) diff --git a/parallel/src/ctmvars_mod.f90 b/parallel/src/ctmvars_mod.f90 index b98638d..983bb5f 100644 --- a/parallel/src/ctmvars_mod.f90 +++ b/parallel/src/ctmvars_mod.f90 @@ -137,6 +137,11 @@ MODULE ctmvars TYPE(fld2ddata), POINTER :: c_snocov TYPE(fld2ddata), POINTER :: c_veg TYPE(fld2ddata), POINTER :: c_lai + TYPE(fld2ddata), POINTER :: c_clayf + TYPE(fld2ddata), POINTER :: c_sandf + TYPE(fld2ddata), POINTER :: c_drag + TYPE(fld2ddata), POINTER :: c_ssm + TYPE(fld2ddata), POINTER :: c_uthr TYPE(fld2ddata), POINTER :: c_seaice TYPE(fld2ddata), POINTER :: c_snowh TYPE(fld2ddata), POINTER :: c_wr diff --git a/parallel/src/dealloc_ctm.f90 b/parallel/src/dealloc_ctm.f90 index 4307332..96d16ad 100644 --- a/parallel/src/dealloc_ctm.f90 +++ b/parallel/src/dealloc_ctm.f90 @@ -173,6 +173,12 @@ SUBROUTINE dealloc_ctm NULLIFY ( c_lai ) NULLIFY ( c_seaice ) NULLIFY ( c_snowh ) + NULLIFY ( c_clayf ) + NULLIFY ( c_sandf ) + NULLIFY ( c_drag ) + NULLIFY ( c_ssm ) + NULLIFY ( c_uthr ) + IF ( ASSOCIATED ( c_wr ) ) NULLIFY ( c_wr ) IF ( ASSOCIATED ( c_soim1 ) ) NULLIFY ( c_soim1 ) IF ( ASSOCIATED ( c_soim2 ) ) NULLIFY ( c_soim2 ) diff --git a/parallel/src/dealloc_met.f90 b/parallel/src/dealloc_met.f90 index c756cfb..ad4bb2f 100644 --- a/parallel/src/dealloc_met.f90 +++ b/parallel/src/dealloc_met.f90 @@ -151,6 +151,11 @@ SUBROUTINE dealloc_met IF ( ALLOCATED ( isltyp ) ) DEALLOCATE ( isltyp ) IF ( ALLOCATED ( lai ) ) DEALLOCATE ( lai ) + IF ( ALLOCATED ( clayf ) ) DEALLOCATE ( clayf ) + IF ( ALLOCATED ( sandf ) ) DEALLOCATE ( sandf ) + IF ( ALLOCATED ( drag ) ) DEALLOCATE ( drag ) + IF ( ALLOCATED ( ssm ) ) DEALLOCATE ( ssm ) + IF ( ALLOCATED ( uthr ) ) DEALLOCATE ( uthr ) IF ( ALLOCATED ( mol ) ) DEALLOCATE ( mol ) IF ( ALLOCATED ( ra ) ) DEALLOCATE ( ra ) IF ( ALLOCATED ( rstom ) ) DEALLOCATE ( rstom ) diff --git a/parallel/src/dealloc_x.f90 b/parallel/src/dealloc_x.f90 index e836eac..e21d615 100644 --- a/parallel/src/dealloc_x.f90 +++ b/parallel/src/dealloc_x.f90 @@ -143,6 +143,11 @@ SUBROUTINE dealloc_x DEALLOCATE ( xrgrnd ) DEALLOCATE ( xwr ) DEALLOCATE ( xlai ) + DEALLOCATE ( xclayf ) + DEALLOCATE ( xsandf ) + DEALLOCATE ( xdrag ) + DEALLOCATE ( xssm ) + DEALLOCATE ( xuthr ) DEALLOCATE ( xveg ) DEALLOCATE ( xwstar ) diff --git a/parallel/src/init_ctm.f90 b/parallel/src/init_ctm.f90 index fdfb264..1fbf4ab 100644 --- a/parallel/src/init_ctm.f90 +++ b/parallel/src/init_ctm.f90 @@ -641,6 +641,61 @@ SUBROUTINE init_ctm c_lai%iend(1) = nx c_lai%iend(2) = ny + c_clayf%fld = fillreal + c_clayf%fldname = 'CLAYF' + c_clayf%long_name = 'soil clay fraction' + c_clayf%units = '1' + c_clayf%dimnames(1) = 'nx' + c_clayf%dimnames(2) = 'ny' + c_clayf%istart(1) = 1 + c_clayf%istart(2) = 1 + c_clayf%iend(1) = nx + c_clayf%iend(2) = ny + + c_sandf%fld = fillreal + c_sandf%fldname = 'SANDF' + c_sandf%long_name = 'soil sand fraction' + c_sandf%units = '1' + c_sandf%dimnames(1) = 'nx' + c_sandf%dimnames(2) = 'ny' + c_sandf%istart(1) = 1 + c_sandf%istart(2) = 1 + c_sandf%iend(1) = nx + c_sandf%iend(2) = ny + + c_drag%fld = fillreal + c_drag%fldname = 'DRAG' + c_drag%long_name = 'drag partition' + c_drag%units = '1' + c_drag%dimnames(1) = 'nx' + c_drag%dimnames(2) = 'ny' + c_drag%istart(1) = 1 + c_drag%istart(2) = 1 + c_drag%iend(1) = nx + c_drag%iend(2) = ny + + c_ssm%fld = fillreal + c_ssm%fldname = 'SSM' + c_ssm%long_name = 'sediment supply map' + c_ssm%units = '1' + c_ssm%dimnames(1) = 'nx' + c_ssm%dimnames(2) = 'ny' + c_ssm%istart(1) = 1 + c_ssm%istart(2) = 1 + c_ssm%iend(1) = nx + c_ssm%iend(2) = ny + + c_uthr%fld = fillreal + c_uthr%fldname = 'UTHR' + c_uthr%long_name = 'threshold velocity' + c_uthr%units = 'm s-1' + c_uthr%dimnames(1) = 'nx' + c_uthr%dimnames(2) = 'ny' + c_uthr%istart(1) = 1 + c_uthr%istart(2) = 1 + c_uthr%iend(1) = nx + c_uthr%iend(2) = ny + c_seaice%fld = fillreal c_seaice%fldname = 'SEAICE' c_seaice%long_name = 'sea ice' diff --git a/parallel/src/init_met.f90 b/parallel/src/init_met.f90 index 68624eb..485ed9f 100644 --- a/parallel/src/init_met.f90 +++ b/parallel/src/init_met.f90 @@ -139,6 +139,11 @@ SUBROUTINE init_met IF ( ALLOCATED ( coriolis ) ) coriolis (:,:) = 0.0 IF ( ALLOCATED ( isltyp ) ) isltyp (:,:) = 0 IF ( ALLOCATED ( lai ) ) lai (:,:) = 0.0 + IF ( ALLOCATED ( clayf ) ) clayf (:,:) = 0.0 + IF ( ALLOCATED ( sandf ) ) sandf (:,:) = 0.0 + IF ( ALLOCATED ( drag ) ) drag (:,:) = 0.0 + IF ( ALLOCATED ( ssm ) ) ssm (:,:) = 0.0 + IF ( ALLOCATED ( uthr ) ) uthr (:,:) = 0.0 IF ( ALLOCATED ( mol ) ) mol (:,:) = 0.0 IF ( ALLOCATED ( qfx ) ) qfx (:,:) = 0.0 IF ( ALLOCATED ( ra ) ) ra (:,:) = 0.0 diff --git a/parallel/src/init_x.f90 b/parallel/src/init_x.f90 index faa5adc..857aef4 100644 --- a/parallel/src/init_x.f90 +++ b/parallel/src/init_x.f90 @@ -114,6 +114,9 @@ SUBROUTINE init_x xdenss (:,:) = fillreal ; xdluse (:,:) = fillreal xglw (:,:) = fillreal ; xgsw (:,:) = fillreal xhfx (:,:) = fillreal ; xlai (:,:) = fillreal + xclayf (:,:) = fillreal ; xsandf (:,:) = fillreal + xdrag (:,:) = fillreal ; xssm (:,:) = fillreal + xuthr (:,:) = fillreal xlatc (:,:) = fillreal ; xlatd (:,:) = fillreal xlatu (:,:) = fillreal ; xlatv (:,:) = fillreal xlh (:,:) = fillreal ; xlonc (:,:) = fillreal diff --git a/parallel/src/mcipparm_mod.f90 b/parallel/src/mcipparm_mod.f90 index f04e1cc..e350f90 100644 --- a/parallel/src/mcipparm_mod.f90 +++ b/parallel/src/mcipparm_mod.f90 @@ -239,6 +239,16 @@ MODULE mcipparm LOGICAL :: ifkfradextras ! KF-radiative feedbacks extra arrays? LOGICAL :: iflai ! leaf area index in input file? LOGICAL :: iflaiwrfout ! is leaf area index in WRF history? + LOGICAL :: ifclayf ! soil clay fraction in input file? + LOGICAL :: ifclayfwrfout ! soil clay fraction in WRF history? + LOGICAL :: ifsandf ! soil sand fraction in input file? + LOGICAL :: ifsandfwrfout ! soil sand fraction in WRF history? + LOGICAL :: ifdrag ! drag partition in input file? + LOGICAL :: ifdragwrfout ! drag partition in WRF history? + LOGICAL :: ifssm ! sediment supply map in input file? + LOGICAL :: ifssmwrfout ! sediment supply map in WRF history? + LOGICAL :: ifuthr ! threshold velocity in input file? + LOGICAL :: ifuthrwrfout ! threshold velocity in WRF history? LOGICAL :: iflufrc ! fractional land use available? LOGICAL :: ifluwrfout ! is fractional land use in WRF history? LOGICAL :: iflu2wrfout ! is fractional land use 2 in WRF history? diff --git a/parallel/src/metvars2ctm.f90 b/parallel/src/metvars2ctm.f90 index 3da7f52..98c67a6 100644 --- a/parallel/src/metvars2ctm.f90 +++ b/parallel/src/metvars2ctm.f90 @@ -439,6 +439,27 @@ END SUBROUTINE layht ENDIF ! iflai +!Fengsha dust variables + IF ( ifclayf) THEN + xclayf(:,:) = clayf(sc:ec,sr:er) + ENDIF + + IF ( ifsandf) THEN + xsandf(:,:) = sandf(sc:ec,sr:er) + ENDIF + + IF ( ifdrag) THEN + xdrag(:,:) = drag(sc:ec,sr:er) + ENDIF + + IF ( ifssm) THEN + xssm(:,:) = ssm(sc:ec,sr:er) + ENDIF + + IF ( ifuthr) THEN + xuthr(:,:) = uthr(sc:ec,sr:er) + ENDIF + IF ( ifveg ) THEN xveg (:,:) = veg (sc:ec,sr:er) ELSE diff --git a/parallel/src/metvars_mod.f90 b/parallel/src/metvars_mod.f90 index a4b7506..f3a39cf 100644 --- a/parallel/src/metvars_mod.f90 +++ b/parallel/src/metvars_mod.f90 @@ -86,6 +86,11 @@ MODULE metvars INTEGER, ALLOCATABLE :: irnold ( : , : ) INTEGER, ALLOCATABLE :: isltyp ( : , : ) REAL, ALLOCATABLE :: lai ( : , : ) + REAL, ALLOCATABLE :: clayf ( : , : ) + REAL, ALLOCATABLE :: sandf ( : , : ) + REAL, ALLOCATABLE :: drag ( : , : ) + REAL, ALLOCATABLE :: ssm ( : , : ) + REAL, ALLOCATABLE :: uthr ( : , : ) REAL, ALLOCATABLE :: lai_mos ( : , : , : ) REAL, ALLOCATABLE :: lai_px ( : , : ) REAL, ALLOCATABLE :: landmask ( : , : ) diff --git a/parallel/src/rdfv3.f90 b/parallel/src/rdfv3.f90 index 8d45c9f..9f57686 100644 --- a/parallel/src/rdfv3.f90 +++ b/parallel/src/rdfv3.f90 @@ -1434,6 +1434,227 @@ END SUBROUTINE windrotation ENDIF + IF ( ifclayf ) THEN + IF ( ifclayfwrfout ) THEN ! clayf in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'CLAY_FRAC', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + clayf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(clayf)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! clayf(:,:) = 0.1 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'CLAYF ',(clayf(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'CLAYF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! clay fraction in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'CLAY_FRAC', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + clayf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! CLAYF check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) .OR. (clayf > 1.0) ) ! FV3 water = 0 or frac > 1, set CLAYF < 0.0 +! clayf = -1.0 +! END WHERE + WRITE (*,ifmt2) 'CLAYF ', clayf(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'CLAYF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifsandf ) THEN + IF ( ifsandfwrfout ) THEN ! sandf in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'SAND_FRAC', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + sandf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(sandf)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! sandf(:,:) = 0.1 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'SANDF ',(sandf(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'SANDF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! sand fraction in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'SAND_FRAC', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + sandf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! SANDF check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) .OR. (sandf > 1.0) ) ! FV3 water = 0 or frac > 1, set SANDF < 0.0 +! sandf = -1.0 +! END WHERE + WRITE (*,ifmt2) 'SANDF ', sandf(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'SANDF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifdrag ) THEN + IF ( ifdragwrfout ) THEN ! drag in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'DRAG_PART', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + drag(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(drag)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! drag(:,:) = 1.0e-6 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'DRAG ',(drag(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'DRAG', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! sand fraction in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'DRAG_PART', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + drag(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! DRAG check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) ) ! FV3 water = 0 and DRAG < 0.0 +! drag = -1.0 +! END WHERE + WRITE (*,ifmt2) 'DRAG ', drag(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'DRAG', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifssm ) THEN + IF ( ifssmwrfout ) THEN ! ssm in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'SSM', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + ssm(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(ssm)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! ssm(:,:) = 1.0e-6 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'SSM ',(ssm(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'SSM', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! ssm in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'SSM', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + ssm(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! SSM check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) ) ! FV3 water = 0 and CLAYF < 0.0 +! ssm = -1.0 +! END WHERE + WRITE (*,ifmt2) 'SSM ', ssm(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'SSM', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifuthr ) THEN + IF ( ifuthrwrfout ) THEN ! uthr in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'UTHRES', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + uthr(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(ssm)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! ssm(:,:) = 1.0e-6 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'UTHR ',(uthr(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'UTHR', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! uthr in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'UTHRES', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + uthr(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! SSM check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) ) ! FV3 water = 0 and CLAYF < 0.0 +! ssm = -1.0 +! END WHERE + WRITE (*,ifmt2) 'UTHR ', uthr(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'UTHR', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( iflai ) THEN IF ( iflaiwrfout ) THEN ! leaf area index in FV3 history file CALL get_var_2d_real_cdf (cdfid2, 'LAI', dum2d, it, rcode) diff --git a/parallel/src/setgriddefs.f90 b/parallel/src/setgriddefs.f90 index 78e4e12..5f1c0fb 100644 --- a/parallel/src/setgriddefs.f90 +++ b/parallel/src/setgriddefs.f90 @@ -660,6 +660,41 @@ SUBROUTINE setgriddefs ENDIF WRITE (*,f6150) 'LAI', TRIM(yesno) + IF ( ifclayf ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'CLAY_FRAC', TRIM(yesno) + + IF ( ifsandf ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'SAND_FRAC', TRIM(yesno) + + IF ( ifdrag ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'DRAG_PART', TRIM(yesno) + + IF ( ifssm ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'SSM', TRIM(yesno) + + IF ( ifuthr ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'UTHRES', TRIM(yesno) + IF ( iflufrc ) THEN yesno = '' ELSE diff --git a/parallel/src/setup_fv3.f90 b/parallel/src/setup_fv3.f90 index 276f645..6e711c8 100644 --- a/parallel/src/setup_fv3.f90 +++ b/parallel/src/setup_fv3.f90 @@ -765,6 +765,171 @@ SUBROUTINE setup_fv3 (cdfid, cdfid2, ctmlays) ! the flags appropriately. !------------------------------------------------------------------------------- + rcode2 = nf90_inq_varid (cdfid2, 'CLAY_FRAC', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifclayf = .TRUE. ! clay fraction is in the file + ifclayfwrfout = .TRUE. ! clay fraction is not in the file + ELSE + ifclayfwrfout = .FALSE. ! clay fraction is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifclayf = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'CLAY_FRAC', varid) + IF ( rcode == nf90_noerr ) THEN + ifclayf = .TRUE. ! clay fraction is in the file + ELSE + ifclayf = .FALSE. ! clay fraction is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'SAND_FRAC', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifsandf = .TRUE. ! sand fraction is in the file + ifsandfwrfout = .TRUE. ! sand fraction is not in the file + ELSE + ifsandfwrfout = .FALSE. ! sand fraction is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifsandf = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'SAND_FRAC', varid) + IF ( rcode == nf90_noerr ) THEN + ifsandf = .TRUE. ! sand fraction is in the file + ELSE + ifsandf = .FALSE. ! sand fraction is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'DRAG_PART', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifdrag = .TRUE. ! drag partition is in the file + ifdragwrfout = .TRUE. ! drag partition is not in the file + ELSE + ifdragwrfout = .FALSE. ! drag partition is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifdrag = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'DRAG_PART', varid) + IF ( rcode == nf90_noerr ) THEN + ifdrag = .TRUE. ! drag partition is in the file + ELSE + ifdrag = .FALSE. ! drag partition is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'SSM', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifssm = .TRUE. ! sediment supply map is in the file + ifssmwrfout = .TRUE. ! sediment supply map is not in the file + ELSE + ifssmwrfout = .FALSE. ! sediment supply map is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifssm = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'SSM', varid) + IF ( rcode == nf90_noerr ) THEN + ifssm = .TRUE. ! sediment supply map is in the file + ELSE + ifssm = .FALSE. ! sediment supply map is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'UTHRES', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifuthr = .TRUE. ! threshold velocity is in the file + ifuthrwrfout = .TRUE. ! threshold velocity is not in the file + ELSE + ifuthrwrfout = .FALSE. ! threshold velocity is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifuthr = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'UTHRES', varid) + IF ( rcode == nf90_noerr ) THEN + ifuthr = .TRUE. ! threshold velocity is in the file + ELSE + ifuthr = .FALSE. ! threshold velocity is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + rcode2 = nf90_inq_varid (cdfid2, 'LAI', varid) !not in FV3GFSv16 IF ( rcode2 == nf90_noerr ) THEN iflai = .TRUE. ! leaf area index is in the file @@ -788,7 +953,7 @@ SUBROUTINE setup_fv3 (cdfid, cdfid2, ctmlays) IF ( rcode == nf90_noerr ) THEN iflai = .TRUE. ! leaf area index is in the file ELSE - iflai = .FALSE. ! fractional land use is not in the file + iflai = .FALSE. ! leaf area index is not in the file ENDIF rcode = nf90_close (cdfidg) IF ( rcode /= nf90_noerr ) THEN diff --git a/parallel/src/xvars_mod.f90 b/parallel/src/xvars_mod.f90 index 5771de0..6303af6 100644 --- a/parallel/src/xvars_mod.f90 +++ b/parallel/src/xvars_mod.f90 @@ -195,6 +195,11 @@ MODULE xvars REAL, ALLOCATABLE :: xw2a ( : , : ) ! deep layer soil moisture [m3/m3] REAL, ALLOCATABLE :: xwr ( : , : ) ! precip intercepted by canopy [m] REAL, ALLOCATABLE :: xlai ( : , : ) ! leaf area index [m2/m2] + REAL, ALLOCATABLE :: xclayf ( : , : ) ! soil clay fraction [decimal] + REAL, ALLOCATABLE :: xsandf ( : , : ) ! soil sand fraction [decimal] + REAL, ALLOCATABLE :: xdrag ( : , : ) ! drag partition [] + REAL, ALLOCATABLE :: xssm ( : , : ) ! sediment supply map [] + REAL, ALLOCATABLE :: xuthr ( : , : ) ! threshold velocity [m/s] REAL, ALLOCATABLE :: xveg ( : , : ) ! vegetation coverage [decimal] REAL, ALLOCATABLE :: xsltyp ( : , : ) ! soil texture type [category] diff --git a/serial/src/alloc_ctm.f90 b/serial/src/alloc_ctm.f90 index 5c81522..105fc26 100644 --- a/serial/src/alloc_ctm.f90 +++ b/serial/src/alloc_ctm.f90 @@ -209,7 +209,7 @@ SUBROUTINE alloc_ctm npxwrf41 = 0 ENDIF - nfld2dxyt = 29 + nwr + nsoil2d + npxwrf41 + nfld2dxyt = 34 + nwr + nsoil2d + npxwrf41 ALLOCATE ( fld2dxyt ( nfld2dxyt ) ) @@ -246,26 +246,31 @@ SUBROUTINE alloc_ctm c_lai => fld2dxyt(27) c_seaice => fld2dxyt(28) c_snowh => fld2dxyt(29) + c_clayf => fld2dxyt(30) + c_sandf => fld2dxyt(31) + c_drag => fld2dxyt(32) + c_ssm => fld2dxyt(33) + c_uthr => fld2dxyt(34) IF ( ifwr ) THEN - c_wr => fld2dxyt(29+nwr) + c_wr => fld2dxyt(34+nwr) ENDIF IF ( ifsoil ) THEN - c_soim1 => fld2dxyt(29+nwr+1) - c_soim2 => fld2dxyt(29+nwr+2) - c_soit1 => fld2dxyt(29+nwr+3) - c_soit2 => fld2dxyt(29+nwr+4) - c_sltyp => fld2dxyt(29+nwr+5) + c_soim1 => fld2dxyt(34+nwr+1) + c_soim2 => fld2dxyt(34+nwr+2) + c_soit1 => fld2dxyt(34+nwr+3) + c_soit2 => fld2dxyt(34+nwr+4) + c_sltyp => fld2dxyt(34+nwr+5) ENDIF IF ( ifpxwrf41 ) THEN - c_wsat_px => fld2dxyt(29+nwr+nsoil2d+1) - c_wfc_px => fld2dxyt(29+nwr+nsoil2d+2) - c_wwlt_px => fld2dxyt(29+nwr+nsoil2d+3) - c_csand_px => fld2dxyt(29+nwr+nsoil2d+4) - c_fmsand_px => fld2dxyt(29+nwr+nsoil2d+5) - c_clay_px => fld2dxyt(29+nwr+nsoil2d+6) + c_wsat_px => fld2dxyt(34+nwr+nsoil2d+1) + c_wfc_px => fld2dxyt(34+nwr+nsoil2d+2) + c_wwlt_px => fld2dxyt(34+nwr+nsoil2d+3) + c_csand_px => fld2dxyt(34+nwr+nsoil2d+4) + c_fmsand_px => fld2dxyt(34+nwr+nsoil2d+5) + c_clay_px => fld2dxyt(34+nwr+nsoil2d+6) ENDIF !------------------------------------------------------------------------------- diff --git a/serial/src/alloc_met.f90 b/serial/src/alloc_met.f90 index 3b5efab..68f5c7f 100644 --- a/serial/src/alloc_met.f90 +++ b/serial/src/alloc_met.f90 @@ -194,6 +194,26 @@ SUBROUTINE alloc_met ALLOCATE ( lai (met_nx, met_ny) ) ENDIF + IF ( ifclayf ) THEN ! leaf area index available + ALLOCATE ( clayf (met_nx, met_ny) ) + ENDIF + + IF ( ifsandf ) THEN ! leaf area index available + ALLOCATE ( sandf (met_nx, met_ny) ) + ENDIF + + IF ( ifdrag ) THEN ! leaf area index available + ALLOCATE ( drag (met_nx, met_ny) ) + ENDIF + + IF ( ifssm ) THEN ! leaf area index available + ALLOCATE ( ssm (met_nx, met_ny) ) + ENDIF + + IF ( ifuthr ) THEN ! threshold velocity available + ALLOCATE ( uthr (met_nx, met_ny) ) + ENDIF + IF ( ifmol ) THEN ! Monin-Obukhov length available ALLOCATE ( mol (met_nx, met_ny) ) ENDIF diff --git a/serial/src/alloc_x.f90 b/serial/src/alloc_x.f90 index c60fd90..09f6ba9 100644 --- a/serial/src/alloc_x.f90 +++ b/serial/src/alloc_x.f90 @@ -164,6 +164,11 @@ SUBROUTINE alloc_x ALLOCATE ( xrgrnd (ncols_x, nrows_x) ) ALLOCATE ( xwr (ncols_x, nrows_x) ) ALLOCATE ( xlai (ncols_x, nrows_x) ) + ALLOCATE ( xclayf (ncols_x, nrows_x) ) + ALLOCATE ( xsandf (ncols_x, nrows_x) ) + ALLOCATE ( xdrag (ncols_x, nrows_x) ) + ALLOCATE ( xssm (ncols_x, nrows_x) ) + ALLOCATE ( xuthr (ncols_x, nrows_x) ) ALLOCATE ( xveg (ncols_x, nrows_x) ) ALLOCATE ( xwstar (ncols_x, nrows_x) ) diff --git a/serial/src/ctmproc.f90 b/serial/src/ctmproc.f90 index 60c39f5..9116554 100644 --- a/serial/src/ctmproc.f90 +++ b/serial/src/ctmproc.f90 @@ -323,6 +323,11 @@ END SUBROUTINE collapx c_snocov%fld(col,row) = xsnocov(c,r) c_veg%fld(col,row) = xveg(c,r) c_lai%fld(col,row) = xlai(c,r) + c_clayf%fld(col,row) = xclayf(c,r) + c_sandf%fld(col,row) = xsandf(c,r) + c_drag%fld(col,row) = xdrag(c,r) + c_ssm%fld(col,row) = xssm(c,r) + c_uthr%fld(col,row) = xuthr(c,r) c_seaice%fld(col,row) = xseaice(c,r) c_snowh%fld(col,row) = xsnowh(c,r) diff --git a/serial/src/ctmvars_mod.f90 b/serial/src/ctmvars_mod.f90 index b98638d..983bb5f 100644 --- a/serial/src/ctmvars_mod.f90 +++ b/serial/src/ctmvars_mod.f90 @@ -137,6 +137,11 @@ MODULE ctmvars TYPE(fld2ddata), POINTER :: c_snocov TYPE(fld2ddata), POINTER :: c_veg TYPE(fld2ddata), POINTER :: c_lai + TYPE(fld2ddata), POINTER :: c_clayf + TYPE(fld2ddata), POINTER :: c_sandf + TYPE(fld2ddata), POINTER :: c_drag + TYPE(fld2ddata), POINTER :: c_ssm + TYPE(fld2ddata), POINTER :: c_uthr TYPE(fld2ddata), POINTER :: c_seaice TYPE(fld2ddata), POINTER :: c_snowh TYPE(fld2ddata), POINTER :: c_wr diff --git a/serial/src/dealloc_ctm.f90 b/serial/src/dealloc_ctm.f90 index 4307332..96d16ad 100644 --- a/serial/src/dealloc_ctm.f90 +++ b/serial/src/dealloc_ctm.f90 @@ -173,6 +173,12 @@ SUBROUTINE dealloc_ctm NULLIFY ( c_lai ) NULLIFY ( c_seaice ) NULLIFY ( c_snowh ) + NULLIFY ( c_clayf ) + NULLIFY ( c_sandf ) + NULLIFY ( c_drag ) + NULLIFY ( c_ssm ) + NULLIFY ( c_uthr ) + IF ( ASSOCIATED ( c_wr ) ) NULLIFY ( c_wr ) IF ( ASSOCIATED ( c_soim1 ) ) NULLIFY ( c_soim1 ) IF ( ASSOCIATED ( c_soim2 ) ) NULLIFY ( c_soim2 ) diff --git a/serial/src/dealloc_met.f90 b/serial/src/dealloc_met.f90 index c756cfb..ad4bb2f 100644 --- a/serial/src/dealloc_met.f90 +++ b/serial/src/dealloc_met.f90 @@ -151,6 +151,11 @@ SUBROUTINE dealloc_met IF ( ALLOCATED ( isltyp ) ) DEALLOCATE ( isltyp ) IF ( ALLOCATED ( lai ) ) DEALLOCATE ( lai ) + IF ( ALLOCATED ( clayf ) ) DEALLOCATE ( clayf ) + IF ( ALLOCATED ( sandf ) ) DEALLOCATE ( sandf ) + IF ( ALLOCATED ( drag ) ) DEALLOCATE ( drag ) + IF ( ALLOCATED ( ssm ) ) DEALLOCATE ( ssm ) + IF ( ALLOCATED ( uthr ) ) DEALLOCATE ( uthr ) IF ( ALLOCATED ( mol ) ) DEALLOCATE ( mol ) IF ( ALLOCATED ( ra ) ) DEALLOCATE ( ra ) IF ( ALLOCATED ( rstom ) ) DEALLOCATE ( rstom ) diff --git a/serial/src/dealloc_x.f90 b/serial/src/dealloc_x.f90 index e836eac..e21d615 100644 --- a/serial/src/dealloc_x.f90 +++ b/serial/src/dealloc_x.f90 @@ -143,6 +143,11 @@ SUBROUTINE dealloc_x DEALLOCATE ( xrgrnd ) DEALLOCATE ( xwr ) DEALLOCATE ( xlai ) + DEALLOCATE ( xclayf ) + DEALLOCATE ( xsandf ) + DEALLOCATE ( xdrag ) + DEALLOCATE ( xssm ) + DEALLOCATE ( xuthr ) DEALLOCATE ( xveg ) DEALLOCATE ( xwstar ) diff --git a/serial/src/init_ctm.f90 b/serial/src/init_ctm.f90 index fdfb264..1fbf4ab 100644 --- a/serial/src/init_ctm.f90 +++ b/serial/src/init_ctm.f90 @@ -641,6 +641,61 @@ SUBROUTINE init_ctm c_lai%iend(1) = nx c_lai%iend(2) = ny + c_clayf%fld = fillreal + c_clayf%fldname = 'CLAYF' + c_clayf%long_name = 'soil clay fraction' + c_clayf%units = '1' + c_clayf%dimnames(1) = 'nx' + c_clayf%dimnames(2) = 'ny' + c_clayf%istart(1) = 1 + c_clayf%istart(2) = 1 + c_clayf%iend(1) = nx + c_clayf%iend(2) = ny + + c_sandf%fld = fillreal + c_sandf%fldname = 'SANDF' + c_sandf%long_name = 'soil sand fraction' + c_sandf%units = '1' + c_sandf%dimnames(1) = 'nx' + c_sandf%dimnames(2) = 'ny' + c_sandf%istart(1) = 1 + c_sandf%istart(2) = 1 + c_sandf%iend(1) = nx + c_sandf%iend(2) = ny + + c_drag%fld = fillreal + c_drag%fldname = 'DRAG' + c_drag%long_name = 'drag partition' + c_drag%units = '1' + c_drag%dimnames(1) = 'nx' + c_drag%dimnames(2) = 'ny' + c_drag%istart(1) = 1 + c_drag%istart(2) = 1 + c_drag%iend(1) = nx + c_drag%iend(2) = ny + + c_ssm%fld = fillreal + c_ssm%fldname = 'SSM' + c_ssm%long_name = 'sediment supply map' + c_ssm%units = '1' + c_ssm%dimnames(1) = 'nx' + c_ssm%dimnames(2) = 'ny' + c_ssm%istart(1) = 1 + c_ssm%istart(2) = 1 + c_ssm%iend(1) = nx + c_ssm%iend(2) = ny + + c_uthr%fld = fillreal + c_uthr%fldname = 'UTHR' + c_uthr%long_name = 'threshold velocity' + c_uthr%units = 'm s-1' + c_uthr%dimnames(1) = 'nx' + c_uthr%dimnames(2) = 'ny' + c_uthr%istart(1) = 1 + c_uthr%istart(2) = 1 + c_uthr%iend(1) = nx + c_uthr%iend(2) = ny + c_seaice%fld = fillreal c_seaice%fldname = 'SEAICE' c_seaice%long_name = 'sea ice' diff --git a/serial/src/init_met.f90 b/serial/src/init_met.f90 index 68624eb..485ed9f 100644 --- a/serial/src/init_met.f90 +++ b/serial/src/init_met.f90 @@ -139,6 +139,11 @@ SUBROUTINE init_met IF ( ALLOCATED ( coriolis ) ) coriolis (:,:) = 0.0 IF ( ALLOCATED ( isltyp ) ) isltyp (:,:) = 0 IF ( ALLOCATED ( lai ) ) lai (:,:) = 0.0 + IF ( ALLOCATED ( clayf ) ) clayf (:,:) = 0.0 + IF ( ALLOCATED ( sandf ) ) sandf (:,:) = 0.0 + IF ( ALLOCATED ( drag ) ) drag (:,:) = 0.0 + IF ( ALLOCATED ( ssm ) ) ssm (:,:) = 0.0 + IF ( ALLOCATED ( uthr ) ) uthr (:,:) = 0.0 IF ( ALLOCATED ( mol ) ) mol (:,:) = 0.0 IF ( ALLOCATED ( qfx ) ) qfx (:,:) = 0.0 IF ( ALLOCATED ( ra ) ) ra (:,:) = 0.0 diff --git a/serial/src/init_x.f90 b/serial/src/init_x.f90 index faa5adc..857aef4 100644 --- a/serial/src/init_x.f90 +++ b/serial/src/init_x.f90 @@ -114,6 +114,9 @@ SUBROUTINE init_x xdenss (:,:) = fillreal ; xdluse (:,:) = fillreal xglw (:,:) = fillreal ; xgsw (:,:) = fillreal xhfx (:,:) = fillreal ; xlai (:,:) = fillreal + xclayf (:,:) = fillreal ; xsandf (:,:) = fillreal + xdrag (:,:) = fillreal ; xssm (:,:) = fillreal + xuthr (:,:) = fillreal xlatc (:,:) = fillreal ; xlatd (:,:) = fillreal xlatu (:,:) = fillreal ; xlatv (:,:) = fillreal xlh (:,:) = fillreal ; xlonc (:,:) = fillreal diff --git a/serial/src/mcipparm_mod.f90 b/serial/src/mcipparm_mod.f90 index f04e1cc..e350f90 100644 --- a/serial/src/mcipparm_mod.f90 +++ b/serial/src/mcipparm_mod.f90 @@ -239,6 +239,16 @@ MODULE mcipparm LOGICAL :: ifkfradextras ! KF-radiative feedbacks extra arrays? LOGICAL :: iflai ! leaf area index in input file? LOGICAL :: iflaiwrfout ! is leaf area index in WRF history? + LOGICAL :: ifclayf ! soil clay fraction in input file? + LOGICAL :: ifclayfwrfout ! soil clay fraction in WRF history? + LOGICAL :: ifsandf ! soil sand fraction in input file? + LOGICAL :: ifsandfwrfout ! soil sand fraction in WRF history? + LOGICAL :: ifdrag ! drag partition in input file? + LOGICAL :: ifdragwrfout ! drag partition in WRF history? + LOGICAL :: ifssm ! sediment supply map in input file? + LOGICAL :: ifssmwrfout ! sediment supply map in WRF history? + LOGICAL :: ifuthr ! threshold velocity in input file? + LOGICAL :: ifuthrwrfout ! threshold velocity in WRF history? LOGICAL :: iflufrc ! fractional land use available? LOGICAL :: ifluwrfout ! is fractional land use in WRF history? LOGICAL :: iflu2wrfout ! is fractional land use 2 in WRF history? diff --git a/serial/src/metvars2ctm.f90 b/serial/src/metvars2ctm.f90 index 3da7f52..98c67a6 100644 --- a/serial/src/metvars2ctm.f90 +++ b/serial/src/metvars2ctm.f90 @@ -439,6 +439,27 @@ END SUBROUTINE layht ENDIF ! iflai +!Fengsha dust variables + IF ( ifclayf) THEN + xclayf(:,:) = clayf(sc:ec,sr:er) + ENDIF + + IF ( ifsandf) THEN + xsandf(:,:) = sandf(sc:ec,sr:er) + ENDIF + + IF ( ifdrag) THEN + xdrag(:,:) = drag(sc:ec,sr:er) + ENDIF + + IF ( ifssm) THEN + xssm(:,:) = ssm(sc:ec,sr:er) + ENDIF + + IF ( ifuthr) THEN + xuthr(:,:) = uthr(sc:ec,sr:er) + ENDIF + IF ( ifveg ) THEN xveg (:,:) = veg (sc:ec,sr:er) ELSE diff --git a/serial/src/metvars_mod.f90 b/serial/src/metvars_mod.f90 index b739b51..f3a39cf 100644 --- a/serial/src/metvars_mod.f90 +++ b/serial/src/metvars_mod.f90 @@ -86,6 +86,11 @@ MODULE metvars INTEGER, ALLOCATABLE :: irnold ( : , : ) INTEGER, ALLOCATABLE :: isltyp ( : , : ) REAL, ALLOCATABLE :: lai ( : , : ) + REAL, ALLOCATABLE :: clayf ( : , : ) + REAL, ALLOCATABLE :: sandf ( : , : ) + REAL, ALLOCATABLE :: drag ( : , : ) + REAL, ALLOCATABLE :: ssm ( : , : ) + REAL, ALLOCATABLE :: uthr ( : , : ) REAL, ALLOCATABLE :: lai_mos ( : , : , : ) REAL, ALLOCATABLE :: lai_px ( : , : ) REAL, ALLOCATABLE :: landmask ( : , : ) @@ -170,5 +175,6 @@ MODULE metvars REAL, ALLOCATABLE :: znt ( : , : ) REAL, ALLOCATABLE :: znt_mos ( : , : , : ) REAL, ALLOCATABLE :: zpbl ( : , : ) - +!! FV3 temporary +! REAL, ALLOCATABLE :: dum3d ( : , : , : ) END MODULE metvars diff --git a/serial/src/rdfv3.f90 b/serial/src/rdfv3.f90 index 0865d2f..6704075 100644 --- a/serial/src/rdfv3.f90 +++ b/serial/src/rdfv3.f90 @@ -1423,6 +1423,226 @@ END SUBROUTINE windrotation ENDIF + IF ( ifclayf ) THEN + IF ( ifclayfwrfout ) THEN ! clayf in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'CLAY_FRAC', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + clayf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(clayf)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! clayf(:,:) = 0.1 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'CLAYF ',(clayf(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'CLAYF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! clay fraction in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'CLAY_FRAC', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + clayf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! CLAYF check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) .OR. (clayf > 1.0) ) ! FV3 water = 0 and CLAYF < 0.0 +! clayf = -1.0 +! END WHERE + WRITE (*,ifmt2) 'CLAYF ', clayf(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'CLAYF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifsandf ) THEN + IF ( ifsandfwrfout ) THEN ! sandf in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'SAND_FRAC', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + sandf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(sandf)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! sandf(:,:) = 0.1 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'SANDF ',(sandf(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'SANDF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! sand fraction in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'SAND_FRAC', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + sandf(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! SANDF check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) .OR. (clayf > 1.0) ) ! FV3 land = 1 and SANDF < 0.0 +! sandf = -1.0 +! END WHERE + WRITE (*,ifmt2) 'SANDF ', sandf(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'SANDF', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifdrag ) THEN + IF ( ifdragwrfout ) THEN ! drag in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'DRAG_PART', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + drag(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(drag)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! drag(:,:) = 1.0e-6 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'DRAG ',(drag(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'DRAG', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! sand fraction in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'DRAG_PART', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + drag(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! DRAG check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) ) ! FV3 water = 0 and DRAG < 0.0 +! drag = -1.0 +! END WHERE + WRITE (*,ifmt2) 'DRAG ', drag(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'DRAG', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifssm ) THEN + IF ( ifssmwrfout ) THEN ! ssm in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'SSM', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + ssm(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(ssm)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! ssm(:,:) = 1.0e-6 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'SSM ',(ssm(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'SSM', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! ssm in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'SSM', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + ssm(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! SSM check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) ) ! FV3 water = 0 and CLAYF < 0.0 +! ssm = -1.0 +! END WHERE + WRITE (*,ifmt2) 'SSM ', ssm(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'SSM', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + IF ( ifuthr ) THEN + IF ( ifuthrwrfout ) THEN ! uthr in FV3 history file + CALL get_var_2d_real_cdf (cdfid2, 'UTHRES', dum2d, it, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + uthr(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) +! IF ( ABS(MAXVAL(ssm)) < smallnum ) THEN +! IF ( met_soil_lsm == 2 ) THEN ! NOAH LSM +! ssm(:,:) = 1.0e-6 +! ENDIF +! ENDIF + WRITE (*,ifmt2) 'UTHR ',(uthr(lprt_metx,lprt_mety)) + ELSE + WRITE (*,f9400) TRIM(pname), 'UTHR', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + ELSE ! uthr in GEOGRID file from WPS + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9900) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + CALL get_var_2d_real_cdf (cdfidg, 'UTHRES', dum2d, 1, rcode) + IF ( rcode == nf90_noerr ) THEN + call myinterp(dum2d,met_nx,met_ny,atmp,xindex,yindex,ncols_x,nrows_x,1) + uthr(1:ncols_x,1:nrows_x) = atmp(1:ncols_x,1:nrows_x) + ! SSM check over water, set as negative numbers for improved error checking +! WHERE ( (INT(landmask) == 0) ) ! FV3 water = 0 and CLAYF < 0.0 +! ssm = -1.0 +! END WHERE + WRITE (*,ifmt2) 'UTHR ', uthr(lprt_metx,lprt_mety) + ELSE + WRITE (*,f9400) TRIM(pname), 'UTHR', TRIM(nf90_strerror(rcode)) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9950) TRIM(pname) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + IF ( iflai ) THEN IF ( iflaiwrfout ) THEN ! leaf area index in FV3 history file CALL get_var_2d_real_cdf (cdfid2, 'LAI', dum2d, it, rcode) diff --git a/serial/src/setgriddefs.f90 b/serial/src/setgriddefs.f90 index 78e4e12..5f1c0fb 100644 --- a/serial/src/setgriddefs.f90 +++ b/serial/src/setgriddefs.f90 @@ -660,6 +660,41 @@ SUBROUTINE setgriddefs ENDIF WRITE (*,f6150) 'LAI', TRIM(yesno) + IF ( ifclayf ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'CLAY_FRAC', TRIM(yesno) + + IF ( ifsandf ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'SAND_FRAC', TRIM(yesno) + + IF ( ifdrag ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'DRAG_PART', TRIM(yesno) + + IF ( ifssm ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'SSM', TRIM(yesno) + + IF ( ifuthr ) THEN + yesno = '' + ELSE + yesno = 'NOT' + ENDIF + WRITE (*,f6150) 'UTHRES', TRIM(yesno) + IF ( iflufrc ) THEN yesno = '' ELSE diff --git a/serial/src/setup_fv3.f90 b/serial/src/setup_fv3.f90 index 276f645..6e711c8 100644 --- a/serial/src/setup_fv3.f90 +++ b/serial/src/setup_fv3.f90 @@ -765,6 +765,171 @@ SUBROUTINE setup_fv3 (cdfid, cdfid2, ctmlays) ! the flags appropriately. !------------------------------------------------------------------------------- + rcode2 = nf90_inq_varid (cdfid2, 'CLAY_FRAC', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifclayf = .TRUE. ! clay fraction is in the file + ifclayfwrfout = .TRUE. ! clay fraction is not in the file + ELSE + ifclayfwrfout = .FALSE. ! clay fraction is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifclayf = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'CLAY_FRAC', varid) + IF ( rcode == nf90_noerr ) THEN + ifclayf = .TRUE. ! clay fraction is in the file + ELSE + ifclayf = .FALSE. ! clay fraction is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'SAND_FRAC', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifsandf = .TRUE. ! sand fraction is in the file + ifsandfwrfout = .TRUE. ! sand fraction is not in the file + ELSE + ifsandfwrfout = .FALSE. ! sand fraction is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifsandf = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'SAND_FRAC', varid) + IF ( rcode == nf90_noerr ) THEN + ifsandf = .TRUE. ! sand fraction is in the file + ELSE + ifsandf = .FALSE. ! sand fraction is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'DRAG_PART', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifdrag = .TRUE. ! drag partition is in the file + ifdragwrfout = .TRUE. ! drag partition is not in the file + ELSE + ifdragwrfout = .FALSE. ! drag partition is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifdrag = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'DRAG_PART', varid) + IF ( rcode == nf90_noerr ) THEN + ifdrag = .TRUE. ! drag partition is in the file + ELSE + ifdrag = .FALSE. ! drag partition is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'SSM', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifssm = .TRUE. ! sediment supply map is in the file + ifssmwrfout = .TRUE. ! sediment supply map is not in the file + ELSE + ifssmwrfout = .FALSE. ! sediment supply map is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifssm = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'SSM', varid) + IF ( rcode == nf90_noerr ) THEN + ifssm = .TRUE. ! sediment supply map is in the file + ELSE + ifssm = .FALSE. ! sediment supply map is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + + rcode2 = nf90_inq_varid (cdfid2, 'UTHRES', varid) !not in FV3GFSv16 + IF ( rcode2 == nf90_noerr ) THEN + ifuthr = .TRUE. ! threshold velocity is in the file + ifuthrwrfout = .TRUE. ! threshold velocity is not in the file + ELSE + ifuthrwrfout = .FALSE. ! threshold velocity is not available in FV3 history + geofile = TRIM( file_geo ) + INQUIRE ( FILE=geofile, EXIST=ifgeo ) + IF ( .NOT. ifgeo ) THEN + WRITE (*,f9900) TRIM(pname) + ifuthr = .FALSE. + ELSE + flg = file_geo + rcode = nf90_open (flg, nf90_nowrite, cdfidg) + + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9600) TRIM(pname), TRIM(flg) + CALL graceful_stop (pname) + ENDIF + rcode = nf90_inq_varid (cdfidg, 'UTHRES', varid) + IF ( rcode == nf90_noerr ) THEN + ifuthr = .TRUE. ! threshold velocity is in the file + ELSE + ifuthr = .FALSE. ! threshold velocity is not in the file + ENDIF + rcode = nf90_close (cdfidg) + IF ( rcode /= nf90_noerr ) THEN + WRITE (*,f9700) TRIM(pname),TRIM(flg) + CALL graceful_stop (pname) + ENDIF + ENDIF + ENDIF + rcode2 = nf90_inq_varid (cdfid2, 'LAI', varid) !not in FV3GFSv16 IF ( rcode2 == nf90_noerr ) THEN iflai = .TRUE. ! leaf area index is in the file @@ -788,7 +953,7 @@ SUBROUTINE setup_fv3 (cdfid, cdfid2, ctmlays) IF ( rcode == nf90_noerr ) THEN iflai = .TRUE. ! leaf area index is in the file ELSE - iflai = .FALSE. ! fractional land use is not in the file + iflai = .FALSE. ! leaf area index is not in the file ENDIF rcode = nf90_close (cdfidg) IF ( rcode /= nf90_noerr ) THEN diff --git a/serial/src/xvars_mod.f90 b/serial/src/xvars_mod.f90 index 5771de0..6303af6 100644 --- a/serial/src/xvars_mod.f90 +++ b/serial/src/xvars_mod.f90 @@ -195,6 +195,11 @@ MODULE xvars REAL, ALLOCATABLE :: xw2a ( : , : ) ! deep layer soil moisture [m3/m3] REAL, ALLOCATABLE :: xwr ( : , : ) ! precip intercepted by canopy [m] REAL, ALLOCATABLE :: xlai ( : , : ) ! leaf area index [m2/m2] + REAL, ALLOCATABLE :: xclayf ( : , : ) ! soil clay fraction [decimal] + REAL, ALLOCATABLE :: xsandf ( : , : ) ! soil sand fraction [decimal] + REAL, ALLOCATABLE :: xdrag ( : , : ) ! drag partition [] + REAL, ALLOCATABLE :: xssm ( : , : ) ! sediment supply map [] + REAL, ALLOCATABLE :: xuthr ( : , : ) ! threshold velocity [m/s] REAL, ALLOCATABLE :: xveg ( : , : ) ! vegetation coverage [decimal] REAL, ALLOCATABLE :: xsltyp ( : , : ) ! soil texture type [category]