Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Can't set water #114

Open
RemDelaporteMathurin opened this issue Jun 20, 2022 · 0 comments
Open

Can't set water #114

RemDelaporteMathurin opened this issue Jun 20, 2022 · 0 comments

Comments

@RemDelaporteMathurin
Copy link
Member

On the latest fusion-neutronics-workflow image, running this is not possible:

import openmc_dagmc_wrapper as odw

geometry = odw.Geometry("geometry.h5m")

materials = odw.Materials(
    h5m_filename=geometry.h5m_filename,
    correspondence_dict={"water": "H2O"}
)
Traceback (most recent call last):
  File "/home/fusion-neutronics-workflow/examples/run_neutronics.py", line 8, in <module>
    materials = odw.Materials(
  File "/opt/conda/lib/python3.9/site-packages/openmc_dagmc_wrapper/Materials.py", line 25, in __init__
    self.set_openmc_materials()
  File "/opt/conda/lib/python3.9/site-packages/openmc_dagmc_wrapper/Materials.py", line 41, in set_openmc_materials
    openmc_material = create_material(material_tag, material_entry)
  File "/opt/conda/lib/python3.9/site-packages/openmc_dagmc_wrapper/utils.py", line 10, in create_material
    openmc_material = nmm.Material.from_library(
  File "/opt/conda/lib/python3.9/site-packages/neutronics_material_maker/material.py", line 865, in from_library
    return Material(name=name, **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 758, in _add_density
    from CoolProp.CoolProp import PropsSI
ModuleNotFoundError: No module named 'CoolProp'

after installing CoolProp with

pip install Coolprop

Traceback (most recent call last):
  File "/home/fusion-neutronics-workflow/examples/run_neutronics.py", line 8, in <module>
    materials = odw.Materials(
  File "/opt/conda/lib/python3.9/site-packages/openmc_dagmc_wrapper/Materials.py", line 25, in __init__
    self.set_openmc_materials()
  File "/opt/conda/lib/python3.9/site-packages/openmc_dagmc_wrapper/Materials.py", line 41, in set_openmc_materials
    openmc_material = create_material(material_tag, material_entry)
  File "/opt/conda/lib/python3.9/site-packages/openmc_dagmc_wrapper/utils.py", line 10, in create_material
    openmc_material = nmm.Material.from_library(
  File "/opt/conda/lib/python3.9/site-packages/neutronics_material_maker/material.py", line 865, in from_library
    return Material(name=name, **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

As I understand it, we need to provide a temperature to work out the density.

Problem: with this layout, we can't.

The workaround:

import openmc_dagmc_wrapper as odw
import neutronics_material_maker as nmm

geometry = odw.Geometry("geometry.h5m")

water_material = nmm.Material(
            "H2O",
            density="PropsSI('D', 'T', temperature, 'P', pressure, 'Water')/1000.",
            density_unit="g/cm3",
            percent_type="ao",
            temperature=120 + 273.15,  # K
            pressure=3.3e6,  # Pa
        )

materials = odw.Materials(
    h5m_filename=geometry.h5m_filename,
    correspondence_dict={"water": water_material }
)

Surely that's fine as is, just wondered if this use case could be simplified. Happy with the workaround anyway

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant