○ 差分 (derivative.rb)
def derivative(pv, pv0)
if @dfirst == nil
@rank = 1
@alpha = 0.1
@dfirst = false
@nu = 1.0 / (pv.mm*(pv.mm+1) - 2.0) ** @rank
end
psi = pv.to_stream_func
#
# dq/dt = -J(ψ,q) -α(q-q0) +νΔ(q-q0)
#
return jacobian(psi, pv) * (- 2 * PI) - \
@alpha * (pv.spect - pv0.spect) + @nu * laplacian(pv - pv0)
end
def jacobian(a, b)
return a.jacobian(b)
end
def laplacian(a)
return a.laplacian
end