Skip to content

Commit

Permalink
Merge pull request #91 from USEPA/release
Browse files Browse the repository at this point in the history
Master <- Release
  • Loading branch information
michaeltryby authored Oct 18, 2022
2 parents fb1ccc9 + 8e0ec20 commit a3b9db9
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 69 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build and Test

on:
push:
branches: [ master, develop, release ]
branches: [ master, develop, release, lew-develop ]
pull_request:
branches: [ master, develop, release ]
branches: [ master, develop, release, lew-develop ]

env:
OMP_NUM_THREADS: 1
Expand Down Expand Up @@ -94,11 +94,11 @@ jobs:
- name: Build
run: make.cmd /g "Visual Studio 16 2019"

- name: Before test
- name: Before reg test
env:
NRTESTS_URL: https://github.com/SWMM-Project/swmm-nrtestsuite
RELEASE_TAG: v2.0.0
run: before-nrtest.cmd %RELEASE_TAG%
NRTESTS_URL: https://github.com/USEPA/swmm-nrtestsuite
BENCHMARK_TAG: v2.1.0
run: before-nrtest.cmd ${{ env.BENCHMARK_TAG }}

- name: Reg test
run: run-nrtests.cmd %GITHUB_RUN_ID%_%GITHUB_RUN_NUMBER%
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CMakeLists.txt - CMake configuration file for swmm-solver
#
# Created: July 11, 2019
# Modified: Nov 25, 2019
# Modified: Aug 16, 2022
#
# Author: Michael E. Tryby
# US EPA ORD/CESER
Expand All @@ -17,7 +17,7 @@ endif()


project(swmm-solver
VERSION 5.2.0
VERSION 5.2.1
LANGUAGES C CXX
)

Expand Down
4 changes: 2 additions & 2 deletions src/solver/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
//
// Various Constants
Expand All @@ -16,7 +16,7 @@
// General Constants
//------------------

#define VERSION 52000
#define VERSION 52001
#define MAGICNUMBER 516114522
#define EOFMARK 0x1A // Use 0x04 for UNIX systems
#define MAXTITLE 3 // Max. # title lines
Expand Down
13 changes: 8 additions & 5 deletions src/solver/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
//
// Rule-based controls functions.
Expand Down Expand Up @@ -48,6 +48,9 @@
// - Additional attributes added to condition clauses.
// - Support added for named variables in condition clauses.
// - Support added for math expressions in condition clauses.
// Build 5.2.1:
// - A refactoring bug from 5.2.0 causing duplicate actions to be added
// to the list of control actions to take was fixed.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1188,14 +1191,14 @@ void updateActionList(struct TAction* a)
listItem = listItem->next;
}

// --- action not listed so add it to ActionList
listItem = (struct TActionList *) malloc(sizeof(struct TActionList));
if (listItem)
// --- action not listed so add it to ActionList //5.2.1
if ( !listItem )
{
listItem = (struct TActionList *) malloc(sizeof(struct TActionList));
listItem->next = ActionList;
ActionList = listItem;
listItem->action = a;
}
listItem->action = a;
}

//=============================================================================
Expand Down
19 changes: 10 additions & 9 deletions src/solver/dwflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 08/01/22 (Build 5.2.1)
// Author: L. Rossman
// M. Tryby (EPA)
// R. Dickinson (CDM)
Expand All @@ -24,6 +24,8 @@
// - Conduit evap. and seepage loss initialized to 0 in dwflow_findConduitFlow.
// - Most current flow (qLast) used instead of previous time period flow
// (qOld) in call to link_getLossRate.
// Build 5.2.1:
// - Implements the new option to skip checking for normal flow limitations.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -248,11 +250,10 @@ void dwflow_findConduitFlow(int j, int steps, double omega, double dt)
q = culvert_getInflow(j, q, h1);

// --- check for normal flow limitation based on surface slope & Fr
else
if ( y1 < Link[j].xsect.yFull &&
( Link[j].flowClass == SUBCRITICAL ||
Link[j].flowClass == SUPCRITICAL )
) q = checkNormalFlow(j, q, y1, y2, a1, r1);
else if (NormalFlowLtd != NEITHER && y1 < Link[j].xsect.yFull &&
( Link[j].flowClass == SUBCRITICAL ||
Link[j].flowClass == SUPCRITICAL ))
q = checkNormalFlow(j, q, y1, y2, a1, r1);
}

