8 env = cf.Core.environment()
11 env.assertion_throws =
False
12 env.assertion_backtrace =
False
13 env.exception_backtrace =
False
14 env.regist_signal_handlers =
False
18 model = root.create_component(
'Boussinesq',
'cf3.solver.ModelUnsteady')
19 domain = model.create_domain()
20 physics = model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
21 solver = model.create_solver(
'cf3.UFEM.Solver')
24 ic = solver.create_initial_conditions()
27 boussinesq = solver.add_unsteady_solver(
'cf3.UFEM.NavierStokes')
28 boussinesq.options().set(
'use_boussinesq',
True)
30 boussinesq.Assembly.BoussinesqAssemblyQuads.g = [0., 9.81]
33 blocks = domain.create_component(
'blocks',
'cf3.mesh.BlockMesh.BlockArrays')
34 points = blocks.create_points(dimensions = 2, nb_points = 4)
40 block_nodes = blocks.create_blocks(1)
41 block_nodes[0] = [0, 1, 2, 3]
43 block_subdivs = blocks.create_block_subdivisions()
44 block_subdivs[0] = [40, 40]
46 gradings = blocks.create_block_gradings()
47 gradings[0] = [1., 1., 1., 1.]
50 left_patch = blocks.create_patch_nb_faces(name =
'left', nb_faces = 1)
51 left_patch[0] = [3, 0]
53 bottom_patch = blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)
54 bottom_patch[0] = [0, 1]
56 right_patch = blocks.create_patch_nb_faces(name =
'right', nb_faces = 1)
57 right_patch[0] = [1, 2]
59 top_patch = blocks.create_patch_nb_faces(name =
'top', nb_faces = 1)
62 blocks.options().set(
'block_regions', [
'fluid'])
64 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
65 blocks.create_mesh(mesh.uri())
68 boussinesq.options().set(
'regions', [mesh.access_component(
'topology/fluid').
uri()])
76 solver.InitialConditions.navier_stokes_solution.regions = [mesh.access_component(
'topology').
uri()]
77 solver.InitialConditions.navier_stokes_solution.Velocity = u_in
78 solver.InitialConditions.navier_stokes_solution.Temperature = phi_in
82 physics.dynamic_viscosity = 1.e-5
85 bc = boussinesq.get_child(
'BoundaryConditions')
86 bc.options().set(
'regions', [mesh.access_component(
'topology').
uri()])
88 bc.add_constant_bc(region_name =
'left', variable_name =
'Velocity').options().set(
'value', u_wall)
89 bc.add_constant_bc(region_name =
'bottom', variable_name =
'Velocity').options().set(
'value', u_wall)
90 bc.add_constant_bc(region_name =
'right', variable_name =
'Velocity').options().set(
'value', u_wall)
91 bc.add_constant_bc(region_name =
'top', variable_name =
'Velocity').options().set(
'value', u_wall)
93 bc.add_constant_bc(region_name =
'left', variable_name =
'Temperature').options().set(
'value', phi_wall)
94 bc.add_constant_bc(region_name =
'bottom', variable_name =
'Temperature').options().set(
'value', phi_in)
95 bc.add_constant_bc(region_name =
'right', variable_name =
'Temperature').options().set(
'value', phi_wall)
96 bc.add_constant_bc(region_name =
'top', variable_name =
'Temperature').options().set(
'value', phi_wall)
99 time = model.create_time()
100 time.options().set(
'time_step', 0.01)
106 current_end_time = 0.
109 while current_end_time < final_end_time:
110 current_end_time += save_interval
111 time.options().set(
'end_time', current_end_time)
113 domain.write_mesh(cf.URI(
'boussinesq-' +str(iteration) +
'.pvtu'))
116 solver.options().set(
'disabled_actions', [
'InitialConditions'])
119 model.print_timing_tree()
common::URI uri(ComponentWrapper &self)