fusion-energy / neutronics_material_maker

A tool for making reproducible materials and standardizing use across several neutronics codes
https://neutronics-material-maker.readthedocs.io
MIT License
18 stars 10 forks source link

CoolProp not imported #27

Open RemDelaporteMathurin opened 2 years ago

RemDelaporteMathurin commented 2 years ago

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

shimwell commented 2 years ago

Might be solved by a modified pip install

Pip install neutronics-material-maker[density]