anuga_core icon indicating copy to clipboard operation
anuga_core copied to clipboard

set_quantity()

Open Dongxueyang opened this issue 5 years ago • 3 comments

Hi all: @stoiver I want to use a polygon to set stage and I write like this in model file:

polygon = anuga.read_polygon('extent.csv') domain.set_quantity('stage',polygon)

I know it was wrong. But I do not know which parameters should I prepare to input this function. So is it possible to set const stage inside a polygon. (I see polygon in file quantity.py about the function set_quantity()) And what is the format of polygon file. which information should be included in polygon file.

Best regards dong

Dongxueyang avatar Aug 29 '19 14:08 Dongxueyang

@Dongxueyang the following should work to set the stage within the polygon to a value.

polygon = anuga.read_polygon('extent.csv') domain.set_quantity('stage',numeric = value, polygon=polygon)

There is another procedure Set_stage which actually creates an object which will set teh stage when required.

stage_setter = Set_stage(domain, stage=value, polygon=polygon)

then later do this

stage_setter()

to actually set the centroids within the polygon to the given value (which can be a function of x,y

stoiver avatar Aug 29 '19 22:08 stoiver

@stoiver Thanks a lot. Your adivece is helpful and my porblem has been solved. Best regards.

Dongxueyang avatar Aug 30 '19 05:08 Dongxueyang

@stoiver I have a question about the boundary types. I find about 10 boundary types in file anuga/shallow_water/boundaries.py. I can get several examples about some types of them. But not all. And now I am interested in Inflow_boundary(Boundary). I want to set a inlet boundary in a polylines or a polygonal region and controlled by flow(m3/s)(function with time) based on this boundary type. It is better If I can read flow-time information from file.csv. So is it possible to achieve what I want? Is there some example about the Inflow_boundary() can be referred? Thanks your help so long time. Best regards dong

Dongxueyang avatar Aug 31 '19 02:08 Dongxueyang