COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-vtk-tetrahedralize.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 
4 root = cf.Core.root()
5 
6 segs = 10
7 
8 mesh3d = root.create_component('mesh3d','cf3.mesh.Mesh')
9 blocks = root.create_component('model', 'cf3.mesh.BlockMesh.BlockArrays')
10 points = blocks.create_points(dimensions = 2, nb_points = 4)
11 points[0] = [0., 0.]
12 points[1] = [1., 0.]
13 points[2] = [1., 1.]
14 points[3] = [0., 1.]
15 block_nodes = blocks.create_blocks(1)
16 block_nodes[0] = [0, 1, 2, 3]
17 block_subdivs = blocks.create_block_subdivisions()
18 block_subdivs[0] = [segs,segs]
19 gradings = blocks.create_block_gradings()
20 gradings[0] = [1., 1., 0.1, 0.1]
21 blocks.create_patch_nb_faces(name = 'bottom', nb_faces = 1)[0] = [0, 1]
22 blocks.create_patch_nb_faces(name = 'right', nb_faces = 1)[0] = [1, 2]
23 blocks.create_patch_nb_faces(name = 'top', nb_faces = 1)[0] = [2, 3]
24 blocks.create_patch_nb_faces(name = 'left', nb_faces = 1)[0] = [3, 0]
25 blocks.extrude_blocks(positions=[1., 2.], nb_segments=[segs/2, segs/2], gradings=[1., 1.])
26 blocks.create_mesh(mesh3d.uri())
27 
28 #mesh3d.write_mesh(cf.URI('hexahedrons.pvtu'))
29 
30 triangulator = root.create_component('Tetrahedralize', 'cf3.vtk.Tetrahedralize')
31 triangulator.options().set('mesh', mesh3d)
32 triangulator.execute()
33 
34 mesh3d.write_mesh(cf.URI('tetrahedralized.msh'))
Send comments to:
COOLFluiD Web Admin