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
25 domain = model.create_domain()
26 physics = model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
27 physics.options.dimension = 2
28 solver = model.create_solver(
'cf3.UFEM.Solver')
30 polydisp = solver.add_unsteady_solver(
'cf3.UFEM.particles.Polydisperse')
31 polydisp.options.velocity_variable =
'Velocity'
32 polydisp.options.velocity_tag =
'navier_stokes_u_solution'
36 physics.dynamic_viscosity = nu
38 polydisp.initial_diameters = [352.8149349843295e-9,1196.080988061398e-9]
39 polydisp.initial_concentrations = [9.819906242145143e12/ref_vol, 4.037811335485776e10/ref_vol]
40 polydisp.reference_volume = ref_vol
41 polydisp.nb_phases = 2
42 polydisp.options.collision_kernel_type =
'BrownianCollisionKernel'
45 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
46 mesh_generator = domain.create_component(
"mesh_generator",
"cf3.mesh.SimpleMeshGenerator")
47 mesh_generator.options().set(
"mesh",mesh.uri())
48 mesh_generator.options().set(
"nb_cells",[1, 1])
49 mesh_generator.options().set(
"lengths",[1.,1.])
50 mesh_generator.options().set(
"offsets",[0.,0.])
51 mesh_generator.execute()
53 polydisp.regions = [mesh.topology.interior.uri()]
55 polydisp.children.ConcentrationSolver.LSS.SolutionStrategy.Parameters.linear_solver_type =
'Amesos'
57 series_writer = solver.TimeLoop.create_component(
'TimeWriter',
'cf3.solver.actions.TimeSeriesWriter')
58 writer = series_writer.create_component(
'Writer',
'cf3.mesh.VTKXML.Writer')
59 writer.file = cf.URI(
'polydisperse-brownian-{iteration}.pvtu')
61 series_writer.interval = write_interval
63 solver.create_fields()
64 writer.fields = [mesh.geometry.particle_concentration_1.uri(), mesh.geometry.weighted_particle_volume_1.uri()]
67 time = model.create_time()
69 time.end_time = numsteps*dt
72 model.print_timing_tree()
74 c0 = np.array(mesh.geometry.particle_concentration_0)
75 c1 = np.array(mesh.geometry.particle_concentration_1)
76 zeta0 = np.array(mesh.geometry.weighted_particle_volume_0)
77 zeta1 = np.array(mesh.geometry.weighted_particle_volume_1)
79 print 'zeta:', zeta0[0,0], zeta1[0,0]
80 print 'c:', c0[0,0], c1[0,0]
81 print 'v:', zeta0[0,0]/c0[0,0], zeta1[0,0]/c1[0,0]
83 domain.write_mesh(cf.URI(
'polydisperse-brownian-end.pvtu'))
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)