Blob Shapes

We can choose between four different blob shapes that are specified with the blob_shape argument of the Model class.

The blob shape consists of two parts, the blob shape in the propagation direction and the blob shape in the perpendicular direction thereof. The propagation direction is calculated from vx and vy of each individual blob (see blob-alignment for further details).

The blob_shape argument should implement the AbstractBlobShape class. For most cases it suffices to use the standard implementation BlobShapeImpl, instantiated as

Where pulse_shape_prop and pulse_shape_perp indicate the pulse shape in the propagation and perpendicular direction, respectively. These arguments are BlobShapeEnum typed, and can take the following values, where \(\theta\) represents a coordinate in either the propagation or perpendicular direction.

exp

lorentz

double_exp

gaussian

secant

dipole

rect

Exponential

Lorentz

Double Exponential

Gaussian

Secant

Dipole

Rectangular

\(e^\theta \Theta(-\theta)\)

\(\frac{1}{\pi(1+\theta^2)}\)

\(e^{\theta/\lambda} \Theta(-\theta) + e^{\theta/(1-\lambda)} \Theta(\theta)\)

\(\frac{e^{-\theta^2/2}}{\sqrt{\pi}}\)

\(\frac{2}{\pi (e^\theta + e^{-\theta})}\)

\(\frac{-2 \theta e^{-\theta^2}}{\sqrt{\pi}}\)

\(\Theta(|\theta|-1/2)\)

_images/pulse_shapes.png

The following example creates a Model with a pulse shape given by an exponential in the propagation direction, and lorentzian in the perpendicular direction:

    from blobmodel import (
        Model,
        BlobShapeImpl,
        BlobShapeEnum,
        DefaultBlobFactory,
        DistributionEnum,
    )

    bm = Model(
        Nx=100,
        Ny=100,
        Lx=10,
        Ly=10,
        dt=0.1,
        T=10,
        num_blobs=10,
        blob_shape=BlobShapeImpl(BlobShapeEnum.exp, BlobShapeEnum.lorentz),
        periodic_y=True,
        t_drain=1e10,
    )

Two-sided exponential blob shape

The last blob shape we discuss is the two-sided exponential blob shape. In contrast to the shapes above, it requires an asymmetry parameter lam to specify the exact shape. The shape is implemented as follows:

shape[t < 0] = np.exp(t[t < 0] / lam)
shape[t >= 0] = np.exp(-t[t >= 0] / (1 - lam))
_images/2-sided_pulse_shape.png

We specify the asymmetry parameter when defining the blob_factory. An example would look like this:

    bf = DefaultBlobFactory(
        A_dist=DistributionEnum.deg,
        wp_dist=DistributionEnum.deg,
        spp_dist=DistributionEnum.deg,
        sps_dist=DistributionEnum.deg,
        shape_param_p_parameter=0.5,
        shape_param_s_parameter=0.5,
    )
    bm = Model(
        Nx=100,
        Ny=100,
        Lx=10,
        Ly=10,
        dt=0.1,
        T=10,
        num_blobs=10,
        blob_shape=BlobShapeImpl(BlobShapeEnum.double_exp, BlobShapeEnum.double_exp),
        t_drain=1e10,
        blob_factory=bf,
    )

Take a look at examples/2_sided_exp_pulse.py for a fully implemented example.