Skip to content

Commit 7e3c248

Browse files
committed
benchmark
1 parent ec32033 commit 7e3c248

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

benchmark.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -357,20 +357,29 @@ def _elevate_degree(mesh, degree):
357357
E_s = mu_s * 2 * (1 + nu_s)
358358
lambda_s = nu_s * E_s / (1 + nu_s) / (1 - 2 * nu_s)
359359
V_0 = VectorFunctionSpace(mesh_f, "P", degree)
360-
V_1 = FunctionSpace(mesh_f, "P", degree - 2)
361-
V = V_0 * V_1
360+
V_1 = FunctionSpace(mesh_f, "P", degree - 1)
361+
V = V_0 * V_0 * V_1
362362
solution = Function(V)
363363
solution_0 = Function(V)
364-
v_f, p_f = split(solution)
365-
u_f = Function(V_0)
366-
v_f_0, p_f_0 = split(solution_0)
367-
dv_f, dp_f = split(TestFunction(V))
364+
v_f, u_f, p_f = split(solution)
365+
v_f_0, u_f_0, p_f_0 = split(solution_0)
366+
dv_f, du_f, dp_f = split(TestFunction(V))
367+
F = Identity(dim) + grad(u_f)
368+
J = det(F)
369+
E = 1. / 2. * (dot(transpose(F), F) - Identity(dim))
370+
S = lambda_s * tr(E) * Identity(dim) + 2.0 * mu_s * E
371+
#residual = (
372+
# rho_f * J * inner(v_f - v_f_0, dv_f) / dt +
373+
# rho_f * J * inner(dot(grad(v_f), dot(inv(F), v_f - (u_f - u_f_0) / 2)), dv_f) +
374+
# rho_f * J * nu_f * inner(dot(2 * sym(dot(grad(v_f), inv(F))), transpose(inv(F))), grad(dv_f)) -
375+
# J * inner(p_f * transpose(inv(F)), grad(dv_f)) +
376+
# J * inner(tr(dot(grad(v_f), inv(F))), dp_f)) * dx
368377
residual = (
369-
rho_f * inner(v_f - v_f_0, dv_f) / dt +
370-
rho_f * inner(dot(grad(v_f), v_f), dv_f) +
371-
rho_f * nu_f * inner(2 * sym(grad(v_f)), grad(dv_f)) -
372-
inner(p_f, div(dv_f)) +
373-
inner(div(v_f), dp_f)) * dx
378+
rho_f * J * inner(v_f - v_f_0, dv_f) / dt +
379+
rho_f * J * inner(dot(grad(v_f), dot(inv(F), v_f - (u_f - u_f_0) / 2)), dv_f) +
380+
rho_f * J * nu_f * inner(2 * sym(dot(grad(v_f), inv(F))), dot(grad(dv_f), inv(F))) -
381+
J * inner(p_f, tr(dot(grad(dv_f), inv(F)))) +
382+
J * inner(tr(dot(grad(v_f), inv(F))), dp_f) + J * inner(u_f, du_f)) * dx
374383
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.)
375384
bc_inflow = DirichletBC(V.sub(0), as_vector([v_f_left, 0.]), label_left)
376385
bc_noslip = DirichletBC(V.sub(0), Constant((0, 0)), label_bottom + label_top + label_circle + label_interface)

0 commit comments

Comments
 (0)