Skip to content

Commit

Permalink
Merge pull request #386 from OpenWaterAnalytics/merge_usepa522
Browse files Browse the repository at this point in the history
  • Loading branch information
karosc authored Mar 27, 2023
2 parents 1ea204b + 9798716 commit d74e636
Show file tree
Hide file tree
Showing 26 changed files with 228 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
- name: Before reg test
env:
NRTESTS_URL: https://github.com/OpenWaterAnalytics/swmm-nrtestsuite
BENCHMARK_TAG: v3.0.0
BENCHMARK_TAG: v3.0.1
run: ./${{ matrix.before_reg_test }} ${{ env.BENCHMARK_TAG }}

- name: Run reg test
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
# Updated: May 19, 2021
# Modified: Aug 16, 2022
#
# Authors: Michael E. Tryby
# US EPA ORD/CESER
Expand All @@ -22,7 +22,7 @@ endif()


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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stormwater-Management-Model

ORD Stormwater Management Model (aka "SWMM")
Stormwater Management Model (aka "SWMM") solver only

## Introduction
This is the open source SWMM source code repository maintained by the Open
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: 06/01/22 (Build 5.2.1)
// Date: 10/18/22 (Build 5.2.2)
// Author: L. Rossman
//
// Various Constants
Expand All @@ -17,7 +17,7 @@
//------------------

// OWA Version string stored in version.h
// #define VERSION 52001
// #define VERSION 52002
#define MAGICNUMBER 516114522
#define EOFMARK 0x1A // Use 0x04 for UNIX systems
#define MAXTITLE 3 // Max. # title lines
Expand Down
4 changes: 2 additions & 2 deletions src/solver/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,8 @@ void updateActionList(struct TAction* a)
listItem->next = ActionList;
ActionList = listItem;
}
listItem->action = a;
}
listItem->action = a;
}

//=============================================================================

