Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing multimaterial json #136

Merged
merged 16 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ temperature and pressure.

:point_right: [Documentation](https://neutronics-material-maker.readthedocs.io/en/latest/)

:point_right: [Video presentation](https://www.youtube.com/watch?v=V-VHLwRar9s)
:point_right: [Video presentation]()

## Installation

Expand Down Expand Up @@ -106,17 +106,17 @@ my_mat2.openmc_material
```


## Usage - MultiMaterial (Mixed Materials))
## Usage - Material.from_mixture

Materials can also be mixed together using the MultiMaterial class. This
Materials can also be mixed together using the from_mixture method. This
accepts a list of ```neutronics_material_maker.Materials``` or
```openmc.Material``` objects along with the material fractions (fracs).

```python
import neutronics_material_maker as nmm
my_mat1 = nmm.Material('Li4SiO4', packing_fraction=0.64)
my_mat2 = nmm.Material('Be12Ti')
my_mat3 = MultiMaterial(materials=[my_mat1, my_mat2],
my_mat1 = nmm.Material.from_library(name='Li4SiO4', packing_fraction=0.64)
my_mat2 = nmm.Material.from_library(name='Be12Ti')
my_mat3 = nmm.Material.from_mixture(materials=[my_mat1, my_mat2],
fracs=[0.4, 0.6],
percent_type='vo')
my_mat3.openmc_material
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# -- Project information -----------------------------------------------------

project = "NeutronicsMaterialMaker"
copyright = "2020, UKAEA and neutronics-material-maker contributors"
copyright = "2020-2021 neutronics-material-maker contributors"
author = "neutronics-material-maker development team"

# The short X.Y version
Expand Down Expand Up @@ -133,7 +133,7 @@
master_doc,
"NeutronicsMaterialMaker.tex",
"NeutronicsMaterialMaker Documentation",
"John Billingsley",
"Neutronics material maker contributors",
"manual",
)
]
Expand Down
68 changes: 0 additions & 68 deletions docs/source/example_library_usage.rst

This file was deleted.

152 changes: 3 additions & 149 deletions docs/source/example_material.rst
Original file line number Diff line number Diff line change
@@ -1,103 +1,7 @@
Example Material() usage
========================

Usage - basic Material()
------------------------

Here is an example that accesses a material from the internal collection called eurofer which has about 60 isotopes and a density of 7.78g/cm3.

.. code-block:: python

import neutronics_material_maker as nmm

my_mat = nmm.Material('eurofer')

Once the object has been initiated the OpenMC or Serpent material card can be accessed.

.. code-block:: python

my_mat.openmc_material
my_mat.serpent_material

To access MCNP material it is necessary to also provide an id.

.. code-block:: python

my_mat = nmm.Material('eurofer', material_id=1)
my_mat.mcnp_material

To access the Fispact material it is necessary to also provide a volume.

.. code-block:: python

my_mat = nmm.Material('eurofer', volume_in_cm3=10)
my_mat.fispact_material

To access the Shift material it is necessary to also provide a temperature and
a material id

.. code-block:: python

my_mat = nmm.Material('eurofer', temperature=293, material_id=1)
my_mat.shift_material


Usage - hot pressurised Material()
-----------------------------------

For several materials within the collection the temperature and the pressure impacts the density of the material. The neutronics_material_maker adjusts the density to take temperature (in C or K) and the pressure into account when appropriate. Densities are calculated either by a material specific formula (for example `FLiBe <https://github.com/ukaea/neutronics_material_maker/blob/openmc_version/neutronics_material_maker/data/multiplier_and_breeder_materials.json>`_) or using `CoolProps <https://pypi.org/project/CoolProp/>`_ (for example coolants such as H2O).

.. code-block:: python

import neutronics_material_maker as nmm

my_mat1 = nmm.Material('H2O', temperature=300, pressure=15e6)

my_mat1.openmc_material

Temperature can be provided in degrees C or Kelvin.

.. code-block:: python

import neutronics_material_maker as nmm

my_mat1 = nmm.Material('H2O', temperature=573.15, pressure=15e6)

my_mat1.openmc_material

The temperature is automatically sent to the openmc_material and
serpent_material cards. However if this causes difficulties for you (perhaps
due to not having cross sections at that temperature) this automatic propagate
of temperature information can be disabled by setting the
temperature_to_neutronics_code to False.


Usage - enriched Material()
---------------------------

For several materials within the collection the density is adjusted when the material is enriched. For breeder blankets in fusion it is common to enrich the lithium 6 content.

Lithium ceramics used in fusion breeder blankets often contain enriched lithium-6 content. This slight change in density is accounted for by the neutronics_material_maker.

.. code-block:: python

import neutronics_material_maker as nmm

my_mat2 = nmm.Material('Li4SiO4', enrichment=60)

my_mat2.openmc_material


The default enrichment target for 'Li4SiO4' is Li6 but this can be changed if required.

.. code-block:: python

import neutronics_material_maker as nmm

my_mat2 = nmm.Material('Li4SiO4', enrichment_target='Li7', enrichment=40)

my_mat2.openmc_material

While the internal data bases contain

Usage - make a your own materials
---------------------------------
Expand Down Expand Up @@ -154,7 +58,8 @@ Example making materials from isotopes defined by zaid
}
)

It is also possible to make your own materials directly from a dictionary by making use of the python syntax **
It is also possible to make your own materials directly from a dictionary by
making use of the python syntax to exspand a dictionary **

.. code-block:: python

Expand All @@ -172,54 +77,3 @@ It is also possible to make your own materials directly from a dictionary by mak
}

my_mat = nmm.Material(**my_dict)

Usage - adding extra lines to a material card
---------------------------------------------

If you require additional lines at the end of the MCNP, Serpent, Fispact or
Shift materia card then the additional_end_lines argument can be used. This
will add specific line(s) to the end of a material card. Multiple lines can be
added by creating a list with multiple entries.

In this example and additional line can be added to allow the S(α,β) treatment
of water to be correctly modeled in MCNP. But this could also be used to add
comments to the material card or other text at the end of the material card
string.

.. code-block:: python

import neutronics_material_maker as nmm

my_mat2 = nmm.Material(
'H2O',
material_id=24,
temperature=573.15,
pressure=15e6,
additional_end_lines={'mcnp': [' mt24 lwtr.01']}
)

print(my_mat2.mcnp_material)

The above code will return a MCNP material card string with the additional line
' mt24 lwtr.01' at the end. Notice that spaces should also be set by the
user.

.. code-block:: bash

c H2O density 7.25553605e-01 g/cm3
M24 001001 6.66562840e-01
001002 1.03826667e-04
008016 3.32540200e-01
008017 1.26333333e-04
008018 6.66800000e-04
mt24 lwtr.01

It is also possible to specifiy this additional line in a JSON file and
then read in the file and export the material. The additional end lines can
also support different outputs for different codes and multiple lines being
appended to the material card as demonstrated in this video on the feature.

.. raw:: html

<iframe width="560" height="315" src="https://www.youtube.com/embed/YLcMkQGOeJE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Loading