4 env = cf.Core.environment()
6 env.only_cpu0_writes =
True
7 env.exception_backtrace =
False
8 env.assertion_backtrace =
False
14 domain = root.create_component(
'Domain',
'cf3.mesh.Domain')
15 mesh = domain.create_component(
'mesh',
'cf3.mesh.Mesh')
18 mesh_generator = domain.create_component(
"MeshGenerator",
"cf3.mesh.SimpleMeshGenerator")
19 mesh_generator.mesh = mesh.uri()
20 mesh_generator.nb_cells = [20,20]
21 mesh_generator.lengths = [1.,1.]
22 mesh_generator.offsets = [0.,0.]
23 mesh_generator.execute()
25 make_par_data = root.create_component(
'MakeParData',
'cf3.solver.actions.ParallelDataToFields')
26 make_par_data.mesh = mesh
27 make_par_data.execute()
29 domain.write_mesh(cf.URI(
'periodic-input.pvtu'))
31 make_boundary_global = domain.create_component(
'MakeBoundaryGlobal',
'cf3.mesh.actions.MakeBoundaryGlobal')
32 make_boundary_global.mesh = mesh
33 make_boundary_global.execute()
35 link_horizontal = domain.create_component(
'LinkHorizontal',
'cf3.mesh.actions.LinkPeriodicNodes')
36 link_horizontal.mesh = mesh
37 link_horizontal.source_region = mesh.topology.right
38 link_horizontal.destination_region = mesh.topology.left
39 link_horizontal.translation_vector = [-1., 0.]
40 link_horizontal.execute()
44 link_vertical = domain.create_component(
'LinkVertical',
'cf3.mesh.actions.LinkPeriodicNodes')
45 link_vertical.mesh = mesh
46 link_vertical.source_region = mesh.topology.top
47 link_vertical.destination_region = mesh.topology.bottom
48 link_vertical.translation_vector = [0., -1.]
49 link_vertical.execute()
51 my_rank = cf.Core.rank()
52 ranks = mesh.geometry.children.rank
53 periodic_links_active = mesh.geometry.children.periodic_links_active
54 print periodic_links_active
56 for (r, active)
in zip(ranks, periodic_links_active):
57 if r == my_rank
and not active:
60 print 'nodes (non-periodic and non-ghost) for rank before:', my_rank,
':', my_nb_nodes
69 partitioner = domain.create_component(
'Partitioner',
'cf3.zoltan.PHG')
70 partitioner.mesh = mesh
73 my_rank = cf.Core.rank()
74 ranks = mesh.geometry.children.rank
75 periodic_links_active = mesh.geometry.children.periodic_links_active
76 print periodic_links_active
78 for (r, active)
in zip(ranks, periodic_links_active):
79 if r == my_rank
and not active:
82 print 'nodes (non-periodic and non-ghost) for rank after:', my_rank,
':', my_nb_nodes
84 make_par_data.execute()
86 domain.write_mesh(cf.URI(
'periodic.pvtu'))