COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
atest-ufem-velocitygradient.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 
4 # Some shortcuts
5 root = cf.Core.root()
6 env = cf.Core.environment()
7 
8 # Global configuration
9 env.log_level = 4
10 
11 # setup a model
12 model = cf.Core.root().create_component('GradModel', 'cf3.solver.Model')
13 domain = model.create_domain()
14 physics = model.create_physics('cf3.UFEM.NavierStokesPhysics')
15 solver = model.create_solver('cf3.UFEM.Solver')
16 grad = solver.add_direct_solver('cf3.UFEM.VelocityGradient')
17 
18 # Generate a channel mesh
19 generator = domain.create_component('generator', 'cf3.mesh.BlockMesh.ChannelGenerator')
20 generator.options().set('mesh', cf.URI('//GradModel/Domain/mesh'))
21 generator.options().set('x_segments', 64)
22 generator.options().set('cell_overlap', 1)
23 generator.execute()
24 
25 mesh = domain.mesh
26 
27 
28 grad.regions = [mesh.topology.uri()]
29 solver.create_fields()
30 
31 velocity = mesh.geometry.navier_stokes_u_solution
32 coords = mesh.geometry.coordinates
33 for i in range(len(coords)):
34  [x,y,z] = coords[i]
35  v = velocity[i]
36  v[0] = x
37  v[1] = y**2/2.
38  v[2] = z**3/3.
39 
40 # run the simulation
41 model.simulate()
42 
43 # print timings
44 model.print_timing_tree()
45 
46 # Write result
47 domain.write_mesh(cf.URI('velocitygradient_output.pvtu'))
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
Send comments to:
COOLFluiD Web Admin