Julien Waeytens
email: julien.waeytens@ifsttar.fr

Patrice Chatellier
email: patrice.chatellier@ifsttar.fr

Frédéric Bourquin
email: frederic.bourquin@ifsttar.fr

Fr Éd Éric Bourquin

Impacts of discretization error, flow modeling error and measurement noise on inverse transport-diffusion-reaction in a T-junction

published or not. The documents may come

Impacts of discretization error, flow modeling error and measurement noise on inverse transport-diffusion-reaction in a T-junction

Introduction

In drinking water networks, the water quality has to be guaranteed to the users by the operator.

Hence, chlorine is injected into the network to maintain the water quality between the water treatment plant and the end-users. The chlorine eliminates microorganisms and biofilm on the pipe walls at a reasonable cost. According to European standards, the chlorine concentration must be within a predefined range in drinking water networks. The lower limit is associated to chlorine disinfection purposes whereas the higher limit is defined as regards of the water taste. To palliate the lack of measurements in drinking water networks, physical models based on partial differential equations can be employed to predict the time evolution of the water quality at any point of the water network.

The combination of physical models and sensor outputs via data assimilation techniques was previously used to reconstruct the water flow [START_REF] Podvin | A reconstruction method for the flow past an open cavity[END_REF][START_REF] Waeytens | Inverse computational fluid dynamics: Influence of discretization and model errors on flows in water network including junctions[END_REF], to cartography the air quality [START_REF] Zhang | An adjoint sensitivity analysis and 4d-var data assimilation study of texas air quality[END_REF] or the water quality [START_REF] Kang | Real-time demand estimation and confident limit analysis for water distribution systems[END_REF][START_REF] Waeytens | Sensitivity of inverse advection-diffusion-Paper number: FE-16-1416[END_REF].

The optimal control theory [START_REF] Lions | Optimal control of systems governed by partial differential equations[END_REF] may be applied to reconstruct the chlorine concentration in water networks. In this framework, the reconstruction problem is rewritten as an optimization problem in which Paper number: FE-16-1416, Corresponding author: Waeytens, Page 2 the boundary conditions, i.e. the control parameters, are sought to minimize a data misfit functional.

This minimization problem can be solved by iterative gradient methods. The functional gradient can be computed at a lower cost than classical finite differences using the adjoint state. When focusing on the dispersion of chlorine concentration, both direct and adjoint problems are linear transport-diffusionreaction equations. Contrary to the direct problem, the adjoint problem is backward in time, i.e. null final condition, and virtual chlorine is injected at the sensor location. Indeed, in the adjoint problem, the chlorine injection amplitude is given by the gap between the measured and the simulated chlorine. Let us note that the adjoint framework is used in many domains: sensitivity analysis [START_REF] Wacholder | Application of the adjoint sensitivity method to the analysis of a supersonic ejector[END_REF], error estimation on a quantity of interest [START_REF] Becker | An optimal control approach to a posteriori error estimation in finite elements methods[END_REF][START_REF] Waeytens | Guaranteed error bounds on pointwise quantities of interest for transient viscodynamics problems[END_REF], goal-oriented model updating [START_REF] Chamoin | Goal-oriented updating of mechanical models using the adjoint framework[END_REF], optimal sensor placement [START_REF] Waeytens | Sensitivity of inverse advection-diffusion-Paper number: FE-16-1416[END_REF] and shape optimization [START_REF] Jameson | Aerodynamic design via control theory[END_REF][START_REF] Lei | Adjoint-based aerodynamic shape optimization for low reynolds number airfoils[END_REF][START_REF] Papoutsis-Kiachagias | Continuous adjoint methods for turbulent flows, applied to shape and topology optimization: Industrial applications[END_REF].

In the water quality applications, two time scales can be distinguished for the inverse problems. Model parameters such as the kinetic parameter may be updated [START_REF] Munavalli | Water quality parameter estimation in a steady state distribution system[END_REF][START_REF] Fabrie | Quality modeling of water distribution systems using sensitivity equations[END_REF] once a day due to their low time evolution. However, the reconstruction of the chlorine concentration have to be performed several times per hour in real-time. Two ways can be investigated to get a real-time reconstruction. Firstly, real-time computations can be achieved using reduced order methods [START_REF] Ito | A reduced-order method for simulation and control of fluid flows[END_REF][START_REF] Prud'homme | Reliable real-time solution of parametrized partial differential equations: Reduced basis output bound methods[END_REF]. It consists to perform the expensive computation in an offline stage. Hence, sophisticated models such as computational fluid dynamics (CFD) models which are employed in aerodynamic [START_REF] Besem | Vortex-induced Paper number: FE-16-1416, Corresponding author: Waeytens, Page 18 vibration and frequency lock-in of airfoil at high angles of attack[END_REF] and air quality applications [START_REF] Patnaik | Large scale urban contaminant transport simulations with miles[END_REF] can be considered. Secondly, instead of using complex models, we can use simpler flow and dispersion models.

Simplified one-dimensional models are traditionally implemented in drinking water software such as EPANET [START_REF] Rossman | EPANET users' manual[END_REF] to simulate the flow and the propagation of the chlorine concentration. Nevertheless, these simplified models may not be suitable for some key elements of the water networks, especially in junctions where the hypothesis of perfect and instantaneous mixing may not be valid for laminar flow encountered in distribution mains [START_REF] Blokker | Importance of demand modelling in network water quality models: a review[END_REF]. Consequently, one can consider hybrid model approaches, previously applied to biomechanics applications [START_REF] Formaggia | On the coupling of 3d and 1d navier-stokes equations for flow problems in compliant vessels[END_REF] combining coarse model in straight pipes and refined model in junctions.

In the present article, our main objective is to analyze the influence of several factors on the concentration reconstruction process. The inverse transport-diffusion-reaction method and the application to a T-junction are presented in Section 2. To save computation time in the concentration reconstruction process, one can solve direct and adjoint problems using coarse discretizations. Hence, the influence Paper number: FE-16-1416, Corresponding author: Waeytens, Page 3 of the concentration discretization errors is investigated in Section 3. Then, noting that the flow is not well-known in general in water pipe applications [START_REF] Jonkergouw | Water quality model calibration under unknown demands[END_REF], the influence of the flow approximation on the quality of the reconstructed concentration is studied in Section 4. In particular, the influence of flow uncertainties due to modeling error is studied. In Section 5, both influences of discretization errors and modeling errors on the reconstructed concentration field are considered. In the last section we analyze the effect of measurement noise on the reconstruction process. For instance, in the water pipe study, if the flow field is properly known, we show that the error obtained in the concentration field may be less than 5%. However, if an approximate flow field is used in the reconstruction process, a 40% error in the concentration field may be obtained. Finally, concerning the robustness of the inverse technique, we show that the quality of the reconstructed chlorine concentration does not deteriorate when considering corrupted data with a noise variance of few percents. These may be met in the case of measurement error.

2 Inverse transport-diffusion-reaction method applied to the concentration field reconstruction in a T-junction

Summary of the inverse transport-diffusion-reaction method

To reconstruct the space-time cartography of a concentration field for drinking water purposes, the authors have previously proposed in [START_REF] Waeytens | Sensitivity of inverse advection-diffusion-Paper number: FE-16-1416[END_REF] an inverse strategy combining linear transport-diffusion-reaction equations in 2D and concentration sensor outputs. In the present section, only the outlines of the method are given. The full details of the inverse strategy can be found in [START_REF] Waeytens | Sensitivity of inverse advection-diffusion-Paper number: FE-16-1416[END_REF].

The considered inverse method is based on the optimal control theory [START_REF] Lions | Optimal control of systems governed by partial differential equations[END_REF]. The control parameter u, which correspond herein to concentration boundary conditions, is sought such as it minimizes the data misfit functional J defined by:

J(u) = 1 2 n s ∑ j=1 T 0 Ω ψ r j C(u) dΩ -C mes j 2 dt + αR(u,C) (1)
where C denotes the concentration field satisfying 2D linear transport-diffusion-reaction equations, ψ r (resp. C mes j ) is an extracting function (resp. the measured concentration) associated with the j th sensor at x j , n s is the number of chlorine sensors and αR(u,C) is a regularization term.

As we numerically observe that the chlorine reconstruction inverse problem is not ill-posed, the regularization term does not play a significant role. Consequently, the regularization parameter α is taken to zero. The influence of the regularization on the quality of the reconstructed filed lies out of the scope of the article.

To solve the optimization problem associated to the chlorine reconstruction, i.e. minimization of the data misfit functional J, a gradient-based iterative method is used. At each iteration, the different steps can be summarized as follows:

1. solve the linear transport-diffusion-reaction equations, also called "direct problem", considering the concentration boundary conditions u old determined at the previous iteration;

2. solve the adjoint problem, i.e. linear transport-diffusion-reaction equations backward in time where virtual chlorine is injected at the sensor location. The chlorine injection amplitude is given by the gap between the measured and the simulated chlorine;

3. compute the gradient ∇J of the functional at a low computational cost using the direct and the adjoint numerical solutions;

4. determine the optimal descent step γ and get the updated control parameter

u new = u old -γ∇J (2)
Let us note that at each iteration the space-time cartography of the concentration field is updated by computing the direct problem. In the next sections, we analyze the quality of the reconstructed concentration field obtained at each iteration.

The authors verified the ability of the considered gradient-based method to solve optimization problems for the reconstruction of the flow in drinking water networks [START_REF] Waeytens | Inverse computational fluid dynamics: Influence of discretization and model errors on flows in water network including junctions[END_REF] and for the reconstruction of the chlorine concentration in water pipes [START_REF] Waeytens | Sensitivity of inverse advection-diffusion-Paper number: FE-16-1416[END_REF].

Paper number: FE-16-1416, Corresponding author: Waeytens, Page 5

Description of the study case: a water pipe T-junction

In the design of water networks one can distinguish two kinds of pipes, "transport mains" and "distribution mains". The first ones are build of large pipes which usually don't supply any costumer.

The second ones involve much smaller pipes connecting the "transport mains" to the end-user. The design of these pipes diameter is mainly based on the liquid retention time which must be limited in order to avoid the development of bacteria. This limitation leads to smaller diameters of the pipes. This result makes networks cheaper to build but leads to higher pressure drops. Furthermore in case of fire, the pipes diameter of the network should not be too small in order to meet fire flow demand. Obviously this demand is mandatory and is much higher than the domestic demand [START_REF] Vreeburg | Discoulouration in potable water distribution systems: a review[END_REF]. All these considerations lead to areas of the networks where typical velocities can be very low (less than 1 cm/s) and change rapidly from one second to the next [START_REF] Blokker | Importance of demand modelling in network water quality models: a review[END_REF].

Our objective is to reconstruct the chlorine concentration in "distribution mains" for a given flow. Let us note that the authors have previously studied in [START_REF] Waeytens | Inverse computational fluid dynamics: Influence of discretization and model errors on flows in water network including junctions[END_REF] the reconstruction by an inverse technique of the flow encountered in the "distribution mains" of a drinking water network. It has been applied to the T-junction and to a part of a French water network.

Therefore we have chosen to study a T-junction represented in Fig. 1. This is one of the key elements of a water network, and it is simple enough to enable an easy understanding the complexity of the flow and concentration fields in the network. To study this T-junction we first consider a constant flow, and then a fluctuating flow (Section 5). In order to have a better understanding of the reconstruction technique we first deal with simplified boundary velocities (see Fig. 2) and Reynolds numbers less than 2 × 10 3 .

This enables us to compute all numerical solutions using the finite element code FreeFem++ [START_REF] Hecht | New development in freefem++[END_REF]. The The velocities at the boundaries, named (v c 1 , v c 2 , v c 3 ), are normal to the boundaries and their shape g i (x)

is considered parabolic (Poiseuille flow):

v c i (x,t) = v max c i (t)g i (x)n i , i ∈ {1, 2, 3} (3)
Paper number: FE-16-1416, Corresponding author: Waeytens, Page 6

where n i is the exterior normal vector to the boundary ∂ c i Ω.

The transport-diffusion-reaction equation is implemented with the following parameters so that it includes the full complexity of the modeled phenomena. The diffusion coefficient is taken equal to that of chlorine in water ν = 10 -5 m 2 /s leading to a Peclet number of approximately 10 3 . For the kinetics of the reaction we have implemented a first order reaction, meaning that the kinetics is equal to kC, where k is the kinetic coefficient [START_REF] Rossman | EPANET users' manual[END_REF]. From analyses of treated water in U.S. drinking water networks, the kinetic coefficient ranges from 0.08 day -1 to 18 day -1 [START_REF] Vasconselos | Kinetics of chlorine decay[END_REF]. In the present article, we have considered a kinetic coefficient of k = 5 day -1 that is in the upper end of the range. A value as high as that may be found when readily biodegradable pollutant is being degraded by chlorine. On the boundary ∂ d Ω, we do not introduce the wall reaction which might be the case when no biofilm is present. Lastly, on the boundary ∂ c Ω, the spatial shape of the control concentration U = (U 1 ,U 2 ,U 3 ), is considered constant:

U i (x,t) = u i (t) f i (x) with f i (x) = 1, i ∈ {1, 2, 3} (4)
When considering a laminar flow in a straight pipe, let us remark that the transverse uniformity of the concentration distribution can be established for a length above 10vR 2 /ν [START_REF] Wu | Approach to transverse uniformity of concentration distribution of a solute in a solvent flowing along a straight pipe[END_REF] where R (resp. v) corresponds to the radius of the straight pipe (resp. the pipe average velocity).

Using all these parameters the problem we are addressing in the following is: one seeks (u

1 (t), u 2 (t), u 3 (t))
using the concentration outputs from 2 sensors. In practice, the sensor outputs are pointwise and experimental. Nevertheless, the sensor outputs are obtained here numerically from the following steps.

First, using a very fine discretization (1.1 × 10 5 dof, 2560 time steps), we solve the transport-diffusionreaction problem considering the reference boundary concentrations

(U ex 1 ,U ex 2 ,U ex 3 ) shown in Fig. 3.
The associated solution is C ex . Then, we compute the simulated sensor outputs using

C mes j = Ω ψ r j C ex dΩ ≈ C ex (x j ) (5)
Paper number: FE-16-1416, Corresponding author: Waeytens, Page 7

A c c e p t e d M a n u s c r i p t N o t C o p y e d i t e d

where ψ r j is an extracting function associated with the j th sensor at x j .

In the three next sections, we do not introduce noise in the simulated sensor outputs. The influence of the measurement noise on the reconstructed field is studied in the last section.

In this article, direct and adjoint problems are solved using the Characteristic-Galerkin method of order 1 [START_REF] Pironneau | Characteristic galerkin and galerkin least squares space-time formulations for the advection-diffusion equation with time dependent domain[END_REF] and a backward Euler scheme.

For a given flow, the influence of the discretization error on the concentration reconstruction is analyzed. Then, the influence of the flow approximation is studied. To evaluate the quality of the reconstruction process, we define the following normalized errors in the space-time domain:

ε s j = || Ω ψ r j C h dΩ -C mes j || L 2 (Ω×[0;T ]) ||C mes j || L 2 (Ω×[0;T ]) , ε c j = ||C h -C ex || L 2 (∂ c j Ω×[0;T ]) ||C ex || L 2 (∂ c j Ω×[0;T ]) , ε C = ||C h -C ex || L 2 (Ω×[0;T ]) ||C ex || L 2 (Ω×[0;T ]) (6)
The normalized indicator ε s j denotes the j th data misfit whereas ε c j (resp. ε C ) represents the error between the exact boundary concentration and the reconstructed boundary concentration on the boundary ∂ c j (resp. the error between the exact concentration and the reconstructed concentration on the whole space-time domain).

Influence of the discretization error on the concentration reconstruction

In this section, we compare the reconstructed concentration for two discretizations:

• fine discretization (Fig. 4): 2.8 × 10 4 dof, 1280 time steps

• coarse discretization (Fig. 5): 1.9 × 10 3 dof, 256 time steps.

These discretizations are used to solve the direct and adjoint problems when considering a high kinetic coefficient k of 5 day -1 . To evaluate the discretization errors in space and in time, we compute the error estimators previously introduced in [START_REF] Waeytens | Sensitivity of inverse advection-diffusion-Paper number: FE-16-1416[END_REF]. The numerical values of the error estimators are given in Eq. [START_REF] Wacholder | Application of the adjoint sensitivity method to the analysis of a supersonic ejector[END_REF].

The combination of chlorine sensors 1 & 2 and the reference Navier-Stokes flow are considered.

The normalized errors [START_REF] Lions | Optimal control of systems governed by partial differential equations[END_REF] are given in Tables 1 and2. For both discretizations, the quality of the Paper number: FE-16-1416, Corresponding author: Waeytens, Page 8 reconstructed concentration field at the first iteration is similar. One has an error on boundary control 1 (resp. boundary control 3) of approximately 30% (resp. 70%) and an error in the reconstructed concentration of 25%. Nevertheless, from the 16 th iteration, we observe a significant difference in the quality of the reconstructed concentration. In fact, a 2% error in the reconstructed concentration is obtained at iteration 32 with the fine discretization whereas the error is approximately 10% for the coarse discretization. Although the data misfit tends toward 0, the error in the reconstructed concentration can't be less than 10% when using the coarse discretization. This is caused by the discretization error. At the 4 th iteration, the error estimators in space and in time associated with the reconstructed velocity obtained with the fine and the coarse meshes are:

k = 5 day -1 ε s 1 (%) ε s 2 (%) ε c1 (%) ε c3 (%) ε C (%)
       ε f ine SPA |t=T /2 = 1.7%, ε f ine T IME |t=T /2 = 1.7% ε coarse SPA |t=T /2 = 27.6%, ε coarse T IME |t=T /2 = 9.1% (7)
Herein, discretization errors in space and in time of about 1% allows the reconstruction of the concentration field with an error less than 5%.

Concerning the computation time, on a single core 2.5-GHz processor one needs • 105 s per iteration when using the coarse discretization.

•
At each iteration, the most expensive calculations are the resolution of the direct problem, the resolution of the adjoint problem and the determination of the descent step by solving an additional direct problem.

Let us recall that both problems are solved with the Characteristic-Galerkin method and a backward Euler scheme. As the linear system is symmetric, the Crout direct solver is employed.

To summarize, a 10% error in the reconstructed concentration can be obtained using the coarse discretization in 64 iterations, which corresponds to a 112 min of computation time on a single core 2.5-GHz processor. To obtain a 3% error, one needs to use the fine discretization, which leads to a 5 times more expensive calculation. A good strategy to save computation time would be to successively use the coarse discretization and then the fine discretization. Exploring this tracle lies out of the scope of the paper.

In Tables 1 and2, the errors on the chlorine reconstruction are obtained for a high kinetic coefficient of 5 day -1 . To show that these results are of general relevance, i.e. not depending on the kinetic coefficient, Table 3 gives the normalized errors ε s j , εc j and ε C for a low kinetic coefficient of 0.5 day -1 considered as a standard value in [START_REF] Rossman | Modeling chlorine residuals in drinking-water distribution systems[END_REF]. It can be noted that the numerical values of the normalized errors are similar to those of Table In the following sections, we only consider the case of a high kinetic coefficient.

A c c e p t e d M a n u s c r i p t N o t C o p y e d i t e d

Influence of flow uncertainty on the reconstructed concentration field

In the previous sections, we assume that the reference Navier-Stokes flow was exactly known. Nevertheless, this is not the case most of the time in water network applications. Indeed, approximate flow velocities are commonly used to predict the evolution of the chlorine concentration [START_REF] Rossman | EPANET users' manual[END_REF]. In this section, our main objective is to evaluate the influence of the flow uncertainty on the quality of the reconstructed concentration field. Two different types of approximate flow are considered in the transport-diffusionreaction equations. The first flow type corresponds to the exact flow with a perturbation part. The second flow type is the flow obtained by means of velocity reconstruction process [START_REF] Waeytens | Inverse computational fluid dynamics: Influence of discretization and model errors on flows in water network including junctions[END_REF].

To evaluate the quality of the approximate velocity v h , a similar normalized error in the space-time domain is introduced:

ε v = ||v h -v ex || L 2 (Ω×[0;T ]) ||v ex || L 2 (Ω×[0;T ]) (8)

A c c e p t e d M a n u s c r i p t N o t C o p y e d i t e d

4.1 Using the exact velocity field with a perturbation part

For simplicity, let us first consider the following approximate velocity:

v h = (1 + ε)v ex (9)
One can notice that the perturbation parameter ε exactly corresponds to the normalized error ε v defined in Eq. ( 8).

The concentration field is then reconstructed for the 2D study case (Fig. 1) using the above approximate flow. The fine discretization is employed to solve the transport-diffusion-reaction problems. Sensors 1 & 2, presented in Fig. 1, are considered. For different values of the velocity perturbation parameter ε, we present the quality of the reconstructed concentration in Fig. 6. Until 16 iterations of the reconstruction process, the normalized errors between the exact concentration and the reconstructed concentration ε C are quite similar for the approximate flows with an uncertainty less than 5%. For the approximate flow with an uncertainty greater than 5%, one can observe that there is no use iterating many times to improve ε C . In fact, for ε v = 20%, we obtain a more reliable reconstructed concentration after 1 iteration (ε C ≈ 35%) than after 128 iterations (ε C ≈ 80%). This result can be viewed as a generalization of the discrepancy principle to modeling errors. Indeed, the discrepancy principle initially introduced in [START_REF] Morozov | On the solution of functional equations by the method of regularization[END_REF] recommend the data misfit in a reconstruction process not to be less than the measurement error.

Otherwise, it can lead to a wrong reconstruction field. To sum up, herein the reconstruction process has to be stopped when the data misfit reaches the modeling error induced by the flow uncertainty.

Using a velocity field from a reconstruction process

Before reconstructing the concentration field, the authors first determined an approximate velocity field using a similar inverse reconstruction technique based on velocity sensor outputs [START_REF] Waeytens | Inverse computational fluid dynamics: Influence of discretization and model errors on flows in water network including junctions[END_REF]. To quickly obtain the reconstructed velocity, two ways were investigated. In the water pipe junction (Fig. 1), the concentration field is reconstructed using these approximate flows. The fine discretization is employed to solve the transport-diffusion-reaction problems. Sensors 1 & 2, presented in Fig. 1, are considered. The results are presented in Fig. 7. Note that the Navier-Stokes flow and its very fine discretization (2.5 × 10 5 dof, 2580 time steps) corresponds to the reference flow defined in Section 2.2. The solid line with the symbol (+) represents the evolution of the quality of the reconstructed concentration ε C when the reference flow (ε v = 0%) is considered. Let us recall that a 5% error in the reconstructed concentration remains, even after 128 iterations because sensors 1 & 2 do not allow a properly determination of boundary control 3 (see Table 1). When considering the approximate Navier-Stokes flows with ε v less than 5 %, the errors in the reconstructed concentration are observed to be similar at the first iterations. Additionally, at iteration 32, one observes a 11%

error in the reconstructed concentration with the reference flow whereas there is a 16% error with the coarse Navier-Stokes flow (4.4 × 10 3 dof, 64 time steps). By using the unsteady Stokes model with a fine discretization (6.4 × 10 4 dof, 256 time steps) to reconstruct the Navier-Stokes flow, an error in the reconstructed velocity of 16% is obtained. For this approximate flow, it is interesting to note that the error in the reconstructed concentration can not be less than 32%. This result is worth when using an approximate Stokes flow with a fine discretization. In this case, ε C can not be less than 38%.

The approximate velocity fields employed above are shown in Fig. 8. The reference concentration field and the associated reconstructed concentrations field are given in Fig. 9 and 10. For the unsteady Stokes and the Stokes flows, we observe that the chlorine coming from the branch pipe is not identified by the reconstruction process. This may be due to the fact that the functional J, which involves sensors 1 and 2, is not sensitive to boundary control 3 for these two approximate flows. This work confirms several former papers [START_REF] Kang | Real-time demand estimation and confident limit analysis for water distribution systems[END_REF][START_REF] Blokker | Importance of demand modelling in network water quality models: a review[END_REF][START_REF] Munavalli | Water quality parameter estimation in a distribution system under dynamic state[END_REF] stating that the flow needs to be highly accurate before it may be used to simulate the dispersion and decay of a residual disinfectant. In this article, we clearly quantify the quality of the reconstructed concentration field as a function of the the flow accuracy.

Combining the concentration field discretization errors and the flow modeling error

In this section, we present a low-cost strategy for the reconstruction of the concentration field. To achieve this, we still employ approximate flows that are reconstructed using simple flow models, and we

Paper number: FE-16-1416, Corresponding author: Waeytens, Page 13 use the coarse discretization, represented in Fig. 5, to solve transport-diffusion-reaction problems. As previously, sensors 1 & 2 are considered. The influence of the concentration field discretization and the flow modeling errors is studied on two examples. In the first example, the previous smooth boundary velocities are considered (Fig. 2). Then, we aim to reconstruct the chlorine concentration for a highlyfluctuating flow, which represents the real flow in "distribution mains" [START_REF] Blokker | Importance of demand modelling in network water quality models: a review[END_REF]. The associated boundary velocities are presented in Figure 12. In both examples, the Reynolds number is approximately 2 × 10 3 .

Smooth boundary velocity

Herein, the exact flow is described using the Navier-Stokes equations with smooth boundary velocities (Fig. 2). The results of the concentration reconstruction are presented in Fig. 11. With an approximate flow satisfying the Navier-Stokes equations, the error in the reconstructed concentration declines until iteration 128, then a plateau is reached. When considering the coarse Navier-Stokes flow (ε v = 9%), a 15% error between the exact concentration and the reconstructed concentration remains at iteration 128. It may be due to:

• the impossibility to determine boundary control 3

• the 10% uncertainty in the velocity field

• the concentration discretization errors.

It can be noted that there is no use iterating several times when the reconstructed velocity is obtained with simpler flow models. Indeed, Fig. 11 shows that we should stop the reconstruction process after 2 iterations for the unsteady Stokes and Stokes flow models.

To conclude, one observes that an acceptable concentration can be obtained even for high discretization errors in the concentration when considering a reliable flow (ε v < 10%). Using the approximate Navier-Stokes flows and solving the concentration problems with a coarse discretization leads to a 15% error in the reconstructed concentration. Conversely, the modeling error in the flow drastically reduces the quality of the reconstructed concentration field. Even for fine discretizations, in our study case, we are not able to identify boundary concentration 3 when using a reconstructed velocity obtained from Stokes flow model. This leads to a 39% error in the reconstructed concentration.

Paper number: FE-16-1416, Corresponding author: Waeytens, Page 14 obtained using a coarse discretization. To keep the error below 10%, fine concentration discretizations are preferred. Then, we confirm that an accurate chlorine concentration can not be achieved if the flow is not well determined. When considering the exact flow obtained herein from the full set of Navier-Stokes equations, we show that the error on the reconstructed concentration may be less than 5%. However using an approximate flow may lead to a 40% error between the reference concentration field and the reconstructed concentration field. Finally, the robustness of the inverse technique has been shown in the water T-junction. Indeed, the quality of the reconstructed chlorine concentration is not deteriorated when considering corrupted outputs with a normal distribution noise variance of few percents. Lastly, a good engineering practice would be to stop the reconstruction process according to an extended discrepancy principle including modeling and measurement errors. As shown in the article, the quality of the reconstructed field declines after reaching the threshold of the modeling error.

List of Figures σ=0g/l σ=10 -6 g/l σ=2.10 -6 g/l σ=5.10 -6 g/l σ=10 -5 g/l σ=2.10 -5 g/l σ=5.10 -5 g/l

  reference flow chosen for our study satisfies the Navier-Stokes and incompressibility equations. On the boundary ∂ d Ω of ∂ Ω, the velocity vanishes. On the boundary ∂ c Ω of ∂ Ω, velocities v c are prescribed.

  2250 s per iteration when using the fine discretization Paper number: FE-16-1416, Corresponding author: Waeytens, Page 9

  The first way was to use coarse discretizations to solve the Navier-Stokes equations and its associated adjoint problem. The second way was to use a simpler flow model (as the unsteady Stokes equations or the Stokes equations) for the velocity reconstruction process, although the exact flow satisfies the Navier-Stokes equations. Therefore, one has a flow modeling error. Paper number: FE-16-1416, Corresponding author: Waeytens, Page 12

1 9 2 10 3 22 JournalFig. 1 .

 910221 Fig. 1. 2D study case geometry and sensor placement (dimensions in mm)

Fig. 2 .Exact concentration control 3 Fig. 3 .Fig. 4 .Fig. 5 . 24 JournalFig. 6 .SteadyFig. 7 .SteadyFig. 11 . 3 Fig. 12 . 29 Journal 4 .

 23345246711312294 Fig. 2. Temporal evolution of (v max c 1 ) and (v max c 3 ) -

Fig. 13 . 30 JournalA c c e p t e d M a n u s c r i p t N o t C o p y e d i t e dFig. 14 .

 133014 Fig. 13. Influence of flow model error and flow discretization error on the chlorine reconstruction -Sensors 1 & 2 -Coarse discretization(1.9 × 10 3 dof 256 time steps) for chlorine concentration -Representative flow in "distribution mains" ε C represents the L2 error between the exact concentration and the reconstructed concentration; ε v represents the L2 error between the exact velocity and the approximate velocity; n it is the number of iterations of the inverse problem

Fig. 15 .Fig. 16 .

 1516 Fig. 15. Influence of the noise variance σ 2 on the chlorine reconstruction -Sensor 1 & 2 -Fine discretization (2.8 × 10 4 dof, 1280 time steps)

Journal of Fluids Engineering. Received July 04, 2016; Accepted manuscript posted January 20, 2017. doi:10.1115/1.4035806 Copyright (c) 2017 by ASME

Table 1 .

 1 Chlorine reconstruction for the Navier-Stokes flow -Sensors 1 & 2 -Fine mesh (2.8 × 10 4 dof 1280 time steps) -High kinetic coefficient:

Table 2 .

 2 Chlorine reconstruction for the Navier-Stokes flow -Sensors 1 & 2 -Coarse mesh (1.9 × 10 3 dof 256 time steps) -High kinetic coefficient: k = 5 day -1ε s 1 (%) ε s 2 (%) ε c1 (%) ε c3 (%) ε C (%)

	Iteration 0	100	100	100	100	100
	Iteration 1	20.9	9.1	31.7	72.2	25.7
	Iteration 2	4.7	4.2	27.3	74.5	21.1
	Iteration 4	1.9	3.4	22.2	71.6	18.5
	Iteration 8	0.8	1.3	17.8	68.8	14.8
	Iteration 16	0.6	0.8	16.8	57.7	12.3
	Iteration 32	0.2	0.6	16.3	53.2	10.7
	Iteration 64	0.2	0.6	16.0	55.7	10.1
	Iteration 128	0.1	0.5	15.7	60.7	9.9

Journal of Fluids Engineering. Received July 04, 2016; Accepted manuscript posted January 20, 2017. doi:10.1115/1.4035806 Copyright (c) 2017 by ASME

. Paper number: FE-16-1416, Corresponding author: Waeytens, Page 10

Table 3 .

 3 Chlorine reconstruction for the Navier-Stokes flow -Sensors 1 & 2 -Fine mesh (2.8 × 10 4 dof 1280 time steps) -Low kinetic coefficient: k = 0.5 day -1ε s 1 (%) ε s 2 (%) ε c1 (%) ε c3 (%) ε C (%)

	Iteration 0	100	100	100	100	100
	Iteration 1	18.6	7.9	22.4	74.5	27.5
	Iteration 2	4.9	7.9	13.8	74.4	23.5
	Iteration 4	2.4	5.2	11.6	70.4	21.7
	Iteration 8	1.7	4.0	9.4	63.8	19.0
	Iteration 16	1.1	2.6	7.1	54.5	15.2
	Iteration 32	0.8	1.3	4.8	42.4	10.8
	Iteration 64	0.4	0.7	3.3	30.0	7.1
	Iteration 128	0.2	0.4	2.5	22.7	5.2

Journal of Fluids Engineering. Received July 04, 2016; Accepted manuscript posted January 20, 2017. doi:10.1115/1.4035806 Copyright (c) 2017 by ASME

Paper number: FE-16-1416, Corresponding author: Waeytens, Page 11

Downloaded From: http://fluidsengineering.asmedigitalcollection.asme.org/pdfaccess.ashx?url=/data/journals/jfega4/0/ on 02/16/2017 Terms of Use: http://www.asme.org/about-

Acknowledgements

This research was supported by the French Inter-Ministry Fund (FUI) within the project "Smart Water Network", which involved several partners: Advitam, Ondeo Systems (Suez Environnement), EFS, A3IP, ESIEE Paris and IFSTTAR.

http://fluidsengineering.asmedigitalcollection.asme.org/pdfaccess.ashx?url=/data/journals/jfega4/0/ on 02/16/2017 Terms of Use: http://www.asme.org/about

Fluctuating boundary velocity

In this part, we aim to reconstruct the chlorine concentration for a highly-fluctuating flow, which represents the real flow in "distribution mains". Therefore, we consider the fluctuating boundary velocities presented in Fig. 12. The Navier-Stokes equations are still considered to be the reference model.

To save computation time, we reconstruct the concentration filed using the approximate flow and the coarse discretization to solve the transport-diffusion-reaction problems. The approximate flow corresponds to the reconstructed velocity field obtained using a similar inverse technique [START_REF] Waeytens | Inverse computational fluid dynamics: Influence of discretization and model errors on flows in water network including junctions[END_REF]. The results of the concentration reconstruction are given in Fig. 13. In the T-junction, introducing flow time fluctuations does not drastically reduce the accuracy of the reconstructed concentration. As in Fig. 11, the main aspect deteriorating the reconstructed concentration is the flow approximation using a simple model, i.e.

the modeling error of the flow.

Influence of the chlorine measurement error on the reconstructed concentration field

We analyze the capacity of the inverse technique to reconstruct the chlorine concentration field using realistic chlorine sensor outputs. We still consider the 2D water T-junction and the Navier-Stokes flow represented in Fig. 2. Herein, we use the exact flow (no uncertainty) and sensors S 1 and S 2 represented in Fig. 1. In the previous sections, we considered idealized sensor outputs, i.e. without noise. To test the proposed inverse method on realistic data, the chlorine sensor outputs are corrupted with random errors following a normal distribution N (µ, σ 2 ). This distribution might induce non physical negative values that have to be set to zero as it will be the case for a real chlorine sensor. In the first subsection, we consider a normal distribution with a null mean value N (0, σ 2 ). In the second subsection, we focus on a normal distribution with a null variance N (µ, 0) wich represents a measurement offset. In both subsections, we use the fine discretization (2.8 × 10 4 dof, 1280 time steps) to solve the direct and adjoint problems involved in the chlorine reconstruction technique. The mesh is given in Fig. 4. The quality of the reconstructed concentration field, when considering corrupted outputs, is shown in Fig. 15. We can observe that the quality of the reconstructed concentration does not deteriorate when the normal distribution of the noise has a variance less than 10 -5 g/l. Let us notice that a variance of 10 -5 g/l corresponds to 3% of the maximum chlorine concentration at sensor 1. At the 128 th iteration of the inverse problem, one has a 5% L 2 error between the reference and the reconstructed concentrations when we use the idealized outputs (σ = 0). This error reaches 10% when considering corrupted outputs with a noise variance of approximately 6% of the maximum chlorine concentration at sensor 1.

Noise normal distribution N (µ, 0) in the chlorine outputs

In real process, sensors may derive with time. To evaluate the sensitivity of the chlorine reconstruction technique to the bias induced by this derivation, we have added a constant offset µ to the idealized chlorine sensor outputs. The quality of the reconstructed chlorine field at each iteration of the inverse problem is given in Fig. 16 for different values of the offset µ. In this case, we can see that a 10 -5 g/l offset (3% of the maximum chlorine concentration at sensor 1) drastically deteriorates the quality of the reconstructed chlorine concentration. Indeed, the L 2 error between the reference and the reconstructed concentrations is approximately 10% at the 128 th iteration of the inverse problem, whereas the error is 5% with a null offset. To sum up, in view of reconstructing a relevant concentration field both measurement error and modelling error have to be reduced. There is no use considering a sophisticated model in the reconstruction process if the sensor outputs are of poor quality.

Conclusions

In the present paper, we studied the reconstruction of the chlorine concentration in a water pipe junction which is a key element of a water network. To achieve this purpose, boundary controls were determined to minimize the data misfit. An iterative approach based on the resolution of an adjoint problem was employed. The main goal was to study the influence of the concentration discretization errors, the uncertainty on the flow and the measurement noise on the reconstruction process.


Camille Coron

Sylvie Méléard

Denis

D Villemonais

Impact of demography on extinction/fixation events

Keywords: population dynamics and population genetics, demography and extinction, allelic fixation, diffusion processes, path integrability, diffusion absorption

Introduction -A demo-genetic model

This paper is motivated by concerns in conservation biology and more specifically by assessing conditions for the maintenance of biodiversity in populations facing extinction. Classical population genetics models like the Wright-Fisher model, the Moran model or the Wright-Fisher diffusion for instance assume a constant population size, which is then introduced as a key parameter of these models. In contrast, when conservation biology issues, one needs to understand the behaviour of populations facing extinction or composed with only a few individuals. Notably, specific phenomena such as inbreeding ( [START_REF] Byers | Do plant populations purge their genetic load? Effects of population size and mating history on inbreeding depression[END_REF]) and mutational meltdown ( [START_REF] Lynch | Mutation load and the survival of small populations[END_REF]), or changes in interactions between individuals ( [START_REF] Svanbck | Intraspecific competition drives increased resource use diversity within a natural population[END_REF]) are observed in small populations. To study these kinds of phenomena one therefore needs to consider models that allow to take into account and study the joint dynamics of both the demography and the genetic composition of a population. Our aim in this paper is more specifically to understand the impact of demography, and in particular of extinction, on allele extinction (or fixation).

We first study the dynamics of the progressive loss of genetic diversity in a classical population genetics context (constant population size) and second the impact of the fluctuations of population demography on genetic diversity. We consider a population composed of hermaphroditic diploid individuals characterized by their genotype at one locus presenting L possible alleles. The dynamics is modeled by a multidimensional diffusion process. The first study (Section 2) concerns the L-allelic diploid Wright-Fisher diffusion (see [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF], Chap. 10). We prove (Theorem 2.1) that in this model the alleles disappear successively until the fixation of a single last allele. Therefore fixed population size induces a progressive loss of genetic diversity. The proof is done by induction on L and is based on successive time changes and a criterion for perpetual integrals finiteness.

The rest of the article focuses on the impact of demography on genetic diversity. We introduce a diffusion process (N (t), X 2 (t), X 3 (t), ..., X L (t)) t≥0 giving the joint behavior of the population size and the proportions of types 2, 3, ..., L. Note that X 1 = 1 -L i=2 X i is the proportion af allele 1. This diffusion is derived from a slow-fast rescaling of a diploid multi-type birth and death process (see Appendix A). This individual-based model includes Mendelian reproduction, competition, and selection on birth, natural death and competition parameters. Since individuals are diploid, their genotypes are of the form ij where i, j ∈ {1, . . . , L}.

The infinitesimal generator of the considered diffusion process is given for (n, x 2 , ..., x L ) ∈ ]0, +∞) × {(x 2 , ..., x L ) ∈ [0, 1]; x 2 +...+x L ≤ 1} and any function f ∈ C 2 b ([0, +∞)×{(x 2 , ..., x L ) ∈ [0, 1]; x 2 +...+x L ≤ 1}, R) by

L 1 f (n, x 2 , ..., x L ) = n ρ -αn + 1≤i,j≤L s ij -n 1≤k,l≤L c ij,kl x k x l x i x j ∂f ∂n (n, x 2 , ..., x L ) + γn ∂ 2 f ∂n 2 (n, x 2 , ..., x L ) + L i=2   x i L j=1 L k=1
x j x k (s ik -s jk ) -n 1≤l,m≤L (c ik,ml -c jk,ml )x m x l   ∂f ∂x i (n, x 2 , ..., x L )

+ L i=2 γ x i (1 -x i ) 2n ∂ 2 f ∂x 2 i (n, x 2 , ..., x L ) - i =j∈[[2,N ]] γ x i x j 2n ∂ 2 f ∂x i ∂x j
(n, x 2 , ..., x L ).

(

) 1
Here x 1 = 1 -x 2 -... -x L is the proportion of allele 1, ρ ∈ R is the natural growth rate of genotype 11 and s ij quantifies the selective advantage of genotype ij for i, j ∈ {1, . . . , L} (the higher is s ij , the more advantageous is genotype ij); s 11 = 0 by convention. The parameter α + c ij,kl > 0 quantifies the competition pressure of genotype kl on genotype ij (for example due to limitation of resources) and c 11,11 = 0 by convention. The allelic diffusion parameter γ > 0 scales the speed at which birthand-death events occur. The existence and uniqueness properties of this process are given in Appendix A. The Model (1) dramatically generalizes the classical genetic models by considering an arbitrary number of alleles under different types of selection. Let us note the interplay between allelic repartition and demography through differences in competition parameters. In the mean field case with constant competition pressure (c ij,kl = 0 for any i, j, k, l), this model is a stochastically varying population size version of the general Wright-Fisher model introduced in [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF].

If s ij = 0 for all i, j ≥ 1, the model is neutral, since alleles are exchangeable.

If s ij = 1 2 (s i + s j ) for all i, j, which corresponds to additive selection, the generator becomes

L 1 f (n, x 2 , ..., x L ) = n ρ -αn + L i=2 s i x i ∂f ∂n (n, x 2 , ..., x L ) + γn ∂ 2 f ∂n 2 (n, x 2 , ..., x L ) + L i=2 x i s i - L j=1 x j s j ∂f ∂x i (n, x 2 , ..., x L ) + L i=2 γ x i (1 -x i ) 2n ∂ 2 f ∂x 2 i (n, x 2 , ..., x L ) - i =j∈[[2,N ]] γ x i x j 2n ∂ 2 f ∂x i ∂x j (n, x 2 , ..., x L ).
(

) 2
Let us note that this generator is close to the one we would obtain in an haploid case, except that the denominator 2n in the diffusion coefficients would be n, which changes the dynamics.

What is more, the system (1) writes as (2) with any s i replaced by S i defined by

S i = L k=1 s ik x k -n 1≤k,l,m≤L c ik,ml x m x l x k .
The coefficient S i is the true selective advantage of allele i in our general framework. It takes into account both diploid individual (genetic) selection and environmental pressure between individuals.

In Model [START_REF] Anderson | Continuous-time Markov chains[END_REF], population size goes almost-surely to 0 in finite time. We prove (Theorem 3.1) that, almost surely, the fixation of a (non given) single allele occurs before the extinction time and after the successive extinctions of the other alleles. The proof of this result is deduced from that of Theorem 2.1 using time changes and multi-dimensional Girsanov's transform.

The diffusion processes defined in (1) comes from a specific scaling in the individual-based initial model linking the population size and the demographic parameters in an allometric scale explained by the metabolic theory which relates the individuals characteristics and their mass (Cf. [START_REF] Brown | Toward a metabolic theory of ecology[END_REF], [START_REF] Salminen | Properties of perpetual integral functionals of Brownian motion with drift[END_REF], [START_REF] Foucart | Stable continuous stat branching processes with immigration and Beta-Fleming-Viot processes with immigration[END_REF]). This leads in the limit to systems in which the organisms with short lives and fast reproduction create a demographic stochasticity modeled by the diffusion (Cf Champagnat et al. [START_REF] Byers | Do plant populations purge their genetic load? Effects of population size and mating history on inbreeding depression[END_REF]). In the case where some specific density-dependence impacts the birth and death rates, we can obtain a different scaling leading to different population size diffusion coefficients. In Section 4 we explore the impact of the demography on allele fixation and therefore on the maintenance of biodiversity. In particular, we exhibit examples of population size dynamics for which extinction occurs before fixation of alleles with positive probability (Theorem 4.1 and Figures 1 and2). This result implies a maintenance of genetic diversity at all times, for the considered population, and shows the main influence of demographic stochasticity on biodiversity.

Our proofs and results repeatedly rely on the study of quantities of the form T0 0 f (Z s )ds (which are referred to as perpetual integrals [START_REF] Salminen | Properties of perpetual integral functionals of Brownian motion with drift[END_REF]), for a nonnegative (one-dimensional) diffusion process Z and T 0 its hitting time of 0, or T0∧T1 0 f (X s )ds, for a diffusion process X ∈ [0, 1] and T 0 , T 1 its hitting times of 0 and 1. More specifically, we need to know whether such integrals are finite or not. In Appendix B, we state and prove a general criterion involving a necessary and sufficient condition based on the scale function and speed measure of the nonnegative (one-dimensional) diffusion process Z, which ensures that the integral T0 0 f (Z s )ds is finite almost surely or infinite almost surely. Notation: -In the following the state space will be denoted by

S = ]0, +∞) × {(x 2 , ..., x L ) ∈ [0, 1]; x 2 + ... + x L ≤ 1}
and its interior will be denoted by

• S.
-We denote by T z the hitting time of z ∈ [0, +∞) by the process Z:

T z = inf{t ≥ 0, Z t = z}.
When the process Z has to be specified, this time will be denoted T Z z .

Successive fixations for the multi-allelic neutral Wright-Fisher diffusion

In this section we consider a neutral L-type Wright-Fisher diffusion (Ethier-Kurtz [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF], pp. 435 -439) describing the dynamics of the respective proportions of L alleles in a population with fixed size. We are interested in the study of alleles extinctions in this model.

Let us define by X i t the proportion of allele i in the population at time t. Since by definition

X 1 t + • • • + X L t = 1 for any time t, it is enough to study the dynamics of the process (X 1 t , • • • , X L-1 t
) t≥0 . The Wright-Fisher diffusion (see for example [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF]Chap. 10]) is a stochastic diffusion whose infinitesimal generator L 1 is defined for all (x 1 , ..

.x L-1 ) ∈ {(x 1 , ..., x L-1 ) ∈ [0, 1] L-1 ; x 1 + ... + x L-1 ≤ 1} and for all function f ∈ C 2 ({(x 1 , ..., x L-1 ) ∈ [0, 1] L-1 ; x 1 + ... + x L-1 ≤ 1}, R) by L 1 f (x 1 , • • • , x L-1 ) = L-1 i=1 x i (1 -x i ) ∂ 2 f ∂x 2 i (x 1 , • • • , x L-1 ) - i =j∈[[1,L-1]] x i x j ∂ 2 f ∂x i ∂x j (x 1 , • • • , x L-1 ). ( 3
)
Our aim is to prove the following theorem:

Theorem 2.1. (i) One of the L alleles is fixed almost surely in finite time, i.e. the random variable max i∈{1,••• ,L} X i is absorbed at 1 in finite time almost surely.

(ii) Till that time, the population experiences successive (and non simultaneous) allele extinctions.

The proof of this theorem is based on an induction argument and relies on two lemmas.

Lemma 2.2. Let Y be the process solution of

dY t = Y t (1 -Y t ) dB t ; Y 0 ∈ (0, 1),
where (B t , t ≥ 0) is a standard Brownian motion. Then, setting T 1 = inf{t ≥ 0, Y t = 1}, we have for any y ∈ (0, 1)

P y T1 0 1 1 -Y s ds = +∞ = 1. ( 4
)
Proof. It is well known that Y reaches 0 or 1 in finite time a.s.. The process is on natural scale and the speed measure on (0, 1) is given by m(dy) = 2dy y(1-y) . Setting f (y) = 1/(1 -y), we have

P y { T1 0 1 1 -Y s ds = +∞} ∩ {T 1 < T 0 } = P y T 1 < T 0 .
Since {T 1 = +∞} = {T 0 < T 1 } and 1/(1 -Y t ) = 1 for all t ≥ T 0 , we get the result.

Lemma 2.3. Let (X 1 (t), ..., X L-1 (t)) t≥0 be a L -1-dimensional Wright-Fisher diffusion process, let 1 -X L (t) = X 1 (t) + ... + X L-1 (t)
for all time t ≥ 0, and define the time change τ on [0, +∞) such that

τ (t) 0 1 1-X L (s) ds = t for all t ≥ 0 (see Lemma 2.2). Now let (Y 1 t , Y 2 t , ..., Y L-2 t ) t≥0 = X 1 1 -X L (τ (t)), ..., X L-2 1 -X L (τ (t)) t≥0 . The stochastic process (Y 1 t , Y 2 t , ..., Y L-2 t
) t≥0 is a L -2-dimensional Wright-Fisher diffusion process.

Proof of Lemma 2.3. Let us denote by L the infinitesimal generator of the L -1-dimensional diffusion process ( X 1 1-X L (t), X 2 1-X L (t), ..., X L-2 1-X L (t), 1 -X L (t)) t≥0 . For any real-valued twice differentiable function

f defined on {(x 1 , ..., xL-2 , 1 -x L ) ∈ [0, 1] L-1 ; x1 + ... + xL-2 ≤ 1}, we may write for x L = 1, Lf (x 1 , ..., xL-2 , 1 -x L ) = L 1 (f • g)(x 1 , ..., x L-1 ),
where (x 1 , ..., xL-2 , 1 -x L ) = g(x 1 , ..., x L-1 ) and, for any (x 1 , ..

.x L-1 ) ∈ [0, 1] L-1 such that 0 < x 1 + ... + x L-1 ≤ 1 g(x 1 , ..., x L-1 ) = x 1 x 1 + ... + x L-1 , ..., x L-2 x 1 + ... + x L-1 , x 1 + ... + x L-1 .
Therefore, we obtain from Equation (3) that for

x L = 1, Lf (x 1 , x2 , ..., xL-2 , 1 -x L ) = L-2 j=1 γ xj (1 -xj ) 1 -x L ∂ 2 f ∂ x2 j (x 1 , x2 , ..., xL-2 , 1 -x L ) - j =k∈[[1,L-2]] γ xj xk 1 -x L ∂ 2 f ∂ xj ∂ xk (x 1 , x2 , ..., xL-2 , 1 -x L ) + γx L (1 -x L ) ∂ 2 f ∂(1 -x L ) 2 (x 1 , x2 , ..., xL-2 , 1 -x L )
which gives the result since dτ (t) = (1 -X L (t))dt.

Proof of Theorem 2.1. We prove both results by induction on L. (i) is a well known result in the case L = 2. Now for L alleles, note that the proportion of allele 1 follows a 1-dimensional Wright-Fisher diffusion. Therefore allele 1 gets fixed or disappears almost surely in finite time. If allele 1 gets fixed then one of the L alleles gets fixed. If allele 1 gets lost then from its (almost surely finite) extinction time, the population follows a L -1-type Wright-Fisher diffusion, therefore one of the L -1 remaining alleles gets fixed almost surely in finite time, using the induction assumption.

We now prove (ii) (which is trivial when L = 2). We have

T L 1 0 1 1-X L s ds = +∞ from Lemma 2.2.
Let us consider the time change τ (t), defined for all t ∈ [0, +∞) by

