8 blocks = cf.Core.root().
create_component(
'blocks',
'cf3.mesh.BlockMesh.BlockArrays')
9 points = blocks.create_points(dimensions = 2, nb_points = 6)
15 blocks.create_blocks(1)[0] = [0, 1, 3, 2]
16 blocks.create_block_subdivisions()[0] = [x_segs,y_segs]
17 blocks.create_block_gradings()[0] = [1., 1., 1., 1.]
19 blocks.create_patch_nb_faces(name =
'left', nb_faces = 1)[0] = [2, 0]
20 blocks.create_patch_nb_faces(name =
'right', nb_faces = 1)[0] = [1, 3]
21 blocks.create_patch_nb_faces(name =
'top', nb_faces = 1)[0] = [3, 2]
22 blocks.create_patch_nb_faces(name =
'bottom', nb_faces = 1)[0] = [0, 1]
24 blocks.options().set(
'overlap', 0)
29 def __init__(self, modelname, segments, use_spec):
30 if len(sys.argv) == 2:
35 self.
domain = self.model.create_domain()
36 self.
physics = self.model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
37 self.
solver = self.model.create_solver(
'cf3.UFEM.Solver')
47 self.physics.options().set(
'density', 1000.)
48 self.physics.options().set(
'dynamic_viscosity', 10.)
50 self.
ns_solver = self.solver.add_unsteady_solver(
'cf3.UFEM.NavierStokes')
51 self.ns_solver.options().set(
'use_specializations', use_spec)
52 self.ns_solver.options().set(
'disabled_actions', [
'SolveLSS'])
57 globconn = self.domain.create_component(
'GlobalConnectivity',
'cf3.mesh.actions.GlobalConnectivity')
58 globconn.options().set(
'mesh', self.
mesh)
61 grow = self.domain.create_component(
'GrowOverlap',
'cf3.mesh.actions.GrowOverlap')
62 grow.options().set(
'mesh', self.
mesh)
66 self.
mesh = self.domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
68 blocks.partition_blocks(nb_partitions=self.
nb_procs, direction=0)
69 blocks.create_mesh(self.mesh.uri())
75 blocks.partition_blocks(nb_partitions=self.
nb_procs, direction=0)
76 blocks.create_mesh(self.mesh.uri())
77 triangulator = self.domain.create_component(
'triangulator',
'cf3.mesh.MeshTriangulator')
78 triangulator.options().set(
'mesh', self.
mesh)
79 triangulator.execute()
80 self.mesh.move_component(self.domain.uri())
81 self.mesh.raise_mesh_loaded()
85 self.
mesh = self.domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
87 blocks.extrude_blocks(positions=[1.], nb_segments=[self.
segments[2]], gradings=[1.])
88 blocks.partition_blocks(nb_partitions=self.
nb_procs, direction=0)
89 blocks.create_mesh(self.mesh.uri())
95 blocks.extrude_blocks(positions=[1.], nb_segments=[self.
segments[2]], gradings=[1.])
96 blocks.partition_blocks(nb_partitions=self.
nb_procs, direction=0)
97 blocks.create_mesh(self.mesh.uri())
98 triangulator = self.domain.create_component(
'triangulator',
'cf3.mesh.MeshTriangulator')
99 triangulator.options().set(
'mesh', self.
mesh)
100 triangulator.execute()
101 self.mesh.move_component(self.domain.uri())
102 self.mesh.raise_mesh_loaded()
107 self.ns_solver.options().set(
'regions', [self.mesh.access_component(
'topology').
uri()])
108 self.ns_solver.create_lss(
'cf3.math.LSS.TrilinosFEVbrMatrix')
111 time = self.model.create_time()
112 time.options().set(
'time_step', 1.)
113 time.options().set(
'end_time', 1.)
114 self.model.simulate()
115 self.ns_solver.store_timings()
117 assembly_name =
'Assembly'
118 print '<DartMeasurement name=\"' + self.model.name() +
' time\" type=\"numeric/double\">' + str(self.ns_solver.get_child(assembly_name).
properties()[
'timer_mean']) +
'</DartMeasurement>'
120 print 'Could not find timing info'
123 root = cf.Core.root()
124 env = cf.Core.environment()
127 env.options().set(
'assertion_throws',
False)
128 env.options().set(
'assertion_backtrace',
False)
129 env.options().set(
'exception_backtrace',
False)
130 env.options().set(
'regist_signal_handlers',
False)
131 env.options().set(
'log_level', 0)
134 test_case =
TestCase(
'QuadsGeneric', [150,100],
False)
135 test_case.square_mesh_quads()
137 test_case.model.delete_component()
141 test_case =
TestCase(
'TriagsGeneric', [150,100],
False)
142 test_case.square_mesh_triags()
144 test_case.model.delete_component()
147 test_case =
TestCase(
'HexasGeneric', [20, 10, 10],
False)
148 test_case.cube_mesh_hexas()
150 test_case.model.delete_component()
153 test_case =
TestCase(
'TetrasGeneric', [20, 10, 10],
False)
154 test_case.cube_mesh_tetras()
156 test_case.model.delete_component()
159 test_case =
TestCase(
'TriagsSpecialized', [150,100],
True)
160 test_case.square_mesh_triags()
162 test_case.model.delete_component()
165 test_case =
TestCase(
'TetrasSpecialized', [20, 10, 10],
True)
166 test_case.cube_mesh_tetras()
168 test_case.model.delete_component()
def square_mesh_quads(self)
def cube_mesh_hexas(self)
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
common::URI uri(ComponentWrapper &self)
def cube_mesh_tetras(self)
properties()["description"]
def __init__(self, modelname, segments, use_spec)
def square_mesh_triags(self)
def make_square(x_segs, y_segs)