示例#1
0
def impose_bcp(hv, hs, v, s, rho, mu, nx, dx, order, r, tau_1, tau_2):

    # enforces boundry condition for right boundry

    # impose boundary conditions
    import numpy as np
    import boundarycondition

    # penalty weights
    h11 = np.zeros((1, 1))
    penaltyweights(h11, order, dx)

    pv = np.zeros((1, 1))
    ps = np.zeros((1, 1))

    vn = v[nx - 1, :]
    sn = s[nx - 1, :]

    # compute SAT terms
    boundarycondition.bcp(pv, ps, vn, sn, rho, mu, r)

    # penalize boundaries with the SAT terms

    hv[nx - 1, :] = hv[nx - 1, :] - tau_1 / h11 * pv
    hs[nx - 1, :] = hs[nx - 1, :] - tau_2 / h11 * ps
示例#2
0
def impose_bc(
    hv,
    hs,
    v,
    s,
    rho,
    mu,
    nx,
    dx,
    order,
    V,
    S,
    r0,
    r1,
    tau0_1,
    tau0_2,
    tauN_1,
    tauN_2,
):
    # impose boundary conditions
    import numpy as np
    import boundarycondition

    # penalty weights
    h11 = np.zeros((1, 1))
    penaltyweight(h11, dx, order)

    mv = np.zeros((1, 1))
    ms = np.zeros((1, 1))

    pv = np.zeros((1, 1))
    ps = np.zeros((1, 1))

    v0 = v[0, :]
    s0 = s[0, :]

    vn = v[nx - 1, :]
    sn = s[nx - 1, :]

    # boundary forcing
    V0 = V[0, :]
    S0 = S[0, :]

    Vn = V[nx - 1, :]
    Sn = S[nx - 1, :]

    # compute SAT terms
    boundarycondition.bcm(mv, ms, v0, s0, V0, S0, rho, mu, r0)
    boundarycondition.bcp(pv, ps, vn, sn, Vn, Sn, rho, mu, r1)

    # penalize boundaries with the SAT terms
    hv[0, :] = hv[0, :] - tau0_1 / h11 * mv
    hs[0, :] = hs[0, :] - tau0_2 / h11 * ms

    hv[nx - 1, :] = hv[nx - 1, :] - tauN_1 / h11 * pv
示例#3
0
def impose_bc(hv, hs, v, s, rho, mu, nx, dx, order, r0, r1):
    # impose boundary conditions
    import numpy as np
    import boundarycondition

    # penalty weights
    if order == 2:
        h11 = 0.5 * dx
    if order == 4:
        h11 = (17.0 / 48.0) * dx

    if order == 6:
        h11 = 13649.0 / 43200.0 * dx

    mv = np.zeros((1, 1))
    ms = np.zeros((1, 1))

    pv = np.zeros((1, 1))
    ps = np.zeros((1, 1))

    v0 = v[0, :]
    s0 = s[0, :]

    vn = v[nx - 1, :]
    sn = s[nx - 1, :]

    # compute SAT terms
    boundarycondition.bcm(mv, ms, v0, s0, rho, mu, r0)
    boundarycondition.bcp(pv, ps, vn, sn, rho, mu, r1)

    # penalize boundaries with the SAT terms
    hv[0, :] = hv[0, :] - 1.0 / h11 * mv
    hs[0, :] = hs[0, :] - 1.0 / h11 * ms

    hv[nx - 1, :] = hv[nx - 1, :] - 1.0 / h11 * pv
    hs[nx - 1, :] = hs[nx - 1, :] + 1.0 / h11 * ps