COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
atest-quadtriag.py
Go to the documentation of this file.
1 import sys
2 import coolfluid as cf
3 
4 # Global configuration
5 cf.Core.environment().options().set('log_level', 4)
6 
7 # setup a model
8 model = cf.Core.root().create_component('HotModel', 'cf3.solver.Model')
9 domain = model.create_domain()
10 physics = model.create_physics('cf3.UFEM.NavierStokesPhysics')
11 solver = model.create_solver('cf3.UFEM.Solver')
12 hc = solver.add_direct_solver('cf3.UFEM.HeatConductionSteady')
13 
14 
15 # load the mesh (passed as first argument to the script)
16 mesh = domain.load_mesh(file = cf.URI(sys.argv[1]), name = 'Mesh')
17 
18 hc.options().set('regions', [mesh.access_component('topology').uri()])
19 hc.children.Update.options.relaxation_factor_hc = 1.
20 
21 # Boundary conditions
22 bc = hc.get_child('BoundaryConditions')
23 bc.add_constant_bc(region_name = 'inlet', variable_name = 'Temperature').options().set('value', 10)
24 bc.add_constant_bc(region_name = 'outlet', variable_name = 'Temperature').options().set('value', 35)
25 
26 # run the simulation
27 model.simulate()
28 
29 # check the result
30 coords = mesh.access_component('geometry/coordinates')
31 temperature = mesh.access_component('geometry/heat_conduction_solution')
32 length = 0.
33 for i in range(len(coords)):
34  x = coords[i][0]
35  if x > length:
36  length = x
37 
38 for i in range(len(temperature)):
39  if abs(10. + 25.*(coords[i][0] / length) - temperature[i][0]) > 1e-12:
40  raise Exception('Incorrect temperature ' + str(temperature[i][0]) + ' for point ' + str(coords[i][0]))
41 
42 # Write result
43 domain.write_mesh(cf.URI('atest-quadtriag_output.pvtu'))
44 
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
common::URI uri(ComponentWrapper &self)
Send comments to:
COOLFluiD Web Admin