GithubHelp home page GithubHelp logo

fusion-energy / neutronics_material_maker Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 11.0 28.95 MB

A tool for making reproducible materials and standardizing use across several neutronics codes

Home Page: https://neutronics-material-maker.readthedocs.io

License: MIT License

Dockerfile 0.43% Python 99.53% Shell 0.04%
neutrons material library database openmc mcnp serpent fispact

neutronics_material_maker's People

Contributors

ai-pranto avatar allentro avatar asaigiri avatar billingsley-john avatar coronelbuendia avatar daleher avatar danshort12 avatar generein avatar jbae11 avatar katie-taylor avatar py1sl avatar repositony avatar rossworrall avatar rworrall-ukaea avatar shimwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

neutronics_material_maker's Issues

Print statement in `add_additional_end_lines()`

The print statement in the additional end lines function of Utils.py could be removed as it often just prints None to the terminal.

def add_additional_end_lines(code: str, mat) -> list:
    """
    Accertains if additional lines were requested by the user for the code used
    and if so returns the additional lines request as a list to be added to the
    end of the existing material card list.
    """
    print(mat.additional_end_lines)
    if mat.additional_end_lines is not None:
        if code in list(mat.additional_end_lines.keys()):
            return mat.additional_end_lines[code]
    return []

For example this will spam the terminal with None

for k in list(nmm.AvailableMaterials().keys())[:20]:
    mat = nmm.Material.from_library(name=k, material_id=1)
    string = mat.mcnp_material
    # do something with it...

CoolProp not imported

With NMM 1.1.1, running this produces a ModuleNotFoundError.

I suppose it's somehow related to #26

import neutronics_material_maker as nmm

entry = {
    "chemical_equation": "H2O",
    "density": "PropsSI('D', 'T', temperature, 'P', pressure, 'Water')/1000.",
    "density_unit": "g/cm3",
    "comment": "CoolProp python package",
    "percent_type": "ao",
    "material_id": None,
}
nmm.Material(name="H2O", **entry)

running pip install CoolProp seems to fix it.

But then, I have the following error:

  File "/home/fusion-neutronics-workflow/MWE.py", line 11, in <module>
    nmm.Material(name="H2O", **entry)
  File "/opt/conda/lib/python3.9/site-packages/neutronics_material_maker/material.py", line 199, in __init__
    self._make_openmc_material()
  File "/opt/conda/lib/python3.9/site-packages/neutronics_material_maker/material.py", line 645, in _make_openmc_material
    openmc_material = self._add_density(openmc_material)
  File "/opt/conda/lib/python3.9/site-packages/neutronics_material_maker/material.py", line 768, in _add_density
    raise ValueError(
ValueError: Material.temperature is needed to calculate the density

I suppose that's normal though

packing fraction usage

This value is mutliplied by the density which allows packing_fraction to be taken into account for materials involving an amount of void. Recall that packing_fraction is equal to 1/void fraction

The documentation gives this statement for the packing_fraction parameter but it does not agree with the usage/output.
if I have 10 % void in a material 1/10 = 0.1 and the material density is multiplied by this to be an order of magnitude lower not 90% of the density which is the intention. Using a number greater than 1 gives an error.
Should the correct definition not be packing_fraction = 1 - void fraction

Also when using with material.from_mixture if the fractions of the materials do not add to 1 there is a warning, but not if packing_fraction is also used, the resulting density is adjusted for both the remaining fraction and the packing fraction. I believe the warning should be still displayed.

temperature units

in the Material.from_library docs it states

Temperature can be provided in degrees C or Kelvin.

I cannot see how/where the units are specified, there is no equivalent to density_unit.

coolprops for python 3.9

It looks like the conda install -c conda-forge for coolprop is working for python 3.9, perhaps it can be added as a full dependency again
Todo, see if pip works

Density calculation for multipliers and breeders

The properties of some multipliers and breeders here is defined as temperature dependent, e.g. FLiBe:
"density": "2.214 - 4.2e-4 * (temperature + 273.15)",

However, given that the temperature is defined in Kelvin (and seemingly never converted to Celsius in the Material class), I believe these formulas should read (temperature - 273.15) if they are dependencies in Celsius. I can put a PR together if this is confirmed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.