def test_move_mesh(self): BC = create_BC(folder='mprans') last_pos = np.array([1., 1., 1.]) h = np.array([0., 0., 0.]) rot_matrix = np.eye(3) BC.setMoveMesh(last_pos=last_pos, h=h, rot_matrix=rot_matrix) # checking if other BC leaves setTank BC as it should be BC.setFreeSlip() BC.reset() # ---- t_list = get_time_array() hx_dir, hy_dir, hz_dir = [], [], [] displacement = [] from proteus.SpatialTools import rotation3D for t in t_list: new_pos = np.array(get_random_x()) h[:] = new_pos-last_pos rot_angle = get_random_x()[0] rot_axis = get_random_x() rot_matrix[:] = rotation3D(rot_matrix, rot=rot_angle, axis=rot_axis) x = np.array(get_random_x()) hx_dir += [BC.hx_dirichlet.uOfXT(x, t)] hy_dir += [BC.hy_dirichlet.uOfXT(x, t)] hz_dir += [BC.hz_dirichlet.uOfXT(x, t)] x0 = x-last_pos displacement += [(np.dot(x0, rot_matrix)-x0)+h] last_pos[:] = x zeros = np.zeros(len(t_list)) displacement = np.array(displacement) npt.assert_equal(hx_dir, displacement[:, 0]) npt.assert_equal(hy_dir, displacement[:, 1]) npt.assert_equal(hz_dir, displacement[:, 2])
def test_move_mesh(self): BC = create_BC(folder='mprans') last_pos = [1., 1., 1.] h = [0., 0., 0.] rot_matrix = np.eye(3) BC.setMoveMesh(last_pos=last_pos, h=h, rot_matrix=rot_matrix) # checking if other BC leaves setTank BC as it should be BC.setFreeSlip() BC.reset() # ---- t_list = get_time_array() hx_dir, hy_dir, hz_dir = [], [], [] displacement = [] from proteus.SpatialTools import rotation3D for t in t_list: new_pos = np.array(get_random_x()) h[:] = new_pos-last_pos rot_angle = get_random_x()[0] rot_axis = get_random_x() rot_matrix[:] = rotation3D(rot_matrix, rot=rot_angle, axis=rot_axis) x = np.array(get_random_x()) hx_dir += [BC.hx_dirichlet.uOfXT(x, t)] hy_dir += [BC.hy_dirichlet.uOfXT(x, t)] hz_dir += [BC.hz_dirichlet.uOfXT(x, t)] x0 = x-last_pos displacement += [(np.dot(x0, rot_matrix)-x0)+h] last_pos[:] = x zeros = np.zeros(len(t_list)) displacement = np.array(displacement) npt.assert_equal(hx_dir, displacement[:, 0]) npt.assert_equal(hy_dir, displacement[:, 1]) npt.assert_equal(hz_dir, displacement[:, 2])