// --- apply under-relaxation weighting between new & old flows;
Expand Down Expand Up @@ -436,8 +437,8 @@ void findSurfArea(int j, double q, double length, double* h1, double* h2,
double surfArea2 = 0.0; // surface area st downstrm node (ft2)
double criticalDepth; // critical flow depth (ft)
double normalDepth; // normal flow depth (ft)
double fullDepth; // full depth (ft) //(5.1.013)
double fasnh = 1.0; // fraction between norm. & crit. depth //(5.1.013)
double fullDepth; // full depth (ft)
double fasnh = 1.0; // fraction between norm. & crit. depth
TXsect* xsect = &Link[j].xsect; // pointer to cross-section data

// --- get node indexes & current flow depths
Expand Down Expand Up @@ -655,7 +656,7 @@ double checkNormalFlow(int j, double q, double y1, double y2, double a1,
// --- check if water surface slope < conduit slope
if ( NormalFlowLtd == SLOPE || NormalFlowLtd == BOTH || hasOutfall )
{
if ( y1 < y2 ) check = TRUE;
if ( y1 < y2) check = TRUE;
}

// --- check if Fr >= 1.0 at upstream end of conduit
Expand Down
7 changes: 5 additions & 2 deletions src/solver/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
//
// Enumerated constants
Expand Down Expand Up @@ -31,6 +31,8 @@
// - Support added for Streets and Inlets.
// - Support added for variable speed pumps.
// - Support added for analytical storage shapes.
// Build 5.2.1:
// - Adds a NEITHER option to the NormalFlowType enumeration.
//-----------------------------------------------------------------------------

#ifndef ENUMS_H
Expand Down Expand Up @@ -356,7 +358,8 @@ enum CompatibilityType {
enum NormalFlowType {
SLOPE, // based on slope only
FROUDE, // based on Fr only
BOTH}; // based on slope & Fr
BOTH, // based on slope & Fr
NEITHER};

enum InertialDampingType {
NO_DAMPING, // no inertial damping
Expand Down
6 changes: 4 additions & 2 deletions src/solver/flowrout.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 05/02/22 (Build 5.2.1)
// Author: L. Rossman
// M. Tryby (EPA)
//
Expand All @@ -24,6 +24,9 @@
// - Arguments to function link_getLossRate changed.
// Build 5.2.0:
// - Correction made to updating state of terminal storage nodes.
// Build 5.2.1:
// - For storage routing, after convergence the reported depth is now
// based on the last volume found rather than the next trial depth.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -587,7 +590,6 @@ void updateStorageState(int i, int j, int links[], double dt)
if ( fabs(d2 - d1) <= STOPTOL ) stopped = TRUE;

// --- update old depth with new value and continue to iterate
Node[i].newDepth = d2;
d1 = d2;
iter++;
}
Expand Down
12 changes: 7 additions & 5 deletions src/solver/inlet.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
//
// Street/Channel Inlet Functions
Expand All @@ -14,6 +14,8 @@
// Administration Hydraulic Engineering Circular No. 22, 3rd Edition,
// FHWA-NHI-10-009, August 2013).
//
// Build 5.2.1:
// - Substitutes the constant BIG for HUGE.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1567,7 +1569,7 @@ double getOnSagCapturedFlow(TInlet* inlet, double q, double d)
//
{
int linkIndex, designIndex, totalInlets;
double qCaptured = 0.0, qMax = HUGE;
double qCaptured = 0.0, qMax = BIG;

if (inlet->numInlets == 0) return 0.0;
totalInlets = Nsides * inlet->numInlets;
Expand Down Expand Up @@ -1680,7 +1682,7 @@ void findOnSagGrateFlows(int i, double d, double *Qw, double *Qo)
// --- orifice flow applies
else
{
*Qo = 0.67 * Ao * sqrt(2.0 * GRAVITY * di); //HEC-22 Eq(4-27)
*Qo = 0.67 * Ao * sqrt(2.0 * 32.16 * di); //HEC-22 Eq(4-27)
}
}

Expand Down Expand Up @@ -1763,7 +1765,7 @@ double getCurbOrificeFlow(double di, double h, double L, int throatAngle)
d = di - h / 2.0;
else if (throatAngle == INCLINED_THROAT)
d = di + (h / 2.0) * 0.7071;
return 0.67 * h * L * sqrt(2.0 * GRAVITY * d); //HEC-22 Eq(4-31a)
return 0.67 * h * L * sqrt(2.0 * 32.16 * d); //HEC-22 Eq(4-31a)
}

//=============================================================================
Expand Down Expand Up @@ -1895,7 +1897,7 @@ double getCustomCapturedFlow(TInlet* inlet, double q, double d)
qBypassed, // inlet's bypassed flow (cfs)
qCaptured, // inlet's captured flow (cfs)
qIncrement, // increment to captured flow (cfs)
qMax = HUGE; // user-supplied flow capture limit (cfs)
qMax = BIG; // user-supplied flow capture limit (cfs)

if (inlet->numInlets == 0) return 0.0;

Expand Down
12 changes: 7 additions & 5 deletions src/solver/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
//
// Input data processing functions.
Expand All @@ -19,6 +19,8 @@
// Build 5.2.0:
// - Support added for Streets and Inlets.
// - Support added for named variables & math expressions in control rules.
// Build 5.2.1:
// - Possible integer underflow avoided in getTokens() function.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -889,8 +891,8 @@ int getTokens(char *s)
// in CONSTS.H. Text between quotes is treated as a single token.
//
{
int n;
size_t len, m;
int len, n;
int m;
char *c;

// --- begin with no tokens
Expand All @@ -905,15 +907,15 @@ int getTokens(char *s)
// --- scan s for tokens until nothing left
while (len > 0 && n < MAXTOKS)
{
m = strcspn(s,SEPSTR); // find token length
m = (int)strcspn(s,SEPSTR); // find token length
if (m == 0) s++; // no token found
else
{
if (*s == '"') // token begins with quote
{
s++; // start token after quote
len--; // reduce length of s
m = strcspn(s,"\"\n"); // find end quote or new line
m = (int)strcspn(s,"\"\n"); // find end quote or new line
}
s[m] = '\0'; // null-terminate the token
Tok[n] = s; // save pointer to token
Expand Down
6 changes: 4 additions & 2 deletions src/solver/keywords.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
//
// Exportable keyword dictionary
Expand Down Expand Up @@ -34,6 +34,8 @@
// - Support added for variable speed pumps.
// - Support added for analytical storage shapes.
// - Support added for RptFlags.disabled option.
// Build 5.2.1:
// - Adds NONE to the list of NormalFlowWords.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -65,7 +67,7 @@ char* LoadUnitsWords[] = { w_LBS, w_KG, w_LOGN };
char* NodeTypeWords[] = { w_JUNCTION, w_OUTFALL,
w_STORAGE, w_DIVIDER };
char* NoneAllWords[] = { w_NONE, w_ALL, NULL};
char* NormalFlowWords[] = { w_SLOPE, w_FROUDE, w_BOTH, NULL};
char* NormalFlowWords[] = { w_SLOPE, w_FROUDE, w_BOTH, w_NONE, NULL};
char* NormalizerWords[] = { w_PER_AREA, w_PER_CURB, NULL};
char* NoYesWords[] = { w_NO, w_YES, NULL};
char* OffOnWords[] = { w_OFF, w_ON, NULL};
Expand Down
14 changes: 9 additions & 5 deletions src/solver/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// Project: EPA SWMM5
// Version: 5.2
// Date: 11/01/21 (Build 5.2.0)
// Date: 06/01/22 (Build 5.2.1)
// Author: L. Rossman
// M. Tryby (EPA)
//
Expand Down Expand Up @@ -36,12 +36,14 @@
// - Support added for head-dependent weir coefficient curves.
// - Adjustment of regulator link crest offset to match downstream node invert
// now only done for Dynamic Wave flow routing.
// Build 5.1.014:
// - Conduit evap. and seepage losses initialized to 0 in conduit_initState()
// and not allowed to exceed current flow rate in conduit_getLossRate().
// Build 5.2.0:
// Build 5.1.014:
// - Conduit evap. and seepage losses initialized to 0 in conduit_initState()
// and not allowed to exceed current flow rate in conduit_getLossRate().
// Build 5.2.0:
// - Support added for Streets and Inlets.
// - Support added for variable speed pumps.
// Build 5.2.1
// - Warning no longer issued when conduit elevation drop < MIN_DELTA_Z.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1262,7 +1264,9 @@ double conduit_getSlope(int j)
delta = fabs(elev1 - elev2);
if ( delta < MIN_DELTA_Z )
{
/* Deprecated as of v.5.2.1
report_writeWarningMsg(WARN04, Link[j].ID);
*/
delta = MIN_DELTA_Z;
}

Expand Down
Loading

0 comments on commit a3b9db9

Please sign in to comment.