def test_RadialWaveMediumF(self):
        Frequency = 1.
        k = Frequency / self.VP * 2 * np.pi
        assert k * self.DX < 1
        L_PML = self.DX * self.NE_PML
        pml_condition = PMLCondition(sigma0=self.S0,
                                     Lleft=[L_PML, L_PML],
                                     Lright=[L_PML, L_PML],
                                     m=4)
        # sonic wave model
        wave = SonicWaveInFrequencyDomain(self.domain,
                                          vp=self.VP,
                                          pml_condition=pml_condition)
        wave.setFrequency(Frequency)
        # set source and get wave response:
        u = wave.getWave(self.source)

        r = np.array([
            sqrt((x[0] - self.sourceX[0])**2 + (x[1] - self.sourceX[1])**2)
            for x in self.loc.getX()
        ])
        uu2 = -scipy.special.hankel2(0, k * r) * 1j / 4
        uu = np.array(self.loc(u))
        errorA = max(abs(uu2 - uu))
        A = max(abs(uu2))
        self.assertLessEqual(errorA, A * self.TESTTOL)
Example #2
0
for l in range(len(Vs) - 1, -1, -1):
    mask = wherePositive(X[Dim - 1] - (Top - Layers[l]))
    vp = vp * (1 - mask) + mask * Vs[l]
print("Velocity field generated:", vp)

# check spacing vs, wavelength:
wavelength = inf(vp / (2 * np.pi * Frequency))
print("minimum wavelength   = %g" % wavelength)
assert wavelength > max(dx, dz) / Order

# locator to grap amplitudes at geophones:
geophones = Locator(Solution(domain), stationPositions)

# create PML condition:
pml_condition = PMLCondition(sigma0=vp * 100 / Frequency,
                             Lleft=[L_PML, L_PML],
                             Lright=[L_PML, None],
                             m=4)
print("PMLConditon generated ...")

# sonic wave model
wave = SonicWaveInFrequencyDomain(domain, vp=vp, pml_condition=pml_condition)
wave.setFrequency(Frequency)
print("model created...")
# set source and get wave response:
source = Scalar(0j, DiracDeltaFunctions(domain))
source.setTaggedValue(stationTags[NStations // 2], Amplitude)
u = wave.getWave(source)
print("model solved...")

# get amplitude and phase
amps = abs(u)