3 env = cf.Core.environment()
5 env.only_cpu0_writes =
True
8 domain = root.create_component(
'Domain',
'cf3.mesh.Domain')
9 mesh = domain.create_component(
'OriginalMesh',
'cf3.mesh.Mesh')
11 blocks = root.create_component(
'model',
'cf3.mesh.BlockMesh.BlockArrays')
12 points = blocks.create_points(dimensions = 2, nb_points = 4)
17 block_nodes = blocks.create_blocks(1)
18 block_nodes[0] = [0, 1, 2, 3]
19 block_subdivs = blocks.create_block_subdivisions()
20 block_subdivs[0] = [64,64]
21 gradings = blocks.create_block_gradings()
22 gradings[0] = [1., 1., 1., 1.]
23 blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)[0] = [0, 1]
24 blocks.create_patch_nb_faces(name =
'right', nb_faces = 1)[0] = [1, 2]
25 blocks.create_patch_nb_faces(name =
'top', nb_faces = 1)[0] = [2, 3]
26 blocks.create_patch_nb_faces(name =
'left', nb_faces = 1)[0] = [3, 0]
27 blocks.partition_blocks(nb_partitions = cf.Core.nb_procs(), direction = 0)
28 blocks.create_mesh(mesh.uri())
30 valfield = mesh.geometry.create_field(name =
'node_valence', variables=
'Valence[scalar]')
31 valfield.add_tag(
'node_valence')
33 valence = domain.create_component(
'Valences',
'cf3.solver.actions.NodeValence')
34 valence.regions = [mesh.topology.uri()]
38 copyfd = mesh.geometry.create_field(name =
'copy_node_valence', variables=
'copy_Valence[scalar]')
39 copyfd.add_tag(
'copy_node_valence')
40 copier = domain.create_component(
'Copier',
'cf3.solver.actions.CopyScalar')
41 copier.regions = [mesh.topology.uri()]
42 copier.source_field_tag =
'node_valence'
43 copier.source_variable_name =
'Valence'
46 writer = domain.create_component(
'PVWriter',
'cf3.mesh.VTKXML.Writer')
47 writer.fields = [valfield.uri(), copyfd.uri()]
49 writer.file = cf.URI(
'node_valence.pvtu')