Пример #1
0
def test_interlaced_vel_bdy_dof_order(ownership_range, num_components,
                                      bdy_nodes):
    interlaced = LS.InterlacedDofOrderType()

    num_equations = ownership_range[1] - ownership_range[0] + 1
    bdy_nodes = [bdy_nodes, bdy_nodes]
    strong_vel_is = interlaced.create_no_dirichlet_bdy_nodes_is(
        ownership_range, num_equations, num_components, bdy_nodes)

    test_array = strong_vel_is.array - np.array([13, 14, 22, 23, 31, 32])
    assert np.linalg.norm(test_array) < 1.0E-12
Пример #2
0
def test_interlaced_dof_order(ownership_range, num_components):
    interlaced = LS.InterlacedDofOrderType()

    num_equations = ownership_range[1] - ownership_range[0] + 1
    velocity, pressure = interlaced.create_DOF_lists(ownership_range,
                                                     num_equations,
                                                     num_components)
    idx_range = np.arange(ownership_range[0], ownership_range[1] + 1)
    pressure_idx = np.arange(ownership_range[0], ownership_range[1],
                             num_components)
    velocity_mask = np.ones(len(idx_range), dtype='bool')

    velocity_mask[pressure_idx - ownership_range[0]] = 0
    assert np.array_equal(pressure_idx, pressure)
    assert np.array_equal(idx_range[velocity_mask], velocity)
Пример #3
0
def test_interlaced_vel_dof_order(ownership_range,
                                  num_components):
    interlaced = LS.InterlacedDofOrderType()

    num_equations = ownership_range[1] - ownership_range[0] + 1
    global_IS, vel_IS = interlaced.create_vel_DOF_IS(ownership_range,
                                                     num_equations,
                                                     num_components)

    for i in range(1,num_components):
        global_vals = np.arange(ownership_range[0]+i,
                                ownership_range[1]+1,
                                num_components)
        assert np.array_equal(global_IS[i-1].array , global_vals)

    for i in range(1,num_components):
        scaled_ownership_range = ownership_range[0] * (num_components-1) // num_components
        local_vals = np.arange(start=scaled_ownership_range + i - 1,
                               stop=scaled_ownership_range + int( num_equations * (num_components-1) // num_components ),
                               step=num_components-1)
        assert np.array_equal(vel_IS[i-1].array, local_vals)