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

Phosphorus, N2, POM, and PX #88

Merged
merged 11 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
8 changes: 4 additions & 4 deletions examples/dev_sandbox/DOX_sat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def DOs_atm_alpha(

def DOX_sat(
TwaterK: xr.DataArray,
pressure_atm: xr.DataArray,
pressure_mb: xr.DataArray,
pwv: xr.DataArray,
DOs_atm_alpha: xr.DataArray
) -> xr.DataArray:
"""Calculate DO saturation value

Args:
TwaterK: Water temperature kelvin
pressure_atm: Atmospheric pressure (atm)
pressure_mb: Atmospheric pressure (mb)
pwv: Patrial pressure of water vapor (atm)
DOs_atm_alpha: DO saturation atmospheric correction coefficient
"""
Expand All @@ -44,8 +44,8 @@ def DOX_sat(

DOX_sat_uncorrected = -139.34410 + ( 1.575701E05 / TwaterK ) - ( 6.642308E07 / (TwaterK**2.0) ) + ( 1.243800E10 / (TwaterK**3.0) ) - ( 8.621949E11 / (TwaterK**4.0) )

DOX_sat_corrected = DOX_sat_uncorrected * pressure_atm * \
(1 - pwv / pressure_atm) * (1 - DOs_atm_alpha * pressure_atm) / \
DOX_sat_corrected = DOX_sat_uncorrected * pressure_mb * \
(1 - pwv / pressure_mb) * (1 - DOs_atm_alpha * pressure_mb) / \
((1 - pwv) * (1 - DOs_atm_alpha))

print(no_exp)
Expand Down
10 changes: 5 additions & 5 deletions examples/dev_sandbox/model_architecture_nsm.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/dev_sandbox/prof_nsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
'topwidth': 1,
'slope': 2,
'shear_velocity': 4,
'pressure_atm': 2,
'pressure_mb': 2026.5,
'wind_speed': 4,
'q_solar': 4,
'Solid': 1,
Expand Down
32 changes: 17 additions & 15 deletions src/clearwater_modules/nsm1/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class BalgaeStaticVariables(TypedDict):
krb_20=0.2,
kdb_20=0.3,
mub_max_theta = 1.047,
krb_theta = 1.047,
krb_theta = 1.06,
kdb_theta = 1.047,
b_growth_rate_option=1,
b_light_limitation_option=1,
Expand Down Expand Up @@ -130,11 +130,11 @@ class NitrogenStaticVariables(TypedDict):
kdnit_20=0.002,
rnh4_20=0,
vno3_20=0,
knit_theta= 1.047, ## Check values RAS/Kelsey's
kon_theta= 1.047,
kdnit_theta= 1.047,
knit_theta= 1.083,
kon_theta= 1.074,
kdnit_theta= 1.08,
rnh4_theta= 1.047,
vno3_theta= 1.047,
vno3_theta= 1.045,
KsOxdn=0.1,
PN=0.5,
PNb=0.5
Expand All @@ -156,10 +156,10 @@ class CarbonStaticVariables(TypedDict):
DEFAULT_CARBON = CarbonStaticVariables(
f_pocp = 0.9,
kdoc_20= 0.01,
kdoc_theta = 1.047,
f_pocb=0.9,
kpoc_20= 0.005,
kpoc_theta = 1.047,
kdoc_theta = 1.047,
KsOxmc=1.0,
pCO2 = 383.0,
FCO2 = 0.2,
Expand Down Expand Up @@ -200,10 +200,12 @@ class N2StaticVariables(TypedDict):

class POMStaticVariables(TypedDict):
kpom_20: float
h2: float
kpom_theta: float

DEFAULT_POM = POMStaticVariables(
kpom_20 = 0.1,
h2=0.1,
kpom_theta = 1.047
)

Expand All @@ -216,7 +218,7 @@ class PathogenStaticVariables(TypedDict):

DEFAULT_PATHOGEN = PathogenStaticVariables(
kdx_20=0.8,
kdx_theta = 1.047,
kdx_theta = 1.07,
apx=1,
vx=1
)
Expand All @@ -232,7 +234,7 @@ class PhosphorusStaticVariables(TypedDict):
kop_20 = 0.1,
rpo4_20 =0,
kop_theta = 1.047,
rpo4_theta = 1.047,
rpo4_theta = 1.074,
kdpo4 = 0.0,
)

Expand Down Expand Up @@ -299,7 +301,7 @@ class GlobalVars(TypedDict):
topwidth: float
slope: float
shear_velocity: float
pressure_atm: float
pressure_mb: float
wind_speed: float
q_solar: float
Solid: int
Expand All @@ -319,24 +321,24 @@ class GlobalVars(TypedDict):
vs = 999,
SOD_20 = 999,
SOD_theta = 999,
theta=1.047,
vb = 0.01,
fcom = 0.4,
kaw_20_user = 999,
kah_20_user = 999,
kaw_theta = 1.047,
kah_theta = 1.047,
hydraulic_reaeration_option = 2,
wind_reaeration_option = 2,
kaw_theta = 1.024,
kah_theta = 1.024,
hydraulic_reaeration_option = 1,
wind_reaeration_option = 1,
dt = 1, #TODO Dynamic or static?
depth = 1.5, #TODO Dynamic or static?
TwaterC = 20,
theta = 1.047,
velocity = 1,
flow = 2,
topwidth = 1,
slope = 2,
shear_velocity = 4,
pressure_atm = 2,
pressure_mb = 2026.5,
wind_speed = 4,
q_solar = 500,
Solid = 1,
Expand Down
8 changes: 0 additions & 8 deletions src/clearwater_modules/nsm1/dynamic_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1371,14 +1371,6 @@ class Variable(base.Variable):
process=processes.KHN2_tc
)

Variable(
name='P_wv',
long_name='Partial pressure water vapor',
units='atm',
description='Partial pressure water vapor',
use='dynamic',
process=processes.P_wv
)

Variable(
name='N2sat',
Expand Down
Loading
Loading