Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrections to 2-compartment tank mixing #821

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/qualreact.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: computes water quality reactions within pipes and tanks
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 03/12/2024
Last Updated: 12/16/2024
******************************************************************************
*/

Expand Down Expand Up @@ -566,10 +566,10 @@ void tankmix2(Project *pr, int i, double vin, double win, double vnet)
// Update segment volumes
if (vt > 0.0)
{
mixzone->v = vmz;
if (vnet > 0.0)
{
stagzone->v += vt;
mixzone->v = vmz;
stagzone->v += vt;

// Account for mass lost in overflow from stagnant zone
vsz = (tank->Vmax) - vmz;
Expand All @@ -579,14 +579,18 @@ void tankmix2(Project *pr, int i, double vin, double win, double vnet)
stagzone->v = vsz;
}
}
else stagzone->v = MAX(0.0, ((stagzone->v) - vt));
else
{
stagzone->v = MAX(0.0, ((stagzone->v) - vt));
mixzone->v = vmz + vt + vnet;
}
}
else
{
mixzone->v += vnet;
mixzone->v = MIN(mixzone->v, vmz);
mixzone->v = MAX(0.0, mixzone->v);
stagzone->v = 0.0;
if (vmz - mixzone->v > 0.0) stagzone->v = 0.0;
}

// Use quality of mixing zone to represent quality of
Expand Down
Loading