Skip to content

Commit 2cd146a

Browse files
Bugfix: Introducing nested if-conditions in ch4Mod (#69)
* Fix subroutine ch4_tran by introducing two nested if-conditions Related to issue #68 #68 (comment) See also the error messages mentioned in issue comments - #68 (comment) - #68 (comment) --------- Co-authored-by: AGonzalezNicolas <[email protected]>
1 parent c143e2c commit 2cd146a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/clm5/biogeochem/ch4Mod.F90

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,12 +2473,14 @@ subroutine ch4_prod (bounds, num_methc, filter_methc, num_methp, &
24732473
end if
24742474

24752475
! If switched on, use pH factor for production based on spatial pH data defined in surface data.
2476-
if (.not. lake .and. usephfact .and. pH(c) > pHmin .and.pH(c) < pHmax) then
2476+
if (.not. lake .and. usephfact) then
2477+
if (pH(c) > pHmin .and.pH(c) < pHmax) then
24772478
pH_fact_ch4 = 10._r8**(-0.2235_r8*pH(c)*pH(c) + 2.7727_r8*pH(c) - 8.6_r8)
24782479
! fitted function using data from Dunfield et al. 1993
24792480
! Strictly less than one, with optimum at 6.5
24802481
! From Lei Meng
24812482
f_ch4_adj = f_ch4_adj * pH_fact_ch4
2483+
end if
24822484
else
24832485
! if no data, then no pH effects
24842486
end if
@@ -3552,10 +3554,11 @@ subroutine ch4_tran (bounds, &
35523554
pondz = h2osfc(c) / 1000._r8 / frac_h2osfc(c) ! Assume all h2osfc corresponds to sat area
35533555
! mm / mm/m
35543556
pondres = pondres + pondz / ponddiff
3555-
else if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8 .and. &
3556-
h2osfc(c)/frac_h2osfc(c) > capthick) then ! Assuming short-circuit logic will avoid FPE here.
3557+
else if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8) then
3558+
if (h2osfc(c)/frac_h2osfc(c) > capthick) then ! Assuming short-circuit logic will avoid FPE here.
35573559
! assume surface ice is impermeable
35583560
pondres = 1/smallnumber
3561+
end if
35593562
end if
35603563

35613564
spec_grnd_cond(c,s) = 1._r8/(1._r8/grnd_ch4_cond(c) + snowres(c) + pondres)

0 commit comments

Comments
 (0)