COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
atest-ufem-heat2d-disk.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 
4 # Global configuration
5 cf.env.assertion_backtrace = False
6 cf.env.exception_backtrace = False
7 cf.env.regist_signal_handlers = False
8 cf.env.exception_log_level = 0
9 cf.env.log_level = 1
10 cf.env.exception_outputs = False
11 
12 
13 # setup a model
14 model = cf.Core.root().create_component('HotModel', 'cf3.solver.Model')
15 domain = model.create_domain()
16 physics = model.create_physics('cf3.UFEM.NavierStokesPhysics')
17 solver = model.create_solver('cf3.UFEM.Solver')
18 hc = solver.add_direct_solver('cf3.UFEM.HeatConductionSteady')
19 
20 # load the mesh (passed as first argument to the script)
21 mesh = domain.load_mesh(file = cf.URI(sys.argv[1]), name = 'Mesh')
22 hc.regions = [mesh.topology.uri()]
23 
24 # Boundary conditions
25 bc = hc.BoundaryConditions
26 bc.add_constant_bc(region_name = 'inner', variable_name = 'Temperature').value = 10
27 bc.add_constant_bc(region_name = 'outer', variable_name = 'Temperature').value = 35
28 
29 # run the simulation
30 model.simulate()
31 
32 # Print temperature along a line y=0, x > 0
33 print '----------------------- Temperatures profile -------------------'
34 temperatures = mesh.geometry.heat_conduction_solution
35 X = []
36 T = []
37 for (i, (x, y)) in enumerate(mesh.geometry.coordinates):
38  if abs(y) < 1e-2 and x > 0.:
39  X.append(x)
40  T.append(temperatures[i][0])
41 for (x, T) in sorted(zip(X, T)):
42  print x, T
43 
44 # Write result
45 domain.write_mesh(cf.URI('atest-ufem-heat2d-disk.pvtu'))
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
Send comments to:
COOLFluiD Web Admin