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
24 domain = model.create_domain()
25 physics = model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
26 physics.options.dimension = 2
27 solver = model.create_solver(
'cf3.UFEM.Solver')
29 polydisp = solver.add_unsteady_solver(
'cf3.UFEM.particles.Polydisperse')
30 polydisp.options.velocity_variable =
'Velocity'
31 polydisp.options.velocity_tag =
'navier_stokes_u_solution'
35 physics.dynamic_viscosity = nu
37 polydisp.initial_diameters = [(6./np.pi)**(1./3.), (12./np.pi)**(1./3.)]
38 polydisp.initial_concentrations = [1, 0.0001]
39 polydisp.nb_phases = 2
40 polydisp.options.collision_kernel_type =
'UnityCollisionKernel'
43 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
44 mesh_generator = domain.create_component(
"mesh_generator",
"cf3.mesh.SimpleMeshGenerator")
45 mesh_generator.options().set(
"mesh",mesh.uri())
46 mesh_generator.options().set(
"nb_cells",[1, 1])
47 mesh_generator.options().set(
"lengths",[1.,1.])
48 mesh_generator.options().set(
"offsets",[0.,0.])
49 mesh_generator.execute()
51 polydisp.regions = [mesh.topology.interior.uri()]
53 polydisp.children.ConcentrationSolver.LSS.SolutionStrategy.Parameters.linear_solver_type =
'Amesos'
55 series_writer = solver.TimeLoop.create_component(
'TimeWriter',
'cf3.solver.actions.TimeSeriesWriter')
56 writer = series_writer.create_component(
'Writer',
'cf3.mesh.VTKXML.Writer')
57 writer.file = cf.URI(
'polydisperse-uniform-{iteration}.pvtu')
59 series_writer.interval = write_interval
61 solver.create_fields()
62 writer.fields = [mesh.geometry.particle_concentration_1.uri(), mesh.geometry.weighted_particle_volume_1.uri()]
65 time = model.create_time()
67 time.end_time = numsteps*dt
70 model.print_timing_tree()
72 c0 = np.array(mesh.geometry.particle_concentration_0)
73 c1 = np.array(mesh.geometry.particle_concentration_1)
74 zeta0 = np.array(mesh.geometry.weighted_particle_volume_0)
75 zeta1 = np.array(mesh.geometry.weighted_particle_volume_1)
77 print 'zeta:', zeta0[0,0], zeta1[0,0]
78 print 'c:', c0[0,0], c1[0,0]
79 print 'v:', zeta0[0,0]/c0[0,0], zeta1[0,0]/c1[0,0]
81 domain.write_mesh(cf.URI(
'polydisperse-uniform-end.pvtu'))
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)