effluent.solver

The module contains the Solver class, which performs numerical integration of the differential equations described in Algorithm.

Classes

Solver

The class contains methods for solving the model equations.

Module Contents

class effluent.solver.Solver(beta_n=0.34, beta_t=0.17, mass_n=1.0, mass_t=0.18, method='RK45', rtol=0.001, atol=1e-06, first_step=0, max_step=0, start=0, stop=60, step=1)

The class contains methods for solving the model equations.

The constructor contains many adjustable parameters, related to the numerical solution procedure, the physical model parametrization and the density of output points. A more detailed description of each parameter is given in Solver parameters, Model parameters and Output parameters.

Parameters:
  • beta_n – Entrainment rate coefficient in the normal (across-jet) direction

  • beta_t – Entrainment rate coefficient in the tangential (along-jet) direction

  • mass_n – Added mass coefficient in the orthogonal direction

  • mass_t – Added mass coefficient in the tangential direction

  • method – Integration method to use

  • rtol – Relative tolerance

  • atol – Absolute tolerance

  • first_step – Initial step size

  • max_step – Maximum allowed step size

  • start – Time (in seconds) of first trajectory point

  • stop – Time (in seconds) of last trajectory point

  • step – Time (in seconds) between trajectory points

odefunc(t, y)

ODE function to be solved by scipy methods

The order of the variables is (x, y, z, u, v, w, density, radius)

Parameters:
  • t – Vectorized time parameter of shape (n_times, )

  • y – Input vector of shape (n_vars, n_times)

Returns:

Time derivative of the primary variables (n_vars, n_times)

set_ambient(ambient, time)

Set ambient conditions

Set ambient conditions of the initial value problem by sampling ocean data at a specific point in time.

Parameters:
set_init(pipe, time)

Set initial conditions

Set initial conditions of the initial value problem by sampling pipe parameters at a specific point in time.

Parameters:
  • pipe (effluent.io.Pipe) – Properties of the pipe and effluent discharge

  • time – Sampling time

solve()

Solve the differential equations described in Algorithm.

Internally, this function uses scipy.integrate.solve_ivp to compute the solution. Solver properties are set using the class constructor.

The returned dataset contains the value of each primary variable at the pre-determined output points. The variable names are x, y, z, u, v, w, density, radius, all indexed by the coordinate t.

The returned dataset also contains the secondary variable dilution, indexed by the coordinate t.

Returns:

An xarray.Dataset containing the solution

Return type:

xarray.Dataset

volume_change_ratio(t, y)

Compute the time derivative of log(V) according to (17).

This function is required to determine when the simulation should be terminated.

Parameters:
  • t – Seconds since release

  • y – Tuple of primary variables: x, y, z, u, v, w, density, radius

Returns:

Time derivative of log(V)