Exemple #1
0
    def get_induced_velocity(self, zeta_target):
        """
        Computes induced velocity at a point zeta_target.
        """

        M, N = self.maps.M, self.maps.N
        uind_target = np.zeros((3, ), order='C')
        # uind_ref=np.zeros((3,),order='C')

        for mm in range(M):
            for nn in range(N):
                # panel info
                zetav_here = self.get_panel_vertices_coords(mm, nn)
                uind_target += uvlmlib.biot_panel_cpp(zeta_target, zetav_here,
                                                      self.gamma[mm, nn])

        return uind_target
Exemple #2
0
    def get_aic3(self, zeta_target):
        """
        Produces influence coefficinet matrix to calculate the induced velocity
        at a target point. The aic3 matrix has shape (3,K)
        """

        K = self.maps.K
        aic3 = np.zeros((3, K))

        for cc in range(K):
            # define panel
            mm = self.maps.ind_2d_pan_scal[0][cc]
            nn = self.maps.ind_2d_pan_scal[1][cc]

            # get panel coordinates
            zetav_here = self.get_panel_vertices_coords(mm, nn)
            aic3[:, cc] = uvlmlib.biot_panel_cpp(zeta_target,
                                                 zetav_here,
                                                 gamma=1.0)

        return aic3
Exemple #3
0
 def run_biot_panel_cpp():
     for ii in range(10000):
         uvlmlib.biot_panel_cpp(zetaP, ZetaPanel, gamma=3.)
Exemple #4
0
    ### verify consistency amongst models
    gamma = 4.
    zeta0 = np.array([1.0, 3.0, 0.9])
    zeta1 = np.array([5.0, 3.1, 1.9])
    zeta2 = np.array([4.8, 8.1, 2.5])
    zeta3 = np.array([0.9, 7.9, 1.7])
    ZetaPanel = np.array([zeta0, zeta1, zeta2, zeta3])

    zetaP = np.array([3.0, 5.5, 2.0])
    zetaP = zeta2 * 0.3 + zeta3 * 0.7

    ### verify model consistency
    qref = biot_panel(zetaP, ZetaPanel, gamma=gamma)
    qfast = biot_panel_fast(zetaP, ZetaPanel, gamma=gamma)
    qcpp = uvlmlib.biot_panel_cpp(zetaP, ZetaPanel, gamma=gamma)

    ermax = np.max(np.abs(qref - qfast))
    assert ermax < 1e-16, 'biot_panel_fast not matching with biot_panel'
    ermax = np.max(np.abs(qref - qcpp))
    assert ermax < 1e-16, 'biot_panel_cpp not matching with biot_panel'

    ### profiling
    def run_biot_panel_cpp():
        for ii in range(10000):
            uvlmlib.biot_panel_cpp(zetaP, ZetaPanel, gamma=3.)

    def run_biot_panel_fast():
        for ii in range(10000):
            biot_panel_fast(zetaP, ZetaPanel, gamma=3.)
Exemple #5
0
 def run_biot_panel_cpp():
     for ii in range(10000):
         uvlmlib.biot_panel_cpp(zetaP, ZetaPanel, 1e-6,
                                gamma=3.)  # vortex_radius
Exemple #6
0
    ### verify consistency amongst models
    gamma = 4.
    zeta0 = np.array([1.0, 3.0, 0.9])
    zeta1 = np.array([5.0, 3.1, 1.9])
    zeta2 = np.array([4.8, 8.1, 2.5])
    zeta3 = np.array([0.9, 7.9, 1.7])
    ZetaPanel = np.array([zeta0, zeta1, zeta2, zeta3])

    zetaP = np.array([3.0, 5.5, 2.0])
    zetaP = zeta2 * 0.3 + zeta3 * 0.7

    ### verify model consistency
    qref = biot_panel(zetaP, ZetaPanel, 1e-6, gamma=gamma)  # vortex_radius
    qfast = biot_panel_fast(zetaP, ZetaPanel, 1e-6,
                            gamma=gamma)  # vortex_radius
    qcpp = uvlmlib.biot_panel_cpp(zetaP, ZetaPanel, 1e-6,
                                  gamma=gamma)  # vortex_radius

    ermax = np.max(np.abs(qref - qfast))
    assert ermax < 1e-16, 'biot_panel_fast not matching with biot_panel'
    ermax = np.max(np.abs(qref - qcpp))
    assert ermax < 1e-16, 'biot_panel_cpp not matching with biot_panel'

    ### profiling
    def run_biot_panel_cpp():
        for ii in range(10000):
            uvlmlib.biot_panel_cpp(zetaP, ZetaPanel, 1e-6,
                                   gamma=3.)  # vortex_radius

    def run_biot_panel_fast():
        for ii in range(10000):
            biot_panel_fast(zetaP, ZetaPanel, 1e-6, gamma=3.)  # vortex_radius