# Must all universes share the same origin?

**URL:** <https://openmc.discourse.group/t/must-all-universes-share-the-same-origin/3618>\
**Category:** User Support\
**Created:** [November 10, 2023, 11:22am UTC](https://openmc.discourse.group/t/must-all-universes-share-the-same-origin/3618 "2023-11-10T11:22:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![emilio.castro](https://avatars.discourse-cdn.com/v4/letter/e/b38774/32.png) [@emilio.castro](https://openmc.discourse.group/u/emilio.castro)\
**Post date:** [November 10, 2023, 11:22am UTC](https://openmc.discourse.group/t/must-all-universes-share-the-same-origin/3618/1 "2023-11-10T11:22:16Z")

</div>

Hello.

I am trying to place an universe (consisting on a cylinder) inside a cell to place it in my problem universe at a different axial location.

First, I define my isolated cylinder as follows, between z= -1.02555 and 1.02555, and it works:

```python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 9 10:45:00 2023

@author: ecasglez
"""

import openmc

####################
# Define materials #
####################

mat_1 = openmc.Material()
mat_1.add_element('U', 1.0)
mat_1.set_density('g/cm3', 10)
mat_1.temperature = 293.15

mat_2 = openmc.Material()
mat_2.add_element('Zr', 1.0)
mat_2.set_density('g/cm3', 6)
mat_2.temperature = 293.15

mats = openmc.Materials([mat_1, mat_2])
mats.export_to_xml()

###################
# Define geometry #
###################

case_A_cyl_in = openmc.ZCylinder(r=7.5050)
case_A_cyl_out = openmc.ZCylinder(r=7.5438, boundary_type = 'reflective')
case_A_z_in_top = openmc.ZPlane(1.00455)
case_A_z_in_bottom = openmc.ZPlane(-1.00455)
case_A_z_out_top = openmc.ZPlane(1.02555, boundary_type = 'reflective')
case_A_z_out_bottom = openmc.ZPlane(-1.02555, boundary_type = 'reflective')

case_A_in = openmc.Cell()
case_A_in.fill = mat_1
case_A_in.region = -case_A_cyl_in & -case_A_z_in_top & +case_A_z_in_bottom

case_A_out = openmc.Cell()
case_A_out.fill = mat_2
case_A_out.region = -case_A_cyl_out & +case_A_z_out_bottom & -case_A_z_out_top & ~ case_A_in.region

case_A_u = openmc.Universe(cells=[case_A_in, case_A_out])

geom = openmc.Geometry(root = case_A_u)
geom.export_to_xml()

#####################
# Source Definition #        
#####################

point = openmc.stats.Point((0, 0, 0))   
src = openmc.Source(space=point)

############
# Settings #
############

settings = openmc.Settings()
settings.source = src 
settings.batches = 100
settings.inactive = 20
settings.particles = 1000
settings.export_to_xml()

#######
# Run #
#######

openmc.run()

```

Now, I want to put this cylinder inside another cylinder taller that the previous one but with the same diameter. I put it in a cell with the same height of my original cylinder but using a different origin of coordinates. So the first cylinder is defined between z = -1.02555 and 1.02555, and placed then in the problem universe between Z = 0, 1.02555 \* 2, as follows:

```python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 9 10:45:00 2023

@author: ecasglez
"""

import openmc

####################
# Define materials #
####################

mat_1 = openmc.Material()
mat_1.add_element('U', 1.0)
mat_1.set_density('g/cm3', 10)
mat_1.temperature = 293.15

mat_2 = openmc.Material()
mat_2.add_element('Zr', 1.0)
mat_2.set_density('g/cm3', 6)
mat_2.temperature = 293.15

mat_3 = openmc.Material()
mat_3.add_element('H', 1.0)
mat_3.set_density('g/cm3', 1.0)
mat_3.temperature = 293.15

mats = openmc.Materials([mat_1, mat_2, mat_3])
mats.export_to_xml()

###################
# Define geometry #
###################

case_A_cyl_in = openmc.ZCylinder(r=7.5050)
case_A_cyl_out = openmc.ZCylinder(r=7.5438)
case_A_z_in_top = openmc.ZPlane(1.00455)
case_A_z_in_bottom = openmc.ZPlane(-1.00455)
case_A_z_out_top = openmc.ZPlane(1.02555)
case_A_z_out_bottom = openmc.ZPlane(-1.02555)

case_A_in = openmc.Cell()
case_A_in.fill = mat_1
case_A_in.region = -case_A_cyl_in & -case_A_z_in_top & +case_A_z_in_bottom

case_A_out = openmc.Cell()
case_A_out.fill = mat_2
case_A_out.region = -case_A_cyl_out & +case_A_z_out_bottom & -case_A_z_out_top & ~ case_A_in.region

case_A_u = openmc.Universe(cells=[case_A_in, case_A_out])

##################################################################
# Place case_A_u in my problem universe at different coordinates #
##################################################################
#My problem consists of a taller cylinder with the same diameter 
#and the previous case_A_u is placed there at some axial position

problem_cyl_out = openmc.ZCylinder(r=7.5438, boundary_type = 'reflective')
height_case_A = 1.02555 * 2
problem_z_case_A_top = openmc.ZPlane(height_case_A)
problem_z_case_A_bottom = openmc.ZPlane(0)
problem_z_top = openmc.ZPlane(10, boundary_type = 'reflective')
problem_z_bottom = openmc.ZPlane(-10, boundary_type = 'reflective')

problem_cell_1 = openmc.Cell()
problem_cell_1.fill = case_A_u
problem_cell_1.region = -problem_cyl_out & +problem_z_case_A_bottom & -problem_z_case_A_top

problem_cell_2 = openmc.Cell()
problem_cell_2.fill = mat_3
problem_cell_2.region = -problem_cyl_out & +problem_z_bottom & -problem_z_top & ~ problem_cell_1.region

problem_universe = openmc.Universe(cells=[problem_cell_1, problem_cell_2])

geom = openmc.Geometry(root = problem_universe, surface_precision = 6)
geom.export_to_xml()

#####################
# Source Definition #        
#####################

point = openmc.stats.Point((0, 0, 1))
src = openmc.Source(space=point)

############
# Settings #
############

settings = openmc.Settings()
settings.source = src 
settings.batches = 100
settings.inactive = 20
settings.particles = 1000
settings.export_to_xml()

#######
# Run #
#######

openmc.run()

```

So the first cylinder is defined between z = -1.02555 and 1.02555. The cell in the second universe to include this first cylinder is between 0 and 2\*1.02555. If I run openmc I get this

```plaintext
 WARNING: After particle 13 crossed surface 5 it could not be located in any
          cell and it did not leak.
 ERROR: Maximum number of lost particles has been reached.

```

When running openmc-plotter I get this, where the black color means that it has not been filled with any material. This makes me think that all universes must share the same origin.

 ![imagen](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/7/7c0bd87b8883da11662d458c78c9703a23e25c79.png)

Is it required that the origin of coordinates is the same for both universes? That is, do I need to define the first cylinder Z planes related to the main problem universe? If this is the problem, is there a way to define the pieces of the problem individually, to add them later to the problem universe for a case like this where I will change the axial location several times? I can do it by calculating the values using Python, but I wonder if there is an OpenMC way.
