anuga.Domain
- class anuga.Domain(coordinates: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, vertices: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, boundary: dict | None = None, tagged_elements: dict | None = None, geo_reference=None, use_inscribed_circle: bool = False, mesh_filename: str | None = None, use_cache: bool = False, verbose: bool = False, conserved_quantities: list[str] | None = None, evolved_quantities: list[str] | None = None, other_quantities: list[str] | None = None, full_send_dict: dict | None = None, ghost_recv_dict: dict | None = None, starttime: float = 0, processor: int = 0, numproc: int = 1, number_of_full_nodes: int | None = None, number_of_full_triangles: int | None = None, ghost_layer_width: int = 2, **kwargs)[source]
Object which encapulates the shallow water model
This class is a specialization of class Generic_Domain from module generic_domain.py consisting of methods specific to the Shallow Water Wave Equation
Shallow Water Wave Equation
\[U_t + E_x + G_y = S\]where
\[U = [w, uh, vh]^T\]\[E = [uh, u^2h + gh^2/2, uvh]\]\[G = [vh, uvh, v^2h + gh^2/2]\]S represents source terms forcing the system (e.g. gravity, friction, wind stress, …)
and _t, _x, _y denote the derivative with respect to t, x and y respectively.
The quantities are
symbol
variable name
explanation
x
x
horizontal distance from origin [m]
y
y
vertical distance from origin [m]
z
elevation
elevation of bed on which flow is modelled [m]
h
height
water height above z [m]
w
stage
absolute water level, w = z+h [m]
u
speed in the x direction [m/s]
v
speed in the y direction [m/s]
uh
xmomentum
momentum in the x direction [m^2/s]
vh
ymomentum
momentum in the y direction [m^2/s]
eta
mannings friction coefficient [to appear]
nu
wind stress coefficient [to appear]
The conserved quantities are w, uh, vh
- __init__(coordinates: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, vertices: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, boundary: dict | None = None, tagged_elements: dict | None = None, geo_reference=None, use_inscribed_circle: bool = False, mesh_filename: str | None = None, use_cache: bool = False, verbose: bool = False, conserved_quantities: list[str] | None = None, evolved_quantities: list[str] | None = None, other_quantities: list[str] | None = None, full_send_dict: dict | None = None, ghost_recv_dict: dict | None = None, starttime: float = 0, processor: int = 0, numproc: int = 1, number_of_full_nodes: int | None = None, number_of_full_triangles: int | None = None, ghost_layer_width: int = 2, **kwargs) None[source]
Instantiate a shallow water domain.
- Parameters:
coordinates – vertex locations for the mesh
vertices – vertex indices defining the triangles of the mesh
boundary – boundaries of the mesh
Methods
__init__([coordinates, vertices, boundary, ...])Instantiate a shallow water domain.
add_quantity(name, *args, **kwargs)Add values to a named quantity
apply_fractional_steps()Override to sync GPU data before fractional step operators run.
apply_protection_against_isolated_degenerate_timesteps()backup_conserved_quantities()boundary_statistics([quantities, tags])Output statistics about boundary forcing at each timestep
build_tagged_elements_dictionary(*args, **kwargs)centroid_norm(quantity, normfunc)Calculate the norm of the centroid values of a specific quantity, using normfunc.
check_integrity()Run integrity checks on shallow water domain.
compute_boundary_flows()Compute boundary flows at current timestep.
compute_fluxes()Compute fluxes and timestep suitable for all volumes in domain.
compute_forcing_terms()If there are any forcing functions driving the system they should be defined in Domain subclass and appended to the list self.forcing_terms
compute_total_volume()Compute total volume (m^3) of water in entire domain
conserved_values_to_evolved_values(q_cons, ...)Needs to be overridden by Domain subclass
create_quantity_from_expression(expression)Create new quantity from other quantities using arbitrary expression.
distribute_edges_to_vertices()Distribute edge values to vertices.
distribute_to_edges()extrapolate centroid values edges
distribute_to_vertices_and_edges([...])extrapolate centroid values to vertices and edges
dump_triangulation([filename])Get vertex coordinates, partition full and ghost triangles based on self.tri_full_flag
evolve([yieldstep, outputstep, finaltime, ...])Evolve method from Domain class.
evolve_one_euler_step(yieldstep, finaltime)One Euler Time Step Q^{n+1} = E(h) Q^n
evolve_one_rk2_step(yieldstep, finaltime)One 2nd order RK timestep Q^{n+1} = 0.5 Q^n + 0.5 E(h)^2 Q^n
evolve_one_rk3_step(yieldstep, finaltime)One 3rd order RK timestep Q^(1) = 3/4 Q^n + 1/4 E(h)^2 Q^n (at time t^n + h/2) Q^{n+1} = 1/3 Q^n + 2/3 E(h) Q^(1) (at time t^{n+1})
evolve_to_end([finaltime])Iterate evolve all the way to the end.
get_CFL()get CFL
get_algorithm_parameters()Get the standard parameter that are currently set (as a dictionary)
get_area(*args, **kwargs)get_areas(*args, **kwargs)get_beta()Get default beta for limiting.
get_boundary_flux_integral()Compute the boundary flux integral.
get_boundary_polygon(*args, **kwargs)get_boundary_tags(*args, **kwargs)get_centroid_coordinates(*args, **kwargs)get_centroid_transmissive_bc()Get value of centroid_transmissive_bc flag.
get_cfl()get CFL
get_compute_fluxes_method()Get method for computing fluxes.
get_conserved_quantities(vol_id[, vertex, edge])Get conserved quantities at volume vol_id.
get_datadir()get_datetime([timestamp])Retrieve datetime corresponding to current timestamp wrt to domain timezone
get_disconnected_triangles(*args, **kwargs)get_edge_midpoint_coordinate(*args, **kwargs)get_edge_midpoint_coordinates(*args, **kwargs)get_energy_through_cross_section(polyline[, ...])Obtain average energy head [m] across specified cross section.
get_evolve_max_timestep()Set default max_timestep for evolving.
get_evolve_min_timestep()Set default max_timestep for evolving.
get_evolve_starttime()get_evolved_quantities(vol_id[, vertex, edge])Get evolved quantities at volume vol_id.
get_extent(*args, **kwargs)Get method used for timestepping and spatial discretisation
get_flow_through_cross_section(polyline[, ...])Get the total flow through an arbitrary poly line.
get_fractional_step_volume_integral()Compute the integrated flows from fractional steps.
get_full_centroid_coordinates(*args, **kwargs)get_full_nodes(*args, **kwargs)get_full_triangles(*args, **kwargs)get_full_vertex_coordinates(*args, **kwargs)get_georeference(*args, **kwargs)get_global_name()get_hemisphere()get_interpolation_object(*args, **kwargs)get_intersecting_segments(*args, **kwargs)get_inv_tri_map()get_lone_vertices(*args, **kwargs)get_maximum_inundation_elevation([indices, ...])Return highest elevation where h > 0
get_maximum_inundation_location([indices])Return location of highest elevation where h > 0
get_minimum_allowed_height()get_minimum_storable_height()get_multiprocessor_mode()Get multiprocessor mode
get_name()get_nodes(*args, **kwargs)get_normal(*args, **kwargs)get_number_of_full_triangles(*args, **kwargs)get_number_of_nodes(*args, **kwargs)get_number_of_triangles(*args, **kwargs)get_number_of_triangles_per_node(*args, **kwargs)get_quantity(name[, location, indices])Get pointer to quantity object.
get_quantity_names()Get a list of all the quantity names that this domain is aware of.
get_radii(*args, **kwargs)get_relative_time()Set internal relative time
get_starttime([datetime])return starttime, either as timestamp, or as a datetime
get_store()Get whether data saved to sww file.
get_store_centroids()Get whether data saved to sww file.
get_tagged_elements(*args, **kwargs)get_time()Get the absolute model time (seconds).
get_timestep()get current timestep (seconds).
get_timestepping_method()get_timezone()Retrieve current domain timezone
get_tri_map()get_triangle_containing_point(*args, **kwargs)get_triangles(*args, **kwargs)get_triangles_and_vertices_per_node(*args, ...)get_triangles_inside_polygon(*args, **kwargs)get_unique_vertices(*args, **kwargs)get_using_centroid_averaging()get_using_discontinuous_elevation()Return boolean indicating whether algorithm is using dicontinuous elevation
get_vertex_coordinate(*args, **kwargs)get_vertex_coordinates(*args, **kwargs)get_water_volume()get_wet_elements([indices, minimum_height])Return indices for elements where h > minimum_allowed_height
get_zone()get zone for domain Geo_reference
initialise_storage()Create and initialise self.writer object for storing data.
log_operator_timestepping_statistics()maximum_quantity(name, *args, **kwargs)max of values to a named quantity
minimum_quantity(name, *args, **kwargs)min of values to a named quantity
print_algorithm_parameters()Print the standard parameters that are curently set (as a dictionary)
print_boundary_statistics([quantities, tags])print_operator_statistics()print_operator_timestepping_statistics()print_statistics(*args, **kwargs)print_timestepping_statistics(*args, **kwargs)Print time stepping statistics.
print_volumetric_balance_statistics()protect_against_infinitesimal_and_negative_heights()Clean up the stage and momentum values to ensure non-negative heights
quantity_statistics([precision])Return string with statistics about quantities for printing or logging
report_cells_with_small_local_timestep([...])Convenience function to print the locations of cells with a small local timestep.
report_water_volume_statistics([verbose, ...])Compute the volume, boundary flux integral, fractional step volume integral, and their difference
saxpy_conserved_quantities(a, b[, c])set_CFL([cfl])Set CFL parameter, warn if greater than 2.0
set_beta(beta)Shorthand to assign one constant value [0,2] to all limiters.
set_betas(beta_w, beta_w_dry, beta_uh, ...)Assign beta values in the range [0,2] to all limiters.
set_boundary(boundary_map)Associate boundary objects with tagged segments (see base class).
set_centroid_transmissive_bc(flag)Set behaviour of the transmissive boundary condition, namely calculate the BC using the centroid value of neighbouring cell or the calculated edge value.
set_collect_max_quantities([...])Create (or return existing) Collect_max_quantities_operator on this domain.
set_cfl([cfl])Set CFL parameter, warn if greater than 2.0
set_checkpointing([checkpoint, ...])Set up checkpointing.
set_compute_fluxes_method([flag])Set method for computing fluxes.
set_datadir(name)set_default_order(n)Set default (spatial) order to either 1 or 2.
set_evolve_max_timestep(max_timestep)Set default max_timestep for evolving.
set_evolve_min_timestep(min_timestep)Set default min_timestep for evolving.
set_evolve_starttime(time)set_extrapolate_velocity([flag])Extrapolation routine uses momentum by default, can change to velocity extrapolation which seems to work better.
set_fixed_flux_timestep([flux_timestep])Disable variable timestepping and manually set a fixed flux_timestep
set_flow_algorithm([algorithm])Set combination of slope limiting and time stepping
set_fractional_step_operator(operator)set_georeference(*args, **kwargs)set_gpu_interface()set_hemisphere(hemisphere)set_institution(institution)set_low_froude([low_froude])For low Froude problems the standard flux calculations can lead to excessive damping.
set_maximum_allowed_speed(maximum_allowed_speed)Set the maximum particle speed that is allowed in water shallower than minimum_allowed_height.
set_minimum_allowed_height(...)Set minimum depth that will be recognised in the numerical scheme.
set_minimum_storable_height(...)Set the minimum depth that will be written to an SWW file.
set_multiprocessor_mode([multiprocessor_mode])Set multiprocessor mode (legacy integer API).
set_name([name, timestamp])Assign a name to this simulation.
set_omp_num_threads([omp_num_threads, verbose])Set the OpenMP thread count (process-wide).
set_plotter(*args, **kwargs)Set the plotter for this domain
set_points_file_block_line_size(...)set_quantities_to_be_monitored(q[, polygon, ...])Specify which quantities will be monitored for extrema.
set_quantities_to_be_stored(q)Specify which quantities will be stored in the SWW file.
set_quantity(name, *args, **kwargs)Set values for named quantity
set_quantity_vertices_dict(quantity_dict)Set values for named quantities.
set_relative_time([time])Set internal relative time
set_sloped_mannings_function([flag])Set mannings friction function to use the sloped wetted area.
set_starttime([timestamp])Set the starttime for the evolution
set_store([flag])Set whether data saved to sww file.
set_store_centroids([flag])Set whether centroid data is saved to sww file.
set_store_vertices_smoothly([flag, reduction])Decide whether vertex values should be stored smoothly (one value per vertex) or uniquely as computed in the model (False).
set_store_vertices_uniquely([flag, reduction])Decide whether vertex values should be stored uniquely as computed in the model (True) or whether they should be reduced to one value per vertex using self.reduction (False).
set_tag_region(*args, **kwargs)Set quantities based on a regional tag.
set_time([time])Set the model time (seconds).
set_timestepping_method(timestepping_method)set_timezone([tz])Set timezone for domain
set_use_kinematic_viscosity([flag])set_use_optimise_dry_cells([flag])Try to optimize calculations where region is dry
set_using_centroid_averaging([flag])Set flag to use centroid averaging in output of smoothed vertex values.
set_using_discontinuous_elevation([flag])Set flag to show whether compute flux algorithm is allowing discontinuous elevation.
set_zone(zone)Set zone for domain.
statistics(*args, **kwargs)store_timestep()Store time dependent quantities and time.
sww_merge(*args, **kwargs)Dummy function for sequential algorithms where the sww produced is the final products.
timestepping_statistics([track_speeds, ...])Return string with time stepping statistics for printing or logging
tripcolor(*args, **kwargs)triplot(*args, **kwargs)update_boundary()Go through list of boundary objects and update boundary values for all conserved quantities on boundary.
update_boundary_old()Go through list of boundary objects and update boundary values for all conserved quantities on boundary.
update_boundary_old_2()Go through list of boundary objects and update boundary values for all conserved quantities on boundary.
update_centroids_of_momentum_from_velocity()Calculate the centroid value of x and y momentum from height and velocities.
update_centroids_of_velocities_and_height()Calculate the centroid values of velocities and height based on the values of the quantities stage and x and y momentum
update_conserved_quantities()Update vectors of conserved quantities using previously computed fluxes and specified forcing functions.
update_extrema()Update extrema if requested by set_quantities_to_be_monitored.
update_ghosts([quantities])Override to use GPU ghost exchange when in GPU mode.
update_other_quantities()There may be a need to calculate some of the other quantities based on the new values of conserved quantities
update_special_conditions()update_timestep(yieldstep, finaltime)Calculate the next timestep to take
volumetric_balance_statistics()Create volumetric balance report suitable for printing or logging.
write_boundary_statistics([quantities, tags])write_time([track_speeds])Attributes
flux_timestepCurrent flux timestep [s]
gGravitational acceleration [m/s^2]
timestepCurrent timestep [s]