Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing itype as spval for fates patches #2935

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/biogeophys/SurfaceAlbedoMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -864,23 +864,6 @@ subroutine SurfaceAlbedo(bounds,nc, &
end if
end do

! Weight reflectance/transmittance by lai and sai
! Only perform on vegetated patches where coszen > 0

do fp = 1,num_vegsol
p = filter_vegsol(fp)
wl(p) = elai(p) / max( elai(p)+esai(p), mpe )
ws(p) = esai(p) / max( elai(p)+esai(p), mpe )
end do

do ib = 1, numrad
do fp = 1,num_vegsol
p = filter_vegsol(fp)
rho(p,ib) = max( rhol(patch%itype(p),ib)*wl(p) + rhos(patch%itype(p),ib)*ws(p), mpe )
tau(p,ib) = max( taul(patch%itype(p),ib)*wl(p) + taus(patch%itype(p),ib)*ws(p), mpe )
end do
end do

! Diagnose number of canopy layers for radiative transfer, in increments of dincmax.
! Add to number of layers so long as cumulative leaf+stem area does not exceed total
! leaf+stem area. Then add any remaining leaf+stem area to next layer and exit the loop.
Expand Down Expand Up @@ -1051,7 +1034,24 @@ subroutine SurfaceAlbedo(bounds,nc, &
fcansno(bounds%begp:bounds%endp), surfalb_inst)

else


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, so this is another place where this caught this pattern that was being done for FATES, and now you have it only done outside of FATES.

! Weight reflectance/transmittance by lai and sai
! Only perform on vegetated patches where coszen > 0

do fp = 1,num_vegsol
p = filter_vegsol(fp)
wl(p) = elai(p) / max( elai(p)+esai(p), mpe )
ws(p) = esai(p) / max( elai(p)+esai(p), mpe )
end do

do ib = 1, numrad
do fp = 1,num_vegsol
p = filter_vegsol(fp)
rho(p,ib) = max( rhol(patch%itype(p),ib)*wl(p) + rhos(patch%itype(p),ib)*ws(p), mpe )
tau(p,ib) = max( taul(patch%itype(p),ib)*wl(p) + taus(patch%itype(p),ib)*ws(p), mpe )
end do
end do

call TwoStream (bounds, filter_vegsol, num_vegsol, &
coszen_patch(bounds%begp:bounds%endp), &
rho(bounds%begp:bounds%endp, :), &
Expand Down
22 changes: 15 additions & 7 deletions src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module clm_driver
use clm_time_manager , only : get_nstep, is_beg_curr_day, is_beg_curr_year
use clm_time_manager , only : get_prev_date, is_first_step
use clm_varpar , only : nlevsno, nlevgrnd
use clm_varcon , only : spval
use clm_varorb , only : obliqr
use spmdMod , only : masterproc, mpicom
use decompMod , only : get_proc_clumps, get_clump_bounds, get_proc_bounds, bounds_type
Expand Down Expand Up @@ -704,16 +705,23 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
! bugs.
allocate(downreg_patch(bounds_clump%begp:bounds_clump%endp))
allocate(leafn_patch(bounds_clump%begp:bounds_clump%endp))
downreg_patch = bgc_vegetation_inst%get_downreg_patch(bounds_clump)
leafn_patch = bgc_vegetation_inst%get_leafn_patch(bounds_clump)

allocate(froot_carbon(bounds_clump%begp:bounds_clump%endp))
allocate(croot_carbon(bounds_clump%begp:bounds_clump%endp))
froot_carbon = bgc_vegetation_inst%get_froot_carbon_patch( &
bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp))
croot_carbon = bgc_vegetation_inst%get_croot_carbon_patch( &
bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp))

if(use_fates)then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add a comment to this about why this is being done. Also try using nan rather than spval.

downreg_patch(:) = spval
leafn_patch(:) = spval
froot_carbon(:) = spval
croot_carbon(:) = spval
else
downreg_patch = bgc_vegetation_inst%get_downreg_patch(bounds_clump)
leafn_patch = bgc_vegetation_inst%get_leafn_patch(bounds_clump)
froot_carbon = bgc_vegetation_inst%get_froot_carbon_patch( &
bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp))
croot_carbon = bgc_vegetation_inst%get_croot_carbon_patch( &
bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp))
end if

call CanopyFluxes(bounds_clump, &
filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, &
clm_fates,nc, &
Expand Down
2 changes: 1 addition & 1 deletion src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ subroutine init(this, bounds_proc, flandusepftdat)
c = this%f2hmap(nc)%fcolumn(s)
pi = col%patchi(c)+1
pf = col%patchf(c)
! patch%itype(pi:pf) = ispval
patch%itype(pi:pf) = ispval
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a note about why this is being done, and what it will do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, the comments on 925-927 explain what is going on already.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me update the text a little though, its not as clear as it could be

patch%is_fates(pi:pf) = .true.
end do

Expand Down
Loading