COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-zoltan-phg.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(0)
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 mesh_generator = domain.create_component("MeshGenerator","cf3.mesh.SimpleMeshGenerator")
18 mesh_generator.mesh = mesh.uri()
19 mesh_generator.nb_cells = [20,20]
20 mesh_generator.lengths = [1.,1.]
21 mesh_generator.offsets = [0.,0.]
22 mesh_generator.execute()
23 
24 #p2space = mesh.create_continuous_space(name = 'TestP2Space', shape_function = 'cf3.mesh.LagrangeP2')
25 
26 my_rank = cf.Core.rank()
27 
28 ranks = mesh.geometry.children.rank
29 my_nb_nodes = 0
30 for r in ranks:
31  if r == my_rank:
32  my_nb_nodes += 1
33 
34 print 'nodes for rank before:', my_rank, ':', my_nb_nodes
35 
36 partitioner = domain.create_component('Partitioner', 'cf3.zoltan.PHG')
37 partitioner.mesh = mesh
38 
39 partitioner.execute()
40 
41 ranks = mesh.geometry.children.rank
42 my_nb_nodes = 0
43 for r in ranks:
44  if r == my_rank:
45  my_nb_nodes += 1
46 
47 print 'nodes for rank after:', my_rank, ':', my_nb_nodes
48 
49 make_par_data = root.create_component('MakeParData', 'cf3.solver.actions.ParallelDataToFields')
50 make_par_data.mesh = mesh
51 make_par_data.execute()
52 
53 domain.write_mesh(cf.URI('phg-output.pvtu'))
54 
55 #writer = domain.create_component('PVWriter', 'cf3.mesh.VTKXML.Writer')
56 #writer.mesh = mesh
57 #writer.options.dictionary = p2space
58 #writer.fields = [p2space.node_rank.uri(), mesh.children.elems_P0.element_rank.uri()]
59 #writer.file = cf.URI('phg-p2out.pvtu')
60 #writer.execute()
61 
Send comments to:
COOLFluiD Web Admin