Expand Down
18 changes: 9 additions & 9 deletions src/solver/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@
// Cross section shape types
//-------------------------------------
enum XsectType {
DUMMY, // 0
DUMMY, // 0
CIRCULAR, // 1 closed
FILLED_CIRCULAR, // 2 closed
RECT_CLOSED, // 3 closed
RECT_OPEN, // 4
TRAPEZOIDAL, // 5
TRIANGULAR, // 6
RECT_OPEN, // 4
TRAPEZOIDAL, // 5
TRIANGULAR, // 6
PARABOLIC, // 7
POWERFUNC, // 8
RECT_TRIANG, // 9
POWERFUNC, // 8
RECT_TRIANG, // 9
RECT_ROUND, // 10
MOD_BASKET, // 11
MOD_BASKET, // 11
HORIZ_ELLIPSE, // 12 closed
VERT_ELLIPSE, // 13 closed
ARCH, // 14 closed
Expand Down Expand Up @@ -197,7 +197,7 @@
//-------------------------------------
// Computed node quantities
//-------------------------------------
#define MAX_NODE_RESULTS 7
#define MAX_NODE_RESULTS 7
enum NodeResultType {
NODE_DEPTH, // water depth above invert
NODE_HEAD, // hydraulic head
Expand Down Expand Up @@ -418,7 +418,7 @@ enum CompatibilityType {

enum PumpCurveType {
TYPE1_PUMP, // flow varies stepwise with wet well volume
TYPE2_PUMP, // flow varies stepwise with inlet depth
TYPE2_PUMP, // flow varies stepwise with inlet depth
TYPE3_PUMP, // flow varies with head delivered
TYPE4_PUMP, // flow varies with inlet depth
TYPE5_PUMP, // variable speed version of TYPE3 pump
Expand Down
4 changes: 2 additions & 2 deletions src/solver/funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void report_writeTimeStepStats(TTimeStepStats* timeStepStats);
void report_writeErrorMsg(int code, char* msg);
void report_writeErrorCode(void);
void report_writeInputErrorMsg(int k, int sect, char* line, long lineCount);
void report_writeWarningMsg(char* msg, char* id);
void report_writeWarningMsg(char* msg, char* id);
void report_writeTseriesErrorMsg(int code, TTable *tseries);

void inputrpt_writeInput(void);
Expand Down Expand Up @@ -496,7 +496,7 @@ void controls_addToCount(char* s);
int controls_addVariable(char* tok[], int ntoks);
int controls_addExpression(char* tok[], int ntoks);
int controls_addRuleClause(int rule, int keyword, char* Tok[], int nTokens);
int controls_evaluate(DateTime currentTime, DateTime elapsedTime,
int controls_evaluate(DateTime currentTime, DateTime elapsedTime,
double tStep);

//-----------------------------------------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions src/solver/gage.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void gage_setState(int j, DateTime t)
// --- otherwise update next rainfall interval date
Gage[j].startDate = Gage[j].nextDate;
Gage[j].endDate = datetime_addSeconds(Gage[j].startDate,
Gage[j].rainInterval);
Gage[j].rainInterval);
Gage[j].rainfall = Gage[j].nextRainfall;
if ( !getNextRainfall(j) ) Gage[j].nextDate = NO_DATE;
}
Expand Down Expand Up @@ -670,11 +670,11 @@ int getNextRainfall(int j)
{
if ( Frain.file && Gage[j].currentFilePos < Gage[j].endFilePos )
{
fseek(Frain.file, Gage[j].currentFilePos, SEEK_SET);
fread(&Gage[j].nextDate, sizeof(DateTime), 1, Frain.file);
fread(&vNext, sizeof(float), 1, Frain.file);
Gage[j].currentFilePos = ftell(Frain.file);
rNext = convertRainfall(j, (double)vNext);
fseek(Frain.file, Gage[j].currentFilePos, SEEK_SET);
fread(&Gage[j].nextDate, sizeof(DateTime), 1, Frain.file);
fread(&vNext, sizeof(float), 1, Frain.file);
Gage[j].currentFilePos = ftell(Frain.file);
rNext = convertRainfall(j, (double)vNext);
}
else return 0;
}
Expand All @@ -684,9 +684,9 @@ int getNextRainfall(int j)
k = Gage[j].tSeries;
if ( k >= 0 )
{
if ( !table_getNextEntry(&Tseries[k],
&Gage[j].nextDate, &rNext) ) return 0;
rNext = convertRainfall(j, rNext);
if ( !table_getNextEntry(&Tseries[k],
&Gage[j].nextDate, &rNext) ) return 0;
rNext = convertRainfall(j, rNext);
}
else return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/solver/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// - Minimum dynamic wave routing variable time step added.
// Build 5.1.011:
// - Changed WarningCode to Warnings (# warnings issued)
// - Added error message text as a variable.
// - Added error message text as a variable.
// - Added elapsed simulation time (in decimal days) variable.
// - Added variables associated with detailed routing events.
// Build 5.1.012:
Expand Down
34 changes: 21 additions & 13 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: 06/01/22 (Build 5.2.1)
// Date: 10/08/22 (Build 5.2.2)
// Author: L. Rossman
//
// Street/Channel Inlet Functions
Expand All @@ -16,6 +16,8 @@
//
// Build 5.2.1:
// - Substitutes the constant BIG for HUGE.
// Build 5.2.2:
// - Additional statistics added to Street Flow Summary table.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1030,17 +1032,18 @@ void writeStreetStatsHeader()
report_writeLine("*******************");
report_writeLine("");
fprintf(Frpt.file,
"\n ----------------------------------------------------------------------------------------------------------------------"
"\n Peak Maximum Maximum Peak Flow Average Bypass BackFlow"
"\n Flow Spread Depth Inlet Inlet Capture Capture Frequency Frequency");
"\n ---------------------------------------------------------------------------------------------------------------------------------------"
"\n Peak Avg. Bypass Back Peak Peak"
"\n Peak Maximum Maximum Flow Flow Flow Flow Capture Bypass"
"\n Flow Spread Depth Inlet Inlet Inlet Capture Capture Freq Freq / Inlet Flow");
if (UnitSystem == US) fprintf(Frpt.file,
"\n Street Conduit %3s ft ft Design Location %% %% %% %%",
FlowUnitWords[FlowUnits]);
"\n Street Conduit %3s ft ft Design Location Count Pcnt Pcnt Pcnt Pcnt %3s %3s",
FlowUnitWords[FlowUnits], FlowUnitWords[FlowUnits], FlowUnitWords[FlowUnits]);
else fprintf(Frpt.file,
"\n Street Conduit %3s m m Design Location %% %% %% %%",
FlowUnitWords[FlowUnits]);
"\n Street Conduit %3s m m Design Location Pcnt Pcnt Pcnt Pcnt %3s %3s",
FlowUnitWords[FlowUnits], FlowUnitWords[FlowUnits], FlowUnitWords[FlowUnits]);
fprintf(Frpt.file,
"\n ----------------------------------------------------------------------------------------------------------------------");
"\n ---------------------------------------------------------------------------------------------------------------------------------------");
}

