anuga.Field_boundary
- class anuga.Field_boundary(filename, domain, mean_stage=0.0, time_thinning=1, time_limit=None, boundary_polygon=None, default_boundary=None, use_cache=False, verbose=False)[source]
Bases:
BoundaryBoundary condition driven by an SWW field file with optional stage offset.
Reads stage, x-momentum and y-momentum time series from an SWW file and applies them as a boundary condition, linearly interpolating in time. An optional mean_stage offset can be added to the stage values, which avoids regenerating the SWW file when running at different tide levels.
This is a thin wrapper around
File_boundary; the only difference is the mean_stage offset capability.- Parameters:
filename (str) – Path to the SWW file containing stage and momentum time series.
domain (anuga.Domain) – The domain to which this boundary is attached.
mean_stage (float, optional) – Constant offset added to the stage read from the file. Useful for running at different tidal datums without recreating the SWW file. Default
0.0.time_thinning (int, optional) – Read every time_thinning-th time step from the file. Larger values speed up model setup at the cost of temporal resolution. Default
1(all steps).time_limit (float or None, optional) – Stop reading the file after this time (seconds).
Nonemeans read to the end.boundary_polygon (list or None, optional) – Clip the SWW points to this polygon.
Nonemeans use all points.default_boundary (float or None, optional) – Stage returned when model time exceeds the file’s time range.
Noneraises an exception on out-of-range.use_cache (bool, optional) – Cache the interpolated field function. Default
False.verbose (bool, optional) – Emit progress messages. Default
False.
Examples
>>> import anuga >>> domain = anuga.rectangular_cross_domain(10, 10) >>> Bf = anuga.Field_boundary('boundary.sww', domain, mean_stage=0.5) >>> domain.set_boundary({'left': Bf, 'right': Bf, 'top': Bf, 'bottom': Bf})
- __init__(filename, domain, mean_stage=0.0, time_thinning=1, time_limit=None, boundary_polygon=None, default_boundary=None, use_cache=False, verbose=False)[source]
Initialise a field boundary.
- Parameters:
filename (str) – Path to the SWW file.
domain (anuga.Domain) – The domain to which this boundary is attached.
mean_stage (float, optional) – Stage offset (m). Default
0.0.time_thinning (int, optional) – Step stride when reading time steps. Default
1.time_limit (float or None, optional) – Maximum time to read from file.
boundary_polygon (list or None, optional) – Polygon used to clip SWW points.
default_boundary (float or None, optional) – Fallback stage when model time is out of range.
use_cache (bool, optional) – Enable caching. Default
False.verbose (bool, optional) – Verbosity flag. Default
False.
Methods
__init__(filename, domain[, mean_stage, ...])Initialise a field boundary.
evaluate([vol_id, edge_id])Calculate 'field' boundary results.
evaluate_segment([domain, segment_edges])Evaluate boundary condition at edges of a domain in a list defined by segment_edges
get_boundary_values([t])get_time()