コード例 #1
0
def test_plot_solution_salt_dome():
    from pygeoiga.nurb.cad import make_salt_dome
    from pygeoiga.analysis.MultiPatch import patch_topology, form_k_IGA_mp, boundary_condition_mp
    from pygeoiga.analysis.common import solve
    from pygeoiga.plot.solution_mpl import p_temperature, p_temperature_mp
    from pygeoiga.analysis.MultiPatch import map_MP_elements
    geometry = make_salt_dome(refine=True, knot_ins= [np.arange(0.2,1,0.2), np.arange(0.2,1,0.2)])
    geometry, gDoF = patch_topology(geometry)
    K_glob = np.zeros((gDoF, gDoF))
    K_glob = form_k_IGA_mp(geometry, K_glob)

    D = np.zeros(gDoF)
    b = np.zeros(gDoF)

    T_t = 10  # [°C]
    T_b = 90  # [°C]
    T_l = None#10
    T_r = None#40
    bc, D = boundary_condition_mp(geometry, D, T_t, T_b, T_l, T_r)
    bc["gDOF"] = gDoF
    D, b = solve(bc, K_glob, b, D)

    geometry = map_MP_elements(geometry, D)
    from pygeoiga.plot.nrbplotting_mpl import p_surface, p_cpoints, p_knots, create_figure
    fig, ax = create_figure("2d")
    #ax.view_init(azim=270, elev=90)
    fig_sol, ax_sol = create_figure("2d")
    geometrypatch = make_salt_dome(refine=False)
    figpatch, axpatch = create_figure("2d")
    for patch_id in geometry.keys():
        ax = p_surface(geometry[patch_id].get("knots"), geometry[patch_id].get("B"), ax=ax, dim=2,
                       color=geometry[patch_id].get("color"), alpha=0.5)
        #ax = p_cpoints(geometry[patch_id].get("B"), ax=ax, dim=2, color="black", marker=".", point=True, line=False)
        ax = p_knots(geometry[patch_id].get("knots"), geometry[patch_id].get("B"), ax=ax, dim=2, point=False,
                         line=True)

        axpatch = p_surface(geometrypatch[patch_id].get("knots"), geometrypatch[patch_id].get("B"), ax=axpatch, dim=2,
                       color=geometrypatch[patch_id].get("color"), alpha=0.5)
        #axpatch = p_cpoints(geometry[patch_id].get("B"), ax=axpatch, dim=2, color="black", marker=".", point=True, line=False)
        axpatch = p_knots(geometrypatch[patch_id].get("knots"), geometrypatch[patch_id].get("B"), ax=axpatch, dim=2, point=False,
                     line=True)

        #ax_sol = p_cpoints(geometry[patch_id].get("B"), ax=ax_sol, dim=2, color=geometry[patch_id].get("color"), marker=".", point=True, line=False)
        ax_sol = p_surface(geometry[patch_id].get("knots"), geometry[patch_id].get("B"), ax=ax_sol, dim=2,
                       color="k", fill=False)
        x = geometry[patch_id].get("x_sol")
        y = geometry[patch_id].get("y_sol")
        t = geometry[patch_id].get("t_sol")
        ax_sol = p_temperature(x,y,t, vmin = np.min(D), vmax = np.max(D), levels=50, show=False, colorbar=True, ax=ax_sol,
                               point = False, fill=True)#, color = "k")

    fig.show()
    fig_sol.show()
    figpatch.show()

    fig_all, ax_all = create_figure("2d")
    p_temperature_mp(geometry=geometry, vmin=np.min(D), vmax=np.max(D), levels=50, show=False, colorbar=True,
                     ax=ax_all, point=False, fill=True, contour=False)
    plt.show()
コード例 #2
0
def test_plot_solution_mp_fault():
    geometry = make_fault_model(refine=True)
    geometry, gDoF = patch_topology(geometry)
    K_glob = np.zeros((gDoF, gDoF))
    K_glob = form_k_IGA_mp(geometry, K_glob)

    D = np.zeros(gDoF)
    b = np.zeros(gDoF)

    T_t = 10  # [°C]
    T_b = 40  # [°C]
    T_l = None
    T_r = None
    bc, D = boundary_condition_mp(geometry, D, T_t, T_b, T_l, T_r)
    bc["gDOF"] = gDoF
    D, b = solve(bc, K_glob, b, D)

    geometry = map_MP_elements(geometry, D)
    from pygeoiga.plot.nrbplotting_mpl import p_surface, p_cpoints, p_knots, create_figure
    fig, ax = create_figure("2d")
    fig_sol, ax_sol = create_figure("2d")#
    fig_point, ax_point = create_figure("2d")  #
    for patch_id in geometry.keys():
        ax = p_surface(geometry[patch_id].get("knots"), geometry[patch_id].get("B"), ax=ax, dim=2,
                       color=geometry[patch_id].get("color"), alpha=0.5)
        ax = p_cpoints(geometry[patch_id].get("B"), ax=ax, dim=2, color="black", marker=".", point=True, line=False)
        ax = p_knots(geometry[patch_id].get("knots"), geometry[patch_id].get("B"), ax=ax, dim=2, point=False,
                         line=True)

        #ax_sol = p_cpoints(geometry[patch_id].get("B"), ax=ax_sol, dim=2, color=geometry[patch_id].get("color"), marker=".", point=True, line=False)
        #ax_sol = p_knots(geometry[patch_id].get("knots"), geometry[patch_id].get("B"),
        #                 color = geometry[patch_id].get("color"), ax=ax_sol, dim=2, point=False, line=True)
        x = geometry[patch_id].get("x_sol")
        y = geometry[patch_id].get("y_sol")
        t = geometry[patch_id].get("t_sol")
        ax_sol = p_temperature(x,y,t, vmin = np.min(D), vmax = np.max(D), levels=50, show=False, colorbar=True, ax=ax_sol,
                               point = False, fill=True, contour=False)
        ax_point = p_temperature(x, y, t, vmin=np.min(D), vmax=np.max(D), levels=100, show=False, colorbar=True, ax=ax_point,
                      point=True, fill=False)
        ax_sol = p_surface(geometry[patch_id].get("knots"), geometry[patch_id].get("B"), ax=ax_sol, dim=2,
                       color="k", alpha=1, fill=False, border=True)

    fig.show()
    fig_sol.show()
    fig_point.show()

    fig_all, ax_all = create_figure("2d")
    p_temperature_mp(geometry=geometry, vmin=np.min(D), vmax=np.max(D), levels=200, show=False, colorbar=True, ax=ax_all,
                     point=False, fill=True, contour=False)
    fig_all.show()
コード例 #3
0
def test_plot_solution_mp_3d():
    import matplotlib
    matplotlib.use('Qt5Agg')
    geometry = make_3_layer_patches()
    geometry, gDoF = patch_topology(geometry)
    K_glob = np.zeros((gDoF, gDoF))
    K_glob = form_k_IGA_mp(geometry, K_glob)

    D = np.zeros(gDoF)
    b = np.zeros(gDoF)

    T_t = 10  # [°C]
    T_b = lambda x, m: T_t + 10 * np.sin(np.pi * x / m)  # [°C]
    T_l = None
    T_r = None
    bc, D = boundary_condition_mp(geometry, D, T_t, T_b, T_l, T_r)
    bc["gDOF"] = gDoF
    D, b = solve(bc, K_glob, b, D)

    geometry = map_MP_elements(geometry, D)
    from pygeoiga.plot.nrbplotting_mpl import p_knots, create_figure
    fig, ax = create_figure()
    for patch_id in geometry.keys():
        ax = p_knots(geometry[patch_id].get("knots"), geometry[patch_id].get("B"),
                         color = geometry[patch_id].get("color"), ax=ax, dim=2, point=False, line=True)
        x = geometry[patch_id].get("x_sol")
        y = geometry[patch_id].get("y_sol")
        t = geometry[patch_id].get("t_sol")
        ax = p_temperature(x,y,t, vmin = np.min(D), vmax = np.max(D), levels=50, show=False, colorbar=True, ax=ax,
                               point = True, fill=True, color = "k")

    plt.show()
コード例 #4
0
ファイル: nurb_creation.py プロジェクト: danielsk78/pygeoiga
 def plot_curve(self, ax=None, **kwargs_curve):
     if ax is None:
         fig, ax = create_figure("2d", figsize=(10, 20))
     ax = p_curve(self.knots,
                  self.B,
                  weight=self.weight,
                  ax=ax,
                  **kwargs_curve)
     return ax
コード例 #5
0
 def plot_cpoints(self, ax=None, **kwargs_cpoints):
     if ax is None:
         fig, ax = create_figure("2d", figsize=(10, 20))
     for patch_name in tqdm(self.geometry.keys(),
                            desc="Plotting control points"):
         ax = p_cpoints(self.geometry[patch_name].get("B"),
                        ax=ax,
                        **kwargs_cpoints)
     return ax
コード例 #6
0
 def plot_knots(self, ax=None, **kwargs_knots):
     if ax is None:
         fig, ax = create_figure("2d", figsize=(10, 20))
     for patch_name in tqdm(self.geometry.keys(), desc="Plotting knots"):
         ax = p_knots(self.geometry[patch_name].get("knots"),
                      self.geometry[patch_name].get("B"),
                      weight=self.geometry[patch_name].get("weight"),
                      ax=ax,
                      **kwargs_knots)
     return ax
コード例 #7
0
def test_plot_biquadratic():
    from pygeoiga.nurb.cad import make_surface_biquadratic
    from pygeoiga.plot.nrbplotting_mpl import p_knots, create_figure, p_cpoints
    from pygeoiga.nurb.refinement import knot_insertion
    knots, cp = make_surface_biquadratic()
    shape = np.asarray(cp.shape)
    shape[-1] = cp.shape[-1] + 1
    B = np.ones((shape))
    B[..., :cp.shape[-1]] = cp

    fig, ax = create_figure("2d")
    ax = p_knots(knots, B, ax=ax, dim=2, point=False, line=True, color="b")
    ax.set_axis_off()
    plt.show()

    direction = 0
    knot_ins = np.asarray([0.2, 0.8])
    B_new, knots_new = knot_insertion(B.copy(), (2, 2), knots.copy(), knot_ins, direction=direction)
    knot_ins = np.asarray([0.3, 0.7])
    direction = 1
    B_new2, knots_new2 = knot_insertion(B_new, (2, 2), knots_new, knot_ins, direction=direction)

    fig, ax = create_figure("2d")
    ax = p_knots(knots_new2, B_new2, ax=ax, dim=2, point=False, line=True, color="b")
    ax = p_cpoints(B_new2, ax=ax, dim=2, point=True, line=False, color="red")
    ax.set_axis_off()
    plt.show()

    direction = 0
    knot_ins = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
    B_new, knots_new = knot_insertion(B.copy(), (2, 2), knots.copy(), knot_ins, direction=direction)
    direction = 1
    knot_ins = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
    B_new2, knots_new2 = knot_insertion(B_new, (2, 2), knots_new, knot_ins, direction=direction)

    fig, ax = create_figure("2d")
    ax = p_knots(knots_new2, B_new2, ax=ax, dim=2, point=False, line=True, color="b")
    #ax = p_cpoints(geometry[patch_id].get("B"), ax=ax, dim=2, color="black", marker=".", point=True, line=False)

    ax.set_axis_off()
    plt.show()
