openmc-dev / openmc_serpent_adapter

Tool for converting Serpent input files to OpenMC classes/XML
MIT License
6 stars 0 forks source link

Support for vessel, cuboid, and trans Surface Types #1

Open sohhae opened 1 month ago

sohhae commented 1 month ago

Hello OpenMC team,

I’ve been working with a Serpent input file, and I’ve come across some surface types that currently aren’t supported by the openmc_serpent_adapter tool. Specifically, I need to use the cuboid and vessel surfaces. These are common surface types in Serpent, and I was wondering if there’s any interest or ongoing effort to include these in the adapter tool?

For reference, here’s the Serpent documentation that defines surface types.

The Serpent input file I'm working with also includes the trans function a lot. I'm wondering if there is any ongoing effort to include this as well?

I’d be happy to contribute to these efforts but would appreciate some guidance on where and how to get started.

Thanks! Soha

paulromano commented 1 month ago

Hey @sohhae! Adding support for cuboid would be very simple since it is equivalent to the openmc.model.RectangularParallelepiped class in OpenMC. If you look at the parse_surf_cards function, you would just need to add another case on the big if/elif/else block.

Support for vessel would be a little more complicated since we don't have a matching composite surface in OpenMC. You would first need to add a new class in openmc/model/surface_composition.py in the main OpenMC repo to match the vessel surface in Serpent. You can take a look at the existing classes in that file to get a sense of what's involved.

As for trans, it depends on which kind of transformation you need. Some are already supported while others are not. You can take a look at the parse_trans_cards function in serpent_conversion.py.

nsedayilmaz commented 1 month ago

Hi @sohhae! We updated openmc_serpent_adapter and added support for cuboid and vessel. The adapter should now work correctly with those surfaces. If you have any other issues with them, please don't hesitate to let me know.

Regarding the trans cards, could you tell me which kind of transformation you need so that I can prioritize them?

sohhae commented 1 month ago

Thanks @nsedayilmaz and @paulromano! Really appreciate your support! I believe the cuboid and vessel implementation is working well, though I'm having issues with the ZConeOneSided.

 File "/Users/sa39262-admin/Documents/modeling/openmc_venv/lib/python3.12/site-packages/openmc_serpent_adapter/serpent_conversion.py", line 387, in parse_surf_cards
    openmc_surfaces[name] = openmc.model.ZConeOneSided(x0, y0, Z0, R, up)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sa39262-admin/Documents/modeling/openmc_venv/lib/python3.12/site-packages/openmc/model/surface_composite.py", line 887, in __init__
    check_greater_than('cone R^2', r2, 0.0)
  File "/Users/sa39262-admin/Documents/modeling/openmc_venv/lib/python3.12/site-packages/openmc/checkvalue.py", line 269, in check_greater_than
    raise ValueError(msg)
ValueError: Unable to set "cone R^2" to "-0.3185059055118106" since it is less than or equal to "0.0"

Regarding the trans cards, I need "U" and "S" implemented.

Thanks again!