Skip to content

Commit

Permalink
Modified code to use consts instead of local values; bumped minor ver…
Browse files Browse the repository at this point in the history
…sion number #70
  • Loading branch information
cbuahin committed Aug 9, 2023
1 parent 71a4c31 commit a831f4f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/solver/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// General Constants
//------------------

#define VERSION 52004
#define VERSION 52005
#define MAGICNUMBER 516114522
#define EOFMARK 0x1A // Use 0x04 for UNIX systems
#define MAXTITLE 3 // Max. # title lines
Expand Down
8 changes: 5 additions & 3 deletions src/solver/lid.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
// - Fixed double counting of initial water volume in green roof drain mat.
// Build 5.2.4
// - Fixed test for invalid data in readDrainData function.
// Build 5.2.5
// - Modified code to use mannings coeff specified in consts.h for consistency
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1041,22 +1043,22 @@ void validateLidProc(int j)
report_writeErrorMsg(ERR_LID_PARAMS, Msg);
}
else LidProcs[j].surface.alpha =
1.49 * sqrt(LidProcs[j].surface.surfSlope) /
PHI * sqrt(LidProcs[j].surface.surfSlope) /
LidProcs[j].surface.roughness;
}
else
{
//... compute surface overland flow coeff.
if ( LidProcs[j].surface.roughness > 0.0 )
LidProcs[j].surface.alpha = 1.49 / LidProcs[j].surface.roughness *
LidProcs[j].surface.alpha = PHI / LidProcs[j].surface.roughness *
sqrt(LidProcs[j].surface.surfSlope);
else LidProcs[j].surface.alpha = 0.0;
}

//... compute drainage mat layer's flow coeff.
if ( LidProcs[j].drainMat.roughness > 0.0 )
{
LidProcs[j].drainMat.alpha = 1.49 / LidProcs[j].drainMat.roughness *
LidProcs[j].drainMat.alpha = PHI / LidProcs[j].drainMat.roughness *
sqrt(LidProcs[j].surface.surfSlope);
}
else LidProcs[j].drainMat.alpha = 0.0;
Expand Down
5 changes: 4 additions & 1 deletion src/solver/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
// - Warning for conduit elevation drop < MIN_DELTA_Z restored.
// Build 5.2.4:
// - Conduit evap+seepage loss under DW routing limited by conduit volume.
// Build 5.2.5:
// - Modified to use GRAVITY defined in const.h instead of local specification
// for consistency.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand Down Expand Up @@ -1140,7 +1143,7 @@ void conduit_validate(int j, int k)
// (factor of 0.3 is for circular pipe 95% full)
// NOTE: this factor was used in the past for a modified version of
// Kinematic Wave routing but is now deprecated.
aa = Conduit[k].beta / sqrt(32.2) *
aa = Conduit[k].beta / sqrt(GRAVITY) *
pow(Link[j].xsect.yFull, 0.1666667) * 0.3;
if ( aa >= 1.0 ) Conduit[k].superCritical = TRUE;
else Conduit[k].superCritical = FALSE;
Expand Down
5 changes: 3 additions & 2 deletions src/solver/subcatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
// Build 5.1.015:
// - Support added for multiple infiltration methods within a project.
// - Only pervious area depression storage receives monthly adjustment.
// Build 5.2.5:
// - Removed duplicate mannings MCOEFF and replaced with PHI in consts.h.
//-----------------------------------------------------------------------------
#define _CRT_SECURE_NO_DEPRECATE

Expand All @@ -49,7 +51,6 @@
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
const double MCOEFF = 1.49; // constant in Manning Eq.
const double MEXP = 1.6666667; // exponent in Manning Eq.
const double ODETOL = 0.0001; // acceptable error for ODE solver

Expand Down Expand Up @@ -403,7 +404,7 @@ void subcatch_validate(int j)

if ( area > 0.0 && Subcatch[j].subArea[i].N > 0.0 )
{
Subcatch[j].subArea[i].alpha = MCOEFF * Subcatch[j].width / area *
Subcatch[j].subArea[i].alpha = PHI * Subcatch[j].width / area *
sqrt(Subcatch[j].slope) / Subcatch[j].subArea[i].N;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/solver/transect.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void getGeometry(TTransect *transect, int i, double y)
if ( aSum == 0.0 )
transect->hradTbl[i] = transect->hradTbl[i-1];
else
transect->hradTbl[i] = pow(qSum * Nchannel / 1.49 / aSum, 1.5);
transect->hradTbl[i] = pow(qSum * Nchannel / PHI / aSum, 1.5);
}

//=============================================================================
Expand Down

0 comments on commit a831f4f

Please sign in to comment.