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(
'NavierStokes',
'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 nstokes = solver.add_unsteady_solver(
'cf3.UFEM.NavierStokes')
27 blocks = domain.create_component(
'blocks',
'cf3.mesh.BlockMesh.BlockArrays')
28 points = blocks.create_points(dimensions = 2, nb_points = 12)
41 points[10] = [-1, 0.2]
44 block_nodes = blocks.create_blocks(6)
45 block_nodes[0] = [0, 1, 3, 2]
46 block_nodes[1] = [2, 3, 5, 4]
48 block_nodes[2] = [1, 6, 7, 3]
49 block_nodes[3] = [3, 7, 8, 5]
50 block_nodes[4] = [9, 0, 2, 10]
51 block_nodes[5] = [10, 2, 4, 11]
53 block_subdivs = blocks.create_block_subdivisions()
54 block_subdivs[0] = [20, 10]
55 block_subdivs[1] = [20, 10]
56 block_subdivs[2] = [20, 10]
57 block_subdivs[3] = [20, 10]
58 block_subdivs[4] = [20, 10]
59 block_subdivs[5] = [20, 10]
61 gradings = blocks.create_block_gradings()
62 gradings[0] = [1., 1., 5., 5.]
63 gradings[1] = [1., 1., 10., 10.]
64 gradings[2] = [1., 1., 5., 5.]
65 gradings[3] = [1., 1., 10., 10.]
66 gradings[4] = [1., 1., 5., 5.]
67 gradings[5] = [1., 1., 10., 10.]
70 inlet_patch = blocks.create_patch_nb_faces(name =
'inlet', nb_faces = 2)
71 inlet_patch[0] = [10, 9]
72 inlet_patch[1] = [11, 10]
74 bottom_patch1 = blocks.create_patch_nb_faces(name =
'bottom1', nb_faces = 1)
75 bottom_patch1[0] = [0, 1]
77 bottom_patch2 = blocks.create_patch_nb_faces(name =
'bottom2', nb_faces = 1)
78 bottom_patch2[0] = [1, 6]
80 bottom_patch3 = blocks.create_patch_nb_faces(name =
'bottom3', nb_faces = 1)
81 bottom_patch3[0] = [9, 0]
83 outlet_patch = blocks.create_patch_nb_faces(name =
'outlet', nb_faces = 2)
84 outlet_patch[0] = [6, 7]
85 outlet_patch[1] = [7, 8]
87 top_patch = blocks.create_patch_nb_faces(name =
'top', nb_faces = 3)
90 top_patch[2] = [4, 11]
92 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
93 blocks.create_mesh(mesh.uri())
94 nstokes.regions = [mesh.topology.uri()]
100 ic_ns = solver.InitialConditions.navier_stokes_solution
103 ic_ns.Velocity = u_in
106 physics.density = 1.2
107 physics.dynamic_viscosity = 1.7894e-5
110 bc = nstokes.BoundaryConditions
111 bc.add_constant_bc(region_name =
'inlet', variable_name =
'Velocity').options().value = u_in
112 bc.add_constant_bc(region_name =
'bottom1', variable_name =
'Velocity').options().value = u_wall
113 bc.add_constant_bc(region_name =
'bottom2', variable_name =
'Velocity').options().value = u_wall
114 bc.add_constant_component_bc(region_name =
'bottom3', variable_name =
'Velocity', component = 1).options().value = 0.
115 bc.add_constant_bc(region_name =
'outlet', variable_name =
'Pressure').options().value = 0.
116 bc.add_constant_bc(region_name =
'top', variable_name =
'Velocity').options().value = u_in
119 time = model.create_time()
127 while time.end_time < final_end_time:
128 time.end_time += save_interval
130 domain.write_mesh(cf.URI(
'atest-flatplate2d-laminar-' +str(iteration) +
'.pvtu'))
133 solver.options.disabled_actions = [
'InitialConditions']
136 model.print_timing_tree()