Adjoint Calculation

Using DifferentiationInterface.jl

using ECCO, Mooncake
using ECCO.DifferentiationInterface

f(x)=ECCO.AirSeaFluxes.bulkformulae(x[1],x[2],x[3],x[4]).hl
x=[300.,0.001,1.,10.]
backend = AutoMooncake(; config=nothing)

ad=ECCO.calc_adjoint(f,backend,x)
ECCO.adjoint_result(-3.0606099804357885, [0.0, 458.8925283180731, -3.0606099804357885, -0.22420640717946])

Optimization

using ECCO

f(x) = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
x0 = [0.0, 0.0]
op=ECCO.calc_optim(f,x0)
ECCO.optim_result(Main.f, identity, [0.0, 0.0], [0.9999634355313174, 0.9999315506115275],  * Status: success

 * Candidate solution
    Final objective value:     3.525527e-09

 * Found with
    Algorithm:     Nelder-Mead

 * Convergence measures
    √(Σ(yᵢ-ȳ)²)/n ≤ 1.0e-08

 * Work counters
    Seconds run:   0  (vs limit Inf)
    Iterations:    60
    f(x) calls:    117
)