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

ASM2d/ADM1 Translator Update #1315

Merged
merged 13 commits into from
Feb 28, 2024

Conversation

MarcusHolly
Copy link
Contributor

Summary/Motivation:

This PR decouples the translator block configuration argument (previously DecaySwitch), and introduces a separate configuration option under the name BioP.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@MarcusHolly MarcusHolly self-assigned this Feb 27, 2024
@MarcusHolly MarcusHolly added the Priority:Normal Normal Priority Issue or PR label Feb 27, 2024
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.42%. Comparing base (b2d1588) to head (9ba25b6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1315      +/-   ##
==========================================
+ Coverage   94.41%   94.42%   +0.01%     
==========================================
  Files         370      370              
  Lines       37753    37740      -13     
==========================================
- Hits        35645    35637       -8     
+ Misses       2108     2103       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarcusHolly MarcusHolly marked this pull request as ready for review February 27, 2024 13:08
@@ -150,8 +150,8 @@ Equations and Relationships (With Decay)
"S_K concentration", ":math:`S_{K, 6} = S_{K, in} + (K_{XPP} * X_{PP, in})`"
"S_Mg concentration", ":math:`S_{Mg, 6} = S_{Mg, in} + (Mg_{XPP} * X_{PP, in})`"

Equations and Relationships (Without Decay)
-------------------------------------------
Equations and Relationships (with phosphorus biomass handled implicitly)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of these should be labeled without biological phosphorus removal and the other with

Comment on lines 59 to 63
class BioP(Enum):
on = auto()
off = auto()


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BioP(Enum):
on = auto()
off = auto()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can handle this without an Enum class (same for decay switch)

Comment on lines 75 to 76
default=BioP.on,
domain=In(BioP),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default=BioP.on,
domain=In(BioP),
default=True,
domain=Bool,

Comment on lines 86 to 87
"``BioP.on``", "All the BioP variables are supposed to be transformed in the interface"
"``BioP.off``", "All the BioP variables are kinetically described within the ADM"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to True/False instead of Enum options


# -------------------------------------------Step 4----------------------------------------------------------------#
if self.config.inlet_reaction_package.config.decay_switch == DecaySwitch.on:
if self.config.bio_P == BioP.on:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.config.bio_P == BioP.on:
if self.config.bio_P:


# -----------------------------------------Step 4--------------------------------------------------------------#
elif self.config.inlet_reaction_package.config.decay_switch == DecaySwitch.off:
elif self.config.bio_P == BioP.off:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif self.config.bio_P == BioP.off:
elif not self.config.bio_P:


# -----------------------------------------Step 4--------------------------------------------------------------#
elif self.config.inlet_reaction_package.config.decay_switch == DecaySwitch.off:
elif self.config.bio_P == BioP.off:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't see it with all the truncating that Github does, but it could be good to have an else here or following this. If the logic really only comes down to Bio_P being True or False, then this could just be else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an else - I'll add it here

@@ -111,8 +111,8 @@ Equations and Relationships
"S_PO4 concentration", ":math:`S_{PO4, 3} = S_{PO4, 2} + (S_{F, in} * i_{PSF})`"
"S_IC concentration", ":math:`S_{IC, 3} = S_{IC, 2} + (S_{F, in} * i_{CSF}) - (S_{su} * Ci[S_{su}] * 1000 * 12) - (S_{aa} * Ci[S_{aa}] * 1000 * 12)`"

Equations and Relationships (With Decay)
----------------------------------------
Equations and Relationships (with biological phosphorus removal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is Decay omitted for the time being or is it somewhere else in this file and associated code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of the word decay was inaccurate to begin with. That is entirely handled in the reaction package (depending on whether the DecaySwitch is on(True) or off (False). Not sure if that answers your question...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it- the decay switch isn't applied in the translator but is applied in the reaction package. Thanks!

Copy link
Contributor

@luohezhiming luohezhiming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@agarciadiego agarciadiego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

default=DecaySwitch.on,
domain=In(DecaySwitch),
default=True,
domain=Bool,
description="Switching function for decay",
doc="""
Switching function for handling decay in reaction rate expressions.

**default** - `DecaySwitch.on``

.. csv-table::
:header: "Configuration Options", "Description"

"``DecaySwitch.on``", "The decay of heterotrophs and autotrophs is dependent on the electron acceptor present"
"``DecaySwitch.off``", "The decay of heterotrophs and autotrophs does not change"
""",
doc="""Switching function for handling decay in reaction rate expressions,
**default** - True.
**Valid values:** {
**True** - the decay of heterotrophs and autotrophs is dependent on the electron acceptor present,
**False** - the decay of heterotrophs and autotrophs does not change""",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcusHolly Does this need to be updated on the technical ref ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is updated automatically
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspected this but didn't check if any manually written description conflicted with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manual descriptions of decay are all still accurate I believe.

Copy link
Contributor

@adam-a-a adam-a-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - we may want to double-check that changes are reflected in documentation accurately, particularly for the modified asm2d rxn tech ref.

@adam-a-a adam-a-a enabled auto-merge (squash) February 28, 2024 16:46
@adam-a-a adam-a-a merged commit 421d21f into watertap-org:main Feb 28, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants