Contributing to OpenFOAM Foundation Release - An effective code development strategy


Contributing to OpenFOAM Foundation Release - An effective code development strategy

Schlegel, F.; Peltola, J.

Open source has changed the world of software development significantly over the last decades. There are many prominent examples where open source software is successfully developed and widely applied, e.g., the Linux kernel, the office suite LibreOffice or the famous Python language. Computational Fluid Dynamics (CFD) is a highly specialised field and the software is characterized by a vast complexity of the underlying physics and equations. Seldom there is the “one” correct way for obtaining a solution for a given numerical problem. In this agile environment OpenFOAM established itself as the leading open source software package for numerical simulations in engineering applications, like nuclear safety research. Today it owns a significant share of the market and the OpenFOAM community is growing constantly.

There are many arguments for adopting open source software for numerical simulations. To qualify a CFD software for usage in a design process of nuclear power plants or critical infrastructure as well as safety analysis, the full access to the source code is an important prerequisite to guarantee transparency and reliability, e.g. to check the truthful implementation of methods and models, to have information about potential correction terms, to track the history of changes, to guarantee a long-term availability and independence from commercial interests of software manufacturers. For research in particular, transparency and reproducibility of results according to the FAIR principles is a fundamental requirement for good scientific work. Using open source software is a key prerequisite to fulfill these criteria. However, FAIR research requires more, because the modifications done by researchers have to be available to the research community in a referencable way. Furthermore, these references and repositories require maintenance and have to be further developed as knowledge evolves to have full transparency and reproducibility. Another benefit is the active community that usually develops around open source software and the availability of a common code base, which helps to enhance joint developments and the exchange of knowledge. Most importantly, open source software can be developed through a process of quick-turnaround releases incorporating lots of user feedback, at a scale that matches the complexity of what is being developed.

For a sustainable development of a complex piece of open source software, criteria like robustness, functionality, usability, extensibility and accessibility are very important as well as a significant number of users. For instance, users rely on the availability of the software package for various platforms, the usability of the solvers and utilities, as well as someone doing basic maintenance. OpenFOAM is designed as a library with multiple solvers, utilities and model libraries. This structure allows an enormous amount of applications, because all features can be combined in different ways, depending on the physical problem that should be analyzed. This flexibility has high demands on the robustness of the implementation and the underlying algorithms. Furthermore, extensibility has to be a main software design aspect (APIs, library structure) when adding new features or functionality, which is particular complicated for CFD software as there is typically more than one way to solve a problem and various, sometimes not compatible theories. All of these points mentioned above require a continuous maintenance and redesign of the OpenFOAM core.

Such a well maintained open source software package is the basis for the community to develop new technologies and own extensions for OpenFOAM. Unfortunately, for ease of development many users fork a stable OpenFOAM version for their implementations and features. The problem of such a fork is that it is rarely synchronized with the main development line of OpenFOAM. As a result bugs can remain unrecognized and unfixed, new features and functionality will be not available or have to be backported with big effort and sharing the code with others becomes problematic at some point. Clearly, for research the FAIR principles are hard to fulfill with such a fork. Hence, contributing features and functionality to the release would be desirable. As already pointed out OpenFOAM has an enormous field of applications, a lot of – maybe conflicting – interests of users, it is integrated into large design workflows and if it is used for safety analysis or in a certification process, all changes have to be well analyzed for side effects and documented. This incomplete list of requirements clearly illustrates that contributions have to fulfill a very high standard concerning software design, robustness, code style and maintainability.

Investing resources in contributions and discussions with core maintainers has another important aspect. One of the main benefits of open source software is that the community grows day by day and develops new fields of application, often into directions that were not foreseen when software got released. The intensive discussions during a contribution helps do broaden the understanding of new developments and technologies and their implications on the source code on both sides, contributors and core maintainers. It also allows to develop generalized, maintainable interfaces for potentially conflicting theories, such that users can pick up the new developments and develop their own ideas or apply them to new, unforeseen fields of application. For sure such discussions are non-trivial, time consuming and require willingness to compromise, but they are necessary to develop OpenFOAM in a sustainable and maintainable way.

VTT Finland and Helmholtz-Zentrum Dresden-Rossendorf have become active contributors to the OpenFOAM Foundation release over the last years, which is a challenge and requires a long term commitment. The population balance framework contributed by Helmholtz-Zentrum Dresden-Rossendorf and VTT Finland in end of 2017 will serve as an example how an effective contribution can look like and what benefits arise from such a contribution. Based on these experiences HZDR develops an extension for multiphase flows and – as presented in another contribution – coordinates the activities of the German nuclear society to develop an extension for numerical simulations in the reactor cooling system. For both extensions a close collaboration and a short way communication with the OpenFOAM Foundation and CFD Direct is established to influence the development of important interfaces, critical infrastructure and functionality done by the OpenFOAM core maintainers. This allows an effective, maintainable and sustainable development of HZDR’s extensions and an efficient development of new technologies in the field of CFD. Furthermore, due to the presence of other contributors, like the Process Engineering Consortium or VTT Finland, new functionality relevant for nuclear applications was developed for OpenFOAM in the last years without direct funding by HZDR. Prominent examples are energy conservation with realistic material properties, species diffusion modelling, tabulated material properties, dynamic mesh support in multiphaseEulerFoam or the revised film modelling interface. For sustainable development of
a complex piece of open source software, criteria like robustness, functionality, usability, extensibility and accessibility are very important as well as a significant number of users.

ACKNOWLEDGEMENTS
This work is carried out in the frame of a current research project funded by the German Federal Ministry for Economic Affairs and Energy, project number 1501604.

  • Lecture (Conference) (Online presentation)
    IAEA Technical Meeting on the Development and Application of Open-Source Modelling and Simulation Tools for Nuclear Reactors, 20.-24.06.2022, Mailand, Italien

Permalink: https://www.hzdr.de/publications/Publ-32710