Skip to content

Commit

Permalink
avoid division by zero in case of zero oxygen (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaerz authored Feb 14, 2025
1 parent 81cc72f commit c8d519a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hamocc/mo_extNsediment.F90
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ subroutine sed_nitrification(j,kpie,kpje,kpke,kbnd,ptho,omask,ex_ddic,ex_dalk)
fdetamox = 1. - (fn2o + fno2)

! NO2 oxidizing step of nitrification
Tdepano2 = q10ano2nitr_sed**((temp-Trefano2nitr_sed)/10.)
Tdepano2 = q10ano2nitr_sed**((temp-Trefano2nitr_sed)/10.)
O2limano2 = powtra(i,j,k,ipowaox)/(powtra(i,j,k,ipowaox) + bkoxnitr_sed)
nut2lim = powtra(i,j,k,ipowno2)/(powtra(i,j,k,ipowno2) + bkano2nitr_sed)
ano2new = powtra(i,j,k,ipowno2)/(1. + rano2nitr_sed*Tdepano2*O2limano2*nut2lim)
Expand All @@ -186,7 +186,7 @@ subroutine sed_nitrification(j,kpie,kpje,kpke,kbnd,ptho,omask,ex_ddic,ex_dalk)
no2fdetamox = NOB2AOAy_sed*n2omaxy_sed*2.*(1. + n2oybeta_sed)*powtra(i,j,k,ipowaox)*bkyamox_sed &
& /(powtra(i,j,k,ipowaox)**2 + 2.*powtra(i,j,k,ipowaox)*bkyamox_sed + bkyamox_sed**2)

fdetnitr = no2fdetamox/(no2fno2 + no2fn2o) ! yield to energy usage ratio for NO2 -> ratio equals 16:x
fdetnitr = no2fdetamox/(no2fno2 + no2fn2o + eps) ! yield to energy usage ratio for NO2 -> ratio equals 16:x

! limitation of the two processes through available nutrients, etc.
totd = potdnh4amox + potdno2nitr
Expand Down
4 changes: 2 additions & 2 deletions hamocc/mo_extNwatercol.F90
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ subroutine nitrification(kpie,kpje,kpke,kbnd,pddpo,omask,ptho)
no2fdetamox = NOB2AOAy*n2omaxy*2.*(1. + n2oybeta)*ocetra(i,j,k,ioxygen)*bkyamox &
& /(ocetra(i,j,k,ioxygen)**2 + 2.*ocetra(i,j,k,ioxygen)*bkyamox + bkyamox**2)

fdetnitr = no2fdetamox/(no2fno2 + no2fn2o) ! yield to energy usage ratio for NO2 -> ratio equals 16:x
fdetnitr = no2fdetamox/(no2fno2 + no2fn2o + eps) ! yield to energy usage ratio for NO2 -> ratio equals 16:x


! limitation of the two processes through available nutrients, etc.
Expand Down Expand Up @@ -217,7 +217,7 @@ subroutine denit_NO3_to_NO2(kpie,kpje,kpke,kbnd,pddpo,omask,ptho)
integer :: i,j,k
real :: Tdep,O2inhib,nutlim,ano3new,ano3denit,temp

! Sett output-related field to zero
! Set output-related field to zero
denit_NO3 = 0.

!$OMP PARALLEL DO PRIVATE(i,k,Tdep,O2inhib,nutlim,ano3new,ano3denit,temp)
Expand Down

0 comments on commit c8d519a

Please sign in to comment.