Skip to content

Commit f218ede

Browse files
committed
benchmark
1 parent b2c9d7b commit f218ede

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

benchmark.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
label_interface = 6
3939

4040

41-
def make_mesh_netgen(h):
41+
def make_mesh_netgen(h, nref, degree):
4242
# points
4343
# 3 2
4444
# +--------------------------------------+
@@ -110,6 +110,9 @@ def make_mesh_netgen(h):
110110
else:
111111
ngmesh = netgen.libngpy._meshing.Mesh(2)
112112
mesh = Mesh(ngmesh)
113+
#if nref > 0:
114+
# #mesh = MeshHierarchy(mesh, nref, netgen_flags={"degree": degree})[-1]
115+
# mesh = MeshHierarchy(mesh, nref)[-1]
113116
V = FunctionSpace(mesh, "HDiv Trace", 0)
114117
f0 = Function(V)
115118
bc0 = DirichletBC(V, 1., (6, 7, 8, 9, 5))
@@ -180,8 +183,8 @@ def _elevate_degree(mesh, degree):
180183
quadrilateral = True
181184
degree = 4 # 2 - 4
182185
if use_netgen:
183-
nref = 0 # # 2 - 5 tested for CSM 1 and 2
184-
mesh = make_mesh_netgen(0.1 / 2 ** nref)
186+
nref = 1 # # 2 - 5 tested for CSM 1 and 2
187+
mesh = make_mesh_netgen(0.1 / 2 ** nref, nref, degree)
185188
mesh = _elevate_degree(mesh, degree)
186189
mesh_f = Submesh(mesh, dmcommon.CELL_SETS_LABEL, label_fluid, mesh.topological_dimension())
187190
mesh_f = _elevate_degree(mesh_f, degree)
@@ -617,16 +620,16 @@ def _elevate_degree(mesh, degree):
617620
print(f"Time: {end - start}")
618621
elif case in ["FSI1_2", "FSI2_2", "FSI3_2"]:
619622
T = 20 # 10.0 # 12.0
620-
dt = Constant(0.002) #0.001
623+
dt = Constant(0.001) #0.001
621624
dt_plot = 0.01
622625
t = Constant(0.0)
623626
CNshift = 10
624627
elast = True
625628
linear_elast = True
626629
if use_netgen:
627-
fname_checkpoint = f"dumbdata/fsi3_P4_P2_nref{nref}_0.002_shift{CNshift}_{elast}_{linear_elast}_netgen"
628-
fname_FD = f"time_series_FD_P4_P2_nref{nref}_0.002_shift{CNshift}_{elast}_{linear_elast}_netgen.dat"
629-
fname_FL = f"time_series_FL_P4_P2_nref{nref}_0.002_shift{CNshift}_{elast}_{linear_elast}_netgen.dat"
630+
fname_checkpoint = f"dumbdata/fsi3_P4_P2_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}_netgen"
631+
fname_FD = f"time_series_FD_P4_P2_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}_netgen.dat"
632+
fname_FL = f"time_series_FL_P4_P2_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}_netgen.dat"
630633
else:
631634
if quadrilateral:
632635
fname_checkpoint = f"dumbdata/fsi3_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}"
@@ -901,7 +904,7 @@ def v_f_left(t_):
901904
# Everything is now up to date.
902905
FD = assemble(dot(sigma_f_, dot(J_f_ * transpose(inv(F_f_)), n_f))[0] * ds_f((label_circle, label_interface)))
903906
FL = assemble(dot(sigma_f_, dot(J_f_ * transpose(inv(F_f_)), n_f))[1] * ds_f((label_circle, label_interface)))
904-
u_A = solution.subfunctions[3].at(pointA)
907+
u_A = solution.subfunctions[3].at(pointA, tolerance=1.e-6)
905908
if mesh.comm.rank == 0:
906909
print(f"FD = {FD}")
907910
print(f"FL = {FL}")

time_series.pdf

-3 KB
Binary file not shown.

0 commit comments

Comments
 (0)