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

Proposal to simplify the package #75

Closed
shimwell opened this issue Aug 26, 2021 · 3 comments
Closed

Proposal to simplify the package #75

shimwell opened this issue Aug 26, 2021 · 3 comments

Comments

@shimwell
Copy link
Member

shimwell commented Aug 26, 2021

So I've tracked down the cause of failing errors in #72

Basically we are trying to cram too much functionality into one package and finding conflicts between the packages

To get everything working I'm thinking we need to be more modular.

We can't have situations where cubit and moab are imported into the same python environment. It causes hdf5 conflicts and would be hard for users to resolve.

But the workflow works when the export to stp then convert to h5m and then run openmc are all separate files and are executed separately with python ... but it doesn't work as one big file.

So we could make the package more modular

  1. make a new package called stl_to_h5m that uses moab / pymoab to convert a list of stl files and their material tags into a h5m geometry.

  2. then remove export_h5m_with_pymoab from the paramak and remove moab as a dependency. This means the package can be installed on windows which is a nice bonus

  3. as we already have a package cad_to_h5m which takes a list of stp files and their material tags and makes a h5m file so we can remove the export_to_h5m_with_cubit method

  4. We could then remove the general export_to_h5m method and all the method = cubit or method = pymoab parts scattered in the code.

To make it convenient for users we would still have a neutronics_description that provides all the stp filenames and the material_tags in a dictionary form that cad_to_h5m accepts

So the files would look like this

python make_stp_files.py

import paramak

my_shape = paramak.ExtrudeStraightShape(
    points=[
        (400, 100),
        (400, 200),
        (600, 200),
        (600, 100)
        ],
    distance = 180,
)

my_shape.export_stp('steel.stp')
my_shape.export_graveyard('graveyard.stp')

python convert_stp_files_to_h5m.py

from cad_to_h5m import cad_to_h5m

cad_to_h5m(
    files_with_tags=[
        {'filename':'steel.stp', 'material_tag':'mat1'},
        {'filename':'graveyard.stp', 'material_tag':'graveyard'},
    ],
    h5m_filename='my_dagmc.h5m',
    cubit_path='/opt/Coreform-Cubit-2021.5/bin/'
) 

python build_openmc_model_from_h5m.py

import openmc
import paramak_neutronics


my_source = openmc.Source()
my_source.space = openmc.stats.Point((0, 0, 0))
my_source.angle = openmc.stats.Isotropic()
my_source.energy = openmc.stats.Discrete([14e6], [1])

neutronics_model = paramak_neutronics.NeutronicsModel(
    h5m_filename='my_dagmc.h5m',
    source=my_source,
    materials={
        "mat1": "eurofer",
    },
    cell_tallies=["flux"],
    simulation_batches=5,
    simulation_particles_per_batch=1e4,
)

neutronics_model.simulate()

Any thoughts on this @RemDelaporteMathurin @billingsley-john

@shimwell
Copy link
Member Author

If the moab and cubit hdf5 conflict does get fixed then these separate processes could once again be combined into a single file.

@RemDelaporteMathurin
Copy link
Member

The thing I don't understand is : why would this package conflict occur with GitHub Actions but not with a local environment or with CircleCI?

@shimwell
Copy link
Member Author

Openmc-dagmc-wrapper and dagmc-h5m-inspector packages has been made. Everything is working together as shown in the neutronics_workflow repository

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

No branches or pull requests

2 participants