Exemplo n.º 1
0
 def assemble_panels_wash(self, time: bool=True):
     if time:
         start = perf_counter()
     shp = (self.numhsv, self.numpnl)
     self._awd = zeros(shp, dtype=float)
     self._aws = zeros(shp, dtype=float)
     for pnl in self.pnls.values():
         ind = pnl.ind
         _, _, avd, avs = pnl.influence_coefficients(self.hsvpnts)
         self._awd[:, ind] = elementwise_dot_product(avd, self.hsvnrms)
         self._aws[:, ind] = elementwise_dot_product(avs, self.hsvnrms)
     if time:
         finish = perf_counter()
         elapsed = finish - start
         print(f'Wash matrix assembly time is {elapsed:.3f} seconds.')
Exemplo n.º 2
0
 def anm(self, mach: float=0.0):
     if self._anm is None:
         self._anm = {}
     if mach not in self._anm:
         nrms = self.nrms.repeat(self.numpnl, axis=1)
         self._anm[mach] = elementwise_dot_product(nrms, self.avm(mach))
     return self._anm[mach]
Exemplo n.º 3
0
def velocity_matrix(ra: MatrixVector,
                    rb: MatrixVector,
                    rc: MatrixVector,
                    betm: float = 1.0,
                    tol: float = 1e-12):

    if ra.shape != rb.shape:
        return ValueError()

    numi = rc.shape[0]
    numj = ra.shape[1]

    ra = ra.repeat(numi, axis=0)
    rb = rb.repeat(numi, axis=0)
    rc = rc.repeat(numj, axis=1)

    a = rc - ra
    b = rc - rb

    a.x = a.x / betm
    b.x = b.x / betm

    am = a.return_magnitude()
    bm = b.return_magnitude()

    # Velocity from Bound Vortex
    adb = elementwise_dot_product(a, b)
    abm = multiply(am, bm)
    dm = multiply(abm, abm + adb)
    axb = elementwise_cross_product(a, b)
    axbm = axb.return_magnitude()
    chki = (axbm == 0.0)
    chki = logical_and(axbm >= -tol, axbm <= tol)
    veli = elementwise_multiply(axb, divide(am + bm, dm))
    veli.x[chki] = 0.0
    veli.y[chki] = 0.0
    veli.z[chki] = 0.0

    # Velocity from Trailing Vortex A
    axx = MatrixVector(zeros(a.shape, dtype=float), a.z, -a.y)
    axxm = axx.return_magnitude()
    chka = (axxm == 0.0)
    vela = elementwise_divide(axx, multiply(am, am - a.x))
    vela.x[chka] = 0.0
    vela.y[chka] = 0.0
    vela.z[chka] = 0.0

    # Velocity from Trailing Vortex B
    bxx = MatrixVector(zeros(b.shape, dtype=float), b.z, -b.y)
    bxxm = bxx.return_magnitude()
    chkb = (bxxm == 0.0)
    velb = elementwise_divide(bxx, multiply(bm, bm - b.x))
    velb.x[chkb] = 0.0
    velb.y[chkb] = 0.0
    velb.z[chkb] = 0.0

    return veli, vela, velb
Exemplo n.º 4
0
 def assemble_horseshoes_wash(self, time: bool=True):
     if time:
         start = perf_counter()
     shp = (self.numhsv, self.numhsv)
     self._awh = zeros(shp, dtype=float)
     for i, hsv in enumerate(self.hsvs):
         avh = hsv.trefftz_plane_velocities(self.hsvpnts)
         self._awh[:, i] = elementwise_dot_product(avh, self.hsvnrms)
     if time:
         finish = perf_counter()
         elapsed = finish - start
         print(f'Wash horse shoe assembly time is {elapsed:.3f} seconds.')
Exemplo n.º 5
0
def vel_doublet_matrix(av, am, bv, bm):
    adb = elementwise_dot_product(av, bv)
    abm = multiply(am, bm)
    dm = multiply(abm, abm + adb)
    axb = elementwise_cross_product(av, bv)
    axbm = axb.return_magnitude()
    chki = (axbm == 0.0)
    chki = logical_and(axbm >= -tol, axbm <= tol)
    velvl = elementwise_multiply(axb, divide(am + bm, dm))
    velvl.x[chki] = 0.0
    velvl.y[chki] = 0.0
    velvl.z[chki] = 0.0
    return velvl
Exemplo n.º 6
0
def vel_doublet_matrix(av, am, bv, bm):
    adb = elementwise_dot_product(av, bv)
    abm = multiply(am, bm)
    dm = multiply(abm, abm+adb)
    axb = elementwise_cross_product(av, bv)
    axbm = axb.return_magnitude()
    chki = (axbm == 0.0)
    chki = logical_and(axbm >= -tol, axbm <= tol)
    chkd = absolute(dm) < tol
    fac = zeros(axbm.shape, dtype=float)
    divide(am+bm, dm, where=logical_not(chkd), out=fac)
    velvl = elementwise_multiply(axb, fac)
    velvl.x[chki] = 0.0
    velvl.y[chki] = 0.0
    velvl.z[chki] = 0.0
    return velvl