Skip to content

Commit

Permalink
WIP API and bindings unit testing; cleaning up #204, #162, #163, #184,
Browse files Browse the repository at this point in the history
  • Loading branch information
cbuahin committed Dec 22, 2024
1 parent 14e0a0a commit 0a78d5e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/solver/lid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,8 +1789,7 @@ double getImpervAreaRunoff(int j)
{
q *= Subcatch[j].subArea[IMPERV0].fOutlet;
}
nonLidArea = Subcatch[j].area - Subcatch[j].lidArea;
nonLidArea = 0.0 < nonLidArea ? 0.0 : nonLidArea;
nonLidArea = MAX(0.0, Subcatch[j].area - Subcatch[j].lidArea);
return q * nonLidArea;
}

Expand All @@ -1816,7 +1815,7 @@ double getPervAreaRunoff(int j)
{
q *= Subcatch[j].subArea[PERV].fOutlet;
}
nonLidArea = max(0.0, Subcatch[j].area - Subcatch[j].lidArea);
nonLidArea = MAX(0.0, Subcatch[j].area - Subcatch[j].lidArea);
return q * nonLidArea;
}

Expand Down
3 changes: 1 addition & 2 deletions src/solver/qualrout.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ void findNodeQual(int j)

// --- Calculate bounded externally provided api pollutant flux and update mass balance
// --- Positive fluxes are added in the addExternalInflows function in routing.c (This really needs to be refactored for consistency)
cOut = -Node[j].apiExtQualMassFlux[p] / qNode;
cOut = cOut < 0.0 ? 0.0 : cOut > cIn ? cIn : cOut;
cOut = MIN(cIn, MAX(0.0, -Node[j].apiExtQualMassFlux[p] / qNode));
cIn -= cOut;
massbal_addOutflowQual(p, cOut * qNode, FALSE);

Expand Down
3 changes: 1 addition & 2 deletions src/solver/subcatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,7 @@ double subcatch_getRunoff(int j, double tStep)
// --- find volume of inflow to non-LID portion of subcatchment as existing
// ponded water + any runon volume from upstream areas;
// rainfall and snowmelt will be added as each sub-area is analyzed
nonLidArea = Subcatch[j].area - Subcatch[j].lidArea;
nonLidArea = nonLidArea < 0.0 ? 0.0 : nonLidArea;
nonLidArea = MAX(0.0, Subcatch[j].area - Subcatch[j].lidArea);
vRunon = Subcatch[j].runon * tStep * nonLidArea;
Vinflow = vRunon + subcatch_getDepth(j) * nonLidArea;

Expand Down
3 changes: 1 addition & 2 deletions src/solver/surfqual.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ void surfqual_getBuildup(int j, double tStep)
newBuildup = MAX(newBuildup, oldBuildup);

//--- add bounded building from external API
newBuildup = newBuildup + Subcatch[j].apiExtBuildup[p] * area;
newBuildup = newBuildup < 0.0 ? 0.0 : newBuildup;
newBuildup = MAX(0.0, newBuildup + Subcatch[j].apiExtBuildup[p] * area);

Subcatch[j].landFactor[i].buildup[p] = newBuildup;
massbal_updateLoadingTotals(BUILDUP_LOAD, p,
Expand Down

0 comments on commit 0a78d5e

Please sign in to comment.