anuga_core icon indicating copy to clipboard operation
anuga_core copied to clipboard

How to setup river level in anuga

Open chooron opened this issue 11 months ago • 5 comments

I have prepared the elevation data for the basin and the river polygon. However, when I run this code:

domain.set_quantity('stage', expression='elevation + %f' % 3, polygon=river_polygon)

I encounter the following error:


Traceback (most recent call last):
  File "D:\miniconda3\envs\anuga_env\lib\site-packages\IPython\core\interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-3914e5c91e47>", line 1, in <module>
    domain.set_quantity('stage', expression='elevation + %f' % 3, polygon=river_polygon)
  File "D:\miniconda3\envs\anuga_env\lib\site-packages\anuga\shallow_water\shallow_water_domain.py", line 1058, in set_quantity
    Generic_Domain.set_quantity(self, name, *args, **kwargs)
  File "D:\miniconda3\envs\anuga_env\lib\site-packages\anuga\abstract_2d_finite_volumes\generic_domain.py", line 722, in set_quantity
    self.quantities[name].set_values(*args, **kwargs)
  File "D:\miniconda3\envs\anuga_env\lib\site-packages\anuga\abstract_2d_finite_volumes\quantity.py", line 839, in set_values
    raise Exception(msg)
Exception: With a polygon selected, 'set_quantity' must provide the 'numeric' keyword, and it must be a constant value.

Therefore, I want to know how to initialize the water level of the river using a polygon. When I run the code:

domain.set_quantity('stage', 1900, polygon=river_polygon)

It seems to run without errors, but the river stages are definitely inconsistent."

chooron avatar Sep 12 '23 03:09 chooron