Get flux value at a given coordinate

40 views
Skip to first unread message

John Mayers

unread,
Mar 13, 2024, 3:20:21 PM3/13/24
to OpenMOC Users Group
Hello, dear developers and community.

I met with the problem that I don't know how to get flux values at a given point.
I saw a discussion about it and it was said that I have to use Geometry.getFSRId() function. But when I try to use it I get an error. Maybe I'm doing something wrong?

I use it like this:

x, y = 12.5, 12.5
loc_coord = openmoc.LocalCords(x, y)
fsr_id = geometry.getFSRId(loc_corod)

Can anyone explain what I'm doing wrong?

Guillaume Giudicelli

unread,
Mar 13, 2024, 4:18:13 PM3/13/24
to John Mayers, OpenMOC Users Group
Hello

I think there's some geometry initialization that needs to happen before you can use that routine.
Check examples in the repository to see that routine being used

Best,
Guillaume
> --
> You received this message because you are subscribed to the Google Groups "OpenMOC Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openmoc-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/openmoc-users/795b4ecb-56e9-4203-bcf2-0b20796a3d00n%40googlegroups.com.

John Mayers

unread,
Mar 14, 2024, 3:45:04 AM3/14/24
to OpenMOC Users Group
Thank you for your fast response.
Could you tell me what example exactly should i look for?
I can't find any example using this function in sample-inputs and tests folders.

Thank you in advance.

среда, 13 марта 2024 г. в 23:18:13 UTC+3, guillaume....@gmail.com:

Guillaume Giudicelli

unread,
Mar 14, 2024, 10:35:29 AM3/14/24
to John Mayers, OpenMOC Users Group
In the sample-input folder, if you go to the nested-lattices you can see this
```

###############################################################################

# Creating the Geometry

###############################################################################


log.py_printf('NORMAL', 'Creating geometry...')


geometry = openmoc.Geometry()

geometry.setRootUniverse(root_universe)

geometry.initializeFlatSourceRegions()
```

I would say you can only call getFSRId after `geometry.initializeFlatSourceRegions()`

Guillaume
> To view this discussion on the web visit https://groups.google.com/d/msgid/openmoc-users/5dddd40f-b633-4aa3-b2c3-9778770e6c66n%40googlegroups.com.

John Mayers

unread,
Mar 14, 2024, 2:07:33 PM3/14/24
to OpenMOC Users Group
Thank you for your response.
I've already figured out what i'm doing wrong.
The problem was not initialization. I did this after the calculation was done, so the flat source regions were already initialized.
The problem was in the way I tried to create LocalCoords object. 
I'll leave here the instruction for those who will meet the same problem as me.

So, if you want to get the flux value at the given coordinate you should do the following:

xc, yc, zc = (x coordinate you need), (y coordinate you need), (z coordinate you need)
loc_coord = openmoc.LocalCoords(xc, yc, zc)
loc_coord.setUniverse(geometry.getRootUniverse())
loc_coord.setCell(geometry.findCellContainingCoords(loc_coord))
fsr_id = geometry.findFSRId(coords=loc_coord) - 1 // geometry is your openmoc.Geometry class instance

четверг, 14 марта 2024 г. в 17:35:29 UTC+3, guillaume....@gmail.com:

John Mayers

unread,
Mar 19, 2024, 3:02:36 PM3/19/24
to OpenMOC Users Group
Little correction:

fsr_id = geometry.findFSRId(coords=loc_coord) - 1 =>  fsr_id = geometry.findFSRId(coords=loc_coord)
-1 is not required, it was my mistake

четверг, 14 марта 2024 г. в 21:07:33 UTC+3, John Mayers:
Reply all
Reply to author
Forward
0 new messages