def METHOD_NAME(cols, rows, J, dN, dS, dE, dW, c, Lambda):
    for i in range(rows):
        for j in range(cols):
            k = i * cols + j  # current index
            # diffusion coefficent
            s = i + 1 if i < (rows - 1) else (rows - 1)
            e = j + 1 if j < (cols - 1) else (cols - 1)
            cN = c[k]
            cS = c[s * cols + j]
            cW = c[k]
            cE = c[i * cols + e]
            # divergence (equ 58)
            D = cN * dN[k] + cS * dS[k] + cW * dW[k] + cE * dE[k]
            # image update (equ 61)
            J[k] += 0.25*Lambda*D