-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix several quality source issues #65
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ void QualSource::setStrength(Node* node) | |
{ | ||
strength = base; | ||
if ( pattern ) strength *= pattern->currentFactor(); | ||
if ( type == MASS ) strength *= 60.0; // mass/min -> mass/sec | ||
if ( type == MASS ) strength /= 60.0; // mass/min -> mass/sec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. converting mass flow rate from min. to sec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is correct - thank you. |
||
else strength /= FT3perL; // mass/L -> mass/ft3 | ||
} | ||
|
||
|
@@ -64,7 +64,15 @@ double QualSource::getQuality(Node* node) | |
{ | ||
// ... no source contribution if no flow out of node | ||
quality = node->quality; | ||
if ( outflow == 0.0 ) return quality; | ||
if (abs(outflow) <= ZERO_FLOW) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use ZERO_FLOW to determine the stagnant flow but not 0.0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There appears to be a major problem with the original code here -- the value of
|
||
{ | ||
if (node->type() == Node::JUNCTION && node->outflow < 0.0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for inflow junction, the source contribution should be the source quality |
||
{ | ||
if (type == MASS) quality = strength * 60.0; // mass/sec -> mass/min | ||
else quality = strength; | ||
} | ||
return quality; | ||
} | ||
|
||
switch (type) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
#include "tank.h" | ||
#include "curve.h" | ||
#include "qualsource.h" | ||
#include "Core/network.h" | ||
#include "Core/constants.h" | ||
#include "Core/error.h" | ||
|
@@ -107,6 +108,7 @@ void Tank::initialize(Network* nw) | |
outflow = 0.0; | ||
pastOutflow = 0.0; | ||
quality = initQual; | ||
if (qualSource) qualSource->quality = quality; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. initialize the source quality There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, there is no need to initialize |
||
updateArea(); | ||
if ( volCurve ) minVolume = findVolume(minHead); | ||
else if ( minVolume == 0.0 ) minVolume = (minHead - elev) * area; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,7 +308,7 @@ void LTDSolver::updateNodeQuality() | |
if ( node->type() == Node::JUNCTION ) | ||
{ | ||
// ... account for dilution from any external negative demand | ||
if (node->outflow < 0.0 && node->qualSource == nullptr ) | ||
if (node->outflow < 0.0 && node->qualSource != nullptr ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update the concentration if the inflow junction has Quality Source There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is not correct. The dilution occurs only for external inflows at nodes with no WQ source. For nodes with WQ sources the mixing of the external inflow with the node's current quality is handled in |
||
{ | ||
volIn[i] -= node->outflow * tstep; | ||
} | ||
|
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.
initialize the source quality
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.
There is no need to initialize
qualSource->quality
. This variable is assigned locally inQualSource::getQuality
.