2 import xml.etree.ElementTree
as ET
10 print 'Profiling is on'
12 print 'GooglePerfTools not found, not profiling'
17 self.profiler.file_path = cf.URI(filename)
18 self.profiler.start_profiling()
23 self.profiler.stop_profiling()
27 cf.env.assertion_throws =
False
28 cf.env.assertion_backtrace =
False
29 cf.env.exception_backtrace =
False
30 cf.env.exception_outputs =
False
31 cf.env.regist_signal_handlers =
False
35 measurement = ET.Element(
'DartMeasurement', name =
'Problem size', type =
'numeric/integer')
36 measurement.text = str(n)
37 print ET.tostring(measurement)
43 for lss_name
in [
'EmptyLSS',
'TrilinosFEVbr',
'TrilinosCrs']:
44 for modelname
in [
'Manual',
'Specialized',
'Specialized2',
'Proto']:
47 model = cf.Core.root().
create_component(modelname+
'Model',
'cf3.solver.ModelUnsteady')
49 domain = model.create_domain()
51 physics = model.create_physics(
'cf3.UFEM.NavierStokesPhysics')
53 physics.dynamic_viscosity = 1.
55 solver = model.create_solver(
'cf3.UFEM.Solver')
57 if modelname ==
'Specialized2':
58 ns_solver = solver.add_unsteady_solver(
'cf3.UFEM.NavierStokes')
59 ns_solver.options.use_specializations =
True
60 elif modelname ==
'Proto':
61 ns_solver = solver.add_unsteady_solver(
'cf3.UFEM.NavierStokes')
62 ns_solver.options.use_specializations =
False
64 ns_solver = solver.add_unsteady_solver(
'cf3.UFEM.demo.NavierStokes' + modelname)
65 ns_solver.matrix_builder =
'cf3.math.LSS.{name}Matrix'.format(name=lss_name)
68 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
69 mesh_generator = domain.create_component(
"MeshGenerator",
"cf3.mesh.SimpleMeshGenerator")
70 mesh_generator.mesh = mesh.uri()
71 mesh_generator.nb_cells = [n,n]
72 mesh_generator.lengths = [10.,2.]
73 mesh_generator.offsets = [0.,0.]
74 mesh_generator.execute()
77 triangulator = domain.create_component(
'triangulator',
'cf3.mesh.MeshTriangulator')
78 triangulator.mesh = mesh
79 triangulator.execute()
82 ns_solver.regions = [mesh.topology.uri()]
84 ns_solver.options.disabled_actions = [
'SolveLSS']
88 bc_wall = ns_solver.BoundaryConditions.add_constant_bc(region_name =
'top', variable_name =
'Velocity')
89 bc_wall.value = [0., 0.]
90 bc_wall.regions = [mesh.topology.top.uri(), mesh.topology.bottom.uri()]
92 ns_solver.BoundaryConditions.add_function_bc(region_name =
'left', variable_name =
'Velocity').value = [
'y*(2-y)',
'0']
94 ns_solver.BoundaryConditions.add_constant_bc(region_name =
'right', variable_name =
'Pressure').value = 0.
97 time = model.create_time()
99 time.end_time = 10.*time.time_step
102 profiler.start(
'NS' + modelname +
'-' + lss_name +
'.pprof')
105 ns_solver.store_timings()
108 assembly_time = ns_solver.Assembly.properties()[
"timer_mean"]
109 measurement = ET.Element(
'DartMeasurement', name = modelname +
' ' + lss_name +
' timing', type =
'numeric/double')
110 measurement.text = str(assembly_time)
111 print ET.tostring(measurement)
113 print 'no timing info found'
115 model.delete_component()
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
def start(self, filename)