Skip to content

Commit

Permalink
Allow partially-tilled soil layers.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Aug 21, 2023
1 parent 86b81fb commit 69451e2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/soilbiogeochem/TillageMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,16 @@ subroutine get_apply_tillage_multipliers(idop, c, j, decomp_k)
real :: sumwt ! sum of all patch weights, to check
real(r8), dimension(ndecomp_pools) :: tillage_mults
real(r8), dimension(ndecomp_pools) :: tillage_mults_1patch
real(r8) :: layer_top ! Depth (cm) of the top of this soil layer. zisoi is the depth of the bottom.
real(r8) :: layer_thickness ! Thickness of this soil layer (m)
real(r8) :: fraction_tilled ! Fraction of this layer that's within the tillage depth

! TODO: Allow partially-tilled layers.
if (.not. col%active(c) .or. zisoi(j) > max_tillage_depth) then
if (j == 1) then
layer_top = 0._r8
else
layer_top = zisoi(j-1)
end if
if (.not. col%active(c) .or. layer_top > max_tillage_depth) then
return
end if

Expand Down Expand Up @@ -301,6 +308,12 @@ subroutine get_apply_tillage_multipliers(idop, c, j, decomp_k)
call endrun('ERROR Active crop patch weights does not sum to 1')
end if

! Adjust tillage_mults to consider fraction of this layer that's within tillage depth
layer_thickness = zisoi(j) - layer_top
fraction_tilled = max(0._r8, min(1._r8, (max_tillage_depth - layer_top) / layer_thickness))
tillage_mults = tillage_mults * fraction_tilled &
+ 1._r8 * (1._r8 - fraction_tilled)

! Apply
decomp_k = decomp_k * tillage_mults(:)

Expand Down

0 comments on commit 69451e2

Please sign in to comment.