コード例 #8
0
ファイル: nurb_creation.py プロジェクト: danielsk78/pygeoiga
    def plot(self,
             ax=None,
             kwargs_surface={},
             kwargs_knots={},
             kwargs_cpoints={}):
        if ax is None:
            fig, ax = create_figure("2d", figsize=(10, 20))

        ax = self.plot_surface(ax, **kwargs_surface)
        ax = self.plot_knots(ax, **kwargs_knots)
        ax = self.plot_cpoints(ax, **kwargs_cpoints)
        return ax
コード例 #9
0
    def plot_solution(self, ax=None, **kwargs_temperature):
        if ax is None:
            fig, ax = create_figure("2d", figsize=(10, 20))
        tmin = 200
        tmax = -200
        for patch_name in self.geometry.keys():
            t = self.geometry[patch_name].get("t_sol")
            tmin = t.min() if t.min() < tmin else tmin
            tmax = t.max() if t.max() > tmax else tmax

        for patch_name in tqdm(self.geometry.keys(),
                               desc="Plotting solutions"):
            x = self.geometry[patch_name].get("x_sol")
            y = self.geometry[patch_name].get("y_sol")
            t = self.geometry[patch_name].get("t_sol")
            ax = p_temperature(x,
                               y,
                               t,
                               vmin=tmin,
                               vmax=tmax,
                               ax=ax,
                               **kwargs_temperature)
        return ax
コード例 #10
0
ファイル: nurb_creation.py プロジェクト: danielsk78/pygeoiga
 def plot_cpoints(self, ax=None, **kwargs_cpoints):
     if ax is None:
         fig, ax = create_figure("2d", figsize=(10, 20))
     ax = p_cpoints(self.B, ax=ax, **kwargs_cpoints)
     return ax
