Skip to content

Commit

Permalink
Merge pull request #85 from EcohydrologyTeam/KW_NitrogenTesting
Browse files Browse the repository at this point in the history
Balgae Testing (and one Nitrogen Test)
  • Loading branch information
sjordan29 authored May 13, 2024
2 parents ec0d3d0 + 0ff1eff commit 190c12a
Show file tree
Hide file tree
Showing 39 changed files with 2,537 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def mub_max_tc(
"""Calculate mub_max_tc: Maximum benthic algal growth rate with temperature correction (1/d).
Args:
mu_max_20: Maximum benthic algal growth rate at 20C (1/d)
mub_max_20: Maximum benthic algal growth rate at 20C (1/d)
TwaterC: Water temperature (C)
"""
return arrhenius_correction(TwaterC, mub_max_20, 1.047)
Expand Down Expand Up @@ -162,7 +162,7 @@ def FNb(
"""
FNb = xr.where(use_NH4 or use_NO3, (NH4 + NO3) / (KsNb + NH4 + NO3),1)
FNb = xr.where(math.isnan(FNb),0.0,
xr.where(FNb < 1.0, 1, FNb))
xr.where(FNb > 1.0, 1, FNb))

return FNb

Expand Down Expand Up @@ -230,12 +230,12 @@ def mub(
FPb: Benthic algae phosphorous limitation (unitless)
FNb: Benthic algae nitrogen limitation (unitless)
FSb: Benthic density attenuation (unitless),
"""
"""

# Benthic Local Specific Growth Rate
return xr.where(b_growth_rate_option == 1, mub_max_tc * FLb * FPb * FNb * FSb, mub_max_tc * FLb * FSb * min(FPb, FNb))


#TODO RAS WQ has an option for harmonic which the FORTAN code does not have

@numba.njit
def AbGrowth(
Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions src/clearwater_modules/nsm1/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def mub_max_tc(
"""Calculate mub_max_tc: Maximum benthic algal growth rate with temperature correction (1/d).
Args:
mu_max_20: Maximum benthic algal growth rate at 20C (1/d)
mub_max_20: Maximum benthic algal growth rate at 20C (1/d)
TwaterC: Water temperature (C)
"""
return arrhenius_correction(TwaterC, mub_max_20, 1.047)
Expand Down Expand Up @@ -1169,7 +1169,7 @@ def kon_tc(
kon_20: Decay rate of OrgN to NH4 (1/d)
"""

return arrhenius_correction(TwaterC, kon_20, 1.074)
return arrhenius_correction(TwaterC, kon_20, 1.047)



Expand Down Expand Up @@ -1490,6 +1490,8 @@ def NH4_ApGrowth(
def NH4_AbRespiration(
use_Balgae: bool,
rnb: xr.DataArray,
Fb: xr.DataArray,
depth: xr.DataArray,
AbRespiration: xr.DataArray,

) -> xr.DataArray:
Expand All @@ -1499,10 +1501,12 @@ def NH4_AbRespiration(
use_Balgae: true/false to use benthic algae module (unitless),
rnb: xr.DataArray,
AbRespiration: Benthic algal respiration rate (g/m^2/d),
depth: water depth (m),
Fb: Fraction of bottom area for benthic algae (unitless),
"""
# TODO changed the calculation for respiration from the inital FORTRAN due to conflict with the reference guide

return xr.where(use_Balgae, rnb * AbRespiration, 0.0 )
return xr.where(use_Balgae, (rnb * AbRespiration*Fb)/depth, 0.0 )

def NH4_AbGrowth(
use_Balgae: bool,
Expand Down
Loading

0 comments on commit 190c12a

Please sign in to comment.