I want to write my own Monte Carlo code for Neutron transport

In summary, the code you seek is likely available as a library or as an easy methodology somewhere, but it may require some more complex modeling before it can be used effectively.
  • #1
7
5
Hi, i would like to write my own MC code in order to simulate the transport of Neutrons in Nuclear reactors. I know the basics of MC and i have already written a code for homogeneus reactors, my problem is the generalization to more complex geometries made of different materials, such as fuel rods and lattices.

So my question is: there exists some libraries (in Matlab or Python environments possibly) or "easy" methodologies to define different regions in the reactor? To be more precise, how can i effectively tell the neutron in which region of the reactor it is and so which nuclide is it colliding with?

My hope is to find some pre-existing functions devoted to the geometry realization (cylinders or other simple shapes) that provide me some sort of "region label" that i can use for the identification of the appropriate cross section.

Any suggestion is really appreciated.
 
Engineering news on Phys.org
  • #2
Many years ago (I'm long since retired) my work involved problem you described. The main issue is finding 3 dimensional modeling codes. MCNP https://mcnp.lanl.gov/ seems to be widely used.
 
  • Like
Likes jim mcnamara
  • #3
You can search the Physics Forums (and of course, you can go to google) for Monte Carlo code and find numerous examples.
 
  • #4
A reactor is a pretty complicated piece of geometry, and neutrons are notoriously energy dependent in their ineractiions. Perhaps a less complicated interrim problem would be useful. I don't know enough Matlab or Python stuff to suggest a good one.

You should describe your previous achievements in this modeling.
 
  • #5
This is wildly good by Forrest Brown. https://mcnp.lanl.gov/pdf_files/la-ur-16-29043.pdf

As for the location stuff, you need more than location ID, you need distance to the next cell boundary. So in effect a ray tracer. You might be better starting with a 2D model with limited depth and square rod cross sections. When you move to 3D you'll need a set of equations for every shape.
 
  • #6
Thank you all for your replies,

mathman said:
Many years ago (I'm long since retired) my work involved problem you described. The main issue is finding 3 dimensional modeling codes. MCNP https://mcnp.lanl.gov/ seems to be widely used.
Thank you, i heard about MCNP but i don't have a licence. However I have some experience with a similar code named Serpent. But my goal is to write my own.

sysprog said:
You can search the Physics Forums (and of course, you can go to google) for Monte Carlo code and find numerous examples.
I tried to do so but unfortunately i wasn't able to find anything useful about this specific topic.

hutchphd said:
A reactor is a pretty complicated piece of geometry, and neutrons are notoriously energy dependent in their ineractiions. Perhaps a less complicated interrim problem would be useful. I don't know enough Matlab or Python stuff to suggest a good one.

You should describe your previous achievements in this modeling.
Yes, indeed it is quite complicated but i would be happy also with simpler geometries, however my code should be as general as possible. Up to now i succeeded in 3D homogeneus core and in 1D multi region slab but in these situations is easy to identify in which region of the geometry neutrons are colliding. For the slab, for example, i just need to see in which interval neutron coordinate is: x_i < x < x_{i+1}.

Alex A said:
This is wildly good by Forrest Brown. https://mcnp.lanl.gov/pdf_files/la-ur-16-29043.pdf

As for the location stuff, you need more than location ID, you need distance to the next cell boundary. So in effect a ray tracer. You might be better starting with a 2D model with limited depth and square rod cross sections. When you move to 3D you'll need a set of equations for every shape.
Thank you for the document, it seems to be very interesting. Probably you are right, i should start with a simpler model. But even in 2D with square objects i need some functions which provide me the region ID (and for the geometry creation). Did you think that i should write these functions by my own or i can exploit some pre-existing code?
For what concern ray tracing I'm planning to use Delta-tracking method, doing so i don't need to re-sample neutron path when it cross a surface.
 
  • #7
I had not heard of Woodcock delta-tracking. It may take a while to sink in.

For rods you can specify using if then statements for x and y. A lattice of rods is then also fairly easy. Since all surfaces are at 90 degrees to every other surface geometry math is simpler too.

https://github.com/openmc-dev/openmc/
If you are searching for a code to read try this one. Older versions were written in FORTRAN and had MCNP like problem entry. Now things are in C++ and Python, and Python is the method for problem entry. Either way it's a proper neutronics code in 3D.
 
  • Like
Likes mark_bose
  • #8
I'm not aware of any general libraries that are available. If you want some examples, you could start looking in the source code for Serpent or OpenMC. Geometry processing is fairly complicated, and the more geometry types you support, the more complicated it becomes.

As you are probably aware from working with Serpent, the "standard" way of representing geometry in Monte Carlo codes is combinatorial geometry where you have a set of surfaces and you define volumes using the surfaces.

My suggestion is to start simple. For example, start out by supporting planes and spheres. Start with a sphere in a box with reflective boundary conditions. In this case you have 7 different surfaces (6 planes and the sphere). You have a particle at a point in space with a certain direction. The particle is in one of two volumes - inside the sphere or outside the sphere. You should calculate the distance from the point in space to each surface along the direction of travel. This takes quite a bit of geometry calculations, but you can use Google to find formulas for the distance to different surfaces. You build up a list of distances, and then find the minimum distance to find the nearest surface (the particle may not intersect all of the surfaces). After this, move the particle. It may or may not reach the surface. If it goes past the surface, you need find the next voluime, and then start your search over again. Once it leaves the surface, you also have to find out what the new volume is.

Once you have this working, you can add additional geometries. Add additional spheres, cylinders, etc. Make sure to test each step thoroughly before adding the next one.

The real trick is to make this work efficiently. As you probably figured out, as your problem gets larger, it will get harder to find what volume the particle is currently in. You can start to build up internal lists of what volumes are next to each other.

Another good place to look is in video game design. Modern video games do a lot of "ray tracing" and they've come up with some very good algorithms to find the distance to surfaces and search methods.

I hope this helps. Good luck!
 
  • Like
  • Informative
Likes Alex A, hutchphd, sysprog and 3 others
  • #9
My question is why? I am not a reactor physicist, but I would check to see if something is available for free that you could use instead of trying to reinvent the wheel. As @rpp suggests. For example, Open MC seems like a good place to start.
 
  • Like
Likes sysprog
  • #10
Thank you all for the suggestions. Probably i will start with the simplifications you suggest. It seems that "Theory and Methodology" chapter in OpenMC manual could be useful.
 
  • Like
Likes berkeman, hutchphd and sysprog
  • #11
If you want to play with something yourself, then you need multiblock mesh support. In python, you could work with pyvista and use paraview multiblock meshes to set up something. This also makes it easy to generate cell averaged means and visualize your results with pyvista

https://docs.pyvista.org/
 
  • Like
Likes mark_bose
  • #12
There is a Russian code named Mcu with a shitton of functions. I can share it for you but documentation is in Russian. Write me in PM if you are interested.
 
  • Love
Likes DAntanov

1. What is Monte Carlo code for Neutron transport?

Monte Carlo code for Neutron transport is a computational method used to simulate the behavior of neutrons in a given system. It involves generating random numbers to model the probability of neutron interactions and tracking their paths through the system.

2. Why would someone want to write their own Monte Carlo code for Neutron transport?

Writing your own Monte Carlo code for Neutron transport allows for customization and flexibility in the simulation. It also provides a deeper understanding of the underlying physics and mathematical principles involved.

3. What are the key components of a Monte Carlo code for Neutron transport?

The key components of a Monte Carlo code for Neutron transport include the geometry of the system, the nuclear data used for neutron interactions, and the algorithms for generating random numbers and tracking neutron paths.

4. What are the challenges of writing a Monte Carlo code for Neutron transport?

Writing a Monte Carlo code for Neutron transport can be challenging due to the complexity of the underlying physics, the need for accurate and extensive nuclear data, and the computational resources required for large-scale simulations.

5. How can one validate their Monte Carlo code for Neutron transport?

To validate a Monte Carlo code for Neutron transport, one can compare the results with experimental data or benchmark calculations. It is also important to perform sensitivity analyses and convergence studies to ensure the accuracy and reliability of the code.

Suggested for: I want to write my own Monte Carlo code for Neutron transport

Back
Top