-
Notifications
You must be signed in to change notification settings - Fork 191
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
Bug fix in roughness unit conversion when using D-W #450
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These updates look good. I approve.
@@ -571,7 +571,7 @@ def _to_si(self, flow_units, data, darcy_weisbach=False): | |||
|
|||
elif self in [HydParam.RoughnessCoeff] and darcy_weisbach: | |||
if flow_units.is_traditional: | |||
data = data * (1000.0 * 0.3048) # 1e-3 ft to m | |||
data = data * (0.001 * 0.3048) # 1e-3 ft to m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worked out the conversion and agree with this change.
@@ -668,7 +668,7 @@ def _from_si(self, flow_units, data, darcy_weisbach=False): | |||
|
|||
elif self in [HydParam.RoughnessCoeff] and darcy_weisbach: | |||
if flow_units.is_traditional: | |||
data = data / (1000.0 * 0.3048) # 1e-3 ft from m | |||
data = data / (0.001 * 0.3048) # 1e-3 ft from m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worked out the conversion and agree with this change.
Summary
The following PR addresses #443 regarding unit conversion of the roughness coefficient when using D-W headloss formula. This update only impacts the EpanetSimulator which requires the unit conversion when reading/writing the INP file. The WNTRSimulator does not support D-W headloss formula.
The original code did not convert roughness in
_read_pipes
and_write_pipes
. Theto_si
andfrom_si
conversion functions for roughness were also incorrect and updated.If
wn.options.hydraulic.headloss
is changed from ['H-W', 'C-M'] to/from 'D-W', a UserWarning is printed to the screen. The units of headloss cannot be converted from unitless to/from length.Tests and documentation
Tests were added to
test_epanet_io.py
. The mean absolute error in pressure values for Net3 is within 0.55 m when using H-W, C-M, and D-W with GPM and LPS.Acknowledgement
By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.