コード例 #1
0
ファイル: diffuse.py プロジェクト: katmratliff/avulsion-bmi
def calc_crevasse_dep(dx, dy, nu, dt, ch_depth, riv_i, riv_j, n,
                      sea_level, slope, loc):
    """Calculate crevasse splay deposition rate."""

    beach_len = find_beach_length_riv_cell(n, (riv_i[-2], riv_j[-2]),
                                  (riv_i[-1], riv_j[-1]), sea_level,
                                  ch_depth, slope, dx=dx, dy=dy)

    n_river = n[riv_i, riv_j]
    n_river[-1] = sea_level - ch_depth
    s_river = get_channel_distance((riv_i, riv_j), dx=dx, dy=dy)
    s_river[-1] += beach_len

    dn_rc = (nu * dt) * solve_second_derivative(s_river, n_river)

    # average deposition in 3 cells above 'breach' to find
    # crevasse splay deposition rate
    if len(dn_rc[:loc]) >= 3:
        splay_dep = np.average(dn_rc[loc-3:loc])
    else: splay_dep = dn_rc[loc-1]

    if splay_dep < 0:
        splay_dep = 0

    return splay_dep
コード例 #2
0
ファイル: diffuse.py プロジェクト: mcflugen/avulsion-bmi
def smooth_rc(dx, dy, nu, dt, riv_i, riv_j, n):
    """Smooth river channel elevations using the diffusion equation.

    Parameters
    ----------
    dx : float
        Spacing of grid columns.
    dy : float
        Spacing of grid rows.
    nu : float
        Diffusion coefficient.
    dt : float
        Time step (in seconds).
    riv_i : ndarray
        Row indices for the river path.
    riv_j : ndarray
        Column indices for the river path.
    n : ndarray
        2D array of grid elevations.
    """
    # NOTE: Divide by dx to match the old way, but I don't think this is
    # correct.
    # nu /= dx
    # KMR 8/24/15: don't need to divide by dx anymore, diffusion coeff
    # should be fixed with new calculation

    n_river = n[riv_i, riv_j]
    s_river = get_channel_distance((riv_i, riv_j), dx=dx, dy=dy)

    dn_rc = (nu * dt) * solve_second_derivative(s_river, n_river)

    n[riv_i[1:-1], riv_j[1:-1]] += dn_rc

    return
コード例 #3
0
ファイル: diffuse.py プロジェクト: katmratliff/avulsion-bmi
def smooth_rc(dx, dy, nu, dt, ch_depth, riv_i, riv_j, n, sea_level, slope):
    """Smooth river channel elevations using the diffusion equation.

    Parameters
    ----------
    dx : float
        Spacing of grid columns.
    dy : float
        Spacing of grid rows.
    nu : float
        Diffusion coefficient.
    dt : float
        Time step (in seconds).
    riv_i : ndarray
        Row indices for the river path.
    riv_j : ndarray
        Column indices for the river path.
    n : ndarray
        2D array of grid elevations.
    """

    beach_len = find_beach_length_riv_cell(n, (riv_i[-2], riv_j[-2]),
                                  (riv_i[-1], riv_j[-1]), sea_level,
                                  ch_depth, slope, dx=dx, dy=dy)


    n_river = n[riv_i, riv_j]
    n_river[-1] = sea_level - ch_depth
    s_river = get_channel_distance((riv_i, riv_j), dx=dx, dy=dy)
    s_river[-1] += beach_len

    dn_rc = (nu * dt) * solve_second_derivative(s_river, n_river)

    n[riv_i[1:-1], riv_j[1:-1]] += dn_rc

    return dn_rc