# Need help to model the same problem in OpenMC

**URL:** <https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161>\
**Category:** User Support\
**Created:** [January 20, 2025, 1:39pm UTC](https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161 "2025-01-20T13:39:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Habib01](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@Habib01](https://openmc.discourse.group/u/Habib01)\
**Post date:** [January 20, 2025, 1:39pm UTC](https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161/1 "2025-01-20T13:39:08Z")

</div>

Hi, I am new to use OpenMC, and want to learn by example, I have the problem modeled in Serpent and want to model the same with OpenMC, please write the OpenMC version of the given input file

Serpent version:  
set title “cylMCFR radius 19.0, height 100.0, reflector 25.0”  
% **surface definitions** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
surf 1 cylz 0.0 0.0 19.0 % fuel  
surf 2 cylz 0.0 0.0 44.0 % reflector

% **cell definitions** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
cell 30 re refl 1 -2 % radial reflector  
cell 80 0 fill re 1 -2  
cell 50 fs fuelsalt -1 % fuel salt  
cell 85 0 fill fs -1  
cell 99 0 outside 2

% Fuel salt: 66.66%NaCl + 33.34%UCl3, U enrichment 0.93  
mat fuelsalt -3.16391796 rgb 240 30 30 burn 1 tmp 900.000  
11023.09c -0.100274788825 % Na-23  
17035.09c -0.289847995589 % Cl-35  
17037.09c -0.096758222661 % Cl-37  
92234.09c -0.004225929437 % U-234  
92235.09c -0.476858378996 % U-235  
92236.09c -0.002202896269 % U-236  
92238.09c -0.029831788223 % U-238

% MgO reflector  
mat refl -3.5 tmp 873.0 rgb 75 75 75  
12024.06c 1.0  
8016.06c 1.0

set mvol fuelsalt 0 226822.98958918

set pop 100000 240 40 % N pop and criticality cycles  
set power 300000.0 % Power, 300 thermal kW  
set bc 1 % vacuum

ene six\_group 1 1E-11 7.485E-4 5.5308E-3 2.47875E-2 0.4979 2.2313 12  
set gcu re fs % group constant generation in unis fs and re  
set nfg six\_group  
set micro nj20

det default n  
dn 1  
0 44 25 % 25 radial bins, 0 to 44  
0 360 1 % 1 angual bin, 0 to 360 deg  
-25 125 75 % 75 axial bin, -25 to 125  
de six\_group

% Data Libraries  
set acelib “/opt/JEFF-3.3/sss\_jeff33.xsdir”  
set declib “/opt/JEFF-3.3/jeff33.dec”  
set nfylib “/opt/JEFF-3.3/jeff33.nfy”

% Plots  
plot 3 1500 1500  
plot 2 1500 1500

---

<div class="post-metadata">

**Author:** ![khurrum](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@khurrum](https://openmc.discourse.group/u/khurrum)\
**Post date:** [January 20, 2025, 2:33pm UTC](https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161/2 "2025-01-20T14:33:41Z")

</div>

One simple option is to use serpent openmc convertor.

> **[GitHub - openmc-dev/openmc\_serpent\_adapter: Tool for converting Serpent input files to OpenMC...](https://github.com/openmc-dev/openmc_serpent_adapter)**
>
> Tool for converting Serpent input files to OpenMC classes/XML

---

<div class="post-metadata">

**Author:** ![wahidluthfi](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/wahidluthfi/32/3375_2.png) [@wahidluthfi](https://openmc.discourse.group/u/wahidluthfi)\
**Post date:** [January 20, 2025, 11:39pm UTC](https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161/3 "2025-01-20T23:39:13Z")

</div>

Hi Habib, welcome to the openmc community.  
You could try the serpent adapter mentioned by Khurrum since I think the serpent geometry you want to model is still a simple model with cylz surfaces. But if the geometry becomes complicated, I recommend you build your geometry manually from the surface to the cell and universe based on your serpent model. That way you can avoid geometry errors.

---

<div class="post-metadata">

**Author:** ![Habib01](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@Habib01](https://openmc.discourse.group/u/Habib01)\
**Post date:** [January 21, 2025, 3:55am UTC](https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161/4 "2025-01-21T03:55:29Z")

</div>

The converter currently only handles geometry and material information, while i have model the same problem for simple criticality calculations but the problem is that i got very high relative errer of (817.22 pcm) keff\_serpent = 1.09934, keff\_openmc = 1.090356, i want to please check my input file and correctme if there are some mistakes

OpenMC Input File:

import numpy as np  
import matplotlib.pyplot as plt  
from PIL import Image # For image conversion  
import openmc

# Step 1: Define geometry dimensions

fuel\_radius = 19.0 # Fuel radius in cm  
reflector\_thickness = 25.0 # Reflector thickness in cm  
total\_radius = 44.0  
height = 100.0

# Step 2: Define materials

# Fuel Salt Material (NaCl-UCl3 mixture)

fuel = openmc.Material(name=‘Fuel Salt’)  
fuel.add\_element(‘Na’, 0.100274788825, percent\_type=‘wo’)  
fuel.add\_nuclide(‘Cl35’, 0.289847995589, percent\_type=‘wo’)  
fuel.add\_nuclide(‘Cl37’, 0.096758222661, percent\_type=‘wo’)  
fuel.add\_nuclide(‘U234’, 0.004225929437, percent\_type=‘wo’)  
fuel.add\_nuclide(‘U235’, 0.476858378996, percent\_type=‘wo’)  
fuel.add\_nuclide(‘U236’, 0.002202896269, percent\_type=‘wo’)  
fuel.add\_nuclide(‘U238’, 0.029831788223, percent\_type=‘wo’)  
fuel.set\_density(‘g/cm3’, 3.16391796)  
fuel.temperature = 900 # Set current temperature

# Reflector Material (Magnesium Oxide)

reflector = openmc.Material(name=‘Magnesium Oxide’)  
reflector.add\_element(‘Mg’, 1.0) # Magnesium  
reflector.add\_element(‘O’, 1.0) # Oxygen  
reflector.set\_density(‘g/cm3’, 3.5)  
reflector.temperature = 873.0 # Set current temperature

# Step 3: Create a materials collection and export to XML

materials = openmc.Materials([fuel, reflector])  
materials.export\_to\_xml()

# Step 3: Define geometry

# Fuel cylinder (infinite along z-axis)

fuel\_cylinder = openmc.ZCylinder(r=fuel\_radius)

# Reflector cylinder (infinite along z-axis)

reflector\_cylinder = openmc.ZCylinder(r=total\_radius, boundary\_type=‘vacuum’)

# Define planes for z-boundaries

bottom\_plane = openmc.ZPlane(z0=-0.5 \* height, boundary\_type=‘reflective’)  
top\_plane = openmc.ZPlane(z0=0.5 \* height, boundary\_type=‘reflective’)

# Define regions

fuel\_region = -fuel\_cylinder & +bottom\_plane & -top\_plane # Inside the fuel cylinder  
reflector\_region = +fuel\_cylinder & -reflector\_cylinder & +bottom\_plane & -top\_plane # Between fuel and reflector cylinders

# Assign materials to regions

fuel\_cell = openmc.Cell(region=fuel\_region, fill=fuel)  
reflector\_cell = openmc.Cell(region=reflector\_region, fill=reflector)

# Create a universe

root\_universe = openmc.Universe(cells=[fuel\_cell, reflector\_cell])

# Step 4: Export geometry

geometry = openmc.Geometry(root\_universe)  
geometry.export\_to\_xml()

# Step 5: Define settings

settings = openmc.Settings()  
settings.particles = 100000  
settings.batches = 240  
settings.inactive = 40  
settings.output = {‘tallies’: True}

# Define the bounds for the uniform source distribution

bounds = [-44, -44, -50, 44, 44, 50]  
uniform\_dist = openmc.stats.Box(bounds[:3], bounds[3:], only\_fissionable=True)  
settings.source = openmc.Source(space=uniform\_dist)  
settings.trigger\_active = True  
settings.trigger\_max\_batches = settings.batches \* 4  
settings.temperature = {‘method’: ‘interpolation’, ‘multipole’: True}  
settings.export\_to\_xml()

# Step 6: Run simulation

openmc.run()

---

<div class="post-metadata">

**Author:** ![wahidluthfi](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/wahidluthfi/32/3375_2.png) [@wahidluthfi](https://openmc.discourse.group/u/wahidluthfi)\
**Post date:** [January 21, 2025, 10:33am UTC](https://openmc.discourse.group/t/need-help-to-model-the-same-problem-in-openmc/5161/5 "2025-01-21T10:33:22Z")

</div>

Have you tried to run using the same JEFF-3.3 nuclear data library?  
I ran your input with ENDF VII.1 and I got k-eff 1.090xx, and sorry I didn’t try to run it with the JEFF 3.3 lib even though we can download it from [Other Data Libraries | OpenMC](https://openmc.org/other-data-libraries/).  
I think your openmc model is consistent even though you use 100 cm height reflective BC, but I have tried to run without it and it was still around 1.090. I also checked my endf lib, and I didn’t find any s(alpha,beta) for MgO.

I hope other members can give their recommendations on this code-to-code case.
