8 env = cf.Core.environment()
11 env.options().set(
'log_level', 4)
21 channel_height = 5.2e-3
22 channel_length = 150.e-3
27 channel_x_grading = 1.5
34 blocks = root.create_component(
'model',
'cf3.mesh.BlockMesh.BlockArrays')
36 points = blocks.create_points(dimensions = 2, nb_points = 13)
37 points[0] = [-step_length, 0. ]
38 points[1] = [-step_length, channel_height/2.]
39 points[2] = [-step_length, channel_height ]
40 points[3] = [0., -step_height ]
41 points[4] = [0., -step_height/2. ]
43 points[6] = [0., channel_height/2.]
44 points[7] = [0., channel_height ]
45 points[8] = [channel_length, -step_height ]
46 points[9] = [channel_length, -step_height/2. ]
47 points[10] = [channel_length, 0. ]
48 points[11] = [channel_length, channel_height/2.]
49 points[12] = [channel_length, channel_height ]
51 block_nodes = blocks.create_blocks(6)
52 block_nodes[0] = [0, 5, 6, 1]
53 block_nodes[1] = [1, 6, 7, 2]
54 block_nodes[2] = [3, 8, 9, 4]
55 block_nodes[3] = [4, 9, 10, 5]
56 block_nodes[4] = [5, 10, 11, 6]
57 block_nodes[5] = [6, 11, 12, 7]
60 y_segs = [int(math.ceil(step_y_segs/2.)), int(math.floor(step_y_segs/2.)), int(math.floor(channel_y_segs/2.)), int(math.ceil(channel_y_segs/2.))]
61 block_subdivs = blocks.create_block_subdivisions()
62 block_subdivs[0] = [step_x_segs, y_segs[1]]
63 block_subdivs[1] = [step_x_segs, y_segs[0]]
64 block_subdivs[2] = [channel_x_segs, y_segs[3]]
65 block_subdivs[3] = [channel_x_segs, y_segs[2]]
66 block_subdivs[4] = [channel_x_segs, y_segs[1]]
67 block_subdivs[5] = [channel_x_segs, y_segs[0]]
69 gradings = blocks.create_block_gradings()
70 gradings[0] = [step_x_grading, step_x_grading, 1./top_grading, 1./top_grading]
71 gradings[1] = [step_x_grading, step_x_grading, top_grading, top_grading]
72 gradings[2] = [channel_x_grading, channel_x_grading, 1./bottom_grading, 1./bottom_grading]
73 gradings[3] = [channel_x_grading, channel_x_grading, bottom_grading, bottom_grading]
74 gradings[4] = [channel_x_grading, channel_x_grading, 1./top_grading, 1./top_grading]
75 gradings[5] = [channel_x_grading, channel_x_grading, top_grading, top_grading]
77 inlet_patch = blocks.create_patch_nb_faces(name =
'inlet', nb_faces = 2)
78 inlet_patch[0] = [1, 0]
79 inlet_patch[1] = [2, 1]
81 step_top = blocks.create_patch_nb_faces(name =
'step_top', nb_faces = 1)
84 step_front = blocks.create_patch_nb_faces(name =
'step_front', nb_faces = 2)
85 step_front[0] = [4, 3]
86 step_front[1] = [5, 4]
88 top_patch = blocks.create_patch_nb_faces(name =
'top', nb_faces = 2)
89 top_patch[0] = [12, 7]
92 bottom_patch = blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)
93 bottom_patch[0] = [3, 8]
95 outlet_patch = blocks.create_patch_nb_faces(name =
'outlet', nb_faces = 4)
96 outlet_patch[0] = [8, 9]
97 outlet_patch[1] = [9, 10]
98 outlet_patch[2] = [10, 11]
99 outlet_patch[3] = [11, 12]
101 blocks.options().set(
'block_regions', [
'fluid_top',
'fluid_top',
'fluid_bottom',
'fluid_bottom',
'fluid_top',
'fluid_top'])
104 mesh = root.create_component(
'Mesh',
'cf3.mesh.Mesh')
105 blocks.create_mesh(mesh.uri())
106 mesh.write_mesh(file=cf.URI(
'backstep-multiregion.msh'))