Пример #1
0
def structure_m_apply_bc(KS11, KS22, MST11, MST22):
    bc_id = np.where(sy_n < delta_x/10)
    if ph.mesh_prefix == 'annulus_':
        KS22 = la_utils.set_diag(KS22,bc_id)
        MST22 = la_utils.clear_rows(MST22,bc_id)

    bc_id = np.where(sx_n < delta_x/10)
    if ph.mesh_prefix == 'annulus_':
        KS11 = la_utils.set_diag(KS11,bc_id)
        MST11 = la_utils.clear_rows(MST11,bc_id)

    return KS11, KS22, MST11, MST22
Пример #2
0
def coupling_apply_bc(GT11, GT22):
    #lower boundary
    bc_id = np.where(y_u < delta_x/10)
    if ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'channel_' or ph.mesh_prefix == 'swingbar_':
        GT11 = la_utils.clear_rows(GT11,bc_id)
    GT22 = la_utils.clear_rows(GT22,bc_id)

    #upper boundary
    bc_id = np.where(y_u > 1-delta_x/10)
    GT11 = la_utils.clear_rows(GT11,bc_id)
    GT22 = la_utils.clear_rows(GT22,bc_id)

    #right boundary
    bc_id = np.where(x_u > 1-delta_x/10)
    if ph.mesh_prefix == 'annulus_' or ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'swingbar_':
        GT11 = la_utils.clear_rows(GT11,bc_id)
        GT22 = la_utils.clear_rows(GT22,bc_id)

    #left boundary
    bc_id = np.where(x_u < delta_x/10)
    GT11 = la_utils.clear_rows(GT11,bc_id)
    if ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'channel_' or ph.mesh_prefix == 'swingbar_':
        GT22 = la_utils.clear_rows(GT22,bc_id)

    return GT11, GT22
Пример #3
0
def pressure_m_apply_bc(BT1, BT2):
    #lower boundary
    bc_id = np.where(y_u < delta_x/10)
    if ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'channel_' or ph.mesh_prefix == 'swingbar_':
        BT1 = la_utils.clear_rows(BT1,bc_id)
    BT2 = la_utils.clear_rows(BT2,bc_id)

    #upper boundary
    bc_id = np.where(y_u > 1-delta_x/10)
    BT1 = la_utils.clear_rows(BT1,bc_id)
    BT2 = la_utils.clear_rows(BT2,bc_id)

    #right boundary
    bc_id = np.where(x_u > 1-delta_x/10)
    if ph.mesh_prefix == 'annulus_' or ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'swingbar_':
        BT1 = la_utils.clear_rows(BT1,bc_id)
        BT2 = la_utils.clear_rows(BT2,bc_id)

    #left boundary
    bc_id = np.where(x_u < delta_x/10)
    BT1 = la_utils.clear_rows(BT1,bc_id)
    if ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'channel_' or ph.mesh_prefix == 'swingbar_':
        BT2 = la_utils.clear_rows(BT2,bc_id)

    return BT1, BT2
Пример #4
0
def fluid_m_apply_bc(A11, A22, A12 = None, A21 = None):
    if A12 == None:
        A12 = sparse.csr_matrix(A11.shape)
    if A21 == None:
        A21 = sparse.csr_matrix(A11.shape)
    #lower boundary
    bc_id = np.where(y_u < delta_x/10)
    if ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'channel_' or ph.mesh_prefix == 'swingbar_':
        A11 = la_utils.set_diag(A11,bc_id)
        A12 = la_utils.clear_rows(A12, bc_id)
    A22 = la_utils.set_diag(A22,bc_id)
    A21 = la_utils.clear_rows(A21, bc_id)

    #upper boundary
    bc_id = np.where(y_u > 1-delta_x/10)
    A11 = la_utils.set_diag(A11,bc_id)
    A22 = la_utils.set_diag(A22,bc_id)
    A12 = la_utils.clear_rows(A12,bc_id)
    A21 = la_utils.clear_rows(A21,bc_id)

    #right boundary
    bc_id = np.where(x_u > 1-delta_x/10)
    if ph.mesh_prefix == 'annulus_' or ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'swingbar_':
        A11 = la_utils.set_diag(A11,bc_id)
        A22 = la_utils.set_diag(A22,bc_id)
        A12 = la_utils.clear_rows(A12,bc_id)
        A21 = la_utils.clear_rows(A21,bc_id)

    #left boundary
    bc_id = np.where(x_u < delta_x/10)
    A11 = la_utils.set_diag(A11,bc_id)
    A12 = la_utils.clear_rows(A12,bc_id)
    if ph.mesh_prefix == 'cavity_' or ph.mesh_prefix == 'channel_' or ph.mesh_prefix == 'swingbar_':
        A22 = la_utils.set_diag(A22,bc_id)
        A21 = la_utils.clear_rows(A21,bc_id)
    return A11, A22, A12, A21
Пример #5
0
B = BT.transpose()

mean_p = np.zeros((1, ndofs_p))
for row in topo_p:
    x_l = x_p[row[0:3]]
    y_l = y_p[row[0:3]]
    eval_p = np.zeros((0, 2))
    (phi_dx, phi_dy, phi, omega) = shp.tri_p1(x_l, y_l, eval_p)
    mean_p[0, row] += omega * np.array([1. / 3., 1. / 3., 1. / 3., 1])
    # mean_p[0,row] += omega * np.array([1./3.,1./3.,1./3.])

mean_pT = mean_p.transpose()

#upper boundary
bc_id = np.where(y_u > y_top - delta_x / 10)
BT1 = la_utils.clear_rows(BT1, bc_id)
BT2 = la_utils.clear_rows(BT2, bc_id)

#lower boundary
bc_id = np.where(y_u < y_bottom + delta_x / 10)
BT1 = la_utils.clear_rows(BT1, bc_id)
BT2 = la_utils.clear_rows(BT2, bc_id)

#right boundary
bc_id = np.where(x_u > x_right - delta_x / 10)
# BT1 = la_utils.clear_rows(BT1,bc_id)
# BT2 = la_utils.clear_rows(BT2,bc_id)

#left boundary
bc_id = np.where(x_u < x_left + delta_x / 10)
BT1 = la_utils.clear_rows(BT1, bc_id)