opentidalfarm.memoize.
MemoizeMutable
(fn, hash_keys=False)[source]¶Implements a memoization function to avoid duplicated functional (derivative) evaluations
opentidalfarm.functionals.time_integrator.
TimeIntegrator
(problem, functional, final_only)[source]¶Bases: object
opentidalfarm.helpers.
FrozenClass
[source]¶Bases: object
A class which can be (un-)frozen. If the class is frozen, no attributes can be added to the class.
opentidalfarm.helpers.
OutputWriter
(functional)[source]¶Bases: object
Suite of tools to write output to disk
opentidalfarm.helpers.
cpu0only
(f)[source]¶A decorator class that only evaluates on the first CPU in a parallel environment.
opentidalfarm.helpers.
function_eval
(func, point)[source]¶A parallel safe evaluation of dolfin functions
opentidalfarm.helpers.
norm_approx
(u, alpha=0.0001)[source]¶A smooth approximation to \(\|u\|\):
Parameters: |
|
---|---|
Returns: | ufl expression – the approximate norm of u. |
opentidalfarm.helpers.
smooth_uflmin
(a, b, alpha=1e-08)[source]¶A smooth approximation to \(\min(a, b)\):
Parameters: |
|
---|---|
Returns: | ufl expression – the approximate \(\min\) function. |
opentidalfarm.helpers.
test_gradient_array
(J, dJ, x, seed=0.01, perturbation_direction=None, number_of_tests=5, plot_file=None)[source]¶Checks the correctness of the derivative dJ. x must be an array that specifies at which point in the parameter space the gradient is to be checked. The functions J(x) and dJ(x) must return the functional value and the functional derivative respectivaly.
This function returns the order of convergence of the Taylor series remainder, which should be 2 if the gradient is correct.
opentidalfarm.solvers.les.
LES
(V, u, smagorinsky_coefficient)[source]¶Bases: object
A solver for computing the eddy viscosity by solving:
where \(e\) is the eddy viscosity, \(s\) is the smagorinsky coefficient, \(w = \sqrt{\text{cell volume}}\) is the filter width, and \(I\) is the second invariant defined as:
Parameters:
Parameters: |
|
---|---|
Variables: | eddy_viscosity – The smagorinsky coefficient. |