COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-zoltan-phg-periodic.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 
4 env = cf.Core.environment()
5 env.log_level = 4
6 env.only_cpu0_writes = True
7 env.exception_backtrace = False
8 env.assertion_backtrace = False
9 #env.assertion_throws = False
10 
11 #cf.Core.wait_for_debugger(1)
12 
13 root = cf.Core.root()
14 domain = root.create_component('Domain', 'cf3.mesh.Domain')
15 mesh = domain.create_component('mesh','cf3.mesh.Mesh')
16 
17 
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()
24 
25 make_par_data = root.create_component('MakeParData', 'cf3.solver.actions.ParallelDataToFields')
26 make_par_data.mesh = mesh
27 make_par_data.execute()
28 
29 domain.write_mesh(cf.URI('periodic-input.pvtu'))
30 
31 make_boundary_global = domain.create_component('MakeBoundaryGlobal', 'cf3.mesh.actions.MakeBoundaryGlobal')
32 make_boundary_global.mesh = mesh
33 make_boundary_global.execute()
34 
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()
41 
42 
43 
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()
50 
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
55 my_nb_nodes = 0
56 for (r, active) in zip(ranks, periodic_links_active):
57  if r == my_rank and not active:
58  my_nb_nodes += 1
59 
60 print 'nodes (non-periodic and non-ghost) for rank before:', my_rank, ':', my_nb_nodes
61 
62 #link_depth = domain.create_component('LinkDepth', 'cf3.mesh.actions.LinkPeriodicNodes')
63 #link_depth.mesh = mesh
64 #link_depth.source_region = mesh.topology.back
65 #link_depth.destination_region = mesh.topology.front
66 #link_depth.translation_vector = [0., 0., -1.]
67 #link_depth.execute()
68 
69 partitioner = domain.create_component('Partitioner', 'cf3.zoltan.PHG')
70 partitioner.mesh = mesh
71 partitioner.execute()
72 
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
77 my_nb_nodes = 0
78 for (r, active) in zip(ranks, periodic_links_active):
79  if r == my_rank and not active:
80  my_nb_nodes += 1
81 
82 print 'nodes (non-periodic and non-ghost) for rank after:', my_rank, ':', my_nb_nodes
83 
84 make_par_data.execute()
85 
86 domain.write_mesh(cf.URI('periodic.pvtu'))
87 
Send comments to:
COOLFluiD Web Admin