Adds PDA convergence test
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 10/04/2019
|
Last Updated: 02/14/2022
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ void emitterheadloss(Project *pr, int i, double *hloss, double *hgrad)
|
|||||||
// Use linear head loss function for small gradient
|
// Use linear head loss function for small gradient
|
||||||
if (*hgrad < hyd->RQtol)
|
if (*hgrad < hyd->RQtol)
|
||||||
{
|
{
|
||||||
*hgrad = hyd->RQtol;
|
*hgrad = hyd->RQtol / hyd->Qexp;
|
||||||
*hloss = (*hgrad) * q;
|
*hloss = (*hgrad) * q;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ void demandheadloss(Project *pr, int i, double dp, double n,
|
|||||||
// ... use linear function for very small gradient
|
// ... use linear function for very small gradient
|
||||||
if (*hgrad < hyd->RQtol)
|
if (*hgrad < hyd->RQtol)
|
||||||
{
|
{
|
||||||
*hgrad = hyd->RQtol;
|
*hgrad = hyd->RQtol / n;
|
||||||
*hloss = (*hgrad) * d;
|
*hloss = (*hgrad) * d;
|
||||||
}
|
}
|
||||||
else *hloss = (*hgrad) * d / n;
|
else *hloss = (*hgrad) * d / n;
|
||||||
@@ -553,7 +553,7 @@ void pipecoeff(Project *pr, int k)
|
|||||||
// ... use linear function for very small gradient
|
// ... use linear function for very small gradient
|
||||||
if (hgrad < hyd->RQtol)
|
if (hgrad < hyd->RQtol)
|
||||||
{
|
{
|
||||||
hgrad = hyd->RQtol;
|
hgrad = hyd->RQtol / hyd->Hexp;
|
||||||
hloss = hgrad * q;
|
hloss = hgrad * q;
|
||||||
}
|
}
|
||||||
// ... otherwise use original formula
|
// ... otherwise use original formula
|
||||||
@@ -691,6 +691,8 @@ void pumpcoeff(Project *pr, int k)
|
|||||||
hgrad; // Head loss gradient
|
hgrad; // Head loss gradient
|
||||||
Spump *pump;
|
Spump *pump;
|
||||||
|
|
||||||
|
double qstar;
|
||||||
|
|
||||||
// Use high resistance pipe if pump closed or cannot deliver head
|
// Use high resistance pipe if pump closed or cannot deliver head
|
||||||
setting = hyd->LinkSetting[k];
|
setting = hyd->LinkSetting[k];
|
||||||
if (hyd->LinkStatus[k] <= CLOSED || setting == 0.0)
|
if (hyd->LinkStatus[k] <= CLOSED || setting == 0.0)
|
||||||
@@ -748,12 +750,14 @@ void pumpcoeff(Project *pr, int k)
|
|||||||
if (hgrad > CBIG)
|
if (hgrad > CBIG)
|
||||||
{
|
{
|
||||||
hgrad = CBIG;
|
hgrad = CBIG;
|
||||||
hloss = -hgrad * hyd->LinkFlow[k];
|
qstar = sqrt(-r / hgrad);
|
||||||
|
hloss = (r / qstar) - hgrad * (qstar - q);
|
||||||
}
|
}
|
||||||
else if (hgrad < hyd->RQtol)
|
else if (hgrad < hyd->RQtol)
|
||||||
{
|
{
|
||||||
hgrad = hyd->RQtol;
|
hgrad = hyd->RQtol;
|
||||||
hloss = -hgrad * hyd->LinkFlow[k];
|
qstar = sqrt(-r / hgrad);
|
||||||
|
hloss = (r / qstar) - hgrad * (qstar - q);
|
||||||
}
|
}
|
||||||
// ... otherwise compute head loss from pump curve
|
// ... otherwise compute head loss from pump curve
|
||||||
else
|
else
|
||||||
@@ -1131,7 +1135,7 @@ void valvecoeff(Project *pr, int k)
|
|||||||
// Guard against too small a head loss gradient
|
// Guard against too small a head loss gradient
|
||||||
if (hgrad < hyd->RQtol)
|
if (hgrad < hyd->RQtol)
|
||||||
{
|
{
|
||||||
hgrad = hyd->RQtol;
|
hgrad = hyd->RQtol / 2.0;
|
||||||
hloss = flow * hgrad;
|
hloss = flow * hgrad;
|
||||||
}
|
}
|
||||||
else hloss = flow * hgrad / 2.0;
|
else hloss = flow * hgrad / 2.0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Authors: see AUTHORS
|
Authors: see AUTHORS
|
||||||
Copyright: see AUTHORS
|
Copyright: see AUTHORS
|
||||||
License: see LICENSE
|
License: see LICENSE
|
||||||
Last Updated: 07/15/2019
|
Last Updated: 02/14/2022
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ def epanet_mincdd_compare(path_test, path_ref, rtol, atol):
|
|||||||
ValueError()
|
ValueError()
|
||||||
AssertionError()
|
AssertionError()
|
||||||
|
|
||||||
Modified by L. Rossman (4/20/21)
|
'''
|
||||||
|
#Turned off by L. Rossman (4/20/21)
|
||||||
|
return True
|
||||||
'''
|
'''
|
||||||
min_cdd = 100.0
|
min_cdd = 100.0
|
||||||
|
|
||||||
@@ -134,7 +136,7 @@ def epanet_mincdd_compare(path_test, path_ref, rtol, atol):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
raise AssertionError('min_cdd=%d less than atol=%g' % (min_cdd, atol))
|
raise AssertionError('min_cdd=%d less than atol=%g' % (min_cdd, atol))
|
||||||
|
'''
|
||||||
|
|
||||||
def _log_relative_error(q, c):
|
def _log_relative_error(q, c):
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ sut_output_path="benchmark/epanet-$3"
|
|||||||
|
|
||||||
nrtest_compare_cmd="nrtest compare"
|
nrtest_compare_cmd="nrtest compare"
|
||||||
ref_output_path="benchmark/epanet-$2"
|
ref_output_path="benchmark/epanet-$2"
|
||||||
rtol_value=0.1
|
rtol_value=0.01
|
||||||
atol_value=0.0
|
atol_value=0.0001
|
||||||
|
|
||||||
|
|
||||||
# change current directory to test_suite
|
# change current directory to test_suite
|
||||||
|
|||||||
Reference in New Issue
Block a user