Ejemplo n.º 1
0
    def run(self):
        '''
        Run the model. Sets the following instance variables:
        vr: Calculation ranges (m), NumPy 1D array.
        vz: Calculation depths (m), NumPy 1D array.
        tll: Transmission loss (dB) at receiver depth (zr),
             NumPy 1D array, length vr.size.
        tlg: Transmission loss (dB) grid,
             NumPy 2D array, dimensions vz.size by vr.size.
        proc_time: Processing time (s).
        '''

        t0 = process_time()

        self.setup()

        nr = int(numpy.round(self._rmax / self._dr)) - 1

        for rn in range(nr):

            self.updat()

            solve(self.u, self.v, self.s1, self.s2, self.s3, self.r1, self.r2,
                  self.r3, self.iz, self.nz, self._np)

            self.r = (rn + 2) * self._dr

            self.mdr, self.tlc = \
                (outpt(self.r, self.mdr, self._ndr, self._ndz, self.tlc, self.f3,
                       self.u, self.dir, self.ir, self.tll, self.tlg, self.cpl, self.cpg)[:])

        self.proc_time = process_time() - t0

        results = {
            'ID': self._id,
            'Proc Time': self.proc_time,
            'Ranges': self.vr,
            'Depths': self.vz,
            'TL Grid': self.tlg,
            'TL Line': self.tll,
            'CP Grid': self.cpg,
            'CP Line': self.cpl,
            'c0': self._c0
        }

        return results
Ejemplo n.º 2
0
    def selfs(self):

        '''The self-starter'''

        # Conditions for the delta function

        si = self._zs / self._dz
        _is = int(numpy.floor(si))  # Source depth index
        dis = si - _is  # Offset

        self.u[_is] = (1 - dis) * numpy.sqrt(2 * numpy.pi / self.k0) / \
            (self._dz * self.alpw[_is])
        self.u[_is + 1] = dis * numpy.sqrt(2 * numpy.pi / self.k0) / \
            (self._dz * self.alpw[_is])

        # Divide the delta function by (1-X)**2 to get a smooth rhs

        self.pd1[0] = 0
        self.pd2[0] = -1

        matrc(self.k0, self._dz, self.iz, self.iz, self.nz, 1,
              self.f1, self.f2, self.f3, self.ksq, self.alpw, self.alpb,
              self.ksqw, self.ksqb, self.rhob, self.r1, self.r2, self.r3,
              self.s1, self.s2, self.s3, self.pd1, self.pd2)
        for _ in range(2):
            solve(self.u, self.v, self.s1, self.s2, self.s3,
                  self.r1, self.r2, self.r3, self.iz, self.nz, 1)

        # Apply the operator (1-X)**2*(1+X)**(-1/4)*exp(ci*k0*r*sqrt(1+X))

        self.epade(ip=2)
        matrc(self.k0, self._dz, self.iz, self.iz, self.nz, self._np,
              self.f1, self.f2, self.f3, self.ksq, self.alpw, self.alpb,
              self.ksqw, self.ksqb, self.rhob, self.r1, self.r2, self.r3,
              self.s1, self.s2, self.s3, self.pd1, self.pd2)
        solve(self.u, self.v, self.s1, self.s2, self.s3,
              self.r1, self.r2, self.r3, self.iz, self.nz, self._np)