Skip to content

Commit

Permalink
Added text output for LAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
drnimbusrain committed Feb 13, 2024
1 parent a84a6ac commit 168fae2
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 23 deletions.
16 changes: 8 additions & 8 deletions input/namelist.canopy
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions src/canopy_alloc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/canopy_calcs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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), &
Expand Down
1 change: 1 addition & 0 deletions src/canopy_canvars_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/canopy_dealloc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/canopy_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions src/canopy_txt_io_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)', &
Expand All @@ -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), &
Expand Down

0 comments on commit 168fae2

Please sign in to comment.