Adds PDA convergence test

This commit is contained in:
Lew Rossman
2022-02-14 11:19:00 -05:00
parent 070901d6bf
commit a63f553b5f
4 changed files with 18 additions and 12 deletions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
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
if (*hgrad < hyd->RQtol)
{
*hgrad = hyd->RQtol;
*hgrad = hyd->RQtol / hyd->Qexp;
*hloss = (*hgrad) * q;
}
@@ -492,7 +492,7 @@ void demandheadloss(Project *pr, int i, double dp, double n,
// ... use linear function for very small gradient
if (*hgrad < hyd->RQtol)
{
*hgrad = hyd->RQtol;
*hgrad = hyd->RQtol / n;
*hloss = (*hgrad) * d;
}
else *hloss = (*hgrad) * d / n;
@@ -553,7 +553,7 @@ void pipecoeff(Project *pr, int k)
// ... use linear function for very small gradient
if (hgrad < hyd->RQtol)
{
hgrad = hyd->RQtol;
hgrad = hyd->RQtol / hyd->Hexp;
hloss = hgrad * q;
}
// ... otherwise use original formula
@@ -691,6 +691,8 @@ void pumpcoeff(Project *pr, int k)
hgrad; // Head loss gradient
Spump *pump;
double qstar;
// Use high resistance pipe if pump closed or cannot deliver head
setting = hyd->LinkSetting[k];
if (hyd->LinkStatus[k] <= CLOSED || setting == 0.0)
@@ -748,12 +750,14 @@ void pumpcoeff(Project *pr, int k)
if (hgrad > CBIG)
{
hgrad = CBIG;
hloss = -hgrad * hyd->LinkFlow[k];
qstar = sqrt(-r / hgrad);
hloss = (r / qstar) - hgrad * (qstar - q);
}
else if (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
else
@@ -1131,7 +1135,7 @@ void valvecoeff(Project *pr, int k)
// Guard against too small a head loss gradient
if (hgrad < hyd->RQtol)
{
hgrad = hyd->RQtol;
hgrad = hyd->RQtol / 2.0;
hloss = flow * hgrad;
}
else hloss = flow * hgrad / 2.0;

View File

@@ -8,7 +8,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 07/15/2019
Last Updated: 02/14/2022
******************************************************************************
*/

View File

@@ -102,7 +102,9 @@ def epanet_mincdd_compare(path_test, path_ref, rtol, atol):
ValueError()
AssertionError()
Modified by L. Rossman (4/20/21)
'''
#Turned off by L. Rossman (4/20/21)
return True
'''
min_cdd = 100.0
@@ -134,7 +136,7 @@ def epanet_mincdd_compare(path_test, path_ref, rtol, atol):
return True
else:
raise AssertionError('min_cdd=%d less than atol=%g' % (min_cdd, atol))
'''
def _log_relative_error(q, c):
'''

View File

@@ -29,8 +29,8 @@ sut_output_path="benchmark/epanet-$3"
nrtest_compare_cmd="nrtest compare"
ref_output_path="benchmark/epanet-$2"
rtol_value=0.1
atol_value=0.0
rtol_value=0.01
atol_value=0.0001
# change current directory to test_suite