Can I use surf_source_write to write neutron going inside a cylinder?

Dear Sir

Can I use surf_source_write to write neutron going inside a cylinder?

Best Regards,
Pu

@pun welcome to the OpenMC community! surf_source_write is used to write particles to a source file at the point where they cross the surface. Let me know if that still doesn’t answer your question.

Dear Paul
Thank you for your reply.

I tried to use surf_source_write to generate surface source crossing the surface ID 2 in a example pincell. However I got error as follow:

Traceback (most recent call last):
File “build_xml.py”, line 72, in
settings.surf_source_write = {‘surfaces_ids’: [2],‘max_particles’: 1000000}
File “/usr/local/lib/python3.8/dist-packages/openmc/settings.py”, line 606, in surf_source_write
cv.check_value(‘surface source writing key’, key,
File “/usr/local/lib/python3.8/dist-packages/openmc/checkvalue.py”, line 190, in check_value
raise ValueError(msg)
ValueError: Unable to set “surface source writing key” to “surfaces_ids” since it is not in “(‘surface_ids’, ‘max_particles’)”

Then, I tried to add <surf_source_write> into setting file to run openmc. In this time, openmc can be run well. There are source particles in the surface source file.
<surf_source_write>
<surface_ids>2</surface_ids>
<max_particles>1000000</max_particles>
</surf_source_write>

However, when I change 2 to -2 in surface id and run openmc, I can not obtain particle in the surface source file.

The first problem is that you should have 'surface_id' as a key in the dictionary, not 'surfaces_id':

settings.surf_source_write = {'surfaces_id': [2], 'max_particles': 1000000}

Currently you can only specify a surface ID, not a specific side of the surface. If you specify surface 2, all particles that pass surface 2 (from either side) will be captured up the the max particles limit.

@paulromano Thank you for your reply. I found my mistake.
I think particles going into cylinder and go out from other side. Thus, there are no particle recording in out file.

I would like to use OpenMC to couple with other code. Therefore, I need to use a surface source with particle direction inside a cylinder or sphere.
Look forward to your update version!!!