4 env = cf.Core.environment()
6 env.only_cpu0_writes =
True
9 domain = root.create_component(
'Domain',
'cf3.mesh.Domain')
12 mesh = domain.create_component(
'mesh',
'cf3.mesh.Mesh')
14 blocks = root.create_component(
'model',
'cf3.mesh.BlockMesh.BlockArrays')
15 points = blocks.create_points(dimensions = 2, nb_points = 9)
20 points[4] = [0.5, 0.5]
25 block_nodes = blocks.create_blocks(3)
26 block_nodes[0] = [0, 7, 4, 8]
27 block_nodes[1] = [8, 4, 5, 3]
28 block_nodes[2] = [4, 6, 2, 5]
29 block_subdivs = blocks.create_block_subdivisions()
30 block_subdivs[0] = [10,10]
31 block_subdivs[1] = [10,10]
32 block_subdivs[2] = [10,10]
33 gradings = blocks.create_block_gradings()
34 gradings[0] = [1., 1., 1., 1.]
35 gradings[1] = [1., 1., 1., 1.]
36 gradings[2] = [1., 1., 1., 1.]
37 blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)[0] = [0, 7]
38 blocks.create_patch_nb_faces(name =
'right', nb_faces = 1)[0] = [6, 2]
39 top = blocks.create_patch_nb_faces(name =
'top', nb_faces = 2)
42 left = blocks.create_patch_nb_faces(name =
'left', nb_faces = 2)
45 step = blocks.create_patch_nb_faces(name =
'step', nb_faces = 2)
48 blocks.partition_blocks(nb_partitions = 2, direction = 0)
49 blocks.partition_blocks(nb_partitions = 2, direction = 1)
50 blocks.create_mesh(mesh.uri())
52 make_boundary_global = root.create_component(
'MakeBoundaryGlobal',
'cf3.mesh.actions.MakeBoundaryGlobal')
53 make_boundary_global.mesh = mesh
54 make_boundary_global.execute()
56 wall_distance = root.create_component(
'WallDistance',
'cf3.mesh.actions.WallDistance')
57 wall_distance.mesh = mesh
58 wall_distance.regions = [mesh.topology.step]
59 wall_distance.execute()
61 domain.write_mesh(cf.URI(
'wall-distance-2dstep.pvtu'))
63 mesh.delete_component()
66 mesh = domain.load_mesh(file = cf.URI(sys.argv[1]), name =
'mesh')
67 make_boundary_global.mesh = mesh
68 make_boundary_global.execute()
69 wall_distance.mesh = mesh
70 wall_distance.regions = [mesh.topology.inner]
71 wall_distance.execute()
72 domain.write_mesh(cf.URI(
'wall-distance-sphere.pvtu'))
74 mesh.delete_component()
77 mesh = domain.create_component(
'mesh',
'cf3.mesh.Mesh')
79 blocks = root.create_component(
'model',
'cf3.mesh.BlockMesh.BlockArrays')
80 points = blocks.create_points(dimensions = 2, nb_points = 9)
85 points[4] = [0.5, 0.5]
90 block_nodes = blocks.create_blocks(3)
91 block_nodes[0] = [0, 7, 4, 8]
92 block_nodes[1] = [8, 4, 5, 3]
93 block_nodes[2] = [4, 6, 2, 5]
94 block_subdivs = blocks.create_block_subdivisions()
95 block_subdivs[0] = [10,10]
96 block_subdivs[1] = [10,10]
97 block_subdivs[2] = [10,10]
98 gradings = blocks.create_block_gradings()
99 gradings[0] = [1., 1., 1., 1.]
100 gradings[1] = [1., 1., 1., 1.]
101 gradings[2] = [1., 1., 1., 1.]
102 blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)[0] = [0, 7]
103 blocks.create_patch_nb_faces(name =
'right', nb_faces = 1)[0] = [6, 2]
104 top = blocks.create_patch_nb_faces(name =
'top', nb_faces = 2)
107 left = blocks.create_patch_nb_faces(name =
'left', nb_faces = 2)
110 step = blocks.create_patch_nb_faces(name =
'step', nb_faces = 2)
113 blocks.extrude_blocks(positions=[1.], nb_segments=[10], gradings=[1.])
114 blocks.partition_blocks(nb_partitions = 2, direction = 0)
115 blocks.partition_blocks(nb_partitions = 2, direction = 1)
116 blocks.create_mesh(mesh.uri())
118 make_boundary_global.mesh = mesh
119 make_boundary_global.execute()
120 wall_distance.mesh = mesh
121 wall_distance.regions = [mesh.topology.step, mesh.topology.back]
122 wall_distance.execute()
123 domain.write_mesh(cf.URI(
'wall-distance-3dstep.pvtu'))