8 env = cf.Core.environment()
11 env.options().set(
'log_level', 4)
20 channel_height = 5.2e-3
21 channel_length = 150.e-3
26 channel_x_grading = 1.5
33 domain = root.create_component(
'Domain',
'cf3.mesh.Domain')
35 blocks = domain.create_component(
'model',
'cf3.mesh.BlockMesh.BlockArrays')
37 points = blocks.create_points(dimensions = 2, nb_points = 13)
38 points[0] = [-step_length, 0. ]
39 points[1] = [-step_length, channel_height/2.]
40 points[2] = [-step_length, channel_height ]
41 points[3] = [0., -step_height ]
42 points[4] = [0., -step_height/2. ]
44 points[6] = [0., channel_height/2.]
45 points[7] = [0., channel_height ]
46 points[8] = [channel_length, -step_height ]
47 points[9] = [channel_length, -step_height/2. ]
48 points[10] = [channel_length, 0. ]
49 points[11] = [channel_length, channel_height/2.]
50 points[12] = [channel_length, channel_height ]
52 block_nodes = blocks.create_blocks(6)
53 block_nodes[0] = [0, 5, 6, 1]
54 block_nodes[1] = [1, 6, 7, 2]
55 block_nodes[2] = [3, 8, 9, 4]
56 block_nodes[3] = [4, 9, 10, 5]
57 block_nodes[4] = [5, 10, 11, 6]
58 block_nodes[5] = [6, 11, 12, 7]
61 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.))]
62 block_subdivs = blocks.create_block_subdivisions()
63 block_subdivs[0] = [step_x_segs, y_segs[1]]
64 block_subdivs[1] = [step_x_segs, y_segs[0]]
65 block_subdivs[2] = [channel_x_segs, y_segs[3]]
66 block_subdivs[3] = [channel_x_segs, y_segs[2]]
67 block_subdivs[4] = [channel_x_segs, y_segs[1]]
68 block_subdivs[5] = [channel_x_segs, y_segs[0]]
70 gradings = blocks.create_block_gradings()
71 gradings[0] = [step_x_grading, step_x_grading, 1./top_grading, 1./top_grading]
72 gradings[1] = [step_x_grading, step_x_grading, top_grading, top_grading]
73 gradings[2] = [channel_x_grading, channel_x_grading, 1./bottom_grading, 1./bottom_grading]
74 gradings[3] = [channel_x_grading, channel_x_grading, bottom_grading, bottom_grading]
75 gradings[4] = [channel_x_grading, channel_x_grading, 1./top_grading, 1./top_grading]
76 gradings[5] = [channel_x_grading, channel_x_grading, top_grading, top_grading]
78 inlet_patch = blocks.create_patch_nb_faces(name =
'inlet', nb_faces = 2)
79 inlet_patch[0] = [1, 0]
80 inlet_patch[1] = [2, 1]
82 step_top = blocks.create_patch_nb_faces(name =
'step_top', nb_faces = 1)
85 step_front = blocks.create_patch_nb_faces(name =
'step_front', nb_faces = 2)
86 step_front[0] = [4, 3]
87 step_front[1] = [5, 4]
89 top_patch = blocks.create_patch_nb_faces(name =
'top', nb_faces = 2)
90 top_patch[0] = [12, 7]
93 bottom_patch = blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)
94 bottom_patch[0] = [3, 8]
96 outlet_patch = blocks.create_patch_nb_faces(name =
'outlet', nb_faces = 4)
97 outlet_patch[0] = [8, 9]
98 outlet_patch[1] = [9, 10]
99 outlet_patch[2] = [10, 11]
100 outlet_patch[3] = [11, 12]
102 blocks.options.overlap = 0
105 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
106 blocks.partition_blocks(nb_partitions = x_parts, direction = 0)
107 blocks.partition_blocks(nb_partitions = y_parts, direction = 1)
108 blocks.create_mesh(mesh.uri())
110 make_par_data = domain.create_component(
'MakeParData',
'cf3.solver.actions.ParallelDataToFields')
111 make_par_data.mesh = mesh
112 make_par_data.execute()
114 domain.write_mesh(cf.URI(
'backstep2d-blockmesh.pvtu'))
116 load_balancer = domain.create_component(
'LoadBalancer',
'cf3.mesh.actions.LoadBalance')
117 load_balancer.mesh = mesh
118 load_balancer.execute()
120 make_par_data.execute()
121 domain.write_mesh(cf.URI(
'backstep2d-zoltan.pvtu'))