Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balgae Testing (and one Nitrogen Test) #85

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading