|
38 | 38 | label_interface = 6 |
39 | 39 |
|
40 | 40 |
|
41 | | -def make_mesh_netgen(h): |
| 41 | +def make_mesh_netgen(h, nref, degree): |
42 | 42 | # points |
43 | 43 | # 3 2 |
44 | 44 | # +--------------------------------------+ |
@@ -110,6 +110,9 @@ def make_mesh_netgen(h): |
110 | 110 | else: |
111 | 111 | ngmesh = netgen.libngpy._meshing.Mesh(2) |
112 | 112 | mesh = Mesh(ngmesh) |
| 113 | + #if nref > 0: |
| 114 | + # #mesh = MeshHierarchy(mesh, nref, netgen_flags={"degree": degree})[-1] |
| 115 | + # mesh = MeshHierarchy(mesh, nref)[-1] |
113 | 116 | V = FunctionSpace(mesh, "HDiv Trace", 0) |
114 | 117 | f0 = Function(V) |
115 | 118 | bc0 = DirichletBC(V, 1., (6, 7, 8, 9, 5)) |
@@ -180,8 +183,8 @@ def _elevate_degree(mesh, degree): |
180 | 183 | quadrilateral = True |
181 | 184 | degree = 4 # 2 - 4 |
182 | 185 | 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) |
185 | 188 | mesh = _elevate_degree(mesh, degree) |
186 | 189 | mesh_f = Submesh(mesh, dmcommon.CELL_SETS_LABEL, label_fluid, mesh.topological_dimension()) |
187 | 190 | mesh_f = _elevate_degree(mesh_f, degree) |
@@ -617,16 +620,16 @@ def _elevate_degree(mesh, degree): |
617 | 620 | print(f"Time: {end - start}") |
618 | 621 | elif case in ["FSI1_2", "FSI2_2", "FSI3_2"]: |
619 | 622 | T = 20 # 10.0 # 12.0 |
620 | | - dt = Constant(0.002) #0.001 |
| 623 | + dt = Constant(0.001) #0.001 |
621 | 624 | dt_plot = 0.01 |
622 | 625 | t = Constant(0.0) |
623 | 626 | CNshift = 10 |
624 | 627 | elast = True |
625 | 628 | linear_elast = True |
626 | 629 | 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" |
630 | 633 | else: |
631 | 634 | if quadrilateral: |
632 | 635 | 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_): |
901 | 904 | # Everything is now up to date. |
902 | 905 | FD = assemble(dot(sigma_f_, dot(J_f_ * transpose(inv(F_f_)), n_f))[0] * ds_f((label_circle, label_interface))) |
903 | 906 | 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) |
905 | 908 | if mesh.comm.rank == 0: |
906 | 909 | print(f"FD = {FD}") |
907 | 910 | print(f"FL = {FL}") |
|
0 commit comments