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

OARO flowsheet #829

Merged
merged 32 commits into from
Nov 18, 2022
Merged

OARO flowsheet #829

merged 32 commits into from
Nov 18, 2022

Conversation

luohezhiming
Copy link
Contributor

@luohezhiming luohezhiming commented Oct 28, 2022

Fixes/Resolves:

Summary/Motivation:

Implement OARO flowsheet
Thank @bknueven for providing valueble help for initialization routine for this flowsheet

Changes proposed in this PR:

  • add one-stage OARO flowsheet
  • add tests

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.

@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Merging #829 (d8f2796) into main (8416050) will decrease coverage by 0.04%.
The diff coverage is 90.36%.

@@            Coverage Diff             @@
##             main     #829      +/-   ##
==========================================
- Coverage   95.47%   95.42%   -0.05%     
==========================================
  Files         258      259       +1     
  Lines       24876    25094     +218     
==========================================
+ Hits        23750    23947     +197     
- Misses       1126     1147      +21     
Impacted Files Coverage Δ
watertap/examples/flowsheets/oaro/oaro.py 90.36% <90.36%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Nov 3, 2022
@luohezhiming luohezhiming requested a review from bknueven November 8, 2022 16:40
@luohezhiming luohezhiming changed the title Draft for OARO flowsheet OARO flowsheet Nov 17, 2022
Copy link
Contributor

@bknueven bknueven left a comment

Choose a reason for hiding this comment

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

I guess for optimization we need an OARO costing method? Might be best to leave it for after #835 is merged.

Copy link
Contributor

@bknueven bknueven left a comment

Choose a reason for hiding this comment

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

Looks good. Let's add costing and optimization later.

Comment on lines +272 to +282
# initial guess for states of pump 3 output (temperature and concentrations)
m.fs.P3.control_volume.properties_out[0].temperature.value = feed_temperature
permeate_flow_mass = 0.75
permeate_mass_frac_NaCl = 0.015
permeate_mass_frac_H2O = 1 - permeate_mass_frac_NaCl
m.fs.P3.control_volume.properties_out[0].flow_mass_phase_comp[
"Liq", "H2O"
].value = (permeate_flow_mass * permeate_mass_frac_H2O)
m.fs.P3.control_volume.properties_out[0].flow_mass_phase_comp[
"Liq", "NaCl"
].value = (permeate_flow_mass * permeate_mass_frac_NaCl)
Copy link
Contributor

Choose a reason for hiding this comment

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

Much better than my hand-tuned values!

@luohezhiming
Copy link
Contributor Author

Looks good. Let's add costing and optimization later.

Yeah, right now, we don't have costing method for OARO model, so we might add it later.

# Control volume flow blocks
m.fs.feed = Feed(property_package=m.fs.properties)
m.fs.product = Product(property_package=m.fs.properties)
m.fs.product2 = Product(property_package=m.fs.properties)
Copy link
Contributor

@MarcusHolly MarcusHolly Nov 18, 2022

Choose a reason for hiding this comment

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

The product2 can be deleted now. I originally added this when we were playing around with constructing the flowsheet one unit at a time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted

Comment on lines 243 to 244
pressure_atmospheric = 101325
feed_pressure = pressure_atmospheric
Copy link
Contributor

@MarcusHolly MarcusHolly Nov 18, 2022

Choose a reason for hiding this comment

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

Seems like only one of these should be here?

from watertap.unit_models.pressure_changer import Pump, EnergyRecoveryDevice
from watertap.core.util.initialization import assert_degrees_of_freedom
from watertap.costing import WaterTAPCosting

Copy link
Contributor

@MarcusHolly MarcusHolly Nov 18, 2022

Choose a reason for hiding this comment

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

