[![CircleCI](https://circleci.com/gh/fusion-energy/openmc-plasma-source/tree/main.svg?style=svg)](https://circleci.com/gh/fusion-energy/openmc-plasma-source/tree/main) [![codecov](https://codecov.io/gh/fusion-energy/openmc-plasma-source/branch/main/graph/badge.svg?token=kDvWo6NGue)](https://codecov.io/gh/fusion-energy/openmc-plasma-source) [![PyPI version](https://badge.fury.io/py/openmc-plasma-source.svg)](https://badge.fury.io/py/openmc-plasma-source)
# OpenMC-plasma-source
This python-based package offers a collection of pre-built [OpenMC](https://github.com/openmc-dev/openmc) neutron sources for fusion applications.
## Installation
OpenMC is required to use this package.
To install openmc-plasma-source, simply run:
```
pip install openmc-plasma-source
```
## Usage
### Tokamak Source
Create a source with a spatial and temperature distribution of a tokamak plasma.
The OpenMC sources are ring sources which reduces the computational cost and the settings.xml file size.
Each source has its own strength (or probability that a neutron spawns in this location).
The equations implemented here are taken from [this paper](https://doi.org/10.1016/j.fusengdes.2012.02.025).
```python
from openmc_plasma_source import TokamakSource
my_source = TokamakSource(
elongation=1.557,
ion_density_centre=1.09e20,
ion_density_peaking_factor=1,
ion_density_pedestal=1.09e20,
ion_density_separatrix=3e19,
ion_temperature_centre=45.9,
ion_temperature_peaking_factor=8.06,
ion_temperature_pedestal=6.09,
ion_temperature_separatrix=0.1,
major_radius=9.06,
minor_radius=2.92258,
pedestal_radius=0.8 * 2.92258,
mode="H",
shafranov_factor=0.44789,
triangularity=0.270,
ion_temperature_beta=6
).make_openmc_sources()
```
For a more complete example check out the [example script](https://github.com/fusion-energy/openmc-plasma-source/blob/main/examples/tokamak_source_example.py).
![out](https://user-images.githubusercontent.com/40028739/135100022-330aa51c-e2a2-401c-9738-90f3e99c84d4.png)
![out](https://user-images.githubusercontent.com/40028739/135098576-a94709ef-96b4-4b8d-8fa0-76a201b6c5d2.png)
### Ring Source
Create a ring source with temperature distribution of a 2000 eV plasma.
```python
from openmc_plasma_source import FusionRingSource
my_plasma = FusionRingSource(
angles = (0., 6.28318530718), # input is in radians
radius = 400, # units in cm
temperature = 20000., # ion temperature in eV
fuel='DT' # or 'DD'
)
```
### Point Source
Create a point source with temperature distribution of a 2000 eV plasma.
```python
from openmc_plasma_source import FusionPointSource
my_plasma = FusionPointSource(
coordinate = (0, 0, 0),
temperature = 20000., # ion temperature in eV
fuel = 'DT' # or 'DD'
)
```
## Testing
To run the tests, simply run
```
pytest tests/
```
Raw data
{
"_id": null,
"home_page": null,
"name": "openmc-plasma-source",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, neutron, fusion, source, openmc, energy, tokamak",
"author": "R\u00e9mi Delaporte-Mathurin",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/17/d9/f3cdfb827e6364bc71cf252c597830a28a545aaa7af6e2637283a8edcd81/openmc_plasma_source-0.3.1.tar.gz",
"platform": null,
"description": "[![CircleCI](https://circleci.com/gh/fusion-energy/openmc-plasma-source/tree/main.svg?style=svg)](https://circleci.com/gh/fusion-energy/openmc-plasma-source/tree/main) [![codecov](https://codecov.io/gh/fusion-energy/openmc-plasma-source/branch/main/graph/badge.svg?token=kDvWo6NGue)](https://codecov.io/gh/fusion-energy/openmc-plasma-source) [![PyPI version](https://badge.fury.io/py/openmc-plasma-source.svg)](https://badge.fury.io/py/openmc-plasma-source)\n\n# OpenMC-plasma-source\n\nThis python-based package offers a collection of pre-built [OpenMC](https://github.com/openmc-dev/openmc) neutron sources for fusion applications.\n\n## Installation\n\nOpenMC is required to use this package.\n\nTo install openmc-plasma-source, simply run:\n```\npip install openmc-plasma-source\n```\n\n## Usage\n\n### Tokamak Source\n\nCreate a source with a spatial and temperature distribution of a tokamak plasma.\nThe OpenMC sources are ring sources which reduces the computational cost and the settings.xml file size.\nEach source has its own strength (or probability that a neutron spawns in this location).\n\nThe equations implemented here are taken from [this paper](https://doi.org/10.1016/j.fusengdes.2012.02.025).\n\n```python\nfrom openmc_plasma_source import TokamakSource\n\nmy_source = TokamakSource(\n elongation=1.557,\n ion_density_centre=1.09e20,\n ion_density_peaking_factor=1,\n ion_density_pedestal=1.09e20,\n ion_density_separatrix=3e19,\n ion_temperature_centre=45.9,\n ion_temperature_peaking_factor=8.06,\n ion_temperature_pedestal=6.09,\n ion_temperature_separatrix=0.1,\n major_radius=9.06,\n minor_radius=2.92258,\n pedestal_radius=0.8 * 2.92258,\n mode=\"H\",\n shafranov_factor=0.44789,\n triangularity=0.270,\n ion_temperature_beta=6\n ).make_openmc_sources()\n```\n\nFor a more complete example check out the [example script](https://github.com/fusion-energy/openmc-plasma-source/blob/main/examples/tokamak_source_example.py).\n\n![out](https://user-images.githubusercontent.com/40028739/135100022-330aa51c-e2a2-401c-9738-90f3e99c84d4.png)\n ![out](https://user-images.githubusercontent.com/40028739/135098576-a94709ef-96b4-4b8d-8fa0-76a201b6c5d2.png)\n\n### Ring Source\n\n\nCreate a ring source with temperature distribution of a 2000 eV plasma.\n\n```python\nfrom openmc_plasma_source import FusionRingSource\n\nmy_plasma = FusionRingSource(\n angles = (0., 6.28318530718), # input is in radians\n radius = 400, # units in cm\n temperature = 20000., # ion temperature in eV\n fuel='DT' # or 'DD'\n)\n```\n### Point Source\n\nCreate a point source with temperature distribution of a 2000 eV plasma.\n\n\n```python\nfrom openmc_plasma_source import FusionPointSource\n\nmy_plasma = FusionPointSource(\n coordinate = (0, 0, 0),\n temperature = 20000., # ion temperature in eV\n fuel = 'DT' # or 'DD'\n)\n```\n\n## Testing\n\nTo run the tests, simply run\n\n```\npytest tests/\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Creates tokamak and ICF plasma sources for OpenMC",
"version": "0.3.1",
"project_urls": {
"Bug Tracker": "https://github.com/fusion-energy/openmc-plasma-source/issues",
"Homepage": "https://github.com/fusion-energy/openmc-plasma-source"
},
"split_keywords": [
"python",
" neutron",
" fusion",
" source",
" openmc",
" energy",
" tokamak"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bd4956852244fb543785755e344892fc5dc034a73acfba94499578f81c25da89",
"md5": "b81d504a5ee16d6ba9b3957fde347b35",
"sha256": "a3ce2ae70649062eafc12078c2562f66f3b859888cb70d55f2d422506ae3268a"
},
"downloads": -1,
"filename": "openmc_plasma_source-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b81d504a5ee16d6ba9b3957fde347b35",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12979,
"upload_time": "2024-04-13T22:39:07",
"upload_time_iso_8601": "2024-04-13T22:39:07.399850Z",
"url": "https://files.pythonhosted.org/packages/bd/49/56852244fb543785755e344892fc5dc034a73acfba94499578f81c25da89/openmc_plasma_source-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "17d9f3cdfb827e6364bc71cf252c597830a28a545aaa7af6e2637283a8edcd81",
"md5": "c335008dc56e4b3f2ae9a9abcd36ea9e",
"sha256": "94d92e8d889a249047aadac0d230c53196cbc1fcf1b01da610ec2c4ce7381bd1"
},
"downloads": -1,
"filename": "openmc_plasma_source-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "c335008dc56e4b3f2ae9a9abcd36ea9e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20970,
"upload_time": "2024-04-13T22:39:08",
"upload_time_iso_8601": "2024-04-13T22:39:08.995600Z",
"url": "https://files.pythonhosted.org/packages/17/d9/f3cdfb827e6364bc71cf252c597830a28a545aaa7af6e2637283a8edcd81/openmc_plasma_source-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-13 22:39:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fusion-energy",
"github_project": "openmc-plasma-source",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"lcname": "openmc-plasma-source"
}