a free nuclear reactor core analysis code


milonga is a free core-level neutronic code that solves the steady-state multigroup neutron transport equation (either using the diffusion approximation or the discrete ordinates SN method) over unstructured grids (although simple structured grids can also be used) using either a finite-volumes or a finite-elements discretization scheme. It works on top of the wasora framework, which provides means to parse and understand a high-level plain-text 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.


Its main features are:

  • free & open source software (released under the terms of the GNU GPL version 3)
  • solves the steady-state few-group neutron transport equation over a Gmsh-generated unstructured grids in one, two or three spatial dimensions
  • may solve either the discrete ordinates or the diffusion formulation of the transport equation
  • may use either a finite-volumes or a finite-elements spatial discretization scheme to obtain a matrix-casted problem
  • solves any combination of multiplicative and non-multiplicative media with and without independent source
  • can solve for either the direct or the adjoint flux
  • structured grids may be generated for simple problems within milonga without needing an external mesher (discouraged)
  • macroscopic cross sections are given as algebraic expressions of x, y and z in a per-material basis
  • algebraic expressions may involve interpolated point-wised user-defined functions of one or more variable, so cross sections may depend on intermediate spatial distributions (e.g. temperatures)
  • algebraic expressions may involve standard functions (sin, cos, exp, log, etc.) and functionals (integral, derivative, root, etc.)
  • computed results (i.e. keff, fluxes, power) are given as scalar variables and functions of x, y and z which may be further used in algebraic expressions
  • program output in 100% user-defined
  • milonga may be coupled to other calculation codes using files, shared-memory objects or python bindings
  • non-linear effects (e.g. xenon and/or thermalhydraulic feedback) may be solved in an iterative way
  • multidimensional quasi-random sequential parametric or non-linear minimization cases are easily created from single-run input files
  • milonga may be extended by runtime-loadable shared objects and/or fixed entry-point plugins
  • high-quality free & open third-party libraries are used to perform tasks that other people have already worked out: PETSc, SLEPc, GSL, IDA, Readline
  • new formulations and/or spatial discretizations schemes can be (more or less) easily added
  • milonga interfaces well with other UNIX tools (m4, grep, sed, awk, etc.) and plotting & post-processing tools (Gnuplot, Gmsh, LaTeX, ParaView, Pyxplot, etc.)

Actually, milonga can be seen as a glue layer between a mesh generator (i.e Gmsh) and a large sparse matrix solver (i.e SLEPc for eigenvalue problems and PETSc for linear problems). That is to say, milonga builds the matrices R and F that cast the multigroup neutron transport/diffusion equation as a matrix-based eigenvalue problem:

Fϕ = keff ⋅ Rϕ

Should there be independent neutron sources S, then the problem is casted as a system of linear equations:

(F − R)ϕ = S

These matrices are expected to be sparse, as they are the result of the discretization of the differential diffusion operator using either finite volumes or finite elements, over a certain spatial grid either generated by a mesher or structured defined within the milonga input file. Said matrices are thus built in PETSc format, so they can either be passed to a parallel solver (default is SLEPc, whose algorithms and parameters may be chosen at run-time) or even dumped into files to be opened later. The macroscopic cross-section may depend on the spatial coordinates x, y and/or z (depending on the dimension of the problem) not only because different materials may be assigned to the regions of the domain (i.e. physical entities) but also due to continuous dependence of these cross sections with arbitrary parameter distributions within the entity (i.e. temperatures, densities, poison concentration, etc.). These dependencies can be given either as point-wise interpolated functions or algebraic expressions (that may in turn involve point-wise defined data).

Milonga provides also a second glue layer that links the output of the linear/eigen-solver to the input of a post-processing tool (i.e Gmsh or ParaView). The effective multiplication factor keff is stored as a wasora variable, and the fluxes and power distribution as point-wise defined multidimensional functions, which can then be added, subtracted, integrated, differentiated, etc. Parametric and optimization runs may be also performed.

The subdirectory examples contains a test suite that may be used as examples of usage.
See for examples of actual applications.

milonga was designed by a guy who

  1. works in the nuclear industry
  2. is tired of old-fashioned inflexible poorly-coded fortran-based engineering programs
  3. wants to contribute, extend and apply into real-world applications those numerical recipes that are taught in the academia that only work for canonical cases (i.e. simple bare geometries with uniform cross sections)
  4. was disappointed when being an undergraduate student found out that there were virtually no high-quality free and/or open nuclear engineering codes available to investigate, to understand and to reproduce
hence, milonga appears with a lot of features intrinsically embedded by a thoughtful design basis. For example, the main objective is to be able to easily insert the spatial dependence of cross sections. Each material can have a different set of cross sections, each one being an algebraic expression that can involve the evaluation of multidimensional functions, which themselves can be defined by interpolation of scattered data, which itself can be read at runtime from a file or from a shared-memory object, for instance to configure a coupled calculation with thermalhydraulics and/or control codes.

Last modification: Tue, 13 Jan 2015 19:26:09 -0300.


Updated web page.
Added slides of the presentation about milonga at ENIEF 2014.


all sections within a single page


name (full/alias)
contact (email/url)
hoy many points do you see? (antibot) . :


Thu, 14 May 2015 22:47:40 -0400

Sat, 25 Apr 2015 21:54:44 -0400

jeremy theler
Wed, 15 Apr 2015 08:58:21 -0400

Hi! Does the cygwin version that is available in the download section work for you?

Mosebetsi Leotlela (
Tue, 14 Apr 2015 09:51:05 -0400

Thank you so much for your kindness and generosity to make this code available to of us free of charge.

Do you perhaps have the Windows version?

Sun, 29 Mar 2015 08:25:23 -0400




© jeremy theler 2004—2015