zoomy_core.model.models.legacy.shallow_water module

zoomy_core.model.models.legacy.shallow_water module#

Module zoomy_core.model.models.shallow_water.

class zoomy_core.model.models.legacy.shallow_water.ShallowWaterEquations(init_functions=True, **params)#

Bases: Model

Shallow Water Equations (SWE) Model. Automatically handles 1D and 2D based on ‘dimension’.

dimension = 1#
variables()#

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

aux_variables()#

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

g = 9.81#
ex = 0.0#
ey = 0.0#
ez = 1.0#
manning_n = 0.03#
chezy_C = 50.0#
nu = 0.0#
flux()#

Returns the Flux Tensor F of shape (n_vars, dimension).

source()#

Default source is zero. Subclass this or modify to return specific terms like: return self.topography_term() + self.manning_friction_term()

topography_term()#

Bathymetry source: S = [0, -gh * dz/dx, -gh * dz/dy]^T Assumes aux_variables contains [dh/dx, dh/dy].

newtonian_friction_term()#

Viscous friction: S = -nu * u / h

manning_friction_term()#

Manning friction: S = -g * n^2 * u * |u| / h^(7/3)

chezy_friction_term()#

Chezy friction: S = -1/C^2 * u * |u|

project_2d_to_3d()#

Maps state vector to 3D visualization vector. Out: [b, h, u, v, w, pressure]