Source code for rolland.excitation
"""Defines excitation classes for FDM simulation.
.. autosummary::
:toctree: excitation
Excitation
StationaryExcitation
GaussianImpulse
MovingExcitation
"""
import abc
from numpy import exp
from traitlets import Float, List, Union
from .abstract_traits import ABCHasTraits
[docs]
class Excitation(ABCHasTraits):
"""Abstract base class for excitation."""
[docs]
@abc.abstractmethod
def validate_excitation(self):
"""Validate excitation parameters."""
[docs]
class StationaryExcitation(Excitation):
"""Abstract base class for stationary excitation."""
[docs]
@abc.abstractmethod
def validate_stationary_excitation(self):
"""Validate stationary excitation parameters."""
[docs]
class GaussianImpulse(StationaryExcitation):
"""Gaussian impulse excitation class.
Gaussian impulse according to :cite:t:`stampka2022a`. This excitation type is used for
non-moving sources.
Attributes
----------
sigma : float
Pulse parameter (regulates pulse-time) :math:`[-]`.
a : float
Pulse parameter (regulates amplitude) :math:`[s]`.
x_excit : float
Excitation position :math:`[m]`.
"""
sigma = Float(default_value=0.7e-4)
a = Float(default_value=0.5e2)
x_excit = Union([List(), Float(default_value=50.0)])
[docs]
def validate_excitation(self):
"""Validate excitation parameters."""
[docs]
def validate_stationary_excitation(self):
"""Validate stationary excitation parameters."""
[docs]
def force(self, t):
"""Compute force array (contains force over time)."""
tg = t - 4 * self.sigma
return self.a * tg / self.sigma ** 2 * exp(-tg ** 2 / self.sigma ** 2)
[docs]
class MovingExcitation(Excitation):
"""Moving excitation class."""