Description
@LRossman We found an issue when run quality simulation on a model with an inflow junction (negative demand). We don't quite understand this and would like to ask for your help. Thanks.
Run the inflow-junction_quality.zip in both epanet 2.0 and epanet 3.0 engines.
The junction
J00001
has set with Source Quality as 0.45 and Concentration type.
The results are different, see below graphs:
Comparing the source quality code between the two versions:
main code difference
- EPANET 3.0:
quality += strength * (-node->outflow / outflow);
the quality is the node's quality plus the source's quality as the code comments. - EPANET 2.0:
c = -c * hyd->NodeDemand[n] * tstep / volout;
the quality is fixed to the source quality as manual said. (without plus current node's quality).
I tried a code change on EPANET3.0, (remove the plus). quality = strength * (-node->outflow / outflow);
The result was same as EPANET2.0.
So, there is my puzzle: the code comments for EPANET 3.0 looks reasonable. But the result looks bad, is the quality formula's issue? Take an extreme case, the inflow junction is an end of a pipe and start of another pipe. So, the quality value should be the (quality * pipe_flow + source_quality * node_inflow) / (pipe_flow + node_inflow)
? Or it is just a regression from EPANET 2.0? Just fix it by following EPANET 2.0.
code details for reference:
epanet-dev/src/Elements/qualsource.cpp
Lines 71 to 84 in 186744e
// Added source concentration depends on source type
c = sourcequal(pr, source);
switch (source->Type)
{
// Concentration Source:
case CONCEN:
if (net->Node[n].Type == JUNCTION)
{
// ... source requires a negative demand at the node
if (hyd->NodeDemand[n] < 0.0)
{
c = -c * hyd->NodeDemand[n] * tstep / volout;
}
else c = 0.0;
}
break;
In the manual of EPANet 2.0, it says A concentration source fixes the concentration of any external inflow entering the network, such as flow from a reservoir or from a negative demand placed at a junction.