def test_infinite_taylor_error():
    mg = RasterModelGrid((5, 5))
    z = mg.add_zeros("node", "topographic__elevation")
    z += mg.node_x.copy() ** 4
    Cdiff = TaylorNonLinearDiffuser(mg, nterms=400)
    with pytest.raises(RuntimeError):
        Cdiff.soilflux(10)
def test_infinite_taylor_error():
    mg = RasterModelGrid((5, 5))
    z = mg.add_zeros("topographic__elevation", at="node")
    z += mg.node_x.copy()**4
    Cdiff = TaylorNonLinearDiffuser(mg, nterms=400)
    with pytest.raises(RuntimeError):
        Cdiff.soilflux(10)
def test_raise_stability_error():
    mg = RasterModelGrid((5, 5))
    z = mg.add_zeros("node", "topographic__elevation")
    z += mg.node_x.copy() ** 2
    Cdiff = TaylorNonLinearDiffuser(mg)
    with pytest.raises(RuntimeError):
        Cdiff.soilflux(10, if_unstable="raise")
def test_raise_stability_error():
    mg = RasterModelGrid((5, 5))
    z = mg.add_zeros("topographic__elevation", at="node")
    z += mg.node_x.copy()**2
    Cdiff = TaylorNonLinearDiffuser(mg, if_unstable="raise")
    with pytest.raises(RuntimeError):
        Cdiff.soilflux(10)