# 3.7. Reduced functional¶

class opentidalfarm.reduced_functional.ReducedFunctional(functional, controls, solver, parameters)[source]

Following parameters are expected:

Variables: functional – a PrototypeFunctional class. controls – a TurbineFarmControl or dolfin_adjoint.DolfinAdjointControl class. solver – a Solver object. parameters – a ReducedFunctionalParameters object.

This class has a parameter attribute for further adjustments.

static default_parameters()[source]

Return the default parameters for the ReducedFunctional.

derivative(m_array, forget=True, **kwargs)[source]

Computes the first derivative of the functional with respect to its parameters by solving the adjoint equations.

derivative_with_check(m, seed=0.1, tol=1.8, forget=True)[source]

This function checks the correctness and returns the gradient of the functional for the parameter choice m.

evaluate(m, annotate=True)[source]

Return the functional value for the given parameter array.

class opentidalfarm.reduced_functional.ReducedFunctionalParameters[source]

A set of parameters for a ReducedFunctional.

Following parameters are available:

Variables: scale – A scaling factor. Default: 1.0 automatic_scaling – The reduced functional will be automatically scaled such that the maximum absolute value of the initial gradient is equal to the specified factor. Set to False to deactivate the automatic scaling. Default: 5. load_checkpoints – If True, the checkpoints are loaded from file and used. Default: False save_checkpoints – Automatically store checkpoints after each search iteration. Default: False checkpoint_basefilename – The base filename (without extensions) for storing or loading the checkpoints. Default: ‘checkpoints’.
class opentidalfarm.reduced_functional.TurbineFarmControl(farm)[source]

This class is required to that the parameter set works with dolfin-adjoint.