Hello All,
I am developing a flood simulation model using ANUGA Hydro and I am interested in automatically detecting when the flood event has concluded. My goal is to configure the simulation to terminate as soon as the water depth is zero. (no floods) returns to zero. I would like to know if it is possible to program this condition into the ANUGA runtime.
thank you for your help.
kind regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello All,
I am developing a flood simulation model using ANUGA Hydro and I am interested in automatically detecting when the flood event has concluded. My goal is to configure the simulation to terminate as soon as the water depth is zero. (no floods) returns to zero. I would like to know if it is possible to program this condition into the ANUGA runtime.
I have implemented an if condition within my evolve loop to stop the simulation once the water depth in a specific downstream area (covering the river and floodplains) falls below a certain threshold. Although the code runs without errors, the simulation stops as soon as it begins. As a beginner in Python, I am unsure why this is happening or how to ensure the simulation only stops after the water has actually arrived and then receded.
ds_polygon = [[619708.796,3085199.395],[620345.056,3090989.363],[665901.284,3079345.802],[654066.845,3061594.143]]
region = anuga.Region(domain, polygon = ds_polygon)
indices = region.indices
for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime):
print(domain.timestepping_statistics())
current_depths = domain.quantities['height'].centroid_values[indices]
max_ds_depth = np.max(current_depths)
print(f"Time: {t}s, Max depth in polygon: {max_ds_depth:.3f}m")
thank you for your help.
kind regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Rup, the example code you have provided doesn't have an if statement in the evolve loop. Can you provide the actual code you are using. Also in the email the python indentation has been lost. I assume the code is correctly indented in the file?
Hello All,
I am developing a flood simulation model using ANUGA Hydro and I am interested in automatically detecting when the flood event has concluded. My goal is to configure the simulation to terminate as soon as the water depth is zero. (no floods) returns to zero. I would like to know if it is possible to program this condition into the ANUGA runtime.
thank you for your help.
kind regards,
Hi Rup,
Of course you could go into the anuga code to do this, but you can probably do what you want within a standard anuga script.
You can run multiple evolve loops of some fixed duration within a while loop. Break out of the while loop when your flood condition has occurred.
Cheers Steve
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: discussion@anuga.p.re.sourceforge.net discussion@anuga.p.re.sourceforge.net on behalf of Rup rupi@users.sourceforge.net
Sent: Tuesday, December 16, 2025 11:01:23 PM
To: [anuga:discussion] 593113@discussion.anuga.p.re.sourceforge.net
Subject: [anuga:discussion] Regarding custom runtime logic in ANUGA
Hello All,
I am developing a flood simulation model using ANUGA Hydro and I am interested in automatically detecting when the flood event has concluded. My goal is to configure the simulation to terminate as soon as the water depth is zero. (no floods) returns to zero. I would like to know if it is possible to program this condition into the ANUGA runtime.
thank you for your help.
kind regards,
Regarding custom runtime logic in ANUGAhttps://sourceforge.net/p/anuga/discussion/593113/thread/464d616331/?limit=25#c0fc
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/anuga/discussion/593113/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
hello,
I have implemented an if condition within my evolve loop to stop the simulation once the water depth in a specific downstream area (covering the river and floodplains) falls below a certain threshold. Although the code runs without errors, the simulation stops as soon as it begins. As a beginner in Python, I am unsure why this is happening or how to ensure the simulation only stops after the water has actually arrived and then receded.
ds_polygon = [[619708.796,3085199.395],[620345.056,3090989.363],[665901.284,3079345.802],[654066.845,3061594.143]]
region = anuga.Region(domain, polygon = ds_polygon)
indices = region.indices
stage = domain.quantities['stage'].centroid_values[indices]
elevation = domain.quantities['elevation'].centroid_values[indices]
depth = stage - elevation
yieldstep = 60
finaltime = 5400
t = 0
for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime):
print(domain.timestepping_statistics())
current_depths = domain.quantities['height'].centroid_values[indices]
max_ds_depth = np.max(current_depths)
print(f"Time: {t}s, Max depth in polygon: {max_ds_depth:.3f}m")
thank you for your help.
kind regards,
Rup, the example code you have provided doesn't have an if statement in the evolve loop. Can you provide the actual code you are using. Also in the email the python indentation has been lost. I assume the code is correctly indented in the file?
I would suggest creating variables
stage = domain.quantities['stage'].centroid_values
elev = domain.quantities['elevation'].centroid_values
before the evolve loop and calculate the depth specifically inside your evolve loop
depth = stage[indices] - elev[indicies]
and check on the state of depth to test for completion of your loop.
You might be able to use the break command to break out of the evolve loop. It would be interesting to see if that works.
Cheers
Steve