你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-05 20:16:52 +08:00
Added gaussianprime and gaussiandoubleprime waveforms which are direct 1st and 2nd derivatives of the gaussian waveform, i.e. they don't share the same centre frequency.
这个提交包含在:
@@ -661,6 +661,8 @@ Allows you to specify waveforms to use with sources in the model. The syntax of
|
|||||||
* ``gaussiandotdot`` which is the second derivative of a Gaussian waveform.
|
* ``gaussiandotdot`` which is the second derivative of a Gaussian waveform.
|
||||||
* ``gaussiandotdotnorm`` which is the normalised second derivative of a Gaussian waveform.
|
* ``gaussiandotdotnorm`` which is the normalised second derivative of a Gaussian waveform.
|
||||||
* ``ricker`` which is a Ricker (or Mexican hat) waveform, i.e. the negative, normalised second derivative of a Gaussian waveform.
|
* ``ricker`` which is a Ricker (or Mexican hat) waveform, i.e. the negative, normalised second derivative of a Gaussian waveform.
|
||||||
|
* ``gaussianprime`` which is the first derivative of a Gaussian waveform, directly derived from the aforementioned ``gaussian`` (see notes below).
|
||||||
|
* ``gaussiandoubleprime`` which is the second derivative of a Gaussian waveform, directly derived from the aforementioned ``gaussian`` (see notes below).
|
||||||
* ``sine`` which is a single cycle of a sine waveform.
|
* ``sine`` which is a single cycle of a sine waveform.
|
||||||
* ``contsine`` which is a continuous sine waveform. In order to avoid introducing noise into the calculation the amplitude of the waveform is modulated for the first cycle of the sine wave (ramp excitation).
|
* ``contsine`` which is a continuous sine waveform. In order to avoid introducing noise into the calculation the amplitude of the waveform is modulated for the first cycle of the sine wave (ramp excitation).
|
||||||
* ``f1`` is the scaling of the maximum amplitude of the waveform (for a ``#hertzian_dipole`` the units will be Amps, for a ``#voltage_source`` or ``#transmission_line`` the units will be Volts).
|
* ``f1`` is the scaling of the maximum amplitude of the waveform (for a ``#hertzian_dipole`` the units will be Amps, for a ``#voltage_source`` or ``#transmission_line`` the units will be Volts).
|
||||||
@@ -672,6 +674,9 @@ For example, to specify the normalised first derivate of a Gaussian waveform wit
|
|||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
* The functions used to create the waveforms can be found in the :ref:`tools section <waveforms>`.
|
* The functions used to create the waveforms can be found in the :ref:`tools section <waveforms>`.
|
||||||
|
* ``gaussiandot``, ``gaussiandotnorm``, ``gaussiandotdot``, ``gaussiandotdotnorm``, ``ricker`` waveforms have their centre frequencies specified by the user, i.e. they are not derived to the 'base' ``gaussian``
|
||||||
|
* ``gaussianprime`` and ``gaussiandoubleprime`` waveforms are the first derivative and second derivative of the 'base' ``gaussian`` waveform, i.e. the centre frequencies of the waveforms will rise for the first and second derivatives.
|
||||||
|
|
||||||
|
|
||||||
#excitation_file:
|
#excitation_file:
|
||||||
-----------------
|
-----------------
|
||||||
|
@@ -24,7 +24,15 @@ from gprMax.utilities import round_value
|
|||||||
class Waveform(object):
|
class Waveform(object):
|
||||||
"""Definitions of waveform shapes that can be used with sources."""
|
"""Definitions of waveform shapes that can be used with sources."""
|
||||||
|
|
||||||
types = ['gaussian', 'gaussiandot', 'gaussiandotnorm', 'gaussiandotdot', 'gaussiandotdotnorm', 'ricker', 'sine', 'contsine', 'impulse', 'user']
|
types = ['gaussian', 'gaussiandot', 'gaussiandotnorm', 'gaussiandotdot', 'gaussiandotdotnorm', 'gaussianprime', 'gaussiandoubleprime', 'ricker', 'sine', 'contsine', 'impulse', 'user']
|
||||||
|
|
||||||
|
# Information about specific waveforms:
|
||||||
|
#
|
||||||
|
# gaussianprime and gaussiandoubleprime waveforms are the first derivative and second derivative of the 'base' gaussian
|
||||||
|
# waveform, i.e. the centre frequencies of the waveforms will rise for the first and second derivatives.
|
||||||
|
#
|
||||||
|
# gaussiandot, gaussiandotnorm, gaussiandotdot, gaussiandotdotnorm, ricker waveforms have their centre frequencies
|
||||||
|
# specified by the user, i.e. they are not derived from the 'base' gaussian
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = None
|
self.ID = None
|
||||||
@@ -44,8 +52,8 @@ class Waveform(object):
|
|||||||
ampvalue (float): Calculated value for waveform.
|
ampvalue (float): Calculated value for waveform.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Coefficients for certain waveforms
|
# Coefficients for specific waveforms
|
||||||
if self.type == 'gaussian' or self.type == 'gaussiandot' or self.type == 'gaussiandotnorm':
|
if self.type == 'gaussian' or self.type == 'gaussiandot' or self.type == 'gaussiandotnorm' or self.type == 'gaussianprime' or self.type == 'gaussiandoubleprime':
|
||||||
chi = 1 / self.freq
|
chi = 1 / self.freq
|
||||||
zeta = 2 * np.pi**2 * self.freq**2
|
zeta = 2 * np.pi**2 * self.freq**2
|
||||||
delay = time - chi
|
delay = time - chi
|
||||||
@@ -58,14 +66,14 @@ class Waveform(object):
|
|||||||
if self.type == 'gaussian':
|
if self.type == 'gaussian':
|
||||||
ampvalue = np.exp(-zeta * delay**2)
|
ampvalue = np.exp(-zeta * delay**2)
|
||||||
|
|
||||||
elif self.type == 'gaussiandot':
|
elif self.type == 'gaussiandot' or self.type == 'gaussianprime':
|
||||||
ampvalue = -2 * zeta * delay * np.exp(-zeta * delay**2)
|
ampvalue = -2 * zeta * delay * np.exp(-zeta * delay**2)
|
||||||
|
|
||||||
elif self.type == 'gaussiandotnorm':
|
elif self.type == 'gaussiandotnorm':
|
||||||
normalise = np.sqrt(np.exp(1) / (2 * zeta))
|
normalise = np.sqrt(np.exp(1) / (2 * zeta))
|
||||||
ampvalue = -2 * zeta * delay * np.exp(-zeta * delay**2) * normalise
|
ampvalue = -2 * zeta * delay * np.exp(-zeta * delay**2) * normalise
|
||||||
|
|
||||||
elif self.type == 'gaussiandotdot':
|
elif self.type == 'gaussiandotdot' or self.type == 'gaussiandoubleprime':
|
||||||
ampvalue = 2 * zeta * (2 * zeta * delay**2 - 1) * np.exp(-zeta * delay**2)
|
ampvalue = 2 * zeta * (2 * zeta * delay**2 - 1) * np.exp(-zeta * delay**2)
|
||||||
|
|
||||||
elif self.type == 'gaussiandotdotnorm':
|
elif self.type == 'gaussiandotdotnorm':
|
||||||
|
@@ -19,7 +19,7 @@ def hertzian_dipole_fs(iterations, dt, dxdydz, rx):
|
|||||||
|
|
||||||
# Waveform
|
# Waveform
|
||||||
w = Waveform()
|
w = Waveform()
|
||||||
w.type = 'gaussiandot'
|
w.type = 'gaussianprime'
|
||||||
w.amp = 1
|
w.amp = 1
|
||||||
w.freq = 1e9
|
w.freq = 1e9
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ def hertzian_dipole_fs(iterations, dt, dxdydz, rx):
|
|||||||
|
|
||||||
# Waveform first derivative
|
# Waveform first derivative
|
||||||
wdot = Waveform()
|
wdot = Waveform()
|
||||||
wdot.type = 'gaussiandotdot'
|
wdot.type = 'gaussiandoubleprime'
|
||||||
wdot.amp = w.amp
|
wdot.amp = w.amp
|
||||||
wdot.freq = w.freq
|
wdot.freq = w.freq
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ def mpl_plot(w, timewindow, dt, iterations, fft=False):
|
|||||||
if w.freq and not w.type == 'gaussian':
|
if w.freq and not w.type == 'gaussian':
|
||||||
print('Centre frequency: {:g} Hz'.format(w.freq))
|
print('Centre frequency: {:g} Hz'.format(w.freq))
|
||||||
|
|
||||||
if w.type == 'gaussian' or w.type == 'gaussiandot' or w.type == 'gaussiandotnorm':
|
if w.type == 'gaussian' or w.type == 'gaussiandot' or w.type == 'gaussiandotnorm' or w.type == 'gaussianprime' or w.type == 'gaussiandoubleprime':
|
||||||
delay = 1 / w.freq
|
delay = 1 / w.freq
|
||||||
print('Time to centre of pulse: {:g} s'.format(delay))
|
print('Time to centre of pulse: {:g} s'.format(delay))
|
||||||
elif w.type == 'gaussiandotdot' or w.type == 'gaussiandotdotnorm' or w.type == 'ricker':
|
elif w.type == 'gaussiandotdot' or w.type == 'gaussiandotdotnorm' or w.type == 'ricker':
|
||||||
|
在新工单中引用
屏蔽一个用户