COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-actions-meshdiff.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 
4 def build_mesh(mesh, parent):
5  blocks = parent.create_component('Blocks', 'cf3.mesh.BlockMesh.BlockArrays')
6  points = blocks.create_points(dimensions = 2, nb_points = 4)
7  points[0] = [0., 0.]
8  points[1] = [1., 0.]
9  points[2] = [1., 1.]
10  points[3] = [0., 1.]
11  block_nodes = blocks.create_blocks(1)
12  block_nodes[0] = [0, 1, 2, 3]
13  block_subdivs = blocks.create_block_subdivisions()
14  block_subdivs[0] = [40,20]
15  gradings = blocks.create_block_gradings()
16  gradings[0] = [1., 1., 1., 1.]
17  blocks.create_patch_nb_faces(name = 'bottom', nb_faces = 1)[0] = [0, 1]
18  blocks.create_patch_nb_faces(name = 'right', nb_faces = 1)[0] = [1, 2]
19  blocks.create_patch_nb_faces(name = 'top', nb_faces = 1)[0] = [2, 3]
20  blocks.create_patch_nb_faces(name = 'left', nb_faces = 1)[0] = [3, 0]
21  blocks.partition_blocks(nb_partitions = cf.Core.nb_procs(), direction = 1)
22  blocks.create_mesh(mesh.uri())
23  blocks.delete_component()
24 
25 env = cf.Core.environment()
26 env.log_level = 4
27 env.only_cpu0_writes = False
28 
29 root = cf.Core.root()
30 domain = root.create_component('Domain', 'cf3.mesh.Domain')
31 meshdiff = domain.create_component('MeshDiff', 'cf3.mesh.actions.MeshDiff')
32 meshdiff.left = domain.create_component('mesh1','cf3.mesh.Mesh')
33 meshdiff.right = domain.create_component('mesh2','cf3.mesh.Mesh')
34 
35 build_mesh(meshdiff.left, domain)
36 
37 meshdiff.execute()
38 if meshdiff.properties()['mesh_equal']:
39  raise Exception('Incorrect meshdiff result')
40 
41 build_mesh(meshdiff.right, domain)
42 
43 meshdiff.execute()
44 if not meshdiff.properties()['mesh_equal']:
45  raise Exception('Incorrect meshdiff result')
46 
47 make_par_data = root.create_component('MakeParData', 'cf3.solver.actions.ParallelDataToFields')
48 make_par_data.mesh = meshdiff.right
49 make_par_data.execute()
50 
51 meshdiff.execute()
52 if meshdiff.properties()['mesh_equal']:
53  raise Exception('Incorrect meshdiff result')
54 
55 make_par_data.mesh = meshdiff.left
56 make_par_data.execute()
57 
58 meshdiff.execute()
59 if not meshdiff.properties()['mesh_equal']:
60  raise Exception('Incorrect meshdiff result')
Send comments to:
COOLFluiD Web Admin