# 3.2. Problems¶

Problems for OpenTidalFarm

class opentidalfarm.problems.steady_sw.SteadySWProblem(parameters)[source]

Create a steady-state shallow water problem:

$\begin{split}-\nabla\cdot\nu\nabla u+u\cdot\nabla u+g\nabla \eta + \frac{c_b + c_t}{H} \| u\| u &= f_u, \\ \nabla \cdot \left( H u \right) &= 0,\end{split}$

where

• $$u$$ is the velocity,
• $$\eta$$ is the free-surface displacement,
• $$H=\eta + h$$ is the total water depth where $$h$$ is the water depth at rest,
• $$f_u$$ is the velocity forcing term,
• $$c_b$$ is the (quadratic) natural bottom friction coefficient,
• $$c_t$$ is the (quadratic) friction coefficient due to the turbine farm,
• $$\nu$$ is the viscosity coefficient,
• $$g$$ is the gravitational constant,
Parameters: parameters – A SteadySWProblemParameters object containing the parameters of the problem.
static default_parameters()[source]

Returns a SteadySWProblemParameters with default parameters.

class opentidalfarm.problems.steady_sw.SteadySWProblemParameters[source]

A parameters set for a SteadySWProblem.

Domain parameters:

Variables: domain – The computational domain, see Domains.

Physical parameters:

Variables: depth – Water depth. Default: 50.0 g – Gravitational constant. Default: 9.81 viscosity – Water viscosity. Default: 3.0 friction – Natural bottom friction. Default: 0.0025 rho – Density of water. Default: 1025.0

Equation parameters:

Variables: include_advection – Boolean indicating if the advection is included. Default: True include_viscosity – Boolean indicating if the viscosity is included. Default: True linear_divergence – Boolean indicating if the divergence equation is linearised. Default: False f_u – A source term for the velocity component as a dolfin.Expression. Default: Constant((0, 0))

Boundary conditions:

Variables: bctype – Specifies how the boundary conditions should be enforced. Valid options are: ‘weak_dirichlet’, ‘strong_dirichlet’ or ‘flather’. Default: ‘strong_dirichlet’ bcs – A opentidalfarm.boundary_conditions.BoundaryConditionSet containing a list of boundary conditions for the problem.

Discretization settings:

Variables: finite_element – The finite-element pair to use. Default: opentidalfarm.finite_elements.p2p1

## 3.2.2. Multi steady shallow water¶

class opentidalfarm.problems.multi_steady_sw.MultiSteadySWProblem(parameters)[source]

Create a shallow water problem consisting of a sequence of (independent) steady-state shallow water problems. More specifically, it solves for each time-level $$n$$:

$\begin{split}-\nabla\cdot\nu\nabla u^n+u^n\cdot\nabla u^n+g\nabla \eta^n + \frac{c_b + c_t}{H^n} \| u^n\| u^n &= f_u^n, \\ \nabla \cdot \left( H^n u^n \right) &= 0,\end{split}$

where

• $$u$$ is the velocity,
• $$\eta$$ is the free-surface displacement,
• $$H=\eta + h$$ is the total water depth where $$h$$ is the water depth at rest,
• $$f_u$$ is the velocity forcing term,
• $$c_b$$ is the (quadratic) natural bottom friction coefficient,
• $$c_t$$ is the (quadratic) friction coefficient due to the turbine farm,
• $$\nu$$ is the viscosity coefficient,
• $$g$$ is the gravitational constant,
parameter parameters:
A MultiSteadySWProblemParameters object containing the parameters of the problem.
static default_parameters()[source]

Returns a dictionary with the default parameters

class opentidalfarm.problems.multi_steady_sw.MultiSteadySWProblemParameters[source]

A set of parameters for a MultiSteadySWProblem.

The parameters are as described in opentidalfarm.problems.steady_sw.SteadySWProblemParameters.

In addition following parameters are available:

Temporal parameters:

Variables: dt – The timestep. Default: 1.0. start_time – The start time. Default: 0.0. finish_time – The finish time. Default: 100.0.

## 3.2.3. Time-dependent shallow water¶

class opentidalfarm.problems.sw.SWProblem(parameters)[source]

Create a transient shallow water problem:

$\begin{split}\frac{\partial u}{\partial t} -\nabla\cdot\nu\nabla u+u\cdot\nabla u+g\nabla \eta + \frac{c_b + c_t}{H} \| u\| u &= f_u, \\ \frac{\partial \eta}{\partial t} + \nabla \cdot \left( H u \right) &= 0,\end{split}$

where

• $$u$$ is the velocity,
• $$\eta$$ is the free-surface displacement,
• $$H=\eta + h$$ is the total water depth where $$h$$ is the water depth at rest,
• $$f_u$$ is the velocity forcing term,
• $$c_b$$ is the (quadratic) natural bottom friction coefficient,
• $$c_t$$ is the (quadratic) friction coefficient due to the turbine farm,
• $$\nu$$ is the viscosity coefficient,
• $$g$$ is the gravitational constant,
Parameters: parameters – A SWProblemParameters object containing the parameters of the problem.
static default_parameters()[source]

Returns a dictionary with the default parameters

class opentidalfarm.problems.sw.SWProblemParameters[source]

A set of parameters for a SWProblem.

The parameters are as described in opentidalfarm.problems.steady_sw.SteadySWProblemParameters.

In addition following parameters are available:

Time parameters:

Variables: theta – The theta value for the timestepping-scheme. Default 1.0. dt – The timestep. Default: 1.0. start_time – The start time. Default: 0.0. finish_time – The finish time. Default: 100.0.

Functional time integration paramters (FIXME: Move to reduced functional):

Variables: functional_final_time_only – Boolean indicating if the functional should be integrated over time or evaluated at the end of time only. Default: False.