From 168fae2061fad5ab6d34fa8445ec2ffde06c7a14 Mon Sep 17 00:00:00 2001 From: drnimbusrain Date: Tue, 13 Feb 2024 18:29:28 -0500 Subject: [PATCH] Added text output for LAD. --- input/namelist.canopy | 16 ++++++++-------- src/canopy_alloc.F90 | 1 + src/canopy_calcs.F90 | 9 +++++++++ src/canopy_canvars_mod.F90 | 1 + src/canopy_dealloc.F90 | 1 + src/canopy_init.F90 | 3 ++- src/canopy_txt_io_mod.F90 | 28 ++++++++++++++-------------- 7 files changed, 36 insertions(+), 23 deletions(-) diff --git a/input/namelist.canopy b/input/namelist.canopy index a474f967..3e0a1c0b 100755 --- a/input/namelist.canopy +++ b/input/namelist.canopy @@ -1,23 +1,23 @@ &FILENAMES !Gridded Text and NCF Examples ! Recommend set file_out prefix to initial 'YYYY-MM-DD-HH-MMSS_region_identifier' - file_vars = 'input/gfs.t12z.20220630.sfcf023.canopy.nc' 'input/gfs.t12z.20220701.sfcf000.canopy.nc' 'input/gfs.t12z.20220701.sfcf001.canopy.nc' +! file_vars = 'input/gfs.t12z.20220630.sfcf023.canopy.nc' 'input/gfs.t12z.20220701.sfcf000.canopy.nc' 'input/gfs.t12z.20220701.sfcf001.canopy.nc' ! file_vars = 'input/gfs.t12z.20220630.sfcf023.canopy.txt' 'input/gfs.t12z.20220701.sfcf000.canopy.txt' 'input/gfs.t12z.20220701.sfcf001.canopy.txt' - file_out = 'output/2022-07-01-11-0000_southeast_us' +! file_out = 'output/2022-07-01-11-0000_southeast_us' !Single Point Example ! Recommend set file_out prefix to initial 'YYYY-MM-DD-HH-MMSS_point_identifier' -! file_vars = 'input/point_file_20220630.sfcf023.txt' 'input/point_file_20220701.sfcf000.txt' 'input/point_file_20220701.sfcf001.txt' -! file_canvars = 'input/point_file_canvars_20220630.sfcf023.txt' 'input/point_file_canvars_20220701.sfcf000.txt' 'input/point_file_canvars_20220701.sfcf001.txt' -! file_out = 'output/2022-07-01-11-0000_point' + file_vars = 'input/point_file_20220630.sfcf023.txt' 'input/point_file_20220701.sfcf000.txt' 'input/point_file_20220701.sfcf001.txt' + file_canvars = 'input/point_file_canvars_20220630.sfcf023.txt' 'input/point_file_canvars_20220701.sfcf000.txt' 'input/point_file_canvars_20220701.sfcf001.txt' + file_out = 'output/2022-07-01-11-0000_point' / &USERDEFS !Input model format options - infmt_opt = 0 + infmt_opt = 1 !Input model grid sizes - nlat = 43 - nlon = 86 + nlat = 1 + nlon = 1 !Input model run times and interval time_start = '2022-07-01-11:00:00.0000' time_end = '2022-07-01-13:00:00.0000' diff --git a/src/canopy_alloc.F90 b/src/canopy_alloc.F90 index 7e231ffd..7937d344 100644 --- a/src/canopy_alloc.F90 +++ b/src/canopy_alloc.F90 @@ -43,6 +43,7 @@ SUBROUTINE canopy_alloc if(.not.allocated(ppfd_sun)) allocate(ppfd_sun(modlays)) if(.not.allocated(ppfd_shade)) allocate(ppfd_shade(modlays)) if(.not.allocated(ppfd_ave)) allocate(ppfd_ave(modlays)) + if(.not.allocated(lad)) allocate(lad(nlat*nlon,modlays)) !------------------------------------------------------------------------------- ! Allocate arrays for Canopy Wind Outputs diff --git a/src/canopy_calcs.F90 b/src/canopy_calcs.F90 index 32024d8d..fc1460c7 100644 --- a/src/canopy_calcs.F90 +++ b/src/canopy_calcs.F90 @@ -585,6 +585,15 @@ SUBROUTINE canopy_calcs(nn) end if end if +! ... calculate leaf area density profile from foliage shape function for output (m2/m3) + do k=1, modlays + if (k .lt. modlays) then + lad(loc,k) = ((fafraczInt(k+1) - fafraczInt(k))*lairef)/modres + else + lad(loc,k) = lad(loc,modlays-1) + end if + end do + ! ... calculate zero-plane displacement height/hc and surface (soil+veg) roughness lengths/hc call canopy_zpd(zhc(1:cansublays), fafraczInt(1:cansublays), & diff --git a/src/canopy_canvars_mod.F90 b/src/canopy_canvars_mod.F90 index d3d29112..2f1fc13d 100644 --- a/src/canopy_canvars_mod.F90 +++ b/src/canopy_canvars_mod.F90 @@ -42,6 +42,7 @@ MODULE canopy_canvars_mod real(rk), allocatable :: ppfd_ave ( : ) ! Average PPFD for sunlit and shaded leaves (umol phot/m2 s) real(rk), allocatable :: canBOT ( : ) ! Canopy bottom wind reduction factors real(rk), allocatable :: canTOP ( : ) ! Canopy top wind reduction factors + real(rk), allocatable :: lad ( : , : ) ! Leaf Area Density calculated from foliage shape function (m2/m3) real(rk), allocatable :: canWIND ( : , : ) ! canopy wind speeds (m/s) real(rk), allocatable :: canWIND_3d ( : , : , : ) ! canopy wind speeds -- 3D (m/s) real(rk), allocatable :: dx ( : ) ! Model grid cell distance/resolution (m) diff --git a/src/canopy_dealloc.F90 b/src/canopy_dealloc.F90 index e28d9d2f..66e55276 100644 --- a/src/canopy_dealloc.F90 +++ b/src/canopy_dealloc.F90 @@ -44,6 +44,7 @@ SUBROUTINE canopy_dealloc if(allocated(ppfd_sun)) deallocate(ppfd_sun) if(allocated(ppfd_shade)) deallocate(ppfd_shade) if(allocated(ppfd_ave)) deallocate(ppfd_ave) + if(allocated(lad)) deallocate(lad) !------------------------------------------------------------------------------- ! Deallocate arrays for Canopy Wind diff --git a/src/canopy_init.F90 b/src/canopy_init.F90 index 9a0bfa34..8079847e 100644 --- a/src/canopy_init.F90 +++ b/src/canopy_init.F90 @@ -27,7 +27,8 @@ SUBROUTINE canopy_init if(allocated(tleaf_ave)) tleaf_ave(:) = fillreal if(allocated(ppfd_sun)) ppfd_sun(:) = fillreal if(allocated(ppfd_shade)) ppfd_shade(:) = fillreal - if(allocated(ppfd_ave)) ppfd_ave(:) = fillreal + if(allocated(ppfd_ave)) ppfd_ave(:) = fillreal + if(allocated(lad)) lad(:,:) = fillreal !------------------------------------------------------------------------------- ! Initialize arrays for Canopy Wind diff --git a/src/canopy_txt_io_mod.F90 b/src/canopy_txt_io_mod.F90 index b7470077..68f8bae5 100644 --- a/src/canopy_txt_io_mod.F90 +++ b/src/canopy_txt_io_mod.F90 @@ -90,11 +90,11 @@ SUBROUTINE write_txt(TXTPREFX,TIMENOW) write(10, '(a15, a24)') 'time stamp: ', TIMENOW write(10, '(a30, f6.1, a2)') 'reference height, h: ', href_set, 'm' write(10, '(a30, i6)') 'number of model layers: ', modlays - write(10, '(a8, a9, a12, a17)') 'lat', 'lon', 'height (m)', 'ws (m s-1)' + write(10, '(a8, a9, a12, a13, a17)') 'lat', 'lon', 'height (m)', 'LAD (m2 m-3)', 'ws (m s-1)' do loc=1, nlat*nlon do k=1, modlays - write(10, '(f8.2, f9.2, f12.2, es15.7)') variables(loc)%lat, variables(loc)%lon, & - zk(k), canWIND(loc, k) + write(10, '(f8.2, f9.2, f10.2, f12.2, es15.7)') variables(loc)%lat, variables(loc)%lon, & + zk(k), lad(loc,k), canWIND(loc, k) end do end do end if @@ -122,11 +122,11 @@ SUBROUTINE write_txt(TXTPREFX,TIMENOW) write(12, '(a15, a24)') 'time stamp: ', TIMENOW write(12, '(a30, f6.1, a2)') 'reference height, h: ', href_set, 'm' write(12, '(a30, i6)') 'number of model layers: ', modlays - write(12, '(a8, a9, a12, a15)') 'lat', 'lon', 'height (m)', 'kz (m2 s-1)' + write(12, '(a8, a9, a12, a13, a15)') 'lat', 'lon', 'height (m)', 'LAD (m2 m-3)', 'kz (m2 s-1)' do loc=1, nlat*nlon do k=1, modlays - write(12, '(f8.2, f9.2, f12.2, es15.7)') variables(loc)%lat, variables(loc)%lon, & - zk(k), Kz(loc,k) + write(12, '(f8.2, f9.2, f12.2, f12.2, es15.7)') variables(loc)%lat, variables(loc)%lon, & + zk(k), lad(loc,k), Kz(loc,k) end do end do end if @@ -139,11 +139,11 @@ SUBROUTINE write_txt(TXTPREFX,TIMENOW) write(13, '(a15, a24)') 'time stamp: ', TIMENOW write(13, '(a30, f6.1, a2)') 'reference height, h: ', href_set, 'm' write(13, '(a30, i6)') 'number of model layers: ', modlays - write(13, '(a8, a9, a12, a15)') 'lat', 'lon', 'height (m)', 'rjcf (1)' + write(13, '(a8, a9, a12, a13, a15)') 'lat', 'lon', 'height (m)', 'LAD (m2 m-3)', 'rjcf (1)' do loc=1, nlat*nlon do k=1, modlays - write(13, '(f8.2, f9.2, f12.2, es15.7)') variables(loc)%lat, variables(loc)%lon, & - zk(k), rjcf(loc,k) + write(13, '(f8.2, f9.2, f12.2, f12.2, es15.7)') variables(loc)%lat, variables(loc)%lon, & + zk(k), lad(loc,k), rjcf(loc,k) end do end do end if @@ -155,8 +155,8 @@ SUBROUTINE write_txt(TXTPREFX,TIMENOW) write(14, '(a15, a24)') 'time stamp: ', TIMENOW write(14, '(a30, f6.1, a2)') 'reference height, h: ', href_set, 'm' write(14, '(a30, i6)') 'number of model layers: ', modlays - write(14, '(a8, a9, a12, a28, a28, a28, a28, a28, a28, a28, a28, a28, a28, & - & a28, a28, a28, a28, a28, a28, a28, a28, a28)') 'lat', 'lon', 'height (m)', & + write(14, '(a8, a9, a12, a13, a28, a28, a28, a28, a28, a28, a28, a28, a28, a28, & + & a28, a28, a28, a28, a28, a28, a28, a28, a28)') 'lat', 'lon', 'height (m)', 'LAD (m2 m-3)', & 'emi_isop (kg m-3 s-1)', 'emi_myrc (kg m-3 s-1)', 'emi_sabi (kg m-3 s-1)', & 'emi_limo (kg m-3 s-1)', 'emi_care (kg m-3 s-1)', 'emi_ocim (kg m-3 s-1)', & 'emi_bpin (kg m-3 s-1)', 'emi_apin (kg m-3 s-1)', 'emi_mono (kg m-3 s-1)', & @@ -166,11 +166,11 @@ SUBROUTINE write_txt(TXTPREFX,TIMENOW) 'emi_ovoc (kg m-3 s-1)' do loc=1, nlat*nlon do k=1, modlays - write(14, '(f8.2, f9.2, f12.2, es15.7, es15.7, es15.7, es15.7, es15.7, es15.7, & + write(14, '(f8.2, f9.2, f12.2, f12.2, es15.7, es15.7, es15.7, es15.7, es15.7, es15.7, & & es15.7, es15.7, es15.7, es15.7, es15.7, es15.7, es15.7, es15.7, & & es15.7, es15.7, es15.7, es15.7, es15.7)') & - variables(loc)%lat, variables(loc)%lon, & - zk(k), emi_isop(loc,k), emi_myrc(loc,k), emi_sabi(loc,k), emi_limo(loc,k), & + variables(loc)%lat, variables(loc)%lon, zk(k), & + lad(loc,k), emi_isop(loc,k), emi_myrc(loc,k), emi_sabi(loc,k), emi_limo(loc,k), & emi_care(loc,k), emi_ocim(loc,k), emi_bpin(loc,k), emi_apin(loc,k), & emi_mono(loc,k), emi_farn(loc,k), emi_cary(loc,k), emi_sesq(loc,k), & emi_mbol(loc,k), emi_meth(loc,k), emi_acet(loc,k), emi_co(loc,k), &