#ifndef CS_DIURNAL_KINETICS_UDF_H
#define CS_DIURNAL_KINETICS_UDF_H

#define __Ny__  10

// Kv is dependent on y-coordinate.
static inline real_t Kv(uint32_t y)
{
    const real_t y_0 = 30.0000000000000000000;
    const real_t y_1 = 50.0000000000000000000;
    const real_t Kv0 = 0.0000000100000000000;
    const real_t dy  = (y_1 - y_0) / (__Ny__-1);

    return Kv0 * exp( (y_0 + y * dy) / 5.0 );
}

// Kv function used when evaluating derivatives.
// It returns the same value but kernels generated in C need the return value to be adouble type.
// Therefore, to make the kernel operable in both C and C++ return _constant_(Kv) which returns adouble object.
static inline adouble Kv_deriv(uint32_t y)
{
    real_t kv = Kv(y);
    return _constant_(kv);
}
#endif