Skip to content

Commit

Permalink
benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagiyam committed May 27, 2024
1 parent 56da231 commit b6a41e7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _elevate_degree(mesh, degree, label):
ntimesteps = int(T / dt_float)
t = Constant(0.0)
dim = 2
nref = 0 # # 2 - 5 tested for CSM 1 and 2
nref = 4 # # 2 - 5 tested for CSM 1 and 2
h = 0.1 / 2 ** nref
degree = 3 #3 # 2 - 4
if True:
Expand All @@ -187,9 +187,9 @@ def _elevate_degree(mesh, degree, label):
# quad mesh
mesh, label_left, label_right, label_bottom, label_top, label_interface_orig, label_interface, label_struct_base, label_circle = make_mesh_quad()
mesh = _elevate_degree(mesh, degree, label_circle + label_struct_base)
x, y = SpatialCoordinate(mesh)
"""
#mesh.topology_dm.viewFromOptions("-dm_view")
x, y = SpatialCoordinate(mesh)
v = assemble(Constant(1.0, domain=mesh) * ds(label_circle + label_struct_base))
print(v - 2 * pi * r)
print(assemble(x * dx(label_struct)))
Expand Down Expand Up @@ -217,6 +217,11 @@ def _elevate_degree(mesh, degree, label):
dS_f = Measure("dS", domain=mesh_f)
dS_s = Measure("dS", domain=mesh_s)

#print(repr(mesh))
#print(repr(mesh_f))
#print(repr(mesh_s), flush=True)


if mesh.comm.size == 1:
fig, axes = plt.subplots()
axes.axis('equal')
Expand Down Expand Up @@ -496,7 +501,8 @@ def _elevate_degree(mesh, degree, label):
J * inner((u - u_0) / dt - v, du)
) * dx_s # dx(label_struct)
residual = residual_f + residual_s
v_f_left = 1.5 * Ubar * y_f * (H - y_f) / ((H / 2) ** 2) * conditional(t < 2.0, (1 - cos(pi / 2 * t)) / 2., 1.)
#v_f_left = 1.5 * Ubar * y_f * (H - y_f) / ((H / 2) ** 2) * conditional(t < 2.0, (1 - cos(pi / 2 * t)) / 2., 1.)
v_f_left = 1.5 * Ubar * y * (H - y) / ((H / 2) ** 2) * conditional(t < 2.0, (1 - cos(pi / 2 * t)) / 2., 1.)
bc_inflow = DirichletBC(V.sub(0), as_vector([v_f_left, 0.]), label_left)
bc_noslip_v = DirichletBC(V.sub(0), Constant((0, 0)), label_bottom + label_top + label_circle + label_struct_base)
bc_noslip_u = DirichletBC(V.sub(1), Constant((0, 0)), label_left + label_right + label_bottom + label_top + label_circle + label_struct_base)
Expand Down
Binary file modified mesh_f.pdf
Binary file not shown.
Binary file modified mesh_orig.pdf
Binary file not shown.
Binary file modified mesh_s.pdf
Binary file not shown.
Binary file modified time_series.pdf
Binary file not shown.

0 comments on commit b6a41e7

Please sign in to comment.