Skip to content

Commit

Permalink
make new canopystate_inst variable
Browse files Browse the repository at this point in the history
  • Loading branch information
adrifoster committed Feb 5, 2025
1 parent 21dde29 commit 4575646
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/biogeochem/SatellitePhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ subroutine SatellitePhenology(bounds, num_filter, filter, &
associate( &
frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1)
snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m)
tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow
tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow
tlai => canopystate_inst%tlai_input_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow
tsai => canopystate_inst%tsai_input_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow
elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow
esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow
htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m)
hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m)
htop => canopystate_inst%htop_input_patch , & ! Output: [real(r8) (:) ] canopy top (m)
hbot => canopystate_inst%hbot_input_patch , & ! Output: [real(r8) (:) ] canopy bottom (m)
frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-]
)

Expand Down
33 changes: 18 additions & 15 deletions src/biogeophys/CanopyStateType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ module CanopyStateType
real(r8) , pointer :: elai_patch (:) ! patch canopy one-sided leaf area index with burying by snow
real(r8) , pointer :: esai_patch (:) ! patch canopy one-sided stem area index with burying by snow

real(r8) , pointer :: tlai_hist_patch (:) ! patch canopy one-sided leaf area index, for SP mode
real(r8) , pointer :: tsai_hist_patch (:) ! patch canopy one-sided stem area index, for SP mode
real(r8) , pointer :: htop_hist_patch (:) ! patch canopy height, for SP mode
real(r8) , pointer :: tlai_input_patch (:) ! patch canopy one-sided leaf area index driver data for SP mode (no burying by snow)
real(r8) , pointer :: tsai_input_patch (:) ! patch canopy one-sided stem area index driver data for SP mode (no burying by snow)
real(r8) , pointer :: htop_input_patch (:) ! patch canopy height driver data for SP mode
real(r8) , pointer :: hbot_input_patch (:) ! patch canopy bottom driver data for SP mode

real(r8) , pointer :: elai240_patch (:) ! patch canopy one-sided leaf area index with burying by snow average over 10days
real(r8) , pointer :: laisun_patch (:) ! patch patch sunlit projected leaf area index
Expand Down Expand Up @@ -119,9 +120,10 @@ subroutine InitAllocate(this, bounds)

allocate(this%frac_veg_nosno_patch (begp:endp)) ; this%frac_veg_nosno_patch (:) = huge(1)
allocate(this%frac_veg_nosno_alb_patch (begp:endp)) ; this%frac_veg_nosno_alb_patch (:) = 0
allocate(this%tlai_hist_patch (begp:endp)) ; this%tlai_hist_patch (:) = nan
allocate(this%tsai_hist_patch (begp:endp)) ; this%tsai_hist_patch (:) = nan
allocate(this%htop_hist_patch (begp:endp)) ; this%htop_hist_patch (:) = nan
allocate(this%tlai_input_patch (begp:endp)) ; this%tlai_input_patch (:) = nan
allocate(this%tsai_input_patch (begp:endp)) ; this%tsai_input_patch (:) = nan
allocate(this%htop_input_patch (begp:endp)) ; this%htop_input_patch (:) = nan
allocate(this%hbot_input_patch (begp:endp)) ; this%hbot_input_patch (:) = nan
allocate(this%tlai_patch (begp:endp)) ; this%tlai_patch (:) = nan
allocate(this%tsai_patch (begp:endp)) ; this%tsai_patch (:) = nan
allocate(this%elai_patch (begp:endp)) ; this%elai_patch (:) = nan
Expand Down Expand Up @@ -217,10 +219,10 @@ subroutine InitHistory(this, bounds)
ptr_patch=this%displa_patch, default='inactive', l2g_scale_type='veg')

if(use_fates_sp)then
this%htop_hist_patch(begp:endp) = spval
this%htop_input_patch(begp:endp) = spval
call hist_addfld1d (fname='HTOP', units='m', &
avgflag='A', long_name='HTOP weights for SP mode', &
ptr_patch=this%htop_hist_patch)
ptr_patch=this%htop_input_patch)
else
this%htop_patch(begp:endp) = spval
call hist_addfld1d (fname='HTOP', units='m', &
Expand All @@ -230,15 +232,15 @@ subroutine InitHistory(this, bounds)
endif

if(use_fates_sp)then
this%tlai_hist_patch(begp:endp) = spval
this%tlai_input_patch(begp:endp) = spval
call hist_addfld1d (fname='TLAI', units='m', &
avgflag='A', long_name='TLAI weights for SP mode', &
ptr_patch=this%tlai_hist_patch)
ptr_patch=this%tlai_input_patch)

this%tsai_hist_patch(begp:endp) = spval
this%tsai_input_patch(begp:endp) = spval
call hist_addfld1d (fname='TSAI', units='m', &
avgflag='A', long_name='TSAI weights for SP mode', &
ptr_patch=this%tsai_hist_patch)
ptr_patch=this%tsai_input_patch)

else
this%tlai_patch(begp:endp) = spval
Expand Down Expand Up @@ -541,9 +543,10 @@ subroutine InitCold(this, bounds)
this%laisha_patch(p) = 0._r8
end if

this%tlai_hist_patch(p) = 0._r8
this%tsai_hist_patch(p) = 0._r8
this%htop_hist_patch(p) = 0._r8
this%tlai_input_patch(p) = 0._r8
this%tsai_input_patch(p) = 0._r8
this%htop_input_patch(p) = 0._r8
this%hbot_input_patch(p) = 0._r8

! needs to be initialized to spval to avoid problems when averaging for the accum
! field
Expand Down

0 comments on commit 4575646

Please sign in to comment.