Skip to content

Commit e32dc11

Browse files
committed
benchmark
1 parent f73ef19 commit e32dc11

File tree

2 files changed

+2042
-23735
lines changed

2 files changed

+2042
-23735
lines changed

benchmark.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ def _elevate_degree(mesh, degree):
176176

177177

178178
dim = 2
179-
use_netgen = False
179+
use_netgen = True
180180
quadrilateral = True
181181
degree = 4 # 2 - 4
182182
if use_netgen:
183-
nref = 1 # # 2 - 5 tested for CSM 1 and 2
183+
nref = 0 # # 2 - 5 tested for CSM 1 and 2
184184
mesh = make_mesh_netgen(0.1 / 2 ** nref)
185185
mesh = _elevate_degree(mesh, degree)
186186
mesh_f = Submesh(mesh, dmcommon.CELL_SETS_LABEL, label_fluid, mesh.topological_dimension())
@@ -617,15 +617,25 @@ def _elevate_degree(mesh, degree):
617617
print(f"Time: {end - start}")
618618
elif case in ["FSI1_2", "FSI2_2", "FSI3_2"]:
619619
T = 20 # 10.0 # 12.0
620-
dt = Constant(0.001) #0.001
620+
dt = Constant(0.002) #0.001
621621
dt_plot = 0.01
622622
t = Constant(0.0)
623-
CNshift = 100
623+
CNshift = 10
624624
elast = True
625625
linear_elast = True
626-
fname_checkpoint = f"dumbdata/fsi3_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}_temp"
627-
fname_FD = f"time_series_FD_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}_temp.dat"
628-
fname_FL = f"time_series_FL_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}_temp.dat"
626+
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+
else:
631+
if quadrilateral:
632+
fname_checkpoint = f"dumbdata/fsi3_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}"
633+
fname_FD = f"time_series_FD_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}.dat"
634+
fname_FL = f"time_series_FL_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}.dat"
635+
else:
636+
fname_checkpoint = f"dumbdata/fsi3_Q4_Q3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}"
637+
fname_FD = f"time_series_FD_P4_P3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}.dat"
638+
fname_FL = f"time_series_FL_P4_P3_nref{nref}_0.001_shift{CNshift}_{elast}_{linear_elast}.dat"
629639
if case == "FSI1_2":
630640
rho_s = 1.e+3
631641
nu_s = 0.4
@@ -655,9 +665,14 @@ def _elevate_degree(mesh, degree):
655665
g_s = Constant(0.0)
656666
E_s = mu_s * 2 * (1 + nu_s)
657667
lambda_s = nu_s * E_s / (1 + nu_s) / (1 - 2 * nu_s)
658-
V_0 = VectorFunctionSpace(mesh_f, "CG", degree)
659-
V_1 = VectorFunctionSpace(mesh_s, "CG", degree)
660-
V_2 = FunctionSpace(mesh_f, "CG", degree - 1)
668+
if use_netgen or not quadrilateral:
669+
V_0 = VectorFunctionSpace(mesh_f, "P", degree)
670+
V_1 = VectorFunctionSpace(mesh_s, "P", degree)
671+
V_2 = FunctionSpace(mesh_f, "P", degree - 2)
672+
else:
673+
V_0 = VectorFunctionSpace(mesh_f, "Q", degree)
674+
V_1 = VectorFunctionSpace(mesh_s, "Q", degree)
675+
V_2 = FunctionSpace(mesh_f, "Q", degree - 1)
661676
V = V_0 * V_1 * V_0 * V_1 * V_2
662677
solution = Function(V)
663678
solution_0 = Function(V)
@@ -866,7 +881,7 @@ def v_f_left(t_):
866881
outfile.write("t val" + "\n")
867882
with open(fname_FL, 'w') as outfile:
868883
outfile.write("t val" + "\n")
869-
if True:
884+
if False:
870885
coords = mesh_f.coordinates.dat.data_with_halos
871886
coords[:] = coords[:] + solution.subfunctions[2].dat.data_ro_with_halos[:]
872887
pgfplot(solution.subfunctions[4], "pressure.dat", degree=2)

0 commit comments

Comments
 (0)