6 env = cf.Core.environment()
9 env.assertion_throws =
False
10 env.assertion_backtrace =
False
11 env.exception_backtrace =
False
12 env.regist_signal_handlers =
False
16 model = root.create_component(
'NavierStokes',
'cf3.solver.ModelUnsteady')
17 domain = model.create_domain()
18 physics = model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
19 solver = model.create_solver(
'cf3.UFEM.Solver')
25 ns_solver = solver.add_unsteady_solver(
'cf3.UFEM.NavierStokes')
26 ns_solver.options.use_specializations =
False
29 mesh = domain.load_mesh(file = cf.URI(sys.argv[1]), name =
'Mesh')
32 ns_solver.regions = [mesh.topology.uri()]
37 solver.InitialConditions.navier_stokes_solution.Velocity = u_in
39 physics.options().set(
'density', 1000.)
40 physics.options().set(
'dynamic_viscosity', 10.)
43 bc = ns_solver.BoundaryConditions
44 bc.add_constant_bc(region_name =
'in', variable_name =
'Velocity').value = u_in
45 bc.add_constant_bc(region_name =
'symm', variable_name =
'Velocity').value = u_in
46 bc.add_constant_bc(region_name =
'wall', variable_name =
'Velocity').value = [0., 0.]
47 bc.add_constant_bc(region_name =
'out', variable_name =
'Pressure').value = 0.
50 time = model.create_time()
51 time.options().set(
'time_step', 0.1)
58 while current_end_time < final_end_time:
59 current_end_time += save_interval
60 time.options().set(
'end_time', current_end_time)
62 domain.write_mesh(cf.URI(
'navier-stokes-cylinder2d_output-' +str(iteration) +
'.pvtu'))
65 solver.options().set(
'disabled_actions', [
'InitialConditions'])
68 model.print_timing_tree()