5 env = cf.Core.environment()
8 env.assertion_throws =
False
9 env.assertion_backtrace =
False
10 env.exception_backtrace =
False
11 env.regist_signal_handlers =
False
32 blocks = domain.create_component(
'blocks',
'cf3.mesh.BlockMesh.BlockArrays')
33 points = blocks.create_points(dimensions = 2, nb_points = 6)
34 points[0] = [-0.5, -0.5]
35 points[1] = [0.5, -0.5]
36 points[2] = [-0.5, 0.]
38 points[4] = [-0.5,0.5]
39 points[5] = [0.5, 0.5]
41 block_nodes = blocks.create_blocks(2)
42 block_nodes[0] = [0, 1, 3, 2]
43 block_nodes[1] = [2, 3, 5, 4]
45 block_subdivs = blocks.create_block_subdivisions()
46 block_subdivs[0] = [segments, segments/2]
47 block_subdivs[1] = [segments, segments/2]
49 gradings = blocks.create_block_gradings()
52 gradings[0] = [1., 1., 1., 1.]
53 gradings[1] = [1., 1., 1., 1.]
55 left_patch = blocks.create_patch_nb_faces(name =
'left', nb_faces = 2)
56 left_patch[0] = [2, 0]
57 left_patch[1] = [4, 2]
59 bottom_patch = blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)
60 bottom_patch[0] = [0, 1]
62 top_patch = blocks.create_patch_nb_faces(name =
'top', nb_faces = 1)
65 right_patch = blocks.create_patch_nb_faces(name =
'right', nb_faces = 2)
66 right_patch[0] = [1, 3]
67 right_patch[1] = [3, 5]
69 blocks.partition_blocks(nb_partitions = cf.Core.nb_procs(), direction = 0)
71 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
73 blocks.create_mesh(mesh.uri())
75 create_point_region = domain.create_component(
'CreatePointRegion',
'cf3.mesh.actions.AddPointRegion')
76 create_point_region.coordinates = [0., 0.]
77 create_point_region.region_name =
'center'
78 create_point_region.mesh = mesh
79 create_point_region.execute()
81 partitioner = domain.create_component(
'Partitioner',
'cf3.mesh.actions.PeriodicMeshPartitioner')
82 partitioner.mesh = mesh
84 link_horizontal = partitioner.create_link_periodic_nodes()
85 link_horizontal.source_region = mesh.topology.right
86 link_horizontal.destination_region = mesh.topology.left
87 link_horizontal.translation_vector = [-1., 0.]
89 link_vertical = partitioner.create_link_periodic_nodes()
90 link_vertical.source_region = mesh.topology.top
91 link_vertical.destination_region = mesh.topology.bottom
92 link_vertical.translation_vector = [0., -1.]
100 domain = model.create_domain()
101 physics = model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
102 physics.options.dimension = 2
103 solver = model.create_solver(
'cf3.UFEM.Solver')
104 tg_solver = solver.add_unsteady_solver(
'cf3.UFEM.particles.TaylorGreen')
105 tg_solver.options.ua = Ua
106 tg_solver.options.va = Va
107 tg_solver.options.tau = tau
108 tg_solver.options.beta = beta
109 tg_solver.options.vs = Vs
110 tg_solver.options.d = D
112 polydisp = solver.add_unsteady_solver(
'cf3.UFEM.particles.Polydisperse')
113 polydisp.options.velocity_variable =
'FluidVelocityTG'
114 polydisp.options.velocity_tag =
'taylor_green'
118 physics.dynamic_viscosity = nu
120 polydisp.initial_diameters = [1e-5, 1e-4,1e-3]
121 polydisp.initial_concentrations = [1.e20, 1.e20, 1.e20]
122 polydisp.nb_phases = 3
126 tg_solver.regions = [mesh.topology.interior.uri()]
127 polydisp.regions = [mesh.topology.interior.uri()]
129 series_writer = solver.TimeLoop.create_component(
'TimeWriter',
'cf3.solver.actions.TimeSeriesWriter')
130 writer = series_writer.create_component(
'Writer',
'cf3.mesh.VTKXML.Writer')
131 writer.file = cf.URI(
'taylor-green-polydisperse-{iteration}.pvtu')
133 series_writer.interval = write_interval
135 solver.create_fields()
136 writer.fields = [mesh.geometry.taylor_green.uri(), mesh.geometry.particle_concentration_2.uri(), mesh.geometry.weighted_particle_volume_2.uri()]
139 time = model.create_time()
141 time.end_time = numsteps*dt
144 model.print_timing_tree()
146 domain.write_mesh(cf.URI(
'taylor-green-polydisperse-end.pvtu'))
def create_mesh(domain, segments)
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)