COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
atest-ufem-particles-polydisperse-uniform.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 import numpy as np
4 
5 env = cf.Core.environment()
6 
7 # Global configuration
8 env.assertion_throws = False
9 env.assertion_backtrace = False
10 env.exception_backtrace = False
11 env.regist_signal_handlers = False
12 env.log_level = 3
13 
14 nu = 1./5000.
15 
16 dt = 0.001
17 
18 numsteps = 200
19 write_interval = 50
20 
21 
22 # Create the model and solvers
23 model = cf.Core.root().create_component('NavierStokes', 'cf3.solver.ModelUnsteady')
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')
28 
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'
32 
33 # Set up the physical constants
34 physics.density = 1.
35 physics.dynamic_viscosity = nu
36 
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'
41 
42 # Create the mesh
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()
50 
51 polydisp.regions = [mesh.topology.interior.uri()]
52 
53 polydisp.children.ConcentrationSolver.LSS.SolutionStrategy.Parameters.linear_solver_type = 'Amesos'
54 
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')
58 writer.mesh = mesh
59 series_writer.interval = write_interval
60 
61 solver.create_fields()
62 writer.fields = [mesh.geometry.particle_concentration_1.uri(), mesh.geometry.weighted_particle_volume_1.uri()]
63 
64 # Time setup
65 time = model.create_time()
66 time.time_step = dt
67 time.end_time = numsteps*dt
68 
69 model.simulate()
70 model.print_timing_tree()
71 
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)
76 
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]
80 
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)
Send comments to:
COOLFluiD Web Admin