bl_struct.boundary_tags[..., -1, 2] = front_tag ff_struct.boundary_tags[..., -1, 2] = front_tag back_tag = BoundaryTag.empty_tag('back') bl_struct.boundary_tags[..., 0, 2] = back_tag ff_struct.boundary_tags[..., 0, 2] = back_tag if not close_trailing_edge: te_struct.boundary_tags[..., -1, 2] = front_tag te_struct.boundary_tags[..., 0, 2] = back_tag ff_struct.boundary_tags[:, 0, :, 1] = BoundaryTag.symmetry_tag('bottom') ff_struct.boundary_tags[:, -1, :, 1] = BoundaryTag.symmetry_tag('top') # Write the blocks to the blockMeshDict block_mesh_dict = BlockMeshDict(metric='mm') bl_struct.write(block_mesh_dict) ff_struct.write(block_mesh_dict) if not close_trailing_edge: te_struct.write(block_mesh_dict) block_mesh_dict.write_file( 'OF_case', run_blockMesh=True) # Try adding block_structure_only=True here try: import matplotlib.pyplot as plt plt.plot(*s_pts.T) plt.plot(*bl_pts.T) plt.scatter(*s_pts[[u_nose_index, l_nose_index]].T) plt.scatter(*bl_pts[[ub_nose_index, lb_nose_index]].T) ax = plt.gca() ax.set_aspect('equal')
is_complete = True rs = np.array([0., 0.5, 0.8, 1.0]) ts = np.linspace(0., 2 * np.pi, 9, endpoint=is_complete) - 3 * np.pi / 8 zs = np.linspace(0., 3., 6, endpoint=True) ndr = 6 ndt = 5 ndz = 8 tube = TubeBlockStruct(rs, ts, zs, ndr, ndt, ndz, zone_tag='tube', is_complete=is_complete) alternate_blocks = tube[1:, 1::2, 3:] alternate_blocks.edge_mask[..., 1:, 1] = True alternate_blocks.face_mask[..., 0] = True tube.vertices[-1, :-1, 0, 1] += np.pi / 16 tube.vertices[-1, :-1, [2, 3], 1] -= np.pi / 16 tube.vertices[-1, :-1, [2, 3], 0] += 0.2 # Produces correct conical surface for of_dist='.com' block_mesh_dict = BlockMeshDict(metric='mm', of_dist='.org') tube.write(block_mesh_dict) block_mesh_dict.write_file('OF_case', run_blockMesh=True)
zs, ndr, ndt, ndz, zone_tag='ts', is_core_aligned=True, inner_arc_curve=iac, offset=Point((1., 1., 0.))) # Increase size of back half scale = 1.15 cyl.tube_struct.vertices[:, :, 1:, 0] *= scale # Scale tube radii cyl.core_struct.vertices[:, :, 1:, [0, 1]] *= scale # Scale core x and y co-ordinates # Twist the outermost shell of the tube block structure cyl.tube_struct.vertices[-1, :-1, -1, 1] += np.pi / 16 cyl.tube_struct.boundary_tags[-1, ..., 0] = BoundaryTag('wall') block_mesh_dict = BlockMeshDict(metric='mm') cyl.write(block_mesh_dict) # density_scale modifies the global mesh density by multiplying the number of cell divisions along each block edge. # density_scale < 1.0 coarsens the mesh, density_scale = 1.0 leaves the mesh density as specified, # and density_scale > 1.0 increases the density block_mesh_dict.write_file('OF_case', run_blockMesh=True, density_scale=1.2, default_boundary_tag=BoundaryTag('test'))