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

Water quality simulation with bulk coefficient and limiting potential not working properly #461

Open
belottif opened this issue Dec 4, 2024 · 1 comment
Assignees

Comments

@belottif
Copy link

belottif commented Dec 4, 2024

Summary
I'm running a water quality simulation using as a test the Net3 network. I added one source with strength 7.4 at the tank '1'. I set a bulk coefficients for each pipe in the network and a global limiting potential of 15. I would expect that the quality at some nodes in the network would increase until reaching 15, but this is not happening. In some cases the quality also decrease instead of increasing. After trying different limiting potentials and different bulk coefficients the results change sometimes based on the bulk coefficients, but it doesn't seem that the limiting potential plays a role. Moreover, for a first order reaction in which unit should I define the bulk coefficients? I guess I should write them in 1/d and then they will transformed by WNTR into 1/s during calculation, is it right?

Example
import wntr
wn = wntr.network.WaterNetworkModel('Net3.inp')
wn.options.quality.parameter = 'CHEMICAL'
wn.add_source('S', '1', 'CONCEN', 7.4,'SourcePattern')
wn.options.reaction.limiting_potential = 15
wn.options.reaction.bulk_coeff = 0.1
lake = wn.get_node('Lake')
lake.initial_quality = 7.4
river = wn.get_node('River')
river.initial_quality = 7.4
for name, junction in wn.junctions():
junction.initial_quality = 7.4

sim = wntr.sim.EpanetSimulator(wn)
base = sim.run_sim()
results = base.node['quality']

Environment
Provide information on your computing environment.

  • Operating system: Windows 10 Enterprise
  • Python version: 3.11.5
  • WNTR version: 1.1.0
@ucchejbb
Copy link

@belottif The code snippet below seems to behave the way I would expect in EPANET when I tested it. Please let us know if you have additional questions.

wn = wntr.network.WaterNetworkModel(‘Net3.inp')
wn.options.quality.parameter = 'CHEMICAL'

wn.add_source('S', '1', 'CONCEN', 7.4e-3, 'SourcePattern')
wn.options.reaction.limiting_potential = 15 ## Not currently converted by WNTR
wn.options.reaction.bulk_coeff = 1/(3600*24) ## 1 /day would be input to EPANET, /sec
lake = wn.get_node('Lake').initial_quality = 7.4e-3 ## kg/m**3 or g/L
river = wn.get_node('River').initial_quality = 7.4e-3
for name, junction in wn.junctions():
wn.get_node(junction).initial_quality = 7.4e-3 #7.4
# junction.initial_quality = 7.4 ## this should also work, but I left the alternate way I used

for tank in wn.tank_name_list:
wn.get_node(tank).initial_quality = 7.4e-3

sim = wntr.sim.EpanetSimulator(wn)
base = sim.run_sim()
results = base.node['quality']

for i in ['1', '2', '3', '117']:
plt.plot(results.index/3600, ## to convert to hr
results[i].values* 1e3, ## to convert to mg/L
label=i)

plt.ylabel('Chemical (mg/L)')
plt.xlabel('Time (hours)')
plt.legend()

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

3 participants