Antonin Byron

Célia

Diego, Djaffar, Eliot, Felice, Giulia bio, Hadrien, JB Charles

Jona- Than Agnès

Julie Kevin

Ludo, Marco, Mehdi, Minime, Reine Léo

Simon Samira

Xiaokun Stefania Gernez

Yash Alexandre

Je

En cette fin de thèse, j'ai une pensée pour toutes les personnes qui m'ont donné le goût des sciences et des mathématiques. Entre autres je pense à mes professeurs du lycée Ozanam à Lille qui m'ont choyée, à ceux des classes préparatoires Stanislas à Paris grâce à qui j'ai développé ma rigueur et ma persévérance, aux enseignants-chercheurs de l'université de Lille qui m'ont appris à me focaliser sur l'important. J'en profite pour remercier ceux qui ont participé au financement de ma thèse, que ce soit ma bourse ou mes missions : le BRGM, la Région PACA, l'INRIA et l'ANR.

Ces 3 années de thèse n'auraient pas été si agréables sans vous, stagiaires, doctorants, post-doctorants, permanents, amis de Nice et d'ailleurs. Je tiens à vous remercier pour tous les moments passés ensemble, j'ai beaucoup rigolé et beaucoup appris grâce à vous. Tout d'abord, merci aux nombreux permanents qui ont rendu agréables mes journées au labo. Merci Thierry pour les discussions quotidiennes que nous avons pu avoir, je suis contente de t'avoir comme voisin de bureau. Merci Jean-Marc et Roland d'être toujours disponibles pour résoudre mes problèmes et pour discuter. Merci Julia, Valérie, Anita, Chiara et Marie-Cécile pour votre aide rapide, efficace et dans la bonne humeur. Merci aussi aux Fiziens qui m'ont supportée presque tous les midis pour les mots croisés, ainsi que pour votre accueil pendant mon été de rédaction, j'en garde de très bons souvenirs. Et un énorme merci aux doctorants et amis qui m'entourent : Alexandre (mini-Sbryckyz),

Simulation numérique d'écoulements diphasiques compositionnels thermiques en milieux poreux et ses applications à la géothermie haute énergie RÉSUMÉ :

La compréhension des écoulements souterrains est importante pour de nombreuses applications comme l'énergie ou le stockage des déchets nucléaires. Cette thèse, effectuée en collaboration avec le Bureau de Recherches Géologiques et Minières (BRGM), est dédiée à la simulation des écoulements diphasiques compositionnels thermiques en milieux poreux et ses applications à la géothermie haute énergie et plus particulièrement au champ géothermique de Bouillante (Guadeloupe). Tout d'abord, deux formulations à variables persistantes sont comparées en termes d'implémentation et de convergence numérique. Dans ces deux formulations, les fractions molaires d'une phase absente sont étendues par celles à l'équilibre thermodynamique avec la phase présente. Il en résulte que l'ensemble des variables principales et des équations ne dépend pas de l'ensemble de phases présentes. De plus, l'équilibre thermodynamique est exprimé par une contrainte de complémentarité pour chacune des phases, ce qui permet l'utilisation de méthodes de type semi-smooth Newton pour résoudre les systèmes non-linéaires. D'autre part, cette thèse présente une nouvelle méthodologie combinant des discrétisations centrées aux noeuds (le schéma Vertex Approximate Gradient -VAG) et aux faces (le schéma Hybrid Finite Volume -HFV) sur une partition arbitraire des ensembles de mailles ou de faces, dans le but d'adapter le choix du schéma aux différentes parties du maillage. En effet, les maillages hybrides composés de différents types de mailles sont plus adaptés à la discrétisation de la géologie et de la géométrie des différents domaines d'un système géothermique. Ainsi le schéma peut être choisi localement en fonction de la géométrie de la maille et des propriétés pétrophysiques. L'analyse de convergence est effectuée dans le cadre des discrétisations Gradient pour des problèmes de diffusion du second ordre et la convergence est confirmée numériquement sur différents types de maillages hybrides 3D. Ensuite la discrétisation VAG-HFV est étendue au cas des écoulements de Darcy diphasiques non-isothermes compositionnels et est appliquée au cas test 2D représentant le plan de faille vertical du réservoir géothermique de Bouillante. Un autre aspect important de la modélisation des flux géothermiques consiste à prendre en compte les interactions entre le flux dans le milieu poreux et l'atmosphère. Puisque le couplage entre le modèle poreux et un modèle 2D surfacique ou 3D atmosphérique n'est pas réaliste en terme de coût de calcul aux échelles spatiale et temporelle géologiques, l'interaction sol-atmosphère est modélisée grâce à une condition limite prenant en compte l'équilibre de matière et d'énergie à l'interface. Ce modèle considère une couche limite atmosphérique avec transfert convectif molaire et thermique (en supposant l'évaporation de la phase liquide), une condition de débordement liquide aux surfaces d'infiltration, ainsi que le rayonnement thermique et la recharge en eau douce due aux précipitations. Cette condition limite est évaluée à l'aide d'une solution de référence couplant les écoulements non-isothermes liquide-gaz en milieu poreux et le gaz dans le milieu libre. Elle est ensuite étudiée numériquement en terme de convergence et de solution sur des cas tests géothermiques, dont le plan de faille vertical du réservoir géothermique de Bouillante. En complément est présenté le travail issu d'une collaboration lors de l'école d'été du CEMRACS 2016. Le projet consistait à ajouter un modèle de puits multi-branche thermique au code ComPASS, un nouveau simulateur géothermique parallèle basé sur des maillages non-structurés avec la possibilité de représenter des fractures.

MOTS CLÉS :

écoulement de Darcy diphasique compositionnel thermique ; énergie géothermique ; condition limite atmosphérique ; schéma volumes finis ; discrétisation Gradient ; maillage hybride. Numerical simulation of non-isothermal compositional two-phase flows in porous media and its applications to high energy geothermy ABSTRACT:

The study of the subsurface flows is important for various applications such as energy or nuclear waste storage. This thesis, performed in collaboration with the French Geological Survey (BRGM), is dedicated to the simulation of non-isothermal compositional two-phase flows in porous media and its applications to high-energy geothermal fields and more precisely to the Bouillante field (Guadeloupe, French West Indies). First of all, two persistent variable formulations are compared in terms of implementation and numerical convergence. In these two formulations, the choice of the principal variables is based on the extension of the phase molar fractions by the one at thermodynamic equilibrium with the present phase. It results that the set of principal variables and equations does not depend on the set of present phases. It also has the advantage to express the thermodynamic equilibrium as complementarity constraints, which allows the use of semi-smooth Newton methods to solve the non-linear systems. Moreover, this thesis presents a new methodology to combine a node-centered discretization (the Vertex Approximate Gradient scheme -VAG) and a face-centered discretization (the Hybrid Finite Volume scheme -HFV) on arbitrary subsets of cells or faces in order to choose the best-suited scheme in different parts of the mesh. Indeed, hybrid meshes composed of different types of cells are best suited to discretize the geology and geometry of the different parts of the geothermal system. Then, the scheme is adapted locally to the type of mesh/ cells and to petrophysical properties. The convergence analysis is performed in the gradient discretization framework over second order diffusion problems and the convergence is checked numerically on various types of hybrid threedimensional meshes. Then, the VAG-HFV discretization is extended to non-isothermal compositional liquid-gas Darcy flows and is applied on the two dimensional crosssection of the Bouillante high temperature geothermal reservoir. Another important aspect of the geothermal flows modelling consists in considering the interactions between the porous medium and the atmosphere. Since the coupling between the porous medium and the 2D surface of 3D atmospheric flows is not computationally realistic at the space and time scales of a geothermal flow, the soil-atmosphere interaction is modelled using an advanced boundary condition accounting for the matter (mole) and energy balance at the interface. The model considers an atmospheric boundary layer with convective molar and energy transfers (assuming the vaporization of the liquid phase in the atmosphere), a liquid outflow condition at seepage surfaces, as well as the heat radiation and the precipitation influx. This boundary condition is assessed using a reference solution coupling the Darcy flow to a full-dimensional gas free flow. Then, it is studied numerically in terms of solution and convergence of the Newton-min non-linear solvers on several geothermal test cases including two-dimensional simulations of the Bouillante geothermal field. In addition is presented the collaborative project which took place during the CEMRACS summer school 2016. The project consisted in adding a multibranch thermal well model into the ComPASS code, a new geothermal simulator based on unstructured meshes and adapted to parallel distributed architectures with the ability to represent fractures.

KEY WORDS:

non-isothermal compositional two-phase Darcy flow; geothermal energy; soil-atmosphere boundary condition; finite volume scheme; Gradient discretization; hybrid mesh.

REMERCIEMENTS

Bien évidemment, mes premières pensées vont à mon directeur de thèse, Roland. Merci de m'avoir guidée et accompagnée tout au long de ma thèse. Pendant ces trois ans, tu as été présent pour me former aux milieux poreux et aux thématiques variées qui y sont liées. Tu as su m'ouvrir au monde de la recherche en m'encadrant au quotidien et en me donnant l'opportunité de participer à de nombreuses réunions ANR, conférences et écoles d'été. Merci pour tout. Merci aussi à Simon et Farid, j'ai eu la chance d'échanger régulièrement avec vous malgré la distance. Cela m'a permis de me plonger dans ce beau sujet qu'est la géothermie, en particulier en remettant en question les hypothèses du modèle, en analysant les résultats physiques des simulations... Merci Konstantin, le temps a manqué pour que nous travaillions plus longuement ensemble, mais les discussions que nous avons eues, en particulier sur les maillages et sur les équations de Richards m'ont aidée à appréhender le modèle. Ce fut une grande chance pour moi d'être encadrée par des spécialistes de domaines différents et que vous soyez autant impliqués. Je suis heureuse de continuer avec vous un an de plus.

Alors que ce travail se termine, je suis reconnaissante à mes rapporteurs, Inga Berre et Rainer Helmig, pour leur lecture attentive de mon manuscrit. Merci pour vos commentaires très constructifs. Je remercie aussi chaleureusement l'ensemble de mon jury constitué de mes encadrants, mes rapporteurs, Raphaèle Herbin et Laurent Jeannin. Merci à tous d'avoir accepté d'évaluer ma thèse, c'est un honneur pour moi.

Introduction

La simulation numérique d'écoulements de Darcy diphasiques compositionnels dans les milieux poreux hétérogènes joue un rôle majeur dans de nombreuses applications. Dans le secteur pétrolier, ces modèles sont primordiaux pour prévoir et optimiser la production des réservoirs. Dans la modélisation des bassins sédimentaires, ils servent à simuler la migration des phases d'hydrocarbures, aux échelles spatiale et temporelle géologiques, à partir de la roche mère jusqu'aux pièges à pétrole dans les formations géologiques. En stockage géologique de CO 2 , la modélisation d'écoulements de Darcy diphasiques compositionnels contribue à mieux appréhender les performances des sites de stockage de CO 2 pour en renforcer la sûreté. L'étude des flux de Darcy permet aussi d'analyser la migration de gaz et d'évaluer la sécurité à long terme du stockage des déchets nucléaires en couche géologique profonde. Finalement, coupler ces modèles d'écoulements de Darcy avec l'équation de conservation d'énergie mène à des applications pour l'exploration et la production des opérations géothermiques. La géothermie est une énergie décarbonnée non-intermittente qui a un faible impact sur l'environnement (illustration Figure 1). En effet, par rapport à d'autres énergies renouvelables, la géothermie haute énergie a l'avantage de ne pas dépendre des conditions atmosphériques (soleil, pluie, vent). Dans les pays ayant un environnement géothermique favorable, elle représente une alternative à l'énergie fossile aussi bien pour la production d'énergie que pour un usage direct, le chauffage représentant une part importante de la consommation finale d'énergie dans le monde. C'est pourquoi la capacité mondiale d'énergie géothermale installée a augmenté d'environ 17 pourcents entre 2010 et 2015, et on s'attend à ce que la capacité mondiale ait doublé entre 2010 et 2020 [START_REF] Bertani | Geothermics Geothermal power generation in the world 2010-2014 update report[END_REF]. Sur le territoire français, c'est déjà une solution attractive comparée à l'importation de carburant pour les îles volcaniques. En 2016 environ 5 pourcents de la consommation annuelle d'électricité de la Guadeloupe provient de la géothermie. Dans un contexte de changement climatique, le développement de la géothermie s'inscrit dans le cadre des objectifs du Grenelle de l'Environnement sur les énergies renouvelables. Il est prévu notamment de multiplier par 6, entre 2013 et 2020, l'utilisation de la géothermie pour la production de chaleur. C'est aussi essentiel pour parvenir aux objectifs énergétiques et environnementaux, selon lesquels les territoires d'outre-mer devront produire 50 pourcents de leur consommation d'électricité à partir d'énergies renouvelables d'ici 2020 et parvenir à l'auto-suffisance d'ici 2030. Le développement géothermique des Caraibes a un haut potentiel et plusieurs projets industriels sont en développement ou déjà en cours, dans les territoires d'outre-mer français (Guadeloupe, Martinique) aussi bien que dans les îles aux alentours (Dominique, Montserrat, Saint-Christophe-et-Niévès, Sainte-Lucie, ...) qui dépendent actuellement principalement du diesel.

Ce travail est effectué en collaboration avec le Bureau de Recherches Géologiques et Minières (BRGM) pour modéliser le champ géothermique de Bouillante en Guadeloupe (dont un schéma est représenté Figure 2), situé non loin du volcan de la Soufrière. En 1984, un premier forage d'une profondeur de 300 mètres a été réalisé sur la base duquel l'installation d'une centrale de 5 MW a été décidée. Très proches de ce site, trois nouveaux puits de production plus profonds (1 km en moyenne) ont été mis en service en 2001 et une centrale, construite en 2003 (Bouillante 2), a permis de mettre en production 11 MW supplémentaires dès début 2005. Cette centrale géothermique contribue de manière significative à la sécurité de l'approvisionnement en électricité de l'île, à la diminution de son coût de production et à la réduction des émissions de gaz à effet de serre (en Guadeloupe, la majeure partie de l'électricité non géothermique provient de la combustion de combustibles fossiles) [START_REF] Lachassagne | Hydrogeological model of a high energy geothermal field (Bouillante area, Guadeloupe, French West Indies)[END_REF].

Le réservoir de Bouillante se compose de deux ensembles de fractures et de failles perpendiculaires à des structures tectoniques régionales majeures. Les simulations dans cette thèse portent principalement sur une coupe 2D, illustrée Figure 3, représentant un plan de faille majeur qui agit comme un drain perméable. La simulation numérique est devenue essentielle pour toutes les phases des opérations géothermiques. Elle est utilisée dans les phases d'exploration pour évaluer le potentiel géothermique, pour valider les hypothèses de conception et aider à determiner l'emplacement des puits. Le développement sur le terrain et la gestion des ressources requièrent des estimations quantitatives pour éviter l'épuisement des ressources et atteindre son exploitation optimale et durable (scenario injection/production). Enfin, les modèles numériques aident aussi à l'étude d'exploitations liés aux risques industriels tels que les interactions avec les eaux peu profondes (ressources d'eau potable, évents hydrothermaux ou éruption) (voir [START_REF] O'sullivan | Using reservoir models for monitoring geothermal surface features[END_REF]).

Différents modèles numériques existent. Dans cette thèse je considère un modèle de Darcy diphasique compositionnel thermique avec P = {l, g} l'ensemble des phases liquide et gaz. Chaque phase α ∈ P est un mélange de l'ensemble des composants noté C incluant typiquement un composant eau qui peut se vaporiser et un ensemble de composants gazeux qui peuvent se dissoudre dans la phase liquide. Soient P α la pression de la phase α, T la température d'équilibre locale du système et C α = (C α i ) i∈C les fractions molaires de chaque phase. L'équilibre thermodynamique entre la phase gaz et la phase liquide est supposé pour chaque composant. Je me réfère au tableau 3.5.2 pour l'ensemble des notations.

La simulation est basée sur des formulations adaptées au couplage non-linéaire entre l'équation de conservation molaire de chaque composant i ∈ C , la loi de conservation de l'énergie

φ (x)∂ t n i + div( ∑ α∈P C α i ζ α q α ) = 0, i ∈ C , φ (x)∂ t E f + (1 -φ (x))∂ t E r + div( ∑ α∈P h α ζ α q α -λ ∇T ) = 0,
où q α est la vitesse de la phase α (loi de Darcy généralisée)

q α = - k α r µ α Λ Λ Λ(x) ∇P α -ρ α g ,
et les lois de fermetures hydrodynamiques et thermodynamiques. Différentes formulations ont été étudiées pour des flux de Darcy compositionnels isothermes et nonisothermes. Elles diffèrent de par leurs choix d'inconnues principales et d'équations et par la manière dont elles gèrent les changements de phase, ce qui est l'une des principales difficultés de ce type de modèles. La distinction est faite entre les formulations avec changement de système d'inconnues et les formulations à variables persistantes. Les premières adaptent l'ensemble d'inconnues principales et les équations en fonction des phases présentes qui peuvent varier en espace et en temps. La plus connue de cette famille de formulation est la formulation de Coats (aussi appelée formulation à variables naturelles) qui est largement utilisée en simulation réservoir [START_REF] Coats | Implicit compositional simulation of single-porosity and dual-porosity reservoirs[END_REF][START_REF] Class | Numerical simulation of non-isothermal multiphase multicomponent processes in porous media.: 1. An efficient solution technique[END_REF][START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. Elle a l'avantage d'utiliser les variables physiques des lois thermodynamiques et hydrodynamiques comme inconnues principales. Son inconvénient majeur est d'exiger une adaptation coûteuse de cet ensemble d'inconnues en fonction des phases présentes en chaque point de l'espace et du temps. D'un autre côté, les formulations à variables persistantes ont l'avantage d'éviter tout changement de variable lié à la présence des phases et peuvent être basées sur des quantités physiques naturelles telles que les fractions molaires globales des composants ou l'enthalpie spécifique totale (voir [START_REF] Voskov | Comparison of nonlinear formulations for two-phase multi-component eos based simulation[END_REF]), ou bien sur des variables principales non classiques comme dans [START_REF] Bourgeat | Two-phase, partially miscible flow and transport modeling in porous media: application to gas migration in a nuclear waste repository[END_REF][START_REF] Marchand | Fully coupled generalized hybrid-mixed finite element approximation of two-phase two-component flow in porous media. Part I: formulation and properties of the mathematical model[END_REF]. Une autre stratégie pour éviter un changement de variable se base sur l'extension de certaines quantités physiques telles que les fractions molaires comme dans [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF] ou dans [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF][START_REF] Masson | Formulations of two phase liquid gas compositional Darcy flows with phase transitions[END_REF][START_REF] Zhang | Modeling and simulation of ventilation devices in nuclear waste storage[END_REF].

Dans le Chapitre 1 sont étudiées deux formulations à variables persistantes du modèle d'écoulements diphasiques compositionnels thermiques des flux de Darcy (dont la première a été introduite dans le cas isotherme dans [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF]). Dans ces deux formulations, pour éviter un changement de variable, le choix des variables principales est combiné avec une extension des fractions molaires d'une phase absente par celles à l'équilibre thermodynamique avec la phase présente. Il en résulte que l'ensemble des variables principales et des équations ne dépend pas de l'ensemble de phases présentes. De plus, cette extension permet d'exprimer l'équilibre thermodynamique par une contrainte de complémentarité pour chacune des phases [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF].

La réponse classique pour faire face au couplage entre une inconnue elliptique (ou parabolique), la pression, et des inconnues hyperboliques (ou paraboliques dégénérées), les fractions volumiques et molaires, se base sur une discrétisation spatiale de type Volumes Finis, qui est efficace quand couplée avec une discrétisation en temps de type Euler Implicit pour permettre l'utilisation de pas de temps suffisamment grands [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF][START_REF] Peaceman | Fundamentals of Numerical Reservoir Simulations[END_REF]. D'autres discrétisations en temps moins diffusives sont explorées, comme proposé dans [START_REF] Tambue | Efficient simulation of geothermal processes in heterogeneous porous media based on the exponential Rosenbrock-Euler and Rosenbrock-type methods[END_REF] pour les équations d'advection diffusion. Une difficulté majeure est liée à la discrétisation Volumes Finis des flux de Darcy avec des géométries et des géologies complexes tels que rencontrées dans les problèmes pratiques, par exemple des réseaux de fractures, des biseaux stratigraphiques, des hétérogénéités ou des anisotropies spatiales du milieu. Le schéma standard deux-points centré aux mailles Two-Point Flux Approximation (TPFA) qui est largement utilisé dans les simulateurs industriels est peu coûteux et robuste mais sa consistence exige des conditions fortes d'orthogonalité sur le maillage qui ne sont pas réalisables pour des modèles géothermiques complexes. En effet, les champs géothermiques haute énergie sont souvent localisés dans des zones géologiquement actives (par exemple aux limites de plaques tectoniques ou dans des régions volcaniques) avec des structures naturelles et des géométries complexes telles que des réseaux de failles avec des propriétés discontinues et des fractures qui agissent comme des drains ou des barrières sur les transferts de masse et d'énergie, controllant ainsi la distribution de la ressource géothermale.

Les 20 dernières années, ces restrictions ont motivé la recherche sur le développement de nouveaux schémas pour approximer les flux de Darcy sur des mailles polyh-édriques et avec des milieux poreux hétérogènes anisotropes [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Droniou | Finite volume schemes for diffusion equations: introduction and review of modern methods[END_REF]. Toujours centré aux mailles, le schéma Multi-point Flux Approximation (MPFA) étend le schéma TPFA à une discrétisation consistente sur des maillages généraux et avec des milieux hétérogènes anisotropes [START_REF] Aavatsmark | Discretization on unstructured grids for inhomogeneous, anisotropic media. Part I: Derivation of the methods[END_REF][START_REF] Edwards | Finite volume discretization with imposed flux continuity for the general tensor pressure equation[END_REF]. Cependant, la stabilité du schéma MPFA dépend du maillage et de l'anisotropie du milieu et il présente un stencil très large sur les maillages simplectiques et un nombre important d'inconnues. D'autre part, les discrétisations basées aux noeuds comme la méthode Control Volume Finite Element (CFVE) et le schéma Vertex Approximate Gradient (VAG) [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Samier | Implementation of a vertex centered method inside an industrial reservoir simulator -practical issues and comprehensive comparison with cpg and pebi grid models on a field case[END_REF] sont inconditionnellement coercifs et très efficaces sur des maillages simplectiques grâce à leurs discrétisations basées aux noeuds. Finalement, les schémas avec inconnues aux faces tels que le schéma Hybrid Finite Volume (HFV) qui appartient à la famille de méthodes Hybrid Mixed Mimetic (HMM) [START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF], ou la méthode Mixed Hybrid Finite Element, ont été développés et adaptés aux flux de Darcy multi-phasiques dans [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF][START_REF] Abushaikha | Fully implicit mixed-hybrid finite element discretization for general purpose subsurface reservoir simulation[END_REF]. Ils fournissent des discrétisations précises et inconditionnellement stables des flux de Darcy, mais, à cause du nombre élevé de faces, restent coûteux comparé aux approches centrées aux mailles ou aux noeuds. De manière générale, toutes ces discrétisations des flux de Darcy ont leurs propres avantages et leurs propres inconvénients qui dépendent principalement des caractéristiques du maillage et de l'anisotropie du milieu. Le Chapitre 2 consiste à introduire une nouvelle méthodologie combinant des discrétisations centrées aux noeuds et aux faces sur une partition arbitraire des ensembles de mailles ou de faces, dans le but d'adapter le choix du schéma aux différentes parties du maillage. En effet, les maillages hybrides composés de différents types de mailles sont plus adaptés à la discrétisation de la géologie et de la géométrie des différents domaines du système géothermique. Ainsi le schéma peut être choisi localement en fonction de la géométrie de la maille et des propriétés pétrophysiques.

Le schéma HFV a été retenu comme discrétisation centrée aux faces. Dans cette approche, le schéma TPFA est considéré comme un schéma HFV pour lequel les inconnues aux faces peuvent être éliminées à la condition que le maillage satisfasse la condition forte d'orthogonalité et que l'anisotropie soit alignée selon les axes du maillages (voir Lemme 2.1 de [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]). Le schéma VAG est choisi comme discrétisation centrée aux noeuds car il partage une structure de données commune avec le schéma HFV qui s'appuie sur des matrices de transmissibilité locales à chaque maille. Il a aussi l'avantage, comparé à des discrétisations centrées aux noeuds plus classiques telles que CVFE, d'éviter le mélange de rocktype aux volumes de contrôle attribués aux noeuds dans le cas du couplage des flux de Darcy avec une équation de transport.

Un autre aspect important de la modélisation des flux géothermiques, comme mentionné dans [START_REF] O'sullivan | Geothermal reservoir simulation: the state-of-practice and emerging trends[END_REF][START_REF] O'sullivan | Future directions in geothermal modelling[END_REF], consiste à prendre en compte les interactions entre le flux dans le milieu poreux et l'atmosphère. L'étude quantitative des eaux non profondes des sytèmes géothermiques est importante aussi bien pour l'exploration que pour la production des ressources géothermiques haute énergie. A propos de l'exploration, la zone insaturée et/ou les flux d'eau plus froids en superficie peuvent considérablement alté-rer les preuves de présence en profondeur de ressource géothermique. Dans certains cas, la ressource peut être totalement cachée. En terme d'exploitation, comme certains systèmes sont situés sous des zones urbanisées (par exemple Rotorua en Nouvelle-Zélande, ou Bouillante en Guadeloupe), l'exploitation des ressources doit être calibrée et surveillée pour éviter des conséquences indésirables en surface. De plus, certaines caractéristiques, telles que les geysers, ont une signification culturelle majeure pour la population indigène et doivent être protégées [START_REF] O'sullivan | Using reservoir models for monitoring geothermal surface features[END_REF].

Les logiciels actuels (tels que Tough2 [START_REF] O'sullivan | Further improvements in the convergence of Tough2 simulations[END_REF], utilisé depuis plus de 25 ans en géothermie) font face à plusieurs limitations en terme de conditions limites. Les conditions limites mixtes ne sont pas supportées, ce qui entrave la modélisation efficace de processus naturels tels que la recharge en eau douce, l'infiltration ou la fluctuation du niveau hydrostatique. Des solutions de contournement peuvent exister (voir [START_REF] Hurwitz | Groundwater flow, heat transport, and water table position within volcanic edifices: Implications for volcanic processes in the cascade range[END_REF]) mais sont relativement fastidieuses à implémenter et ne sont pas formulées de manière générique.

Dans les îles volcaniques, le niveau hydrostatique dans les terres peut être excessivement profond et les interactions entre la zone insaturée et la recharge en eau froide peut cacher des ressources géothermiques ( [START_REF] Byrdina | Influence of the regional topography on the remote emplacement of hydrothermal systems with examples of ticsani and ubinas volcanoes[END_REF][START_REF] Hurwitz | Groundwater flow, heat transport, and water table position within volcanic edifices: Implications for volcanic processes in the cascade range[END_REF]). Dans les bassins sédimentaires, les interactions avec la topographie et les zones de recharges doivent être correctement prises en compte pour reproduire la distribution des charges piézométriques à l'échelle du bassin [START_REF] Dentzer | Réévaluation du potentiel géothermique en ile de france[END_REF]. Bien que de nombreux logiciels de modélisation des écoulements souterrains peuvent simuler la zone insaturée, ils sont rarement conçus pour étudier les processus hydrothermaux multi-phasiques. Inversement, certains simulateurs de réservoirs géothermiques proposent de prendre en compte les composants air et eau [START_REF] O'sullivan | Improved convergence for air-water and co2-water tough2 simulations[END_REF] mais ils sont restreints par des conditions limites plutôt simples avec généralement la possibilité de fixer les valeurs pour toutes les variables primaires (condition limite de type Dirichlet), ou d'imposer des flux (condition limite de type Neumann) pour toutes les quantitées conservatives (voir [START_REF] Pruess | TOUGH2 user's guide, version 2[END_REF]).

Puisque le couplage entre le modèle poreux et un modèle 2D surfacique ou 3D atmosphérique n'est pas réaliste en terme de coût de calcul aux échelles spatiale et temporelle géologiques, l'objectif est de modéliser l'interaction sol-atmosphère grâce à une condition limite avancée prenant en compte l'équilibre de matière et d'énergie à l'interface entre le milieu poreux et l'atmosphère. Ce modèle considère une couche limite atmosphérique avec transfert convectif molaire et thermique (en supposant l'évaporation de la phase liquide), une condition de débordement liquide aux surfaces d'infiltration, ainsi que le rayonnement thermique et la recharge en eau douce due aux précipitations.

En supposant la vaporisation de la phase liquide à l'interface sol-atmosphère, les flux normaux molaire et thermique à l'interface du côté atmosphère sont souvent approximés en hydrogéologie par un flux deux-points entre la phase gaz à l'interface et à une hauteur de référence dans l'atmosphère [START_REF] Cui | Simulating the water content and temperature changes in an experimental embankment using meteorological data[END_REF][START_REF] Chalhoub | A simple heat and moisture transfer model to predict ground temperature for shallow ground heat exchangers[END_REF]. Les transmissibités de ces flux deux-points sont basées sur des coefficients de transfert convectif molaire et thermique. Cette approximation fait l'hypothèse que les variations latérales du vent, de la température de l'air et de l'humidité peuvent être négligées [START_REF] Vanderborght | Heat and water transport in soils and across the soil-atmosphere interface: 1. Theory and different model concepts[END_REF]. En se référant au manuel de météorologie [START_REF] Monteith | Principles of Environmental Physics[END_REF], le calcul des coefficients de transfert convectif molaire et thermique à l'interface sol-atmosphère peuvent dépendre de la rugosité de la surface du sol incluant les effets de la végétation, de la vitesse du vent, de la diffusivité des turbulences des courants d'air et de la stabilité de l'air au-dessus de la surface du sol chauffée. Le rayonnement qui est absorbé et émis par la surface du sol ainsi que la recharge due aux precipitations peuvent aussi être incorporés dans ces modèles [START_REF] Cui | Simulating the water content and temperature changes in an experimental embankment using meteorological data[END_REF][START_REF] Chalhoub | A simple heat and moisture transfer model to predict ground temperature for shallow ground heat exchangers[END_REF]. D'autre part, des conditions limites de débordement sont généralement appliquées en hydrogéologie aux surfaces d'infiltration permettant la décharge des écoulements souterrains aux endroits où le niveau hydrostatique intersecte un terrain en pente. Elles ont déjà été utilisées pour des applications géothermiques, comme dans [START_REF] Hurwitz | Groundwater flow, heat transport, and water table position within volcanic edifices: Implications for volcanic processes in the cascade range[END_REF] pour un modèle de Darcy diphasique monocomposant. Pour les équations de Richards, les conditions limites de sortie sont modélisées par des contraintes de complémentarité entre le flux liquide normal et la pression capillaire (voir [START_REF] Schweiser | Regularization of outflow problems in unsaturated porous media with dry regions[END_REF]). Pour les modèles de Darcy liquide-gaz, ils sont couplés avec une condition limite de Dirichlet sur la pression de gaz [START_REF] Lenzinger | Two-phase flow equations with outflow boundary conditions in the hydrophobic-hydrophilic case[END_REF].

Dans ce travail, les modèles d'évaporation et de débordement en phase liquide sont unifiés en une unique condition limite qui passe automatiquement de l'évaporation à l'évaporation couplée au débordement en phase liquide. Ce modèle suppose que la phase liquide ne s'accumule pas à l'interface du côté atmosphère, considérant qu'une condition limite d'eau stagnante telle qu'un lac ou une mer peut facilement être exprimée sous la forme d'une condition limite de Dirichlet. Alternativement, quand l'eau n'est pas stagnante, il faudrait modéliser l'écoulement de la phase liquide à la surface sol-atmosphère, ce qui n'est pas pris en compte ici, et pourrait induire un système ayant des échelles de temps différentes que le système géothermique sous-jacent. Notre condition limite est couplée avec le modèle de flux de Darcy gaz-liquide compositionnel thermique et la formulation est adaptée pour tenir compte de nouvelles inconnues et équations à l'interface sol-atmosphère. Les flux deux-points molaire et thermique dans l'atmosphère sont dérivés des conditions de transmission proposés dans [START_REF] Mosthaf | A coupling concept for two-phase compositional porous-medium and single-phase compositional free flow[END_REF] (voir aussi [START_REF] Masson | Coupling compositional liquid gas darcy and free gas flows at porous and free-flow domains interface[END_REF][START_REF] Vanderborght | Heat and water transport in soils and across the soil-atmosphere interface: 1. Theory and different model concepts[END_REF]) pour le couplage du flux de gaz dans un milieu libre et du flux de Darcy gazliquide compositionnel thermique. Les contraintes de complémentarité du débordement en phase liquide sont étendues aux flux compositionnels thermiques grâce à un critère basé sur l'équilibre thermodynamique entre les phases gaz et liquide à l'interface du côté atmosphère.

La thèse commence par un chapitre introduisant le modèle d'écoulements diphasiques compositionnels thermiques en milieux poreux avec l'étude de deux formulations. Puis le Chapitre 2 introduit une nouvelle méthodologie combinant des discrétisations centrées aux noeuds et aux faces. Le Chapitre 3 détaille la condition limite atmosphèrique. Cette condition limite est évaluée à l'aide d'une solution de référence couplant les écoulements non-isothermes liquide-gaz en milieu poreux et le gaz dans le milieu libre. Puis elle est étudiée numériquement en terme de convergence et de solution sur des cas tests géothermiques. Finalement, le schéma combinant des discrétisations centrées aux noeuds et aux faces est appliqué au cas test géothermique 2D du plan de faille de Bouillante avec la condition limite atmosphèrique. En annexe est détaillé un travail réalisé dans le cadre d'un projet collaboratif qui a eu lieu pendant l'école d'été du CEMRACS 2016. Il consistait à ajouter un modèle de puits au code ComPASS, un nouveau simulateur géothermique parallèle basé sur des maillages non-structurés avec la possibilité de prendre en compte les fractures.

La suite de cette introduction contient un court résumé en français de chaque chapitre.

Formulation des écoulements diphasiques compositionnels thermiques en milieux poreux : je considère un modèle de Darcy diphasique compositionnel thermique avec P = {l, g} l'ensemble des phases liquide et gaz. Chaque phase α ∈ P est un mélange de l'ensemble des composants noté C incluant typiquement un composant eau, noté w, qui peut se vaporiser et un ensemble de composants gazeux qui peuvent se dissoudre dans la phase liquide. Léquilibre locale du système est supposé, d'où l'introduction d'une seule température T . Pour chaque phase α, soient P α la pression et C α = (C α i ) i∈C les fractions molaires. L'équilibre thermodynamique entre la phase gaz et la phase liquide est supposé pour chaque composant et est donné par l'égalité des fugacités des phases notées f α (P α , T,C α ) = ( f α i (P α , T,C α )) i∈C , α ∈ P. Voir le tableau 3.5.2 pour l'ensemble des notations.

La simulation est basée sur des formulations adaptées au couplage non-linéaire entre l'équation de conservation molaire de chaque composant, la loi de conservation de l'énergie et les lois de fermetures hydrodynamiques et thermodynamiques. Une formulation largement utilisée en simulation réservoir est la formulation de Coats (aussi appelée formulation à variables naturelles) [START_REF] Coats | Implicit compositional simulation of single-porosity and dual-porosity reservoirs[END_REF][START_REF] Class | Numerical simulation of non-isothermal multiphase multicomponent processes in porous media.: 1. An efficient solution technique[END_REF][START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. Elle a l'avantage d'utiliser les variables physiques des lois thermodynamiques et hydrodynamiques comme inconnues principales. Son principal inconvénient est d'exiger une adaptation coûteuse de cet ensemble d'inconnues en fonction des phases présentes en chaque point de l'espace et du temps.

L'ensemble d'inconnues est défini par les pressions P g , P l , les saturations S g , S l et les fractions molaires C α , α ∈ Q où Q est l'ensemble des phases présentes en chaque point de l'espace et du temps. Dans notre modèle, Q prend l'une des valeurs suivantes {g, l}, {g} ou {l}, qui est généralement déterminée à l'aide d'un flash négatif [START_REF] Whitson | The negative flash[END_REF]. Cette formulation de Coats définit l'ensemble d'inconnues suivant

U Coats = Q, P g , P l , T, S g , S l ,C α , α ∈ Q .
Ainsi, les formulations à changement de système d'inconnues ont tendance à être coûteuses en calculs car elles impliquent qu'un système non-linéaire (de la taille de toutes les grandeurs thermodynamiques pertinentes pour les équations aux dérivées partielles) soit résolu localement [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF].

Dans le Chapitre 1 sont étudiées deux formulations à variables persistantes du modèle d'écoulements diphasiques compositionnels thermiques des flux de Darcy. Dans ces deux formulations, pour éviter un changement de variable, le choix des variables principales est combiné avec une extension des fractions molaires d'une phase absente par celles à l'équilibre thermodynamique avec la phase présente.

La première formulation, proposée dans [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF] dans le cas isotherme, est basée sur les pressions, la température, les saturations et les fugacités des composants comme ensemble de variables principales

U PSF = P α , T, S α , f , α ∈ C .
Des fractions molaires Cα (P α , T, f ) sont ensuite calculées comme l'unique solution du système

f α i (P α , T, Cα ) = f i , i ∈ C , α ∈ P.
Si la phase α est présente, ce qui est le cas quand S α > 0, les fractions molaires Cα coincident avec C α . Si la phase est absente, Cα définit une extension des fractions molaires C α . Cette extension peut être arbitraire car les fractions molaires sont toujours multipliées par la saturation ou la perméabilité relative qui sont nulles lorsque la phase est absente. De plus, le choix de cette extension permet d'exprimer l'équilibre thermodynamique simplement par une contrainte de complémentarité pour chacune des phases [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF]. Cette formulation est définie dès que les fugacités f = f α i (P α , T, Cα ) peuvent être inversées pour tout α ∈ P. L'inconvénient principal de cette première formulation (notée T-PSF par la suite) est d'augmenter la non-linéarité du modèle dans les zones monophasiques. Cela est dû à la dépendance non-linéaire des fractions molaires par rapport aux variables primaires, en particulier dans le cas non-isotherme. Cela explique l'introduction d'une deuxième formulation à variables persistantes qui regroupe les avantages de la formulation de Coats, en utilisant des variables naturelles comme inconnues principales, et de la formulation précédente.

La seconde formulation est basée, comme dans la formulation de Coats, sur les pressions, la température, les saturations et les fractions molaires

U PSC = P α , T, S α , Cα , α ∈ P .
C'est un choix pratique puisque toutes les lois physiques peuvent être directement exprimées à partir d'un sous-ensemble de cet ensemble de variables. C'est aussi un choix naturel dans les zones monophasiques qui sont généralement dominantes dans les applications géothermiques. Comme précédemment, et par opposition à la formulation de Coats, les fractions molaires d'une phase absente sont étendues par celles à l'équilibre thermodynamique avec la phase présente, au sens où l'égalité entre les fugacités f g (P g , T, Cg ) = f l (P l , T, Cl ) est toujours vérifiée. L'équilibre thermodynamique s'exprime comme précédemment par une simple contrainte de complémentarité pour chacune des phases. Cette formulation sera notée T-PSC.

Le Chapitre 1 décrit également la discrétisation spatiale de type Volumes Finis avec l'approximation deux points des flux (Two-Point Flux Approximation, noté TPFA). Dans ce cas le maillage doit respecter la condition d'admissibilité des schéma TPFA aussi bien sur les faces intérieures que les faces de bord. Le domaine peut être maillé avec des triangles aux angles aigus et avec une perméabilité isotrope, ou avec un maillage de Voronoi avec une perméabilité isotrope, ou encore un maillage Cartesien avec une perméabilité anisotrope dont l'anisotropie est alignée avec les axes. De plus les faces doivent être planaires. L'utilisation du schéma TPFA implique que l'ensemble des degrés de liberté de ce modèle

Ξ D = M ∪ F ext soit l'ensemble des mailles K ∈ M et des faces de bord σ ∈ F ext .
L'intégration en temps fait appel au schéma Euler implicite pour éviter des restrictions sévères sur le pas de temps. Un décentrage amont par phase est utilisé pour l'approximation des mobilités du flux de Darcy [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF][START_REF] Eymard | Finite volume methods[END_REF].

De plus, dans les deux formulations, les changements de phase peuvent être exprimés comme une contrainte de complémentarité par phase. C'est pourquoi les systèmes non-linéaires peuvent être résolus grâce à des techniques de semi-smoothed Newton telles que l'algorithme de Newton-min [START_REF] Kräutle | The semi-smooth newton method for multicomponent reactive transport with minerals[END_REF][START_REF] Ben Gharbia | Gas phase appearance and disappearance as a problem with complementarity constraints[END_REF]. Pour réduire la taille des systèmes linéaires résolus à chaque itération de Newton-min à #C + 1 équations et inconnues par degré de liberté ν ∈ Ξ D , l'ensemble d'inconnues est divisé en #C + 1 inconnues primaires et les inconnues secondaires restantes. De plus, la dernière étape de l'algorithme Newton-min permet de proposer différentes améliorations de l'algorithme de base. Ces améliorations consistent principalement à borner certaines inconnues et à imposer les contraintes de complémentarité min(U 1 ,U 2 ) = 0 à chaque itération du Newton. Différentes adaptations sont introduites et testées tout au long de cette thèse.

Ces formulations à variables persistantes sont comparées sur des simulations d'écoulements de Darcy diphasiques compositionnels thermiques appliquées au plan de faille géothermique de Bouillante. La convergence de l'algorithme de Newton est proche pour les deux formulations bien que la formulation T-PSF requiert une mise-à-jour non-linéaire plus compliquée pour obtenir la convergence du Newton. La formulation T-PSC est aussi un peu plus rapide en temps de calcul. C'est pourquoi cette formulation est choisie et le reste de la thèse s'interesse uniquement à la formulation T-PSC. Finalement, la convergence du schéma TPFA avec la formulation T-PSC est étudiée sur une solution stationnaire semi-analytique. Il s'agit d'un cas test 1D non-isotherme liquide-gaz avec l'eau comme seul composant.

Association des discrétisations VAG et HFV sur maillage hybride : dans le Chapitre 2, une nouvelle méthodologie est introduite combinant des discrétisations centrées aux noeuds (VAG) et aux faces (HFV) sur une partition arbitraire de mailles ou de faces, dans le but d'adapter le choix du schéma aux différentes parties du maillage. En effet, les maillages hybrides composés de différentes types de mailles sont plus adaptés à la discrétisation de la géologie et la géométrie des différents domaines d'un système géo-thermique. Ensuite le schéma peut être choisi localement en fonction de la géométrie de la maille et/ou de la géologie. Dans cette approche, le schéma TPFA est considéré comme un schéma HFV basé aux faces pour lequel les inconnues aux faces peuvent être éliminées à la condition que le maillage satisfasse la condition d'orthogonalité et que l'anisotropie soit alignée selon les axes du maillages (voir Lemme 2.1 de [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]).

Deux stratégies sont considérées pour coupler les discrétisations VAG et HFV pour des problèmes de diffusion du second ordre. La première est fondée sur une partition des mailles, chaque maille ayant des inconnues aux faces ou aux noeuds. La seconde approche peut être étendue à des partitions du maillage plus générales basées sur les faces, chaque face ayant une inconnue à la face ou des inconnues aux noeuds. Dans les deux cas le couplage est effectué à l'aide d'un opérateur d'interpolation des faces par les noeuds aux interfaces entre les deux schémas, interpolation qui doit être choisie pour assurer la consistence, la coercivité et la limite conformité du schéma combinant les discrétisations VAG et HFV. L'analyse de convergence est effectuée dans le cadre des discrétisations Gradient [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF][START_REF] Droniou | The Gradient discretization method: A framework for the discretization of linear and nonlinear elliptic and parabolic problems[END_REF] et la convergence est prouvée pour des partitions arbitraires des mailles ou des faces du maillage. Pour utiliser la partition sur les faces, une stabilisation additionnelle est nécessaire pour assurer la coercivité tandis que la coercivité de la méthode basée sur la partition des mailles est obtenue grâce à la présence des mailles VAG voisines. Ceci implique qu'uniquement la seconde construction peut être utilisée de manière autonome sur toutes les mailles du maillage. En effet, si toutes les faces sont avec des inconnues aux noeuds, la première construction donne une discrétisation non-stable tandis que la seconde construction (grâce à la stabilisation) conduit à la discrétisation VAG introduite dans [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF]. D'autre part, lorsque les conditions sont remplies pour que le schéma HFV dégénère en schéma deux-points TPFA, la première construction préserve le caractère deux-points des flux y compris aux mailles interfaces, ce qui n'est pas à priori le cas de la seconde construction. C'est l'un des avantages majeurs de la première construction.

La convergence des deux schémas est confirmée numériquement sur différents types de maillages et est comparée avec les discrétisations VAG d'un côté et HFV de l'autre.

A l'interface entre les discrétisations VAG et HFV, la méthodologie préserve les propriétés de conservation discrète des schémas VAG et HFV. C'est pourquoi l'extension de la discrétisation VAG-HFV à des flux de Darcy diphasiques peut être faite en associant des idées de [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF] pour la discrétisation VAG des flux de Darcy diphasiques et de [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF] pour celle du schéma HFV. Elle s'appuie sur l'écriture des fluxes discrets F Kν connectant chaque maille K à ses noeuds et/ou faces ν faisant partie de ses degrés de liberté. Un volume poreux est assigné à chaque maille et à chaque inconnue noeud [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF], ainsi les équations discrètes de conservation peuvent être écrites à chaque maille et à chaque inconnue noeud en utilisant les volumes poreux, les flux discrets F Kν et un décentrage amont des mobilités du flux de Darcy. Pour toutes les inconnues faces du schéma qui ne sont pas sur le bord du domaine, les équations de continuité du flux sont écrites pour chaque phase en suposant la continuité des mobilités, comme classiquement considéré pour la généralisation de la discrétisation TPFA [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF][START_REF] Peaceman | Fundamentals of Numerical Reservoir Simulations[END_REF]. La convergence est de nouveau évaluée numériquement sur différents types de maillages en comparaison avec les discrétisations VAG et HFV.

Ensuite la discrétisation combinant les deux schémas est étendue au cas des écoulements de Darcy diphasiques non-isothermes compositionnels. Cette extension s'appuie sur des travaux antérieurs qui ont considéré la discrétisation VAG des flux de Darcy diphasiques compositionnels isothermes [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF] et non-isothermes [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. La discrétisation HFV des écoulements de Darcy diphasiques isothermes compositionnels est décrite dans [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF]. L'extension du schéma VAG-HFV tire avantage de l'écriture de la discrétisation à l'aide des flux connectant chaque maille à ses degrés de liberté.

Enfin, la discrétisation VAG-TPFA a été appliquée au cas test 2D d'écoulement de Darcy liquide-gaz compositionnel thermique représentant le plan de faille vertical du réservoir géothermique de Bouillante. L'objectif est de comparer les résultats obtenus avec différents maillages et les différents schémas (VAG seul, TPFA seul et VAG-TPFA) par rapport à une solution numérique de référence calculée sur un maillage plus raffiné.

Le schéma VAG-TPFA sur maillage hybride (mélange de mailles Cartésiennes et triangles) montre le meilleur compromis entre précision et temps de calcul par rapport au schéma VAG sur un maillage triangle et au schéma TPFA sur un maillage de Voronoi.

Condition limite sol-atmosphère : le Chapitre 3 introduit une condition limite modélisant l'interaction entre le milieu poreux et l'atmosphère. Cette interaction est basée sur les équations de conservation molaire et thermique écrites à l'interface. Le modèle prend en compte deux processus de couplage : d'un côté la vaporisation de la phase liquide et les transferts convectifs molaire et thermique dans l'atmosphère, et d'un autre côté une condition de débordement en phase liquide. Ces deux comportements sont décrits dans une unique condition limite en supposant que la phase liquide ne s'accumule pas à l'interface du côté atmosphère. Le rayonnement thermique et la recharge en eau douce sont aussi considérés.

Les flux deux-points molaire et thermique dans l'atmosphère sont obtenus à partir des conditions de transmission proposés dans [START_REF] Mosthaf | A coupling concept for two-phase compositional porous-medium and single-phase compositional free flow[END_REF] (voir aussi [START_REF] Masson | Coupling compositional liquid gas darcy and free gas flows at porous and free-flow domains interface[END_REF][START_REF] Vanderborght | Heat and water transport in soils and across the soil-atmosphere interface: 1. Theory and different model concepts[END_REF]) pour le couplage du flux de gaz dans un milieu libre et du flux de Darcy liquide-gaz compositionnel thermique. Ces conditions assurent la continuité du flux normal molaire de chaque composant et du flux normal thermique, en supposant la vaporisation instantanée de la phase liquide ainsi que la continuité des fractions molaires du gaz, de la température et de la pression du gaz, negligeant le saut de la pression de gaz. Le système d'équations est complété par l'équilibre thermodynamique entre les phases liquide et gaz et par la condition de Beavers-Joseph.

Les flux normaux molaire et thermique à l'interface sont approchés par un flux deux-points entre l'interface du côté atmosphère et une hauteur de référence dans l'atmosphère. Les conditions atmosphériques loin du milieu poreux sont fixées par les fractions molaires du gaz C g,atm

∞

, la température T atm ∞ et la pression P atm . Les conditions de transmission permettent d'écrire que la température, les fractions molaires du gaz et la pression de gaz définies à l'interface du côté atmosphère correspondent à celles du côté milieu poreux et sont donc notées T , C g et P g . Les approximations deux-points tiennent compte des couches limites turbulentes du flux de gaz et du transport dans l'atmosphère à travers des coefficients de transfert convectif molaire H m et thermique H T . Ces coefficients dépendent généralement de la rugosité de la surface du sol incluant les effets de la végétation, de la vitesse du vent, de la diffusivité des turbulences des courants d'air et de la stabilité de l'air au-dessus de la surface du sol chauffée. L'utilisation de coefficients de transfert fait l'hypothèse que les variations latérales du vent, de la température de l'air et de l'humidité peuvent être négligées.

Les flux deux-points prennent également en compte les flux normaux convectifs utilisant, comme inconnue supplémentaire, le flux molaire de gaz q g,atm à l'interface du côté atmosphère orienté sortant du milieu poreux. Il est couplé avec un décentrage amont des fractions molaires du gaz et de l'enthalpie spécifique du composant eau du gaz, décentrage entre l'interface et les conditions atmosphériques en champ lointain. Ainsi les flux deux-points orientés sortant du milieu poreux s'écrivent

q g,atm i = (q g,atm ) + C g i + (q g,atm ) -C g,atm i,∞ + H m C g i -C g,atm i,∞
, i ∈ C , q g,atm e = (q g,atm ) + h g w (P g , T ) + (q g,atm ) -h g w (P atm , T atm

∞ ) + H T (T -T atm ∞ ),
où pour tout réel u, sont notés (u) + = max(0, u) et (u) -= min(0, u).

Les conditions de transmission négligent aussi les variations de pression dans l'atmosphère, ce qui permet d'écrire l'équation de continuité suivante sur la pression de gaz P g = P atm .

L'équilibre thermodynamique est toujours supposé à l'interface, dans le sens où, si la phase gaz est absente à l'interface du côté milieu poreux, les fractions molaires et la pression du gaz sont étendues par celles à l'équilibre avec la phase liquide. Tandis que la phase liquide peut apparaître ou disparaître selon la contrainte de complémentarité de la phase liquide.

La phase liquide est supposée se vaporiser instantanément en sortant du milieu poreux tant que l'atmosphère n'est pas saturée de vapeur d'eau. Dès que l'atmosphère est saturée en vapeur d'eau à l'interface, un débordement en phase liquide modélisé par les flux normaux molaire et thermique dans la phase liquide q l,atm i = C l i q l,atm , i ∈ C , q l,atm e = h l (P l , T,C l ) q l,atm , peut quitter le milieu poreux, où q l,atm ≥ 0 est une inconnue supplémentaire correspondant au flux molaire liquide total orienté sortant du milieu poreux.

Le flux molaire liquide sortant q l,atm est déterminé par la contrainte de complémentarité suivante, obtenu à partir de l'équilibre thermodynamique entre les phases liquide et gaz à l'interface du côté atmosphère (P g -P l ) q l,atm = 0, P g -P l 0, q l,atm 0.

Le rayonnement qui est absorbé et émis par la surface du sol peut aussi être ajouté au modèle dans l'équation de conservation de l'énergie. La recharge en eau douce est aussi intégrée dans les équations de conservation molaire et thermique.

Finalement, les modèles de débordement en phase liquide et de vaporisation sont unifiés en une unique condition limite, en faisant l'hypothèse que la phase liquide ne s'accumule pas à la surface. La condition limite sol-atmosphère est ainsi définie avec 7 + 2#C équations et l'ensemble de 7 + 2#C inconnues suivant U Γ atm = q g,atm , q l,atm , T, P α , S α ,C α , α ∈ P .

Pour valider numériquement le modèle introduit précédemment, sont comparées les solutions des écoulements de Darcy diphasiques thermiques couplés soit avec la condition limite sol-atmosphère, soit avec un modèle complet de type RANS (Reynolds Average Navier-Stokes) non-isotherme compositionnel dans le milieu libre. Dans ce dernier, les conditions de couplage à l'interface entre le milieu libre et le milieu poreux sont ceux introduit dans [START_REF] Mosthaf | A coupling concept for two-phase compositional porous-medium and single-phase compositional free flow[END_REF]. Elles supposent la vaporisation de la phase liquide dans le milieu libre, la continuité des fractions molaires du gaz et des flux normaux molaire et thermique, l'équilibre thermodynamique entre les phases liquide et gaz, la condition de non-glissement et la continuité de la composante normale de la contrainte normale. Le cas test considéré est un cas 2D tiré de [START_REF] Birgle | A domain decomposition method to couple non-isothermal compositional gas liquid darcy and free gas flows[END_REF] qui représente les échanges massique et thermique dans un stockage de déchets radioactifs en géologie profonde entre la formation géologique peu perméable et la gallerie de ventilation. Dans cette simulation, le milieu poreux initialement saturé en eau liquide est séché au voisinage de l'interface entre le milieu libre et le milieu poreux. La phase gaz pénètre dans le milieu poreux et la phase liquide est vaporisée dans le milieu libre. Ce cas test permet de valider la condition limite atmosphèrique lorsque le débordement en phase liquide est nul, i.e. q l,atm = 0. La condition limite sol-atmosphère est ensuite appliquée à des cas tests géothermiques 1D et 2D pour étudier la convergence non-linéaire du Newton-min et l'impact de la condition limite sur la solution physique. Les simulations 1D ont pour but d'analyser plus particulièrement l'apparition et la disparition du débordement en phase liquide.

Les cas tests 2D sont appliqués au domaine représentant le plan de faille dans le réservoir géothermique de Bouillante. Il s'agit de comparer les simulations obtenues avec la condition limite sol-atmosphère et celles avec une condition limite de Dirichlet. Les premiers cas tests sont exécutés avec deux composants (l'air et l'eau) puis avec trois composants en ajoutant le sel (sans tenir compte d'une éventuelle précipitation du composant sel).

Finalement, la condition limite atmosphèrique est appliquée sur un maillage hybride avec le schéma combinant la discrétisation VAG centrée aux noeuds et la discrétisation TPFA centrée aux faces.

Annexe -modèle et simulation de puits à branches multiples dans le code Com-PASS : en annexe est détaillé un travail réalisé dans le cadre d'un projet collaboratif qui a eu lieu pendant l'école d'été du CEMRACS 2016 avec Thibaud Beltzung * , Konstantin Brenner † , Simon Lopez ‡ , Roland Masson † , Farid Smai ‡ , Jean-Frédéric Thebault § et Feng Xing † [START_REF] Beaude | Parallel geothermal numerical model with fractures and multibranch wells[END_REF].

Le projet consistait à ajouter un modèle de puits multi-branche thermique au code ComPASS, un nouveau simulateur géothermique parallèle basé sur des maillages nonstructurés avec la possibilité de représenter des fractures comme des surfaces de codimension 1. La discrétisation Volumes Finis VAG a été choisie dans le code Com-PASS, discrétisation centrées aux noeuds et aux faces fractures. L'échelle spatiale du réservoir géothermique ne permet pas de capter la géométrie du puits dans sa section (rayon de l'ordre de 10 cm), c'est pourquoi chaque puits est modélisé par un terme source de Dirac le long de sa trajectoire 1D. Le puits est discrétisé comme un sousensemble d'arêtes du maillage ce qui permet de représenter facilement des puits déviés ou à branches multiples. Plusieurs tests numériques ont été implémentés pour valider ce modèle avec en particulier une simulation monophasique liquide non-isotherme des flux de Darcy sur une géométrie complexe incluant trois fractures s'intersectant, un puits d'injection dévié et un puits de production à branches multiples.

Chapter 1

Formulations of non-isothermal compositional two-phase Darcy flows

Abstract: in this chapter the non-isothermal compositional two-phase Darcy flow model is detailed with two persistent variable formulations. The first one (introduced in the isothermal case in [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF]) is based on the phase pressures, temperature, phase saturations and component fugacities (T-PSF) as set of principal variables. Our second formulation is based, like in the Coats' formulation, on the phase pressures, temperature, phase saturations and phase molar fractions (T-PSC). Both formulations avoid the switch of variables by extension of the phase molar fractions of an absent phase by the one at thermodynamic equilibrium with the present phase. It results that the set of principal variables and equations does not depend on the set of present phases. Then is introduced the Two-Point Flux Approximation (TPFA) discretization and the algorithm. Thanks to the choice of the formulations, the Newton-min algorithm is used to solve the non-linear system. Then the numerical efficiency of both formulations are compared to finally opt for the T-PSC formulation. To conclude this chapter, the convergence of the TPFA discretization is tested over a one dimensional semi-analytical stationary solution to validate the model.

Introduction

The simulation of compositional multi-phase Darcy flow in heterogeneous porous media plays a major role in many applications. In the oil and gas sector, compositional multi-phase Darcy flow simulations are paramount to predict and optimize reservoir production. In sedimentary basin modelling, such models are used to simulate the migration of hydrocarbon phases, over geological space and time scales, from source rock to traps in geological formations. In CO 2 geological storage, compositional multi-phase Darcy flow models allow optimizing the injection of CO 2 and to evaluate the integrity of the storage. Two-phase compositional Darcy flow models are used to study the gas migration and to assess the long term safety of nuclear waste storages. Finally, coup-ling such models with the energy conservation equation leads to practical applications for both exploration and production phases of geothermal operations.

Geothermal energy is a carbon-free steady energy source with low environmental impact (illustration in Figure 1). Indeed, compared to other renewable energy resources, high temperature geothermal energy does not depend on atmospheric conditions (sun, rain, wind). In countries with a favourable geological context, this energy can be an alternative to fossil energy both for power production and direct use, heat representing a large amount of the world final energy consumption. Consequently, the world installed capacity of geothermal fields has increased of about 17 percent between 2010 and 2015 and is expected to have doubled between 2010 and 2020 [START_REF] Bertani | Geothermics Geothermal power generation in the world 2010-2014 update report[END_REF]. On the French territory, it is already an attractive option in volcanic islands context compared to importing fossil fuel. In 2016, about 5 percent of yearly electricity consumption of Guadeloupe already came from geothermal energy. It is also essential for achieving energetic and environmental targets, according to which the overseas territories should produce 50 percent of their electricity consumption from renewable resources by 2020 and achieve their self sufficiency in 2030. As for other parts of the world, the geothermal development potential of the Caribbean islands is high and several industrial projects are under development or already underway, in French overseas territories (Guadeloupe, Martinique) as well as in nearby islands (Dominica, Montserrat, St. Kitts & Nevis, St Lucia, ...) that currently depend mainly on diesel for power generation. This thesis is performed in collaboration with the French Geological Survey BRGM to model the Bouillante high temperature geothermal field (Guadeloupe, French West Indies). A first drilling has been realised in 1984, three more production wells have been added in 2001, plus a new power plant in 2003 which allows this geothermal power plant to produce about 16MW since 2005. This installation significantly contributes to the security of the island's electricity supply, the reduction of its production cost and the reduction of greenhouse gas emissions [START_REF] Lachassagne | Hydrogeological model of a high energy geothermal field (Bouillante area, Guadeloupe, French West Indies)[END_REF]. The Bouillante reservoir is composed of two major fault families perpendicular to major regional tectonic structures. Most of the simulations in this thesis represent a vertical cross-section (illustrated in Figure 3) assumed to be in the plane of one major fault zone acting as a regional permeable drain.

Numerical modelling has become essential in all phases of geothermal operations. It is used in the exploration phases to assess the geothermal potential, validate conceptual hypothesis and help well siting. Field development and resource management need quantitative estimations to prevent resource exhaustion and achieve its sustainable exploitation (production/injection scenarios). Finally, numerical modelling is also helpful in studying exploitation related to industrial risks such as the interaction with shallow water levels (drinking water resources, hydrothermal vents or eruption) (e.g. [START_REF] O'sullivan | Using reservoir models for monitoring geothermal surface features[END_REF]). Various numerical models have been developed. In my case I consider a nonisothermal compositional liquid gas Darcy flow model, where each phase is a mixture of a set of components including typically a water component which can vaporize in the gas phase and a set of gaseous components which can dissolve in the liquid phase. A unique temperature is considered as the system is always assumed to be at local equilibrium. Moreover the thermodynamic equilibrium between the gas and liquid phases is assumed for each component. The simulation is based on formulations adapted to the non-linear coupling of the molar conservation equation of each component together with the energy conservation and hydrodynamic and thermodynamic closure laws.

Different formulations have been studied for isothermal and non-isothermal compositional Darcy flows. They basically differ by their choice of the principal unknowns and equations and by the way they deal with phase transitions, which is one of the main difficulty of this type of models. Let us distinguish between variable switch and persistent variable formulations. The first ones adapt the set of principal unknowns and equations to the set of present phases which can vary in space and time. The most well known formulation in this family is the so called natural variable or Coats' formulation widely used in reservoir simulations [START_REF] Coats | Implicit compositional simulation of single-porosity and dual-porosity reservoirs[END_REF][START_REF] Class | Numerical simulation of non-isothermal multiphase multicomponent processes in porous media.: 1. An efficient solution technique[END_REF][START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. It has the advantage to use the physical variables of the thermodynamic and hydrodynamic laws as the set of principal unknowns. Its main drawback is to require a cumbersome switch of this set of variables depending on the set of present phases at each point of the space time domain.

On the other hand, persistent variable formulations are based either on natural physical quantities such as overall component molar fractions or total specific enthalpy (see [START_REF] Voskov | Comparison of nonlinear formulations for two-phase multi-component eos based simulation[END_REF]), or alternatively on nonstandard principal variables such as in [START_REF] Bourgeat | Two-phase, partially miscible flow and transport modeling in porous media: application to gas migration in a nuclear waste repository[END_REF][START_REF] Marchand | Fully coupled generalized hybrid-mixed finite element approximation of two-phase two-component flow in porous media. Part I: formulation and properties of the mathematical model[END_REF]. Another strategy to avoid the switch of variables is based on the extension of some physical quantities such as the phase molar fractions like in [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF] using component fugacities, or the phase molar fractions and pressures like in [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF][START_REF] Masson | Formulations of two phase liquid gas compositional Darcy flows with phase transitions[END_REF][START_REF] Zhang | Modeling and simulation of ventilation devices in nuclear waste storage[END_REF]. Let us also mention the negative saturation formulations [START_REF] Abadpour | Method of negative saturations for modeling twophase compositional flow with oversaturated zones[END_REF][START_REF] Salimi | Negative saturation approach for nonisothermal compositional two-phase flow simulations[END_REF] belonging to this family. A comparison between some of these formulations can be found in [START_REF] Voskov | Comparison of nonlinear formulations for two-phase multi-component eos based simulation[END_REF][START_REF] Masson | Formulations of two phase liquid gas compositional Darcy flows with phase transitions[END_REF] in the case of isothermal compositional Darcy flows. In this chapter are detailed two persistent variable formulations of the non-isothermal compositional liquid gas Darcy flows model. The first formulation, proposed in the isothermal case in [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF], is based on the phase pressures, temperature, phase saturations and component fugacities as set of principal variables. To avoid the switch of variables, this choice of the principal variables is combined with the extension of the phase molar fractions by the one at thermodynamic equilibrium with the present phase. It results that the set of principal variables and equations does not depend on the set of present phases. This extension also allows expressing the thermodynamic equilibrium as a complementarity constraint by phase [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF]. The main drawback of this first formulation is to increase the non-linearity of the model in single phase zones due to the non-linear dependence of the phase molar fractions with respect to the primary variables, especially in the non-isothermal case. This motivates the introduction of the following second persistent variable formulation which combines the advantages of the Coats' formulation, using natural variables as principal unknowns, and of the previous formulation. Its set of principal variables are the phase pressures, the phase saturations, the temperature and the phase molar fractions. This is a convenient choice since all the physical laws can be directly expressed using subsets of this set of variables. It is also a very natural choice in single phase regions which are usually dominant in geothermal applications. As previously, the same extension of the phase molar fractions is used thus the phase transitions can be expressed as complementarity constraints. It implies that, for both persistent variable formulations, the non-linear systems can be solved using semi-smoothed Newton techniques such as the Newton-min algorithm [START_REF] Kräutle | The semi-smooth newton method for multicomponent reactive transport with minerals[END_REF][START_REF] Ben Gharbia | Gas phase appearance and disappearance as a problem with complementarity constraints[END_REF].

The standard industrial answer to cope with the strong coupling of both an elliptic (or parabolic) unknown, the pressure, and hyperbolic (or degenerate parabolic) unknowns, the volume and mole fractions, is based on finite volume spatial discretization, which is efficiently combined with an Euler implicit time integration to allow for sufficiently large time steps [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF][START_REF] Peaceman | Fundamentals of Numerical Reservoir Simulations[END_REF]. In this chapter I focus on the classical cell-centered Two-Point Flux Approximation (TPFA) widely used in industrial simulators. It is cheap and robust but its consistency requires strong orthogonality conditions on the mesh and the anisotropy to be aligned with the mesh directions. However, in Chapters 2 and 4 and in Section 3.4, others Finite Volume discretizations are considered which motivates to introduce a general mesh in the following.

The structure of this chapter is as follows. First the non-isothermal compositional two-phase Darcy flow model is detailed in Section 1.2 with the introduction of the two persistent variable formulations. Then is presented a general mesh and the finite volume two-point flux discretization of the model. Section 1.5 presents the Newton-min algorithm used to solve the fully coupled systems at each time step of the simulation. Follows the comparison of the numerical efficiency of both formulations. Finally, to validate the model, Section 1.7 contains a simplified one dimensional non-isothermal liquid gas model with a single water component to study the convergence of the TPFA scheme to a semi-analytical stationary solution.

Non-isothermal compositional two-phase Darcy flow model

Let us consider a non-isothermal compositional liquid gas Darcy flow model with P = {g, l} denoting the set of gas and liquid phases. Each phase α ∈ P is a mixture of a set of components denoted by C including typically a water component, denoted w, which can vaporize in the gas phase and a set of gaseous components which can dissolve in the liquid phase. The thermodynamic properties of each phase α ∈ P depend on its pressure P α , the local equilibrium temperature of the system T and its molar fractions

C α = (C α i ) i∈C .
For each phase α ∈ P, let us denote its molar density by ζ α (P α , T,C α ), its mass density by ρ α (P α , T,C α ), its dynamic viscosity by µ α (P α , T,C α ), its molar internal energy by e α (P α , T,C α ) and its molar enthalpy by h α (P α , T,C α ). For the gas phase, assuming an ideal mixture, the molar enthalpy is defined by

h g (P g , T,C g ) = ∑ i∈C C g i h g i (P g , T ) (1.2.1)
where h g i (P g , T ) is the molar enthalpy of the component i in the gas phase. Thermodynamic equilibrium between the gas and liquid phases is assumed for each component and governed by the phase fugacities denoted by

f α (P α , T,C α ) = ( f α i (P α , T,C α )) i∈C , α ∈ P.
The rock porosity is denoted by φ (x) and the rock permeability tensor by Λ Λ Λ(x) where x denotes the spatial coordinates. We introduce the rock energy per unit rock volume defined by E r (T ). The hydrodynamic Darcy laws are characterized by the relative permeability k α r (x, S α ) of each phase α ∈ P, as a function of the phase saturation S α , and by the capillary pressure P c (x, S g ) = P g -P l . The dependence of the relative permeabilities and capillary pressure on x, which is piecewise constant for each rocktype, is usually omitted in the following for the sake of simplicity.

The simulation is based on formulations adapted to the non-linear coupling of the molar conservation equation of each component together with the energy conservation and hydrodynamic and thermodynamic closure laws.

Two persistent variable formulations

Various formulations with different choice of principal unknowns and equations and ways to deal with phase transitions have been studied for isothermal and non-isothermal compositional Darcy flows. The objective of such a choice is usually to reduce the non-linearity of the successive non-linear systems that typically arise when solving a transient problem with an Euler fully implicit time integration scheme.

Let us first present shortly the most well known variable switch formulation which is the so called natural variable or Coats' formulation widely used in reservoir simulations [START_REF] Coats | Implicit compositional simulation of single-porosity and dual-porosity reservoirs[END_REF][START_REF] Class | Numerical simulation of non-isothermal multiphase multicomponent processes in porous media.: 1. An efficient solution technique[END_REF][START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. It has the advantage to use the physical variables of the thermodynamic and hydrodynamic laws as the set of principal unknowns. Its main drawback is to require a cumbersome switch of this set of variables depending on the set of present phases at each point of the space time domain because it adapts the set of principal unknowns and equations to the set of present phases. The set of unknowns is defined by the phase pressures P g , P l , the phase saturations S g , S l and the phase molar fractions C α for α ∈ Q where Q is the set of present phases at each point of the time space domain. In this model, Q takes the following possible values {g, l} or {g} or {l} which is usually determined using a negative flash computation [START_REF] Whitson | The negative flash[END_REF]. This natural variable formulation defines the following set of unknowns

U Coats = Q, P g , P l , T, S g , S l ,C α , α ∈ Q . (1.2.2)
Let n i (U Coats ) be the number of moles of the component i ∈ C per unit pore volume defined by

n i (U Coats ) = ∑ α∈Q ζ α S α C α i , i ∈ C , (1.2.3)
and let us introduce the component total molar fractions

z i (U Coats ) = ∑ α∈Q ζ α S α C α i ∑ α∈Q ζ α S α , i ∈ C . (1.2.4)
Let us introduce the fluid energy per unit pore volume defined by

E f (U Coats ) = ∑ α∈Q ζ α S α e α . (1.2.5)
Let us denote by g the gravitational acceleration vector. The generalized Darcy velocity of the phase α ∈ Q is given by

q α = - k α r µ α Λ Λ Λ(x) ∇P α -ρ α g . (1.2.6)
The total molar flux of the component i ∈ C is denoted by q i and the energy flux by q e , with

q i = ∑ α∈Q C α i ζ α q α , q e = ∑ α∈Q h α ζ α q α -λ ∇T, (1.2.7)
where λ stands for the bulk thermal conductivity of the fluid and rock mixture.

The system of equations accounts for the molar conservation of each component i ∈ C together with the energy conservation

φ (x)∂ t n i + div(q i ) = 0, i ∈ C , φ (x)∂ t E f + (1 -φ (x))∂ t E r + div(q e ) = 0. (1.2.8)
It is complemented by the following capillary relation between the two phase pressures, the pore volume balance and the equality of the gas and liquid fugacities of each component if both phases are present

                     P c (S g ) = P g -P l , ∑ α∈Q S α = 1, S α = 0, α ∈ P \ Q, ∑ i∈C C α i = 1, α ∈ Q, f g i (P g , T,C g ) = f l i (P l , T,C l ), i ∈ C , if Q = {g, l}.
(1.2.9)

The negative flash consists, at fixed temperature T , fixed pressures P g , P l and fixed component total molar fractions z i , i ∈ C , in finding the gas phase molar fraction θ g ∈ R (which can be negative) and the liquid and gas molar fractions Cg , Cl satisfying the thermodynamic equilibrium

                     z i = θ g Cg i + (1 -θ g ) Cl i , i ∈ C , ∑ i∈C Cg i = 1, ∑ i∈C Cl i = 1, Cg i ≥ 0, Cl i ≥ 0, i ∈ C , f g i (P g , T, Cg ) = f l i (P l , T, Cl ), i ∈ C .
The sign of the gas phase molar fraction θ g determines the set of present phases

     Q = {l} if θ g ≤ 0, Q = {g} if θ g ≥ 1, Q = {g, l} otherwise.
Hence variable switch formulations tend to be computationally expensive because they imply that a non-linear system of equations of the size of all thermodynamic quantities relevant for the partial differential equations needs to be solved locally [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF].

On the other hand, persistent variable formulations avoid the switch of variables and one strategy is based on the extension of some physical quantities. In the following are detailed two persistent variable formulations of the non-isothermal compositional two-phase Darcy flows model. The first formulation, proposed in the isothermal case in [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF], is based on the phase pressures, temperature, phase saturations and component fugacities as set of principal variables. Our second formulation is based, like in the Coats' formulation, on the phase pressures, temperature, phase saturations and phase molar fractions. In both formulations, to avoid the switch of variables, this choice of the principal variables is combined with the extension of the phase molar fractions by the one at thermodynamic equilibrium with the present phase. It results that the set of principal variables and equations does not depend on the set of present phases.

Pressures, saturations, temperature and fugacities formulation (T-PSF)

Let us apply the persistent variable formulation (denoted T-PSF), introduced in [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF] in the isothermal case, where the set of unknowns is based on the phase pressures, temperature, phase saturations and phase component fugacities

U PSF = P α , T, S α , f , α ∈ C (1.2.10) with f = ( f i ) i∈C .
Phase molar fractions Cα (P α , T, f ) are then computed as the unique solution of the system

f α i (P α , T, Cα ) = f i , i ∈ C , α ∈ P.
If the phase α is present, which is the case when S α > 0, the component phase molar fractions Cα coincide with C α . If the phase α is absent, Cα defines an extension of the component phase molar fractions C α . This extension can be arbitrary as the phase molar fractions are always in factor of the saturation or the relative permeability which are both null for an absent phase. On the other hand, this extension allows expressing the thermodynamic equilibrium as complementarity constraints. This formulation is defined as soon as the fugacities f α i (P α , T, Cα ) can be inverted for all α ∈ P.

It results that the set of principal variables does not depend on the set of present phases. Then, in this formulation, definitions (1.2.3) and (1.2.5) are independent of the set of present phase and become

       n i (U PSF ) = ∑ α∈P ζ α S α Cα i , i ∈ C , E f (U PSF ) = ∑ α∈P ζ α S α e α .
The generalized Darcy velocity (1.2.6), the total molar flux q i and the energy flux q e (1.2.7) are also defined for all phases α ∈ P by

q α = - k α r µ α Λ Λ Λ(x) ∇P α -ρ α g , q i = ∑ α∈P Cα i ζ α q α , q e = ∑ α∈P h α ζ α q α -λ ∇T.
With these new definitions, the system of equations (1.2.8) remains

φ (x)∂ t n i + div(q i ) = 0, i ∈ C , φ (x)∂ t E f + (1 -φ (x))∂ t E r + div(q e ) = 0. (1.2.11)
It is complemented by the following capillary relation between the two phase pressures and the pore volume balance

   P c (S g ) = P g -P l , ∑ α∈P S α = 1.
(1.2.12)

In the spirit of [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF][START_REF] Masson | Formulations of two phase liquid gas compositional Darcy flows with phase transitions[END_REF], the liquid gas thermodynamic equilibrium can be expressed as the following complementarity constraints for each phase α ∈ P

S α ≥ 0, 1 -∑ i∈C Cα i ≥ 0, S α (1 -∑ i∈C Cα i ) = 0, α ∈ P. (1.2.13)
Let us refer to [START_REF] Zhang | Modeling and simulation of ventilation devices in nuclear waste storage[END_REF] for the proof that this formulation leads to an equivalent definition of the phase transitions than the Coats' formulation in the isothermal case, if the fugacities can be inverted.

The main drawback of this first formulation is to increase the non-linearity of the model in single phase zones. This is due to the non-linear dependence of the phase molar fractions with respect to the primary variables, especially in the non-isothermal case. For instance, in the case of two components, the water w and the air a, the fugacity functions are chosen as follows (see Table 3.5.2 for the other notations)

         f g i (P g , T, Cg ) = Cg i P g , i = a, w, f l a (P l , T, Cl ) = Cl a H a , f l w (P l , T, Cl ) = Cl w P sat (T ) exp - P sat (T ) -P l 1000RT /0.018 ,
having in mind that the phase molar fractions Cα are obtained as the unique solution of the system

f α i (P α , T, Cα ) = f i , i ∈ C , α ∈ P.
This motivates the introduction of the following second persistent variable formulation which combines the advantages of the Coats' formulation, using natural variables as principal unknowns, and of the previous formulation.

Pressures, saturations, temperature and molar fractions formulation (T-PSC)

Our second persistent variable formulation is based, like in the Coats' formulation, on the phase pressures, phase saturations, temperature and phase molar fractions as set of principal variables

U PSC = P α , T, S α , Cα , α ∈ P . (1.2.14)
This is a convenient choice since all the physical laws can be directly expressed using subsets of this set of variables. It is also a very natural choice in single phase regions which are usually dominant in geothermal applications. Note that, as opposed to the Coats' variable switch formulation, the phase molar fractions Cα of an absent phase α are extended by the ones at equilibrium with the present phase in the sense that the equality of the gas and liquid fugacities f g (P g , T, Cg ) = f l (P l , T, Cl ) always holds.

The system of equation (1.2.11) remains

φ (x)∂ t n i + div(q i ) = 0, i ∈ C , φ (x)∂ t E f + (1 -φ (x))∂ t E r + div(q e ) = 0. (1.2.15)
It is still complemented by the capillary relation and the pore volume balance

   P c (S g ) = P g -P l , ∑ α∈P S α = 1. (1.2.16)
As previously, the liquid gas thermodynamic equilibrium is expressed as complementarity constraints for each phase α ∈ P and is combined with the equality of the gas and liquid fugacities of each component

   S α ≥ 0, 1 -∑ i∈C Cα i ≥ 0, S α (1 -∑ i∈C Cα i ) = 0, α ∈ P, f g i (P g , T, Cg ) = f l i (P l , T, Cl ), i ∈ C .
(1.2.17)

To simplify the notations, in the remaining no difference will be made between the phase molar fractions and the extended one, thus Cα will be denoted by C α .

In the two persistent variable formulations, since the phase transitions can be expressed as complementarity constraints, the non-linear systems can be solved using semi-smoothed Newton techniques such as the Newton-min algorithm [START_REF] Kräutle | The semi-smooth newton method for multicomponent reactive transport with minerals[END_REF][START_REF] Ben Gharbia | Gas phase appearance and disappearance as a problem with complementarity constraints[END_REF]. As detailed in Section 1.5, in order to reduce the size of the linear systems to be solved at each Newton-min iteration, the set of unknowns is split into primary and secondary unknowns at each degree of freedom. The secondary unknowns to be eliminated using the local closure laws are chosen accordingly to the set of present phase.

Let us remark that both formulations give exactly the same result at convergence with the same time step, i.e. each solution of one formulation is also solution of the other. In particular because the extension of the phase molar fractions of an absent phase has no impact on the simulation (it is always multiplied by a null factor).

Polyhedral mesh

Some characteristics of the mesh rely on the discretization scheme, such as the admissibility condition for the TPFA scheme. Let us introduce here a general mesh which will be adapted when necessary.

Let Ω denote a bounded polytopal domain of R d (polygonal for d = 2 or polyhedral for d = 3). Let us denote by M the set of cells that are disjoint open polytopal subsets of Ω such that K∈M K = Ω. Let x K be the so-called "center" of the cell K assuming that K is star-shaped with respect to x K . The d-dimensional Lebesgue measure of K is denoted by |K|.

For K ∈ M , let us define F K , the set of interfaces of non-zero d -1 dimensional Lebesgue measure among the interior interfaces K ∩ L, L ∈ M and the boundary interfaces K ∩ ∂ Ω. To fix ideas, these interfaces are termed "faces" in the remaining, whatever the dimension d = 2, 3. Let us define the set of faces

F = K∈M F K ,
and denote by |σ | the d -1 dimensional Lebesgue measure of σ ∈ F . In the following, we will use the notation

M σ = {K ∈ M | σ ∈ F K },
and for all σ ∈ F , a so-called "center" of the face is chosen such that x σ ∈ σ . Let us denote by F ext the boundary faces of the domain such that

Ω \ Ω = σ ∈F ext σ .
Let [START_REF] Eymard | Finite volume methods[END_REF][START_REF] Droniou | Finite volume schemes for diffusion equations: introduction to and review of modern methods[END_REF] combined with a phase based upwind scheme for the approximation of the mobilities [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF][START_REF] Eymard | Finite volume methods[END_REF]. A mesh satisfying the following admissibility condition of TPFA schemes at both inner and boundary faces is used

(x K x L ) ⊥ σ for all σ ∈ F int with M σ = {K, L}, (x K x σ ) ⊥ σ for all σ ∈ F ext with M σ = {K}.
It can be typically a triangular mesh with acute angles with isotropic permeability, a Voronoi mesh with isotropic permeability or a Cartesian mesh with anisotropic permeability aligned with the axes. In all cases the permeability is assumed cellwise constant. The faces are also assumed to be planar.

The time integration is based on a fully implicit Euler scheme to avoid severe restrictions on the time steps. For N t f ∈ N * , let us consider the time discretization

t 0 = 0 < t 1 < • • • < t n-1 < t n < • • • < t N t f = t f of the time interval [0,t f ].
We denote the time steps by

∆t n = t n -t n-1 for all n = 1, • • • , N t f .
The degrees of freedom of the TPFA scheme is the set Ξ D = M ∪ F ext of all cells K ∈ M and of boundary faces σ ∈ F ext . This geometrical discretization of the domain Ω is denoted in the following by D.

Let us denote the set of physical unknowns for both formulations by

U PSF ν = P α ν , T ν , S α ν , f ν , α ∈ P , U PSC ν = P α ν , T ν , S α ν ,C α ν , α ∈ P , (1.4.1)
for each degree of freedom ν ∈ Ξ D . The full sets of unknowns are denoted by

U PSF D = {U PSF ν , ν ∈ Ξ D }, U PSC D = {U PSC ν , ν ∈ Ξ D }. (1.4.2)
When it is not necessary to distinguish between both formulations, the full set of unknowns will be denoted by U D for the sake of simplicity.

Let us define, for each phase α ∈ P, the finite volume TPFA Darcy flux through the face σ ∈ F K outward to the cell K ∈ M taking into account the gravity term by

F α Kσ = |σ |Λ Λ Λ Kσ P α K -P α Kσ d Kσ + ρ α Kσ |g| z K -z Kσ d Kσ (1.4.3)
where

d Kσ = dist(x K , x L ) if M σ = {K, L}, dist(x K , x σ ) if M σ = {K}, P α Kσ = P α L if M σ = {K, L}, P α σ if M σ = {K}, z Kσ = z L if M σ = {K, L}, z σ if M σ = {K}.
The phase mass density at the face σ is defined by the average

ρ α Kσ =        ρ α (P α K , T K ,C α K ) + ρ α (P α L , T L ,C α L ) 2 if M σ = {K, L}, ρ α (P α K , T K ,C α K ) + ρ α (P α σ , T σ ,C α σ ) 2 if M σ = {K}.
The face rock permeability as well as the face thermal conductivity of the fluid and rock mixture used for the Fourier fluxes are defined by their harmonic average

Λ Λ Λ Kσ =        dist(x K , x L ) dist(x K ,σ ) n Kσ •Λ Λ Λ(x K )•n Kσ + dist(x L ,σ ) n Lσ •Λ Λ Λ(x L )•n Lσ if M σ = {K, L}, n Kσ •Λ Λ Λ(x K ) • n Kσ if M σ = {K}, λ Kσ =        dist(x K , x L ) dist(x K ,σ ) λ (x K ) + dist(x L ,σ ) λ (x K ) if M σ = {K, L}, λ (x K ) if M σ = {K}.
The discretization of the mobility m α i = C α i kr α µ α ζ α for i ∈ C is obtained using the usual phase-by-phase upwinding (see e.g. [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF])

m α i,Kσ =          C α i,K kr α (S α K ) µ α (P α K , T K ,C α K ) ζ α (P α K , T K ,C α K ) if F α Kσ 0, C α i,ν kr α (S α ν ) µ α (P α ν , T ν ,C α ν ) ζ α (P α ν , T ν ,C α ν ) otherwise, where ν = L if M σ = {K, L} and ν = σ if M σ = {K}.
With the same notations, let us also introduce the upwind discretization of the energy mobility

m α e,Kσ =          h α (P α K , T K ,C α K ) kr α (S α K ) µ α (P α K , T K ,C α K ) ζ α (P α K , T K ,C α K ) if F α Kσ 0, h α (P α ν , T ν ,C α ν ) kr α (S α ν ) µ α (P α ν , T ν ,C α ν ) ζ α (P α ν , T ν ,C α ν ) otherwise.
Using these upwind discretizations, for each face which does not belong to the Neumann boundary σ ∈ F K \ F N , the component molar flux is given by

q i,Kσ (U D ) = ∑ α∈P m α i,Kσ F α

Kσ

for i ∈ C and the energy flux by

q e,Kσ (U D ) = ∑ α∈P m α e,Kσ F α Kσ + |σ |λ Kσ T K -T Kσ d Kσ ,
with

T Kσ = T L if M σ = {K, L}, T σ if M σ = {K}.
For each Neumann face σ ∈ F K ∩ F N , the component molar flux and the energy flux are defined equal to zero and the unknowns U σ are not determined as they are not necessary q i,Kσ (U D ) = 0, q e,Kσ (U D ) = 0.

Let us now introduce the cell porous volume

ϕ K = K φ (x)dx,
and its complementary volume φK = |K|ϕ K , K ∈ M .

We can now state the system of discrete equations at each time step n = 1, • • • , N t f which accounts for the component and energy conservations equations (1.2.11) and (1.2.15)

in each cell K ∈ M R i,K (U n D ) = ϕ K n i (U n K ) -n i (U n-1 K ) ∆t n + ∑ σ ∈F K q i,Kσ (U n D ) = 0, for i ∈ C , R e,K (U n D ) = ϕ K E f (U n K ) -E f (U n-1 K ) ∆t n + φK E r (U n K ) -E r (U n-1 K ) ∆t n + ∑ σ ∈F K q e,Kσ (U n D ) = 0.
(1.4.4) It is coupled with the local closure laws for ν ∈ M , closure laws (1.2.12) and (1.2.16) which depend on the formulation

0 = L ν (U PSF,n ν ) =              P c (S g,n ν ) = P g,n ν -P l,n ν , ∑ α∈P S α,n ν = 1, min(S α,n ν , 1 -∑ i∈C C α,n i,ν ) = 0, α ∈ P, (1.4.5
)

0 = L ν (U PSC,n ν ) =                  P c (S g,n ν ) = P g,n ν -P l,n ν , ∑ α∈P S α,n ν = 1, min(S α,n ν , 1 -∑ i∈C C α,n i,ν ) = 0, α ∈ P, f g i (P g,n ν , T n ν ,C g,n ν ) = f l i (P l,n ν , T n ν ,C l,n ν ), i ∈ C , (1.4.6)
where the min function formulation of the complementarity constraints is used having in mind the Newton-min algorithm as non-linear solver described in the following section.

The system is closed with the Dirichlet boundary conditions

U n σ = U σ ,D ,
for all σ ∈ F D , where U σ ,D are the imposed variables at the Dirichlet face σ which depend on the formulation.

Algorithm and Newton-min non-linear solver

For each degree of freedom ν ∈ M , let us denote by R ν (U D ) the residual vector R i,ν (U D ), i ∈ C ∪ {e} and let us rewrite the conservation equation (1.4.4) and the closure laws ((1.4.5) or (1.4.6) depending on the formulation) in vector form defining the following non-linear system at each time step n = 1, 2, ...,

N t f 0 = R(U D ) = R K (U D ) L K (U K ) K ∈ M , (1.5.1)
where the superscript n has been dropped. The Dirichlet and Neumann faces are not included because they are not unknowns of the system (the Dirichlet faces are fixed and the Neumann faces are not determined as their values are not used).

The non-linear system R(U D ) = 0 is solved using a Newton-min solver [START_REF] Kräutle | The semi-smooth newton method for multicomponent reactive transport with minerals[END_REF][START_REF] Ben Gharbia | Gas phase appearance and disappearance as a problem with complementarity constraints[END_REF] as detailed below. In order to reduce the size of the linear systems to be solved at each Newton-min iteration to #C +1 equations and unknowns for each cell ν ∈ M , the set of unknowns U ν is split into #C + 1 primary unknowns U p ν and the remaining secondary unknowns U s ν . This splitting is done for each degree of freedom (here for each cell as the boundary conditions are Dirichlet or Neumann) in such a way that the Jacobian of the local closure laws ∂ L ν ∂U s ν (U ν ) with respect to the secondary unknowns is non singular.

The Newton-min algorithm is initialized with an initial guess U (0) D usually given by the previous time step solution and iterates on the following steps for r = 0, • • • , until the following stopping criterion is satisfied

max i∈C ∪{e}    ∑ ν∈M |R i,ν (U (r) D )| ∑ ν∈M |R i,ν (U (0) D )|    ≤ ε R or dim(X) ∑ i=1    max ν∈M |dX (r) ν,i | ∆X i    + dim(X Γ ) ∑ i=1    max ν∈F ext |dX (r) ν,i | ∆X i    ≤ ε X with dX (r) ν,i = dX p (r) ν,i if i is a primary unknown, dX s (r) ν,i if i is a secondary unknown, and ε R = 10 -8 , ε U = 10 -6 , given ∆U i > 0, i = 1, • • • , dim(U ν ),
A sp (r) ν = - ∂ L ν ∂U s (r) ν -1 ∂ L ν ∂U p (r) ν , B s (r) ν = ∂ L ν ∂U s (r) ν -1 L ν ,
and such that dU

s (r) ν = A sp (r) ν dU p (r) ν + B s (r) ν , (1.5.2)
are computed to obtain the reduced Jacobian

J (r) = (J (r) ν,ν ) (ν,ν )∈(M ) 2 defined by the square matrices of size #C + 1 J (r) ν,ν = ∂ R ν ∂U p (r) ν (U (r) D ) + ∂ R ν ∂U s (r) ν (U (r) D )A sp (r) ν
, and the reduced right hand side

B (r) = (B (r) ν ) ν∈M defined by the vectors of size #C + 1 B (r) ν = -R ν (U (r) D ) -∑ ν ∈M ∂ R ν ∂U s (r) ν (U (r) D )B s (r) ν .
2. Computation of the solution of the reduced linear system

J (r) dU p (r) D = B (r) .
(1.5.3)

Update of the unknowns

U (r) ν , ν ∈ M with a possible relaxation θ (r) ∈ (0, 1]    U p (r+1) ν = U p (r) ν + θ (r) dU p (r) ν , U s (r+1) ν = U s (r) ν + θ (r) A sp (r) ν dU p (r) ν + B s (r) ν .
(1.5.4)

4. Additional updates of some unknowns in order to satisfy exactly some non-linear closure laws to be specified in the following paragraphs.

Table 1.5.1 -Choice of the primary unknowns depending on the active complementarity constraints of the Newton-min algorithm with the T-PSF formulation.

ν ∈ M 1 -∑ i∈C C g i,ν = 0 U p,PSF ν = P g ν , S g ν , ( f i,ν ) i=1,#C -1 1 -∑ i∈C C l i,ν = 0 S g ν = 0 U p,PSF ν = P g ν , T ν , ( f i,ν ) i=1,#C -1 1 -∑ i∈C C l i,ν = 0 1 -∑ i∈C C g i,ν = 0 U p,PSF ν = P g ν , T ν , ( f i,ν ) i=1,#C -1 S l ν = 0 Table 1.5.
2 -Choice of the primary unknowns depending on the active complementarity constraints of the Newton-min algorithm with the T-PSC formulation.

ν ∈ M 1 -∑ i∈C C g i,ν = 0 U p,PSC ν = P g ν , S g ν , (C l i,ν ) i=1,#C -1 1 -∑ i∈C C l i,ν = 0 S g ν = 0 U p,PSC ν = P g ν , T ν , (C l i,ν ) i=1,#C -1 1 -∑ i∈C C l i,ν = 0 1 -∑ i∈C C g i,ν = 0 U p,PSC ν = P g ν , T ν , (C g i,ν ) i=1,#C -1 S l ν = 0 1.

Numerical comparison of the two formulations

To compare their numerical performances, both formulations are applied on compositional non-isothermal liquid gas Darcy flow simulations with the set of water and air components C = {a, w}.

The porous medium is homogeneous with porosity φ (x) = 0.35 and isotropic permeability Λ Λ Λ(x) = K × I with K = 1 D. The relative permeabilities plotted in Figure 2.4.4 are defined by k α r (S α ) = (S α ) 2 for each phase α ∈ P and the capillary pressure function is given by the Corey law

P c (S g ) =    -b ln(1 -S g ) if 0 ≤ S g ≤ S 1 , -b ln(1 -S 1 ) + b 1 -S 1 (S g -S 1 ) if S 1 < S g ≤ 1,
regularized for S g ∈ (S 1 , 1] to allow for the disappearance of the liquid phase, with b = 2 • 10 5 Pa and S 1 = 0.99. The rock energy per unit rock volume is fixed to E r (T ) = 2 • 10 6 T in J. m -3 and the bulk thermal conductivity of the fluid and rock mixture is fixed to λ

= 3 W. m -1 . K -1 .
The gas thermodynamic laws are defined by the perfect gas molar density ζ g = P g RT , with R = 8.314 J. K -1 . mol -1 and the viscosity µ g = (0.361T -10.2) 10 -7 in Pa. s. The liquid molar enthalpy h l and the gas molar enthalpies of each component h g a , h g w are taken from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF]. The gas molar enthalpy is then defined by (1.2.1). The liquid molar density and viscosity are also from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF] and defined by

ζ l = (780.9 + 1.6 T -3.1 10 -3 T 2 )(1 + 0.7 C s ) 0.018 , µ l = (1 + 1.34 C s + 6.12 C 2 s ) 10 -3 0.02(T -273 -8.4 + 8078.4 + (T -273 -8.4) 2 ) -1.2 ,
with the salinity fixed to C s = 35 10 -3 kg. kg -1 . The mass density is defined by

ρ α = ∑ i∈C C α i m i ζ α
with the molar masses m a = 0.029 and m w = 0.018 kg. mol -1 . The vapour pressure P sat (T ) is given by the Clausius-Clapeyron equation

P sat (T ) = 100 exp 46.8 - 6435 T -3.9 log(T ) ,
and the Henry constant of the air component is set to H a = 10 8 Pa. The molar internal energy of each phase is considered to be equal to its enthalpy. Finally, the fugacities are given by Dirichlet: Linear temperature with 278 K at the top and 400 K at the bottom, P l hydrostatic,

     f g i (P g , T,C g ) = C g i P g , i = a, w, f l a (P l , T,C l ) = C l a H a , f l w (P l , T,C l ) = C l w P sat (T ) exp -P sat (T )-P l 1000RT /0.018 .
S l = 1, C l w = 1
Dirichlet: Linear temperature with 278 K at the sea level and 400 K at the bottom, P l hydrostatic,

S l = 1, C l w = 1
Dirichlet: Linear temperature with 300 K at the surface of the sea and 278 K at 100 m deep,

P l hydrostatic, S l = 1, C l w = 1 Dirichlet: T = 300 K, P g = 1 atm, S g = 1, C g a 0.
99 The two dimensional test case illustrated in Figure 1.6.1 represents a simplified two dimensional cut of the Bouillante geothermal reservoir. The initial and lateral conditions are defined by a pure water liquid phase (S l = 1, C l w = 1, C l a = 0) at hydrostatic pressure and a linear temperature between the fixed top and bottom temperatures. The bottom boundary is impervious with a fixed temperature of 400 K except in the interval 8000 m ≤ x ≤ 10000 m where a pure water liquid input flux of -2.9 • 10 -2 mol. m -2 . s -1 at 550 K is imposed. The upper boundary is composed of two parts corresponding to the seabed (z ≤ 0 m and 0 ≤ x ≤ 5000 m) and a sunny plain zone (z > 0 m and 5000 m < x ≤ 11000 m). The sunny plain zone is defined with a relative humidity fixed to 0.5, the temperature to 300 K and the gas pressure to P g = 1 atm from which we deduce that only the gas phase is present with the water and air molar fractions of about C g w 10 -2 , C g a 0.99.

T = 550 K, Imposed flux of 0.03 mol. m -2 . s -1 S l = 1, C l w = 1 T = 400 K, Imposed flux of 0 mol. m -2 . s -1 S l = 1, C l w = 1
A Voronoi mesh, containing approximatively 20000 cells and satisfying the admissibility condition of TPFA schemes at both inner and boundary faces has been generated. The simulations are run over the time interval [0,t f ], t f = 75 years, with an adaptive time stepping starting with an initial time step of 50 days. The maximum time step is fixed to 500 days. If the convergence of the Newton-min algorithm is not met after a certain amount of iterations, the time step is divided by two.

A second test case is run where the Dirichlet boundary condition at the right side of the domain has been replaced by an homogeneous Neumann boundary condition, i.e. the right side is supposed thermally isolated and impervious. This boundary condition has the advantage to reproduce the symmetry condition of the domain. As exhibited in Figure 1.6.2, which shows the gas saturation in the reservoir at final time of the two simulations, this second test case is more difficult as the desaturated zone is much deeper. The step 4 of the Newton-min algorithm (detailed in Section 1.5) allows improving the efficiency of the convergence. For both formulations, the closure law P g ν -P l ν = P c (S g ν ) is imposed at each Newton iterate as well as S l ν + S g ν = 1 with S α ν 0 for each phase α ∈ P. Follows additional adaptations which depend on the formulation.

In the T-PSC formulation, all the complementarity constraints of type min(U 1 ,U 2 ) = 0 are enforced at the initial guess and at each Newton iterate. In addition, to test the gas phase appearance in monophasic liquid zone, a non-linear update of the gas molar fractions is implemented. Indeed, the primary unknowns (the gas pressure P g ν , the temperature T ν and the air liquid molar fraction C l a,ν ) as well as the water liquid molar fraction C l w,ν are linearly updated. Then the gas molar fractions C g ν are determined by equilibrium with the liquid molar fractions using the equality of the fugacities

f g (P g ν , T ν ,C g ν ) = f l (P l ν , T ν ,C l ν )
, where P l ν = P g ν because S g ν = 0 and there is no entry pressure in this test case in the sense that P c (0) = 0. This non-linear update is used in the complementarity constraint to test the appearance of the gas phase.

Two versions of Newton updates have been implemented for the T-PSF formulation which can be viewed as variants of the Newton-min algorithm. In the first version, the phase disappearance is governed by the negative sign of the updated phase saturation for which we enforce S α ≥ 0 and ∑ αP S α = 1 at each Newton iterate. The negative sign of the second constraint 1 -∑ i∈C C α i (P α , T, f ) governs the phase appearance but we do not enforce 1 -∑ i∈C C α i (P α , T, f ) to vanish at each Newton iterate even if the phase is present since it would involve the solution of an additional non-linear system. Note that, for the T-PSC formulation, this equality can be easily enforced if the phase is present since the phase molar fractions are principal unknowns. This is a major advantage of the T-PSC formulation compared with the T-PSF formulation. In the second version (called "T-PSF with non-linear update of the fugacities"), the constraint ∑ i∈C C l i (P l , T, f ) = 1 is additionally enforced at each Newton iterate as soon as the liquid phase is present, taking advantage of the particular expressions of the fugacities, in the following way. After linear update of the unknowns (in particular of the gas pressure P g ν , the temperature T ν and the air fugacity f a,ν ), we set C l a,ν = min(1, max(0,

f a,ν H a )), C l w,ν = 1 -C l a,ν and f w,ν = f l w (P l ν , T ν ,C l ν )
. This value of the water fugacity is taken as Newton update and also used to test the appearance of the gas phase since the complementarity constraint min(S g ν , 1 -

∑ i∈C C g i,ν ) = 0 in (1.4.5) becomes min(S g ν , P g ν -∑ i∈C f i,ν ) = 0.
Table 1.6.1 compares the numerical behaviour of the simulation with N t f the number of successful time steps, N chops the number of time step chops and N newton the average number of Newton-min iterations per successful time step. The CPU times are in seconds on 2.9 GHz Intel Core i5 processor and 8Go RAM.

To study the robustness of both formulations, let us compare the numerical behaviour of the non-linear solver with much larger time steps. The time steps are multiplied by 10, i.e. the initial time step is set to 500 day and the maximum time step to 5000 days. Let us remark that the time step is adapted with respect to the increments of the temperature and the gas saturation. Thus the time step can decrease even when the Newton-min has converged at the previous time step. The numerical behaviour are summarized in Table 1 Tables 1.6.1 and 1.6.2 show that the non-linear update of the fugacities with the T-PSF formulation is necessary to obtain similar behaviours on the Newton-min convergence compared with the T-PSC formulation. But even with this improvement, in most of the simulations and especially in the second test case (with larger time steps), it is slightly less efficient than the T-PSC formulation, with more time step chops, or a higher average number of Newton iterations per successful time step if the number of time steps is the same, and a longer CPU time. Furthermore, this non-linear update of the fugacities involves the inversion of the systems f α (P α , T,C α ) = f which will be costly in combination with an Equation of State thermodynamic system. It also seems difficult to generalize to more general thermodynamic systems. In the previous tests, the fugacity of the water component has been non-linearly updated but it is an arbitrary choice, it could have been the air component. Whereas the non-linear update of the gas molar fractions in the T-PSC formulation does not depend on the number of components nor on the choice of fugacity functions. This formulation can also be slightly improved by bounding the molar fractions at each Newton-min iteration, which is not done in this section to compare the efficiency with as few constraints as possible on the Newton-min algorithm.

Besides, the use of the component fugacities as principal unknowns rather than the phase molar fractions results in additional non-linear couplings between the molar fractions and the temperature which are not desirable for non-isothermal Darcy flows. Thus in the remainder of the thesis the study will be performed with the T-PSC formulation.

We can now fix the set of physical unknowns to

U ν = P α ν , T ν , S α ν ,C α ν , α ∈ P (1.6.1)
for each degree of freedom ν ∈ Ξ D , the full set of unknowns

U D = {U ν , ν ∈ M ∪ F ext }, (1.6.2)
and the system of equations to

φ (x)∂ t n i + div(q i ) = 0, i ∈ C , φ (x)∂ t E f + (1 -φ (x))∂ t E r + div(q e ) = 0, (1.6.3)
complemented by the closure laws

               P c (S g ) = P g -P l , ∑ α∈P S α = 1, S α ≥ 0, 1 -∑ i∈C C α i ≥ 0, S α (1 -∑ i∈C C α i ) = 0, α ∈ P, f g i (P g , T,C g ) = f l i (P l , T,C l ), i ∈ C .
(1.6.4)

Convergence of the finite volume scheme to a semi-analytical one dimensional stationary solution

In this section, a simplified one dimensional non-isothermal liquid gas model with a single water component is used to analyse the convergence of the TPFA scheme with the T-PSC formulation to a semi-analytical stationary solution.

Definition of the one dimensional stationary solution

Let us consider a single water component (C = {w}) liquid gas non-isothermal Darcy flow model on the one dimensional domain Ω = (z 0 , z 3 ), z 3 > z 0 . Let us assume constant liquid and gas molar densities ζ l and ζ g , and viscosities µ l and µ g . The liquid and gas molar enthalpies are defined by h α (T ) = c α p T , α ∈ P, with the molar heat capacities c g p > c l p . Let us denote by P sat (T ) the saturated vapour pressure and by T sat (P) its inverse. The thermal conductivity is assumed constant λ > 0. The relative permeabilities k α r (S α ), α = l, g are such that k α r (0) = 0 and k α r (1) = 1. The capillary pressure is neglected. The absolute permeability of the porous medium Λ Λ Λ is also assumed constant.

Let us recall the definition of the water (or total) molar flow rate

q w = ζ l q l + ζ g q g , with q α = -k α r (S α )
µ α Λ Λ Λ∂ z (P + ρ α |g|z) and ρ α = ζ α m w where m w denotes the water molar mass. We also set S = S g = 1 -S l . The energy flow rate is

q e = c l p T ζ l q l + c g p T ζ g q g -λ ∂ z T.
The stationary solution P(z), T (z), S(z), z ∈ Ω is such that

∂ z q w = 0, ∂ z q e = 0 and    P g = P sat (T ), if 0 < S < 1, P g ≥ P sat (T ), if S = 0, P g ≤ P sat (T ), if S = 1.
The boundary conditions specify at the bottom boundary z = z 0 the input saturation S = 0, the input molar flow rate q w,0 > 0 and the input energy flow rate q e,0 . The temperature at z = z 0 is denoted by T 0 and the pressure by P 0 . It is assumed that P 0 > P sat (T 0 ) meaning that only the liquid phase is present at the bottom boundary. At the top boundary we impose a gaseous state of temperature T 3 and pressure P 3 which are such that P 3 < P sat (T 3 ).

We assume that the solution has three zones defined by z 0 < z 1 < z 2 < z 3 and such that S = 0 on (z 0 , z 1 ), S = 1 on (z 2 , z 3 ) and P = P sat (T ) on (z 1 , z 2 ).

Let us denote by P i , T i the pressure and temperature at z = z i for i = 0, 1, 2, 3. The saturation S 1 at point z 1 is continuous and equal to S 1 = 0. At point z 2 the saturation may be discontinuous with S + 2 = 1 and S - 2 to be determined.

We define the following set of 8 unknowns U = (P 0 , T 0 , P 1 , T 1 , P 2 , T 2 , z 1 , z 2 ) for which we are going to define 8 equations.

Since S = 0 on [z 0 , z 1 ],

q w,0 = - ζ l µ l Λ Λ Λ∂ z (P + ρ l |g|z).
Integrating this equation between z 0 and z 1 , we obtain

P 1 -P 0 = -(ρ l |g| + µ l q w,0 ζ l Λ Λ Λ )(z 1 -z 0 ).
Moreover, ∂ z q e = 0 gives

a l ∂ z T = ∂ z 2 T with a l = c l p q w,0 λ , from which we deduce that T (z) = E l + D l e a l z , with α l i = e a l z i , i = 0, 1, E l = α l 1 T 0 -α l 0 T 1 α l 1 -α l 0 , D l = T 1 -T 0 α l 1 -α l 0 .
Introducing this formula into q e,0 = c l p T q w,0λ ∂ z T, we get q e,0 = c l p E l q w,0 + D l e a l z (c l p q w,0λ a l ) = c l p q w,0 E l .

Likewise on ]z 2 , z 3 ], we have S = 1 from which we deduce that

P 3 -P 2 = -(ρ g |g| + µ g q w,0 ζ g Λ Λ Λ )(z 3 -z 2 ) and T (z) = E g + D g e a g z , with a g = c g p q w,0 λ , α g i = e a g z i , i = 2, 3, E g = α g 3 T 2 -α g 2 T 3 α g 3 -α g 2 , D g = T 3 -T 2 α g 3 -α g 2 .
It results that q e,0 = c g p q w,0 E g . This provides the following 6 equations

                           P 1 = P sat (T 1 ), P 2 = P sat (T 2 ), P 1 -P 0 = -(ρ l |g| + µ l q w,0 ζ l Λ Λ Λ )(z 1 -z 0 ), P 3 -P 2 = -(ρ g |g| + µ g q w,0 ζ g Λ Λ Λ )(z 3 -z 2 ),
c l p q w,0 E l = q e,0 , c g p q w,0 E g = q e,0 .

The two missing equations are obtained by integration of the following system on

(z 1 , z 2 )                    q α = - k α r (S α ) µ α Λ Λ Λ∂ z (P + ρ α |g|z), ζ l q l + ζ g q g = q w,0 , c l p T ζ l q l + c g p T ζ g q g -λ ∂ z T = q e,0 , P = P sat (T ), P(z 2 ) = P 2 , (1.7.1)
and by setting S(z 1 ) = 0, P(z 1 ) = P 1 .

We also obtain an algebraic equation using that ζ l q l = q w,0 , q g = 0 at z = z 1 as well as S(z 1 ) = 0, T (z 1 ) = T 1 . It leads by elimination of ∂ z T and using ∂ z P = P sat (T )∂ z T to the following equation which allows computing directly T 1

- ζ l Λ Λ Λ µ l P sat (T 1 ) 1 λ (c l p T 1 q w,0 -q e,0 ) + ρ l |g| = q w,0 .

Computation of the one dimensional stationary solution in a particular case

To simplify the computation of the solution we assume that e -a l (z 1 -z 0 ) and e -a g (z 3 -z 2 ) are of the order of the machine round off error. This will be checked a posteriori but it basically holds when λ is small enough.

In that case we have E l = T 0 and E g = T 2 , which gives T 0 = q e,0 c l p q w,0

, T 2 = q e,0 c g p q w,0

, P 2 = P sat (T 2 ),
and

z 2 = z 3 - P 2 -P 3 ρ g |g| + µ g q w,0 ζ g Λ Λ Λ
.

Then, the temperature T 1 can be computed as the solution of the equation

- ζ l Λ Λ Λ µ l P sat (T 1 )
1 λ (c l p T 1 q w,0q e,0 ) + ρ l |g| = q w,0 , as well as P 1 = P sat (T 1 ).

The position z 1 is computed by dichotomy in order to solve T (z 1 ) = T 1 (or equivalently S(z 1 ) = 0) using a numerical integration of (1.7.1) on (z 1 , z 2 ). This integration is done using an Euler implicit scheme. It amounts to solve a non-linear system for T (z), S(z) at each node z of a uniform discretization of the interval (z 1 , z 2 ) in decreasing z order starting from z = z 2 .

Once z 1 is obtained, we can compute P 0 as follows

P 0 = P 1 + (ρ l |g| + µ l q w,0 ζ l Λ Λ Λ )(z 1 -z 0 ).

Convergence of the finite volume scheme

Let us consider the following data set

z 0 = 0 m, z 3 = 3000 m, T 3 = 400 K, P 3 = 10 5 Pa, ζ g = 10 m w , ζ l = 1000 m w , µ g = 10 -4 Pa. s -1 , µ l = 10 -3 Pa. s -1 , λ = 1 W. m -1 . K -1 , k α r (S α ) = (S α ) 2 , c l p = 2000m w , c g p = 2800m w , q w,0 = 6 10 -4
m w , q e,0 = 600 q w,0 c l p , |g| = 9.81 m. s -2 , Λ Λ Λ = 10 -12 m 2 , m w = 0.018 kg. mol -1 .

The saturated vapour pressure is defined by the following Rankine formula

P sat = 10 5 exp(13.7 - 5120 T ).
The corresponding stationary solution computed as described above is exhibited in

Conclusion

In this chapter, the non-isothermal compositional two-phase Darcy flow model has been detailed with two persistent variable formulations. The T-PSC formulation is preferred to T-PSF since the use of the component fugacities as principal unknowns rather than the phase molar fractions results in additional non-linear couplings between the molar fractions and the temperature which are not desirable for non-isothermal Darcy flows. Furthermore, a non-linear update of the fugacities is necessary to obtain a good convergence of the Newton-min algorithm, which involves the inversion of the systems f α (P α , T,C α ) = f that will be costly in combination with an Equation of State thermodynamic system. It also seems difficult to generalize to more general thermodynamic systems.

The numerical simulations confirmed that the T-PSC formulation has a slightly better Newton-min convergence thanks to a smaller number of time step chops, of average number of Newton iterations per successful time step, and of CPU time. Finally, the study of the convergence of the TPFA scheme with the T-PSC formulation to a semianalytical stationary solution validated the model.

Let us recall that our formulation of the model leads, independently on the set of present phases, to the fix sets of 2#C + 5 unknowns (1.6.1) and of 2#C + 5 equations (1.6.3)-(1.6.4) including the #C + 1 conservation equations (1.6.3) and the remaining #C + 4 local closure laws (1.6.4). It also has the advantage to express the thermodynamic equilibrium as complementarity constraints which allows the use of semismooth Newton methods [START_REF] Kräutle | The semi-smooth newton method for multicomponent reactive transport with minerals[END_REF][START_REF] Ben Gharbia | Gas phase appearance and disappearance as a problem with complementarity constraints[END_REF] to solve the non-linear systems at each time step of the simulation. Some improvements of the Newton-min algorithm will be suggested in Section 3.2.5.

48

Chapter 2

Combined face based and nodal based discretizations on hybrid meshes

Abstract: in this chapter is developed a new methodology to combine a node-centered discretization and a face-centered discretization on arbitrary subsets of cells or faces in order to choose the best suited scheme in different parts of the mesh [START_REF] Beaude | Combined face based and nodal based discretizations on hybrid meshes for non-isothermal two-phase darcy flow problems[END_REF]. The coupling strategy is based on a node to face interpolation operator at the interface which must be chosen to ensure the consistency, the coercivity and the limit conformity properties of the combined discretization; the proof of convergence being performed in the gradient scheme framework [START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF] over second order diffusion problems. The framework preserves at the interface the discrete conservation properties of both schemes which allows extending naturally the combined scheme to the discretization of twophase compositional non-isothermal Darcy flow models. Numerical tests have been run to validate the new scheme and the numerical efficiency has been analysed on geothermal applications. The combined scheme shows to provide the best compromise between accuracy and CPU time when compared with both standalone schemes.

Introduction

The simulation of compositional multi-phase Darcy flow in heterogeneous porous media plays a major role in many applications (for example in the oil and gas sector, sedimentary basin modelling, CO 2 geological storage or geothermal study). A major difficulty is linked to the finite volume discretization of the Darcy fluxes on the complex geometry and geology encountered in practical problems typically including fault networks, pinch-out, heterogeneities and spatially varying anisotropies of the medium. The classical cell-centered Two-Point Flux Approximation (TPFA) widely used in industrial simulators is cheap and robust but its consistency requires strong orthogonality conditions on the mesh which cannot be achieved for complex geological models. In the last 20 years, these restrictions have motivated an active research on the development of new discretization schemes to approximate the Darcy fluxes on polyhedral cells and in heterogeneous anisotropic porous media [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Droniou | Finite volume schemes for diffusion equations: introduction and review of modern methods[END_REF]. Still relying on the cell-centered approximation, Multi-Point Flux Approximations (MPFA) extend TPFA to consistent discretizations on general meshes with anisotropic heterogeneous media [START_REF] Aavatsmark | Discretization on unstructured grids for inhomogeneous, anisotropic media. Part I: Derivation of the methods[END_REF][START_REF] Edwards | Finite volume discretization with imposed flux continuity for the general tensor pressure equation[END_REF]. Yet, MPFA schemes are mesh and anisotropy conditionally stable and exhibit a very large stencil on simplectic meshes. Alternatively, nodal discretizations such as the Control Volume Finite Element (CVFE) method [START_REF] Huber | Node-centered finite volume discretizations for the numerical simulation of multi-phase flow in heterogeneous porous media[END_REF] and the Vertex Approximate Gradient (VAG) scheme [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Samier | Implementation of a vertex centered method inside an industrial reservoir simulator -practical issues and comprehensive comparison with cpg and pebi grid models on a field case[END_REF] are unconditionally coercive and very efficient on simplectic meshes thanks to their node-centered approximation. Finally, face based discretizations such as the Hybrid Finite Volume (HFV) scheme [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF] belonging to the family of Hybrid Mixed Mimetic (HMM) methods [START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF], or the Mixed Hybrid Finite Element method, have been developed and adapted to multi-phase Darcy flows in [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF][START_REF] Abushaikha | Fully implicit mixed-hybrid finite element discretization for general purpose subsurface reservoir simulation[END_REF]. They provide accurate and unconditionally stable discretizations of the Darcy fluxes but, due to the large number of faces, remain rather expensive compared with nodal or cell-centered approaches.

Roughly speaking, all these discretizations of the Darcy fluxes have their own drawbacks and advantages which typically depend on the mesh characteristics and on the anisotropy of the medium. In this work, we propose a new methodology which combines node-centered and face-centered discretizations on arbitrary subsets of cells or faces in order to adapt the choice of the scheme in different parts of the mesh. We choose the Hybrid Finite Volume (HFV) scheme [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF] as the face-centered discretization, and in our approach, the TPFA scheme is considered as a face based HFV scheme for which the face unknowns can be eliminated assuming that the mesh satisfies the superadmissibility property with anisotropy aligned with the mesh directions (see Lemma 2.1 of [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]). The VAG scheme is chosen as our nodal approximation since it shares a common data structure with the HFV scheme which relies on local to each cell transmissibility matrices. It also has the advantage, compared with more classical nodal discretizations such as CVFE, to avoid the mixing of rocktypes at nodal control volumes [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF][START_REF] Samier | Implementation of a vertex centered method inside an industrial reservoir simulator -practical issues and comprehensive comparison with cpg and pebi grid models on a field case[END_REF].

We consider two types of strategies to couple the VAG and HFV (TPFA) discretizations. The first one is founded on a partition of the cells, each cell using either nodal or face unknowns. The second approach can be extended to more general partitions of the mesh based on faces, each face using either face or nodal unknowns. In both cases, the coupling is performed using a node to face interpolation operator at interfaces which must be chosen to ensure the consistency, the coercivity and the limit conformity properties of the combined VAG-HFV discretizations. The convergence analysis is performed in the gradient discretization framework [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF][START_REF] Droniou | The Gradient discretization method: A framework for the discretization of linear and nonlinear elliptic and parabolic problems[END_REF] and convergence is proved for arbitrary cell or face partitions of the mesh. For face partitions, an additional stabilisation is required to ensure the coercivity while for cell partitions no additional stabilisation is needed and the stability is obtained at the interface thanks to the neighbouring VAG cells.

At the interface, the framework preserves the discrete conservation properties of the VAG and HFV schemes with fluxes based on local to each cell transmissibility matrices which size is the number of selected nodes or/and faces on the shared boundary. This discrete conservative form leads to a natural extension of the VAG and HFV discretizations of multi-phase Darcy flow models to the combined VAG-HFV schemes.

The remainder of this chapter is organized as follows. Section 2.2 focuses on the discretization of second order diffusion problems. It introduces our framework based, to fix ideas, on a partition of the cells into VAG, HFV and interface cells. Then, two gradient schemes are built combining the VAG and HFV schemes in their respective subset of cells coupled with two possible choices of matching discretizations in the interface cells. The stability and convergence of both discretizations are proved using the gradient discretization framework and the convergence is assessed numerically on various types of hybrid three dimensional meshes and compared with the standalone VAG and HFV discretizations. Using the discrete fluxes connecting each cell to its node or/and face boundary degrees of freedom, the VAG-HFV discretizations are extended to immiscible two-phase Darcy flows in Section 2.3. Then, numerical tests investigate, on a one dimensional two-phase flow reference solution, the convergence and efficiency of the VAG-HFV schemes compared with the standalone VAG and HFV discretizations. Section 2.4 considers the extension of the VAG-HFV discretizations to nonisothermal compositional liquid gas Darcy flows based on the formulation introduced in Section 1.2.1. Finally, the model and its VAG-TPFA discretization are tested on the simplified two dimensional cross-section of the Bouillante high temperature geothermal reservoir with an hybrid cartesian triangular mesh. A reference solution, computed on a refined mesh, is compared in terms of accuracy and CPU time with the solutions obtained with the VAG scheme on a triangular mesh and the TPFA scheme on a Voronoi mesh.

Two Gradient discretizations combining the VAG and HFV schemes

Let us consider a domain Ω ⊂ R d , with d = 2, 3 the space dimension, and the following second order diffusion equation looking for the potential u ∈ H 1 0 (Ω) and the velocity q ∈ H div (Ω) such that div(q) = f on Ω, q = -Λ Λ Λ∇u on Ω.

(2.2.1)

In (2.2.1), f ∈ L 2 (Ω) is the source term and Λ Λ Λ ∈ L ∞ (Ω) d×d is the diffusion tensor such that there exist k ≥ k > 0 with k|ξ | 2 ≤ (Λ Λ Λ(x)ξ , ξ ) ≤ k|ξ | 2 for all ξ ∈ R d , x ∈ Ω.
The primal weak formulation of (2.2.1) amounts to find u ∈ H 1 0 (Ω) satisfying the following variational equality for all v ∈ H 1 0 (Ω)

Ω Λ Λ Λ(x)∇u(x)∇v(x)dx = Ω f (x)v(x)dx. (2.2.2)
It admits a unique solution from the Lax Milgram theorem.

Polyhedral mesh and its partition

Following [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Brenner | Vertex Approximate Gradient scheme for hybrid-dimensional two-phase Darcy flows in fractured porous media[END_REF], we consider generalized polyhedral meshes of Ω. Let us recall the notations concerning the mesh introduced in Section 1.3 and adapt them to hybrid meshes. Let M be the set of cells that are disjoint open subsets of Ω such that K∈M K = Ω. For all K ∈ M , x K denotes the so-called "center" of the cell K under the assumption that K is star-shaped with respect to x K . Let F denote the set of faces of the mesh. The faces are not assumed to be planar for the VAG discretization, hence the term "generalized polyhedral cells", but they need to be planar for the HFV discretization. We denote by V the set of vertices of the mesh. Let V K , F K , V σ respectively denote the set of the vertices of K ∈ M , faces of K and vertices of σ ∈ F . The set of edges of the mesh is denoted by E and E σ denotes the set of edges of the face σ ∈ F . Let M σ denote the set of cells sharing the face σ ∈ F . We denote by F ext the subset of faces σ ∈ F such that M σ has only one element and V ext = σ ∈F ext V σ . The mesh is assumed to be conforming in the sense that for all σ ∈ F \ F ext , the set M σ contains exactly two cells. It is assumed that, for each face σ ∈ F , there exists a so-called "center" x σ of the face such that

x σ = ∑ s∈V σ β σ s x s , with ∑ s∈V σ β σ s = 1,
where β σ s ≥ 0 for all s ∈ V σ . The face σ is assumed to match with the union of the triangles T σ ,e defined by the face center x σ and each of its edge e ∈ E σ .

A tetrahedral submesh of M is defined by

T = {T K,σ ,e , e ∈ E σ , σ ∈ F K , K ∈ M },
where T K,σ ,e is the tetrahedron joining the cell center x K to the triangle T σ ,e . Let ρ T denote the insphere diameter of a given tetrahedron T , h T its diameter and h T = max T ∈T h T . We will assume in the convergence analysis that the family of tetrahedral submeshes T is shape regular. Hence let us define the following shape regularity parameter of the mesh by

θ T = max T ∈T h T ρ T . (2.2.3)
The following combination of the VAG and HFV discretizations relies on the choice of a subset of cells M v ⊂ M on which the VAG discretization is used. Then, we define the subset of interfacial faces F hv ⊂ F \ F ext by

F hv = {σ ∈ F \ F ext | K ∈ M v , L ∈ M v or L ∈ M v , K ∈ M v with M σ = {K, L}}
and the set of interface cells M hv by

M hv = K ∈ M \ M v | F K ∩ F hv = / 0 .
The subset of HFV cells on which the HFV discretization is used is finally defined by

M h = M \ (M v ∪ M hv ),
such that M v , M h , M hv defines a partition of the set of cells M (see Figure 2.2.1). We also define the following subsets of nodes and faces

V v = K∈M v V K , V hv = σ ∈F hv V σ , F h = K∈M h ∪M hv F K \ F hv , and V v ext = V ext ∩ V v , F h ext = F ext ∩ F h .
For all σ ∈ F h ∪ F hv , it is assumed in the following that the face σ is planar and that x σ is the center of gravity of σ .

Combining the VAG and HFV discretizations using the gradient discretization framework

The junction between the VAG and HFV discretizations is obtained using the gradient discretization framework introduced in [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF][START_REF] Droniou | The Gradient discretization method: A framework for the discretization of linear and nonlinear elliptic and parabolic problems[END_REF]. This framework is based on the definition of a vector space of discrete unknowns X D , of a function reconstruction operator

Π D : X D → L 2 (Ω),
and of a gradient reconstruction operator

∇ D : X D → (L 2 (Ω)) d .
The subspace of X D incorporating homogeneous Dirichlet boundary conditions is denoted by X 0 D . Then, the discretization of our model problem (2.2.2) is obtained by the following variational formulation: find

u D ∈ X 0 D such that Ω Λ Λ Λ(x)∇ D u D (x)∇ D v D (x)dx = Ω f (x)Π D v D (x)dx (2.2.4) for all v D ∈ X 0 D .
It admits a unique solution as soon as

. D = ∇ D . (L 2 (Ω)) d defines a norm on X 0 D .
As exhibited in Figure 2.2.1, our construction relies on the following set of degrees of freedom (d.o.f.)

Ξ D = {K ∈ M } ∪ {s ∈ V v } ∪ {σ ∈ F h },
(2.2.5) the associated vector space X D of discrete unknowns

X D = {u ν ∈ R | ν ∈ Ξ D } , (2.2.6)
and its subspace

X 0 D = u D ∈ X D | u s = 0, u σ = 0, s ∈ V v ext , σ ∈ F h ext . (2.2.7)
Let us also define the subsets of d.o.f. located at the boundary of a given cell K ∈ M as

Ξ K =      (F K \ F hv ) ∪ (V K ∩ V hv ) if K ∈ M hv , F K if K ∈ M h , V K if K ∈ M v .
The function reconstruction operator is based on an arbitrary partition {D K , D K,ν , ν ∈ Ξ K } of each cell K ∈ M and is defined by with

Π D u D (x) = u K for all x ∈ D K , K ∈ M , u ν for all x ∈ D K,ν , K ∈ M , ν ∈ Ξ K , (2.2.8) K ∈ M hv K ∈ M h K ∈ M v F hv node unknown u s , s ∈ V v face unknown u σ , σ ∈ F h cell unknown u K , K ∈ M
D K,ν = / 0 for all ν ∈ V v ext ∪ F h ext .
The gradient reconstruction operator is defined cellwise by

∇ D u D (x) =      ∇ v K u D (x) for all x ∈ K, K ∈ M v , ∇ h K u D (x) for all x ∈ K, K ∈ M h , ∇ hv K u D (x) for all x ∈ K, K ∈ M hv .
(2.2.9)

It is founded on the VAG gradient reconstruction operator ∇ v K for all VAG cells K ∈ M v and on the HFV gradient reconstruction operator ∇ h K for all HFV cells K ∈ M h . On the interface cells K ∈ M hv , the gradient reconstruction operator ∇ hv K must be built to guarantee that the gradient discretization (X D , ∇ D , Π D ) satisfies the coercivity, consistency and limit conformity properties of the gradient discretization framework, ensuring the well-posedness and convergence of the scheme (see [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF][START_REF] Droniou | The Gradient discretization method: A framework for the discretization of linear and nonlinear elliptic and parabolic problems[END_REF] and Subsection 2.2.3 below).

VAG gradient reconstruction operator

Following [START_REF] Eymard | Benchmark 3d: the vag scheme[END_REF], a P 1 finite element discretization is built using the tetrahedral submesh T of M and a second order interpolation at the face centers

x σ , σ ∈ F \ F h defined for u D ∈ X D by u σ = ∑ s∈V σ β σ s u s .
For a given u D ∈ X D , we define the function Π T u D on K∈M v K as the continuous piecewise affine function on each tetrahedron of T included in

K∈M v K such that Π T u D (x K ) = u K , Π T u D (x s ) = u s , and Π T u D (x σ ) = ∑ s∈V σ β σ s u s for all K ∈ M v , s ∈ V v and σ ∈ F \ F h .
The VAG gradient reconstruction operator is obtained from this finite element discretization by setting

∇ v K u D (x) = ∇Π T u D (x) for all x ∈ K, K ∈ M v .
(2.2.10)

HFV gradient reconstruction operator

We follow the construction presented in [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]. As shown in [START_REF] Droniou | A unified approach to mimetic finite difference, hybrid finite volume and mixed finite volume methods[END_REF] it can be generalized as the family of Hybrid Mimetic Methods covering in the same framework Mimetic Finite Difference, Hybrid Finite Volume and Mixed Finite Volume Methods. For K ∈ M , let us set

U K = u K , u σ , σ ∈ F K ∈ R #F K +1
and define

∇ K U K = 1 |K| ∑ σ ∈F K |σ |(u σ -u K )n Kσ ,
where |K| is the volume of the cell K, |σ | is the surface of the face σ , and n Kσ is the unit normal vector of the face σ ∈ F K oriented outward of the cell K. Let us remark that ∇ K U K does not depend on u K since ∑ σ ∈F K |σ |n Kσ = 0. Hence a stabilised gradient reconstruction is defined as follows

∇ K,σ U K = ∇ K U K + 1 √ d |σ | |K σ | R K,σ (U K )n Kσ , σ ∈ F K , with R K,σ (U K ) = u σ -u K -∇ K U K • (x σ -x K ),
where K σ is the cone joining the face σ to the cell center x K and |K σ | its d-dimensional measure. It leads to the definition of the HFV gradient reconstruction operator for u D ∈ X D as

∇ h K u D (x) = ∇ K,σ U K for all x ∈ K σ , K ∈ M h , σ ∈ F K , (2.2.11)
Note that the weight 1

√ d
is chosen in order to recover the gradient reconstruction corresponding to the two point flux approximation in the case of a superadmissible mesh (see Lemma 2.1 of [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]).

First gradient reconstruction operator in the interface cells

Our first construction relies on a second order interpolation of the face unknown u σ at the center of gravity x σ for each face σ ∈ F hv defined by

u σ = 1 |σ | σ Π T u D (x)dσ (x).
Since x σ is the center of gravity of the face σ , it results that

u σ = ∑ s∈V σ β σ s u s .
Then we set for u D ∈ X D ,

U K = u K , u σ = 1 |σ | σ Π T u D (x)dσ (x), σ ∈ F K ∩ F hv , u σ , σ ∈ F K \ F hv ,
and

∇ hv K u D (x) = ∇ K,σ U K for all x ∈ K σ , K ∈ M hv , σ ∈ F K .
(2.2.12)

Second gradient reconstruction operator in the interface cells

The second construction combines the previous interpolation at the faces σ ∈ F hv with a stabilisation of the cell gradient. As previously, for u D ∈ X D , let us set

U K = u K , u σ = 1 |σ | σ Π T u D (x)dσ (x), σ ∈ F K ∩ F hv , u σ , σ ∈ F K \ F hv .
Then we rewrite the constant gradient ∇ K U K as

∇ K U K = ∑ ν∈Ξ K (u ν -u K )b K,ν , with        b K,σ = |σ | |K| n Kσ for σ ∈ F K \ F hv , b K,s = ∑ {σ ∈F K ∩F hv | s∈V σ } β σ s |σ | |K| n Kσ for s ∈ V K ∩ V hv .
This gradient does not actually depends on u K and must be stabilised using the residual

R K,ν (u D ) = u ν -u K -∇ K U K • (x ν -x K ),
and, for each ν ∈ Ξ K , the new gradient

∇ K,ν u D = ∇ K U K + γ Kν R K,ν (u D )b K,ν .
It leads to define the stabilised gradient

∇ hv K u D (x) = ∇ K,ν u D for all x ∈ ω Kν , K ∈ M hv , ν ∈ Ξ K , (2.2.13)
where the weights (γ Kν ) ν∈Ξ K and the partition

(ω Kν ) ν∈Ξ K of the cell K ∈ M hv are such that        ω Kσ = K σ for σ ∈ F K \ F hv , |ω Ks | = ∑ σ ∈F K ∩F hv |K σ | #(V K ∩ V hv ) for s ∈ V K ∩ V hv ,
and

       γ Kσ = 1 √ d |K| |K σ | for σ ∈ F K \ F hv , γ Ks = 1 √ d |K| |ω Ks | for s ∈ V K ∩ V hv , such that γ Kν |ω Kν | = 1 √ d
|K| for all ν ∈ Ξ K . Note that, as soon as the diffusion tensor

Λ Λ Λ(x)

Conservative formulation

From the cellwise definition of the gradient reconstruction, one can define the cell transmissibility symmetric positive matrices

T K ∈ R Ξ K ×Ξ K , K ∈ M such that Ω Λ Λ Λ(x)∇ D u D (x)∇ D v D (x)dx = ∑ K∈M ∑ ν∈Ξ K ∑ ν ∈Ξ K T ν,ν K (u ν -u K )(v ν -v K ), with T ν,ν K = K Λ Λ Λ(x)∇ D w (ν ) D (x)∇ D w (ν) D (x)dx,
where w

(ν) µ = δ ν µ for all (ν, µ) ∈ Ξ D ×Ξ D . Let us define the following fluxes connecting each cell K ∈ M to its boundary d.o.f. ν ∈ Ξ K F Kν (u D ) = ∑ ν ∈Ξ K T ν,ν K (u K -u ν ). (2.2.14)
Then, the gradient scheme (2.2.4) can be formulated as a set of discrete conservation equations as follows: find

u D ∈ X 0 D such that          ∑ ν∈Ξ K F Kν (u D ) = D K f (x)dx for all K ∈ M , ∑ K∈M | ν∈Ξ K -F Kν (u D ) = ∑ K∈M | ν∈Ξ K D K,ν f (x)dx for all ν ∈ (F h ∪ V v ) \ F h ext ∪ V v ext .
(2.2.15)

Each cell unknown u K can be eliminated from the first equation in (2.2.15) which depends only on u K and u ν , ν ∈ Ξ K . It leads to a Schur complement linear system without any fill-in depending only on the face and node unknowns

u ν for ν ∈ F h ∪ V v .
Remark 2.2.2 For the first construction, given T h K ∈ R F K ×F K , the HFV transmissibility matrix of the cell K ∈ M hv , then the transmissibility matrix T K can be easily computed by

T K = (A K ) t T h K A K , (2.2

.16)

where

A K ∈ R F K ×Ξ K is such that (A K ) σ ,ν = δ ν σ for all σ ∈ F K ∩F h , ν ∈ Ξ K , (A K ) σ ,s = β σ s for all σ ∈ F K ∩F hv , s ∈ V σ , and (A K ) σ ,ν = 0 for all σ ∈ F K ∩F hv , ν ∈ Ξ K \V σ . Remark 2.2.3 The cell transmissibility matrix T K is Symmetric Positive Definite (SPD) for all K ∈ M v ∪ M h , but T K is SPD for K ∈ M hv
for the second construction only. From (2.2.16), it is clear that T K is symmetric positive but not definite for the first construction for K ∈ M hv . Remark 2.2.4 In the special case for which a given cell K ∈ M hv satisfies the superadmissibility property σ ⊥ x K x σ for all σ ∈ F K and say for Λ Λ Λ isotropic and cellwise constant, the HFV discretization transmissibility matrix T h K is diagonal leading to two point fluxes F Kσ (see Lemma 2.1 of [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]). From (2.2.16), it can be checked that this two point flux property is preserved by the first construction for all faces σ ∈ F K ∩ F h while it is not a priori the case for the second construction. This is one of the major advantage of the first approach when coupling the VAG and TPFA discretizations.

Mathematical analysis in the gradient discretization framework

Gradient discretization framework

Let us recall the coercivity, consistency, and limit conformity properties for sequences of gradient discretizations introduced in [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF][START_REF] Droniou | The Gradient discretization method: A framework for the discretization of linear and nonlinear elliptic and parabolic problems[END_REF].

Coercivity: Let C D > 0 be defined by

C D = max v D ∈X 0 D \{0} Π D v D L 2 (Ω) v D D . (2.2.17)
Then, a sequence of gradient discretizations (D l ) l∈N is said to be coercive if there exist C P > 0 such that C D l ≤ C P for all l ∈ N.

Consistency: For all u ∈ H 1 0 (Ω) and v D ∈ X 0 D let us define

S D (u, v D ) = ∇ D v D -∇u (L 2 (Ω)) d + Π D v D -u L 2 (Ω) (2.2.18)
and

S D (u) = min v D ∈X 0 D S D (u, v D ). (2.2.19)
Then, a sequence of gradient discretizations (D l ) l∈N is said to be consistent if for all u ∈ H 1 0 (Ω) one has lim l→+∞ S D l (u) = 0.

Limit Conformity: For all q ∈ H div (Ω) and v D ∈ X 0 D , let us define

W D (q, v D ) = Ω (Π D v D )div(q) + ∇ D v D • q dx, (2.2.20)
and

W D (q) = max v D ∈X 0 D \{0} |W D (q, v D )| v D D . (2.2.21)
Then, a sequence of gradient discretizations (D l ) l∈N is said to be limit conforming if for all q ∈ H div (Ω) one has lim l→+∞ W D l (q) = 0.

The following proposition is proved in [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF][START_REF] Droniou | Gradient schemes: a generic framework for the discretisation of linear, nonlinear and nonlocal elliptic and parabolic equations[END_REF][START_REF] Droniou | The Gradient discretization method: A framework for the discretization of linear and nonlinear elliptic and parabolic problems[END_REF].

Proposition 2.2.1 Let D = X 0 D , ∇ D , Π D be a gradient discretization such that . D is a norm on X 0 D , then the gradient scheme (2.2.4) has a unique solution u D ∈ X 0 D which satisfies the a priori estimate u D D ≤ C D k f L 2 (Ω) .
Let u ∈ H 1 0 (Ω) be the solution of (2.2.2) and let us set q = -Λ Λ Λ∇u ∈ H div (Ω). Then, one has the following error estimates

       ∇u -∇ D u D (L 2 (Ω)) d ≤ (k + k)S D (u) + 1 k W D (q), Π D u D -u L 2 (Ω) ≤ 1 k (C D k + k)S D (u) +C D W D (q) .
Proof of the coercivity, consistency and limit conformity properties for both constructions Proposition 2.

Π D v D L 2 (Ω) ≤ C D v D D , for all v D ∈ X 0 D , (2.2

.22)

and the following consistency estimate

S D (ϕ) ≤ C ϕ h T , for all ϕ ∈ C 2 (Ω) ∩ H 1 0 (Ω), (2.2.23)
holds with C ϕ depending only on θ T and ϕ. Furthermore, the following limit conformity estimate

W D (ϕ) ≤ C ϕ h T , for all ϕ ∈ (C 1 (Ω)) d , ( 2
D ∈ X 0 D Π M u D 2 L 2 (Ω) ≤ C 1 ∑ K∈M ∑ σ ∈F K |σ | d Kσ (u σ -u K ) 2 , (2.2.25)
with

u σ = ∑ s∈V σ β σ s u s for all σ ∈ F \ F h and d Kσ = n Kσ • (x σ -x K ). For all K ∈ M v ,
it results from the convex combination assumption on the weights β σ s , s ∈ V σ , the definition of θ T (2.2.3) and from Lemma 3.2 of [START_REF] Brenner | Convergence of a Vertex centered Discretization of Two-Phase Darcy flows on General Meshes[END_REF] that there exists C 2 depending only on θ T such that

∑ σ ∈F K |σ | d Kσ (u σ -u K ) 2 ≤ C 2 ∇ v K u D 2 (L 2 (K)) d . ( 2
∑ σ ∈F K |σ | d Kσ (u σ -u K ) 2 ≤ C 3 ∇ D u D 2 (L 2 (K)) d . ( 2
∈ X 0 D Π M u D L 2 (Ω) ≤ C 4 ∇ D u D (L 2 (Ω)) d . (2.2.28)
To conclude the proof of the coercivity property, let us now prove that there exists C 5 depending only on θ T such that for all

u D ∈ X D Π M u D -Π D u D L 2 (Ω) ≤ C 5 h T ∇ D u D (L 2 (Ω)) d . (2.2.29)
It results from (2.2.27) and Lemma 3.4 of [START_REF] Brenner | Convergence of a Vertex centered Discretization of Two-Phase Darcy flows on General Meshes[END_REF] that there exists a constant C 6 depending only on θ T such that for all u D ∈ X D and for all K ∈ M v ∪ M h , one has

Π M u D -Π D u D 2 L 2 (K) ≤ C 6 (h K ) 2 ∇ D u D 2 (L 2 (K)) d , (2.2.30)
where h K is the diameter of the cell K. On the interface cells K ∈ M hv , from (2.2.27), there exists a constant C 7 depending only on θ T such that for all

u D ∈ X D ∑ σ ∈F K \F hv |K||u σ -u K | 2 ≤ C 7 (h K ) 2 ∇ hv K u D 2 (L 2 (K)) d . (2.2.31)
For all σ ∈ F hv , M σ = {K, L}, K ∈ M hv , using that L ∈ M v and Lemma 3.2 of [START_REF] Brenner | Convergence of a Vertex centered Discretization of Two-Phase Darcy flows on General Meshes[END_REF], there exists a constant C 8 depending only on θ T such that for all

u D ∈ X D ∑ s∈V σ |K| |u s -u L | 2 ≤ C 8 (h L ) 2 ∇ v L u D 2 (L 2 (L)) d .
It results that, for σ ∈ F hv , M σ = {K, L}, K ∈ M hv , there exists a constant C 9 depending only on θ T such that for all

u D ∈ X D ∑ s∈V σ |K| |u s -u K | 2 ≤ 3 ∑ s∈V σ |K| |u s -u L | 2 + |u L -u σ | 2 + |u σ -u K | 2 ≤ C 9 (h L ) 2 ∇ v L u D 2 (L 2 (L)) d + (h K ) 2 ∇ hv K u D 2 (L 2 (K)) d . (2.2.32)
It is clear from (2.2.32) that the control of the contribution of the node

s ∈ V σ to Π M u D -Π D u D 2 L 2 (K) is
Π D u D (x) = Π T u D (x) for all x ∈ K, K ∈ M v and Π D u D (x) = Π M u D (x) for all x ∈ K, K ∈ M h ∪ M hv . Using that ∇ v K u D = ∇Π D u D | K for all K ∈ M v , one has T v = ∑ K∈M v K (Π D u D )div(ϕ) + ∇ D u D • ϕ dx = ∑ σ ∈F hv M σ ={K,L},K∈M v σ (Π T u D )ϕ • n Kσ dσ (x). Let us set u σ = ∑ s∈V σ β σ s u s for all σ ∈ F \ F h and ϕ σ = 1 |σ | σ ϕ(x)dσ (x), ϕ K = 1 |K| K ϕ(x)dx. We define T h = ∑ K∈M h ∪M hv K (Π D u D )div(ϕ) + ∇ D u D • ϕ dx = T h 1 + T h 21 + T h 22 ,
with

T h 1 = ∑ K∈M h ∪M hv K (Π D u D )div(ϕ)dx = ∑ K∈M h ∪M hv ∑ σ ∈F K |σ |u K ϕ σ • n Kσ , T h 21 = ∑ K∈M h ∪M hv ∑ σ ∈F K |σ |(u σ -u K )ϕ K • n Kσ , T h 22 = ∑ K∈M h ∪M hv ∑ σ ∈F K 1 √ d |σ |R K,σ (u D )n Kσ • 1 |K σ | K σ ϕ(x)dx. Since ∑ σ ∈F K |σ |R K,σ (u D )n Kσ = 0, one has T h 22 = ∑ K∈M h ∪M hv ∑ σ ∈F K 1 √ d |σ |R K,σ (u D )n Kσ • 1 |K σ | K σ (ϕ(x) -ϕ K )dx,
and, from [START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF], it exists C depending only on θ T and ϕ such that

|T h 22 | ≤ Ch T ∑ K∈M h ∪M hv ∇ D u D 2 (L 2 (K)) d 1 2 . Since ∑ K∈M h ∪M hv ∑ σ ∈F K |σ |u σ ϕ σ • n Kσ = ∑ σ ∈F hv M σ ={K,L},L∈M v |σ |u σ ϕ σ • n Kσ , one has T h 1 = ∑ K∈M h ∪M hv ∑ σ ∈F K |σ |(u K -u σ )ϕ σ • n Kσ + ∑ σ ∈F hv M σ ={K,L},L∈M v |σ |u σ ϕ σ • n Kσ .
Combining the previous identities and using that |σ |u σ = σ Π T u D (x)dσ (x) for all σ ∈ F hv , we obtain that

T v + T h 1 + T h 21 = T hv + T h 3 , with T h 3 = ∑ K∈M h ∪M hv ∑ σ ∈F K |σ |(u σ -u K )(ϕ K -ϕ σ ) • n Kσ , T hv = ∑ σ ∈F hv M σ ={K,L},K∈M v σ (Π T u D (x) -u σ )(ϕ(x) -ϕ σ ) • n Kσ dσ (x),
We deduce that there exists C depending only on θ T and ϕ such that

|T h 3 | ≤ Ch T ∑ K∈M h ∪M hv ∇ D u D 2 (L 2 (K)) d 1 2 .
Since for σ ∈ F hv with M σ = {K, L}, K ∈ M v , there exists a constant C depending only on θ T such that

Π T u D (x) -u σ L 2 (σ ) ≤ Ch 1 2 K ∇ v K u D (L 2 (K)) d
, together with the Cauchy-Schwarz inequality, we deduce that there exists C depending only on θ T and ϕ such that

|T hv | ≤ C ∑ σ ∈F hv M σ ={K,L},K∈M v h 3 2 K h K ∇ v K u D (L 2 (K)) d (2.2.33)
which gives with a second Cauchy-Schwarz inequality

|T hv | ≤ C ∑ σ ∈F hv M σ ={K,L},K∈M v h 3 K 1 2 ∑ σ ∈F hv M σ ={K,L},K∈M v h 2 K ∇ v K u D 2 (L 2 (K)) d 1 2 .
The surface of the interface ∑ σ ∈F hv |σ | may not remain bounded as the subset M v of VAG cells is arbitrary, but

∑ σ ∈F hv M σ ={K,L},K∈M v h 3
K is bounded by the volume of the VAG cells thus we deduce that there exists a constant C depending only on θ T and ϕ such that whatever the subset M v of VAG cells one has the estimate

|T hv | ≤ Ch T ∑ σ ∈F hv M σ ={K,L},K∈M v ∇ v K u D 2 (L 2 (K)) d 1 2 .
Note that a better estimate of order h

3 2
T is obtained for |T hv | if the subset of VAG cells is such that the surface of the interface ∑ σ ∈F hv |σ | remains bounded independently of the mesh. Indeed, (2.2.33) can be written as

|T hv | ≤ C ∑ σ ∈F hv M σ ={K,L},K∈M v h K h 3 2 K ∇ v K u D (L 2 (K)) d
and applying the Cauchy-Schwarz inequality, we obtain

|T hv | ≤ C ∑ σ ∈F hv M σ ={K,L},K∈M v h 2 K 1 2 ∑ σ ∈F hv M σ ={K,L},K∈M v h 3 K ∇ v K u D 2 (L 2 (K)) d 1 2
thus, by hypothesis that ∑ σ ∈F hv |σ | remains bounded independently of the mesh, we deduce that there exists a constant C depending only on θ T and ϕ such that whatever the subset M v of VAG cells, we get

|T hv | ≤ Ch 3 2 T ∑ σ ∈F hv M σ ={K,L},K∈M v ∇ v K u D 2 (L 2 (K)) d 1 2
.

66

This concludes the proof of the limit conformity estimate (2.2.24) for the gradient discretization X 0 D , ∇ D , Π D . The extension of this estimate to D = X 0 D , ∇ D , Π D results from the estimate

Π D u D -Π D u D L 2 (Ω) ≤ Ch T u D D , for all u D ∈ X 0
D which is obtained in a similar way than the estimate (2.2.29) on Π M u D -Π D u D L 2 (Ω) established in the above proof of the coercivity.

Proof for the second gradient reconstruction: as stated in remark 2.2.1, the second gradient reconstruction (2.2.13) can be used in combination with X 0 D and Π D as a standalone gradient discretization. The proof of the coercivity, consistency and limit conformity for this gradient discretization is similar to the one presented in Lemma 3.1 of [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF]

using that ∑ ν∈Ξ K (x ν -x K )b t K,ν = I and that ∑ ν∈Ξ K R K,ν (u D )b K,ν = 0.
The limit conformity when combining this gradient discretization with the VAG gradient reconstruction (2.2.10) must be checked but this analysis is similar to the one performed above using that [START_REF] Beaude | Parallel geothermal numerical model with fractures and multibranch wells[END_REF]) and such that there exists θ with θ T l ≤ θ for all l ∈ N and such that lim l→+∞ h T l = 0. Then, the sequence (D l ) l∈N is coercive, consistent and limit conforming. Therefore the gradient scheme is convergent. Furthermore, it satisfies a first order error estimate on smooth solutions.

|σ |u σ = σ (Π T u D )dσ (x) for all σ ∈ F hv . Proposition 2.2.3 Let (D l ) l∈N be a sequence of gradient discretizations D l = X 0 D l , ∇ D l , Π D l defined
Proof: the coercivity of the sequence of gradient discretizations results from Proposition 2.2.2 and from the shape regularity assumption. The consistency of the sequence of gradient discretizations results from Proposition 2.2.2, from lim l→+∞ h T l = 0 and from the density of C 2 (Ω) ∩ H 1 0 (Ω) in H 1 0 (Ω). The limit conformity property of the sequence of gradient discretizations results from Proposition 2.2.2, the density of (C 1 (Ω)) d in H div (Ω) and from the coercivity property.

Numerical tests for second order diffusion problems

In the following subsections, the VAG scheme on the full domain (vag), the HFV scheme on the full domain (hfv) and both combined VAG-HFV schemes using stabilisation (vag-hfv stab) or not (vag-hfv) are compared on various families of meshes. All test cases consider the exact solution A convergence of order two is observed as expected in Figure 2.2.3 on the potential and of order one on the gradient for the VAG and both VAG-HFV schemes. This is not the case for the HFV scheme for which the gradient clearly does not converge due to the non planar faces in the VAG region. The combined VAG-HFV schemes solve this issue by using the consistent VAG scheme in the non planar face region. Both VAG-HFV schemes are remarkably more accurate than the VAG scheme on the potential. The VAG-HFV stabilised scheme is also more accurate than the VAG scheme on the gradient with both norms. The unstabilised version is doing slightly worse than the VAG scheme on the L ∞ gradient norm. A convergence of order two is observed as expected in Figure 2.2.5 on the potential and of order one on the gradient for all schemes. The VAG scheme is more accurate than the HFV scheme on the gradient while it is the contrary on the potential. The convergence of both combined VAG-HFV schemes matches with the convergence of the HFV scheme on the potential and the VAG-HFV schemes provide the best convergence of the gradient in L 2 norm. In L ∞ norm the convergences of the gradient for the VAG-HFV schemes are rather in between the VAG and HFV convergences.

Anisotropic test case

We consider in this subsection the previous test case with the following homogeneous anisotropic diffusion tensor As exhibited in Figure 2.2.6, the order of convergence are again the expected ones for all schemes. The VAG scheme is more accurate than the HFV scheme on the gradient while it is the contrary on the potential. The convergences of both combined VAG-HFV schemes are roughly in between those of the VAG and HFV schemes.

Λ Λ Λ =   3 -1 -1 -1 3 -1 -1 -1 3   .

Red black test case

Let us consider the family of uniform Cartesian grids of the domain Ω = (0, 1) 3 of size N × N × N with N = 8, 16, 32, 64. The cells are order in red black fashion and the VAG cells (resp. the HFV cells) correspond to the red cells (resp. black cells) as exhibited in Figure 2.2.7. Note that it implies that the HFV cells are interface cells i.e. M h = / 0.

A super convergence of order two of the gradient is observed in Figure 2.2.8 for the VAG and HFV schemes on this family of uniform Cartesian meshes. This super convergence property is lost as expected for the combined VAG-HFV schemes for which the usual order one convergence of the gradient in L ∞ norm is clearly recovered. We also remark that the HFV scheme provides a better accuracy than the VAG scheme for this family of meshes and consequently that the convergence of the potential for the combined VAG-HFV schemes is close to the one of the VAG scheme.

Combined VAG-HFV discretization of two-phase Darcy flows

The extension of the VAG-HFV discretization to two-phase Darcy flows combines ideas presented in [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF] for the VAG discretization of multi-phase Darcy flow models and in [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF] for the HFV discretization of two-phase Darcy flows. It relies on the discrete fluxes F Kν , K ∈ M , ν ∈ Ξ K defined in (2.2.14) and connecting each cell K to its nodes s ∈ V K ∩ V v and faces σ ∈ F K ∩ F h . Porous volumes are assigned as usual to all cells K ∈ M but also, following [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF], to each node s ∈ V v \ V D (excluding the Dirichlet nodes V D ). Then, discrete conservation equations are derived for all K ∈ M and s ∈ V v \ V D using the porous volumes, the discrete fluxes F Kν and an upwind approximation of the mobilities. The faces σ ∈ F h are considered as interfaces on which, following [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF], the flux continuity equations are written for each phase assuming the continuity of the phase mobility. This is a natural generalisation to the HFV discretization of the harmonic transmissibility formula which is classicaly considered for Two-Point Flux Approximations [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF][START_REF] Peaceman | Fundamentals of Numerical Reservoir Simulations[END_REF].

Two-phase Darcy flow model

Let us consider the following two-phase Darcy flow model

   φ (x)∂ t S α + div(q α ) = 0, α ∈ P, ∑ α∈P S α = 1, (2.3.1)
where φ (x) is the porous medium porosity, P = {g, l} denotes the set of the nonwetting phase (denoted by g to fix ideas) and the wetting phase (denoted by l to fix ideas) and S α , α ∈ P is the phase saturation. The flow rates q α are defined by the following generalized Darcy laws for α ∈ P

q α = - k α r (x, S α ) µ α Λ Λ Λ(x) ∇P α -ρ α g , (2.3.2)
where ρ α is the phase mass density, µ α is the phase dynamic viscosity, g is the gravitational acceleration, Λ Λ Λ(x) is the absolute permeability tensor, k α r (x, S α ) is the phase relative permeability and P α is the phase pressure. The model is closed by the following capillary pressure relation P g -P l = P c (x, S g ),

where P c (x, S g ) is the capillary function.

The boundary conditions are the following. On ∂ Ω D , we consider a Dirichlet boundary condition with prescribed pressures P α and saturations S α , α ∈ P. On ∂ Ω N , homogeneous Neumann boundary conditions are imposed with q α • n = 0 for α ∈ P.

V v D = V v ∩ ( σ ∈F D V σ ),
and the Neumann boundary HFV faces by

F h N = F N ∩ F h .
A rocktype rt K is assigned to each cell K ∈ M and each rocktype rt corresponds to given capillary and phase relative permeability functions denoted by P c,rt (S g ) and k α r,rt (S α ). The porosity and absolute permeability tensor are also assumed cellwise constant and denoted by φ K and Λ Λ Λ K for all K ∈ M .

For the VAG discretization, a single rocktype rt s is assigned to each non-Dirichlet node s ∈ V v \ V v D . It is chosen as the most permeable rocktype among all rocktypes (rt K ) K∈M s ∩M v . Then, the porous volume is distributed to the VAG nodes as follows: given a parameter ω ∈ (0, 1), we set for all

K ∈ M v , s ∈ V v ∩ V K α Ks =    0 if rt K = rt s or s ∈ V v D , ω #V K \V v D #{s ∈V K \V v D | rt s =rt K } if rt K = rt s and s ∈ V v D ,
thus the porous volumes are

ϕ s = ∑ K∈M s ∩M v α Ks φ K |K|, (2.3.3) for s ∈ V v , ϕ K = (1 -∑ s∈V K α Ks )φ K |K|, (2.3.4)
for K ∈ M v , and

ϕ K = φ K |K|, (2.3.5) for K ∈ M h ∪ M hv . Note that ω is chosen small enough such that (1 -∑ s∈V K α Ks ) > 0 (see Figure 2.3.1). The complementary rock volume for ν ∈ M ∪ (V v \ V v D
) is denoted by φν . For HFV Dirichlet boundary faces σ ∈ F h D , let us also set rt σ = rt K with M σ = {K}.

K ∈ M hv K ∈ M h K ∈ M v s ∈ V K α Ks |K| F hv
U D = {(P g ν , P l ν , S g ν , S l ν ), ν ∈ M ∪ V v ∪ F h D } ∪ {(P g σ , P l σ ), σ ∈ F h \ F h D }, (2.3.6)
and let us introduce the subsets of phase pressure unknowns by

P α D = {P α ν , ν ∈ M ∪ V v ∪ F h }, (2.3.7)
for α ∈ P. Using the combined VAG-HFV discretization, let us define the discrete Darcy fluxes for all K ∈ M and ν ∈ Ξ K by

P g K , P l K , S g K , S l K P g K , P l K , S g K , S l K P g σ , P l σ P g s , P l s , S g s , S l s P g K , P l K , S g K , S l K F hv
F α Kν (P α D ) = F Kν (P α D ) -ρ α F Kν (g D ) with g D ∈ X D such that for all ν ∈ Ξ D , g ν = x ν • g.
The discrete generalized Darcy fluxes for all K ∈ M and ν ∈ Ξ K are deduced using an upwind approximation of the mobilities as follows

q α Kν (U D ) =                          k α r,rt K (S α K ) µ α (F α Kν (P α D )) + + k α r,rt ν (S α ν ) µ α (F α Kν (P α D )) -, if ν ∈ V v ∪ F h D , k α r,rt K (S α K ) µ α (F α Kν (P α D )) + + k α r,rt L (S α L ) µ α (F α Kν (P α D )) -, if ν ∈ F h \ (F h D ∪ F h N ), M ν = {K, L}, 0 if ν ∈ F h N ,
where for any real u, we have set (u) + = max(0, u) and (u) -= min(0, u).

The time integration is based on a fully implicit Euler scheme to avoid severe restrictions on the time steps. For N t f ∈ N * , let us consider the time discretization

t 0 = 0 < t 1 < • • • < t n-1 < t n < • • • < t N t f = t f of the time interval [0,t f ].
We denote the time steps by ∆t n = t nt n-1 for all n = 1, • • • , N t f . It leads to the following set of equations at each time step n = 1, • • • , N t f accounting for the cell conservation equations

ϕ K S α,n K -S α,n-1 K ∆t n + ∑ ν∈Ξ K q α Kν (U n D ) = 0, K ∈ M , α ∈ P, (2.3.8)
the VAG node conservation equations

ϕ s S α,n s -S α,n-1 s ∆t n - ∑ K∈M s \M h q α Ks (U n D ) = 0, s ∈ V v \ V v D , α ∈ P, (2.3
∑ K∈M σ F α Kσ (P α,n D ) = 0, σ ∈ F h \ F h D , α ∈ P, (2.3.10)
the Dirichlet boundary conditions at Dirichlet nodes and faces

P α,n ν = P α D,ν , S α,n ν = S α D,ν , ν ∈ V v D ∪ F h D , α ∈ P, (2.3.11)
and with the closure laws

S g,n ν + S l,n ν = 1, P g,n ν -P l,n ν = P c,rt ν (S g,n ν ), ν ∈ M ∪ V v \ V v D .
(2.3.12)

Numerical experiments on a one dimensional solution

This test case considers the domain Ω = (0, 1) 3 with homogeneous isotropic permeability Λ Λ Λ = 1 and porosity φ = 1. The gravitational acceleration g is set to zero, the relative permeabilities to k α r (S α ) = (S α ) 2 , α = g, l, the dynamic viscosities to µ g = 5 and µ l = 1 and the capillary pressure to P c (S g ) = -0.1 log(1 -S g ). Dirichlet boundary conditions are set at x = 0 with imposed non-wetting phase pressure P g = 2 and saturation S g = 0.9, as well as at x = 1 with P l = 0 and S g = 0. Homogeneous Neumann conditions are considered at the remaining boundaries. The saturation is set to S g = 0 at initial time t = 0 and the final simulation time is fixed to t f = 1.

In the following subsections, the VAG scheme on the full domain (vag), the HFV scheme on the full domain (hfv) and both combined VAG-HFV schemes using stabilisation (vag-hfv stab) or not (vag-hfv) are compared on three families of meshes. The error is computed both for the saturation and for the non-wetting phase pressure compared to a numerical reference solution obtained on a one dimensional uniform grid with 1000 cells and time steps. A space time discrete L 1 norm computed from all cell and time step values is used for simplicity.

For all test cases, a uniform time stepping is used with 200 time steps on [0,t f ]. The system of equations (2.3.8)-(2.3.9)-(2.3.10)-(2.3.11) is solved at each time step by using a Newton-min algorithm w.r.t. the set of primary unknowns The Jacobian matrix is computed analytically, then the VAG cell primary unknowns and conservation equations for K ∈ M v are eliminated without any fill-in by Schur complement. As mentioned in Remark 2.2.4, in the case of superadmissibility of the cells K ∈ M h ∪ M hv such as for Cartesian cells with isotropic permeability tensor, the HFV scheme reduces to a TPFA scheme and the face unknowns {(P g σ , P l σ ), σ ∈ F h \ F h D } are eliminated from the flux continuity equations (2.3.10). When using the stabilised version of the combined VAG-HFV scheme, note that the TPFA fluxes are not preserved at the faces of the interface cells. Consequently these face unknowns will not be eliminated for the stabilised VAG-HFV scheme. The reduced linear systems obtained at each Newton iteration are solved using the GMRes iterative solver combined with a CPR-AMG preconditioner [START_REF] Lacroix | Decoupling preconditioners in the implicit parallel accurate reservoir simulator (IPARS)[END_REF][START_REF] Scheichl | Decoupling and block preconditioning for sedimentary basin simulations[END_REF].

U P D = {(P g ν , S g ν ), ν ∈ M ∪ V v \ V v D } ∪ {(P g σ , P l σ ), σ ∈ F h \ F h D }, (2.3
The numerical behaviour of the four schemes is reported for the three families of meshes on the finest mesh with N red the number of degree of freedom of the reduced linear systems with two primary unknowns per d.o.f., NZ red the number of non-zero 2 by 2 entries in the reduced linear systems, N newton the average number of Newton iterations per time step and N gmres the average number of GMRes iterations per Newton step. The CPU times are in seconds on 3.1 Ghz Intel Core i7 processor and 16Go RAM.

Hexahedral meshes

Let us consider the family of uniform Cartesian grids of the domain Ω = (0, 1) 3 Figure 2.3.3 exhibits, for the four schemes, the convergence of the error. All schemes exhibit the same order of convergence both for the saturation (lower but close to 1) and for the pressure (roughly 1). The VAG scheme is more accurate on this type of mesh since it uses more d.o.f. than the HFV scheme for the transport of the saturation accounting for the leading error term due to the first order upwind discretization of the mobilities. The combined VAG-HFV schemes both exhibit roughly the same convergence as the HFV scheme since the HFV domain is much larger than the VAG domain in this test case. Table 2.3.1 exhibits the numerical behaviour of the four schemes on the finest mesh N = 32 with 4096 hexahedra in the VAG subdomain and 28672 cubes in the HFV subdomain. All schemes have roughly the same number of Newton iterations and hence their numerical behaviours differ by the sparsity of the reduced linear systems and efficiency of the CPR-AMG preconditioner. The HFV scheme reduces to a TPFA scheme in the HFV region representing most of the domain which explains the better CPU time observed with the HFV scheme compared with the VAG scheme. The VAG-HFV scheme without stabilisation leads to the sparsest reduced system and to the lowest CPU time. The stabilisation increases the number of non-zero elements of the reduced linear systems since the face unknowns located at the interface cells are not eliminated. The CPR-AMG preconditioner is also less efficient leading to a CPU time that is twice larger than the unstabilised VAG-HFV scheme. As exhibited in Figure 2.3.5, the convergence of the error behaves like in the previous test case.

Scheme

The following Table 2.3.2 exhibits the numerical behaviour of the four schemes on the finest mesh N = 32 with 16384 cubes in the HFV subdomain and 98304 pyramids in the VAG subdomain. The HFV scheme is roughly four times more costly than the three other schemes due to the much larger number of faces in the VAG region compared with the number of nodes and to the number of CPR-AMG preconditioner iterations which is doubled.

Red black test case

Let us consider the family of uniform Cartesian grids of the domain Ω = (0, 1) 3 of size N × N × N with N = 4, 8, 16, 32. The cells are ordered in red black fashion and the VAG cells (resp. the HFV cells) correspond to the red cells (resp. black cells) as exhibited in Figure 2.2.7.

The VAG and VAG-HFV schemes have roughly the same structure in the sense that the face unknowns are only located at the boundary faces σ ∈ F ext ∩ F h for the VAG-HFV schemes. Note however, as can be noticed in Table 2.3.3, that the HFV cells are not eliminated for the VAG-HFV schemes while they are eliminated for the VAG scheme. Let us also remark that the HFV scheme reduces here to a TPFA scheme on the full domain. From Figure 2.3.6, we can check as expected that the convergence of the errors for the VAG and for both VAG-HFV schemes are very close while the HFV scheme is less accurate due to its twice lower number of unknowns used for the transport of the saturation. As for the previous test cases, the orders of convergence are the same for all schemes. Table 2.3.3 exhibits the numerical behaviour of the four schemes on the finest mesh N = 32 with 16384 cubes both in the VAG and HFV regions. The HFV scheme is much cheaper since it reduces to a TPFA scheme on the full domain, while the three other schemes are rather close in CPU time with a significantly larger cost for the stabilised version of the VAG-HFV scheme.

Scheme

Combined VAG-HFV discretization of non-isothermal compositional two-phase Darcy flows

We consider in this section the extension of the previous combined VAG-HFV discretization to the case of a non-isothermal compositional two-phase Darcy flow. This extension is based on the formulation of the model introduced in Section 1.2.1. Its main advantage compared with the related Coats' variable switch formulation [START_REF] Coats | Implicit compositional simulation of single-porosity and dual-porosity reservoirs[END_REF] is to fix the set of unknowns using extended phase molar fractions and to express the thermodynamic equilibrium as complementarity constraints for both phases α ∈ P. Previous works have considered the VAG discretization of isothermal and of non-isothermal compositional two-phase Darcy flows in respectively [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF] and [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. The HFV discretization of isothermal two component two-phase Darcy flows is also derived in [START_REF] Angelini | Finite volume approximation of a diffusion-dissolution model and application to nuclear waste storage[END_REF] and the related Mixed-Hybrid Finite Element discretization of three-phase Darcy flows in [START_REF] Abushaikha | Fully implicit mixed-hybrid finite element discretization for general purpose subsurface reservoir simulation[END_REF]. Our extension to the combined VAG-HFV discretization follows the methodology presented in the previous section for immiscible isothermal two-phase flows which takes advantage of the cell-centered definition of the fluxes shared by the VAG, the HFV and by the combined scheme at interface cells.

Non-isothermal compositional two-phase Darcy flow model

Let us recall the non-isothermal compositional liquid gas Darcy flow model introduced in Chapter 1 with the T-PSC formulation. Each phase α ∈ P is a mixture of an arbitrary number of components with typically the water component (denoted by w) which can vaporize in the gas phase and the air component (denoted by a) which can dissolve in the liquid phase. The set of components is denoted by C . The thermodynamic properties of each phase α ∈ P depend on its pressure P α , the local equilibrium temperature of the system T and its molar fractions

C α = (C α i ) i∈C .
Our formulation of the model is based on the fixed set of unknowns defined by U = (P g , P l , T, S g , S l ,C g ,C l ).

Let us recall the notations for the thermodynamic laws. The molar density is denoted by ζ α (P α , T,C α ) and the dynamic viscosity by µ α (P α , T,C α ) for each phase α ∈ P. The mass density is defined by ρ α (P α , T,C α ) = ∑ i∈C C α i m i ζ α where m i is the molar mass of the component i ∈ C . Let us denote by e α (P α , T,C α ) the molar internal energy, by h α (P α , T,C α ) the molar enthalpy of the phase α ∈ P and by E r (T ) the rock energy per unit rock volume. For shorter notations, let us introduce the fluid energy per unit pore volume defined by

E f (U) = ∑ α∈P ζ α S α e α ,
and the number of moles of the component i ∈ C per unit pore volume denoted by

n i (U) = ∑ α∈P ζ α S α C α i , i ∈ C .
In order to simplify the notations, each thermodynamic law can also be written in the following as a function of the full set of variables U still keeping the same notation for the function. Thermodynamic equilibrium between the gas and liquid phases is assumed for each component and governed by the phase fugacities denoted by

f α (P α , T,C α ) = ( f α i (P α , T,C α )) i∈C , α ∈ P.
Note that, as opposed to the Coats' variable switch formulation [START_REF] Coats | Implicit compositional simulation of single-porosity and dual-porosity reservoirs[END_REF][START_REF] Class | Numerical simulation of non-isothermal multiphase multicomponent processes in porous media.: 1. An efficient solution technique[END_REF], the molar fractions C α of an absent phase α are extended by the ones at equilibrium with the present phase in the sense that the equality of the gas and liquid fugacities f g (P g , T,C g ) = f l (P l , T,C l ) always holds (let us refer to Section 1.2.1). This allows fixing the set of unknowns independently of the present phases.

The total molar flow rate q i of the component i ∈ C and the energy flow rate q e are obtained from the generalized Darcy velocities introduced in (2.3.2) such that

q i = ∑ α∈P C α i ζ α q α , q e = ∑ α∈P h α ζ α q α -λ ∇T, (2.4.1)
where λ stands for the bulk thermal conductivity of the fluid and rock mixture. The molar diffusion is neglected for the sake of simplicity.

Let us write the system of equations accounting for the molar conservation of each component i ∈ C together with the energy conservation

φ (x)∂ t n i + div(q i ) = 0, i ∈ C , φ (x)∂ t E f + (1 -φ (x))∂ t E r + div(q e ) = 0. (2.4.2)
It is complemented by the capillary relation between the two phase pressures and the pore volume balance

P c (x, S g ) = P g -P l , ∑ α∈P S α = 1.
In the spirit of [START_REF] Lauser | A new approach for phase transitions in miscible multi-phase flow in porous media[END_REF], the liquid gas thermodynamic equilibrium can be expressed as the following complementarity constraints for each phase α ∈ P combined with the equality of the gas and liquid fugacities of each component

min(S α , 1 -∑ i∈C C α i ) = 0, α ∈ P, f g i (P g , T,C g ) = f l i (P l , T,C l ), i ∈ C .
To fix ideas, let us consider a Dirichlet boundary condition on ∂ Ω D with prescribed phase pressure P α , molar fractions C α , saturation S α , α ∈ P and temperature T . On ∂ Ω N , homogeneous Neumann boundary conditions are imposed with q i • n = 0 for i ∈ C and q e • n = 0.

Combining the VAG and HFV discretizations of non-isothermal compositional two-phase Darcy flows

The extension of the discrete set of unknowns (2.3.6) to the non-isothermal compositional two-phase flow model is defined by

U D = {(P g ν , P l ν , T ν , S g ν , S l ν ,C g ν ,C l ν ), ν ∈ M ∪ V v ∪ F h D } ∪ {(P g σ , P l σ , T σ ), σ ∈ F h \ F h D }. (2.4.3)
The discrete generalised compositional Darcy and flowing enthalpy fluxes write respectively

q i,Kν (U D ) = ∑ α∈P C α i,(Kν) α V α Kν (U D ), K ∈ M , ν ∈ Ξ K , i ∈ C ,
and

q e,Kν (U D ) = ∑ α∈P h α (U (Kν) α )V α Kν (U D ), K ∈ M , ν ∈ Ξ K .
It leads to the following set of equations at each time step n = 1, • • • , N t f accounting for the cell conservation equations

                   ϕ K n i (U n K ) -n i (U n-1 K ) ∆t n + ∑ ν∈Ξ K q i,Kν (U n D ) = 0, i ∈ C , ϕ K E f (U n K ) -E f (U n-1 K ) ∆t n + φK E r (U n K ) -E r (U n-1 K ) ∆t n + ∑ ν∈Ξ K q e,Kν (U n D ) + ∑ ν∈Ξ K λ n-1 K G Kν (T n D ) = 0, (2.4.4)
for K ∈ M , the VAG node conservation equations

                   ϕ s n i (U n s ) -n i (U n-1 s ) ∆t n - ∑ K∈M s \M h q i,Ks (U n D ) = 0, i ∈ C , ϕ s E f (U n s ) -E f (U n-1 s ) ∆t n + φs E r (U n s ) -E r (U n-1 s ) ∆t n -∑ K∈M s \M h q e,Ks (U n D ) - ∑ K∈M s \M h λ n-1 K G Ks (T n D ) = 0, (2.4.5) for s ∈ V v \ V v D ,
∑ K∈M σ F α Kσ (P α,n D ) = 0, α ∈ P, ∑ K∈M σ λ n-1 K G Kσ (T n D ) = 0, (2.4.6)
for σ ∈ F h \ F h D , the Dirichlet boundary conditions at Dirichlet nodes and faces

P α,n ν = P α D,ν , T n ν = T D,ν , S α,n ν = S α D,ν , C α,n ν = C α D,ν , α ∈ P, (2.4.7) for ν ∈ V v D ∪ F h D and with the closure laws                  S g,n ν + S l,n ν = 1, P g,n ν -P l,n ν = P c,rt ν (S g,n ν ), min(S α,n ν , 1 -∑ i∈C C α,n i,ν ) = 0, α ∈ P, f g i (P g,n ν , T n ν ,C g,n ν ) = f l i (P l,n ν , T n ν ,C l,n ν ), i ∈ C , (2.4.8) for ν ∈ M ∪ V v \ V v D .
The non-linear system defined by the conservation equations (2.4.4)-(2.4.5), the flux continuity equations (2.4.6) and the local closure laws (2.4.8) is solved at each time step w.r.t. the set of unknowns U n D (2.4.3) by a Newton-min algorithm adapted to the complementarity constraints (see Section 1.5 for details). The size of the linear system to be solved at each Newton iteration can be considerably reduced by elimination of the Dirichlet d.o.f. and by elimination for each d

.o.f. ν ∈ M ∪ V v \ V v D of
P ν = U ν \U S ν is reported in Table 2.4.1.
Furthermore, the VAG cell unknowns U K and equations (2.4.4), K ∈ M v can be eliminated from the linear system without any fill-in by Schur complement which considerably reduces the number of VAG d.o.f. in the case of simplectic meshes. Finally, in the case of superadmissibility of the cells K ∈ M h ∪ M hv , as in Remark 2.2.4, the HFV scheme reduces to a TPFA scheme and the face unknowns {(P g σ , P l σ , T σ ), σ ∈ F h \ F h D } are eliminated from the Darcy and Fourier flux continuity equations (2.3.10) leading to the classical harmonic transmissibilities.

Table 2.4.1 -Primary unknowns of the degree of freedom

ν ∈ M ∪ V v \ V v
D depending on the active complementarity constraints of the Newton-min algorithm.

ν ∈ M ∪ V v \ V v D 1 -∑ i∈C C g i,ν = 0 U P ν = P g ν , S g ν , (C l i,ν ) i∈C \{w} 1 -∑ i∈C C l i,ν = 0 S g ν = 0 U P ν = P g ν , T ν , (C l i,ν ) i∈C \{w} 1 -∑ i∈C C l i,ν = 0 1 -∑ i∈C C g i,ν = 0 U P ν = P g ν , T ν , (C g i,ν ) i∈C \{w} S l ν = 0

Application to geothermal simulations

High temperature geothermal fields are often located in active geological settings (e.g. plate boundaries, volcanic areas...) with complex natural structures and geometries such as fault networks with discontinuous properties and fractures that act as drains or barriers on the deep transfer of mass and energy, thus controlling the distribution of geothermal resources. The geological modelling of such systems and their discretization into conforming unstructured meshes are challenging tasks and often result in meshes that are hardly tractable for flow simulations. In such situation, hybrid meshes composed of different types of cells best suited to discretize the geology and geometry in different parts of the geothermal system represent a clear asset. Then, the scheme is adapted locally to the type of mesh/cells and to petrophysical properties using the methodology developed in the previous sections.

In this section, we consider a simplified geological setting which corresponds to the two dimensional vertical cross-section of the Bouillante high temperature geothermal field (Guadeloupe, French West Indies). The vertical cross-section is assumed to be in the plane of major fault zone acting as a regional permeable drain (see Figure 3 in the Introduction). Our objective is to compare the results of the simulations on different meshes and schemes of the non-isothermal compositional liquid gas Darcy flow model. The following test cases focus on the coupling between the VAG scheme and the TPFA scheme assuming that the cells K ∈ M h ∪ M hv satisfy the TPFA admissibility conditions. Only the unstabilised version of the combined VAG-TPFA scheme is considered in order to preserve the two-point fluxes at all faces σ ∈ F h . Indeed, the previous results on the order of convergence of both combining schemes highlighted that they have the same performances, the unstabilised version being slightly quicker in term of CPU time and less complex. We first consider in the next subsection a simple tracer test case with analytical solution to validate the various discretizations. Then, a two-component liquid gas geothermal test case is investigated.

Tracer test case

Let us set C = {a, w} and consider the following tracer model in the liquid phase

∂ t C l i + div(C l i q l ) = 0, i ∈ C , C l a +C l w = 1, (2.4.9)
with q l = -∇P l .

On the boundary ∂ Ω, a Dirichlet boundary condition for the pressure P l is imposed such that the exact pressure is given by This tracer test case is simulated using the implementation of the liquid gas compositional model presented in the previous section in the isothermal case. Several meshes of approximatively 18000 cells have been generated to highlight the specificities of the schemes. Let us first apply each scheme independently on its most natural mesh, i.e. the TPFA scheme on a Voronoi mesh and the VAG scheme on a triangular mesh. It is checked as expected that the affine pressure solution is exactly reproduced in both cases. shows that the numerical diffusion of the TPFA and VAG schemes depends on the flow direction when using an oriented grid. On the top images the velocity is vertical thus orthogonal or aligned with the faces of the Cartesian mesh, this induces that the TPFA scheme has no lateral numerical diffusion on the subdomain Ω \ Ω v . The top left and right images exhibit this phenomenon. The VAG scheme has no lateral numerical diffusion when the velocity is aligned with the diagonal of a square Cartesian mesh, since in such a case, the VAG scheme is a TPFA scheme on a diagonal Cartesian submesh. The test cases are close to this configuration on Ω \ Ω v for p a = 1.1 which explains why there is less lateral numerical diffusion for this scheme when the velocity q l is almost diagonal (bottom middle image compared with the bottom left and right images). As in Figure 2.4.1, when leaving the Cartesian subdomain Ω \ Ω v , the numerical diffusion becomes similar for both schemes since the mesh is unstructured.

P l = p a x -z,

Two dimensional Bouillante geothermal test case

In this subsection, the TPFA, VAG and VAG-TPFA schemes are applied to a simplified two dimensional cut of the Bouillante geothermal reservoir. We consider the nonisothermal compositional two-phase Darcy flow model introduced in Section 2.4 with the set of water and air components C = {a, w}.

The thermodynamic laws used in this test case are the following. The gas phase is assumed to have a perfect gas molar density ζ g = P g RT , R = 8.314 J. K -1 . mol -1 and a constant gas dynamic viscosity fixed to µ g = 2 • 10 -5 Pa. s. The liquid molar enthalpy h l and the gas molar enthalpies of each component h g a , h g w are taken from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF], from which the gas molar enthalpy is deduced assuming a perfect mixture

h g (P g , T,C g ) = ∑ i∈C C g i h g i (P g , T ).
The liquid molar density and viscosity are also fixed to the constant values ζ l = 1000 0.018 mol. m -3 and µ l = 10 -3 Pa. s in order to avoid thermal convection instabilities which would prevent the comparison of the schemes on the different types of meshes. The mass density is defined by ρ α = ζ α ∑ i∈C m i C α i with the molar masses m a = 0.029 and m w = 0.018 kg. mol -1 . The molar internal energy e α (T ) of each phase α ∈ P is considered to be equal to its enthalpy. The fugacities are defined by

         f g i = C g i P g , i = a, w, f l a = C l a H a , f l w = C l w P sat (T ) exp - P sat (T ) -P l ζ l RT ,
where the Henry constant of the air component is set to H a = 10 8 Pa and the vapour pressure P sat (T ) is given by the Clausius-Clapeyron equation

P sat (T ) = 100 exp 46.784 - 6435 T -3.868 log(T ) .
In this test case, the porous medium is homogeneous with porosity φ (x) = 0.35 and isotropic permeability Λ Λ Λ(x) = K × I with K = 1 D. The relative permeabilities plotted in Figure 2.4.4 are defined by k α r (S α ) = (S α ) 2 for each phase α ∈ P and the capillary pressure function is given by the Corey law

P c (S g ) =    -b ln(1 -S g ) if 0 ≤ S g ≤ S 1 , -b ln(1 -S 1 ) + b 1 -S 1 (S g -S 1 ) if S 1 < S g ≤ 1,
regularized for S g ∈ (S 1 , 1] to allow for the disappearance of the liquid phase, with b = 2 • 10 5 Pa and S 1 = 0.99 (see Figure 2.4.4). The rock energy per unit rock volume is fixed to E r (T ) = 2 • 10 6 T in J. m -3 and the bulk thermal conductivity of the fluid and rock mixture is fixed to λ = 3 W. m -1 . K -1 . The upper boundary is composed of three parts corresponding to the seabed (z ≤ 0 m and 0 ≤ x ≤ 5000 m), a sunny plain zone (0 < z ≤ 500 m and 5000 m < x ≤ 8450 m) and a rainy mountain zone (z > 500 m and 8450 m < x ≤ 11000 m)

• the seabed boundary condition is defined by a pure water liquid phase (S l = 1, C l w = 1) at hydrostatic pressure. The temperature is sea depth dependent. It is linear between the sea level z = 0 m at 300 K and z = -100 m at 278 K, then constant below z = -100 m,

• the sunny plain zone is defined by the relative humidity fixed to 0.5, the temperature fixed to 300 K and the gas pressure fixed to P g = 1 atm, from which we deduce that only the gas phase is present with the molar fractions roughly equal to C g a 0.99, C g w 10 -2 ,

• the rainy mountain zone is characterized by a two-phase state at thermodynamic equilibrium which is defined by a fixed temperature, gas pressure and relative humidity corresponding to the following physical values The simulations are run over the time interval [0,t f ], t f = 650 years, with an adaptive time stepping starting with an initial time step of 1 day and with a maximum time step of 150 days. Several meshes of roughly 18500 cells have been generated, a triangular mesh, a Voronoi mesh admissible both at inner and boundary faces, an hybrid mesh exhibited in Figure 2.4.2 combining Cartesian cells on the bottom subdomain Ω \ Ω v and Voronoi cells on the upper subdomain Ω v with

Ω v = {x ∈ Ω | z > -1500 m}.
A fourth mesh exhibited in Figure 2.4.6 is best suited for the VAG-TPFA scheme and combines Cartesian cells on the bottom subdomain Ω \ Ω v with triangular cells on the upper subdomain Ω v . In this thesis, when the domain is composed of two distinct types of cells the two subdomains contain approximatively the same number of cells. The numerical results on the various combinations of meshes and schemes are compared to a reference solution obtained on a refined hybrid mesh with roughly 78000 cells including Cartesian cells on the TPFA subdomain Ω \ Ω v and triangular cells on the VAG subdomain Ω v . 8, 2.4.9 and 2.4.12). The flow lines being better captured, the temperature profile is more accurate and it is reflected on the gas saturation close to the top boundary because in this part the gas phase is composed of water vapour. Some differences in the gas saturation are also visible since the meshes are not refined enough. Table 2.4.2 compares the numerical behaviour of the simulation with N red the number of degree of freedom of the reduced linear systems with 3 primary unknowns per d.o.f., NZ red the number of non-zero 3 by 3 entries in the reduced linear systems, N t f the number of successful time steps, N chops the number of time step chops and N newton the average number of Newton-min iterations per successful time step. The CPU times are in seconds on 2.9 GHz Intel Core i5 processor and 8Go RAM. This table exhibits large differences in CPU time between the different meshes and schemes whereas the numbers of cells are comparable for all meshes. Thanks to the elimination of the VAG cell unknowns for all K ∈ M v , the number of non-zero entries in the Jacobian matrix is the smallest with the VAG scheme combined with the triangular mesh. It results that the VAG scheme combined with the triangular mesh leads to the fastest solution. On the other hand, as explained above, it also leads to a less accurate solution compared with the solution obtained using the TPFA scheme combined with a Cartesian mesh on the lower part of the reservoir. All together, the Cartesian-triangular mesh combined with the VAG-TPFA scheme provides the best compromise in terms of CPU time and accuracy for this geothermal test case.

Conclusion

A new methodology is introduced in this work to combine face-centered (HFV or TPFA) and nodal-centered (VAG) discretizations on hybrid meshes in order to adapt the numerical scheme to the different types of cells and medium properties in different parts of the mesh. The stability and convergence of the combined VAG-HFV schemes have been studied in the gradient discretization framework and are shown to hold on arbitrary partitions of the cells for the unstabilised version and on arbitrary partitions of the faces for the stabilised version. The framework preserves at the interface the discrete conservation properties of the VAG and HFV schemes with fluxes based on local to each cell transmissibility matrices of size the number of d.o.f. at the cell bound-ary. This discrete conservative form allows a natural extension of the VAG and HFV discretizations of two-phase Darcy flow models to the combined VAG-HFV schemes. Numerical results on different types of meshes have shown the accuracy and efficiency of the combined schemes which have been compared to the standalone VAG and HFV (or TPFA) discretizations. The convergence of the schemes has first been studied numerically for single-phase and two-phase Darcy flows using analytical solutions and numerical reference solutions. Then, a non-isothermal compositional liquid gas Darcy flow test case representing a two dimensional vertical cross-section of the Bouillante geothermal reservoir has been considered. For this test case, the combined VAG-TPFA scheme on an hybrid Cartesian triangular mesh is shown to provide the best compromise between accuracy and CPU time compared with the VAG scheme on a triangular mesh and the TPFA scheme on a Voronoi mesh.

One difficulty faced during this study relies on the bad preconditioning of the Jacobian matrix when using the HFV scheme. Indeed, there are two elliptic pressure unknowns located at the faces centers and only one located at the cells centers which prevents the use of the CPR-AMG preconditioner. Usually it is based on the definition of a pressure bloc which is preconditioned with CPR-AMG but it is not suitable for the HFV scheme because the definition of the pressure bloc is not possible as the number of equations depends on the degree of freedom. To solve the problem, one idea would be to eliminate the pressure unknowns located at the faces centers (as for the TPFA scheme for example), except that for the HFV scheme it would fill too much the Jacobian matrix. Thus it could be interesting to study an approximate elimination of the two pressures by choosing a sparse stencil. And finally the reduced Jacobian matrix containing only the pressure unknowns located at the cells centers could be easily preconditioned with CPR-AMG.

It would also be interesting to perform further works on this combined scheme to simulate other test cases on three dimensional domains with more complex geological objects such as faults or fractures. The HFV face based discretization is natural at the neighbourhood of the fractures because it creates no coupling between the interface unknowns, which allows eliminating them from the Jacobian matrix. However, using only the HFV scheme would be very expensive on tetrahedral mesh. On the other hand, the VAG discretization is well adapted if there is no interface unknown but it does not capture jumps of the pressures and the saturations between the reservoir and the fracture. It is possible to add interface unknowns however in this case VAG becomes time consuming. Thus the combining VAG-HFV scheme should be a pertinent solution.

97

Chapter 3

Atmospheric boundary condition

Abstract: in geothermal modelling, the impact of the atmosphere is sometimes important. Since the coupling between the porous medium and the 2D surface of 3D atmospheric flows is not computationally realistic at the space and time scales of a geothermal flow, the objective of this chapter is rather to model the soil-atmosphere interaction using an advanced boundary condition accounting for the matter (mole) and energy balance at the interface between the porous medium and the atmosphere. The model considers an atmospheric boundary layer with convective molar and energy transfers (assuming the vaporization of the liquid phase in the atmosphere), a liquid outflow condition at seepage surfaces, as well as the heat radiation and the precipitation influx [START_REF] Beaude | Non-isothermal compositional liquid gas darcy flow: formulation, soil-atmosphere boundary condition and application to high energy geothermal simulations[END_REF]. Once introduced, this boundary condition is assessed using a reference solution coupling the Darcy flow to a full-dimensional gas free flow. Then the advanced atmospheric boundary condition is applied to two components (air-water) and three components (air-water-salt) geothermal simulations. Finally the boundary condition is tested on a hybrid mesh with the combined nodal-face based discretization introduced in Chapter 2.

Introduction

The quantitative understanding of the shallow parts of geothermal systems is challenging both for the exploration and exploitation of high energy geothermal resources. About exploration, the unsaturated zone and/or cooler superficial water flows can considerably alter evidences of the presence of a deeper geothermal resource. In some cases, the resource may be totally hidden. In terms of exploitation, as some systems underlay urbanized areas (e.g. Rotorua in New Zealand or Bouillante in the French Caribbean), resource exploitation much be carefully monitored and controlled in order to avoid unwanted induced surface manifestations or risks. Moreover, several features such as geysers, have a major cultural significance for indigenous populations and must therefore be protected and kept unaltered [START_REF] O'sullivan | Using reservoir models for monitoring geothermal surface features[END_REF].

The physics embedded in the numerical model should correctly handle non-linear evolution of saturation transients with water table fluctuations, high temperature gradients and phase change processes in the shallow levels of the simulation domain. In addition, simulation meshes must correctly capture topographic effects and have sufficient vertical resolutions in these areas.

As mentioned in [START_REF] O'sullivan | Geothermal reservoir simulation: the state-of-practice and emerging trends[END_REF][START_REF] O'sullivan | Future directions in geothermal modelling[END_REF], the interaction between the flow in the porous medium and the atmosphere plays an important role in geothermal flows. Current software suffers several limitations in terms of boundary conditions which are known to play a major role in geothermal flows [START_REF] O'sullivan | Geothermal reservoir simulation: the state-of-practice and emerging trends[END_REF][START_REF] O'sullivan | Future directions in geothermal modelling[END_REF]. Mixed-type transient boundary conditions are not supported which impedes the convenient modelling of natural processes such as recharge or seepage or water table fluctuations. Workarounds may exist (e.g. [START_REF] Hurwitz | Groundwater flow, heat transport, and water table position within volcanic edifices: Implications for volcanic processes in the cascade range[END_REF]) but are relatively tedious to implement and are not formulated in a generic way. Transient complex upper or lower boundary conditions are mandatory to take into account some crucial processes. In volcanic island settings, the inland water table may be excessively deep and the interactions between the vadose zone and the fresh water recharge may hide geothermal resources ( [START_REF] Byrdina | Influence of the regional topography on the remote emplacement of hydrothermal systems with examples of ticsani and ubinas volcanoes[END_REF][START_REF] Hurwitz | Groundwater flow, heat transport, and water table position within volcanic edifices: Implications for volcanic processes in the cascade range[END_REF]). In sedimentary basins the interactions with the topography and recharge areas must be correctly taken into account to reproduce head distributions at basin scale [START_REF] Dentzer | Réévaluation du potentiel géothermique en ile de france[END_REF]. Though many groundwater simulation software programs can deal with the vadose zone, they are rarely designed to study multiphasic hydrothermal processes. Conversely, some geothermal reservoir simulators propose to take into account a gas/air component [START_REF] O'sullivan | Improved convergence for air-water and co2-water tough2 simulations[END_REF] but they are still restricted to rather simple boundary conditions and most of the time the alternative is between fixed value/Dirichlet type for all primary variables or fixed fluxes/Neumann type for all conserved quantities (e.g. [START_REF] Pruess | TOUGH2 user's guide, version 2[END_REF]).

Since the coupling between the porous medium and the 2D surface of 3D atmospheric flows is not computationally realistic at the space and time scales of a geothermal flow, our objective is rather to model the soil-atmosphere interaction using an advanced boundary condition accounting for the matter (mole) and energy balance at the interface between the porous medium and the atmosphere. Such model should take into account an atmospheric boundary layer with convective molar and energy transfers (assuming the vaporization of the liquid phase in the atmosphere), a liquid outflow condition at seepage surfaces, as well as the heat radiation and the precipitation influx.

Assuming the vaporization of the liquid phase at the soil-atmosphere interface, the molar and energy normal fluxes at the interface on the atmosphere side are frequently approximated in hydrogeology by two-point fluxes between the gas phase at the interface and the atmosphere at a reference height [START_REF] Cui | Simulating the water content and temperature changes in an experimental embankment using meteorological data[END_REF][START_REF] Chalhoub | A simple heat and moisture transfer model to predict ground temperature for shallow ground heat exchangers[END_REF]. The transmissivities of these two-point fluxes are based on convective molar and energy transfer coefficients. Such approximation basically assumes that the lateral variations in wind, air temperature and humidity can be neglected [START_REF] Vanderborght | Heat and water transport in soils and across the soil-atmosphere interface: 1. Theory and different model concepts[END_REF]. Let us refer to the textbook [START_REF] Monteith | Principles of Environmental Physics[END_REF] on meteorology for the computation of convective molar and energy transfer coefficients at the soil-atmosphere interface depending on the roughness of the soil surface including the effect of the vegetation, on the wind velocity, on the eddy diffusivity in the air stream and stability of the air above the heated soil surface. The radiation which is absorbed by and emitted from the soil surface as well as the precipitation recharge can also be incorporated in such models [START_REF] Cui | Simulating the water content and temperature changes in an experimental embankment using meteorological data[END_REF][START_REF] Chalhoub | A simple heat and moisture transfer model to predict ground temperature for shallow ground heat exchangers[END_REF].

Outflow boundary conditions are frequently used in hydrogeology at seepage surfaces allowing the groundwater discharge to occur where the water table intercepts a sloping land surface. They have already been used for geothermal applications as in [START_REF] Hurwitz | Groundwater flow, heat transport, and water table position within volcanic edifices: Implications for volcanic processes in the cascade range[END_REF] for a single component liquid gas Darcy flow model. For the Richards equation, outflow boundary conditions are modelled by complementarity constraints between the non negative liquid normal flux and the non negative capillary pressure (see [START_REF] Schweiser | Regularization of outflow problems in unsaturated porous media with dry regions[END_REF]). For liquid gas Darcy flow models, they are combined with a Dirichlet boundary condition for the gas pressure [START_REF] Lenzinger | Two-phase flow equations with outflow boundary conditions in the hydrophobic-hydrophilic case[END_REF]. To our knowledge, their extension to general non-isothermal compositional liquid gas Darcy flows has not yet been derived.

In this work, both the evaporation and liquid outflow models are combined in a single boundary condition which automatically switches from evaporation to evaporation and liquid outflow boundary condition. It assumes that the liquid phase does not accumulate at the surface on the atmosphere side -considering that standing water condition such as lake or sea can easily be expressed in the form of Dirichlet conditions. Alternatively, one would need to model the flow of the liquid phase at the soil-atmosphere surface which has not been considered here and might induce a coupling with a system with different time scales than the underlying geothermal system. Our boundary condition is coupled with the general non-isothermal compositional liquid gas Darcy flow model. The formulation of the Darcy flow model from Chapter 1 is adapted to account for the new unknowns and equations at the soil-atmosphere interface. The derivation of the two-point molar and energy fluxes in the atmosphere is obtained starting from the transmission conditions proposed in [START_REF] Mosthaf | A coupling concept for two-phase compositional porous-medium and single-phase compositional free flow[END_REF] (see also [START_REF] Masson | Coupling compositional liquid gas darcy and free gas flows at porous and free-flow domains interface[END_REF][START_REF] Vanderborght | Heat and water transport in soils and across the soil-atmosphere interface: 1. Theory and different model concepts[END_REF]) for the coupling of nonisothermal compositional liquid gas Darcy and free gas flows. The complementarity constraints for the liquid outflow are extended to non-isothermal compositional flows using a switching criterion based on the thermodynamic equilibrium between the gas and liquid phases at the interface on the free-flow side. The efficiency of this formulation combined with different improvements of the Newton-min non-linear solver will be investigated on several test cases.

The structure of the rest of this chapter is as follows. The soil-atmosphere boundary condition is derived in Section 3.2. Then, the evaporation is assessed using a reference solution obtained with a full-dimensional free gas flow and transport model coupled to the liquid gas Darcy flow in Section 3.2.6. In Section 3.3, the model and its formulation are studied numerically in terms of solution and convergence of the Newton-min nonlinear solvers on several geothermal test cases including one dimensional test cases and two dimensional simulations of the Bouillante geothermal field in Guadeloupe. Finally, the scheme combining the TPFA and VAG discretizations, introduced in Chapter 2, is applied on the two dimensional cut of Bouillante with the soil-atmosphere boundary condition.

Soil-atmosphere boundary condition for non-isothermal compositional liquid gas Darcy flow

The fluid and energy transport in high energy geothermal systems is deeply governed by the conditions set at the boundary of the computational domain. In particular, it is well known that the modelling of the interaction between the porous medium model and the atmosphere plays an important role [START_REF] O'sullivan | Geothermal reservoir simulation: the state-of-practice and emerging trends[END_REF][START_REF] O'sullivan | Future directions in geothermal modelling[END_REF]. In this section, a boundary condition is derived to model the soil-atmosphere interaction based on mole and energy balance equations set at the interface. The model takes into account two coupling processes: on the one hand, the vaporization of the liquid phase and the convective molar and energy transfer in the atmosphere described in Subsection 3.2.1, on the other hand, a liquid outflow condition described in Subsection 3.2.2. Both coupling processes will be combined in a single boundary condition assuming that the liquid phase does not accumulate at the surface. The radiation and the precipitation recharge are also considered.

Convective molar and energy transfer in the atmosphere

Transmission conditions at the interface between a non-isothermal compositional liquid gas Darcy flow and a gas free flow

The derivation of the boundary condition accounting for convective molar and energy transfer in the atmosphere can be explained starting from the transmission conditions introduced in [START_REF] Mosthaf | A coupling concept for two-phase compositional porous-medium and single-phase compositional free flow[END_REF] (see also [START_REF] Masson | Coupling compositional liquid gas darcy and free gas flows at porous and free-flow domains interface[END_REF][START_REF] Vanderborght | Heat and water transport in soils and across the soil-atmosphere interface: 1. Theory and different model concepts[END_REF]) to couple a non-isothermal compositional liquid gas Darcy flow with a gas free flow. These conditions state the continuity of the component molar and energy normal fluxes, assuming instantaneous vaporization of the liquid phase, as well as the continuity of the gas molar fractions, of the temperature and of the gas pressure, neglecting the gas pressure jump. It is complemented by the thermodynamic equilibrium between the liquid and gas phases and by the Beavers-Joseph condition. On the free-flow side, the component molar and energy fluxes are defined by

w i = ζ g (P, T,C) C i u -D t ∇C i , i ∈ C , w e = ζ g (P, T,C)h g (P, T,C)u -λ t ∇T -∑ i∈C ζ g (P, T,C)h g i (P, T )D t ∇C i , (3.2.1)
where u denotes the gas velocity, P the pressure, C = (C i ) i∈C the gas molar fractions, T the temperature, D t the turbulent diffusivity and λ t the turbulent thermal conductivity.

The continuity of the component molar normal fluxes states that

w i • n = q i • n, i ∈ C , (3.2.2)
where the unit normal vector n at the interface is oriented outward from the porous medium domain. The last term in the free-flow energy flux in (3.2.1) introduces a strong non-linear coupling between the component molar and energy fluxes which raises an additional difficulty in the two-point approximation of the normal fluxes. This can be addressed in a simple and efficient way if the dissolution of the gaseous components in the liquid phase is small which corresponds to the usual case. In such a case, using

ζ g << ζ l , C w << 1, ∑ i∈C C i = 1 and (3.2.
2), we can derive that , temperature T atm ∞ and pressure P atm , which fixes the far field atmospheric specific gas enthalpy of the water component h g,atm w,∞ = h g w (P atm , T atm ∞ ). From the transmission conditions stated above, the temperature, the gas molar fractions and the gas pressure defined at the interface on the atmospheric side, match with their values on the porous medium side and consequently they are denoted respectively by T , C g and P g . The two-point flux approximations account for the turbulent boundary layers of the gas flow and transport in the atmosphere using the molar and energy transfer coefficients H m and H T . These coefficients are usually obtained from correlations used for environmental gas flows depending on the roughness of the soil surface including the effect of the vegetation, on the wind velocity, on the eddy diffusivity in the air stream and stability of the air above the heated soil surface [START_REF] Monteith | Principles of Environmental Physics[END_REF]. The two-point fluxes take also into account the convective normal fluxes using, as additional unknown, the gas molar flow rate q g,atm at the interface on the atmosphere side oriented outward from the porous medium domain. It is combined with an upwinding of the gas molar fractions and of the gas enthalpy of the water component between the interface and the far field atmospheric conditions. This leads us to define the following two-point fluxes oriented outward from the porous medium domain

|q i • n| << |q w • n| ∼ ζ g |u • n| ∼ ζ g D t |∇C w • n|, (3.2.3) for all i ∈ C \ {w}. Using that ∑ i∈C C i = 1, one has (w e + λ t ∇T ) • n = ζ g (P, T,C) h g (P, T,C)u • n -∑ i∈C h g i (P, T )D t ∇C i • n = ζ g (P, T,C) ∑ i∈C h g i (P, T )C i u • n -∑ i∈C \{w} (h g i (P, T ) -h g w (P, T ))D t ∇C i • n = ζ g (P, T,C)h g w (P, T )u • n + ∑ i∈C \{w} (h g i (P, T ) -h g w (p, T ))w i • n.
q g,atm i = (q g,atm ) + C g i + (q g,atm ) -C g,atm i,∞ + H m C g i -C g,atm i,∞
, i ∈ C , q g,atm e = (q g,atm ) + h g w (P g , T ) + (q g,atm

) -h g,atm w,∞ + H T (T -T atm ∞ ), (3.2.6)
where for any real u, we have set (u) + = max(0, u) and (u) -= min(0, u).

Neglecting the variations of pressure in the atmosphere, leads to the following continuity equation for the gas pressure at the interface

P g = P atm . (3.2.7)
Thermodynamic equilibrium is always assumed at the interface in the sense that the gas molar fractions and pressure at the interface on the porous medium side are extended by the one at equilibrium with the liquid phase in the absence of the gas phase. On the other hand, the liquid phase can appear or disappear according to the liquid phase complementarity constraint. It results that the following equations hold at the interface

                 f g i (P g , T,C g ) = f l i (P l , T,C l ), i ∈ C , ∑ i∈C C g i = 1, S l ≥ 0, 1 -∑ i∈C C l i ≥ 0, S l (1 -∑ i∈C C l i ) = 0, S g = S g (P g -P l ), ∑ α∈P S α = 1, (3.2.8)
where P l is the liquid pressure, C l the liquid molar fractions and S α , α ∈ P the saturations at the interface on the porous medium side and S g (P c ) denotes the inverse of the monotone graph extension of the capillary pressure function P c (S g ). As detailed in [START_REF] Brenner | Improving newton's method performance by parametrization: The case of the richards equation[END_REF][START_REF] Brenner | Immiscible twophase Darcy flow model accounting for vanishing and discontinuous capillary pressures: application to the flow in fractured porous media[END_REF] and in Subsection 3.3.1, a switch of variables between S g and P c could also be used in order to account for non invertible capillary functions.

Regarding the interface energy balance, the model can also account for the solar and long wave radiation that is absorbed by and emitted from the soil surface defined by the following net radiation R n ( W. m -2 )

R n = (1 -a)R s + R a -εσ SB T 4 , (3.2.9)
where R a ( W. m -2 ) is the incoming long-wave radiation emitted by the atmosphere, R s ( W. m -2 ) is the net short-wave radiation, a is the surface albedo, σ SB ( W. m -2 . K -4 ) is the Stephan-Boltzmann constant and ε the soil emissivity.

Liquid outflow complementarity constraints

The liquid phase is assumed to vaporize instantaneously when leaving the porous medium as long as the atmosphere is not saturated with water vapour. As soon as the atmosphere is vapour saturated at the interface, the component molar and energy normal fluxes in the liquid phase defined by q l,atm i = C l,atm i q l,atm , i ∈ C , q l,atm e = h l (P l , T,C l,atm ) q l,atm , (3.2.10) are allowed to exit the porous medium, where q l,atm ≥ 0 is an additional unknown corresponding to the total liquid molar flow rate oriented positively outward to the porous medium domain. In (3.2.10), the liquid molar fractions C l,atm = (C l,atm i ) i∈C at the interface on the atmosphere side are those at thermodynamic equilibrium with the gas phase and are such that f l (P atm , T,C l,atm ) = f g (P g , T,C g ).

(3.2.11)

Note that, due to the jump of the capillary pressure which vanishes on the atmosphere side, C l,atm does not match in general with the liquid molar fractions on the porous medium side C l which satisfies f l (P l , T,C l ) = f g (P g , T,C g ).

(3.2.12)

The liquid molar outflow rate q l,atm is determined by the following complementarity constraint accounting for the thermodynamic equilibrium between the liquid and gas phases at the interface on the atmosphere side

     (1 -∑ i∈C C l,atm i ) q l,atm = 0, 1 -∑ i∈C C l,atm i 0, q l,atm 0. (3.2.13)
It remains to eliminate the liquid molar fractions C l,atm from (3.2.10) and (3.2.13). Let us consider for f ∈ R C the function C l ( f , P l , T ) ∈ R C defined as the unique solution of the equation f l (P l , T,C l ) = f . From f g (P g , T,C g ) = f l (P g , T,C l,atm ) = f l (P l , T,C l ) := f given by the equations (3.2.11) and (3.2.12), it results that C l,atm = C l ( f , P g , T ).

105

On the one hand, if S l > 0, it follows that

1 -∑ i∈C C l,atm i = ∑ i∈C C l i -C l,atm i = ∑ i∈C C l i ( f , P l , T ) -C l i ( f , P g , T ) . (3.2.14)
Following [START_REF] Masson | Formulations of two phase liquid gas compositional Darcy flows with phase transitions[END_REF], since the function ∑ i∈C C l i ( f , P, T ) is strictly decreasing with respect to P, it results that the complementarity constraint (3.2.13) is equivalent to (P g -P l ) q l,atm = 0, P g -P l 0, q l,atm 0.

(3.2.15)

On the other hand, if S l = 0 then one has P g -P l = P c (1) > 0 and ∑ i∈C C l,atm i < 1. It results that both conditions (3.2.15) and (3.2.13) imply that q l,atm = 0. Finally, let us remark that if (3.2.15) holds, the liquid outflow fluxes in (3.2.10) rewrite as follows q l,atm i = C l i q l,atm , i ∈ C , q l,atm e = h l (P l , T,C l ) q l,atm .

(3.2.16)

The model also takes into account the following component molar and energy flow rates which represent the precipitation recharge q l,rain i = C l,rain i q l,rain , i ∈ C , q l,rain e = h l (P atm , T atm ∞ ,C l,rain ) q l,rain , (3.2.17)

with the rain molar fractions denoted by C l,rain = (C l,rain i ) i∈C , a temperature assumed at equilibrium with the far field atmosphere, the rain molar enthalpy denoted by h l,rain = h l (P atm , T atm ∞ ,C l,rain ) and a negative constant q l,rain < 0.

Evaporation-outflow boundary condition

Both the liquid outflow and evaporation models are combined in a single boundary condition, assuming that the liquid does not accumulate at the surface. Gathering the equations (3.2.6), (3.2.7), (3.2.8), (3.2.15), (3.2.16), (3.2.17) together with the component molar an energy balance equations, the evaporation-outflow boundary condition at the interface is defined by the sets of 7 + 2#C unknowns U Γ atm = q g,atm , q l,atm , T, P α , S α ,C α , α ∈ P , and equations

                                                       q i • n = (q g,atm ) + C g i + (q g,atm ) -C g,atm i,∞ + H m C g i -C g,atm i,∞
+C l i q l,atm +C l,rain i q l,rain , i ∈ C , q e • n = (q g,atm ) + h g w (P g , T ) + (q g,atm ) -h g,atm w,∞ + H T (T -T atm ∞ ) -R n + h l (P l , T,C l )q l,atm + h l,rain q l,rain , P g = P atm , S g = S g (P g -P l ),

∑ α∈P S α = 1, ∑ i∈C C g i = 1, min S l , 1 -∑ i∈C C l i = 0, f g i (P g , T,C g ) = f l i (P l , T,C l ), i ∈ C min P g -P l , q l,atm = 0. (3.2.18)

TPFA discretization of the non-isothermal compositional two-phase Darcy flow model with soil-atmosphere evaporation-outflow boundary condition

In this chapter we focus on the TPFA discretization thus the following orthogonality conditions are assumed on the mesh at both inner and boundary faces

(x K x L ) ⊥ σ for all σ ∈ F int with M σ = {K, L}, (x K x σ ) ⊥ σ for all σ ∈ F Γ atm with M σ = {K}.
Let Γ atm ⊂ ∂ Ω denote the boundary on which the soil-atmosphere evaporationoutflow boundary condition is imposed. It is assumed that there exists a subset F Γ atm of F such that

Γ atm = σ ∈F Γ atm σ .
To simplify, let us detail only the boundary where the advanced boundary condition is applied, thus in this chapter, the Dirichlet and Neumann boundary condition will not be described. It also implies that F Γ atm = F ext in the following. As detailed previously, the degrees of freedom of the TPFA scheme is the set M ∪ F Γ atm of all cells K ∈ M and of boundary faces σ ∈ F Γ atm .

Let us recall from (1.6.1) that the set of physical unknowns is

U K = P α K , T K , S α K ,C α K , α ∈ P ,
for each cell K ∈ M and let us introduce

U σ = q g,atm σ , q l,atm σ , P α σ , T σ , S α σ ,C α σ , α ∈ P , (3.2.19)
for each boundary face σ ∈ F Γ atm . The full set of unknowns is denoted by

U D = {U K ,U σ , K ∈ M , σ ∈ F Γ atm }. (3.2.20)
Let us refer to the Chapter 1 for the formulation (Section 1.2.1) and the TPFA discretization (Section 1.4) of the interior part of the domain Ω \ Γ atm . Let us recall here the system of discrete equations at each time step n = 1, • • • , N t f which accounts for the component and energy conservations equations in each cell

K ∈ M R i,K (U n D ) = ϕ K n i (U n K ) -n i (U n-1 K ) ∆t n + ∑ σ ∈F K q i,Kσ (U n D ) = 0, for i ∈ C , R e,K (U n D ) = ϕ K E f (U n K ) -E f (U n-1 K ) ∆t n + φK E r (U n K ) -E r (U n-1 K ) ∆t n + ∑ σ ∈F K q e,Kσ (U n D ) = 0. (3.2.21) It is coupled with the local closure laws in each cell K ∈ M 0 = L K (U n K ) =                      P c (S g,n K ) = P g,n K -P l,n K , ∑ α∈P S α,n K = 1, min S α,n K , 1 -∑ i∈C C α,n i,K = 0, α ∈ P, f g i (P g,n K , T n K ,C g,n K ) = f l i (P l,n K , T n K ,C l,n K ), i ∈ C . (3.2.22)
On the atmosphere side, the component molar normal flux at the face σ ∈ F Γ atm is discretized such that

q atm i,σ (U σ ) = (q g,atm σ ) + C g i,σ + (q g,atm σ ) -C g,atm i,∞ + H m,σ C g i,σ -C g,atm i,∞ +C l i,σ q l,atm σ +C l,rain i,σ q l,rain σ , ( 3

.2.23)

for i ∈ C and the energy normal flux by q atm e,σ (U σ ) = (q g,atm σ

) + h g σ + (q g,atm σ ) -h g,atm ∞ + H T,σ (T σ -T atm ∞ ) -(1 -a σ )R s,σ -R a,σ + εσ SB T 4 σ + h l (P l σ , T σ ,C l σ )q l,atm σ + h l,rain σ q l,rain σ . ( 3

.2.24)

It is now possible to state the system of discrete equations at each time step n = 1, • • • , N t f which accounts for the component and energy conservation equations at each boundary face

σ ∈ F Γ atm with M σ = {K} R i,σ (U n D ) = q atm i,σ (U n σ ) -q i,Kσ (U n D ) = 0, for i ∈ C , R e,σ (U n D ) = q atm e,σ (U n σ ) -q e,Kσ (U n D ) = 0. (3.2.25)
It is coupled with the local closure laws for each σ ∈ F Γ atm

0 = L σ (U n σ ) =                                      P g,n σ = P atm , S g,n σ = S g (P g,n σ -P l,n σ ), ∑ α∈P S α,n σ = 1, ∑ i∈C C g,n i,σ = 1, min S l,n σ , 1 -∑ i∈C C l,n i,σ = 0, f g i (P g,n σ , T n σ ,C g,n σ ) = f l i (P l,n σ , T n σ ,C l,n σ ), i ∈ C , min P g,n σ -P l,n σ , q l,atm,n σ = 0, (3.2.26)
where as previously, the complementarity constraints are formulated using the min function. Table 3.2.1 specifies the choice of the primary and secondary unknowns for each degree of freedom depending on the type on d.o.f. (atmospheric boundary face F Γ atm or cell M ). Table 3.2.1 -Choice of the primary unknowns depending on the active complementarity constraints of the Newton-min algorithm with the atmospheric boundary condition.

ν ∈ F Γ atm ν ∈ M q l,atm ν = 0 q g,atm ν , P c,ν , (C l i,ν ) i=1,#C -1 1 -∑ i∈C C g i,ν = 0 P g ν , S g ν , (C l i,ν ) i=1,#C -1 1 -∑ i∈C C l i,ν = 0 1 -∑ i∈C C l i,ν = 0 P g ν -P l ν = 0 q g,atm ν , q l,atm ν , T ν , S g ν = 0 P g ν , T ν , (C l i,ν ) i=1,#C -1 1 -∑ i∈C C l i,ν = 0 (C l i,ν ) i=1,#C -2 1 -∑ i∈C C l i,ν = 0 q l,atm ν = 0 q g,atm ν , T ν , (C g i,ν ) i=1,#C -1 1 -∑ i∈C C g i,ν = 0 P g ν , T ν , (C g i,ν ) i=1,#C -1 S l ν = 0 S l ν = 0 3.2.

Numerical validation of the soil-atmosphere evaporation boundary condition

In this subsection, the solutions of the non-isothermal liquid gas Darcy flow coupled either with the soil-atmosphere evaporation-outflow boundary condition or with a fulldimensional gas free flow, are compared. The full-dimensional free-flow model is a non-isothermal compositional Reynolds Average Navier-Stokes (RANS) gas flow. The coupling conditions at the interface between the free-flow and porous medium are those introduced in [START_REF] Mosthaf | A coupling concept for two-phase compositional porous-medium and single-phase compositional free flow[END_REF]. They assume the vaporization of the liquid phase in the free-flow domain and account for the gas molar fraction and molar and energy normal flux continuity, the liquid gas thermodynamic equilibrium, the no slip condition and the normal component of the normal stress continuity. We consider a two dimensional test case from [START_REF] Birgle | A domain decomposition method to couple non-isothermal compositional gas liquid darcy and free gas flows[END_REF] which simulates the mass and energy exchanges occurring within deep geological radioactive waste disposal at the interface between a geological formation with low permeable porous medium and a ventilation excavated gallery. The data set is derived from lab experiments and in accordance with the deep disposal center for French radioactive waste project. In this test case, the porous medium initially saturated with the liquid phase is dried by suction in the neighbourhood of the interface between the porous and free-flow domains. The gas phase penetrates the porous domain and the liquid phase is vaporized in the free-flow domain.

The porous medium domain is defined by Ω pm = (0, l) × (h f f , h pm ) with l = 100 m, h f f = 5 m and h pm = 20 m. As exhibited in Figure 3.2.2, it corresponds to the computational domain of the Darcy flow model coupled with the soil-atmosphere evaporation-outflow boundary condition applied at Γ atm = (0, l) × {h f f }. The computational domain (0, l) × (0, h pm ) of the coupled Darcy and full-dimensional free-flow models is the union of the porous medium domain Ω pm and of the free-flow domain where P sat (T ) is the vapour pressure of the pure water given by the Rankine formula P sat (T ) = 1.013 10 5 exp 13.7 -5120 T .

Ω f f = (0, l) × (0, h f f ). It is illustrated in
The liquid molar enthalpy h l and the gas molar enthalpy of the water component h g w are taken from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF]. The gas molar enthalpy of the air component is given by h g a (T ) = c g p,a T where c g p,a = 29 J. K -1 . mol -1 is the specific molar heat capacity of pure air and the gas molar enthalpy is then defined by (1.2.1). The bulk rock thermal conductivity is fixed to λ = 10 W. m -1 . K -1 and the rock energy per unit volume is given by E r (T ) = 2 10 6 T in J. m -3 with T in K.

The initial and top boundary conditions in the porous medium are defined by a liquid phase S l = 1 with pure water C l w = 1, C l a = 0, a temperature T 0 pm fixed either to 303 or 333 K and a hydrostatic pressure with 38 atm at the top boundary. The lateral boundaries are considered thermally isolated (no Fourier flux) and impervious (no Darcy flux). The soil-atmosphere evaporation-outflow boundary condition at the interface Γ atm is set with no radiation nor precipitation recharge and the outflow liquid flux is null during the overall simulation in the following test cases.

At the output boundary Γ out = {l} × (0, h f f ) of the free-flow domain, the pressure P out = 10 5 Pa is the atmospheric pressure. The velocity at the input boundary Γ in = {0} × (0, h f f ) is defined by the uncoupled turbulent velocity profile u 0 (y) = u 0 (y) 0 , computed from the Prandtl algebraic turbulent model (see [START_REF] Masson | Coupling compositional liquid gas darcy and free gas flows at porous and free-flow domains interface[END_REF]), with an average velocity

u in = 1 h ff h ff 0 u 0 (y)dy = 0.5 m.s -1 ,
and such that u 0 (h f f ) = u 0 (0) = 0. The initial condition in the free flow domain and the input boundary Γ in are initialized with a fixed temperature T in = 303 K and the input molar fractions

C in = C w,in 1 -C w,in
with the relative humidity

P out C w,in P sat (T in ) = 0.5.
An homogeneous Dirichlet boundary condition for the velocity and homogeneous Neumann boundary conditions for the molar and energy transport are used at the boundary (0, l)×{0}. The turbulent viscosity µ t used in the free-flow domain to define the RANS stress tensor is given by the Prandtl algebraic turbulent model as in [START_REF] Masson | Coupling compositional liquid gas darcy and free gas flows at porous and free-flow domains interface[END_REF] and computed once and for all from the uncoupled solution in the free-flow model. The turbulent diffusivity

D t = D g + µ t -µ g ρ g S c (3.2.27)
is deduced using the gas Fickian diffusion D g = 2 10 -5 m 2 . s -1 and the Schmidt number S c = 1. The turbulent thermal conductivity is similarly defined by λ t = λ g + c g p,a (µ tµ g ) with the gas thermal conductivity

λ g = 0.026 W. m -1 . K -1 .
The simulation is run over the time interval [0,t f ] with t f = 200 years, using an adaptive time step starting with an initial time stepping of 1 s and a maximum time step of 10 years. The Cartesian mesh is uniform in the x direction with N x = 100 edges and refined exponentially in the vertical y direction on both sides of the interface Γ atm = (0, l) × {h f f } to account for the turbulent boundary layer and for the high gradient of the liquid pressure. More precisely, the porous medium mesh is defined by N e > 0, N y > N e , r > 1, ∆y r > 0, such that h f f + ∆y r (r N e -1) < h pm . Numbering the y-edges (y i , y i+1 ), i = 1, • • • , N y + 1 from bottom to top, we set The convective molar and energy transfer coefficients are computed from the following low frequency diagonal approximations of the Dirichlet to Neumann operators related to the uncoupled convection diffusion equations in the free-flow domain. Let us define the solutions c and T of the following linear convection diffusion equations by

y i =    h f f + ∆y r (r i-1 -1), 1 ≤ i ≤ N e + 1,
y N e +1 + (i -N e -1) h pm -y N e +1 N y -N e , N e + 2 ≤ i ≤ N y + 1.
ζ g (P out , T in )div cu 0 -D t ∇c = 0 on Ω f f , c = 1 on Γ atm , c = 0 on Γ in , ∇c • n = 0 on Γ out , ∇c • n = 0 on (0, l) × {0}, (3.2.28) and div ζ g (P out , T in ) ∂ h g w ∂ T (P out , T in )T u 0 -λ t ∇T = 0 on Ω f f , T = 1 on Γ atm , T = 0 on Γ in , ∇T • n = 0 on Γ out , ∇T • n = 0 on (0, l) × {0}. (3.2.29)
Then, we set

H m (x) = ζ g (P out , T in )D g ∇c • n f f | Γ atm , H T (x) = λ g ∇T • n f f | Γ atm , (3.2.30)
with n f f the normal at Γ atm oriented outward to the free-flow domain.

Tables 3.2.2 and 3.2.3 compare, respectively for T 0 pm = 303 K and T 0 pm = 333 K and for the three meshes, the numerical efficiency of the Newton-min non-linear solvers with their different improvements introduced in Section 3.2.5. Each table contains the number of successful time steps, the number of time step chops (i.e. the number of Newton-min convergence failures), the average number of Newton iterations per time step and the CPU time (in seconds on 2.9 GHz Intel Core i5 processor and 8Go RAM). It is shown that the basic Newton-min algorithm fails to converge in this test case and that the use of the equilibrium phase molar fractions for the phase appearance criterion is necessary to obtain the convergence for the finest mesh at T 0 pm = 303 K. On the other hand, imposing the thermodynamic equilibrium at each Newton iterate improves only slightly the convergence. The solutions of the liquid gas Darcy flow coupled either with the soil-atmosphere boundary condition or with the full-dimensional gas free flow are compared using the finest mesh with N y = 90. Figures 3.2.4 and 3.2.5 exhibit, respectively for T 0 pm = 303 K and T 0 pm = 333 K, the evolution in time (in log scale) of the mean relative humidity, the mean temperature and the mean molar flow rate of the water component at the interface Γ atm for both models. The two stages, typical of drying processes, are clearly identified. The first stage corresponds to a high liquid evaporation rate combined with a relative humidity at the interface close to one. This stage is mainly governed by the free turbulent flow as long as the interface is water saturated. The second stage, triggered by the desaturation of the porous medium, corresponds to the drop of both the evaporation rate and the relative humidity reaching their stationary state say at time 200 years. The cooling effect of the liquid evaporation at the interface is also clearly observed in the temperature plot of Figure 3.2.4. Figures 3.2.4 and 3.2.5 show that the soil-atmosphere boundary condition combined with the convective molar and energy transfer coefficients (3.2.30) provides a very good approximation of the coupled non-isothermal liquid gas Darcy and full-dimensional gas free flow model. The mismatch is larger for T 0 pm = 333 K than for T 0 pm = 303 K on the evaporation rate due to larger variations in time of the convective molar and energy transfer coefficients not captured by H m and H T . Nevertheless, the temperature and relative humidity at the interface remains very well approximated in both cases.

N x ×

Study of the non-linear convergence and of the soil-atmosphere boundary condition on one dimensional and two dimensional geothermal test cases

In these simulations, the porous medium is homogeneous of porosity φ (x) = 0.35 and of isotropic permeability Λ Λ Λ(x) = K × I with K = 1 D. The relative permeabilities are defined by k α r (S α ) = (S α ) 2 for each phase α ∈ P. The capillary pressure function is given by the Corey law

P c (S g ) = -b ln(1 -S g ) if 0 ≤ S g ≤ S 1 , -b ln(1 -S 1 ) + b 1-S 1 (S g -S 1 ) if S 1 < S g ≤ 1,
with b = 2 10 5 Pa and S 1 = 0.99. It is regularized for S g ∈ (S 1 , 1] to allow for the disappearance of the liquid phase (see Figure 2.4.4). Since there is no entry capillary pressure (in the sense that P c (0) = 0), the complementarity constraint min(P c (S g ), q l,atm ) = 0 from (3.2.15) is equivalent to min(S g , q l,atm ) = 0. It results that the gas saturation can be used in the following test cases as primary unknown at the interface Γ atm rather than the capillary pressure P c (refer to Table 3.2.1). Different choices, including P c and a variable switch between P c and S g are compared in Paragraph 3.3.1.

The liquid and gas phases are a mixture of two components, the water denoted by w and the air denoted by a. The gas thermodynamic laws are defined by the perfect gas molar density ζ g = P g RT with R = 8.314 J. kg -1 . mol -1 and the viscosity µ g = (0.361T -10.2) 10 -7 in Pa. s. The liquid molar enthalpy h l and the gas molar enthalpies of each component h g a , h g w are taken from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF]. The gas molar enthalpy is then defined by (1.2.1). The liquid molar density and viscosity are also from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF] and defined by

ζ l = (780.83795 + 1.62692 T -3.06354 10 -3 T 2 )(1 + 0.651 C s ) 0.018 , (3.3.1)
µ l = (1 + 1.34 C s + 6.12 C 2 s ) 10 -3 0.02148(T -273 -8.435 + 8078.4 + (T -273 -8.435) 2 ) -1.2 , (3.3.2)
with the salinity fixed to C s = 35 10 -3 kg. kg -1 . The mass density is defined by ρ α = ∑ i∈C C α i m i ζ α with the molar masses m a = 0.029 and m w = 0.018 kg. mol -1 . The vapour pressure P sat (T ) is given by the Clausius-Clapeyron equation

P sat (T ) = 100 exp 46.784 - 6435 T -3.868 log(T ) ,
and the Henry constant of the air component is set to H a = 10 8 Pa. The molar internal energy of each phase is considered to be equal to its enthalpy. Finally, the fugacities are given by

     f g i = C g i P g , i = a, w, f l a = C l a H a , f l w = C l w P sat (T ) exp -P sat (T )-P l 1000RT /0.018 .
The thermal conductivity is fixed to λ = 3 W. m -1 . K -1 and the rock energy per unit volume is given by E r (T ) = 2 • 10 6 T in J. m -3 with T in K.

One dimensional geothermal test cases

The aim of the one dimensional test cases is to study the soil-atmosphere evaporationoutflow boundary condition introduced in Section 3.2 and in particular the appearance and disappearance of the liquid outflow. The domain is a box of length (0 m, 11000 m) and height (-3000 m, 1000 m) meshed with 1000 cells in the vertical direction. The initial condition is defined by a liquid phase S l = 1 composed of pure water C l w = 1, C l a = 0 at hydrostatic pressure with P l = 1 atm at the top boundary and a linear temperature between 300 K at the top boundary and 550 K at the bottom boundary. The lateral boundaries of the domain are thermally isolated (no Fourier flux) and impervious (no Darcy flux). In addition to the fixed temperature 550 K, we impose at the bottom boundary an input molar flow rate q w,in < 0 composed of pure liquid water.

The soil-atmosphere boundary condition developed in Section 3.2 is imposed at the top boundary. The short and long wave radiation coming from the atmosphere and reaching the soil surface is fixed to (1a)R s + R a = 340 W. m -2 and the soil emissivity to ε = 0.97. The convective molar and energy transfer coefficients are set to H m = 0.69 mol. m -2 . s -1 and H T = 29 × H m = 20 W. m -2 . K -1 . The far field atmospheric conditions are set to C g,atm a,∞ = 0.99, C g,atm w,∞ = 10 -2 , T atm ∞ = 300 K and P atm = 1 atm, corresponding roughly to a relative humidity of 0.5. The precipitation recharge is not considered in these one dimensional test cases.

The simulations are run with t f = 1200 years using an adaptive time stepping starting with an initial time step of 6 days and with a maximum time step of 700 days.

One dimensional geothermal test case with soil-atmosphere evaporation-outflow boundary condition

The input molar flow rate is fixed to q w,in = -2.9 10 -2 mol. m -2 . s -1 during the overall simulation. Table 3.3.1 shows the numerical behaviour of the simulation with the different versions of the Newton-min algorithm described in Section 3.2.5, including the number of successful time steps N t f , the number of time step chops N chops , the average number of Newton-min iterations per successful time step N newton and the CPU time (in seconds on 2.9 GHz Intel Core i5 processor and 8Go RAM). It shows that the basic Newton-min algorithm leads to 8 percent additional Newton-min iterations per time step compared with the improved versions of the Newton-min algorithm. The nonlinear phase appearance criterion does not lead to a significant improvement for this test case and enforcing the thermodynamic equilibrium at each Newton iterate slightly degrades the convergence. , average number of Newton-min iterations per successful time step N newton and the CPU time of the Newton-min algorithms. Figures 3.3.1 and 3.3.2 show the time evolution of the phase pressures, temperature and gas saturation both at the top cell and at the top atmospheric boundary, and the relative humidity and the phase molar flow rate at the interface. They highlight that the liquid outflow appears at the first time step and remains throughout the simulation. This is due to a high input molar flux at the bottom boundary which saturates the atmosphere at the top boundary. They also exhibit that the evaporation rate increases with the temperature at the top boundary while the liquid outflow decreases. The stationary state is reached after say 200 years for this test case.

N t f N chops N newton CPU(s) Basic Newton-

One dimensional geothermal test case with appearance and disappearance of the outflow

In this test case, as exhibited in Figure 3.3.3, the time-dependent input molar flow rate

q w,in (t) =      -2.9 10 -2
for 0 < t ≤ 300 years, 0 for 300 < t ≤ 900 years, -1.45 10 -2 for 900 < t ≤ t f , in mol. m -2 . s -1 is imposed at the bottom boundary in order to test the appearance and disappearance of the liquid outflow. Table 3.3.2, which summarizes the numerical characteristics of the simulations, shows that the performances are drastically increased when enforcing the complementarity constraints of type min(U 1 ,U 2 ) = 0 to hold exactly at each Newton iteration. The non-linear appearance criterion slightly increases the number of time step chops compared with the linear appearance criterion. Enforcing the thermodynamic equilibrium at each Newton iterate reduces the number of time step chops but deteriorates the number of Newton iterations so it remains worse than the convergence obtained with the linear appearance criterion. The simulation is governed by the time-dependent input molar flow rate exhibited in Figure 3.3.3 and by the boundary condition at the top of the geothermal column. Typically, the hot liquid front rises by buoyancy and viscous forces to the top of the reservoir. As soon as the temperature is larger than the saturated vapour temperature, a bubble of vapour grows and rises by gravity. The connection with the top of the reservoir crucially depends on the boundary condition imposed at the top. In our case, as expected, the soil-atmosphere evaporation-outflow boundary condition automatically switches from a liquid-outflow to a vanishing liquid phase boundary condition when the input bottom molar flow rate vanishes at time t = 300 years. It switches back to a liquid outflow at time t = 900 years when the input molar flow rate becomes again strictly negative. Since there is no entry capillary pressure in this test case, the liquid outflow complementarity constraint (3.2.15) is equivalent to min S g , q l,atm = 0 which explains why, in Figure 3.3.4, the gas saturation at the interface is vanishing as soon as the liquid molar flow rate q l,atm is strictly positive (see Figure 3.3.5). This can also be observed in Figure 3.3.6 in the gas saturation blue and red plots. The solutions exhibited respectively at times t = 300 year and at final time correspond to the stationary states obtained with their respective input molar flow rate at the bottom boundary. During the time interval 300 years < t ≤ 900 years, since there is no input flow rate at the bottom boundary, the liquid outflow and the gas molar flow rate vanish rapidly. The solutions at the end of this time interval, exhibited in green in Figure 3.3.6, show that the liquid phase drops, air penetrates at the top of the geothermal column and the water vapour rises by gravity. The liquid phase vanishes from the top of the geothermal column for say z ∈ (978 m, 1000 m). Note also that the stationary linear conductive solution for the temperature is far from being reached after 600 years at time t = 900 years. From 630 m to say 845 m, a step in the temperature curve can be noticed. This step corresponds to the domain where the fluid is diphasic and the air molar fraction in the gas phase is null. Neglecting the Kelvin correction and the dissolution of air in the liquid phase, the equality of the liquid and gas water fugacities imposes that f g w = C g w P g ∼ P sat (T ). Since f g w = C g w P g is roughly equal to 1 atm, the temperature is also roughly constant.

One dimensional geothermal test case with entry capillary pressure

Let us fix again the input molar flow rate to q w,in = -2.9 • 10 -2 mol. m -2 . s -1 during the overall simulation. The capillary pressure curve includes an entry pressure P e > 0 defined by the following regularization of the Corey law (see Figure 3.3.7)

P c (S g ) =    P e -b ln(1 -S g ) if 0 ≤ S g ≤ S 1 , P e -b ln(1 -S 1 ) + b 1 -S 1 (S g -S 1 ) if S 1 < S g ≤ 1,
with P e = 10 5 Pa, b = 2 • 10 5 Pa and S 1 = 0.99. The Corey law is again regularized for S g ∈ (S 1 , 1] to allow for the disappearance of the liquid phase. , average number of Newton iterations per successful time step N newton and CPU time for the different versions of the Newton-min algorithm using the variable switch parametrization. Tables 3.3.3 and 3.3.4 exhibit a significant gain in terms of non-linear convergence obtained with the variable switch parametrization compared with the scaled capillary pressure. As previously, Figures 3.3.8 and 3.3.9 show the time evolution of the relative humidity and the phase molar flow rate at the interface, and the main physical variables at the top cell and at the top boundary. The solutions plotted are almost the same than those obtained with the Van Genuchten capillary pressure in Figures 3.3.1 and 3.3.2. This is expected since both capillary pressure curves are quite similar and since the outflow regime is reached at the first time step of both simulations. The comparison between Table 3.3.1 and Table 3.3.3 shows that the parametrizations τ = S g with the Van Genuchten law and τ = P c P e with the Corey law provide similar results. Tables 3.3.1 to 3.3.4 highlight that the performances are significantly increased when enforcing the complementarity constraints of type min(U 1 ,U 2 ) = 0 to hold exactly at each Newton iteration. The non-linear phase appearance criterion reduces slightly this improvement. Its combination with the thermodynamic equilibrium update gives mixed results with sometimes a small reduction of the CPU time.

Two dimensional geothermal test cases

The two dimensional test case illustrated in Figure 3.3.10 represents the simplified two dimensional cut of the Bouillante geothermal reservoir. It is run with two different upper boundary conditions to compare the solutions obtained with the evaporationoutflow boundary condition introduced in Section 3.2 and with Dirichlet boundary conditions. The initial and left side conditions are defined by a pure water liquid phase (S l = 1, C l w = 1, C l a = 0) at hydrostatic pressure and a linear temperature between the fixed top and bottom temperatures. The bottom boundary is impervious with a fixed temperature of 400 K except in the interval 8000 m ≤ x ≤ 10000 m where a pure water liquid input flux of -2.9 • 10 -2 mol. m -2 . s -1 at 550 K is imposed. The right side of the domain is supposed thermally isolated and impervious corresponding to the hypothesis of a symmetric extension of the domain.

The top boundary conditions are test case dependent and are detailed below, except at the seabed boundary such that z ≤ 0 m, x ≤ 5000 m. The seabed boundary condition is defined by a pure water liquid phase (S l = 1, C l w = 1) at hydrostatic pressure. The temperature is sea depth dependent. It is linear between the sea level z = 0 m at 300 K and z = -100 m at 278 K, then constant below (z ≤ -100 m). Two Voronoi meshes, a coarse and a fine one, satisfying the admissibility condition of TPFA schemes at both inner and boundary faces have been generated. The coarse mesh contains approximatively 1500 cells (about 1700 degrees of freedom) and is refined at the neighbourhood of the top boundary with a volume ratio of 22 between the smallest and the largest cells of the mesh. The fine mesh contains approximatively 3500 cells (around 4000 degrees of freedom) and the refinement at the interface is characterized by a volume ratio of 115 between the smallest and the largest cells of the mesh. The coarse mesh is exhibited in Figure 3.3.11 as well as a zoom of the top right zone for both the coarse and the fine meshes.

T = 550 K, Imposed flux of 0.03 mol. m -2 . s -1 S l = 1, C l W = 1 T = 400 K, Imposed flux of 0 mol. m -2 . s -1 S l = 1, C l W = 1
The simulations are run over the time interval [0,t f ], t f = 1000 years, with an adaptive time stepping starting with an initial time step of 6 days in the Dirichlet case and of 1 day with the evaporation-outflow boundary condition. The maximum time step is fixed to 700 days in both cases.

Two dimensional geothermal test case with Dirichlet top boundary conditions

In this test case, the upper boundary is composed of three parts corresponding to the seabed (z ≤ 0 m and 0 ≤ x ≤ 5000 m) described above, a sunny plain zone (0 < z ≤ 500 m and 5000 m < x ≤ 8450 m) and a rainy mountain zone (z > 500 m and 8450 m < x ≤ 11000 m). The sunny plain zone is defined with the same parameters than the far field atmospheric conditions used in the next test case (Paragraph 3.3.2), which means that the relative humidity is fixed to 0.5, the temperature to 300 K and the gas pressure to P g = 1 atm from which we deduce that only the gas phase is present with the water and air molar fractions of about C g a 0.99, C g w 10 -2 . The rainy mountain zone is characterized by a two-phase flow at thermodynamic equilibrium which is fitted in such a way that the liquid flux entering the domain is similar to the one obtained in the next test case with the evaporation-outflow top boundary condition including the precipitation recharge. Then, the Dirichlet boundary condition for z > 500 m (which corresponds to x > 8450 m) is defined by a fixed temperature, gas pressure and relative humidity corresponding to the following physical values

Two dimensional geothermal test case with the soil-atmosphere evaporation-outflow boundary condition

In this paragraph, the Dirichlet conditions on the sunny plain and rainy mountain zones are replaced by the evaporation-outflow boundary condition developed in Section 3.2. The radiation, the convective molar and energy transfer coefficients and the far field atmospheric conditions are those defined in the one dimensional geothermal test cases in Subsection 3.3.1. The precipitation recharge is null on the sunny plain zone and fixed to q l,rain = -3.2 • 10 -2 mol. m -2 . s -1 on the rainy mountain zone with C l,rain w = 0.999 and C l,rain a = 10 -3 . This precipitation recharge corresponds to roughly twice the observed rainfall of 9 m in 2016. It has been doubled since the reservoir two dimensional cut is assumed to be along a fault plane which favours the water intrusion. Table 3.3.6 summarizes the convergence behaviour of the Newton-min algorithm with the atmospheric boundary condition and Figure 3.3.14 exhibits the temperature and the gas saturation in the whole domain at final time. This shift can be explained by the lower liquid pressure P l = P atm -P c (1) provided at the top boundary by the gas Dirichlet condition than the one provided by the evaporation-outflow boundary condition with in particular P l = P g = P atm between say x = 5000 m and x = 6000 m as a consequence of the liquid outflow. It also results that the temperature drop near the shoreline does no longer appear. The gas saturation remains null below the seabed and the desaturated zone is shifted to x > 5000 m (see also Figures 3.3.13 and 3.3.16). It can also be noticed that the desaturated zone is deeper with the evaporation-outflow than with the Dirichlet boundary condition. In the previous test cases, only the air-water components have been considered to simplify but the salt component should be present to respect the physic. Taking into account the salinity dependent liquid dynamic viscosity and mass density of the sea water will be shown to remove the thermal instabilities induced by the left side Dirichlet boundary condition observed in Figures 3.3.12 and 3.3.14. This is the object of the next paragraph.

Two dimensional geothermal test case with a water-air-salt thermodynamic system

In this paragraph, the previous test case is extended to take into account the dissolution of the salt component in the liquid phase. Since the model assumes all components to be present in both phases, the liquid and gas phases are now a mixture of three components, the water denoted by w, the air denoted by a and the salt denoted by s, setting C = {w, a, s}. The liquid molar density (3.3.1) and viscosity (3.3.2) are functions of the salinity C s in kg. kg -1 which is now related to the liquid molar fractions by The Dirichlet boundary condition at the interface between the sea and the reservoir now uses the input salinity C s = 35 • 10 -3 kg. kg -1 of the sea water. The input salinity at the left side of the reservoir as well as at the bottom boundary is fixed to the lower value C s = 20 • 10 -3 kg. kg -1 . The remaining boundary and initial conditions are unchanged compared with the previous test case, considering that the initial water in the reservoir and the precipitation recharge contain no salt. Table 3.3.7 summarizes the convergence behaviour of the different versions of the Newton-min algorithm. Figure 3.3.17 exhibits the temperature, the gas saturation and the salt mass fraction in the liquid phase in the reservoir at final time. The comparison between Figure 3.3.17 and Figures 3.3.12, 3.3.14 confirm that the sea water intrusion prevents the development of the convective thermal instabilities from the left side of the reservoir. This is due to the higher salinity of the sea water compared with the left side and bottom salinity. It also explains why the high temperature zone is shifted to the right compared with the previous simulation. This shift is responsible for the vaporisation of the liquid water component near the top boundary which is observed in the gas saturation in Figure 3.3.17. Indeed, the high temperature zone is closer to the shoreline where the pressure is lower which favours the vaporisation of the liquid phase. The plot of the salt molar fraction in the liquid phase in Figure 3.3.17 clearly shows that the reservoir is split in three zones depending on the source of the water flux: the sea water zone on the left, the rain water zone on the right and the high temperature water zone in between. A high salt molar fraction in the liquid phase can also be noticed in 3.3.6 and 3.3.7), the basic Newton-min algorithm fails to converge while the Newton-min algorithm with projection on the complementarity constraints exhibits a good non-linear convergence. In most of the cases, the non-linear phase appearance criterion also improves the non-linear convergence and its combination with the thermodynamic equilibrium update gives mixed results with sometimes a small reduction of the CPU time.

C s = C l s m s ∑ i∈C C l i m i
The non-linear convergence of the test case using Dirichlet boundary conditions is easier to achieve, hence the basic Newton-min algorithm succeeds in converging (refer to Table 3.3.5) but is about twice longer than the other versions of the Newton-min algorithm. In this simulation, the Newton-min algorithm with projection and thermodynamic equilibrium is the most efficient.

Atmospheric boundary condition on hybrid meshes

In this section, let us apply the soil-atmosphere boundary condition on the combined VAG-HFV discretization introduced in Chapter 2. The TPFA discretization is chosen as HFV scheme to allow for a better comparison with the previous study. It implies that the meshes need to respect the admissibility condition on the TPFA part of the domain. The choice of the TPFA discretization favours the use of the unstabilised version of the combined VAG-TPFA scheme to preserve the two point flux property for all faces σ ∈ F h (refer to Remark 2.2.4). Both the numerical results and the convergence efficiency will be studied. About the Newton-min algorithm, the Newton-min with projection on the complementarity constraints from Section 3.2.5 is selected, with the non-linear updates to test the appearance of a missing phase. This is the best com-promise between the cost efficiency and an easy implementation.

The previous test case with two components (water and air) is adapted with a constant gas dynamic viscosity fixed to µ g = 2 • 10 -5 Pa. s. The liquid molar density and viscosity are also fixed to the constant values ζ l = 1000 0.018 mol. m -3 and µ l = 10 -3 Pa. s in order to avoid thermal convection instabilities which would prevent the comparison of the different schemes. Figure 3.4.1 presents the two dimensional vertical crosssection of the Bouillante geothermal reservoir and the conditions applied at the domain boundary.

The simulations are run over the time interval [0,t f ], t f = 650 years, with an adaptive time stepping starting with an initial time step of 1 day and with a maximum time step of 150 days. To allow the comparison with the previous simulations (Section 2.4.3), two hybrid meshes generated in Chapter 2 have been applied. The first one combines Voronoi cells on the upper subdomain Table 3.4.1 compares the numerical behaviour of the simulation with N red the number of degree of freedom of the reduced linear systems with 3 primary unknowns per d.o.f., NZ red the number of non-zero 3 by 3 entries in the reduced linear systems, N t f the number of successful time steps, N chops the number of time step chops and N newton the average number of Newton-min iterations per successful time step. The CPU times are in seconds on 2.9 GHz Intel Core i5 processor and 8Go RAM. The lines of Table 2.4.2 with the same configuration and the Dirichlet boundary condition has been copied to facilitate the comparison. The comparison between Figures 3.4.3 with the advanced boundary condition and Figure 3.4.2 with Dirichlet confirms that the evaporation-outflow boundary condition shifts slightly the high temperature zone to the left and that the temperature drop near the shoreline does no longer appear. It also shows that the desaturated zone is deeper with the evaporation-outflow than with the Dirichlet boundary condition and more localised: there is a zone between the shoreline and the desaturated zone where only the liquid phase is present. This zone does not exist in Figure 3 [START_REF] Ahmed | Control-volume distributed multi-point flux approximation coupled with a lower-dimensional fracture model[END_REF] show as expected that the results are very similar with both schemes even if they remain slightly different as the meshes are not refined enough near the top boundary. In particular there is a difference of approximatively 1.2 K on the mean temperature over the boundary faces (top left figure in 3.4.5) which appears at the first time step and remains during the whole simulation, both profiles being almost identical. However, the similarities of the results validate the accuracy of the combined scheme over a more complex physical test case.

Ω v = {x ∈ Ω | z > -
In Table 3.4.1, the convergence of the TPFA scheme with the Dirichlet test case shows irregular global convergence behaviour (7 time step chops) since, in some cells, the solution is locally close to a point where the gas phase appears or vanishes. It is no more the case with the atmospheric boundary condition (0 time step chops) because, as explained previously, the gas phase is more localised and there is no thin domain with bad convergence due to phase transitions. The convergence of the combined VAG-TPFA scheme differs, the atmospheric condition increases the number of nonzero elements in the matrix and the number of time step chops. Thus the CPU time is slightly longer (augmentation of about 7 percent). With both schemes, the average number of Newton-min iterations per time step is slightly smaller with the Dirichlet boundary condition which is expected as the soil-atmosphere condition adds non-linearities.

Even with this small degradation of the convergence of the Newton-min algorithm with the combined scheme (more time step chops), as the number of non-zero elements in the matrix is smaller and because the average number of Newton-min iterations per successful time step is lower, the CPU time drops of approximatively 20 percent when compared with the TPFA scheme and it remains the best compromise between accuracy and CPU time.

Conclusion

In this work, the new formulation for non-isothermal compositional gas liquid Darcy flows based on natural variables and using extended phase molar fractions has been coupled with an advanced soil-atmosphere boundary condition. It accounts for the vaporization of the liquid phase in the atmosphere, the convective molar and energy transfer, a liquid outflow condition as well as the precipitation recharge and the radiation. Newton-min algorithms with various improvements have been investigated to solve the non-linear systems obtained at each time step after an Euler implicit time integration. The numerical efficiency of the formulation and the soil-atmosphere evaporationoutflow boundary condition have been studied on several one dimensional and two dimensional test cases. Then the two dimensional cut of the Bouillante high energy geothermal field in Guadeloupe with both air-water and air-water-salt thermodynamic systems has been simulated. The air-water thermodynamic system has also been studied on hybrid meshes. It enlightens by comparison with a fitted Dirichlet boundary condition the importance for geothermal simulations of the top boundary condition taking into account the seabed, the sunny plain and the rainy mountain zones. Regarding the non-linear solver efficiency, it is shown that enforcing the complementarity constraints to hold at each Newton iterate considerably improves the non-linear convergence ,and the non-linear phase appearance criteria often improves slightly this amelioration. Finally, the numerical results on a hybrid mesh confirm the accuracy and efficiency of the combined scheme.

However, only two dimensional simulations have been run, a further step could be to apply this advanced atmospheric boundary condition on more complex geometries and geologies on three dimensional domains, and in particular it could be implemented in the ComPASS code (detailed in the Annex 4). The soil-atmosphere boundary condition is easily adapted to the VAG scheme, it has been done for the numerical tests in Section 3.4. First, it would consist in adjusting the study to the Coats formulation which is implemented in the ComPASS code. Then, an other difficulty relies on the addition of Robin type boundary conditions since it leads to the introduction of a new system of unknowns and equations. Finally, the direct solver which has been used previously could not be applied on three dimensional simulations and would be replaced by an iterative one. It is thus probable that the Robin type boundary condition leads to issues with the preconditioning of the Jacobian matrix.

Conclusions et perspectives

Bilans des résultats obtenus

Le modèle d'écoulements liquide gaz compositionnels thermiques des flux de Darcy a été détaillé avec deux formulations à variables persistantes dans le Chapitre 1. Ces deux formulations ont l'avantage d'éviter tout changement de variable lié à la présence des phases. Pour cela, le choix des variables principales est combiné avec une extension des fractions molaires d'une phase absente par celles à l'équilibre thermodynamique avec la phase présente. Ainsi l'ensemble des variables principales et des équations ne dépendent pas de l'ensemble des phases présentes. De plus l'équilibre thermodynamique a pu être exprimé par une contrainte de complémentarité pour chacune des phases, ce qui a permis l'utilisation de l'algorithme de Newton-min pour résoudre les systèmes non-linéaires à chaque pas de temps de la simulation. Dans ce chapitre, les modèles ont été discrétisés par le schéma deux-points centré aux mailles TPFA (Two Point Flux Approximation). Les deux formulations ont été étudiées sur des simulations de la coupe 2D représentant le plan de faille majeur de Bouillante. La formulation T-PSC a montré une meilleure convergence du Newton-min que la formulation T-PSF en comparant le nombre d'échecs du pas de temps, le nombre moyen d'itérations de Newton par pas de temps et le temps CPU. De plus la formulatin T-PSF nécessite une mise-à-jour non-linéaire qui est difficilement généralisable à un nombre plus important de composants et à des formules pour les fugacités plus compliquées. C'est pourquoi la formulation T-PSC a été retenue et l'étude de convergence vers une solution stationnaire semi-analytique a validé la discrétisation et la formulation de ce modèle.

Cependant, la consistence du schéma TPFA exige des conditions fortes d'orthogonalité sur le maillage qui ne sont pas réalisables pour des modèles géothermiques complexes. Une solution proposée dans le Chapitre 2 consiste en un schéma basé sur des maillages hybrides. L'utilisation de différents types de mailles est plus adaptée à la discrétisation de la géologie et la géométrie des différents domaines du système géothermique (failles, topographie, ...). Le schéma combinant la discrétisation centrée aux faces HFV (Hybrid Finite Volume) et celle basée aux noeuds VAG (Vertex Approximate Gradient) permet de choisir localement le schéma en fonction de la géometrie et des propriétés géologiques de la maille et de tirer avantage des spécificités de chaque schéma. Deux stratégies ont été considérées pour coupler ces deux discrétisa-tions. La première repose sur la partition des mailles, chaque maille ayant des inconnues aux faces ou aux noeuds, tandis que la seconde est fondée sur la partition des faces, chaque face ayant une inconnue à la face ou des inconnues aux noeuds. Dans les deux cas le couplage est effectué à l'aide d'un opérateur d'interpolation des faces par les noeuds aux interfaces entre les deux schémas. L'interpolation a été choisie pour assurer la consistence, la coercivité et la limite conformité de la discrétisation, plaçant le schéma dans le cadre des discrétisations Gradient. La convergence a été prouvée pour des partitions arbitraires des mailles ou des faces du maillage. La première construction a l'avantage de préserver le caractère deux-points des flux y compris aux mailles interfaces lorsque les conditions sont remplies pour que le schéma HFV dégénère en TPFA par contre elle n'est stable que pour une partition arbitraire de mailles. Cela produit un stencil plus petit que la seconde construction. En effet, pour assurer la coercivité pour une partition quelconque des faces, la seconde construction requière une stabilisation additionnelle. Cependant, cette stabilisation permet à la seconde construction d'être utilisée de manière autonome sur toutes les faces du maillage. Ces constructions ont aussi l'avantage d'être faciles à implémenter car elles s'appuient sur l'écriture des flux discrets connectant chaque maille à ses noeuds et/ou faces faisant partie de ses degrés de liberté. D'autre part, la méthodologie préserve les propriétés de conservation discrète des schémas VAG et HFV à l'interface entre ces deux schémas, ce qui a permis l'extension de la discrétisation VAG-HFV à des modèles de Darcy diphasiques puis au cas des écoulements de Darcy diphasiques non-isothermes compositionnels. De nombreux tests numériques ont validé la bonne convergence des schémas VAG-HFV d'abord sur des problèmes de diffusion du second ordre, puis sur des écoulements de Darcy diphasiques. Ces tests ont été éffectués sur des géométries et des partitions VAG/HFV différentes et ont été comparés aux discrétisations VAG d'un côté et HFV de l'autre. Enfin, des simulations diphasiques non-isothermes compositionnelles avec des discrétisations et des maillages différents du plan de faille de Bouillante ont confirmé que le schéma VAG-TPFA sur un maillage hybride Cartésien-triangle fournit le meilleur compromis entre précision et temps de calcul, comparé au schéma VAG sur maillage triangulaire et au schéma TPFA sur maillage Voronoi. Ce travail a donné lieu à une publication dans la conférence internationale ECMOR XVI [START_REF] Beaude | Combining face based and nodal based discretizations for multiphase darcy flow problems[END_REF] et à une publication soumise à M2AN [START_REF] Beaude | Combined face based and nodal based discretizations on hybrid meshes for non-isothermal two-phase darcy flow problems[END_REF].

Un autre aspect important de la modélisation des flux géothermiques consiste à prendre en compte l'impact de l'atmosphère sur les flux dans le milieu poreux. Dans le Chapitre 3 a été proposé une condition limite avancée prenant en compte l'équilibre de matière et d'énergie à l'interface entre le milieu poreux et l'atmosphère. Elle contient la vaporisation de la phase liquide dans l'atmosphère, le transfert convectif molaire et thermique, une condition de débordement liquide aux surfaces d'infiltration, ainsi que le rayonnement thermique et la recharge en eau douce due aux précipitations. La condition de débordement n'est active que quand l'atmosphère est saturée en vapeur d'eau et dans ce cas le modèle ne suppose pas l'accumulation de l'eau liquide dans l'atmo-sphère. La condition limite d'évaporation a été validée grâce à la comparaison avec un modèle complet de type RANS (Reynolds Average Navier-Stokes) non-isotherme compositionnel dans le milieu libre. D'autre part, plusieurs propositions ont été étudiées pour améliorer la convergence de l'algorithme de Newton et en particulier le fait d'imposer les contraintes de complémentarité à chaque itération du Newton. Ainsi la condition limite sol-atmosphère a été appliquée à plusieurs simulations numériques 1D et 2D avec deux composants (air et eau) pour étudier entre autres le comportement de la condition de débordement en phase liquide, la convergence numérique de l'algorithme de Newton, et pour comparer l'impact de la condition limite atmosphèrique sur la solution physique à la place d'une condition de Dirichlet. Ces simulations ont confirmé l'importance de la modélisation de l'atmosphère et la difficulté de la remplacer par une condition limite de Dirichlet. Les adaptations de l'algorithme de Newton améliorent la convergence et sont même régulièrement nécéssaires pour obtenir la convergence des tests numériques. Enfin, pour plus de respect de la physique du champ géothermique de Bouillante, le composant sel a été ajouté dans un dernier cas test (sans tenir compte d'une éventuelle précipitation). D'autre part, la condition limite atmosphèrique a été appliquée sur un maillage hybride avec le schéma VAG-TPFA. Les simulations numériques ont confirmé la précision et l'efficacité du schéma couplé et de la condition limite atmosphérique. Ce travail a donné lieu à deux publications dans des conférences internationales [START_REF] Beaude | Non-isothermal compositional two-phase darcy flow: formulation and outflow boundary condition[END_REF], [START_REF] Beaude | Numerical Modeling of High Energy Geothermal Systems with Soil Atmosphere Boundary Condition[END_REF] et à une publication soumise à Computational Geosciences [START_REF] Beaude | Non-isothermal compositional liquid gas darcy flow: formulation, soil-atmosphere boundary condition and application to high energy geothermal simulations[END_REF].

Perspectives

Extension du schéma couplé VAG-HFV à des géométries moins académiques : il serait intéressant de faire plus de cas tests sur des domaines 3D avec des objets géologiques plus complexes comme des failles ou des fractures. Le schéma avec inconnue aux faces HFV est naturel au voisinage des fractures car il ne couple pas les inconnues d'interface entre elles, ce qui permet de les éliminer de la Jacobienne. Cependant utiliser uniquement la discrétisation HFV serait très couteux sur maillage tétrahèdrique. De son côté, le schéma VAG est bien adapté s'il n'y a pas d'inconnue d'interface mais cela ne permet pas de capter les sauts de pressions et de saturations entre la matrice et la fracture. Il est possible d'ajouter des inconnues d'interface mais dans ce cas VAG devient très couteux. Le schéma couplant les discrétisations VAG et HFV serait une solution pertinente.

Préconditionneur HFV : une difficulté rencontrée dans cette thèse repose sur le mauvais préconditionnement de la Jacobienne lors de l'utilisation du schéma HFV. En effet, la présence de deux inconnues pressions elliptiques aux faces et d'une seule aux mailles bloque l'utilisation du préconditionneur CPR-AMG. Généralement il s'agit de définir un bloc pression qui est préconditionné avec CPR-AMG mais dans le cas HFV on ne sait pas définir de bloc pression car le nombre d'équations dépend du degré de li-berté. Pour contourner le problème, l'idée serait d'éliminer les inconnues pressions aux faces (comme pour le schéma TPFA par exemple), sauf qu'avec le schéma HFV cela remplirait trop la Jacobienne. Il pourrait donc être intéressant d'étudier une élimination approchée des deux pressions en choisissant un stencil creux. Ainsi la Jacobienne réduite ne contenant que des inconnues pressions aux mailles pourrait être préconditionnée facilement grâce à CPR-AMG.

Extension de la condition limite atmosphérique à des géométries et géologies plus complexes : pour compléter l'étude de cette condition limite avancée, il serait judicieux d'étendre le modèle de condition limite sol-atmosphère introduit au Chapitre 3 à des géométries et des géologies plus complexes, et en particulier elle pourrait être implémentée dans le code ComPASS (détaillé dans l'annexe 4). La condition limite est facilement applicable au schéma VAG, cela a été fait pour les tests numériques de la Section 3.4. Il s'agirait tout d'abord d'adapter le travail à la formulation de Coats implémentée dans ComPASS. Puis, une autre difficulté réside dans l'ajout de conditions limites de type Robin puisqu'il faut introduire un nouveau système d'inconnues et d'équations. D'autre part, les simulations 3D étant plus conséquentes, le solveur direct utilisé jusqu'à présent devra être remplacé par un solveur itératif et il est probable que la condition limite de Robin pose des problèmes de préconditionnement. with the ability to represent fractures. The VAG scheme has been implemented into the ComPASS code, discretization which uses nodal and fracture face unknowns in addition to the cell unknowns which can be eliminated without any fill-in. At the reservoir scale, the mesh cannot resolve the well boundary thus the well is modelled as a Dirac source term along the well trajectory. Each well is discretized as a subset of edges of the mesh which allows to represent easily slanted and multi-branch wells. Several simulations have been run to validate the implementation and in particular a single-phase non-isothermal transient flow on a complex geometry including three intersecting fractures, one slanted injection well and one multi-branch production well.

Notations

Element Notation bounded polytopal domain of R d Ω set of cells M "center" of the cell K ∈ M x K set of faces F "center" of the face σ ∈ F x σ set of neighbouring cell(s) of the face σ ∈ F M σ set of faces of the cell K ∈ M F K set of interior faces
T W. m -2 . K -1 soil emissivity ε net radiation R n W. m -2 incoming long-wave radiation R a W. m -2 net short-wave radiation R s W. m -2 surface albedo a Stephan-Boltzmann constant σ SB W. m -2 . K -4

Introduction

There is a need to develop new efficient and robust simulation tools to go beyond existing code capabilities in terms of geological and physical complexity [START_REF] Ketilsson | Geothermal Reservoir Modeling Recommendations for Research and Development[END_REF][START_REF] O'sullivan | Future directions in geothermal modelling[END_REF]. In particular such code should be able to deal with fault and fracture networks acting as major heat and mass transfer corridors in high energy geothermal reservoirs and also to simulate both under critical and super critical thermodynamic domains. Existing tools such as Tough2 [START_REF] O'sullivan | Further improvements in the convergence of Tough2 simulations[END_REF], used for more than 25 years in geothermy, are limited to structured meshes and are not able to integrate conductive fractures. Moreover, their parallel efficiency is very limited.

This has motivated the development of a new geothermal simulator based on unstructured meshes and adapted to parallel distributed architectures with the ability to represent fractures as co-dimension 1 surfaces connected to the surrounding matrix domain. The current version of this simulator is described in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. The objective of this Cemracs project is to bring the development of this simulator to a level where operational use is possible and real geothermal test cases can be considered. In this regard, wells are central features of geothermal exploitation and are the main focus of this work.

The use of lower dimensional rather than equi-dimensional entities to represent fracture or fault networks has been introduced in [START_REF] Alboin | Modeling fractures as interfaces for flow and transport in porous media[END_REF][START_REF] Flauraud | Domain decomposition for an asymptotic geological fault modeling[END_REF][START_REF] Bogdanov | Two-phase flow through fractured porous media[END_REF][START_REF] Karimi-Fard | An efficient discrete-fracture model applicable for general-purpose reservoir simulators[END_REF][START_REF] Martin | Modeling fractures and barriers as interfaces for flow in porous media[END_REF] to facilitate the grid generation and to reduce the number of degrees of freedom of the discretized model. The reduction of dimension in the fracture network is obtained from the equidimensional model by integration and averaging along the width of each fracture. The resulting so called hybrid-dimensional model couple the 3D model in the matrix with a 2D model in the fracture network taking into account the jump of the normal fluxes as well as additional transmission conditions at the matrix-fracture interfaces. These transmission conditions depend on the mathematical nature of the equi-dimensional model and on additional physical assumptions. They are typically derived for a single phase Darcy flow for which they specify either the continuity of the pressure in the case of fractures acting as drains [START_REF] Alboin | Modeling fractures as interfaces for flow and transport in porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flows in fractured porous media[END_REF] or Robin type conditions in order to take into account the discontinuity of the pressure for fractures acting either as drains or barriers [START_REF] Flauraud | Domain decomposition for an asymptotic geological fault modeling[END_REF][START_REF] Martin | Modeling fractures and barriers as interfaces for flow in porous media[END_REF][START_REF] Angot | Asymptotic and numerical modelling of flows in fractured porous media[END_REF][START_REF] Brenner | Hybrid-dimensional modelling and discretization of two phase darcy flow through DFN in porous media[END_REF]. In our case, the fractures will be assumed to act as drains both for the Darcy flow and for the thermal conductivity leading us to set the pressure and temperature continuity as transmission conditions at the matrix fracture interfaces.

The discretization of hybrid-dimensional Darcy flow models has been the object of many works using cell-centered Finite Volume schemes with either Two Point or Multi Point Flux Approximations (TPFA and MPFA) [START_REF] Karimi-Fard | An efficient discrete-fracture model applicable for general-purpose reservoir simulators[END_REF][START_REF] Angot | Asymptotic and numerical modelling of flows in fractured porous media[END_REF][START_REF] Haegland | Comparison of cell-and vertex-centered discretization methods for flow in a two-dimensional discrete-fracture-matrix system[END_REF][START_REF] Tunc | A model for conductive faults with non-matching grids[END_REF][START_REF] Sandve | An efficient multi-point flux approximation method for Discrete Fracture-Matrix simulations[END_REF][START_REF] Ahmed | Control-volume distributed multi-point flux approximation coupled with a lower-dimensional fracture model[END_REF][START_REF] Ahmed | Three-dimensional control-volume distributed multi-point flux approximation coupled with a lowerdimensional surface fracture model[END_REF], Mixed or Mixed Hybrid Finite Element methods (MFE and MHFE) [START_REF] Alboin | Modeling fractures as interfaces for flow and transport in porous media[END_REF][START_REF] Martin | Modeling fractures and barriers as interfaces for flow in porous media[END_REF][START_REF] Hoteit | An efficient numerical model for incompressible twophase flow in fractured media[END_REF], Hybrid Mimetic Mixed methods (HMM, which contains mixed-hybrid finite volume and mimetic finite difference schemes [START_REF] Droniou | A unified approach to mimetic finite difference, hybrid finite volume and mixed finite volume methods[END_REF]) [START_REF] Faille | Model reduction and discretization using hybrid finite volumes of flow in porous media containing faults[END_REF][START_REF] Antonietti | Mimetic finite difference approximation of flows in fractured porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flows in fractured porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flow in fractured porous media with discontinuous pressures at matrix-fracture interfaces[END_REF], Control Volume Finite Element methods (CVFE) [START_REF] Bogdanov | Two-phase flow through fractured porous media[END_REF][START_REF] Reichenberger | A mixed-dimensional finite volume method for two-phase flow in fractured porous media[END_REF][START_REF] Monteagudo | Control-volume model for simulation of water injection in fractured media: incorporating matrix heterogeneity and reservoir wettability effects[END_REF][START_REF] Haegland | Comparison of cell-and vertex-centered discretization methods for flow in a two-dimensional discrete-fracture-matrix system[END_REF][START_REF] Matthai | Finite element -node-centered finite-volume two-phase-flow experiments with fractured rock represented by unstructured hybrid-element meshes[END_REF]. This article focus on the Vertex Approximate Gradient (VAG) scheme which has been introduced for the discretization of multiphase Darcy flows in [START_REF] Eymard | Vertex-centred discretization of multiphase compositional Darcy flows on general meshes[END_REF] and extended to hybrid-dimensional models in [START_REF] Brenner | Vertex Approximate Gradient scheme for hybrid-dimensional two-phase Darcy flows in fractured porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flows in fractured porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flow in fractured porous media with discontinuous pressures at matrix-fracture interfaces[END_REF][START_REF] Xing | Parallel Vertex Approximate Gradient discretization of hybrid-dimensional Darcy flow and transport in discrete fracture networks[END_REF][START_REF] Brenner | Hybrid-dimensional modelling and discretization of two phase darcy flow through DFN in porous media[END_REF][START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. The VAG scheme uses nodal and fracture face unknowns in addition to the cell unknowns which can be eliminated without any fill-in. Thanks to its essentially nodal feature, it leads to a sparse discretization on tetrahedral or mainly tetrahedral meshes. It has the benefit, compared with the CVFE methods of [START_REF] Bogdanov | Two-phase flow through fractured porous media[END_REF][START_REF] Reichenberger | A mixed-dimensional finite volume method for two-phase flow in fractured porous media[END_REF][START_REF] Monteagudo | Control-volume model for simulation of water injection in fractured media: incorporating matrix heterogeneity and reservoir wettability effects[END_REF][START_REF] Matthai | Finite element -node-centered finite-volume two-phase-flow experiments with fractured rock represented by unstructured hybrid-element meshes[END_REF], to avoid the mixing of the control volumes at the matrix fracture interfaces, which is a key feature for its coupling with a transport model. As shown in [START_REF] Brenner | Vertex Approximate Gradient scheme for hybrid-dimensional two-phase Darcy flows in fractured porous media[END_REF] for two phase flow problems, this allows for a coarser mesh size at the matrix fracture interfaces for a given accuracy.

At the reservoir scale of a few kilometers, the mesh cannot resolve the well boundary with a radius of say 10 cm and the well is modelled as a Dirac source term along the well trajectory. Most well models in reservoir simulations are defined by a set of connected perforations, each perforation belonging to a cell of the mesh [START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation[END_REF][START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation with Nonsquare Grid Blocks and Anisotropic Permeability[END_REF]. This type of approach is adapted to cell-centered finite volume discretization. In order to take advantage of unstructured meshes and of the nodal feature of the VAG scheme, it is more convenient in our case to discretize each well as a subset of edges of the mesh. This alternative approach provides an efficient way to represent slanted and multi-branch wells. The fluxes connecting the well with the 3D matrix and the 2D fracture network at each node of the well will be computed using Peaceman's approach [START_REF] Chen | Well flow models for various numerical methods[END_REF][START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation[END_REF][START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation with Nonsquare Grid Blocks and Anisotropic Permeability[END_REF]. It is based on a Two Point Flux Approximation with a transmissibility taking into account the unresolved singularity of the pressure (or temperature) solution in the neighbourhood of the well. The non-isothermal flow model inside the well is defined in the spirit of what is conventionally done in oil reservoir simulators [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF] using a single implicit unknown for each well corresponding to a reference pressure often called the bottom hole pressure. The pressures along the well will be deduced from the bottom hole pressure assuming that the pressure is hydrostatic inside the well. The temperatures along the well will be computed assuming thermal equilibrium and a stationary flow inside the well. Then, the well equation is obtained by the complementarity conditions between a specified well mass flow rate and a specified limit bottom hole pressure. By connecting all the nodes along the well trajectory to the well reference pressure unknown, the well equation introduces an additional connectivity. This difficulty will be accounted for by the definition of ghost and own wells for each process and by extension of the ghost nodes of each process in order to take into account the additional connections induced by the own and ghost wells. This allows to assemble the Jacobian and to compute the well pressure drops locally on each process without the need of MPI communications.

The outline of the remaining of this chapter is as follows. In Section 4.2, the hybriddimensional model presented in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF] is recalled. Although the implementation has been done for the multi-phase compositional model defined in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF], we focus here on the particular case of a non-isothermal single-component single-phase Darcy flow model in order to simplify the presentation. Section 4.3 introduces the space and time discretization of the model. The definitions of the multi-branch well data structure and of the well model are detailed in Subsection 4.3.2. Section 4.4 presents the parallel implementation of the model including the partitioning of the mesh and wells, as well as the parallel assembly of the non-linear and linear systems to be solved at each time step of the simulation. The solution of the linear systems uses the parallel linear solver library PETSc [START_REF] Balay | PETSc Users Manual[END_REF] and is based on the GMRES iterative solver preconditioned by a CPR-AMG preconditioner [START_REF] Lacroix | Decoupling preconditioners in the implicit parallel accurate reservoir simulator (IPARS)[END_REF][START_REF] Scheichl | Decoupling and block preconditioning for sedimentary basin simulations[END_REF]. The implementation of the CPR-AMG preconditioner takes into account the well equations in the definition of the pressure block. Two numerical tests are presented in Section 4.5. The first test case is used to validate our model. It considers an isothermal single-phase stationary Darcy flow on a simple geometry with one horizontal fracture and one vertical well for which an analytical pressure solution can be obtained. The second test case considers a single-phase nonisothermal transient flow on a complex geometry including three intersecting fractures, one slanted injection well and one multi-branch production well.

Hybrid-dimensional non-isothermal single-phase Discrete Fracture Model

This section recalls, in the particular case of a non-isothermal single-component singlephase Darcy flow model, the hybrid-dimensional model introduced in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF].

Discrete Fracture Network

Let Ω denote a bounded domain of R 3 assumed to be polyhedral. Following [START_REF] Alboin | Modeling fractures as interfaces for flow and transport in porous media[END_REF][START_REF] Flauraud | Domain decomposition for an asymptotic geological fault modeling[END_REF][START_REF] Martin | Modeling fractures and barriers as interfaces for flow in porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flows in fractured porous media[END_REF][START_REF] Brenner | Gradient discretization of hybrid-dimensional Darcy flow in fractured porous media with discontinuous pressures at matrix-fracture interfaces[END_REF] the fractures are represented as interfaces of codimension 1. Let J be a finite set and let Γ = j∈J Γ j and its interior Γ = Γ \ ∂ Γ denote the network of fractures Γ j ⊂ Ω, j ∈ J, such that each Γ j is a planar polygonal simply connected open domain included in a plane of R 3 . fracture width is denoted by d f and is such that 0

< d f ≤ d f (x) ≤ d f for all x ∈ Γ.
We can define, for each fracture j ∈ J, its two sides + and -. For scalar functions on Ω, possibly discontinuous at the interface Γ (typically in H 1 (Ω \ Γ)), we denote by γ ± the trace operators on the side ± of Γ. Continuous scalar functions u at the interface Γ (typically in H 1 (Ω)) are such that γ + u = γ -u and we denote by γ the trace operator on Γ for such functions. At almost every point of the fracture network, we denote by n ± the unit normal vector oriented outward to the side ± of Γ such that n + + n -= 0. For vector fields on Ω, possibly discontinuous at the interface Γ (typically in H div (Ω \ Γ), we denote by γ ± n the normal trace operator on the side ± of Γ oriented w.r.t. n ± . The gradient operator in the matrix domain Ω \ Γ is denoted by ∇ and the tangential gradient operator on the fracture network is denoted by ∇ τ such that

∇ τ u = ∇u -(∇u • n + )n + .
We also denote by div τ the tangential divergence operator on the fracture network, and by dτ(x) the Lebesgue measure on Γ.

We denote by Σ the dimension 1 open set defined by the intersection of the fractures excluding the boundary of the domain Ω, i.e. the interior of {( j, j

)∈J×J | j = j } ∂ Γ j ∩ ∂ Γ j \ ∂ Ω.
Γ D ∩ ∂ Γ N = / 0, ∂ Γ ∩ ∂ Ω = ∂ Γ D ∪ ∂ Γ N . Let γ n ∂ Γ j
, j ∈ J denote the normal trace operator at the fracture Γ j boundary oriented outward to Γ j .

Non-isothermal single-phase flow model

To focus on the implementation aspects related to well modelling, the physics of the fluid is kept relatively simple and we refer to [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF] for a compositional multiphase nonisothermal modelling of reservoir flow. The fluid is monophasic and is described by its thermodynamic variables X = (P, T ) where P is the pressure and T the temperature. We denote by ρ(X) its mass density, by µ(X) its dynamic viscosity, by e(X) its specific internal energy, and by h(X) its specific enthalpy. The rock energy density is denoted by E r (X).

The reduction of dimension in the fractures leading to the hybrid-dimensional model is obtained by integration of the conservation equations along the width of the fractures complemented by transmission conditions at both sides of the matrix fracture interfaces (see [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]). In the following, X m = (P m , T m ) denote the pressure and temperature in the matrix domain Ω \ Γ, and X f = (P f , T f ) are the pressure and temperature in the fractures averaged along the width of the fractures. The permeability tensor is denoted by Λ Λ Λ m in the matrix domain and is assumed to be constant in the width of the fractures and to have the normal vector n + as principal direction. We denote by Λ Λ Λ f the tangential permeability tensor in the fractures. The porosity (resp. thermal conductivity of the rock and fluid mixture) is denoted by φ m (resp. λ m ) in the matrix domain. It is assumed to be constant in the width of the fractures and denoted by φ f (resp. λ f ). The gravity acceleration vector is denoted by g.

The set of unknowns of the hybrid-dimensional model is defined by X m in the matrix domain Ω \ Γ, by X f in the fracture network Γ, and by X Σ = (P Σ , T Σ ) at the fracture intersection Σ. The set of equations couples the mass and energy conservation equations in the matrix

φ m ∂ t ρ(X m ) + div(q m ) = 0, φ m ∂ t ρ(X m )e(X m ) + (1 -φ m )∂ t E r (X m ) + div(q e,m ) = 0, (4.2.1)
in the fracture network

d f φ f ∂ t ρ(X f )+div τ (q f ) -γ + n q m -γ - n q m = 0, d f φ f ∂ t ρ(X f )e(X f ) + d f (1 -φ f )∂ t E r (X f ) + div τ (q e, f ) -γ + n q e,m -γ - n q e,m = 0, (4.2.2)
and at the fracture intersection

∑ j∈J (γ n ∂ Γ j q f )| Σ = 0, ∑ j∈J (γ n ∂ Γ j q e, f )| Σ = 0, (4.2.3)
as well as the Darcy and Fourier laws providing the mass and energy fluxes in the matrix

q m = ρ(X m ) µ(X m ) V m , q e,m = h(X m )q m -λ m ∇T m , (4.2.4)
and in the fracture network

q f = ρ(X f ) µ(X f ) V f , q e, f = h(X f )q f -d f λ f ∇ τ T f , (4.2.5)
where

V m = -Λ Λ Λ m ∇P m -ρ(X m )g , V f = -d f Λ Λ Λ f ∇ τ P f -ρ(X f )g τ , g τ = g-(g•n + )n + .
The system (4. ) is closed with the transmission conditions at the matrix fracture interface Γ. These conditions state the continuity of the pressure and temperature at the matrix fracture interface assuming that the fractures do not act as barrier neither for the Darcy flow nor for the thermal conductivity (see [START_REF] Alboin | Modeling fractures as interfaces for flow and transport in porous media[END_REF][START_REF] Flauraud | Domain decomposition for an asymptotic geological fault modeling[END_REF][START_REF] Martin | Modeling fractures and barriers as interfaces for flow in porous media[END_REF][START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]).

γ + P m = γ -P m = γP m = P f , γ + T m = γ -T m = γT m = T f . (4.2.6)
F Γ and the fracture nodes V Γ are shared between the matrix and the fractures but the control volumes associated with these degrees of freedom will belong to the fracture network (see Figure 4.3.2). The degrees of freedom at the fracture intersection Σ are defined by the set of nodes V Σ ⊂ V Γ located on Σ. The set of nodes at the Dirichlet boundaries ∂ Ω D and ∂ Γ D is denoted by V D .

The VAG scheme is a control volume scheme in the sense that it results, for each non Dirichlet degree of freedom in a mass or energy balance equation. The matrix diffusion tensor is assumed to be cellwise constant and the tangential diffusion tensor in the fracture network is assumed to be facewise constant. The two main ingredients are therefore the conservative fluxes and the control volumes. The VAG matrix and fracture fluxes are illustrated in Figure 4.3.1. For u D ∈ V D , the matrix fluxes F Kν (u D ) connect the cell K ∈ M to the degrees of freedom located at the boundary of K, namely

ν ∈ Ξ K = V K ∪ (F K ∩ F Γ ).
The fracture fluxes F σ s (u D ) connect each fracture face σ ∈ F Γ to its nodes s ∈ V σ . The expression of the matrix (resp. the fracture) fluxes is linear and local to the cell (resp. fracture face). As in (2.2.14), the matrix fluxes are given by

F Kν (u D ) = ∑ ν ∈Ξ K T ν,ν K (u K -u ν ),
with a symmetric positive definite transmissibility matrix T K = (T ν,ν K ) (ν,ν )∈Ξ K ×Ξ K depending only on the cell K geometry (including the choices of x K and of x σ , σ ∈ F K ) and on the cell matrix diffusion tensor. The fracture fluxes are given by

F σ s (u D ) = ∑ s∈V σ T s,s σ (u σ -u s ),
with a symmetric positive definite transmissibility matrix T σ = (T s,s σ ) (s,s )∈V σ ×V σ depending only on the fracture face σ geometry (including the choice of x σ ) and on the fracture face width and tangential diffusion tensor. Let us refer to [START_REF] Brenner | Vertex Approximate Gradient scheme for hybrid-dimensional two-phase Darcy flows in fractured porous media[END_REF] for a more detailed presentation and for the definition of T K and T σ .

The construction of the control volumes at each degree of freedom is based on partitions of the cells and of the fracture faces. These partitions are respectively denoted, for all K ∈ M , by

K = ω K   s∈V K \V D ω K,s   ,
and, for all σ ∈ F Γ , by

σ = Σ σ   s∈V σ \V D Σ σ ,s   .
It is important to notice that in the usual case of cellwise constant rocktypes in the matrix and facewise constant rocktypes in the fracture network, the implementation of the scheme does not require to build explicitly the geometry of these partitions. In that case, it is sufficient to define the matrix volume fractions

α K,s = ω K,s dx K dx , s ∈ V K \ (V D ∪ V Γ ), K ∈ M ,
constrained to satisfy α K,ν ≥ 0, and ∑ s∈V K \(V D ∪V Γ ) α K,s ≤ 1, as well as the fracture volume fractions

α σ ,s = Σ σ ,s d f (x)dτ(x) σ d f (x)dτ(x) , s ∈ V σ \ V D , σ ∈ F Γ ,
constrained to satisfy α σ ,s ≥ 0, and ∑ s∈V σ \V D α σ ,s ≤ 1, where we denote by dτ(x) the 2 dimensional Lebesgue measure on Γ. Let us also set

ϕ K = (1 - ∑ s∈V K \(V D ∪V Γ ) α K,s ) K φ m (x)dx for K ∈ M , and
ϕ σ = (1 -∑ s∈V σ \V D α σ ,s ) σ φ f (x)d f (x)dτ(x) for σ ∈ F Γ ,
as well as

ϕ s = ∑ K∈M s α K,s K φ m (x)dx for s ∈ V \ (V D ∪ V Γ ), and
ϕ s = ∑ σ ∈F Γ,s α σ ,s σ φ f (x)d f (x)dτ(x) for s ∈ V Γ \ V D ,
which correspond to the porous volumes distributed to the degrees of freedom excluding the Dirichlet nodes. The rock complementary volume in each control volume

ν ∈ M ∪ F Γ ∪ (V \ V D ) is denoted by φν .
As shown in [START_REF] Brenner | Vertex Approximate Gradient scheme for hybrid-dimensional two-phase Darcy flows in fractured porous media[END_REF], the flexibility in the choice of the control volumes is a crucial asset, compared with usual CVFE approaches and allows to significantly improve the accuracy of the scheme when the permeability field is highly heterogeneous. As exhibited in Figure 4.3.2, as opposed to usual CVFE approaches, this flexibility allows to define the control volumes in the fractures with no contribution from the matrix in order to avoid to artificially enlarge the flow path in the fractures.

Multi-branch non-isothermal well model

Let W denote the set of wells. Each multi-branch well ω ∈ W is defined by a set of oriented edges of the mesh assumed to define a rooted tree oriented away from the root. This orientation corresponds to the drilling direction of the well. The set of nodes of a well ω ∈ W is denoted by V ω ⊂ V and its root node is denoted by s root ω . A partial ordering is defined on the set of vertices V ω with s < shall be taken into account when modelling the wellbore flow up to the surface. It is assumed that the radius r ω of each well ω ∈ W is small compared to the cell sizes in the neighbourhood of the well. It results that the Darcy flux between the reservoir and the well at a given well node s ∈ V ω is obtained using the Two Point Flux Approximation V s,ω = WI s,ω (P s -P s,ω ),

where P s is the reservoir pressure at node s and P s,ω is the well pressure at node s.

The Well Index WI s,ω is typically computed using Peaceman's approach (see [START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation[END_REF][START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation with Nonsquare Grid Blocks and Anisotropic Permeability[END_REF][START_REF] Chen | Well flow models for various numerical methods[END_REF]) and takes into account the unresolved singularity of the pressure solution in the neighbourhood of the well. Fourier fluxes between the reservoir and the well could also be discretized using such Two Point Flux Approximation but they are assumed to be small compared with thermal convective fluxes and will be neglected in the following well model. At each well node s ∈ V ω the temperature inside the well is denoted by T s,ω and let us introduce X s,ω = (P s,ω , T s,ω ).

For any a ∈ R, let us define a + = max(a, 0) and a -= min(a, 0). The mass flow rate between the reservoir and the well ω at a given node s ∈ V ω is defined by the upwind formula q m,s,ω = β in j ω ρ(X s,ω ) µ(X s,ω ) WI s,ω (P s -P s,ω ) -+ β prod ω ρ(X s ) µ(X s ) WI s,ω (P s -P s,ω ) + , (4.3.1)

and the energy flow rate by q e,s,ω = h(X s,ω )q - m,s,ω + h(X s )q + m,s,ω . (4.3.

2)

The well coefficients β in j ω and β prod ω are used to impose specific well behavior. The general case corresponds to β in j ω = β prod ω = 1. Yet, for an injection well, it will be convenient as explained in Subsection 4.3.2, to impose that the mass flow rates q m,s,ω are non positive for all nodes s ∈ V ω corresponding to set β in j ω = 1 and β prod ω = 0. Likewise, for a production well, it will be convenient as explained in Subsection 4.3.2, to set β in j ω = 0 and β prod ω = 1 which corresponds to assume that the mass flow rates q m,s,ω are non negative for all nodes s ∈ V ω . These simplifying options currently prevent the modelling of cross flows where injection and production occur in different places of the same well, as it sometimes happen in geothermal wells, typically in closed wells.

Well model

Our conceptual model inside the well assumes that the flow is stationary at the reservoir time scale along with perfect mixing and thermal equilibrium. The pressure distribution along the well is also assumed hydrostatic.

For the sake of simplicity, the flow rate between the reservoir and the well is considered concentrated at each node s of the well. Hence the mass flow rate along each edge ε ∈ E ω depends only on time. It is denoted by q ε and is oriented positively from s 1 to s 2 with ε = s 1 s 2 . Since Fourier fluxes are neglected, the specific enthalpy depends as well only on time along the edge ε and is denoted by h ε .

The set of well unknowns is defined by the well pressure P s,ω and the well temperature T s,ω at each node s ∈ V ω , the mass flow rate q ε and specific enthalpy h ε at each edge ε ∈ E ω , the well total mass flow rate q ω (non negative for production wells and non positive for injection wells) as well as the well specific enthalpy h ω for injection wells.

For each edge ε = s 1 s 2 ∈ E ω , the specific enthalpy h ε satisfies the equation h ε = h(X s 1 ,ω ) if q ε ≥ 0, h(X s 2 ,ω ) if q ε < 0. ∑ ε∈E s ∩E ω κ ε,s q ε + q m,s,ω = δ s root ω s q ω , ∑ ε∈E s ∩E ω κ ε,s h ε q ε + q e,s,ω = δ

s root ω s h ω q - ω + h(X s,ω )q + ω , (4.3.4)
where δ stands for the Kronecker symbol. Inside the well, the hypothesis of hydrostatic pressure distribution implies that

       ∂ P ∂ z = -gρ(X) on ε = s 1 s 2 , h (
X) = h ε , P(z s 1 ) = P s 1 ,ω , P(z s 2 ) = P s 2 ,ω , (4. 3.5) for each edge ε ∈ E ω . To close the system, the well boundary conditions prescribe a limit total mass flow rate qω and a limit bottom hole pressure Pω . Then, complementarity constraints accounting for usual well monitoring conditions, are imposed between q ωqω and P ω -Pω with P ω = P s root ω ,ω . In addition, the well specific enthalpy h ω is also prescribed for an injection well.

In the following subsections, we consider the particular cases of injection wells and production wells. The flow rates are enforced to be non positive (resp. non negative) at all well nodes for injection wells (resp. production wells). It corresponds to set β in j ω = 1, β prod ω = 0 for an injection well and β in j ω = 0, β prod ω = 1 for a production well. The limit bottom hole pressure Pω is a maximum (resp. minimum) pressure and the limit total mass flow rate qω is a minimum non positive (resp. maximum non negative) flow rate for injection (resp. production) wells. In both cases, using an explicit computation of the hydrostatic pressure drop, the well model can be reduced to a single equation and a single implicit unknown corresponding to the well reference pressure P ω (see e.g. [START_REF] Aunzo | Wellbore Models GWELL, GWN-ACL, and HOLA, user's guide[END_REF]).

Injection wells

The injection well model sets β in j ω = 1, β prod ω = 0 and prescribes the minimum well total mass flow rate qω ≤ 0, the well maximum bottom hole pressure Pω and the well specific enthalpy h ω .

Since β in j ω = 1 and β prod ω = 0, the mass flow rates q ε are enforced to be non negative and it results from (4.3.4) that h ε = h ω for all ε ∈ E ω .

To compute the pressures along the well, we first solve numerically the equations (4.3.5) using the well reference pressure P n-1 ω = P n-1 s root ω ,ω obtained at the previous time step n -1 and h ε = h ω . It provides the pressure drop ∆P n-1 s,ω = P(z s ) -P n-1 ω at each node s ∈ V ω , from which we deduce the well pressures using the bottom well pressure at the current time step n P n s,ω = P n ω + ∆P n-1 s,ω .

From the equation h(X n s,ω ) = h(P n s,ω , T n s,ω ) = h ω , the well temperature T n s,ω at each node s ∈ V ω depends only on the implicit unknown P n ω . The mass and energy flow rates at each node s ∈ V ω between the reservoir and the well are defined by (4.3.1)-(4.3.2) with β in j ω = 1 and β prod ω = 0 and depend only on the implicit unknowns X n s and P n ω q m,s,ω (X n s , P n ω ) = ρ(X n s,ω ) µ(X n s,ω ) WI s,ω (P n s -P n s,ω ) -, q e,s,ω (X n s , P n ω ) = h ω q m,s,ω (X n s , P n ω ),

The well equation at the current time step is defined by the following complementarity constraint between the prescribed minimum well total mass flow rate and the prescribed maximum bottom hole pressure min ∑ s∈V ω q m,s,ω (X n s , P n ω )qω , Pω -P n ω = 0. (4.3.6)

Production wells

The production well model sets β in j ω = 0, β prod ω = 1 and prescribes the maximum well total mass flow rate qω ≥ 0 and the well minimum bottom hole pressure Pω .

The solution at the previous time step n -1 provides the pressure drop ∆P n-1 s,ω at each node s ∈ V ω . This computation is detailed below. As for the injection well, we deduce the well pressures using the bottom well pressure at the current time step n P n s,ω = P n ω + ∆P n-1 s,ω .

The mass and energy flow rates at each node s ∈ V ω between the reservoir and the well are defined by (4. WI s,ω (P n s -P n s,ω ) + , q e,s,ω (X n s , P n ω ) = h(X n s )q m,s,ω (X n s , P n ω ).

The well equation at the current time step is defined by the following complementarity constraint between the prescribed maximum well total mass flow rate and the prescribed minimum bottom hole pressure min qω -∑ s∈V ω q m,s,ω (X n s , P n ω ), P n ω -Pω = 0. (

Let us now detail the computation of the pressure drop at each node s ∈ V ω using the previous time step solution n -1. We first compute the well temperature T n-1 s,ω at each node s using equations (4.3.4) as follows. The mass and energy flow rates from the upstream nodes of the node s are given by Q m,s,ω = ∑ s ∈V ω |s ≥ ω s q m,s ,ω (X n-1 s , P n-1 ω ), Q e,s,ω = ∑ s ∈V ω |s ≥ ω s q e,s ,ω (X n-1 s , P n-1 ω ).

The temperature T n-1 s,ω inside the well at node s is the solution of the non-linear system h(X n-1 s,ω ) = Q e,s,ω Q m,s,ω from which we deduce the mass density ρ n-1 s,ω = ρ(X n-1 s,ω ) inside the well at node s. These mass densities and the reference pressure P n-1 ω are then used to compute the hydrostatic pressure drop ∆P n-1 s,ω for each node s ∈ V ω using equations (4.3.5).

Discretization of the hybrid-dimensional non-isothermal single-phase flow model

The time integration is based on a fully implicit Euler scheme to avoid severe restrictions on the time steps due to the small volumes and high velocities in the fractures.

An upwind scheme is used for the approximation of the mobilities in the mass and energy fluxes that is to say the same scheme that is already used in the computation of the well mass and energy fluxes (see e.g. [START_REF] Aziz | Petroleum Reservoir Simulation[END_REF]). At the matrix fracture interfaces, we avoid mixing matrix and fracture rocktypes by choosing appropriate control volumes for σ ∈ F Γ and s ∈ V Γ (see Figure 4.3.2). In order to avoid tiny control volumes at the nodes s ∈ V Σ located at the fracture intersection, the volume is distributed to such a node s from all the fracture faces containing the node s. It results that the volumes of the control volumes s ∈ V Σ at the fracture intersections are not smaller than at any other matrix fracture degrees of freedom. This solves the problems reported in [START_REF] Karimi-Fard | An efficient discrete-fracture model applicable for general-purpose reservoir simulators[END_REF] and [START_REF] Sandve | An efficient multi-point flux approximation method for Discrete Fracture-Matrix simulations[END_REF] related to the small volumes at the fracture intersections and avoids the Star-Delta transformation used in [START_REF] Karimi-Fard | An efficient discrete-fracture model applicable for general-purpose reservoir simulators[END_REF] which is not valid when coupled with a transport model.

For each ν ∈ M ∪ F Γ ∪ V the couple of reservoir pressure and temperature is denoted by U ν = P ν , T ν . We denote by U D , the set of reservoir unknowns where G D denotes the vector (g • x ν ) ν∈M ∪F Γ ∪V .

U D = {U ν , ν ∈ M ∪ F Γ ∪ V },
For each Darcy flux, let us define the upwind control volume cv µ,ν such that cv K,ν = K if q Kν (U D ) 0 ν if q Kν (U D ) < 0 for ν ∈ Ξ K , K ∈ M , for the matrix fluxes, and such that

cv σ ,s = σ if q σ s (U D ) 0 s if q σ s (U D ) < 0 for s ∈ V σ , σ ∈ F Γ ,
for fracture fluxes. Using this upwinding, the mass and energy fluxes are given by q m,ν,ν (U D ) = ρ(U cv ν,ν ) µ(U cv ν,ν ) q νν (U D ), q e,ν,ν (U D ) = h(U cv ν,ν )q m,ν,ν (U D ) + G ν,ν (T D ).

In each control volume ν ∈ M ∪ F Γ ∪ V , the mass and energy accumulations are denoted by A m,ν (U ν ) = ϕ ν ρ(U ν ), A e,ν (U ν ) = e(U ν )A m,ν (U ν ) + φν E r (U ν ).

We can now state the system of discrete equations at each time step n = 1, • • • , N t f which accounts for the mass (i = m) and energy (i = e) conservation equations in each cell Let us denote by R ν the vector R i,ν , i ∈ {m, e} , and let us rewrite the conservation equations (4.3.9), (4.3.10), (4.3.11), (4.3.12), (4.3.13) as well as the Dirichlet boundary conditions in vector form defining the following non-linear system at each time step n = 1, 2, ..., N t f where the superscript n is dropped to simplify the notations and where the Dirichlet boundary conditions have been included at each Dirichlet node s ∈ V D in order to obtain a system size independent of the boundary conditions.

K ∈ M R i,K (U n D ) = A i,K (U n K ) -A i,K (U n-1 K ) ∆t n + ∑ s∈V K q i,K,s (U n D ) + ∑ σ ∈F Γ ∩F K q i,K,σ (U n D ) = 0,
0 = R(U D , P W ) =        R s (U D , P W ), s ∈ V , R σ (U D ), σ ∈ F Γ , R K (U D ), K ∈ M , R ω (U D , P W ), ω ∈ W ,
The non-linear system R(U D , P W ) = 0 is solved by a Newton-min algorithm [START_REF] Kräutle | The semi-smooth newton method for multicomponent reactive transport with minerals[END_REF]. Our implementation is based on an active set method which enforces either the total mass flow rate or the bottom hole pressure at each Newton iterate and use the remaining inequality constraint to switch from prescribed total mass flow rate to prescribed bottom hole pressure and vice versa.

Parallel implementation

In this section, the extension to our well model of the original parallel implementation described in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF] is detailed. The distribution of wells to each MPI process p is such that any well with a node belonging to the set of own nodes of p belongs to the set of own and ghost wells of p (see Subsection 4.4.1). Then, the set of own and ghost nodes of p is extended to include all the nodes belonging to the own and ghost wells of p. These definitions ensure that (i) the local linearized systems can be assembled locally on each process without communication as in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF], and (ii) the pressure drops of the wells can be computed locally on each process without communication. This last property is convenient since the pressure drop is a sequential computation along the well rooted tree. This parallelization strategy of the well model is based on the assumption that the number of additional ghost nodes resulting from the connectivity of the wells remains very small compared with the number of own nodes of the process.

In Subsection 4.4.2, the new structure of the local linearized systems is described as well as the local elimination of the cell unknowns. Then, the modification of the pressure block in the CPR-AMG preconditioner and the extension of the synchronization to the ghost well unknowns are addressed.

Mesh decomposition

Let us denote by N p the number of MPI processes. The set of cells M is partitioned into N p subsets M p , p = 1, ..., N p using the library METIS [START_REF] Karypis | A Fast and high quality multilevel scheme for partitioning irregular graphs[END_REF]. The non overlapping partitioning of the set of nodes V , of the set of fracture faces F Γ , and of the set of wells W is defined as follows: assuming we have defined a global index of the cells K ∈ M , let us denote by K(s), s ∈ V (resp. K(σ ), σ ∈ F Γ ) the cell with the smallest global index among those of M s (resp. M σ ). Then we set

V p = {s ∈ V | K(s) ∈ M p }, F p Γ = {σ ∈ F Γ | K(σ ) ∈ M p }, and
W p = {ω ∈ W | s root ω ∈ V p }.

Parallelism of the Jacobian system

The Jacobian of the non-linear system (4. 3)

The linear system (4.4.2) is built locally on each process p and transferred to the parallel linear solver library PETSc [START_REF] Balay | PETSc Users Manual[END_REF]. The parallel matrix and the parallel vector in PETSc are stored in a distributed manner, i.e. each process stores its own rows. We construct the following parallel linear system JU = b, (4.4.4)

with where q ω is the mass flow rate per unit well length. The total mass flow rate is

J =      J 1 R 1 J 2 R
q ω = (2H + k f k m d f )q ω .
This solution will be used to test the convergence of our discretization for both an injection and a production well with fixed temperature. For both test cases, the fluid properties are set to µ = 10 -3 Pa. s for the viscosity and to ρ = 10 3 kg. m -3 for the mass density.

We consider a uniform Cartesian mesh of size n x × n x × n x of the domain Ω conforming to the fracture and to the well. The well indices WI s,ω for s ∈ V ω are computed following Peaceman's methodology [START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation[END_REF][START_REF] Peaceman | Interpretation of Well-Block Pressures in Numerical Reservoir Simulation with Nonsquare Grid Blocks and Anisotropic Permeability[END_REF][START_REF] Chen | Well flow models for various numerical methods[END_REF] using the analytical solution (4.5.1). Since the mesh is uniform it suffices to solve numerically a local 2D problem with four (or more) horizontal faces around a given well node s. The pressure equation is solved using the VAG scheme in the 2D domain composed of the four (or more) faces with the flow rate qω imposed at the well node s and the radial pressure analytical solution (4.5.1) imposed at the boundary nodes. From the pressure numerical solution at the well node P s we deduce the Peaceman radius r 0 defined by (P s -P ω ) = q ω µ 2πk m ρ ln( r 0 r ω ).

This computation leads to the following solution for the numerical Peaceman indices at the limit of a large number of faces around the well node. Let us set dx = H n x , r 0 = 0.14036dx, W 0 = 2π ln( r 0 r ω ) .

Then, denoting by E ω the set of edges of the well, the well index of a given node s ∈ V ω is given by

WI s,ω = ∑ ε∈E ω |s∈ε dx 2 k m W 0 ,
for a matrix node s ∈ V ω \ V Γ , and by

WI s,ω = d f k f + ∑ ε∈E ω |s∈ε dx 2 k m W 0
for the fracture node s ∈ V ω ∩ V Γ . Since there is no coupling between the fracture and the matrix for this radial pressure solution, note that for the fracture node, the Peaceman index is just obtained by summing up the contributions from the fracture and from the matrix.

For both test cases, Dirichlet boundary conditions given by the analytical solution are imposed at the lateral boundaries of Ω and at the boundary of Γ. Homogeneous Neumann boundary conditions are imposed at the top and bottom boundaries of Ω. The well boundary condition is set to either a specified bottom hole pressure P ω or a specified total flow rate q ω . Let us first consider the case of an injection well with the well pressure P ω = 2 × 10 7 Pa and the flow rate per unit well lengh set to q ω = 0.1 kg. s -1 . m -1 . The corresponding analytical solution defined by (4.5.1) with these parameters is shown in Next, we consider the case of a production well with the well pressure P ω = 5 × 10 6 Pa and the well flow rate per unit well lengh set to q ω = 0.1 kg. s -1 . m -1 . We present in Figure 4.5.4 the convergence of the relative L 2 errors between the analytical solution and the numerical solution as a function of the mesh size n x = 10, 20, 40, 80, both in the matrix domain and in the fracture and for both a specified pressure or a specified flow rate. We obtain as previously an order 1 of convergence in all cases.

Non-isothermal single-phase flow

This test case considers a non-isothermal liquid flow with mass density, viscosity, specific internal energy and enthalpy obtained from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF]. The thermal conductivity is fixed to λ = 2 W. m -1 . K -1 and the rock internal energy density is defined by E r (T ) = c r p T with c r p = 16.10 5 J. m -3 . K -1 . Then we show in Figures 4.5.9 and 4.5.10 the pressure in the matrix domain and in the fractures at times t = 4×10 4 days and t = t f = 5•10 6 days. In addition, the pressures at the root nodes of both wells as functions of time are shown in Figure 4.5.11.

Finally we present in Figure 4.5.12 the total computational time in hours for different numbers of MPI processes N p = 4, 8, 16, 32, 64, 128. The scalability behaves as expected for fully implicit time integration and AMG type preconditioners. It is well known that the AMG preconditioner requires a sufficient number of unknowns per MPI process, say 10 5 as typical order of magnitude, to achieve a linear strong scaling. For this mesh size, leading to roughly 8.2 × 10 5 unknowns for the pressure block, the scalability is still not far from linear on up to 64 processes and then degrades more rapidly for N p = 128.

Conclusion

In this annex, the non-isothermal hybrid-dimensional Darcy flow model presented in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF] has been extended to incorporate thermal well models coupled with both the matrix domain and the fracture network. The well data structure is based on a rooted tree defined by a set of edges of the mesh. This allows to represent efficiently both slanted and multi-branch wells taking advantage of the unstructured mesh and of the nodal feature of the VAG discretization. The fluxes connecting the well with the 3D matrix and the 2D fracture network at each node of the well are computed using Peaceman's approach, and the well non-isothermal flow model is based on the usual single unknown approach assuming the hydrostatic and thermodynamic equilibrium inside the well. The parallelization of the well model is performed by definition of own and ghost wells for each process and by extension of the ghost nodes in order to account for the additional connectivity induced by the own and ghost well equations. This allows to assemble the Jacobian and to compute the well pressure drops locally on each process without MPI communication.

The model has been validated using a pressure analytical solution on a simple geometry with one horizontal fracture and one vertical well. The efficiency of the model, both in terms of ability to account for complex geology and in terms of parallel scalability, is demonstrated on a non-isothermal single-phase flow test case using a tetrahedral mesh with roughly 4.9×10 6 cells and including three intersecting fractures, one slanted injection well, and one muti-branch production well. This is an important step toward the application of our simulator to real geothermal test cases in a near future.

Figure 1 -

 1 Figure 1 -Représentation d'un système géothermique idéal.

Figure 2 -

 2 Figure 2 -Illustration et photo (Photothèque du BRGM -c BRGM) du champ géothermique de Bouillante en Guadeloupe.

Figure 3 -

 3 Figure 3 -Représentation (Photothèque du BRGM -c BRGM) du plan de faille 2D considéré généralement dans les cas tests géothermiques de cette thèse.

  and with the Newton's steps dU p (r) i,ν , dU s (r) i,ν defined respectively in (1.5.3) and (1.5.2). If the convergence it not met after r max Newton iterations, the time step is chopped. 1. Computation of the residual R(U (r) D ) and of the Jacobian matrix with elimination of the secondary unknowns. It starts with the choice of the primary and secondary unknowns for each cell ν ∈ M depending only on the active complementarity constraints, choice specified in Tables 1.5.2 and 1.5.1. Then the matrices A sp (r) ν and the vectors B s (r) ν , ν ∈ M defined by

Figure 1 . 6 . 1 -

 161 Figure 1.6.1 -Illustration of the two dimensional geothermal reservoir and of the boundary conditions.

Figure 1 . 6 . 2 -

 162 Figure 1.6.2 -Gas saturation above the threshold of 10 -2 at final time (75 years) obtained with the Dirichlet boundary condition (on the left) and with the homogeneous Neumann boundary condition (on the right).

Fig- ure 1 . 7 . 1 .Figure 1 . 7 . 1 -Figure 1 . 7 . 2 -

 171171172 Figure 1.7.1 -Pressure, temperature and gas saturation stationary solutions.

Figure 2 . 2 . 1 -

 221 Figure 2.2.1 -Example of two dimensional mesh with the partition of the cells between the VAG cells K ∈ M v , the HFV cells K ∈ M h and the interface cells K ∈ M hv . Examples of cell (crosses), node (circles) and face (squares) degrees of freedom of Ξ D in the VAG, HFV and interface regions.

  u(x, y, z) = e cos(x+y+z) , with Dirichlet boundary conditions at ∂ Ω. If not specified differently, the diffusion tensor Λ Λ Λ is the identity matrix. Let us consider the family of uniform Cartesian grids of the domain Ω = (0, 1) 3 of size N × N × N with N = 8, 16, 32, 64. The family of hexahedral meshes is obtained by random perturbation of the Cartesian grids inside the subdomain Ω v = (0.25, 0.75) 3 as exhibited in Figure 2.2.2 for N = 8.

Figure 2 . 2 . 2 -

 222 Figure 2.2.2 -Hexahedral mesh obtained for N = 8 and composed of cubic cells in the HFV subdomain Ω \ Ω v and of randomly perturbated cubic cells in the VAG subdomain Ω v = (0.25, 0.75) 3 .

Figure 2 . 2 . 3 -

 223 Figure 2.2.3 -Convergence in L 2 norm (left) and in L ∞ norm (right) of the potential (above) and of the gradient (below) on the family of hexahedral meshes and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

Figure 2 . 2 . 4 -

 224 Figure 2.2.4 -Hybrid mesh obtained for N = 8 and composed of cubes in the HFV subdomain Ω \ Ω v and of pyramids in the VAG subdomain Ω v = (0.25, 0.75) 3 .

Figure 2 . 2 . 5 -

 225 Figure 2.2.5 -Convergence in L 2 norm (left) and in L ∞ norm (right) of the potential (above) and of the gradient (below) on the family of hybrid meshes and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

Figure 2 . 2 . 6 -

 226 Figure 2.2.6 -Convergence in L 2 norm (left) and in L ∞ norm (right) of the potential (above) and of the gradient (below) on the family of hybrid meshes (hexahedral and pyramidal cells) with anisotropic permeability and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

Figure 2 . 2 . 7 -

 227 Figure 2.2.7 -Uniform Cartesian mesh for N = 8 with the VAG cells in red and the HFV cells in blue.

Figure 2 . 2 . 8 -

 228 Figure 2.2.8 -Convergence in L 2 norm (left) and in L ∞ norm (right) of the potential (above) and of the gradient (below) on the family of Cartesian meshes and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

2. 3 . 2

 32 Combining the VAG and HFV discretizations of two-phase Darcy flows Let us recall from Section 1.3 that F D and F N define a partition of the boundary faces F ext and that the mesh is assumed to be conforming with the boundary condition in the sense that σ ∈F D σ = ∂ Ω D and σ ∈F N σ = ∂ Ω N . Let us define the set of Dirichlet boundary HFV faces by F h D = F D ∩ F h , the set of Dirichlet boundary VAG nodes by

Figure 2 . 3 . 1 -

 231 Figure 2.3.1 -Example of two dimensional mesh with the distribution of the volumes α Ks |K| at each node s ∈ V K of the cell K ∈ M v in the case of a single rock type.

Figure 2 . 3 . 2 -

 232 Figure 2.3.2 -Two dimensional mesh with some of the discrete unknowns in the set U D for the two-phase flow model.

. 9 )

 9 coupled with the flux continuity equations or Neumann boundary condition at HFV faces

. 13 )

 13 taking into account the elimination of the Dirichlet boundary conditions (2.3.11) and of the secondary unknowns {(P l ν , S l ν ), ν ∈ M ∪ V v \ V v D } together with the closure laws (2.3.12).

  of size N × N × N with N = 4, 8, 16, 32. The family of hexahedral meshes is obtained by random perturbation of the Cartesian grids inside the VAG subdomain Ω v = (0.25, 0.75) 3 as exhibited in Figure 2.2.2 for N = 8.

Figure 2 . 3 . 3 -

 233 Figure 2.3.3 -Convergence in space time discrete L 1 norm of the saturation and the non-wetting pressure on the family of hexahedral meshes and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

  Hybrid meshes with hexahedra and pyramidsLet us consider the family of uniform Cartesian grids of the domain Ω = (0, 1)3 of size N × N × N with N = 8, 16, 32. Then our family of hybrid meshes is obtained by cutting in 6 pyramids each cubic cell contained in the VAG subdomain Ω v = (0.5, 1) × (0, 1) 2 as exhibited in Figure 2.3.4 for N = 8.

Figure 2 . 3 . 4 -

 234 Figure 2.3.4 -Hybrid mesh obtained for N = 8 and composed of cubes in the HFV subdomain Ω \ Ω v and of pyramids in the VAG subdomain Ω v = (0.5, 1) × (0, 1) 2 .

Figure 2 . 3 . 5 - 2 -

 2352 Figure 2.3.5 -Convergence in space time discrete L 1 norm of the saturation and the non-wetting pressure on the family of hybrid meshes and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

Figure 2 . 3 . 6 -

 236 Figure 2.3.6 -Convergence in space time discrete L 1 norm of the saturation and the non-wetting pressure on the family of Cartesian meshes with red black coloring and for the VAG, HFV, VAG-HFV and the stabilised VAG-HFV schemes.

  coupled with the Darcy and Fourier flux continuity equations and Neumann boundary conditions at HFV faces

  with p a ∈ R a fixed parameter. An input Dirichlet boundary condition is fixed for the tracer C l a with the following valuesC l a = 0.1 if x ∈ [8000,1000], z = -3000, 0 otherwise, on the input boundary {x ∈ ∂ Ω | q l • n < 0} which depends on the parameter p a . The initial condition consists in pure liquid water C l a = 0.

Figure 2 . 4 . 1 -

 241 Figure 2.4.1 -Air molar fraction at t = 2100 s obtained with the TPFA scheme on a Voronoi mesh (left) and with the VAG scheme on a triangular mesh (right); p a = 0 (top) and p a = 1.1 (bottom).

  Figure 2.4.1 illustrates that both the VAG and TPFA schemes provide a similar numerical diffusion of the tracer front on such meshes.

Figure 2 . 4 . 2 -

 242 Figure 2.4.2 -Illustration of a coarse Cartesian-Voronoi mesh.

Figure 2 . 4 . 3 -

 243 Figure 2.4.3 -Air molar fraction at t = 2100 s obtained on the Voronoi-Cartesian mesh with the TPFA scheme (left), the VAG scheme (middle) and the combined VAG-TPFA scheme (right); p a = 0 (top) and p a = 1.1 (bottom).

Figure 2 . 4 . 3

 243 Figure 2.4.3 shows that the numerical diffusion of the TPFA and VAG schemes depends on the flow direction when using an oriented grid. On the top images the velocity is vertical thus orthogonal or aligned with the faces of the Cartesian mesh, this induces that the TPFA scheme has no lateral numerical diffusion on the subdomain Ω \ Ω v . The top left and right images exhibit this phenomenon. The VAG scheme has

Figure 2 . 4 .Figure 2 . 4 . 4 -T 1 T 1 Figure 2 . 4 . 5 -

 2424411245 Figure 2.4.5 shows the two dimensional vertical cross-section of the Bouillante geothermal reservoir and the conditions applied at the domain boundary. The initial and left side conditions are defined by a pure water liquid phase (S l = 1, C l w = 1, C l a = 0) at hydrostatic pressure and by a linear temperature between the fixed top and bottom temperatures. The bottom boundary is impervious (zero Darcy fluxes) with a fixed temperature of 400 K except in the interval 8000 m ≤ x ≤ 10000 m where a pure water liquid input flux of -3 • 10 -2 mol. m -2 . s -1 at 550 K is imposed. The right side of the

S g 0. 72 ,

 72 S l 0.28, P g = 1 atm, P l -153671 Pa,

Figure 2 . 4 . 6 -

 246 Figure 2.4.6 -Illustration of the Cartesian-triangular mesh.

Figures 2 . 4 .

 24 Figures 2.4.7 to 2.4.12 show the temperature (on the left) and the gas saturation (on the right) at final time for the different combinations of meshes and schemes, Figure 2.4.7 being the reference. All the numerical results are very similar and as expected no visible artefact can be seen at the interface z = -1500 m for the coupled VAG-TPFA scheme.

Figure 2 . 4 . 7 -

 247 Figure 2.4.7 -Reference temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the refined Cartesian-triangle mesh combined with the TPFA-VAG scheme.

Figure 2 . 4 . 8 -

 248 Figure 2.4.8 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the VAG scheme on the triangular mesh.

Figure 2 . 4 . 9 -

 249 Figure 2.4.9 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the TPFA scheme on the Voronoi mesh.

Figure 2 . 4 .

 24 Figure 2.4.10 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the TPFA scheme on the Cartesian-Voronoi mesh.

Figure 2 .

 2 Figure 2.4.11 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the TPFA-VAG scheme on the Cartesian-triangular mesh.

Figure 2 . 4 .

 24 Figure 2.4.12 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the VAG scheme on the Cartesian-triangular mesh.

  .

Figure 2 . 4 . 13 -

 2413 Figure 2.4.13 -Ratio between the gas volume and the total pore volume as a function of time for the various discretizations both with log time scale (bottom) and standard time scale (top).

Figure 2 . 4 .

 24 Figure 2.4.13 exhibits the ratio between the gas volume and the total pore volume as a function of time (both with log and standard time scales) which is characteristic of the solution close to the top boundary. The graphic highlights two phenomena. First the desaturation of the vadose zone induced by the top Dirichlet boundary condition for z > 0.Then, around t = 70000 days, the plots exhibit the vaporization of the water component occurring when the high temperature front reaches the low pressure zone close to the top boundary. The desaturated zone is thin compared to the height of the reservoir and strongly depends on the size of the top cells. This explains the small discrepancies observed between the plots obtained with the various schemes which have been checked to converge to the reference solution on refined meshes.

( 3 . 2 . 4 )

 324 From (3.2.3) and (3.2.2), it results that (w e + λ t ∇T ) • n ∼ h g w (P, T )ζ g (P, T,C)u • n, allowing to use the following approximation of w e • n w e • n = ζ g (P, T,C)h g w (P, T )u • nλ t ∇T • n. (3.2.5) Two-point flux approximation The boundary conditions are obtained by two-point flux approximations of the component normal fluxes w i • n, i ∈ C and of the energy normal flux w e • n. These two-point fluxes are computed between the interface on the atmosphere side and the far field atmospheric conditions at a given reference height. The far field atmospheric conditions are defined by the constant gas molar fractions C g,atm ∞

Figure 3 = h f f 20 mFigure 3 . 2 . 3 -

 320323 Figure 3.2.1 -Computational domain of the coupled Darcy and full-dimensional freeflow models with some precisions about the boundary conditions.

  The numerical performances of the Darcy flow model coupled with the soil-atmosphere boundary condition are assessed on the following meshes N y = 30 with N e = 10, r = 1.58, ∆y r = 1.43 10 -2 , N y = 60 with N e = 20, r = 1.28, ∆y r = 1.02 10 -2 , N y = 90 with N e = 30, r = 1.19, ∆y r = 8.40 10 -3 .

3 -

 3 Number of successful time steps, of time step chops, average number of Newton-min iterations per successful time step and CPU time for the three Newton-min methods obtained with N y = 30, 60, 90 and T 0 pm = 333 K.

Figure 3 . 2 . 4 -

 324 Figure 3.2.4 -Mean relative humidity, mean temperature (in K) and mean molar flow rate of the water component (in mol. m -2 . s -1 ) at the interface Γ atm as functions of time (in years) for both models with T 0 pm = 303 K and N y = 90.

Figure 3 . 2 . 5 -

 325 Figure 3.2.5 -Mean relative humidity, mean temperature (in K) and mean molar flow rate of the water component (in mol. m -2 . s -1 ) at the interface Γ atm as functions of time (in years) for both models with T 0 pm = 333 K and N y = 90.

Figure 3 . 3 . 1 -

 331 Figure 3.3.1 -Gas and liquid pressures (in MPa), temperature (in K) and gas saturation at the top boundary and at the top cell as functions of time (in years).

Figure 3 . 3 . 2 -

 332 Figure 3.3.2 -Relative humidity and gas and liquid molar flow rates (in mol. m -2 . s -1 ) at the top boundary as functions of time (in years).

Figure 3 . 3 . 3 - 2 -

 3332 Figure 3.3.3 -Input molar flow rate q w,in (t) at the bottom boundary as a function of time.

Figure 3 . 3 . 4 -

 334 Figure 3.3.4 -Gas and liquid pressures (in MPa), temperature (in K) and gas saturation as functions of time both at the top boundary and at the top cell, obtained for the timedependent input molar flow rate.

  .4 and 3.3.5 show the time evolution of the phase pressures, temperature and gas saturation both at the top cell and at the top boundary, and the relative humidity and the phase molar flow rate at the interface. Figure3.3.6 exhibits the solutions obtained at the end of each period at times t = 300, 900, 1200 years. Note that the blue curve in Figure3.3.6 also corresponds to the solution obtained at final time in the previous test case as the input flow rate is the same and the stationary solution is reached in both cases.

Figure 3 . 3 . 5 -

 335 Figure 3.3.5 -Relative humidity and gas and liquid molar flow rates (in mol. m -2 . s -1 ) at the top boundary as functions of time, obtained for the time-dependent input molar flow rate.

Figure 3 . 3 . 6 -

 336 Figure 3.3.6 -Gas and liquid pressures (in MPa), temperature (in K) and gas saturation as functions of depth (in m) and air molar fraction in the gas phase obtained at times t = 300 years, 900 years and 1200 years for the time-dependent input molar flow rate.

Figure 3 . 3 . 7 -

 337 Figure 3.3.7 -Capillary pressure (in Pa) with a non-zero entry pressure as a function of the liquid saturation.

N

Figure 3 . 3 . 8 -

 338 Figure 3.3.8 -Relative humidity and gas and liquid molar flow rates (in mol. m -2 . s -1 ) at the top boundary as functions of time with entry capillary pressure.

Figure 3 . 3 . 9 -

 339 Figure 3.3.9 -Gas and liquid pressures (in MPa), temperature (in K) and gas saturation at the top boundary and at the top cell as functions of time with entry capillary pressure.

  temperature with 278 K at the sea level and 400 K at the bottom, P l hydrostatic,S l = 1, C l W =1Dirichlet: Linear temperature with 300 K at the surface of the sea and 278 K at 100 m deep, P l hydrostatic, S l = 1,

Figure 3 . 3 . 10 -

 3310 Figure 3.3.10 -Illustration of the two dimensional domain and its boundary conditions.

Figure 3 .

 3 Figure 3.3.11 -Coarse mesh (on the top) of the 2D cut of the Bouillante geothermal reservoir and zoom of the top right zone of the coarse mesh (in the bottom left) and of the fine mesh (on the bottom right).

S g 0. 72 ,

 72 S l 0.28, P g = 1 atm, P l -153671 Pa, the convergence behaviour of the Newton-min algorithms with the Dirichlet boundary condition. The efficiency of the Newton-min algorithms is discussed at the end of this section to compare with the following numerical tests.

5 -

 5 Number of successful time steps, of time step chops, average number of Newton iterations per successful time step and CPU time obtained for the different versions of the Newton-min algorithm for both meshes with the Dirichlet top boundary condition.

Figure 3 .

 3 Figure 3.3.12 -Temperature (in Celsius) and gas saturation above the threshold of 10 -2 at final time obtained with the fine mesh and the Dirichlet top boundary conditions.

Figure 3 . 3 .

 33 Figure 3.3.12 exhibits the temperature and the gas saturation in the reservoir at final time and Figure 3.3.13 shows the main physical variables at different times along the top cells. The top cells are chosen rather than the top boundary since the top boundary variables are fixed by the Dirichlet conditions. The degree of freedom of the top cell is the center of the cell which is located approximately 12 m below the top boundary. The hot liquid plume rises by buoyancy and viscous forces from the bottom injection boundary to the top of the reservoir. During the simulation, convective thermal instabilities are initially observed, then the hot liquid plume is stabilized and reaches a stationary state in between the cold water intrusion from the rainy mountain boundary on the right side of the reservoir and the sea water intrusion on the left side of the reservoir. The desaturation deepens by gravity at the right top side of the reservoir down to a stationary state at the end of the simulation. A small amount of water vapour can also be observed at the top of the hot liquid plume close to the surface due to the high temperature combined with the low pressure. Convective thermal instabilities are still observed at final time in Figure 3.3.12 corresponding to water intrusion from the left side boundary. From Figure 3.3.12, let us remark that the hot liquid plume goes out of the reservoir at the top boundary on both sides of the shoreline approximately in the interval 3575 m ≤ x ≤ 5550 m. Inside this interval, we can observe a temperature drop in the interval 4800 m < x < 5200 m. It is explained by the vaporisation of the liquid phase which cools down the surface neighbourhood.

Figure 3 . 3 . 13 -

 3313 Figure 3.3.13 -Gas and liquid pressures (in MPa), temperature (in K), gas saturation and air molar fraction in the gas phase weighted by the gas saturation obtained at times t = 6 days, 1 year and 60, 100, 300, 1000 years along the top cells using the fine mesh and the Dirichlet top boundary condition.

Figure 3 . 3 .

 33 15 plots the main physical variables along the top boundary while Figure 3.3.16 plots the same variables along the top cells to be compared with the above Dirichlet test case. Coarse mesh Fine mesh Basic Newton-min × × Newton-min 567/1/4.50/201 593/11/4.93/1025 with projection and non-linear phase appearance criterion 577/1/4.40/207 614/15/4.74/1074 Newton-min 577/1/4.41/203 615/15/4.71/1071 with projection and thermodynamic equilibrium Table 3.3.6 -Number of successful time steps, of time step chops, average number of Newton iterations per successful time step and CPU time obtained for the different versions of the Newton-min algorithm for both meshes and with the evaporation-outflow boundary condition.

Figure 3 .

 3 Figure 3.3.14 -Temperature (in Celsius) and gas saturation above the threshold of 10 -2 at final time (1000 years) obtained with the fine mesh and the evaporation-outflow boundary condition.

Figure 3 .

 3 Figure 3.3.14, when compared with Figure 3.3.12, shows that at final time the evaporation-outflow boundary condition shifts the high temperature zone to the left, from (3575 m, 5550 m) at the top boundary for the Dirichlet boundary condition to (2950 m, 4575 m) for the evaporation-outflow boundary condition.This shift can be explained by the lower liquid pressure P l = P atm -P c (1) provided at the top boundary by the gas Dirichlet condition than the one provided by the evaporation-outflow boundary condition with in particular P l = P g = P atm between say x = 5000 m and x = 6000 m as a consequence of the liquid outflow. It also results that the temperature drop near the shoreline does no longer appear. The gas saturation remains null below the seabed and the desaturated zone is shifted to x > 5000 m (see alsoFigures 3.3.13 and 3.3.16). It can also be noticed that the desaturated zone is deeper with the evaporation-outflow than with the Dirichlet boundary condition.

Figure 3 .

 3 Figure 3.3.15 -Gas and liquid pressures (in MPa), temperature (in K) and gas saturation obtained at times t = 1 day, 1 year and 60, 100, 300, 1000 years at the top boundary using the fine mesh and the evaporation-outflow boundary condition.

Figure 3 . 3 . 16 -

 3316 Figure 3.3.16 -Gas and liquid pressures (in MPa), temperature (in K) and gas saturation obtained at times t = 1 day, 1 year and 60, 100, 300, 1000 years at the top cells using the fine mesh and the evaporation-outflow boundary condition.

, with m s = 58 •

 58 10 -3 , m w = 18 • 10 -3 , m a = 29 • 10 -3 kg. mol -1 . The air and water fugacities in both phases are still given by (3.3.3) and the fugacities of the salt component are defined byf g s = C g s P g , f l s = C l s H s ,with a very low Henry constant H s = 10 -1 Pa in order to keep the vaporization of the salt component in the gas phase negligible.

Figures 3. 3

 3

  .18 and 3.3.19 show the physical variables at the top boundary and along the top cells.

  /3.99/363 669/38/4.43/2017 with projection and non-linear phase appearance criterion 648/25/3.85/391 660/35/4.38/1941 Newton-min 642/24/3.87/398 629/25/4.53/1814 with projection and thermodynamic equilibrium Table 3.3.7 -Number of successful time steps, of time step chops, average number of Newton iterations per successful time step and CPU time obtained with the different versions of the Newton-min algorithm for both meshes and the air-water-salt test case.

Figure 3 .

 3 Figure 3.3.17 -Temperature (in Celsius), gas saturation above the threshold of 10 -2 and salinity of the liquid phase (in g. kg -1 ) at final time (1000 years) obtained with the fine mesh and the air-water-salt test case.

Figure 3 . 3 .

 33 18 at the top boundary due to the liquid vaporization. It goes up to 0.35 at time t = 100 years and then decreases to 0.1 at final time. It could induce the precipitation of the salt not taken into account in this model.

Figure 3 . 3 . 18 -

 3318 Figure 3.3.18 -Gas and liquid pressures (in MPa), temperature (in K), gas saturation and salt molar fraction in the liquid phase weighted by the liquid saturation at times t = 1 day, 1 year and 60, 100, 300, 1000 years at the top boundary, obtained with the fine mesh and the air-water-salt test case.

Figure 3 . 3 . 19 -

 3319 Figure 3.3.19 -Gas and liquid pressures (in MPa), temperature (in K), gas saturation and salt molar fraction in the liquid phase weighted by the liquid saturation at times t = 1 day, 1 year and 60, 100, 300, 1000 years along the top cells obtained with the fine mesh and the air-water-salt test case.

  1500 m}, and Cartesian cells on the bottom subdomain Ω \ Ω v (as illustrated in Figure 2.4.2). The mesh is build to satisfy the admissibility condition of TPFA schemes in the whole domain. The second one combines Cartesian cells on the bottom subdomain Ω \ Ω v with triangular cells on the upper subdomain Ω v . The mesh is build to satisfy the admissibility condition of TPFA schemes at both inner and boundary faces of the Cartesian domain. Both meshes have roughly 9000 cells in each subdomain.

Figures 3 .

 3 Figures 3.4.3 and 3.4.4 show the temperature and the gas saturation on the two dimensional domain at final time when the atmospheric boundary condition is applied, Figure 3.4.3 with the TPFA scheme on the Cartesian-Voronoi mesh and Figure 3.4.4 with the VAG-TPFA scheme on the Cartesian-triangular mesh.Figure 3.4.3 should be compared with Figure 2.4.10 to observe the impact of the advanced atmospheric boundary condition on the behaviour of the reservoir, this is why it has been recalled here (Figure 3.4.2).Figure 3.4.5 exhibits the comparison of both schemes over the mean temperature (in the whole domain and at the top boundary) and the mean relative humidity at the top boundary where the soil-atmosphere boundary condition is applied (z > 0 m) as functions of time (in log scale).

Figure 3 .

 3 Figures 3.4.3 and 3.4.4 show the temperature and the gas saturation on the two dimensional domain at final time when the atmospheric boundary condition is applied, Figure 3.4.3 with the TPFA scheme on the Cartesian-Voronoi mesh and Figure 3.4.4 with the VAG-TPFA scheme on the Cartesian-triangular mesh.Figure 3.4.3 should be compared with Figure 2.4.10 to observe the impact of the advanced atmospheric boundary condition on the behaviour of the reservoir, this is why it has been recalled here (Figure 3.4.2).Figure 3.4.5 exhibits the comparison of both schemes over the mean temperature (in the whole domain and at the top boundary) and the mean relative humidity at the top boundary where the soil-atmosphere boundary condition is applied (z > 0 m) as functions of time (in log scale).

Figure 3 .

 3 Figures 3.4.3 and 3.4.4 show the temperature and the gas saturation on the two dimensional domain at final time when the atmospheric boundary condition is applied, Figure 3.4.3 with the TPFA scheme on the Cartesian-Voronoi mesh and Figure 3.4.4 with the VAG-TPFA scheme on the Cartesian-triangular mesh.Figure 3.4.3 should be compared with Figure 2.4.10 to observe the impact of the advanced atmospheric boundary condition on the behaviour of the reservoir, this is why it has been recalled here (Figure 3.4.2).Figure 3.4.5 exhibits the comparison of both schemes over the mean temperature (in the whole domain and at the top boundary) and the mean relative humidity at the top boundary where the soil-atmosphere boundary condition is applied (z > 0 m) as functions of time (in log scale).

1 T 1 Figure 3 . 4 . 1 - 1 -

 113411 Figure 3.4.1 -Illustration of the two dimensional geothermal reservoir and the conditions applied at its boundary when using hybrid meshes.

Figure 3 . 4 . 2 -

 342 Figure 3.4.2 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the TPFA scheme on the Cartesian-Voronoi mesh with the Dirichlet top boundary condition.

Figure 3 . 4 . 3 -

 343 Figure 3.4.3 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the TPFA scheme on the Cartesian-Voronoi mesh with the atmospheric boundary condition.

Figure 3 . 4 . 4 -

 344 Figure 3.4.4 -Temperature (in K) and gas saturation above the threshold of 10 -2 at final time (650 years) obtained with the VAG-TPFA scheme on the Cartesian-triangular mesh with the atmospheric boundary condition.

Figure 3 . 4 . 5 -

 345 Figure 3.4.5 -Comparison of the mean relative humidity at the top boundary where the soil-atmosphere boundary condition is applied, and of the mean temperature (in K) in the whole domain, at the top boundary and at the top cell as functions of time (in days).

  .4.2 as the Dirichlet boundary condition imposes S g = 1 at the top faces in this part of the domain. The curves of Figure 3.4.5 and the comparison of Figures 3.4.3 and 3.4.

  F int boundary of the domain (two dimensional open set) ∂ Ω set of boundary faces F ext two dimensional open set with Dirichlet boundary condition ∂ Ω D set of Dirichlet boundary faces F D two dimensional open set with Neumann boundary condition ∂ Ω N set of Neumann boundary faces F N two dimensional open set with atmospheric boundary condition Γ atm set of atmospheric boundary faces F Γ atm set of vertices V set of the vertices of the cell K ∈ M V K set of vertices of the face σ ∈ F V σ set of boundary vertices V ext set of edges E set of edges of the face σ ∈ F E σ triangle defined by the face center x σ and the edge e ∈ E σ T σ ,e tetrahedron joining the cell center x K to the triangle T σ ,e T K,σ ,e set of degrees of freedom Ξ D subset of d.o.f. located at the boundary of a cell K ∈ M Ξ K

  Figure 4.2.1 illustrates a two dimensional domain with fractures. The

Figure 4 . 2 . 1 -

 421 Figure 4.2.1 -Example of a two dimensional domain with three intersecting fractures Γ 1 , Γ 2 , Γ 3 .

  For the matrix domain, Dirichlet (subscript D) and Neumann (subscript N) boundary conditions are imposed on the two dimensional open sets ∂ Ω D and ∂ Ω N respectively where ∂ Ω D ∩ ∂ Ω N = / 0, ∂ Ω = ∂ Ω D ∪ ∂ Ω N . Similarly for the fracture network, the Dirichlet and Neumann boundary conditions are imposed on the one dimensional open sets ∂ Γ D and ∂ Γ N respectively where ∂

Figure 4 . 3 . 1 -

 431 Figure 4.3.1 -For a cell K and a fracture face σ (in bold), examples of VAG degrees of freedom u K , u s , u σ , u s and VAG fluxes F K,σ , F Ks , F Ks , F σ s .

Figure 4 . 3 . 2 -

 432 Figure 4.3.2 -Example of control volumes at cells, fracture face, and nodes, in the case of two cells K and L separated by one fracture face σ (the width of the fracture is enlarged in this figure). The control volumes are chosen to avoid mixing fracture and matrix rocktypes.

ωs

  if and only if the unique path from the root s root ω to s passes through s.

Figure 4 .s 2 . 4 Figure 4 . 3 . 3 -

 424433 Figure 4.3.3 -Illustration of a multi-branch well with its root node and the partial ordering of the set of vertices.

( 4 . 3 . 3 )

 433 For all s 1 s 2 = ε ∈ E ω , let us set κ ε,s = 1 if s = s 2 and κ ε,s = -1 if s = s 1 . The well equations account for the mass and energy conservations at each node of the well. Let E s denote the set of edges sharing the node s, then for all s ∈ V ω we obtain the equations

  3.1)-(4.3.2) with β in j ω = 0 and β prod ω = 1 and depend only on the implicit unknowns X n s and P n ωq m,s,ω (X n s , P n ω ) = ρ(X n s ) µ(X n s )

2 F 2 F

 22 and similarly by P D and T D the sets of reservoir pressures and temperatures. The set of well bottom hole pressures is denoted byP W = {P ω , ω ∈ W }.The Darcy fluxes taking into account the gravity term are defined byq Kν (U D ) = F Kν (P D ) + ρ(U K )+ρ(U ν ) Kν (G D ), ν ∈ Ξ K , K ∈ M , q σ s (U D ) = F σ s (P D ) + ρ(U σ )+ρ(U s ) σ s (G D ), s ∈ V σ , σ ∈ F Γ ,(4.3.8)

( 4 .

 4 3.9) in each fracture face σ ∈ F Γ R i,σ (U n D ) = A i,σ (U n σ ) -A i,σ (U n-1 σ ) ∆t n + ∑ s∈V σ q i,σ ,s (U n D ) + ∑ K∈M σ -q i,K,σ (U n D ) = 0, (4.3.10) and at each node s ∈ V \ V D R i,s (U n D , P n W ) = A i,s (U n s ) -A i,s (U n-1 s ) ∆t n + ∑ σ ∈F Γ,s -q i,σ ,s (U n D ) + ∑ K∈M s -q i,K,s (U n D ) + ∑ ω∈W |s∈V ω q i,s,ω (U n s , P n ω ) = 0. (4.3.11)It is coupled with the well equations for the injection wellsω ∈ W in j R ω (U n D , P n W ) =min( ∑ s∈V ω q m,s,ω (U n s , P n ω )qω , Pω -P n ω ) = 0,(4.3.12)and for the production wellsω ∈ W prod R ω (U n D , P n W ) = min( qω -∑ s∈V ω q m,s,ω (U n s , P n ω ), P n ω -Pω ) = 0,(4.3.13)reformulating respectively (4.3.6) and (4.3.7).The system is closed with the Dirichlet boundary conditionsU n s = U s,D ,for all s ∈ V D , where U s,D = (P s,D , T s,D ) are the imposed pressure and temperature at node s.

3 . 14 )

 314 is assembled locally on each process p = 1, ..., N p resulting in the following rectangular linear system

  (2#V p ) , U p f ∈ R (2#F p Γ ) , U p c ∈ R (2#M p )denote the vectors of pressure and temperature unknowns at nodes s ∈ V p , fracture faces σ ∈ F p Γ , and cells K ∈ M p . The vectorU p w ∈ R (#W p ) is the vector of well reference pressures. Likewise, b p s ∈ R (2#V p ) and b p f ∈ R (2#F p Γ )are the right hand side vectors of own nodes and fracture faces equations, b p c ∈ R (2#M p ) is the right hand side vector of own and ghost cells equations, and b p w ∈ R (#W p ) is the right hand side vector of own wells equations. The matrix J p cc is a non singular block diagonal matrix with 2 × 2 blocks, and the cell unknowns can be easily eliminated without fill-in leading to the following Schur complement system

4. 5 . 1

 51 Well model validation: numerical convergence for an analytical solution with one horizontal fracture and a vertical well We consider the domain Ω = (-H, H) 3 , H = 1000 m, with one horizontal fracture Γ = {(x, y, z) ∈ Ω | z = 0} of width d f = 0.5 m and one vertical well of radius r ω = 0.1 m and defined by the line {(x, y, z) ∈ Ω | x = y = 0}. Both the matrix and the fracture are isotropic and homogeneous with permeability Λ Λ Λ m = k m I, k m = 10 -14 m 2 in the matrix and with tangential permeability Λ Λ Λ f = k f I, k f = 10 -11 m 2 in the fracture. For such a simple geometry, an analytical solution of the isothermal stationary linear Darcy equation is defined by the radial pressure P(r) = P ω + q ω µ 2πk m ρ ln( r r ω ), r = x 2 + y 2 > 0, (x, y, z) ∈ Ω, (4.5.1)

Figure 4 .

 4 5.1.

  Figure 4.5.2 shows, for both a specified pressure or flow rate, the convergence of the relative L 2 errors between the analytical solution and the numerical solution both in the matrix domain and in the fracture as a function of the mesh size n x = 10, 20, 40, 80. We obtain an order 1 of convergence in all cases.

Figure 4 . 5 . 1 -

 451 Figure 4.5.1 -Analytical solution with the injection well in the matrix domain (left) and in the fracture (right).

  (a) Imposed pressure. (b) Imposed flow rate.

Figure 4 . 5 . 2 -

 452 Figure 4.5.2 -Relative L 2 errors between the analytical solution and the numerical solution with one injection well in the matrix domain and in the fracture, where the pressure is imposed (A) or the flow rate is imposed (B).

Figure 4 .

 4 5.3 shows the analytical solution defined by (4.5.1) with these parameters.

Figure 4 . 5 . 3 -

 453 Figure 4.5.3 -Analytical solution with the production well in the matrix domain (left) and in the fracture (right).

Figure 4 . 5 . 7 -

 457 Figure 4.5.7 -Left: temperature in the matrix domain and in the fractures at t = 5 × 10 6 days where a clip view on plane {y = 1000} is used in the matrix domain. Right: temperature in the fractures at t = 5 × 10 6 days. The wells are drawn as black lines in both figures.

Figure 4 . 5 . 8 -

 458 Figure 4.5.8 -Temperature at the root node of the production well as a function of time.

Figure 4 . 5 . 9 -

 459 Figure 4.5.9 -Left: pressure in the matrix domain and in the fractures at t = 4 × 10 4 days where a clip view on plane {y = 1000} is used in the matrix domain. Right: pressure in the fractures at t = 4 × 10 4 days where the wells are drawn with black lines.

Figure 4 .

 4 Figure 4.5.10 -Left: pressure in the matrix domain and in the fractures at t = 5 × 10 6 days where a clip view on plane {y = 1000} is used in the matrix domain. Right: pressure in the fractures at t = 5 × 10 6 days where the wells are drawn with black lines.

Figure 4 . 5 . 11 -Figure 4 . 5 . 12 -

 45114512 Figure 4.5.11 -Pressures at the root nodes of both wells as functions of time.

  us first consider Dirichlet and Neumann boundary conditions, then (in Chapter 3) will be introduced an atmospheric boundary condition. Let us denote by ∂ Ω D and ∂ Ω N the two dimensional open sets where the Dirichlet and Neumann boundary conditions are imposed, with ∂ Ω D ∩∂ Ω N = / 0 and ∂ Ω D ∪∂ Ω N = ∂ Ω. Let us assume that the set of boundary faces is conforming with the boundary condition, i.e. there exist two subsets of the boundary faces F D and F N where the Dirichlet and Neumann conditions are applied, with F D ∩ F N = / 0 and F D ∪ F N = F ext . The set of interior faces F int is defined such that F int = F \ F ext . Let us remark that M σ = {K, L} for all σ ∈ F int whereas M σ = {K} for all σ ∈ F ext .

	1.4 TPFA discretization of the non-isothermal
	compositional two-phase Darcy flow model
	For the two formulations, the systems of equations ((1.2.11)-(1.2.12)-(1.2.13)) and
	((1.2.15)-(1.2.16)-(1.2.17)) are discretized using a finite volume discretization in space
	with a Two-Point Flux Approximation (TPFA) of the Darcy and Fourier fluxes

Table 1 .

 1 .6.2.

	Formulation	Boundary Condition N t f N chops N newton CPU(s)
	T-PSC	Dirichlet Neumann	63 162	0 40	4.00 7.48	566 4004
	T-PSF	Dirichlet Neumann	63 220	0 56	4.89 6.94	702 5345
	T-PSF with non-linear	Dirichlet	63	0	4.00	578
	update of the fugacities	Neumann	146	34	7.99	3790
	Formulation	Boundary Condition N t f N chops N newton CPU(s)
	T-PSC	Dirichlet Neumann	14 152	0 39	6.29 7.77	200 3965
	T-PSF	Dirichlet Neumann	17 199	2 54	7.12 7.38	347 5241
	T-PSF with non-linear	Dirichlet	14	0	6.36	207
	update of the fugacities	Neumann	165	44	7.38	4349

6.1 -Number of successful time steps, of time step chops, average number of Newton iterations per successful time step and CPU time obtained with the two different lateral boundary conditions and with both formulations.

Table 1 .

 1 6.2 -Number of successful time steps, of time step chops, average number of Newton iterations per successful time step and CPU time obtained with larger time steps.

  is cellwise constant, only the d-dimensional measures of the sets ω Kν , ν ∈ Ξ K are used. This second gradient reconstruction (2.2.13) based on interpolation and stabilisation can be applied as a standalone discretization in all cells provided that a partition of the faces σ ∈ F between those with a face unknown u σ and those with node unknowns u

	Remark 2.2.1

s , s ∈ V σ is given. The situation is different for the first gradient reconstruction (2.2.12) based only on interpolation which leads to a stable discretization thanks to the neighbouring VAG cells (see Subsection 2.2.3). For example, if all faces are with node unknowns, it is clear that the first construction, if applied to all cells, will lead to an unstable discretization while the second construction reduces to the VAG discretization presented in

[START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF]

which differs from the VAG gradient reconstruction defined by (2.2.10).

  2.2 Let us consider the gradient discretization D = X 0 D , ∇ D , Π D

	defined by (2.2.7), (2.2.8), (2.2.9) with the gradient reconstructions given either by
	(2.2.10)-(2.2.11)-(2.2.12) or by (2.2.10)-(2.2.11)-(2.2.13). Then, there exists C D de-
	pending only on θ T such that

  .2.[START_REF] Brenner | Improving newton's method performance by parametrization: The case of the richards equation[END_REF] holds with C ϕ depending only on θ T and ϕ.Proof for the first gradient reconstruction: the consistency estimate (2.2.23) is a classical result already established in the case of the VAG discretization (see[START_REF] Brenner | Convergence of a Vertex centered Discretization of Two-Phase Darcy flows on General Meshes[END_REF] Lemma 3.7 and 3.4) and of the HFV discretization (see[START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF] Lemma 4.3). The extension to our case results from the exactness of the cell gradients on affine functions as well as from the definition of θ

T (2.2.3). Let us now prove the coercivity (2.2.22). Let us set for all u D ∈ X D , Π M u D (x) = u K for all x ∈ K and K ∈ M . It results from the discrete Sobolev embeddings proved in

[START_REF] Eymard | Discretisation of heterogeneous and anisotropic diffusion problems on general non-conforming meshes. SUSHI: a scheme using stabilisation and hybrid interfaces[END_REF]

Lemma 5.3, that there exists C 1 depending only on θ T such that for all u

  .2.27) Combining (2.2.25)-(2.2.26)-(2.2.27), it results that the coercivity holds for the cellwise constant reconstruction in the sense that there exists C 4 depending only on θ T such that for all u D

  obtained thanks to the neighbouring VAG cell L.

	Gathering (2.2.30)-(2.2.31)-(2.2.32) concludes the proof of (2.2.29) and hence of
	the coercivity (2.2.22).
	Let us first prove the limit conformity estimate (2.2.24) for the gradient discretiza-
	tion	X 0

D , ∇ D , Π D using the function reconstruction Π D defined by

  by (2.2.7), (2.2.8), (2.2.9) with the gradient reconstructions given either by (2.2.10)-(2.2.11)-(2.2.12) or by (2.2.10)-(2.2.11)-(2.2.

Table 2 .

 2 3.1 -Numerical behaviour of the VAG, HFV and VAG-HFV schemes for the two-phase Darcy flow on the finest Hexahedral mesh obtained for N = 32.

		N red	NZ red N newton N gmres CPU(s)
	hfv	45824 411392	3.06	7.4	670
	vag	35937 877215	3.05	7.4	1060
	vag-hfv	33585 322961	3.0	6.9	553
	vag-hfv stab 38385 427985	3.06	9.3	1048

Table 2 . 3

 23

		N red	NZ red	N newton N gmres CPU(s)
	hfv	32768 223232	2.92	5.3	398
	vag	35937 877215	3.04	7.2	1020
	vag-hfv	52317 1151623	3.06	6.4	927
	vag-hfv stab 55389 1196415	3.06	7.0	1249

.3 -Numerical behaviour of the VAG, HFV and VAG-HFV schemes for the two-phase Darcy flow on the finest Cartesian mesh obtained for N = 32.

  the local closure laws (2.4.8) w.r.t. to a set of #C + 4 secondary unknowns U S ν ⊂ U ν chosen in such a way that the differential of the closure laws w.r.t. U S ν is non singular. A classical choice of the set of primary unknowns U

Table 2 .

 2 4.2 -Number of d.o.f. after elimination of the VAG cells and TPFA faces, number of 3 by 3 non-zero elements in the matrix after elimination of the VAG cells and TPFA faces, number of successful time steps, number of time step chops, average number of Newton-min iterations per time step and CPU time obtained with the different meshes and schemes.

	scheme	mesh	N red	NZ red	N t f	N chops N newton CPU(s)
	VAG	triangular 9616	65822 1726	9	4.76	10178
	TPFA	Voronoi 18828 128303 1709	6	4.12	15331
	TPFA	Cart-Voro 18960 111427 1713	7	4.32	15224
	VAG-TPFA Cart-trian 14702 82984 1933	25	3.95	10936
	VAG	Cart-trian 14440 117355 1983	29	4.23	25594

Table 3 .

 3 N y 2.2 -Number of successful time steps, of time step chops, average number of Newton-min iterations per successful time step and CPU time for the three Newton-min methods obtained with N y = 30, 60, 90 and T 0 pm = 303 K.

		100 × 30	100 × 60	100 × 90
	Basic Newton-min	×	×	×
	Newton-min with projection	157/0/3.71/147 157/1/3.97/552	×
	and non-linear phase appearance criterion	157/0/3.44/147 157/0/3.80/502 157/0/3.92/1012
	Newton-min
	with projection and	157/0/3.46/140 157/0/3.78/487 157/0/3.97/988
	thermodynamic equilibrium
	N x × N y	100 × 30	100 × 60	100 × 90
	Basic Newton-min	×	×	×
	Newton-min with projection	157/0/3.52/142 157/0/3.90/497 180/2/4.09/1360
	and non-linear phase appearance criterion	157/0/3.44/145 157/0/3.80/467 157/0/3.91/999
	Newton-min
	with projection and	157/0/3.39/138 157/0/3.73/523 157/0/3.90/972
	thermodynamic equilibrium

Table 3 .

 3 2.

Table 3 .

 3 3.1 -Number of successful time steps N t f , of time step chops N chops

	min	738	11	2.03	138
	Newton-min with projection	718	4	1.88	117
	and non-linear phase appearance criterion 718	4	1.88	119
	Newton-min
	with projection and	714	5	1.88	116
	thermodynamic equilibrium

Table 3 .

 3 t f N chops N newton CPU(s) 3.3 -Number of successful time steps N t f , of time step chops N chops , average number of Newton iterations per successful time step N newton and CPU time for the different versions of the Newton-min algorithm using the scaled capillary pressure as parameter τ.

	Basic Newton-min	738	11	2.02	135
	Newton-min with projection	718	4	1.88	115
	and non-linear phase appearance criterion 718	4	1.88	116
	Newton-min
	with projection and	714	5	1.88	114
	thermodynamic equilibrium
		N t f N chops N newton CPU(s)
	Basic Newton-min	727	4	1.95	117
	Newton-min with projection	716	2	1.91	113
	and non-linear phase appearance criterion 719	1	1.94	115
	Newton-min
	with projection and	716	2	1.91	109
	thermodynamic equilibrium

Table 3 .

 3 3.4 -Number of successful time steps N t f , of time step chops N chops

Table 3 .

 3 5.1 -Notations of the domain and mesh.

	Entity	Notation	Unit
	set of phases	P
	set of components	C
	phase saturation	S α
	phase pressure	P α	Pa
	capillary pressure	P c	Pa
	local equilibrium temperature	T	K
	phase molar fractions phase fugacity	C α = (C α i ) i∈C f α = ( f α i ) i∈C	Pa
	Henry constant	H i , i = {a, s}	Pa
	number of moles of i ∈ C per unit pore volume	n i	mol. m -3
	gravitational acceleration vector	g	m. s -2
	phase molar density	ζ α	mol. m -3
	phase mass density	ρ α	kg. m -3
	molar mass of i ∈ C	m i	kg. mol -1
	phase dynamic viscosity	µ α	Pa. s
	bulk thermal conductivity of the fluid and rock mixture	λ	W. m -1 . K -1
	turbulent thermal conductivity	λ t	W. m -1 . K -1
	turbulent viscosity	µ t	Pa. s
	turbulent diffusivity	D t	m 2 . s -1
	phase molar enthalpy	h α	J. mol -1
	phase relative permeability	k α r
	vapour pressure	P sat	Pa
	rock permeability tensor	Λ Λ Λ	m 2
	rock porosity	φ
	porous volume	ϕ	m 3
	phase molar internal energy	e α	J. mol -1
	molar heat capacity rock energy per unit rock volume	c α p E r	J. mol -1 . K -1 J. m -3
	fluid energy per unit pore volume	E f	J. m -3
	convective molar transfer coefficient	H m	mol. m -2 . s -1
	convective energy transfer coefficient	H

Table 3 .

 3 5.2 -Notations of the physical entities and there units.

	Chapter 4
	Annex : modelling and simulation of
	multi-branch wells into the ComPASS
	code

Abstract: this chapter describes a project which took place into the CEMRACS summer school in 2016 devoted to numerical challenges in parallel computing. The CEM-RACS is a scientific event of the SMAI (the french Society of Applied and Industrial Mathematics) with 5 weeks of research projects. My project was in collaboration with Thibaud Beltzung * , Konstantin Brenner † , Simon Lopez ‡ , Roland Masson † , Farid Smai ‡ , Jean-Frédéric Thebault § and Feng Xing †

[START_REF] Beaude | Parallel geothermal numerical model with fractures and multibranch wells[END_REF]

. The project consisted in adding a multibranch thermal well model into the ComPASS code. It is a new geothermal simulator based on unstructured meshes and adapted to parallel distributed architectures

  , communications are handled by OpenMPI 1.8.2 (GCC 4.9) and PETSc 3.5.3. Gravity acceleration is set to 0 in all the test cases.

			process 1
	2 J N p R N p . . .	   	process 2 . . . process N p

La thèse que vous avez entre les mains n'aurait pas vu le jour sans le soutien inconditionnel de ma famille. Merci de croire en moi et de me pousser à devenir qui je suis. Tout d'abord, merci à mes parents, Christine et Nicolas, de m'avoir laissée faire mes choix tout en m'accompagnant si bien. Je ne peux pas lister ici tous les moments marquants où vous m'avez soutenue sans retenue, un grand merci de chercher encore à m'élever. Merci à mes frères, Olivier et François, sans qui je n'aurais pas un tel caractère. Vous me poussez à donner le meilleur de moi sans sentir de compétition ni de jalousie, je suis consciente de la chance que j'ai. Grâce à vous tous, j'ai eu la confiance et la liberté d'arriver ici aujourd'hui. Merci aux "pièces rapportées", Cécile et Sophie, vous avez élargi ma vision du monde grâce à nos discussions, à tous les moments passés ensemble. Enfin, merci à mes nièces, Irène et Eloïse, j'aime vous voir grandir avec vos caractères très différents.

† Université Côte d'Azur, Inria, CNRS, LJAD, UMR 7351 CNRS, team Coffee ‡ BRGM, Orléans § Storengy

Acknowledgments

This work was supported by a joint project between INRIA and BRGM Carnot institutes (ANR, INRIA, BRGM). It was granted access to the HPC and visualization resources of "Centre de Calcul Interactif" hosted by University Nice Sophia-Antipolis.

We also consider the subset of phase pressure unknowns P α D introduced in (2.3.7), the subset of temperature unknowns

and the subset of the physical unknowns at a given ν ∈ M ∪ V v ∪ F h D U ν = (P g ν , P l ν , T ν , S g ν , S l ν ,C g ν ,C l ν ).

Let us define the discrete Darcy fluxes for all K ∈ M and ν ∈ Ξ K by

where the phase mass density is defined by

Let us also introduce the discrete Fourier fluxes for all K ∈ M and ν ∈ Ξ K by

where the thermal conductivity λ K is a cell average of the bulk thermal conductivity computed explicitly from the previous time step variables and G Kν is the flux function (2.2.14) obtained with the identity diffusion tensor in all cells. The discretization of the mobilities is obtained using the phase based upwind approximation. For each Darcy flux, let us define the phase dependent upwind control volume (Kν) α for K ∈ M , ν ∈ Ξ K such that

Let us introduce the upwind approximation of the phase molar fluxes

Newton-min non-linear solver adaptations

The step 4 of the Newton-min algorithm detailed in Section 1.5 allows proposing the following different improvements of the Newton-min algorithm.

Basic Newton-min algorithm

The basic version of the Newton-min algorithm only enforces at each iterate the following non-linear closure law for ν ∈ M ∪ F Γ atm P g ν -P l ν = P c (S g ν ). Our objective for this basic Newton-min algorithm is to use no projections of the physical unknowns onto their physical bounds. However, in order to obtain the convergence of the Newton-min algorithm, it is necessary to project the molar fractions of a present phase within the range say [-0.2; 1.2] at each Newton iterate.

Newton-min with projection on the complementarity constraints

In order to obtain a better convergence of the Newton-min algorithm, all the complementarity constraints of type min(U 1 ,U 2 ) = 0 are enforced at the initial guess and at each Newton iterate. In addition, P g ν -P l ν = P c (S g ν ) is also enforced for each ν ∈ M ∪ F Γ atm and the following physical ranges are imposed on the molar fractions of a present phase and on the saturations

An additional improvement, whose numerical efficiency is studied in Sections 3.2.6 and 3.3, is to test the appearance of a missing phase using the molar fractions at equilibrium with the present phase rather than their linear Newton updates.

Newton-min with projection on the complementarity constraints and thermodynamic equilibrium

In addition to the previous updates, the molar fractions C ᾱ which are secondary unknowns (see Table 3.2.1), complemented by the temperature if both phases are present, are updated in order to verify the following closure laws at each Newton iterate

The liquid and gas phases are a mixture of two components, the water denoted by w and the air denoted by a. The gas molar density is defined by the perfect gas law ζ g = P g RT , with R = 8.314 J. K -1 . mol -1 and the liquid molar density is fixed to ζ l = 55555 mol. m -3 . The phases viscosities are fixed to µ g = 18.51 • 10 -6 Pa. s and µ l = 10 -3 Pa. s. The gas fugacities are given by Dalton's law for an ideal mixture of perfect gas f g i = C g i P g , i = a, w. The fugacity of the air component in the liquid phase is given by Henry's law f l a = C l a H a (T ) with the temperature dependent Henry constant

T 2 -T 1 where Ha 1 = 6 10 9 Pa, Ha 2 = 10 10 Pa, T 1 = 293 K and T 2 = 353 K. For the water component in the liquid phase, the fugacity is taken from [START_REF] Schmidt | Properties of water and steam in S.I. units[END_REF] f l w = C l w P sat (T ) exp -

The soil-atmosphere evaporation-outflow boundary condition (3.2.18) should account for capillary pressures P g -P l in the interval [0, P e ]. It results that, for non-zero entry pressures P e , the gas saturation cannot be used anymore as primary unknown at the top boundary. Following [START_REF] Brenner | Improving newton's method performance by parametrization: The case of the richards equation[END_REF][START_REF] Brenner | Immiscible twophase Darcy flow model accounting for vanishing and discontinuous capillary pressures: application to the flow in fractured porous media[END_REF], let us introduce a parameter τ and two continuously differentiable non-decreasing functions S : R → [0, 1] and P c : R → R,

Then τ is defined as an additional unknown at the top boundary and equation S g = S g (P g -P l ) in (3.2.18) is replaced by S g = S(τ) and P g -P l = P c (τ).

Two choices of parametrization S(τ) and P c (τ) are compared in terms of convergence of the different versions of the Newton-min algorithm in Tables 3.3.3 and 3.3.4. The first choice uses the capillary pressure scaled by the entry pressure P e as parameter τ and is defined by

The second choice is based on a variable switch between the capillary pressure and the gas saturation which is shown in [START_REF] Brenner | Improving newton's method performance by parametrization: The case of the richards equation[END_REF][START_REF] Brenner | Immiscible twophase Darcy flow model accounting for vanishing and discontinuous capillary pressures: application to the flow in fractured porous media[END_REF] to improve the non-linear convergence and also allows accounting for non invertible capillary functions. It is defined by

Note also that the pressure P f (resp. the temperature T f ) is assumed continuous and equal to P Σ (resp. T Σ ) at the fracture intersection Σ, and that homogeneous Neumann boundary conditions are applied for the mass q f and energy q e, f fluxes at the fracture tips ∂ Γ \ ∂ Ω.

VAG Finite Volume Discretization

Let us refer to Section 2.2 for the notations of the VAG space discretization. Let us recall that the faces are not necessarily planar. The mesh is also supposed to be conforming w.r.t. the fracture network Γ in the sense that for all j ∈ J there exist the subsets F Γ j of F such that

We will denote by F Γ the set of fracture faces

and by

the set of fracture nodes. This geometrical discretization of Ω and Γ is denoted in the following by D.

In addition, the following notation will be used

For N t f ∈ N * , let us consider the time discretization

We denote the time steps by ∆t n = t nt n-1 for all n = 1, • • • , N t f .

VAG fluxes and control volumes

The VAG discretization has been introduced in [START_REF] Eymard | Small-stencil 3D schemes for diffusive flows in porous media[END_REF] for diffusive problems on heterogeneous anisotropic media. Its extension to the hybrid-dimensional Darcy flow model has been proposed in [START_REF] Brenner | Vertex Approximate Gradient scheme for hybrid-dimensional two-phase Darcy flows in fractured porous media[END_REF] based upon the following vector space of degrees of freedom

The degrees of freedom are illustrated in Figure 4.3.1 for a given cell K with one fracture face σ in bold.

The matrix degrees of freedom are defined by the set of cells M and by the set of nodes V \ V Γ excluding the nodes at the matrix fracture interface Γ. The fracture faces These sets of own elements are then extended with ghost elements as follows. The overlapping decomposition of M into the sets

is chosen in such a way that any compact finite volume scheme such as the VAG scheme can be assembled locally on each process. Hence, as exhibited in Figure 4.4.1, M p is defined as the set of cells sharing a node with a cell of M p . The overlapping decompositions of the set of wells, of the set of nodes and of the set of fracture faces for p = 1, • • • , N p are performed in such a way that the linearized systems can be assembled locally on each process and that the pressure drops of the own and ghost wells can be computed locally on each process p. It results that any well with a node belonging to V p is included in the set W p of own and ghost wells of the process p. Then, the set of own and ghost nodes V p is extended compared to the definition of [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF] in such a way that any node of a well in W p belongs to V p . The definition of the set of own and ghost fracture faces is unchanged compared with its original definition in [START_REF] Xing | Parallel numerical modeling of hybriddimensional compositional non-isothermal Darcy flows in fractured porous media[END_REF]. This leads to the following definitions

well root The partitioning of the mesh is performed by the master process (process 1), and then each local mesh is distributed to its process. Therefore, each MPI process contains the local mesh (M p , V p , F p Γ , W p ), p = 1, 2, ..., N p which is split into two parts own elements:

We now turn to the parallel implementation of the Jacobian system to be solved at each Newton iteration of each time step. and

where R p , p = 1, 2, ..., N p is a restriction matrix satisfying

The matrix J p R p , the vector U p and the vector b p schur b p w are stored in process p.

The linear system (4.4.4) is solved using the GMRES iterative solver preconditioned by a CPR-AMG preconditioner introduced in [START_REF] Lacroix | Decoupling preconditioners in the implicit parallel accurate reservoir simulator (IPARS)[END_REF][START_REF] Scheichl | Decoupling and block preconditioning for sedimentary basin simulations[END_REF]. This preconditioner combines multiplicatively a parallel algebraic multigrid preconditioner (AMG) [START_REF] Henson | BoomerAMG: A parallel algebraic multigrid solver and preconditioner[END_REF] for a pressure block of the linear system with a block Jacobi ILU0 preconditioner for the full system. In our case, the columns of the pressure block are defined by the node, the fracture face and the well pressure unknowns, and its lines by the node and the fracture face mass conservation equations as well as the well equations.

The solution of the linear system provides on each process p the solution vector (U p s ,U p f ,U p w ) of own node, fracture-face and well unknowns. Then, the ghost node unknowns U p ν , ν ∈ (V p \V p ), the ghost fracture face unknowns U p ν , ν ∈ (F p Γ \F p Γ ) and the ghost well unknowns U w ν , ν ∈ (W p \W p ) are recovered by a synchronization step with MPI communications. This synchronization is efficiently implemented using a PETSc matrix vector product U = SU (4.4.5)

where

is the vector of own and ghost node, fracture-face and well unknowns on all processes. The matrix S, containing only 0 and 1 entries, is assembled once and for all at the beginning of the simulation. Finally, thanks to (4.4.3), the vector of own and ghost cell unknowns U p c is computed locally on each process p.

Numerical results

All the numerical tests have been implemented on the Cicada cluster of the University Nice Sophia Antipolis composed of 72 nodes (16 cores/node, Intel Sandy Bridge E5-2670, 64GB/node). We always fix 1 core per process and 16 processes per node. The The simulation domain is defined by Ω = (0, 2000) 3 in meters. The mesh is a 3D tetrahedral mesh conforming to the fracture network and to the wells. It was generated using the implicit framework from the 3D mesh generation package from the Computational Geometry Algorithms Library (CGAL [START_REF]The CGAL Project: CGAL User and Reference Manual[END_REF]). As shown in Figure 4.5.5, there is one injection well (red line) and one multi-branch production well (green line). This mesh contains about 4.9 × 10 6 cells, 2.8 × 10 4 fracture faces and 8.0 × 10 5 nodes. The radius of both wells is set to 0.1 m and the fracture width is fixed to d f = 1 m. The permeabilities are isotropic and set to Λ Λ Λ m = 10 -14 I m 2 in the matrix domain and to Λ Λ Λ f = 10 -11 I m 2 in the fracture network. The porosities in the matrix domain and in the fractures are φ m = 0.1 and φ f = 0.4 respectively. The computation of numerical Peaceman indices would require an analytical solution for the linear diffusion equation, which is not known for such a complex geometry involving fractures and multi-branch wells. This solution could also be obtained numerically using a mesh at the scale of the wells but its generation is out of the scope of this test case. Alternatively, we will use for this test case approximate analytical Peaceman type formulas providing a good order of magnitude for the Peaceman indices.

The domain is initially at the constant temperature 413 K and the constant pressure 2.0 × 10 7 Pa. The temperature is fixed to 413 K and the pressure is fixed to 2.0 × 10 7 Pa at the lateral boundaries of the domain. Zero fluxes for both mass and energy are imposed at the top and bottom boundaries of the domain. At the injection well, a cold water at temperature T in j = 333 K is injected with the maximum bottom hole pressure Pmax in j = 3.0 × 10 7 Pa and the total mass flow rate qin j = -27.78 kg. s -1 (i.e. -100 t/h). At the production well, hot water is produced with the minimum bottom hole pressure Pmin prod = 1.0 × 10 7 Pa and the total mass flow rate qprod =qin j = +27.78 kg. s -1 . Table 4.5.1 gathers the time stepping and convergence parameters.