τ (t) 0 1 1-X L s ds = t. Note that for t ∈ [0, +∞), X L (τ (t)) < 1.
Therefore we can define the stochastic process

Y t = (Y 1 t , . . . , Y L-2 t ) t≥0 such that Y i t = X i 1-X L (τ (t)) for all 1 ≤ i ≤ L -2 and for any t ∈ [0, +∞). From Lemma 2.3, the stochastic process (Y 1 t , Y 2 t , ..., Y L-2 t
) t≥0 is a L -2 dimensional Wright-Fisher diffusion process. By induction assumption, this diffusion process experiences L -2 successive and non simultaneous extinctions, at times denoted by

S Y 1 < ... < S Y L-2 < +∞. Therefore τ (S Y 1 ) < ... < τ (S Y L-2 ) < τ (+∞) = T L 1 . Under the event { T L 1 < +∞}, the times τ (S Y 1 ), ..., τ (S Y L-2
) and T L 1 correspond to the L -1 extinction times experienced by the population, which gives the result, since

P(∪ L i=1 {T i 1 < +∞}) = 1 from (i).
3 Long time behavior of the diffusion process (1)

In this section, we focus on the stochastic diffusion process (N (t), X 2 (t), X 3 (t), ..., X L (t)) t≥0 whose infinitesimal generator is given in (1) and whose existence is obtained by the scaling limit of a multi-type birth-and-death process (see Appendix A, Theorem A.4 for existence and uniqueness). Here the genetic dynamics of the population depends on both the selection and the competition between individuals, and the population size dynamics depends on the allelic repartition. The following theorem generalizes the results obtained in Theorem 2.1, to this very general class of demogenetics models. The main intuition (for the proof) is that the speed of allelic extinctions is inversely proportional to population size. So we introduce an appropriate time change to compensate the population size variability.

Theorem 3.1. (i) The population size process (N (t)) t≥0 is absorbed at 0 (extinction of the population) almost surely in finite time.

(ii) One of the allele will eventually get fixed before the extinction of the population, almost surely.

(iii) Till that time, the population experiences successive (and not simultaneous) allele extinctions.

Proof. (i) From (1), using that x i ∈ [0, 1] for all i, and setting ρ = sup i,j {ρ + s ij } and α = inf i,j,k,l {α + c ij,kl }, one can easily see that the process (N (t)) t≥0 is stochastically dominated by the logistic Feller diffusion process (N (t)) t≥0 satisfying dN t = N t (ρ -αN t )dt + 2γN t dB t which is known to reach 0 almost surely in finite time ( [START_REF] Ikeda | Stochastic differential equations and diffusion processes[END_REF], Chapter VI.3).

(ii) and (iii). We first use a multi-dimensional Girsanov transform to reduce the study to the neutral diffusion process (for which s ij = c ij,kl = 0 for all i, j, k, l). We introduce an appropriate time change to compensate the population size variability. That allows us to deduce the long time behavior of the diffusion process (1) from that of the classical Wright-Fisher diffusion process, obtained in Theorem 2.1.

The infinitesimal generator (1) writes

L 1 f (n, x 2 , ..., x L ) = n ρ -αn + 1≤i,j≤L s ij -n 1≤k,l≤L c ij,kl x k x l x i x j ∂f ∂n (n, x 2 , ..., x L ) + γn ∂ 2 f ∂n 2 (n, x 2 , ..., x L ) + L i=2 b i (n, x 2 , ..., x L ) ∂f ∂x i (n, x 2 , ..., x L ) + 1 2 i,j∈[[2,N ]] a(n, x 2 , ..., x L ) ij ∂ 2 f ∂x i ∂x j (n, x 2 , ..., x L ),
where the diffusion matrix a(n, x 2 , x 3 , ..., x L ) satisfies for i

= j a(n, x 2 , x 3 , ..., x L ) ii = γ x i (1 -x i ) n and a(n, x 2 , x 3 , ..., x L ) ij = -γ x i x j n .
Remark that this matrix is related to the covariance matrix of a L-1-dimensional multinomial (n,

x 2 , x 3 , ..., x L ) vector Y : a(n, x 1 , ..., x L ) = γCov((Y 2 , ..., Y L )/n).
Therefore it is a symmetric positive semi-definite matrix. The vector b is defined by

b i (n, x 2 , ..., x L ) = x i L j=1 L k=1 x j x k (s ik -s jk ) -n 1≤l,m≤L (c ik,ml -c jk,ml )x m x l .
We first prove that for all (n, x 2 , ..

., x L ) ∈ • S, a(n, x 2 , ..., x L ) is an invertible matrix. Lemma 3.2. Assume that n = 0, then det(a) = 1 n L-1 1 - L i=2 x i L i=2 x i .
Proof. It is well known that det(a) is a polynomial of degree less than 2L -2. It is obvious that any x i , i = 2, . . . ,L, is a factor of det(a). Moreover adding all columns, we also obtain that (1 -L i=2 x i ) = x 1 factorizes det(a). The derivative of det(a) is of degree one in any variable x i , since it is a multilinear form on its columns whose derivatives are of degree one. The conclusion follows by computing the determinant with x i = 1/L (which allows us to check that the value of the dominating constant is 1/n L-1 ).

We remark that a(n, x 2 , ..., x L ) = ã(x 2 , ..., x L )/n where the second derivative of ã is bounded. Then from Theorem 5.2.3 of Stroock-Varadhan [START_REF] Stroock | Multidimensional diffusion processes[END_REF], there exists a Lipschitz square root σ of the matrix ã.

Let us note that b

i (n, x 2 , ..., x L ) = x i (S i - L j=2 S j x j ) where S i (n, x 2 , ..., x L ) = L k=1 s ik x k -n k,l,m c ml,ik x m x l x k .
We have the remarkable identity: If Σ denotes the vector of coordinates

S i (n, x 2 , ..., x L ), i = 2, . . . ,L, then a(n, x 2 , ..., x L ).Σ = γ n b(n, x 2 , ..., x L ). (5)
Then for (n, x)

∈ • S, σ -1 (n, x 2 , ..., x L )b(n, x 2 , ..., x L ) 2 =< b(n, x 2 , ..., x L ), a -1 (n, x 2 , ..., x L )b(n, x 2 , ..., x L ) > = n γ < b(n, x 2 , ..., x L ), Σ > .
Therefore there exists a constant C > 0 such that for all (n, x 2 , ..., x L ) ∈ S,

σ -1 (n, x 2 , ..., x L )b(n, x 2 , ..., x L ) 2 ≤ C (1 + n 2 ). (6)
Let (N, X 2 , ..., X L ) be solution to the stochastic differential system

dN t = √ γN t dB 1 t + N t ρ -αN t + L i=2 S i (N t , X 2 t , ..., X L t ) X i t dt dX t = σ(N t , X t ) dB t + b(N t , X t )dt ; (N 0 , X 0 ) ∈ • S (7)
where X = (X 2 , ..., X L ) and B 1 and B are two independent Brownian motions respectively one and L -1-dimensional. The system is well defined as soon as the solutions stay in • S and then for any time

t < T N 0 ∧ T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 , where X 1 = 1 -X 2 -... -X L . We now use the following L-dimensional Girsanov transformation ([16], p. 192). Let us introduce k ∈ N and define τ k = T N 0 ∧ T N k ∧ T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 .
We introduce the exponential martingale E(M ) t∧τ k where for any t ≤ τ k ,

M t = - L i=2 S i (N s , X 2 s , ..., X L s ) t 0 X i s N s γ dB 1 s + L i=2 t 0 σ -1 (N s , X 2 s , ..., X L s ) b(N s , X 2 s , ..., X L s )dB s .
For each k, the martingale E(M ) t∧τ k is uniformly integrable, thanks to [START_REF] Champagnat | A microscopic interpretation for adaptive dynamics trait substitution sequence models[END_REF]. Under the probability

Q such that dQ dP | Ft = E(M ) t , the process ( B 1 , B) = (B 1 -B 1 , M , B -B, M
) is a L-dimensional Brownian motion, and the process (N, X 2 , ..., X L ) is solution to the stochastic differential system

dN t = √ γN t d B 1 t + N t ρ -αN t dt dX t = σ(N t , X t ) d B t ; (N 0 , X 0 ) ∈ • S, (8)
for t < τ k . The end of the proof of (ii) and (iii) consists in using a time change in order to apply Theorem 2.1 (i) and (ii). Using Example 2 in Section B, we know that

T N 0 0 γ 2N s ds = +∞
a.s. Hence we can define the time change τ (t) defined for all t ∈ [0, +∞) as the unique positive real number satisfying

τ (t) 0 γ 2N s ds = t. (9)
In particular, τ is increasing and, under Q, the process defined for any t by Xt = X τ (t) is a Markov process whose generator is given in (3). Since τ (•) is increasing, we deduce that, Q-almost surely,

T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 = τ (T X1 0 ∧ T X2 0 ∧ ... ∧ T XL 0 )
and that, up to a Q-negligible event,

T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 < T N 0 = T X1 0 ∧ T X2 0 ∧ ... ∧ T XL 0 < +∞ .
Using Theorem 2.1, we deduce that

Q T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 < T N 0 = 1.
Hence, one has

P T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 < T N 0 = lim k→+∞ P T X 1 0 ∧ T X 2 0 ∧ ... ∧ T X L 0 < T N k ∧ T N 0 = lim k→+∞ E Q 1 T X 1 0 ∧T X 2 0 ∧...∧T X L 0 <T N k ∧T N 0 E(-M ) T N k ∧T N 0 ≥ lim k→+∞ E Q 1 T N 0 <T N k E(-M ) T N k ∧T N 0 = lim k→+∞ P T N 0 < T N k = 1.
Using the same induction argument as in the proof of Theorem 2.1, this concludes the proof of (ii) and (iii) and hence of Theorem 3.1.

Demography and maintenance of biodiversity

The general demogenetics model ( 1) was obtained from a specific scaling of the parameters in the individual-based model. Other scalings will lead to different coefficients. In particular we can generalize the linear form of the size diffusion coefficient (Feller diffusion). Our aim in this section is to emphasize the importance of the variance effects, both in the demographic and in the genetic part of the system, on the long time behavior. The main question is whether one allele gets fixed almost surely before the population goes extinct. We will see that it depends on the behavior of the diffusion coefficient near extinction in the equation satisfied by the population size. The next theorem notably highlights the major effect of the demography on the maintenance of genetic diversity by giving a necessary and sufficient criterion ensuring almost sure fixation before extinction.

For simplicity we consider in this section the bi-allelic framework.

Let us consider the process (N t , X t ) t≥0 solution to the system of stochastic differential equations

dN t = σ(N t ) dB t + N t (ρ -αN t )dt, N 0 > 0, α > 0 dX t = Xt(1-Xt) f (Nt) dW t , t < T N 0+ , (10)
where B, W are independent one-dimensional Brownian motions, σ : (0, +∞) → (0, +∞) is locally Lipschitz and f : (0, +∞) → (0, +∞) is locally bounded away from 0 and where

T N 0+ := lim n→+∞ T N 1/n .
Note that lim inf x→0 f (x) can be null or not, nevertheless the former case is more interesting and biologically motivated (see [START_REF] Coron | Slow-fast stochastic diffusion dynamics and quasi-stationarity for diploid populations with varying size[END_REF]). Note also that the system admits a pathwise unique strong solution, as will be explained in the proof of the following theorem (if σ is only locally Hölder continuous, an adaptation of our proof leads to the weak existence and pathwise uniqueness of a solution to this system, so that the following result remains valid).

In particular, if f is the identity function, the behavior of σ(N ) near extinction plays a main role. Whereas for the usual demographic term σ(N ) = √ N (studied in the previous sections), fixation occurs almost surely before extinction, a small perturbation of this diffusion term, taking for example σ(N ) = N (1-ε)/2 , ε > 0, leads to extinction before fixation with positive probability. An example of trajectory for which fixation does not occur before extinction is given in Figure 1, and the effect of ε on the probability of extinction before fixation is numerically studied in Figure 2.

Note that the demographic term σ(N ) =

√

N can be explained from an individual-based stochastic system in a case of large size combined with accelerated birth and death. This corresponds to population dynamics with allometric demographies whose time scale is explained by the metabolic theory which relates the individuals characteristics and their mass (Cf. [START_REF] Brown | Toward a metabolic theory of ecology[END_REF], [START_REF] West | The fourth dimension of life : fractal geometry and allometric scaling of organisms[END_REF], [START_REF] Gillooly | Effects of size and temperature on metabolic rate[END_REF]). This leads in the limit to systems in which the organisms with short lives and fast reproduction create a demographic stochasticity modeled by the Brownian part (Cf Champagnat et al. [START_REF] Champagnat | Unifying evolutionary dynamics: from individual stochastic processes tomacroscopic models[END_REF]). In the case where some specific density-dependence impacts the birth and death rates, we can obtain, in the limit of large population, a demographic term of the form σ(N ) = N (1-ε)/2 , ε > 0. For the mathematical statement of such limits, we refer to Bansaye-Méléard [START_REF] Bansaye | Stochastic models for structured populations[END_REF].

such that dNt = N (1-ε) t dB 1 t + Nt(r -cNt)dt and dXt = X t (1-X t ) N t
, with r = -1 and c = 0.1. We plot the number of simulations for which fixation does not occur before extinction.

Proof. Let us first prove that the system (10) admits a unique (strong) solution up to time T N 0+ , which in particular implies the strong Markov property used in the sequel. Given B and W , for all n ≥ 1, there exists a pathwise unique strong solution N n to the equation dN n t = σ(N n t ) dB t + N n t (ρ -αN n t )dt for all time t < T N 1/n := inf{s ≥ 0, N n s ≤ 1/n} (this is an immediate consequence of Theorem 3.11 p.300 in [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF]). Setting N t = N n t for all t ∈ [T N 1/n , T N 1/n+1 ), one obtains a pathwise unique strong solution to dN t = σ(N t ) dB t + N t (ρ -αN t )dt up to time T N 0+ (in the case where σ is only Hölder continuous, weak existence holds true, see for instance in Section 12.1 of [START_REF] Champagnat | General criteria for the study of quasi-stationarity[END_REF]).

We define the random number

T max = T N 0+ 0 1 f (N s ) ds
and the time change τ (t), for all t ∈ [0, T max ), as the unique positive real number satisfying

τ (t) 0 1 f (N s ) ds = t.
In particular, τ is increasing and T N 0+ = τ (T max ). We define Wt := τ (t) 0 1 f (Ns) dW s for all t < T max (which is a standard Brownian motion), and consider Xt the unique strong solution to

d Xt = Xt (1 -Xt ) d Wt , X0 = X 0 , t ∈ [0, T max )
(strong existence and pathwise uniqueness of such a solution is a consequence of Proposition 2.13 p.291 of [START_REF] Karatzas | Brownian motion and stochastic calculus[END_REF]). Then the process

X t := X τ -1 (t) is a strong solution to dX t = Xt(1-Xt) f (Nt)
dW t for all t < T N 0+ . Pathwise uniqueness up to time T N 1/n,n := inf{t ≥ 0, N t / ∈ [1/n, n]} for all n ≥ 1 is proved using the same approach as in the proof of Theorem 3.8 p.298 of [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF], using the fact that inf y∈[1/n,n] f (y) > 0. Since lim n→+∞ T N 1/n,n = T N 0+ almots surely, one concludes that the system (10) admits a pathwise unique strong solution.

We denote by TF = inf{t > 0, Xt ∈ {0, 1}} the (possibly infinite) absorption time of X.

Assume first that 0+ y σ 2 (y)f (y) dy = +∞. In this case, using [START_REF] Mijatovic | Convergence of integral functionals of one-dimensional diffusions[END_REF], we note that s(y) ∼ y→0 y s (y). Hence T max = +∞ by Corollary B.3, and X reaches 0 or 1 in finite time almost surely. Then, T F = τ ( TF ) < τ (T max ) = T N 0+ (i.e. fixation occurs before extinction) almost surely.

Assume now that 0+ y σ 2 (y)f (y) dy < +∞. In this case T max < +∞ with probability one by Corollary B.3. Let W be a Brownian motion independent from B and consider X the solution to the SDE

d X t = X t (1 -X t ) d W t , X 0 = X 0 .
We define for t < T N 0+ the time changed X t = X τ -1 (t) , so that (N, X ) is solution to the SDE system [START_REF] Engelbert | On Functionals of a Wiener Process with Drift and Exponential Local Martingales[END_REF] and hence, by uniqueness in law of the solution to this system, (N, X ) and (N, X) have the same law. Since (N, X ) and (N, X) can be obtained as the same function of (N, X ) and (N, X) respectively, we deduce that they share the same law up to time T max . Then we have P(X t ∈ (0, 1) ∀t < T N 0+ and X T N 0+ -exists in (0, 1)) = P( Xt ∈ (0, 1) ∀t < T max and XTmaxexists in (0, 1)) = P( X t ∈ (0, 1) ∀t < T max and X Tmax-exists in (0, 1)) > 0, since N and X are independent and X is a Wright-Fisher diffusion. This concludes the proof, since {X t ∈ (0, 1), ∀t < T N 0+ and X T N 0+ -exists in (0, 1)} ⊂ {T N 0+ < T F }, therefore P(T N 0+ < T F ) > 0.

Acknowledgements: This work was partially funded by the Chair "Modélisation Mathématique et Biodiversité" of VEOLIA-Ecole Polytechnique-MnHn-FX and also supported by public grants as part of the "Investissement d'avenir" project, reference ANR-11-LABX-0056-LMH, LabEx LMH, and reference ANR-10-CAMP-0151-02, FMJH, and by the Mission for Interdisciplinarity at the CNRS.

A Derivation of the generator (1) from an individual-based model A.1 The model

We consider a population of diploid hermaphroditic organisms, characterized by their genotype at one locus. There exist L versions (alleles) of the gene at this locus and we denote by 1, 2,.., L, these alleles. Individuals can then have genotype ij for all i and j in [ [1, L]] (genotypes ij and ji are not distinguished), and we study the dynamics of the respective numbers of individuals with each genotype. We introduce a scaling parameter K ∈ N\{0} that scales the initial population size and goes to infinity. The population is then represented at any time t ≥ 0 by a symmetric positive matrix with size L, whose coefficients belong to Z + /2K:

N K (t) = (n K ij (t)) 1≤i,j≤L , where for all i ∈ [[1, L]], n K ii (t) ∈ Z + /K
i = j ∈ [[1, L]], n K ij (t) + n K ji (t) = 2n K ij (t) ∈ Z + /K
is the number of individuals with genotype ij at time t, divided by K. For any time t, and for all K, N K (t) belongs to the space S L ([0, +∞)) of symmetric matrices with positive real-valued coefficients.

Notation A.1. For any matrix ν = (ν ij ) 1≤i,j≤L ∈ S L ([0, +∞)), we define ν {ii} = ν ii and ν {ij} = 2ν ij for all i = j.

We assume that the population follows a non-linear birth-and-death process with Mendelian reproduction and competition whose jump rates will be given later.

The following quantities play a main role in this study:

• N K (t) = i,j∈[[1,L]] n K ij (t)
is the rescaled population size at time t,

• n K i (t) = 2 L j=1 n K ij (t)
is the rescaled number of occurrences of allele i at time t,

• x K i (t) = n K i (t) 2N K (t) = j n K ij (t) i,j n K ij (t)
is the proportion of alleles i at time t,

• x K ij (t) = n K {ij} (t) N K (t)
is the proportion of genotypes ij at time t,

• K ij (t) = x K i (t)x K j (t)- x K ij (t) 2
is called the deviation of the population from Hardy-Weinberg structure, for genotype ij with i = j.

For all n = (n ij ) i,j∈[[1,L]] ∈ S L ([0, +∞)) \ 0, we set for all i = j, ψ ij (n) = ij = ( k n ik )( l n jl ) i,j n ij 2 - n ij i,j n ij .
We obtain the following result:

Lemma A.2. For all n = (n ij ) i,j∈[[1,L]] ∈ S L ([0, +∞)) \ 0, let us define φ 1 (n) = L i,j=1 n ij ; φ i (n) = j n ij i,j n ij for all i ∈ [[2, L]], (φ L+1 (n), ..., φ L(L+1)/2 (n)) = ((ψ 1j (n)) 1<j≤L , (ψ 2j (n)) 2<j≤L , ..., ψ (L-1)L (n))
The function

φ : S L ([0, +∞)) \ 0 → φ(S L ([0, +∞)) \ 0) n → φ(n) = φ 1 (n), ..., φ L(L+1) 2 (n) is a bijection. Proof. Setting x 1 = 1 -x 2 -x 3 -... -x L , we get that (n, x 2 , x 3 , ..., x L , ( 1j ) 1≤i<j≤L , ( 2j ) 2≤i<j≤L , ..., (L-1)L ) = φ(x)
if and only if n ij = n(x i x jij ) for all i = j, and

n ii = n(x i ) 2 + j =i ij ,
which gives the result.

For all i, j ∈ [[1, L]], we now denote by e ij the square matrix with size L such that for all k, l ∈

[[1, L]], e ij (k, l) = δ (k,l) (i,j) +δ (k,l) (j,i)

2

. Individuals experience panmictic Mendelian reproduction. Therefore, for all i < j ∈ [[1, L]], as long as the total population size 1≤i,j≤L

n ij = n = 0, the rate λ K ij (n) (resp. λ K ii (n)) at which the stochastic process N K jumps from n = (n ij ) i,j∈[[1,L]] ∈ S L ([0, +∞)) to n + e ij /K (resp. n + e ii /K) is given by: λ K ij (x) = 2Kb K ij nx i x j λ K ii (x) = Kb K ii nx 2 i , (12)
where b K ij ∈ [0, +∞) for all i ≤ j ∈ [ [1, L]]. These birth rates are naturally all equal to 0 if n = 0. Each individual can die either naturally or due to the competition with other individuals. More precisely, for all i ≤ j ∈ [ [1, L]], the rate µ K ij (x) at which the stochastic process

X K jumps from x = (x ij ) i,j∈[[1,L]] ∈ S L ([0, +∞)) to x -e ij /K, is given by µ K ij (x) = K   d K ij + K 1≤k,l≤L c K ij,kl x kl   x {ij} , (13)
where ) is the intrinsic death rate of an an individual with genotype ij, and c K ij,kl ∈ ]0, +∞) is the rate at which a given individual with genotype ij dies due to the competition with a given individual with genotype kl (we have used Notation A.1). We obviously assume that c K ij,kl = c K ij,lk = c K ji,kl for all i, j, k, and l, since the two genotypes ij and ji are indistinguishable.

d K ij ∈ [0, +∞
Note that for all K ∈ N\{0}, the pure jump process X K is well-defined for all time t ∈ [0, +∞). Indeed, the process (N K (t), t ≥ 0) is stochastically dominated by a logistic birth-and-death process N K with birth, intrinsic death and competition parameters respectively equal to sup

i,j b K ij < +∞, inf i,j d K ij and inf i,j,k,l
c K kl,ij > 0, which, from Chapter 8 of [START_REF] Anderson | Continuous-time Markov chains[END_REF], does not explode, almost surely. The stochastic process (X K (t), t ≥ 0) is therefore a pure jump process with values in S L (R + ) (endowed with the distance r such that r(x, y) = max i,j |x ij -y ij |, for instance), absorbed at 0, and defined for all t ≥ 0 by

X K t = X K 0 + 1≤i≤j≤L t 0 e ij K 1 {θ≤λ K ij (X K s -)} η ij 1 (ds, dθ)- t 0 e ij K 1 {θ≤µ K ij (X K s -)} η ij 2 (ds, dθ)
where the measures η ij k for i ≤ j ∈ [ [1, L]] and k ∈ {1, 2} are independent Poisson point measures on [0, +∞)

2 , with intensity dsdθ. For all K, the law of X K is then a probability measure on the space of trajectories D([0, +∞), S L ([0, +∞))) which is the space of càd-làg functions, from [0, +∞) to S L ([0, +∞)), endowed with the Skorokhod topology. The extended generator L K of (X K (t), t ≥ 0) satisfies, for all measurable function f from S L ([0, +∞)) to R, and for all x ∈ S L ([0, +∞)):

L K f (x) = 1≤i≤j≤L λ K ij (x) f x + e ij K -f (x) + µ K ij (x) f x - e ij K -f (x) , (14)
where the rates λ K ij (x) and µ K ij (x) have been defined in Equations ( 12) and ( 13) for all i ≤ j.

A.2 Slow-fast dynamics

We now study the convergence of the sequence of stochastic processes (X K (t), t ≥ 0) K∈N\{0} toward a slow-fast stochastic diffusion dynamic, as done in [START_REF] Coron | Slow-fast stochastic diffusion dynamics and quasi-stationarity for diploid populations with varying size[END_REF]. To this aim, demographic parameters must be properly rescaled, according to the following assumptions, for γ > 0:

b K ij = γK + β ij ∈ ]0, +∞), d K ij = γK + δ ij ∈ [0, +∞), and c K ij,kl = α ij,kl K ∈ ]0, +∞).
Besides, we assume that there exists a constant C < ∞ such that sup

K E((N K (0)) 3 ) ≤ C. (15)
Then, from Lemma 1 of [START_REF] Champagnat | A microscopic interpretation for adaptive dynamics trait substitution sequence models[END_REF] and the proof of Theorem 5.3 of [START_REF] Fournier | A microscopic probabilistic description of a locally regulated population and macroscopic approximations[END_REF]:

(i) There exists a constant C > 0 such that sup K sup t≥0 E((N K (t)) 3 ) ≤ C.
(ii) For all T < +∞, there exists a constant C T such that sup

K E sup t≤T (N K (t)) 3 ≤ C T .
The following proposition gives the convergence of the fast variables (( K ij (t)) 1≤i<j≤L , t ≥ 0) toward 0 and is an extension of Proposition 3.2 of [START_REF] Coron | Slow-fast stochastic diffusion dynamics and quasi-stationarity for diploid populations with varying size[END_REF] for a larger number of alleles. The proof of this result can be found in [START_REF] Coron | Stochastic modeling and eco-evolution of a diploid population. PhD thesis under the supervision of Sylvie Méléard[END_REF], Chapter 4, Appendix A.

Proposition A.3. Under the Hypothesis [START_REF] Gillooly | Effects of size and temperature on metabolic rate[END_REF], for all times s, t > 0 and for all i

= j ∈ [[1, L]], sup t≤u≤t+s E(( K ij (u)) 2 ) → 0 when K goes to infinity.
We next study the asymptotic behavior of the sequence of stochastic processes constituted of the remaining variables (N K (t), x K 2 (t), x K 3 (t), ..., x K L (t)) t≥0 introduced in Lemma A.2, when K goes to infinity. For more simplicity, we first consider the sequence of stochastic processes ((n K 1 (t), n K 2 (t), ..., n K L (t)) t≥0 ) K∈N\{0} giving the respective numbers of occurrences of the different alleles, whose dynamics are simpler. The proof of the following can be found in [START_REF] Coron | Stochastic modeling and eco-evolution of a diploid population. PhD thesis under the supervision of Sylvie Méléard[END_REF], Chapter 4, Appendix A and is a generalization of the proof of Theorem 1 in [START_REF] Coron | Slow-fast stochastic diffusion dynamics and quasi-stationarity for diploid populations with varying size[END_REF].

Theorem A.4. Under (15), if the sequence (n K 1 (0), n K 2 (0), ..., n K L (0)) K∈N\{0} converges in law toward a random variable (n 1 (0), n 2 (0), ..., n L (0)) ∈ [0, +∞)
L when K goes to infinity, then for all T > 0, the sequence of stochastic processes

((n K 1 (t), n K 2 (t), ..., n K L (t)), t ∈ [0, T ]) converges in law in D([0, T ], [0, +∞) L ) when K goes to infinity, toward a time-continuous diffusion process ((n 1 (t), n 2 (t), ..., n L (t)), t ∈ [0, T ])
starting from (n 1 (0), n 2 (0), ..., n L (0)), which is the unique continuous solution of the martingale problem: 16)

g(n 1 (t), n 2 (t), ..., n L (t)) -g(n 1 (0), n 2 (0), ..., n L (0)) - t 0 Lg(n 1 (s), n 2 (s), ..., n L (s))ds (
is a martingale for all function g ∈ C 2 b ([0, +∞) L , R) where L satisfies Lg(n 1 , ..., n L ) = L i=1 ∂g ∂n i (n)   L j=1   β ij -δ ij - k,l α ij,kl n k n l 2 k n k   n i n j k n k   + γ L i=1 ∂ 2 g ∂n 2 i (n) (n i ) 2 k n k + n i + γ i<j ∂ 2 g ∂n i ∂n j (n) 2n i n j k n k (17)
for all point n = (n 1 , ..., n L ) of [0, +∞) L .

Note that the diffusion coefficients of the generator L go to 0 when the total k n k goes to 0. The system of equations ( 16) and ( 17) admits a unique strong solution up to time T = inf{t > 0, n 1 (t) + n 2 (t) + ... + n L (t) ≥ }. Then from Theorem 6.2, Chapter 4 of [START_REF] Ethier | Markov Processes. Characterization and convergence[END_REF], it admits a unique strong solution up to time T 0+ = lim →0 T .

From Theorem A.4, we deduce for all > 0 the convergence of the sequence of stochastic processes (N K (t), x K 2 (t), x K 3 (t), ...x K L (t)) t≥0 stopped when N K (t) ≤ , toward a L-dimensional diffusion process (N (.), x 2 (.), ..., x L (.)) .∧T , stopped when N (t) ≤ : Corollary A.5. For all > 0 and T > 0, let us define

T K = inf{t ∈ [0, T ] : N K (t) ≤ }. If the sequence of random variables (N K (0), x K 2 (0), x K 3 (0), ...x K L (0)) ∈ [ , +∞[×[0, 1] L-1
converges in law when K goes to infinity, toward a random vector (N (0), x 2 (0),

x 3 (0), ...x L (0)) ∈] , +∞[×[0, 1] L-1 , then the sequence of stopped stochastic processes {(N K (t∧T K ), x K 2 (t∧T K ), x K 3 (t∧T K ), ..., x K L (t∧T K )) 0≤t≤T } K≥1 converges in law in D([0, T ], [ , ∞[×[0, 1] L-1 ) when K goes to infinity, toward a continuous diffusion process (N (t ∧ T ), x 2 (t ∧ T ), ..., x L (t ∧ T )) 0≤t≤T stopped at time T = inf{t ∈ [0, T ] : N t = }, starting from (N (0), x 2 (0), x 3 (0), ...x L (0)) and whose infinitesimal generator L 1 is defined for all function f ∈ C 2 b ([ , ∞[×[0, 1] L-1 , R) by L 1 f (n,x 2 , ..., x L ) = n   1≤i,j≤L   β ij -δ ij - 1≤k,l≤L α ij,kl nx k x l   x i x j   ∂f ∂n (n, x 2 , ..., x L ) + γn ∂ 2 f ∂n 2 (n, x 2 , ..., x L ) + L i=2 x i L j=1 L k=1 x j x k (β ik -β jk ) -(δ ik -δ jk ) - 1≤l,m≤L (α ik,ml -α jk,ml )nx m x l ∂f ∂x i (n, x 2 , ..., x L ) + L i=2 γ x i (1 -x i ) 2n ∂ 2 f ∂x 2 i (n, x 2 , ..., x L ) - i =j∈[[2,N ]] γ x i x j 2n ∂ 2 f ∂x i ∂x j (n, x 2 , ..., x L )
The link with the generator (1) can be seen by setting ρ = β 11 -δ 11 ,

s ij = (β ij -δ ij ) -(β 11 -δ 11 ), α = α 11,

B Integrability properties for diffusion processes

Proofs of Theorems 2.1, Lemmas 2.2, 2.3 and Theorem 3.1 rely on the integrability of paths of diffusion processes. This section is devoted to the statement and the proof of a criterion for such integrability (Theorem B.2). More precisely, this result states that, depending on the behavior of the diffusion and drift coefficients near absorption, the integral of the paths of diffusion processes are either almost surely finite or almost surely infinite. This 0-1 law criterion has already been proved by various methods, using a combination of the local time formula and Ray-Knight Theorem [START_REF] Engelbert | Integral functionals of strong Markov continuous local martingale[END_REF][START_REF] Mijatovic | Convergence of integral functionals of one-dimensional diffusions[END_REF][START_REF] Khoshnevisan | A note on a.s. finiteness of perpetual integral functionals of diffusions[END_REF] (see also [START_REF] Engelbert | On Functionals of a Wiener Process with Drift and Exponential Local Martingales[END_REF][START_REF] Foucart | Stable continuous stat branching processes with immigration and Beta-Fleming-Viot processes with immigration[END_REF] for proofs in particular settings). We give a simpler proof of this criterion, which also provides explicit bounds for the moments of perpetual integrals and can be easily extended to more general one dimensional Markov processes. Then, we extend this result to a diffusion taking values in a compact subset and finally to non-homogeneous processes by the use of Girsanov's transform.

B.1 General diffusion processes on [0, +∞)

Let us consider a general one-dimensional diffusion process (Z t , t ≥ 0) (that is a continuous strong Markov process) with values in [0, +∞). We denote by T z the hitting time of z ∈ [0, +∞) by the process Z:

T z = inf{t ≥ 0, Z t = z}.

When the process Z has to be specified, this time will be denoted T Z z .

Let us denote by P z the law of Z starting from z. We assume that Z is regular (∀z ∈ (0, +∞), ∀y ∈ (0, +∞), P z (T y < +∞) > 0). This implies that for any a < b ∈ (0, +∞) and a ≤ z ≤ b, E z (T a ∧T b ) < +∞ and we can associate with Z a scale function s and a locally finite speed measure m on [0, +∞) (see [22, Chapter VII]). We moreover assume that for all z ∈ (0, +∞),

P z (T 0 = T 0 ∧ T e < +∞) = 1, (18)
where T e is the explosion time.

Note that Condition ( 19) is well known in the case where Z is solution of a stochastic differential equation (cf. [START_REF] Karatzas | Brownian motion and stochastic calculus[END_REF] p.348, [START_REF] Ikeda | Stochastic differential equations and diffusion processes[END_REF] p.450).

Proof. Assume first that ( 18) is satisfied. As Z has scale s, s(Z) is a local martingale on (s(0), s(+∞))

such that T s(Z) s(0) < T s(Z)
s(+∞) a.s.. We deduce that s(0) > -∞ and s(+∞) = +∞. The diffusion s(Z) has a natural scale with speed measure m = m • s -1 (see [START_REF] Revuz | Continuous martingales and Brownian motion[END_REF], Chapter VII). Since it attains s(0) in finite time almost surely, we deduce using [START_REF] Rogers | Diffusions, Markov processes and martingales[END_REF] that s(0)+ (u -s(0)) m(du) < +∞. As s(0)+ (u -s(0)) m(du) < +∞ ⇐⇒ 0+ (s(y) -s(0)) m(dy) < +∞, we obtain [START_REF] Khoshnevisan | A note on a.s. finiteness of perpetual integral functionals of diffusions[END_REF]. Conversely, assume [START_REF] Khoshnevisan | A note on a.s. finiteness of perpetual integral functionals of diffusions[END_REF]. Conditions s(0) > -∞ and s(+∞) = +∞ imply that the local martingale s(Z) doesn't explode a.s.. Since 0+ (s(y) -s(0)) m(dy) < +∞, then s(0)+ (u -s(0)) m(du) < +∞ and the process s(Z) attains s(0) in finite time a.s., so does the process Z.

Since the function s is defined up to a constant, we choose by convention s(0) = 0 as soon as s(0) > -∞.

The following theorem gives a 0 -1 law criterion for the finiteness/infiniteness of perpetual integrals of diffusion processes, for which we provide a new and simple proof.

Theorem B.2. Let (Z t , t ≥ 0) be a regular diffusion process on [0, +∞) with scale function s and speed measure m on (0, +∞) satisfying [START_REF] Khoshnevisan | A note on a.s. finiteness of perpetual integral functionals of diffusions[END_REF]. Let also f be a non-negative locally integrable function on (0, +∞). Then, for all z > 0 and all n ≥ 1, Proof. Because of the non-explosion assumption [START_REF] Khoshnevisan | A note on a.s. finiteness of perpetual integral functionals of diffusions[END_REF], we have

E z T0 0 f (Z s ) ds n ≤ n! ∞ 0 s(y) f (y) m(dy)
T0 0 f (Z s ) ds < +∞ ⇔ ∀k ∈ N, T0 0 f (Z s )1 Zs≤k ds < +∞ and T0 0 f (Z s ) ds = +∞ ⇔ ∃k ∈ N such that T0 0 f (Z s )1 Zs≤k ds = +∞.
Hence it is sufficient to prove Theorem B.4 for functions f satisfying ∞ a f (x) s(x) m(dx) < +∞ for all a > 0. We make this assumption from the rest of the proof.

As Z has scale function s and speed measure m, the process s(Z) is on a natural scale with speed measure m • s -1 . Then it is enough to prove the result for Z on a natural scale. In particular, we have the following Green formula (see [ Chapter 23] of [START_REF] Kallenberg | Foundations of modern probability[END_REF])

E x T0 0 f (Z s ) ds = (0,+∞) 2 (x ∧ y) f (y) m(dy). Noting that T0 0 f (Z s ) ds = ∞ k=1 T x/(k+1) T x/k f (Z s ) ds,
one easily checks that, under P x for any x ∈ (0, +∞), T0 0 f (Z s ) ds < +∞ satisfies a 0-1 law. Indeed, the random variables T x/(k+1) T x/k f (Z s ) ds, k ≥ 1 are non-negative and independent (strong Markov property) and almost surely finite because of our assumptions and the Green's formula applied under P x/k up to time T x/k+1 . Hence the above series is finite with probability zero or one.

Let us now assume that (0,+∞) y f (y) m(dy) < +∞. Then T0 0 f (Z s )ds < ∞ almost surely and, for all n ≥ 1,

E x T0 0 f (Z s )ds n = E x   n T0 0 f (Z s ) T0 s f (Z u ) du n-1 ds   = n ∞ 0 E x   1 s<T0 f (Z s ) T0 s f (Z u ) du n-1   ds = n E x   T0 0 f (Z s )E Zs   T0 0 f (Z u )du n-1   ds   ,
where we used the Markov property. We immediately deduce by induction that

E x T0 0 f (Z s )ds n ≤ n! (0,+∞) 2yf (y)m(dy) n .
This concludes the proof of the first part of Theorem B.2 (the inequality is trivial when (0,+∞) y f (y) m(dy) = +∞).

Assume now that (0,+∞) y f (y) m(dy) = +∞ and fix x ∈ (0, +∞). For all k ≥ 1, we set

f k (y) = f (y) if y ≥ 1 f (y) ∧ k if y < 1.
In particular, (0,+∞) f k (y) y m(dy) < ∞ for all k ≥ 1 and hence, using the inequalities established above and then the fact that (0,+∞) 2yf k (y) m(dy) goes to infinity and the fact that yf (y)m(dy) is assumed to be finite on neighborhood of +∞, we deduce that for k large enough

E x   T0 0 f k (Z s )ds 2   ≤ 2 (0,+∞) 2y f k (y) m(dy) 2 ≤ 2 (0,+∞) 2 (y ∧ x)f k (y) m(dy) + ∞ x 2(y -x)f (y) m(dy) 2 ≤ 4 (0,+∞) 2 (y ∧ x)f k (y) m(dy) 2 + 4 ∞ x 2(y -x)f (y) m(dy) 2 ≤ 5 (0,+∞) 2 (y ∧ x)f k (y) m(dy) 2 ≤ 5 E x T0 0 f k (Z s )ds 2 .
We deduce that, for k large enough,

P x T0 0 f k (Z s )ds ≥ E x T0 0 f k (Z s )ds 2 ≥ 1 20 .

Indeed, for any random variable

Y ≥ 0 such that E(Y 2 ) ≤ 5E(Y ) 2 , we have, setting M = E(Y ), 5M 2 ≥ E(Y 2 ) ≥ E(Y 2 | Y ≥ M/2)P(Y ≥ M/2) ≥ E(Y | Y ≥ M/2) 2 P(Y ≥ M/2) ≥ E(Y 1 Y ≥M/2 ) 2 P(Y ≥ M/2) ≥ M 2 /4 P(Y ≥ M/2)
and hence P(Y ≥ M/2) ≥ 1/20. Now using the fact that f k is increasing in k, we deduce that, for k large enough,

P x T0 0 f (Z s )ds ≥ E x T0 0 f k (Z s )ds 2 ≥ 1/20. Since E x T0 0 f k (Z s )ds is not bounded in k, we deduce that P x T0 0 f (Z s )ds = +∞ ≥ 1/20
. This and the fact that { T0 0 f (Z s )ds = +∞} satisfies a 0 -1 law conclude the proof.

The equivalences stated in Theorem B.2 are particularly useful when Z is solution of

dZ t = σ(Z t )dB t + b(Z t )dt ; Z 0 > 0, (20)
where B is a one dimensional Brownian motion, and σ : (0, +∞) → (0, +∞) and b : (0, +∞) → R are measurable functions such that b/σ 2 is locally integrable. The scale function (up to a constant) and speed measure equal to

s(x) = x c exp -2 y c b(z) σ 2 (z) dz dy ; m(dx) = 2dx s (x) σ 2 (x) , (21)
(y) = 1/y α , we have T0 0 1 (N s ) α ds = +∞ a.s. ⇐⇒ α ≥ 1 ; T0 0 1 (N s ) α ds < +∞ a.s. ⇐⇒ α < 1. (22)
In the particular case α = 1, the authors of [START_REF] Foucart | Stable continuous stat branching processes with immigration and Beta-Fleming-Viot processes with immigration[END_REF] propose an other approach based on self-similarity properties.

Example 2. Logistic diffusion process. Let us consider the process A similar result holds at the boundary a.

dN t = N t dB t + N t (b -c N t ) dt ; N 0 > 0,
Proof. As in the proof of Theorem B.2, it is enough to prove the result in the case where s is the identity function. Without loss of generality, we take (a, b) = (0, 1). Let us consider x ∈ (0, 1), fix ε ∈ (0, 1 -x) and consider a locally finite measure m ε on (0, +∞) such that the restriction of m ε on (0, 1 -ε) is equal to the restriction of m on (0, 1 -ε). Let X ε be a diffusion process on natural scale on (0, +∞) with speed measure m ε and starting from x, built as a time change of the same Brownian motion as X. Because of this construction, X and X ε coincide up to time T 0 on the event {T 0 < T 1-ε }. Now, by Theorem B.2 applied to X ε and f ε : y → f (y)1 y≤1-ε , we deduce that Since on the event T 0 < T 1-ε , X and X ε coincide up to time T 0 and X s ≤ 1 -ε holds for s ≤ T 0 , then up to P x -negligible events, The continuity of the paths of X implies that {T 0 < T 1 } = ∪ 0<ε<1-x {T 0 < T 1-ε }, which yields, up to negligible events, This concludes the proof of the direct implications in Theorem B.4. Now, assume for instance that T0 0 f (X s )ds = +∞ on T 0 < T 1 . Then, a fortiori, T0 0 f (X s )ds = +∞ on T 0 < T 1-ε for any ε ∈ (0, 1 -x). This implies that T0 0 f (X ε s )ds = +∞ on T 0 < T 1-ε . But T 0 < T 1-ε happens with probability x/(1 -ε) > 0 by definition of the natural scale. We deduce from Theorem B.2 that 0 + y f (y)m(dy) < +∞ does not hold and hence, because f is non-negative, that

B.3 Extension to non-homogeneous processes by use of Girsanov transform

We are interested in generalized one-dimensional stochastic differential equations of the form dX t = σ(X t )dB t + b(X t )dt + q(X t , θ t )dt, X 0 > 0, [START_REF] Rogers | Diffusions, Markov processes and martingales[END_REF] where (B t , t ≥ 0) is a Brownian motion for some filtration (F t ) t and (θ t , t ≥ 0) is predictable with respect to (F t ) t . The process (θ t ) t can for example model an environmental heterogeneity.

Assumption (H): We consider real functions σ and b such that for any Brownian motion W on some probability space, the one-dimensional stochastic differential equation dZ t = σ(Z t )dW t + b(Z t )dt, Z 0 > 0 satisfies the assumptions of Corollary B.3.

Theorem B.5. Let us consider a solution X of (23) where σ and b satisfy Assumption (H). We also assume that T 0 = T X 0 < +∞ almost surely and that the sequence (T X k ) k∈N * tends almost surely to infinity as k tends to infinity.

Next, we assume that for any k ∈ N\{0}, E exp 1 2

T X k 0 q 2 (X s , θ s ) σ 2 (X s ) ds < +∞. ( 24
)
Let f be a non negative locally bounded measurable function on (0, +∞). We have

Theorem 4 . 1 .

 41 Fixation occurs before extinction with probability one if and only if

0+ y σ 2

 2 (y)f (y) dy = +∞.

Figure 1 :

 1 Figure 1: We plot a trajectory of the 2-dimensional diffusion process (N, X) such that dNt = N (1-ε)t

Figure 2 :

 2 Figure 2: For different values of ε, we simulate 10000 trajectories of the 2-dimensional diffusion process (N, X)

  [START_REF] Engelbert | Integral functionals of strong Markov continuous local martingale[END_REF] and c ij,kl = α ij,kl -α 11,11 .

Lemma B. 1 .

 1 Condition (18) is equivalent to s(+∞) = +∞ ; s(0) > -∞ ; 0+ (s(y) -s(0)) m(dy) < +∞.

  ) f (y) m(dy) < +∞ ⇐⇒ T0 0 f (Z s ) ds < +∞ P z -almost surely 0 + s(y) f (y) m(dy) = +∞ ⇐⇒ T0 0 f (Z s ) ds = +∞ P z -almost surely.

  where c > 0. Then s(y) = y 0 e cz 2 -2bz dz and m(dy) = 2e -cy 2 +2by y dy and 0 + s(y)m(dy) < +∞, since s(y) s (y) y → y→0 1. (Note that if c = 0, the condition s(+∞) = +∞ is not satisfied). It is immediate to check that (22) also holds. B.2 General diffusion processes on (a, b) Let us consider a general diffusion process (X t , t ≥ 0) with scale function s and locally finite speed measure m on (a, b), with -∞ < a < b < +∞. Let us denote by T a and T b the hitting times of a and b respectively by the process X. We assume that, for all x ∈ (a, b), P x (T a ∧ T b < +∞) = 1. This is the case if and only if one of the following properties is satisfied (i) -∞ < s(a) < s(b) < +∞ ; a + (s(y) -s(a)) m(dy) < +∞ and b - (s(b) -s(y) m(dy) < +∞; (ii) -∞ < s(a) and s(b) = +∞ ; a + (s(y) -s(a)) m(dy) < +∞; (iii) s(a) = -∞ and s(b) < +∞ ; b - (s(b) -s(y)) m(dy) < +∞. Theorem B.4. Fix x ∈ (a, b) and let f : (a, b) → R + be a locally bounded measurable function. Thenb- (s(b) -s(y)) f (y)m(dy) = ∞ ⇔ P x { T b 0 f (X s )ds = ∞} ∩ {T b < T a } = P x T b < T a b -(s(b) -s(y)) f (y)m(dy) < ∞ ⇔ P x { T b 0 f (X s )ds < ∞} ∩ {T b < T a } = P x T b < T a .

T0 0 f 0 f (X ε s ) 1

 001 (X ε s )1 X ε s ≤1-ε ds = +∞ almost surely ⇐⇒ 0 + y f (y)m(dy) = +∞, T0 X ε s ≤1-ε ds < +∞ almost surely ⇐⇒ 0 + y f (y)m(dy) < +∞.

  s )ds = +∞ on T 0 < T 1-ε . 0 + y f (y)m(dy) < +∞ =⇒ T0 0 f (X s )ds < +∞ on T 0 < T 1-ε .

  s )ds = +∞ on T 0 < T 1 .0 + y f (y)m(dy) < +∞ =⇒ T0 0 f (X s )ds < +∞ on T 0 < T 1 .

0

  + y f (y)m(dy) = +∞. This provides the first ⇐ implication in Theorem B.4. The second ⇐ implication in Theorem B.4 is proved using similar arguments. The result at boundary b is proved similarly.

0 0f

 0 s )ds = +∞ almost surely,0 + f (y)s(y) m(dy) < +∞ ⇐⇒ T X (X s )ds < +∞ almost surely,where s and m are defined in[START_REF] Mijatovic | Convergence of integral functionals of one-dimensional diffusions[END_REF].Note that[START_REF] Salminen | Properties of perpetual integral functionals of Brownian motion with drift[END_REF] holds true as soon as, for all k ∈ R + , sup x∈(0,k),θ |q(x, θ)/σ(x)| < +∞.[START_REF] Stroock | Multidimensional diffusion processes[END_REF]

  is the number of individuals with genotype ii at time t, divided by K and for all

  Let us give two examples for population size processes. Example 1. Branching process with immigration. Let us consider the solution of the stochastic differential equation dN t = σ √ N t dB t + βdt, β > 0. Computing s and m as in (21), we easily obtain that (18) ⇐⇒ β/σ 2 < 1/2. Applying Corollary B.3 with f

	0 +	f (y)s(y) s (y)σ 2 (y)	dy = +∞ ⇐⇒	0	T0	f (Z s ) ds = +∞ almost surely,
	0 +	f (y)s(y) s (y)σ 2 (y)	dy < +∞ ⇐⇒	0	T0	f (Z

(cf.

[START_REF] Kallenberg | Foundations of modern probability[END_REF] Chapter 23]

).

Corollary B.3. Assume that Z is solution of (20) with s(+∞) = +∞ and 0+ s(y) m(dy) < +∞. Let us consider a non negative locally integrable function f on (0, +∞). Then, under P z , s ) ds < +∞ almost surely.

Proof. We use the Girsanov Theorem, as stated for example in Revuz-Yor [START_REF] Revuz | Continuous martingales and Brownian motion[END_REF] Chapter 8 Proposition 1.3.

Let us consider the diffusion process X k on [0, k], absorbed when it reaches 0 or k, at time τ k := T X 0 ∧T X k . The exponential martingale E(L k ) t , where L k t = -t∧τ k 0 q(Xs,θs) σ(Xs) dB s , is uniformly integrable thanks to [START_REF] Salminen | Properties of perpetual integral functionals of Brownian motion with drift[END_REF] and Novikov's criterion. Define for any x > 0 the probability Q x with dQx dPx | Ft = E(L) t . Then, the process ω = B -B, L is a Q x -Brownian motion and, under Q x , X is solution to the SDE dX t = σ(X t )dω t + b(X t )dt. Hence s restricted to (0, k) is the scale function of X k under Q x . Since s and f are both bounded in a vicinity of k, we deduce from Theorem B.4 that

Note also that, since we assumed that T k tends almost surely to infinity, we have up to a P x -negligible event,

and hence

But, by definition of Q x and by Theorem B.4, we have

= 0 if 0+ s(y)f (y) m(dy) < +∞ P x (T 0 < T k ) otherwise.

(28)

Letting k tend to infinity concludes the proof.