コード例 #11
0
def test_show_simple_mesh_IGA():
    from pygeoiga.plot.nrbplotting_mpl import create_figure, p_cpoints, p_knots, p_curve, p_surface

    cp = np.array([[[0, 0], [3, 0]], [[0, 2], [3, 2]]])
    kn1 = [0, 0, 1, 1]
    kn2 = [0, 0, 1, 1]
    knots = [kn1, kn2]
    shape = np.asarray(cp.shape)
    shape[-1] = 3  # To include the weights in the last term
    B = np.ones(shape)
    B[..., :2] = cp
    from pygeoiga.nurb.refinement import knot_insertion
    B, knots = knot_insertion(B, [1, 1], knots, [0.5], 0)
    B, knots = knot_insertion(B, [1, 1], knots, [1 / 3, 2 / 3], 1)

    fig, ax = create_figure("2d")
    ax.spines["right"].set_visible(False)
    ax.spines["top"].set_visible(False)
    ax.set_xlabel("x")
    ax.set_ylabel("y")
    ax.set_xticks([])
    ax.set_yticks([])

    ax = p_knots(knots, B, ax=ax, dim=2, point=False, line=True, color="black")
    ax = p_cpoints(B,
                   ax=ax,
                   dim=2,
                   color="red",
                   marker="o",
                   point=True,
                   line=False)
    n, m = B.shape[0], B.shape[1]
    P = np.asarray([(B[x, y, 0], B[x, y, 1]) for x in range(n)
                    for y in range(m)])

    for count, point in enumerate(P):
        ax.annotate(str(count),
                    point,
                    xytext=(5, 5),
                    textcoords="offset points")

    ax.annotate("$\Omega_1$", (0.5, 0.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_2$", (1.5, 0.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_3$", (2.5, 0.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_4$", (0.5, 1.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_5$", (1.5, 1.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_6$", (2.5, 1.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")

    fig.show()

    knots = [kn1, kn2]
    shape = np.asarray(cp.shape)
    shape[-1] = 3  # To include the weights in the last term
    B = np.ones(shape)
    B[..., :2] = cp

    from pygeoiga.nurb.refinement import degree_elevation
    B, knots = degree_elevation(B, knots, direction=0)
    B, knots = degree_elevation(B, knots, direction=1)

    from pygeoiga.nurb.refinement import knot_insertion
    B, knots = knot_insertion(B, [2, 2], knots, [0.5], 0)
    B, knots = knot_insertion(B, [2, 2], knots, [1 / 3, 2 / 3], 1)

    fig2, ax2 = create_figure("2d")
    # ax2.set_axis_off()
    ax2.spines["right"].set_visible(False)
    ax2.spines["top"].set_visible(False)
    ax2.set_xlabel("x")
    ax2.set_ylabel("y")
    ax2.set_xticks([])
    ax2.set_yticks([])
    ax2 = p_knots(knots,
                  B,
                  ax=ax2,
                  dim=2,
                  point=False,
                  line=True,
                  color="black")
    ax2 = p_cpoints(B,
                    ax=ax2,
                    dim=2,
                    color="red",
                    marker="o",
                    point=True,
                    line=False)
    n, m = B.shape[0], B.shape[1]
    P = np.asarray([(B[x, y, 0], B[x, y, 1]) for x in range(n)
                    for y in range(m)])

    for count, point in enumerate(P):
        ax2.annotate(str(count),
                     point,
                     xytext=(5, 5),
                     textcoords="offset points")

    disp = (28, 30)
    ax2.annotate("$\Omega_1$", (0.5, 0.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_2$", (1.5, 0.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_3$", (2.5, 0.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_4$", (0.5, 1.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_5$", (1.5, 1.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_6$", (2.5, 1.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")

    fig2.show()

    save = True
    if save or save_all:
        fig.savefig(fig_folder + "NURB_mesh_1_degree.pdf", **kwargs_savefig)
        fig2.savefig(fig_folder + "NURB_mesh_2_degree.pdf", **kwargs_savefig)
コード例 #12
0
def test_show_modifysimple_mesh():
    from pygeoiga.plot.nrbplotting_mpl import create_figure, p_cpoints, p_knots, p_curve, p_surface

    cp = np.array([[[0, 0], [1, 0], [2, 0], [3, 0]],
                   [[0, 1], [1, 1], [2, 1], [3, 1]],
                   [[0, 2], [1, 2], [2, 2], [3, 2]]])
    kn1 = [0, 0, 0.5, 1, 1]
    kn2 = [0, 0, 1 / 3, 2 / 3, 1, 1]

    fig, ax = create_figure("2d")
    #ax.set_axis_off()
    ax.spines["right"].set_visible(False)
    ax.spines["top"].set_visible(False)
    ax.set_xlabel("x")
    ax.set_ylabel("y")
    ax.set_xticks([])
    ax.set_yticks([])

    ax = p_knots([kn1, kn2],
                 cp,
                 ax=ax,
                 dim=2,
                 point=False,
                 line=True,
                 color="black")
    ax = p_cpoints(cp,
                   ax=ax,
                   dim=2,
                   color="red",
                   marker="o",
                   point=True,
                   line=False)
    n, m = cp.shape[0], cp.shape[1]
    P = np.asarray([(cp[x, y, 0], cp[x, y, 1]) for x in range(n)
                    for y in range(m)])

    for count, point in enumerate(P):
        ax.annotate(str(count),
                    point,
                    xytext=(5, 5),
                    textcoords="offset points")

    ax.annotate("$\Omega_1$", (0.5, 0.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_2$", (1.5, 0.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_3$", (2.5, 0.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_4$", (0.5, 1.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_5$", (1.5, 1.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")
    ax.annotate("$\Omega_6$", (2.5, 1.5),
                fontsize=20,
                xytext=(-5, -5),
                textcoords="offset points")

    fig.show()

    cp_2 = np.array([[[0., 0.], [0.5, 0.], [1., 0.], [1.5, 0.], [2., 0.],
                      [2.5, 0.], [3., 0.]],
                     [[0., 0.5], [0.5, 0.5], [1., 0.5], [1.5, 0.5], [2., 0.5],
                      [2.5, 0.5], [3., 0.5]],
                     [[0., 1.], [0.5, 1.], [1., 1.], [1.5, 1.], [2., 1.],
                      [2.5, 1.], [3., 1.]],
                     [[0., 1.5], [0.5, 1.5], [1., 1.5], [1.5, 1.5], [2., 1.5],
                      [2.5, 1.5], [3., 1.5]],
                     [[0., 2.], [0.5, 2.], [1., 2.], [1.5, 2.], [2., 2.],
                      [2.5, 2.], [3., 2.]]])

    knots = (np.array([0., 0., 0., 0.5, 0.5, 1., 1., 1.]),
             np.array([
                 0., 0., 0., 0.33333333, 0.33333333, 0.66666667, 0.66666667,
                 1., 1., 1.
             ]))

    fig2, ax2 = create_figure("2d")
    #ax2.set_axis_off()
    ax2.spines["right"].set_visible(False)
    ax2.spines["top"].set_visible(False)
    ax2.set_xlabel("x")
    ax2.set_ylabel("y")
    ax2.set_xticks([])
    ax2.set_yticks([])

    ax2 = p_knots(knots,
                  cp_2,
                  ax=ax2,
                  dim=2,
                  point=False,
                  line=True,
                  color="black")
    ax2 = p_cpoints(cp_2,
                    ax=ax2,
                    dim=2,
                    color="red",
                    marker="o",
                    point=True,
                    line=False)
    n, m = cp_2.shape[0], cp_2.shape[1]
    P = np.asarray([(cp_2[x, y, 0], cp_2[x, y, 1]) for x in range(n)
                    for y in range(m)])

    for count, point in enumerate(P):
        ax2.annotate(str(count),
                     point,
                     xytext=(5, 5),
                     textcoords="offset points")

    disp = (28, 30)
    ax2.annotate("$\Omega_1$", (0.5, 0.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_2$", (1.5, 0.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_3$", (2.5, 0.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_4$", (0.5, 1.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_5$", (1.5, 1.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")
    ax2.annotate("$\Omega_6$", (2.5, 1.5),
                 fontsize=20,
                 xytext=disp,
                 textcoords="offset points")

    fig2.show()

    save = True
    if save or save_all:
        fig.savefig(fig_folder + "mesh_1degree.pdf", **kwargs_savefig)
        fig2.savefig(fig_folder + "mesh_2degree.pdf", **kwargs_savefig)
コード例 #13
0
def test_explicit_model():
    import matplotlib
    from pygeoiga.plot.nrbplotting_mpl import create_figure, p_cpoints, p_knots, p_curve, p_surface

    img = matplotlib.image.imread('dike.jpg')
    fig, ax = plt.subplots()
    ax.imshow(img, alpha=.8, extent=(0, 300, 0, 178))
    ax.set_aspect("equal")
    ax.set_xlabel("x (m)")
    ax.set_ylabel("y (m)")

    ### Big dike
    cp_1 = np.array([[[223, 0], [145, 60], [108, 90], [71, 149]],
                     [[300, 0], [300, 4.5], [141, 111], [104, 159]]])
    kn1_1 = [0, 0, 1, 1]
    kn1_2 = [0, 0, 0.3, 0.6, 1, 1]
    knots_1 = [kn1_1, kn1_2]

    ax = p_cpoints(cp_1,
                   ax=ax,
                   dim=2,
                   color="black",
                   marker="s",
                   point=True,
                   line=False)
    ax = p_knots(knots_1, cp_1, ax=ax, dim=2, point=True, line=True)

    ### middle dike
    cp_2 = np.array([[[0, 40], [92, 86], [197, 154], [300, 178]],
                     [[0, 94], [80, 120], [91, 144], [204, 178]]])
    kn2_1 = [0, 0, 1, 1]
    kn2_2 = [0, 0, 0.3, 0.6, 1, 1]
    knots_2 = [kn2_1, kn2_2]

    ax = p_cpoints(cp_2,
                   ax=ax,
                   dim=2,
                   color="black",
                   marker="s",
                   point=True,
                   line=False)
    ax = p_knots(knots_2, cp_2, ax=ax, dim=2, point=True, line=True)

    ### Weathered dike
    cp_3 = np.array([[[0, 94], [90, 100], [91, 144], [204, 178]],
                     [[0, 100], [80, 150], [91, 160], [204, 178]],
                     [[0, 178], [80, 178], [142, 178], [204, 178]]])
    kn3_1 = [0, 0, 0, 1, 1, 1]
    kn3_2 = [0, 0, 0, 0.5, 1, 1, 1]
    knots_3 = [kn3_1, kn3_2]

    ax = p_cpoints(cp_3,
                   ax=ax,
                   dim=2,
                   color="black",
                   marker="s",
                   point=True,
                   line=False)
    ax = p_knots(knots_3, cp_3, ax=ax, dim=2, point=True, line=True)

    ### Bottom
    cp_4 = np.array([[[0, 40], [92, 86], [197, 154], [300, 178]],
                     [[0, 0], [92, 0], [197, 0], [300, 0]]])
    kn4_1 = [0, 0, 1, 1]
    kn4_2 = [0, 0, 0.3, 0.6, 1, 1]
    knots_4 = [kn4_1, kn4_2]

    ax = p_cpoints(cp_4,
                   ax=ax,
                   dim=2,
                   color="black",
                   marker="s",
                   point=True,
                   line=False)
    ax = p_knots(knots_4, cp_4, ax=ax, dim=2, point=True, line=True)

    ax.set_xlim(0, 300)
    ax.set_ylim(0, 178)
    fig.show()

    fig2, ax2 = create_figure("2d")

    p_surface(knots_4,
              cp_4,
              ax=ax2,
              dim=2,
              color="red",
              border=False,
              label="Dike1")
    p_surface(knots_2,
              cp_2,
              ax=ax2,
              dim=2,
              color="blue",
              border=False,
              label="Dike2")
    p_surface(knots_1,
              cp_1,
              ax=ax2,
              dim=2,
              color="yellow",
              border=False,
              label="Dike3")
    p_surface(knots_3,
              cp_3,
              ax=ax2,
              dim=2,
              color="gray",
              border=False,
              label="Unknown")

    ax2.set_xlim(0, 300)
    ax2.set_ylim(0, 178)
    ax2.set_aspect("equal")
    ax2.set_xlabel("x (m)")
    ax2.set_ylabel("y (m)")
    ax2.legend(loc="center right", facecolor='white', framealpha=0.8)

    fig2.show()

    fig3, ax3 = create_figure("2d")
    ax3.imshow(img, alpha=.8, extent=(0, 300, 0, 178))

    #p_surface(knots_4, cp_4, ax=ax3, dim=2, color="red", fill=False, label="Dike1")
    #p_surface(knots_2, cp_2, ax=ax3, dim=2, color="blue", fill=False, label="Dike2")
    #p_surface(knots_1, cp_1, ax=ax3, dim=2, color="yellow", fill=False, label="Dike3")
    #p_surface(knots_3, cp_3, ax=ax3, dim=2, color="gray", fill=False, label="Unknown")

    ax3.set_xlim(0, 300)
    ax3.set_ylim(0, 178)
    ax3.set_aspect("equal")
    ax3.set_xlabel("x (m)")
    ax3.set_ylabel("y (m)")
    #ax3.legend(loc="center right")
    fig3.show()

    save = False
    if save or save_all:
        fig2.savefig(fig_folder + "model_explicit.pdf", **kwargs_savefig)
        fig3.savefig(fig_folder + "original_explicit.pdf", **kwargs_savefig)