Skip to content

Commit

Permalink
edge case debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiealice committed Oct 11, 2024
1 parent e2f7b37 commit 2e2ec4e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
26 changes: 17 additions & 9 deletions src/biogeochem/DryDepVelocity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ subroutine depvel_compute( bounds, &
msg='ERROR: Not able to determine Wesley vegetation type'//&
errMsg(sourcefile, __LINE__))
end if

if(use_fates)then
wesveg = canopystate_inst%wesley_veg_index_patch(pi)
endif
if(patch%is_fates(pi))then
wesveg = canopystate_inst%wesley_veg_index_patch(pi)
else
wesveg = 8
endif
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 Down Expand Up @@ -407,11 +411,15 @@ subroutine depvel_compute( bounds, &
else if(.not.use_fates .and. elai(pi) > 0.5_r8*maxlai) then
index_season = 1
endif

if(use_fates)then
write(iulog,*) 'fates season index',pi,canopystate_inst%wesley_season_index_patch(pi)
index_season = canopystate_inst%wesley_season_index_patch(pi)
else

if(use_fates.and.index_season<1)then
if(patch%is_fates(pi))then
index_season = canopystate_inst%wesley_season_index_patch(pi)
else
index_season = 1 !set arbitrary seson for bare ground.
endif

else ! not fates

if (index_season<0) then
if (elai(pi) < (minlai+0.05_r8*(maxlai-minlai))) then
Expand Down Expand Up @@ -484,14 +492,14 @@ subroutine depvel_compute( bounds, &

! correction for frost
cts = 1000._r8*exp( -tc - 4._r8 )

!ground resistance
rgsx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rgss(index_season,wesveg)+cts))) + &
(foxd(ispec)/(rgso(index_season,wesveg)+cts)))

!-------------------------------------------------------------------------------------
! special case for H2 and CO;; CH4 is set ot a fraction of dv(H2)
!-------------------------------------------------------------------------------------

if( ispec == index_h2 .or. ispec == index_co .or. ispec == index_ch4 ) then

if( ispec == index_co ) then
Expand Down
5 changes: 3 additions & 2 deletions src/main/clm_initializeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ subroutine initialize2(ni,nj)
! Also for FATES with Dry-Deposition on as well (see above)
! For now don't allow for dry-deposition with full fates
! because of issues in #1044 EBK Jun/17/2022
if( use_fates_nocomp .or. (.not. use_fates )) then
if( use_fates_sp .or. (.not. use_fates )) then
if (masterproc) then
write(iulog,'(a)')'Initializing Satellite Phenology'
end if
Expand Down Expand Up @@ -703,7 +703,8 @@ subroutine initialize2(ni,nj)
! Call interpMonthlyVeg for dry-deposition so that mlaidiff will be calculated
! This needs to be done even if FATES, CN or CNDV is on!
call interpMonthlyVeg(bounds_proc, canopystate_inst)
elseif ( use_fates_sp ) then
endif
if ( use_fates_sp ) then
! If fates has satellite phenology enabled, get the monthly veg values
! prior to the first call to SatellitePhenology()
call interpMonthlyVeg(bounds_proc, canopystate_inst)
Expand Down
12 changes: 6 additions & 6 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,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, &
wesley_veg_index_patch => canopystate_inst%wesley_veg_index_patch, &
wesley_season_index_patch => canopystate_inst%wesley_season_index_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 @@ -1610,8 +1610,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
wesley_veg_index_patch(col%patchi(c)+1:col%patchf(c)) = 0
wesley_season_index_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 @@ -1673,8 +1673,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)
wesley_veg_index_patch(p) = this%fates(nc)%bc_out(s)%wesley_pft_label_pa(ifp)
wesley_season_index_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

0 comments on commit 2e2ec4e

Please sign in to comment.