# Numerical Coupling between a FEM Code and the FVM Code OpenFOAM Using the MED Library
## 1 Introduction  
In the last few decades, the performance increase of computational tools has gained more and more attention from the scientific community. In computational fluid dynamics (CFD), accuracy and efficiency remain challenging, especially when dealing with complex systems. Thus, interest in using multiscale and multiphysics numerical tools to conduct complex and realistic simulations has grown. The evaluation of the whole system requires a modeling effort for all the various scales and interactions associated with its different components together with the development of numerical tools capable of analyzing phenomena across multiple scales and physics [1; 2; 3]. Nowadays, several computational codes have been developed to solve problems involving different engineering aspects, from physics (at every scale) to chemistry and from biology to mathematics. In this context, the concept of high-performance computing (HPC) assumes a central role as it enables the possibility of addressing complex and sophisticated problems by using additional computational power. On the other hand, the simulation of very complex systems is still challenging due to the different phenomena scales. For this reason, the existing codes are developed to address, in general, only a family of problems. For instance, we can find in the open-source framework a plethora of simulation software programs that can tackle a subset of the physical systems we are interested in. We can refer to codes such as OpenFOAM [4], TrioCFD [5], and code_Saturne [6] for fluid dynamics simulations. These codes can solve the Navier-Stokes equations, in their incompressible and compressible variations, multiphase flow, turbulencephenomena (at different scales, through RANS, LES, or DNS), and so on. Several solvers are available in the thermomechanical field, including elasticity problems and fracture propagation. Among them, we can mention Code-Aster [7] or TFEL/MFront [8]. Codes such as Dragon/Donjon have been developed to tackle neutronic problems. Additionally, other open-source FEM-based numerical platforms such as libMesh [9], Deal-II [10], and FEniCS [11] are widely used to solve generic PDE problems. For the simulation of highly complex problems, the capability of modeling different physics coming from various application domains is necessary. However, none of the cited codes can manage the full complexity of any given physics phenomenon. Two main strategies have been explored to simulate these complex multiscale and multiphysics problems. One way is to develop a new numerical code to model all the relevant physical phenomena. This strategy is commonly referred to as the monolithic approach. Alternatively, one can choose to couple existing and validated codes. This second approach is a technique that can integrate multiple codes to enhance simulation capabilities by using standalone code strengths. For instance, we can think about the simulation of a nuclear reactor, for which every physics is tightly coupled to all the others (i.e., neutronics, thermal hydraulics, and thermal mechanics with the presence of multiphase issues). The code-coupling technique can be a reasonable strategy to exploit the different code peculiarities and avoid the necessity to develop a new computational tool that incorporates all the necessary features. By doing so, we can benefit from using codes that have already been extensively validated and from their expertise developed over many years. Therefore, this strategy focuses on a framework suitable for coupling of different codes by exchanging efficiently output and input data, i.e., directly coupling the codes in memory and not through writing and reading from external files [12]. This paper presents a coupling strategy by exploiting the open-source MED and MED-Coupling library to link the in-house FEMuS code with the well-established OpenFOAM software. All simulations performed in this paper have been carried out with OpenFOAM version 11.