Return a constant D function.

Given \(D_0\), returns the function D:

\[D(S) = D_0\]

D0 (float) – \(D_0\), a positive constant


D – Function that maps any value of S to the given constant. It can be called as D(S) to obtain the value. It can also be called as D(S, n) with n equal to 1 or 2, in which case the first n derivatives of the function, which are always zero, are included (in order) as additional return values. While mathematically a scalar function, D operates in a vectorized fashion with the same semantics when S is a numpy.ndarray.

Return type



This function is not particularly useful: a constant D will turn a diffusion problem into a linear one, which has an exact solution and no numerical solvers are necessary. However, it is provided here given that it is the simplest supported function.