COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-solver-actions-nodevalence.py
Go to the documentation of this file.
1 import coolfluid as cf
2 
3 env = cf.Core.environment()
4 env.log_level = 4
5 env.only_cpu0_writes = True
6 
7 root = cf.Core.root()
8 domain = root.create_component('Domain', 'cf3.mesh.Domain')
9 mesh = domain.create_component('OriginalMesh','cf3.mesh.Mesh')
10 
11 blocks = root.create_component('model', 'cf3.mesh.BlockMesh.BlockArrays')
12 points = blocks.create_points(dimensions = 2, nb_points = 4)
13 points[0] = [0., 0.]
14 points[1] = [1., 0.]
15 points[2] = [1., 1.]
16 points[3] = [0., 1.]
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())
29 
30 valfield = mesh.geometry.create_field(name = 'node_valence', variables='Valence[scalar]')
31 valfield.add_tag('node_valence')
32 
33 valence = domain.create_component('Valences', 'cf3.solver.actions.NodeValence')
34 valence.regions = [mesh.topology.uri()]
35 valence.execute()
36 
37 # take the opportunity to test the copier
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'
44 copier.execute()
45 
46 writer = domain.create_component('PVWriter', 'cf3.mesh.VTKXML.Writer')
47 writer.fields = [valfield.uri(), copyfd.uri()]
48 writer.mesh = mesh
49 writer.file = cf.URI('node_valence.pvtu')
50 writer.execute()
Send comments to:
COOLFluiD Web Admin