Skip to main content

Two dimensional model of propagating blobs

Project description

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, blob_shape='gauss',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 Model, DefaultBlobFactory

# use DefaultBlobFactory to define distribution functions of random variables
bf = DefaultBlobFactory(A_dist="exp", wx_dist="uniform", vx_dist="deg", vy_dist="normal")

# pass on bf when creating the Model
tmp = Model(
    Nx=100,
    Ny=1,
    Lx=10,
    Ly=0,
    dt=1,
    T=1000,
    blob_shape="exp",
    t_drain=2,
    periodic_y=False,
    num_blobs=10000,
    blob_factory=bf,
)

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.

Project 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.0.1.tar.gz (15.1 MB view details)

Uploaded Source

Built Distribution

blobmodel-1.0.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blobmodel-1.0.1.tar.gz
  • Upload date:
  • Size: 15.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for blobmodel-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5a9fb43b7f2022e88950b06f2129751d081466a5c40b67a6de174103f7631368
MD5 6d388dff2003944e38cbd5956624c3b1
BLAKE2b-256 1ed2427a992241a0eefa34a3067659663b2f6d5f9f46c0299c5251764ee7e4ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blobmodel-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for blobmodel-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1536909b646231531780b97f1b36eb8362301f4d4ba5f4158eec6e6ec34ded1
MD5 e3defe8cd4b3fe86c1fc7484312ee67f
BLAKE2b-256 aec56070e23ffafa990a6fc5a03146e95101da17092d09ca0c975bb3dc9f7499

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page