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

Drydeposition working with FATES, ctsm side changes. #87

Closed
wants to merge 6 commits into from
Closed
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
23 changes: 16 additions & 7 deletions src/biogeochem/DryDepVelocity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ subroutine depvel_compute( bounds, &
use pftconMod , only : nc3_nonarctic_grass, nc4_grass, nc3crop
use pftconMod , only : nc3irrig, npcropmin, npcropmax
use clm_varcon , only : spval
use clm_varctl , only : use_fates

!
! !ARGUMENTS:
Expand Down Expand Up @@ -359,6 +360,10 @@ subroutine depvel_compute( bounds, &
errMsg(sourcefile, __LINE__))
end if

if(use_fates)then
wesveg = canopystate_inst%wesley_pft_index_patch(pi)
endif

! create seasonality index used to index wesely data tables from LAI, Bascially
!if elai is between max lai from input data and half that max the index_season=1

Expand All @@ -376,12 +381,12 @@ subroutine depvel_compute( bounds, &
! 4 - Winter, snow on ground and subfreezing
! 5 - Transitional spring with partially green short annuals


!mlaidiff=jan-feb
minlai=minval(annlai(:,pi))
maxlai=maxval(annlai(:,pi))

index_season = -1
if(.not. use_fates)then
!mlaidiff=jan-feb
minlai=minval(annlai(:,pi))
maxlai=maxval(annlai(:,pi))
endif
index_season = -1

if ( lun%itype(l) /= istsoil )then
if ( lun%itype(l) == istice ) then
Expand All @@ -399,10 +404,14 @@ subroutine depvel_compute( bounds, &
end if
else if ( snow_depth(c) > 0 ) then
index_season = 4
else if(elai(pi) > 0.5_r8*maxlai) then
else if(.not.use_fates .and. elai(pi) > 0.5_r8*maxlai) then
index_season = 1
endif

if(use_fates)then
index_season = canopystate_inst%drydep_season_patch(pi)
endif

if (index_season<0) then
if (elai(pi) < (minlai+0.05_r8*(maxlai-minlai))) then
index_season = 3
Expand Down
5 changes: 5 additions & 0 deletions src/biogeophys/CanopyStateType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ module CanopyStateType

real(r8) , pointer :: dleaf_patch (:) ! patch characteristic leaf width (diameter) [m]
! for non-ED/FATES this is the same as pftcon%dleaf()
integer , pointer :: wesley_pft_index_patch (:) ! Wesley PFT index for FATES drydep calculations
integer , pointer :: drydep_season_patch (:) ! Season for dry deposition calculations

real(r8) , pointer :: rscanopy_patch (:) ! patch canopy stomatal resistance (s/m) (ED specific)

real(r8) , pointer :: vegwp_patch (:,:) ! patch vegetation water matric potential (mm)
Expand Down Expand Up @@ -142,6 +145,8 @@ subroutine InitAllocate(this, bounds)
allocate(this%fsun240_patch (begp:endp)) ; this%fsun240_patch (:) = nan

allocate(this%dleaf_patch (begp:endp)) ; this%dleaf_patch (:) = nan
allocate(this%wesley_pft_index_patch (begp:endp)) ; ! is an integer so can't be nan
allocate(this%drydep_season_patch (begp:endp)) ; ! is an integer so can't be nan
allocate(this%rscanopy_patch (begp:endp)) ; this%rscanopy_patch (:) = nan
! allocate(this%gccanopy_patch (begp:endp)) ; this%gccanopy_patch (:) = 0.0_r8
allocate(this%vegwp_patch (begp:endp,1:nvegwcs)) ; this%vegwp_patch (:,:) = nan
Expand Down
7 changes: 6 additions & 1 deletion src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,8 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
z0m => canopystate_inst%z0m_patch , & ! Output: [real(r8) (:) ] momentum roughness length (m)
displa => canopystate_inst%displa_patch, &
dleaf_patch => canopystate_inst%dleaf_patch, &
wesley_pft_index_patch => canopystate_inst%wesley_pft_index_patch, &
drydep_season_patch => canopystate_inst%drydep_season_patch, &
snow_depth => waterdiagnosticbulk_inst%snow_depth_col, &
frac_sno_eff => waterdiagnosticbulk_inst%frac_sno_eff_col, &
frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch)
Expand Down Expand Up @@ -1568,7 +1570,8 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
z0m(col%patchi(c)+1:col%patchf(c)) = 0.0_r8
displa(col%patchi(c)+1:col%patchf(c)) = 0.0_r8
dleaf_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8

wesley_pft_index_patch(col%patchi(c)+1:col%patchf(c)) = 0
drydep_season_patch(col%patchi(c)+1:col%patchf(c)) = 0
frac_veg_nosno_alb(col%patchi(c):col%patchf(c)) = 0.0_r8

! Set the bareground patch indicator
Expand Down Expand Up @@ -1630,6 +1633,8 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
z0m(p) = this%fates(nc)%bc_out(s)%z0m_pa(ifp)
displa(p) = this%fates(nc)%bc_out(s)%displa_pa(ifp)
dleaf_patch(p) = this%fates(nc)%bc_out(s)%dleaf_pa(ifp)
wesley_pft_index_patch(p) = this%fates(nc)%bc_out(s)%wesley_pft_label_pa(ifp)
drydep_season_patch(p) = this%fates(nc)%bc_out(s)%drydep_season_pa(ifp)
end do ! veg pach

if(abs(areacheck - 1.0_r8).gt.1.e-9_r8)then
Expand Down
Loading