COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
atest-ufem-particles-polydisperse-brownian.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.7894e-5
15 ref_vol = 1e-18
16 
17 dt = 0.01
18 
19 numsteps = 10
20 write_interval = 500
21 
22 
23 # Create the model and solvers
24 model = cf.Core.root().create_component('NavierStokes', 'cf3.solver.ModelUnsteady')
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')
29 
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'
33 
34 # Set up the physical constants
35 physics.density = 1.
36 physics.dynamic_viscosity = nu
37 
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'
43 
44 # Create the mesh
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()
52 
53 polydisp.regions = [mesh.topology.interior.uri()]
54 
55 polydisp.children.ConcentrationSolver.LSS.SolutionStrategy.Parameters.linear_solver_type = 'Amesos'
56 
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')
60 writer.mesh = mesh
61 series_writer.interval = write_interval
62 
63 solver.create_fields()
64 writer.fields = [mesh.geometry.particle_concentration_1.uri(), mesh.geometry.weighted_particle_volume_1.uri()]
65 
66 # Time setup
67 time = model.create_time()
68 time.time_step = dt
69 time.end_time = numsteps*dt
70 
71 model.simulate()
72 model.print_timing_tree()
73 
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)
78 
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]
82 
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)
Send comments to:
COOLFluiD Web Admin