Skip to main content

blobmodel

Python version Pypi codecov Tests Checked with mypy Code style: black License: MIT Documentation Status

This package provides realizations of advecting and dissipating blobs in up to two dimensions.

All blob parameters can be choosen freely, and multiple blob shapes are implemented. Originally, the model is developed for studying the scrape-off layer of fusion experiments, but it can be applicable to many 1d or 2d systems. See the blobmodel documentation for further details.

Examples for one and two dimensions are shown below:

1D 2D
Density evolution Density evolution

Installation

The package is published to PyPI and can be installed with

pip install blobmodel

If you want the development version you must first clone the repo to your local machine, then install the project in development mode:

git clone https://github.com/uit-cosmo/blobmodel.git
cd blobmodel
python -m pip install -e .

Usage

Create a grid on which the blobs are discretized using the Model class. The make_realization() method computes the output as an xarray dataset which can also be written out as a netcdf file if the argument file_name is specified. A simple example is shown below:

from blobmodel import Model, show_model

bm = Model(Nx=200, Ny=100, Lx=10, Ly=10, dt=0.1, T=20, num_blobs=100)

ds = bm.make_realization(file_name="example.nc")

The data can be shown as an animation using the show_model function:

show_model(ds)

You can specify the blob parameters with a BlobFactory class. The DefaultBlobFactory class has some of the most common distribution functions implemented. An example would look like this:

from blobmodel import DefaultBlobFactory, DistributionEnum, Model

# use DefaultBlobFactory to define distribution functions of random variables
my_blob_factory = DefaultBlobFactory(A_dist=DistributionEnum.normal, A_parameter=5)

# pass on my_blob_factory when creating the Model
bm = Model(
        Nx=100,
        Ny=100,
        Lx=10,
        Ly=10,
        dt=0.1,
        T=20,
        blob_factory=my_blob_factory,
        t_drain=100,
        num_blobs=100,
    )

Alternatively, you can specify all blob parameters exactly as you want by writing your own class which inherits from BlobFactory. See examples/custom_blobfactory.py as an example or take a look at the blobmodel documentation.

Contributing

Feel free to raise issues about anything. Contributions through pull requests are also very welcome. Please take a look at our Contributor guide for further details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blobmodel-1.2.2.tar.gz (20.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blobmodel-1.2.2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file blobmodel-1.2.2.tar.gz.

File metadata

  • Download URL: blobmodel-1.2.2.tar.gz
  • Upload date:
  • Size: 20.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for blobmodel-1.2.2.tar.gz
Algorithm Hash digest
SHA256 4184287e45b39c6203986730423ed124cba1b9d29530f430b6a149b1675e1289
MD5 2774615ba627d8ee090e179f73c5e40c
BLAKE2b-256 6d5864f9817acd4cbef00628d614befcaa8bb7ea25c434527ad2b3cb9c82d971

See more details on using hashes here.

File details

Details for the file blobmodel-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: blobmodel-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for blobmodel-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22f251d1e92257215d0c58a4a3429aa7a324ead535a683d89d1d100d252557b1
MD5 b89e88515833bf3bdf2dc0cbfdd6a7db
BLAKE2b-256 974749a7262df0d5c6b9b6bd9731f9572fd60c9e8f6d4691ba05676c02c002e8

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

This release

1.2.2 This release

2 files

1.2.1

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page