//=============================================================================
Expand Down Expand Up @@ -1095,19 +1098,24 @@ void writeStreetStats(int link)
fprintf(Frpt.file, " ON-GRADE");
else
fprintf(Frpt.file, " ON-SAG ");
fprintf(Frpt.file, " %5d", inlet->numInlets);
fp = inlet->stats.flowPeriods / 100.0;
if (fp > 0.0)
{
cp = inlet->stats.capturePeriods / 100.0;
fprintf(Frpt.file, " %9.2f", inlet->stats.peakFlowCapture);
fprintf(Frpt.file, " %7.2f", inlet->stats.peakFlowCapture);
if (cp > 0.0)
{
afc = inlet->stats.avgFlowCapture / cp;
bpf = inlet->stats.bypassFreq / cp;
}
fprintf(Frpt.file, " %9.2f", afc);
fprintf(Frpt.file, " %9.2f", bpf);
fprintf(Frpt.file, " %9.2f", inlet->stats.backflowPeriods / fp);
fprintf(Frpt.file, " %7.2f", afc);
fprintf(Frpt.file, " %7.2f", bpf);
fprintf(Frpt.file, " %7.2f", inlet->stats.backflowPeriods / fp);
fprintf(Frpt.file, " %7.2f", (maxFlow / Street[t].sides) * UCF(FLOW) *
0.01 * inlet->stats.peakFlowCapture / inlet->numInlets);
fprintf(Frpt.file, " %7.2f", maxFlow * UCF(FLOW) * 0.01 *
(100.0 - inlet->stats.peakFlowCapture));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/solver/lid.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ int lid_readProcParams(char* toks[], int ntoks)
// LID_ID STORAGE <parameters>
// LID_ID DRAIN <parameters>
// LID_ID DRAINMAT <parameters>
// LID_ID REMOVALS <parameters>
// LID_ID REMOVALS <parameters>
//
{
int j, m;
Expand Down Expand Up @@ -712,7 +712,7 @@ int readStorageData(int j, char* toks[], int ntoks)
// Output: returns error code
//
// Format of data is:
// LID_ID STORAGE Thickness VoidRatio Ksat ClogFactor (YES/NO)
// LID_ID STORAGE Thickness VoidRatio Ksat ClogFactor (YES/NO)
//
{
int i;
Expand Down Expand Up @@ -1638,7 +1638,7 @@ void lid_getRunoff(int j, double tStep)
double lidArea; // area of an LID unit
double qImperv = 0.0; // runoff from impervious areas (cfs)
double qPerv = 0.0; // runoff from pervious areas (cfs)
double lidInflow = 0.0; // inflow to an LID unit (ft/s)
double lidInflow = 0.0; // inflow to an LID unit (ft/s)
double qRunoff = 0.0; // surface runoff from all LID units (cfs)
double qDrain = 0.0; // drain flow from all LID units (cfs)
double qReturn = 0.0; // LID outflow returned to pervious area (cfs)
Expand Down
12 changes: 6 additions & 6 deletions src/solver/lid.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// - Support added for separate routing of LID drain flows.
// - Detailed LID reporting modified.
// Build 5.1.011:
// - Water depth replaces moisture content for LID's pavement layer.
// - Water depth replaces moisture content for LID's pavement layer.
// - Arguments for lidproc_saveResults() modified.
// Build 5.1.012:
// - Redefined meaning of wasDry in TLidRptFile structure.
Expand Down Expand Up @@ -47,8 +47,8 @@
//-----------------------------------------------------------------------------
enum LidTypes {
BIO_CELL, // bio-retention cell
RAIN_GARDEN, // rain garden
GREEN_ROOF, // green roof
RAIN_GARDEN, // rain garden
GREEN_ROOF, // green roof
INFIL_TRENCH, // infiltration trench
POROUS_PAVEMENT, // porous pavement
RAIN_BARREL, // rain barrel
Expand All @@ -69,7 +69,7 @@ typedef struct
{
double thickness; // depression storage or berm ht. (ft)
double voidFrac; // available fraction of storage volume
double roughness; // surface Mannings n
double roughness; // surface Mannings n
double surfSlope; // land surface slope (fraction)
double sideSlope; // swale side slope (run/rise)
double alpha; // slope/roughness term in Manning eqn.
Expand Down Expand Up @@ -204,15 +204,15 @@ typedef struct
int drainNode; // node receiving drain flow
TLidRptFile* rptFile; // pointer to detailed report file

TGrnAmpt soilInfil; // infil. object for biocell soil layer
TGrnAmpt soilInfil; // infil. object for biocell soil layer
double surfaceDepth; // depth of ponded water on surface layer (ft)
double paveDepth; // depth of water in porous pavement layer
double soilMoisture; // moisture content of biocell soil layer
double storageDepth; // depth of water in storage layer (ft)

// net inflow - outflow from previous time step for each LID layer (ft/s)
double oldFluxRates[MAX_LAYERS];

double dryTime; // time since last rainfall (sec)
double oldDrainFlow; // previous drain flow (cfs)
double newDrainFlow; // current drain flow (cfs)
Expand Down
6 changes: 3 additions & 3 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: 06/01/22 (Build 5.2.1)
// Date: 10/29/22 (Build 5.2.2)
// Author: L. Rossman
// M. Tryby (EPA)
//
Expand Down Expand Up @@ -44,6 +44,8 @@
// - Support added for variable speed pumps.
// Build 5.2.1
// - Warning no longer issued when conduit elevation drop < MIN_DELTA_Z.
// Build 5.2.2:
// - Warning for conduit elevation drop < MIN_DELTA_Z restored.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1264,9 +1266,7 @@ 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 d74e636

Please sign in to comment.