COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-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 
10 #cf.Core.wait_for_debugger(2)
11 
12 root = cf.Core.root()
13 domain = root.create_component('Domain', 'cf3.mesh.Domain')
14 mesh = domain.create_component('mesh','cf3.mesh.Mesh')
15 
16 
17 blocks = root.create_component('model', 'cf3.mesh.BlockMesh.BlockArrays')
18 blocks.options.overlap = 0
19 points = blocks.create_points(dimensions = 2, nb_points = 4)
20 points[0] = [0., 0.]
21 points[1] = [1., 0.]
22 points[2] = [1., 1.]
23 points[3] = [0., 1.]
24 block_nodes = blocks.create_blocks(1)
25 block_nodes[0] = [0, 1, 2, 3]
26 block_subdivs = blocks.create_block_subdivisions()
27 block_subdivs[0] = [40,20]
28 gradings = blocks.create_block_gradings()
29 gradings[0] = [1., 1., 1., 1.]
30 blocks.create_patch_nb_faces(name = 'bottom', nb_faces = 1)[0] = [0, 1]
31 blocks.create_patch_nb_faces(name = 'right', nb_faces = 1)[0] = [1, 2]
32 blocks.create_patch_nb_faces(name = 'top', nb_faces = 1)[0] = [2, 3]
33 blocks.create_patch_nb_faces(name = 'left', nb_faces = 1)[0] = [3, 0]
34 blocks.extrude_blocks(positions=[1.], nb_segments=[20], gradings=[1.])
35 blocks.partition_blocks(nb_partitions = 2, direction = 0)
36 blocks.partition_blocks(nb_partitions = 2, direction = 1)
37 blocks.create_mesh(mesh.uri())
38 
39 make_par_data = root.create_component('MakeParData', 'cf3.solver.actions.ParallelDataToFields')
40 make_par_data.mesh = mesh
41 make_par_data.execute()
42 
43 domain.write_mesh(cf.URI('periodic-input.pvtu'))
44 
45 periodic_partitioner = domain.create_component('Partitioner', 'cf3.mesh.actions.PeriodicMeshPartitioner')
46 periodic_partitioner.mesh = mesh
47 periodic_partitioner.load_balance = True
48 
49 link_horizontal = periodic_partitioner.create_link_periodic_nodes()
50 link_horizontal.source_region = mesh.topology.right
51 link_horizontal.destination_region = mesh.topology.left
52 link_horizontal.translation_vector = [-1., 0., 0.]
53 # link_horizontal.translation_vector = [-1., 0.]
54 
55 link_vertical = periodic_partitioner.create_link_periodic_nodes()
56 link_vertical.source_region = mesh.topology.top
57 link_vertical.destination_region = mesh.topology.bottom
58 link_vertical.translation_vector = [0., -1., 0.]
59 # link_vertical.translation_vector = [0., -1.]
60 
61 link_depth = periodic_partitioner.create_link_periodic_nodes()
62 link_depth.source_region = mesh.topology.back
63 link_depth.destination_region = mesh.topology.front
64 link_depth.translation_vector = [0., 0., -1.]
65 
66 periodic_partitioner.execute()
67 
68 make_par_data.execute()
69 
70 domain.write_mesh(cf.URI('periodic.pvtu'))
71 
Send comments to:
COOLFluiD Web Admin