Seems like some of these imports are unused and can be deleted (SequentialDecomposition, MomentumMixingType, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I cleaned up redundant imports

Copy link
Contributor

@MarcusHolly MarcusHolly left a comment

Choose a reason for hiding this comment

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

LGTM - just made a few comments about cleaning up the code.

@bknueven bknueven enabled auto-merge (squash) November 18, 2022 18:47
@bknueven bknueven merged commit d238293 into watertap-org:main Nov 18, 2022
lbibl pushed a commit to lbibl/watertap that referenced this pull request Dec 1, 2022
* Add gui

* delete redundant GLSD UI code

* Draft PR for OARO flowsheet

* troubleshoot OARO flowsheet

* DOF = 0 resolved; solving flowsheet unsuccessful; issue related to OARO or pump/ERDs

* troubleshooting flowsheet

* modify test file

* half flowsheet

* Revise code

* Revise OARO model

* Add test

* Revise OARO

* testing main for coverage

Co-authored-by: adam-a-a <aatia@keylogic.com>
Co-authored-by: Bernard Knueven <Bernard.Knueven@nrel.gov>
bknueven pushed a commit that referenced this pull request Dec 14, 2022
* save work

* save unfinished work- nonohmic, diffusion layer in places

* save work

* save work, initial solvable version!

* save work

* membrane diffusion and water osmosis under polarizaiontion refined

* save work, all working property

* first finalized ed1d refinement with tests

* typo correction

* improve fs opt

* test opt bound

* rename i_lim configvalue

* typo fix  and rename set

* all pressure drop dimensionless quantity and friction methods added

* fix impacts on existing ed fs

* fix doc building bug

* test opt in win

* test opt numps solver

* save work, add pressure changes in 1d-cv

* save work, modify init routine

* added and tested cv1d deltaP, addressed comments

* add a configerror test

* fixed a missing sf to improve solving for mumps

* change a var name

* added two additional i_lim methods

* improved model structure and scaling

* Add CITATION file for GitHub

* Fix date released

* Add text to use for reference

* Use entity name for WaterTAP authors

* Isothermal 0DRO (#846)

* changing 0DRO to be isothermal like 1DRO

* updating tests

* updating OARO

* updating RO default configuration yaml

* update seawater RO baselines

* update dye desal baselines

* update NF bypass twostage baseline

* update dye desal baselines; again

* OARO Modeling & Initialization (#841)

* setting constraint scaling transform for small membrane channel constraints

* adjusting RO initialization

* restoring custom interface initialization

* fixing bug in new initializer

* updating test_Pdrop_calculated

* fixing cp modulus guess

* updating testing baseline

* tweaking initialization

* move dens_solvent scaling to base class

* fixing bug with MC initialization

* Revert "tweaking initialization"

This reverts commit e015406.

* updating baselines, again

* removing enthalpy from OARO

* removing unneeded import

* undoing membrane channel constraint scaling

* replacing explicit calls to properties_in/properties_out with 1D versions

* Seawater Ion Generic Documentation (#808)

* Test that each ZO model has a ZO doc

* Adds files that were missed in original commit

* Incorporates Ludovico's suggestions

* Minor changes to address comments

* Excel updatted properly now

* Constructed wetlands rst update

* revert changes made in last commit

* Revert "revert changes made in last commit"

This reverts commit 91711ed.

* hardcoding list place

* Preliminary documentation for seawater_ion_generic

* Cl_1- changed to Cl\_-

* Gets rid of extra properties table

* Update index

* Scaling description revised

* Update prop pack description

* Adds additional properties

* Fixes syntax error

* Fixes another syntax error

* Updates introduction to further explain the connection with IDAES

* Updates introduction to further explain the connection with IDAES

Co-authored-by: Bernard Knueven <Bernard.Knueven@nrel.gov>
Co-authored-by: Keith Beattie <ksbeattie@lbl.gov>

* OARO flowsheet (#829)

* Add gui

* delete redundant GLSD UI code

* Draft PR for OARO flowsheet

* troubleshoot OARO flowsheet

* DOF = 0 resolved; solving flowsheet unsuccessful; issue related to OARO or pump/ERDs

* troubleshooting flowsheet

* modify test file

* half flowsheet

* Revise code

* Revise OARO model

* Add test

* Revise OARO

* testing main for coverage

Co-authored-by: adam-a-a <aatia@keylogic.com>
Co-authored-by: Bernard Knueven <Bernard.Knueven@nrel.gov>

* fixing getting started links (#852)

This addresses #844 by changing them from "latest" to "stable".

I also when doing this changed our ReadTheDocs config so that the default is to point to "stable" (which will be the most recent tagged release) rather than "latest" (which is whatever is on the main branch at the time).

* Remove idaes solver directives (#836)

* removing solver requirement from zero order models

* removing in units and full_treatment_train

* Differential Parameter Sweep Sampling (#806)

* Property Package Constraint Indexing & Utility Function Update (#837)

* Update constraint indexing in water prop pack

* Initial seawater prop pack changes

* Change utility function of seawater prop pack

* Updates indexing and utility functions for prop packs

* Addresses issues with parameters in the utility function

* Makes utility function for transforming property constraints

* Update watertap/core/util/scaling.py

Co-authored-by: bknueven <30801372+bknueven@users.noreply.github.com>

* Update scaling.py

* fixing import

* rebase main, resolve conflicts

* resolve conflicts

* Reorganzing the WaterTAP Costing Package (#835)

* adding working proof-of-concept

* using  attribute

* better error handling

* better example

* hard coding year

* separating remaining units

* costing flows on costing package

* adding init to new dir

* fixing simple erros

* cleaning up imports

* fixing flowsheets

* a few more imports

* setting up to move flows in with units

* fixing import

* moving non-electricity flow definition

* fixing bug in cost_reverse_osmosis

* fixing costing module tests

* fixing electrodialysis 0D tests

* fixing bug in dye_desalination_ui

* cleanup

* testing _DefinedFlowsDict

* adding test for register_costing_parameter_block

* ensuring unit-level costs are convert to base currency

* doing conversions correctly

* removing base_currency update

* fixing units in ion_exchange

* updating ion exchange baselines

* updating UV AOP baselines

* fixing merge conflict mistake

* modify var bound in optmizaiton

* modify var bound in optmizaiton

* modify upper bounds of some vars

* remove upper bounds and format

* Empty commit to trigger CI
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.

5 participants