milongaa free nuclear reactor core analysis code  
milongamilonga is a free computational tool specifically designed to aid a cognizant expert—i.e. you, whether an engineer, scientist, technician, geek, etc—to analyze fission nuclear reactor cores by solving the multigroup neutron diffusion equation over unstructured meshes. Technically speaking, it is a plugin for the computational tool wasora, which provides means to parse and understand a highlevel plaintext input file containing algebraic expressions, data for function interpolation, differential equations and output instructions amongst other facilities. Therefore, any mathematical computation which can be done by wasora—i.e. parametric calculations, multidimensional optimization, function interpolation and integration, etc.—can be combined with the facilities that milonga provides to solve the neutron diffusion equation.
milonga was designed by a guy who
Last modification: Thu, 20 Mar 2014 23:02:58 0400. downloadEven though milonga is a plugin for the wasora code, the package distribution contains also the source of the wasora code, and both the dynamic milonga plugin and a standalone executable are generated. Therefore, milonga can be used as an independent code containing all the basic wasora features and, at the same time, able to load other wasora plugins to further extend its capabilities. The recommended way to get milonga is to download the latest (0.2.20) source tarball and compile milonga from scratch. However, libraries may be tricky to get running so binary versions are also provided:
However, the available version may not contain all the desired features and a manual installation from the source distribution of the libraries may be needed. If in trouble with the required libraries, do not hesitate to ask for help at the mailing list. Note that the decision of using external libraries to implement the actual numerical methods was thoroughly thought by the author and included in the design basis of the code. Any extra work needed to set up the libraries is well overpaid by the entailed benefits. To solve problems it is also needed the free mesh generator gmsh, which can also be installed from the repositories:
Other nonstandard libraries such as SUNDIALS or Readline are optional. See both the projects wasora and milonga relies on. bazaar repositoryIf you plan to contribute to milonga, modify its sources or just want to get updated versions easily, you will need to branch the development tree of milonga, which is hosted at Launchpad using bazaar as a control revision tool. The milonga tree can be browsed online or branched into a local copy withIf you use bzr to get the development version, you will need automake, autoconf, libtool and GNU m4. See details in the README.dev.txt file. Regular users just downloading the tarballs listed above will not need such advanced tools. Feel free to ask whatever question you may have in the mailing list. quickstartAlthought the recommended way to go is to compile the source code, first try to download a binary tarball for your architecture. If you cannot get the executable to work, try downloading the source tarball and uncompress: Then, set the PETSC_DIR, PETSC_ARCH and SLEPC_DIR environment variables. If using the Debian/Ubuntu repository packages, this step reads: Other configurations may need other values for the environment variables. Finally, configure, make, check & install: If the make step fails with errors about libtool, set the SHELL variable to /bin/bash: After this step, both a shared object called milonga.so and an executable named milonga should be installed systemwide. The former should be loaded from wasora either with the p option in the command line or by means of the LOAD_PLUGIN keyword in the input file. The latter is a binary executable that is ready to be run. See the documentation for detailed installation instructions. an homogeneous bare slab reactorUse the following input—which is very simple, following the design basis criterion that simple problems ought to have simple inputs—to solve a onedimensional bare reactor with homogeneous cross sections:MESH FILE_PATH slab.msh DIMENSIONS 1 DEGREES 1
SCHEME ELEMENTS
MATERIAL fuel D 1 nuSigmaF 2e3 SigmaA 1e3
MILONGA_SOLVE
PRINT TEXT "\# keff = " keff
PRINT TEXT "\# x\t\t phi"
PRINT_FUNCTION phi_1
The mesh geometry is given in the mesh file slab.msh: $MeshFormat 2.2 0 8 $EndMeshFormat $PhysicalNames 3 0 1 "left" 0 2 "right" 1 3 "fuel" $EndPhysicalNames $Nodes 11 1 0 0 0 2 100 0 0 3 10 0 0 4 20 0 0 5 30 0 0 6 40 0 0 7 50 0 0 8 60 0 0 9 70 0 0 10 80 0 0 11 90 0 0 $EndNodes $Elements 12 1 15 2 1 1 1 2 15 2 2 2 2 3 1 2 3 1 1 3 4 1 2 3 1 3 4 5 1 2 3 1 4 5 6 1 2 3 1 5 6 7 1 2 3 1 6 7 8 1 2 3 1 7 8 9 1 2 3 1 8 9 10 1 2 3 1 9 10 11 1 2 3 1 10 11 12 1 2 3 1 11 2 $EndElements which was generated by the program gmsh using the geometry file slab.geo: lc = 10; Point(1) = {0, 0, 0, lc}; Point(2) = {100, 0, 0, lc}; Line(1) = {1, 2}; Physical Point("left") = {1}; Physical Point("right") = {2}; Physical Line("fuel") = {1}; The numerical scheme—i.e ether finite volumes or finite elements—can be chosen either using the SCHEME keyword in the input or from the commandline with element or volumes. The commandline has precedence over the input, as illustrated below:
the 2D IAEA PWR BenchmarkFind the effective multiplication factor k_{eff}, the thermal and fast flux distribution and the power density distribution of the 1976 twodimensional IAEA PWR Benchmark problem:
# BENCHMARK PROBLEM
#
# Identification: 11A2 Source Situation ID.11
# Date Submitted: June 1976 By: R. R. Lee (CE)
# D. A. Menely (Ontario Hydro)
# B. Micheelsen (RisoDenmark)
# D. R. Vondy (ORNL)
# M. R. Wagner (KWU)
# W. Werner (GRSMunich)
#
# Date Accepted: June 1977 By: H. L. Dodds, Jr. (U. of Tenn.)
# M. V. Gregory (SRL)
#
# Descriptive Title: Twodimensional LWR Problem,
# also 2D IAEA Benchmark Problem
#
# Reduction of Source Situation
# 1. Twogroupo diffusion theory
# 2. Twodimensional (x,y)geometry
#
# 8< milonga's solution begins here 8<
# this input file quickly solves the benchmark problem
# only the keff and the flux and power distribution are computed
# search online for either
#  The milonga Real Book
#  Unstructured Grids and the Multrigroup Neutron Difussion Equation
#  Difusion de neutrones en mallas no estructuradas: comparacion
entre volumenes y elementos finitos
# for a complete solution to the problem.
# the characteristic length of the mesh is read from the commandline
lc = $1
TEMPLATE benchmark.tpl benchmark.geo lc
# call gmsh with the generated geometry file
SHELL "gmsh 2 v 0 benchmark.geo"
# read the twodimensional twodegreesoffreedom mesh
MESH DIMENSIONS 2 DEGREES 2 FILE_PATH benchmark.msh
# define materials and cross sections according to the twogroup constants
# each material corresponds to a physical entity in the geometry file
Bg2 = 0.8e4 # axial geometric buckling in the z direction
MATERIAL fuel1 {
D_1 1.5 SigmaA_1 0.010+D_1(x,y)*Bg2 SigmaS_1>2 0.02
D_2 0.4 SigmaA_2 0.080+D_2(x,y)*Bg2 nuSigmaF_2 0.135 eSigmaF_2 nuSigmaF_2(x,y) }
MATERIAL fuel2 {
D_1 1.5 SigmaA_1 0.010+D_1(x,y)*Bg2 SigmaS_1>2 0.02
D_2 0.4 SigmaA_2 0.085+D_2(x,y)*Bg2 nuSigmaF_2 0.135 eSigmaF_2 nuSigmaF_2(x,y) }
MATERIAL fuel2+rod {
D_1 1.5 SigmaA_1 0.010+D_1(x,y)*Bg2 SigmaS_1>2 0.02
D_2 0.4 SigmaA_2 0.130+D_2(x,y)*Bg2 nuSigmaF_2 0.135 eSigmaF_2 nuSigmaF_2(x,y) }
MATERIAL reflector {
D_1 2.0 SigmaA_1 0.000+D_1(x,y)*Bg2 SigmaS_1>2 0.04
D_2 0.3 SigmaA_2 0.010+D_2(x,y)*Bg2 }
# define boundary conditions as requested by the problem, applied
# to appropriate physical entities defined in the geometry file
PHYSICAL_ENTITY NAME external BC robin 0.4692
PHYSICAL_ENTITY NAME mirror BC neumann
# set the power setpoint equal to the volume of the core
# (and set eSigmaF_2 = nuSigmaF_2 as above)
power = 17700
# finally ask milonga to solve the eigenvalue problem
MILONGA_SOLVE
# report the keff
PRINT TEXT "keff = " %.10f keff SEP " "TEXT " ( lc = " %g lc TEXT ")"
# open gmsh with the postprocessing (in background)
OUTPUT_FILE post benchmark.pos
MESH_POST FILE post phi_1 phi_2 pow
SHELL "gmsh benchmark.pos &"
# and gnuplot with the power
OUTPUT_FILE dat benchmark.dat
PRINT_FUNCTION FILE dat pow
SHELL "gnuplot p e \"splot 'benchmark.dat' palette\" &"
# 8< milonga's solution ends here 8<
See this monograph, this paper and The milonga Real Book for an alamilonga full solution of the 2D IAEA PWR Benchmark problem. documentationCurrently wasora has a serious lack of complete and uptodate documentation. Sadly, there is still no official reference for milonga. All there exist are scattered documents that somehow illustrate how milonga works. Until a frozen documentation package is obtained, please ask whatever questions you may have in the mailing list. neutron diffusion on unstructured grids: comparison between finite volumes and finite elementsThe main objective of this monograph is to numerically solve a mathematical equation that eventually can have applications of interest—both in the academia and in the industry—to analyze, study and optimize nuclear reactors. In order to do that, we have developed a computational code named milonga which is freely distributed under the terms of the GNU General Public License. In this work, we first introduce two numerical schemes to solve the multigroup neutron diffusion equation over an unstructured mesh—one based on the finite volumes method and the other one based on the finite element method. Then we solve some simple—and others no to simple—using both schemes and we compare the obtained results. We introduce first the basic mathematical concepts related to the multigroup neutron diffusion equation and the we develop the ideas of both numerical schemes, which are the ones that are programmed in the current version of the milonga, used to solve the problems hereby discussed. The cases are presented in increasing order of complexity, paying special attention to the comparison between finite volumes and finite elements.
Please note that the monograph is in Spanish. the milonga Real BookAs with jazz, wasora and its plugins—in particular milonga— are best mastered when played. Visit The milonga Real Book which, as the original, will guide you through wasora with fullyusable examples of increasing complexity and difficulty. The examples come with introductions, wasora inputs, terminal mimics, figures and discussions. The sources and scripts that generate the real book can be accessed at the bazaar repository.the examples subdirectoryFollowing the idea of the wasora Real Book which consists of examples of application, the milonga source tarball includes a subdirectory called examples which contain some readytouse examples. They can be browsed online at the bazaar repository.mailing listThere exist a mailing list < wasora @ talador.com.ar > where questions can be posted about any aspect of the code, including intallation, usage and development. Besides suscribing and directly asking a question, you can also browse the archives. Bugs reports are also welcome. platformsmilonga is free software, and as such it is developed under a free operating system, namely Debian GNU/Linux. The distribution tarball is based on GNU Autoconf & friends, so milonga should build in any POSIXcompliant environment. However, milonga is a fairly complex piece of software, so portability is not guaranteed (but improvements are welcome). Running milonga in nonfree operating systems is discouraged, and such topic is not of the interest of the author of milonga. However, contributions and experiences may be well received if discussed in the mailing list. licensemilonga is released under the terms of the GNU General Public License version 3, or at your option, any later version. Bottomline is, you get the four software freedoms
projects milonga relies onFollowing good practices in UNIX programming, by design milonga tries to reuse as much as possible alreadyavailable highquality free software (especially regarding numerical methods, which are better analyzed by mathematicians and better coded by professional programmers than by myself). In particular, the sparse eigenvalue problem that results when solving the steadystate multigroup neutron diffusion equation over unstructured grids is solved using the SLEPc library, that works on top of the PETSc framework. Morevoer, as milonga is a plugin for wasora, all the libraries wasora relies on are also needed of course. required libraries
publicationsarticles
presentationsNumerical variations of a classical reactor physics problem
(some preliminary ideas about) Geometric optimization of nuclear reactor cores
solving the neutron diffusion equation on unstructured grids: finite volumes vs. finite elements
solution of the 2D IAEA PWR benchmark with the neutronic code milonga
optimizacion de parametros en reactores de potencia: base de diseño del codigo neutronico milonga
© jeremy theler 2004—2014 
