Skip to content

Commit

Permalink
cleanup of moving zenith updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rgknox committed Jan 24, 2025
1 parent fc8e1f0 commit 2c751e9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
13 changes: 12 additions & 1 deletion src/biogeophys/BalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,18 @@ subroutine BalanceCheck( bounds, &
write(iulog,*)'forc_solai(1) = ',forc_solai(indexg,1)
write(iulog,*)'forc_solai(2) = ',forc_solai(indexg,2)
write(iulog,*)'forc_tot = ',forc_solad(indexg,1)+forc_solad(indexg,2) &
+forc_solai(indexg,1)+forc_solai(indexg,2)
+forc_solai(indexg,1)+forc_solai(indexg,2)

write(iulog,*)'coszen_col:',surfalb_inst%coszen_col(indexc)
write(iulog,*)'fabd:',fabd(indexp,:)
write(iulog,*)'fabi:',fabi(indexp,:)
write(iulog,*)'albd:',albd(indexp,:)
write(iulog,*)'albi:',albi(indexp,:)
write(iulog,*)'ftdd:',ftdd(indexp,:)
write(iulog,*)'ftid:',ftid(indexp,:)
write(iulog,*)'ftii:',ftii(indexp,:)


write(iulog,*)'CTSM is stopping'
call endrun(subgrid_index=indexp, subgrid_level=subgrid_level_patch, msg=errmsg(sourcefile, __LINE__))
end if
Expand Down
15 changes: 10 additions & 5 deletions src/biogeophys/SurfaceAlbedoMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module SurfaceAlbedoMod
public :: SurfaceAlbedo_readnl
public :: SurfaceAlbedoInitTimeConst
public :: SurfaceAlbedo ! Surface albedo and two-stream fluxes
public :: DownscaleGeogZenithAngle
public :: UpdateZenithAngles

!
! !PRIVATE MEMBER FUNCTIONS:
Expand Down Expand Up @@ -228,12 +228,13 @@ end subroutine SurfaceAlbedoInitTimeConst

! -----------------------------------------------------------------------

subroutine UpdateZenithAngles(bounds,nc, surfalb_inst, nextsw_cday, declinp1)
subroutine UpdateZenithAngles(bounds, surfalb_inst, nextsw_cday, declinp1)

! Incorporate surface slopes to generate column level zenith angles

use clm_varctl , only : downscale_hillslope_meteorology

use shr_orb_mod

type(bounds_type) , intent(in) :: bounds ! bounds
type(surfalb_type) , intent(inout) :: surfalb_inst
real(r8) , intent(in) :: nextsw_cday ! calendar day at Greenwich (1.00, ..., days/year)
Expand Down Expand Up @@ -266,6 +267,8 @@ subroutine UpdateZenithAngles(bounds,nc, surfalb_inst, nextsw_cday, declinp1)
else
coszen_col(c) = coszen_grc(g)
endif

print*,"COSZEN_COL:",c,coszen_col(c)

end do

Expand Down Expand Up @@ -307,7 +310,7 @@ subroutine SurfaceAlbedo(bounds,nc, &
! only computed over active points.
!
! !USES:
use shr_orb_mod
!use shr_orb_mod
use clm_time_manager , only : get_nstep
use abortutils , only : endrun
use clm_varctl , only : use_subgrid_fluxes, use_snicar_frc, use_fates
Expand Down Expand Up @@ -478,7 +481,9 @@ subroutine SurfaceAlbedo(bounds,nc, &
fabi_sha_z => surfalb_inst%fabi_sha_z_patch & ! Output: [real(r8) (:,:) ] absorbed shaded leaf diffuse PAR (per unit lai+sai) for each canopy layer
)



print*,"PEFORMING ALBEDO"

! Apply column level zenith angles to the patch level
do fp = 1,num_nourbanp
p = filter_nourbanp(fp)
Expand Down
3 changes: 2 additions & 1 deletion src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module clm_driver
use AerosolMod , only : AerosolMasses
use SnowSnicarMod , only : SnowAge_grain
use SurfaceAlbedoMod , only : SurfaceAlbedo
use SurfaceAlbedoMod , only : UpdateZenithAngles
use UrbanAlbedoMod , only : UrbanAlbedo
!
use SurfaceRadiationMod , only : SurfaceRadiation, CanopySunShadeFracs
Expand Down Expand Up @@ -1225,7 +1226,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
! ============================================================================


call UpdateZenithAngles(bounds_clump,surfalb_inst)
call UpdateZenithAngles(bounds_clump,surfalb_inst, nextsw_cday, declinp1)

if (doalb ) then

Expand Down
8 changes: 4 additions & 4 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2813,9 +2813,9 @@ subroutine wrap_canopy_radiation(this, bounds_clump, nc, &
end do

call FatesNormalizedCanopyRadiation( &
this%fates(nc)%sites(s), &
this%fates(nc)%bc_in(s), &
this%fates(nc)%bc_out(s))
this%fates(nc)%sites, &
this%fates(nc)%bc_in, &
this%fates(nc)%bc_out)


! Pass FATES BC's back to HLM
Expand All @@ -2826,7 +2826,7 @@ subroutine wrap_canopy_radiation(this, bounds_clump, nc, &

do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno

p = ifp+col_pp%pfti(c)
p = ifp+col%patchi(c)

albd(p,:) = this%fates(nc)%bc_out(s)%albd_parb(ifp,:)
albi(p,:) = this%fates(nc)%bc_out(s)%albi_parb(ifp,:)
Expand Down

0 comments on commit 2c751e9

Please sign in to comment.