This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from fusion-energy/develop
added pypi uploader
- Loading branch information
Showing
19 changed files
with
2,239 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This yml file will trigger a Github Actions event that builds and upload the | ||
# Python package to PiPy. This makes use of Twine and is triggered when a push | ||
# to the main branch occures. For more information see: | ||
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} # TODO change to token | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
# paramak-neutronics | ||
Adds support for neutronics simulations to the paramak package | ||
|
||
Adds support for neutronics simulations to the paramak package. | ||
|
||
Install with Pip | ||
|
||
```bash | ||
pip install paramak-neutronics | ||
``` | ||
|
||
For examples see the [examples folder](https://github.com/fusion-energy/paramak-neutronics/tree/main/examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This example makes a reactor geometry and a neutronics model. A homogenised material made of enriched lithium lead and eurofer is being used as the blanket material for this simulation in order to demonstrate the use of more complex materials." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import neutronics_material_maker as nmm\n", | ||
"import openmc\n", | ||
"import paramak\n", | ||
"\n", | ||
"# makes the 3d geometry\n", | ||
"my_reactor = paramak.BallReactor(\n", | ||
" inner_bore_radial_thickness=1,\n", | ||
" inboard_tf_leg_radial_thickness=30,\n", | ||
" center_column_shield_radial_thickness=60,\n", | ||
" divertor_radial_thickness=50,\n", | ||
" inner_plasma_gap_radial_thickness=30,\n", | ||
" plasma_radial_thickness=300,\n", | ||
" outer_plasma_gap_radial_thickness=30,\n", | ||
" firstwall_radial_thickness=3,\n", | ||
" blanket_radial_thickness=100,\n", | ||
" blanket_rear_wall_radial_thickness=3,\n", | ||
" elongation=2.75,\n", | ||
" triangularity=0.5,\n", | ||
" number_of_tf_coils=16,\n", | ||
" rotation_angle=359.9, # when using trelis method this can be set to 360\n", | ||
")\n", | ||
"\n", | ||
"# method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", | ||
"# pymoab is used as it is open source and can be tested in the CI\n", | ||
"# if you have Trelis or Cubit then this line can be deleted\n", | ||
"my_reactor.method='pymoab'\n", | ||
"\n", | ||
"# makes a homogenised material for the blanket from lithium lead and\n", | ||
"# eurofer\n", | ||
"blanket_material = nmm.Material.from_mixture(\n", | ||
" fracs=[0.8, 0.2],\n", | ||
" materials=[\n", | ||
" nmm.Material.from_library(\n", | ||
" name='Pb842Li158',\n", | ||
" enrichment=90,\n", | ||
" temperature=500),\n", | ||
" nmm.Material.from_library(name='eurofer')\n", | ||
" ])\n", | ||
"\n", | ||
"source = openmc.Source()\n", | ||
"# sets the location of the source to x=0 y=0 z=0\n", | ||
"source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", | ||
"# sets the direction to isotropic\n", | ||
"source.angle = openmc.stats.Isotropic()\n", | ||
"# sets the energy distribution to 100% 14MeV neutrons\n", | ||
"source.energy = openmc.stats.Discrete([14e6], [1])\n", | ||
"\n", | ||
"# makes the neutronics material\n", | ||
"neutronics_model = paramak.NeutronicsModel(\n", | ||
" geometry=my_reactor,\n", | ||
" source=source,\n", | ||
" materials={\n", | ||
" 'inboard_tf_coils_mat': 'copper',\n", | ||
" 'center_column_shield_mat': 'WC',\n", | ||
" 'divertor_mat': 'eurofer',\n", | ||
" 'firstwall_mat': 'eurofer',\n", | ||
" 'blanket_mat': blanket_material, # use of homogenised material\n", | ||
" 'blanket_rear_wall_mat': 'eurofer'},\n", | ||
" cell_tallies=['TBR'],\n", | ||
" simulation_batches=2,\n", | ||
" simulation_particles_per_batch=10, # this will need increasing to obtain accurate results\n", | ||
")\n", | ||
"\n", | ||
"# starts the neutronics simulation\n", | ||
"neutronics_model.simulate()\n", | ||
"\n", | ||
"# prints the results to screen\n", | ||
"print('TBR', neutronics_model.results['TBR'])" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This is a minimal example that obtains the TBR (Tritium Breeding Ratio) for a parametric ball reactor" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import openmc\n", | ||
"import paramak\n", | ||
"\n", | ||
"\n", | ||
"# makes the 3d geometry from input parameters\n", | ||
"my_reactor = paramak.BallReactor(\n", | ||
" inner_bore_radial_thickness=50,\n", | ||
" inboard_tf_leg_radial_thickness=200,\n", | ||
" center_column_shield_radial_thickness=50,\n", | ||
" divertor_radial_thickness=50,\n", | ||
" inner_plasma_gap_radial_thickness=50,\n", | ||
" plasma_radial_thickness=100,\n", | ||
" outer_plasma_gap_radial_thickness=50,\n", | ||
" firstwall_radial_thickness=1,\n", | ||
" blanket_radial_thickness=100,\n", | ||
" blanket_rear_wall_radial_thickness=10,\n", | ||
" elongation=2,\n", | ||
" triangularity=0.55,\n", | ||
" number_of_tf_coils=16,\n", | ||
" rotation_angle=359.9, # when using trelis method this can be set to 360\n", | ||
")\n", | ||
"\n", | ||
"# method is set to Trelis or Cubit by default to avoid overlaps in the geometry\n", | ||
"# pymoab is used as it is open source and can be tested in the CI\n", | ||
"# if you have Trelis or Cubit then this line can be deleted\n", | ||
"my_reactor.method='pymoab'\n", | ||
"\n", | ||
"source = openmc.Source()\n", | ||
"# sets the location of the source to x=0 y=0 z=0\n", | ||
"source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))\n", | ||
"# sets the direction to isotropic\n", | ||
"source.angle = openmc.stats.Isotropic()\n", | ||
"# sets the energy distribution to 100% 14MeV neutrons\n", | ||
"source.energy = openmc.stats.Discrete([14e6], [1])\n", | ||
"\n", | ||
"# makes the neutronics model from the geometry and material allocations\n", | ||
"neutronics_model = paramak.NeutronicsModel(\n", | ||
" geometry=my_reactor,\n", | ||
" source=source,\n", | ||
" materials={\n", | ||
" 'inboard_tf_coils_mat': 'eurofer',\n", | ||
" 'center_column_shield_mat': 'eurofer',\n", | ||
" 'divertor_mat': 'eurofer',\n", | ||
" 'firstwall_mat': 'eurofer',\n", | ||
" 'blanket_rear_wall_mat': 'eurofer',\n", | ||
" 'blanket_mat': 'Li4SiO4'},\n", | ||
" cell_tallies=['TBR', 'heating'],\n", | ||
" simulation_batches=2,\n", | ||
" simulation_particles_per_batch=10, # this will need increasing to obtain accurate results\n", | ||
")\n", | ||
"\n", | ||
"# simulate the neutronics model\n", | ||
"neutronics_model.simulate()\n", | ||
"print(neutronics_model.results)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.