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

[API] setting a water quality boundary condition on a tank #793

Open
samhatchett opened this issue May 23, 2024 · 2 comments
Open

[API] setting a water quality boundary condition on a tank #793

samhatchett opened this issue May 23, 2024 · 2 comments

Comments

@samhatchett
Copy link
Member

I have a need to use an external process to explicitly set water age at a Tank during a water quality simulation. While setting a WQ "Source" may work for non-age simulations, it appears that I can only force a Reservoir to have a specific age.

To force the Tank to have the "proper" age, I have previously addressed this need by adding special handling to the EN_setnodevalue function:

  case EN_INITQUAL:
    if (value < 0.0)
      return (202);
    node->C0 = value / m->Ucf[QUALITY];
    if (isTank) {
      tank->C = node->C0;
    }
    break;

I suppose the question is, does this rub anyone the wrong way? Is this a misuse of the toolkit on a philosophical level? And if I open a PR for this change, what discussion would anyone like to have about this?

@LRossman
Copy link
Collaborator

It rubs me the wrong way since it would be violating conservation of mass by not considering how age in the tank gets mixed with the age of the inflow during a filling period. This would show up in the reported mass balance listing.

Another way to simulate age is by treating it as a chemical with a zero-order reaction whose rate coefficient is +1 in all pipes. To keep the age in the tank constant at some specified initial value you would set its rate coefficient to 0. Then to make sure that water entering or leaving stays at that value you place a Set Point booster source at a node directly connected to the tank with its quality value the same as used for the tank. I tried this with Net1.inp, setting the age in its Tank 2 to 24 hrs, and it seemed to work (see the figure below -- Junction 1, which contains the source, is a node added directly below the tank).
image

P.S. @samhatchett out of curiosity, where did the code snippet you showed come from. It's quite different from that in the EN_setnodevalue function in epanet.c.

@samhatchett
Copy link
Member Author

@LRossman the snippet came from an outdated private branch of epanet that I used to "get the job done" - just going through all that and trying to clean up and/or atone for my transgressions ;)

The approach makes sense, and I completely agree that my suggestion is a blatant abuse of power w/r/t/ water quality modeling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants