80
Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07 Supervisors: dr. ir. C.W.M. van der Geld dr. ir. J. Schmidt Eindhoven University of Technology Mechanical Engineering Department Division Thermo Fluids Engineering Section Process Technology

Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Condensation oflow volatile components

in lean natural gastransmission pipelines

S.T.A.M. de WispelaereReport number WPC 2006.07

Supervisors:dr. ir. C.W.M. van der Gelddr. ir. J. Schmidt

Eindhoven University of TechnologyMechanical Engineering DepartmentDivision Thermo Fluids EngineeringSection Process Technology

Page 2: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Abstract

Condensation inside natural gas transport pipelines is highly undesirable as it can lead tocorrosion and extra pressure drop. Even for very lean gases accumulation of condensate overperiods of years can lead to considerable amounts of liquid in the pipes. As it is difficult andexpensive to mechanically clean the pipes from liquid deposit, methods to avoid or decreasecondensate flow rate are sought-after. To do so, the condensation process has to be betterunderstood.

A theoretical and numerical study of condensation in long distance natural gas pipelines isdone. Possible condensation phenomena are discussed: filmwise or dropwise wall condensa-tion and fog formation. Due to uncertainties in the modeling of fog and droplet condensation,it is assumed that the dominant process is filmwise wall condensation. To model this type ofcondensation, the film theory can be used.

The film theory models diffusive mass transfer, assuming a binary mixture in its derivation.Problems arise when applying the film theory to natural gases at high pressure, where thedifference between condensable and non-condensable gases is not clear. Phase equilibria the-ory is useful if fixed conditions for pressure, temperature and composition can be assumed,but is not sufficient in the case of finite mass transfer between the two phases. Therefore acombinational model is proposed. The mass transfer rate is diffusion controlled and modeledby film theory, the amount and composition of condensate however is determined with flashcalculations using phase equilibria theory.

Pressure and pipe wall temperature set the phase behaviour of a multicomponent mixture.Inner pipe wall temperatures were calculated using measured (p,T) profiles. At the highlyturbulent flow conditions, the heat resistance of the bulk gas is small, causing small differencebetween bulk gas and wall temperatures.Radial temperature profiles are investigated to calculate inner pipe wall temperatures basedon known axial (p,T) profiles. At the high gas velocities inside the pipe, high Nusselt num-bers and heat transfer coefficient from bulk to pipe wall cause the difference between bulkgas temperature and inner wall temperature to be very small, reaching maximum values of afew Kelvin.

Numerical studies were done with the combination model for a Russian natural gas of 32 com-ponents. For constant conditions of temperature and pressure, the growth rate of the filmthickness proves to be constant in time. A considerable growth rate is observed, ranging frommaximum values of 4.5 to 6 mm/year, depending on soil temperature. Variation of the in-let temperature does not prove to influence the location nor the value of the maximum growth.

1

Page 3: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

The condensation rate of individual components is examined. Indeed, the low volatile com-ponent reaches an early maximum along the length of the pipe. Other components start tocondense more downstream, all at the same location. It proves that the rate of condensationof octane up to hexa-decane is the highest, showing maxima for tri- and tetra-decane. Typicalcondensation rates for these two components reach maxima of about 0.02 kmol /(m year).The presence of the low volatile component in the gas increases the condensation rates of theother components slightly.

2

Page 4: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Contents

List of symbols 5

1 Introduction 71.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 Objectives and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.3 Report lay-out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 Phenomena of condensation 102.1 Wall condensation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.2 fog formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Film theory 123.1 Physical model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2.1 Mass transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2.2 Selection of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2.3 Correction factor for mass transport . . . . . . . . . . . . . . . . . . . 153.2.4 Correction factor for heat transport . . . . . . . . . . . . . . . . . . . 163.2.5 Heat and mass transfer coefficients . . . . . . . . . . . . . . . . . . . . 16

4 Phase Equilibria 184.1 Phase diagram of a natural gas . . . . . . . . . . . . . . . . . . . . . . . . . . 184.2 Equations of state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.3 Phase equilibria with Equations of State . . . . . . . . . . . . . . . . . . . . . 20

5 Inner pipe wall temperature 235.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.2 Governing equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.2.1 Conductive heat loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.2.2 Axial velocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.2.3 Density and property data . . . . . . . . . . . . . . . . . . . . . . . . . 26

5.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

6 Combination model 296.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296.2 Construction of control volumes . . . . . . . . . . . . . . . . . . . . . . . . . . 30

6.2.1 Bulk volume equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3

Page 5: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

6.2.2 Wall control volume equations . . . . . . . . . . . . . . . . . . . . . . 316.2.3 Mass transfer term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

7 Numerical results 347.1 Temperature and pressure profiles . . . . . . . . . . . . . . . . . . . . . . . . 347.2 Phase diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347.3 Flash calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367.4 Time dependent film thickness profile . . . . . . . . . . . . . . . . . . . . . . 377.5 Film thickness growth rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387.6 Condensation rate of individual components . . . . . . . . . . . . . . . . . . . 38

8 Conclusions and recommendations 428.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428.2 Recommendations for further research . . . . . . . . . . . . . . . . . . . . . . 43

Bibliography 45

A Derivations for mass transfer 47A.1 Concentration Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47A.2 Alternative variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

B Equations of state 49B.1 Peng-Robinson expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49B.2 Flash algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

C Gas composition 51

D Property data 53

E Numerical programming 54E.1 Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54E.2 Aspen Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

4

Page 6: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

List of symbols

Variables

cp specific heat capacity at constant pressure [J/(kgK)]c mass fraction [kg/kg]dp pipe diameter [m]D binary diffusion coefficient [m2/s]Di,m effective diffusion coefficient [m2/s]~jq heat flux field due to conduction [W/m2]k thermal conductivity [W/(mK)]L length [m]Lf molar liquid fraction [kmol/kmol]LV C the low volatile component -M molar mass [kg/kmol]M mass in control volume [kmol]m mass flux [kg/(m2s)]n molar flux [kmol/(m2s)]p pressure [Pa]q heat flux [W/m2]~qR heat flux field due to radiation [W/m2]r radial coordinate [m]R universal molar gas constant [J/(kmolK)]R pipe inner radius [m]t time [s]T temperature [K]u, v, w bulk velocity in x, y, z-direction [m/s]v molar volume [m3/kmol]~v velocity vector field [m/s]V volume [m3]Vf molar vapour fraction [kmol/kmol]x molar fraction in the liquid phase [kmol/kmol]y molar fraction in the gas phase [kmol/kmol]z molar fraction in total mixture [kmol/kmol]z axial coordinate in pipe [m]Z compressibility factor [−]

5

Page 7: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

α heat transfer coefficient [W/(m2K)]β mass transfer coefficient [m/s]δ boundary layer thickness [m]ζ resistance factor [−]η dynamic viscosity [Pa s]µJT Joule-Thompson coefficient [K/Pa]Θ correction factor [−]ρ mass density [kg/(m3)]ρ molar density [kmol/(m3)]τ tension tensor [N/(m2)]ω acentric factor [−]

Subscripts

∞ bulk gas0 condensate film surface, pipe inletc thermodynamically criticalcv control volume on pipe walli, j componentsL liquid phasem massn non-condensable gasT temperatureV gas phaseW pipe wall

Superscripts

− pipe cross-sectional average of variableL liquid phaseV gas phase

Dimensionless numbers

Nu = α·dk

Pr = η·cp

k

Re = v·d·ρη

Sc = ηρ·D

Sh = β·dD

6

Page 8: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 1

Introduction

1.1 Background

After producing lean natural gas from a well, a number of operations are necessary to makeit suitable for further transport trough pipelines to the consumers. Apart from filtering thegas, it is important to remove condensable components to prevent the condensation furtherin the transport pipelines, which causes corrosion and extra pressure drop. At the highpressures (typically 30–120 bars) and low temperatures (typically 270–320 K) at which thegas is delivered, most of the heavier components are not present anymore. Before enteringthe pipeline, a low volatile component (hereafter occasionally abbreviated as LVC) is added,that absorbs the remaining water content. Although the chemical deposits with the waterbefore entering the pipeline, small quantities (in the order of 1 ppm) of the component remainin the gas and can condense further in the pipeline. This is possible because the gas dropsin temperature and pressure, due to frictional pressure drop and heat loss. These can beconsiderable for long distance pipelines. For a multicomponent mixture like natural gas, it isthen possible to enter the two-phase region, a phenomenon known as retrograde condensation.Other low volatile components in the gas influence the condensation behaviour of the totalsystem and must be taken into account. Although the gas is lean and the rate of condensationis expected to be very small, accumulation of condensate over long periods of time (in the orderof years) can result in large amounts of liquid in the pipeline. As it is difficult and expensiveto pause gas transport for mechanical removal of condensate, it is useful to search for methodsto avoid condensation, or to evaporate existing condensate back into the gas. A number ofdifficulties are present. The concentration of the low-volatile components is extremely smalland so is the expected rate of condensation. Furthermore, the conditions over a year changesignificantly. Ambient temperature changes, causing different temperature profiles. Locally,the ambient temperatures can differ strongly. Finally, the composition of the bulk gas changes,as the water absorbing chemical is only added in winter, when the larger temperature dropmakes water condensation more critical. The challenge is to predict the condensation processaccurately for these conditions.

1.2 Objectives and assumptions

Experimental data from existing pipelines on the subject of condensation are sparse. Someimportant variables, like axial temperature and pressure profiles are well known. Measuring

7

Page 9: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

the amount and composition of condensate is possible but time consuming. The amountof condensate can be extremely small and difficult to detect. Accurate methods to predictcondensation rates, and to understand what influences it are therefore desirable.

The approach of this study is purely theoretical. The objective is to develop a model topredict the condensate mass flow rate in time and place in the pipeline.

The following assumptions are made:

• The object under study is a pipe of 338 km length and 1.2 m diameter. Inclination isnot considered.

• The inlet pressure is 90 bars. Axial pressure profiles are known from measurements orare calculated using appropriate software (Aspen Plus).

• The inlet bulk gas temperature can vary between 20 C and 50 C.

• The pipe is buried in a sand bed with a temperature of 2 C in winter and 10 C insummer.

• The volume flow through the pipe lies between 1 and 3 million m3/hr at standardconditions (p=1 atm, T=0 C).

• The gas is Russian natural gas with 32 components.

• The condensate layer does not move in axial direction.

• Mass transport inside the condensate layer is not considered as the film thicknesses arethin and the condensate is assumed perfectly mixed

The assumptions are set up to reflect a realistic long distance natural gas pipeline. Somesimplifications are taken here and more will be taken in the rest of this study. The main goalis to set up a functioning model with these assumptions. Later on, other effects should beadded to the model to produce more accurate simulations.

1.3 Report lay-out

In chapter 2 it is assessed which phenomena of condensation are relevant to a natural gaspipeline. The assumption is made that condensation occurs only on the pipe wall in a purelyfilmwise manner.

To model film condensation, the film theory can be used. This is a diffusion based mass trans-fer model that regards condensation as the diffusion of a vapour through a non-condensablegas. Although its derivation is based on a binary mixture of a condensable vapour and aarbitrary number of non-condensable gases, it can be applied to a multicomponent mixturewith multiple condensable gasses as well. The derivation is given in chapter 3, leading to themain equation with which mass transfer can be modelled.

8

Page 10: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Two important variables remain unknown to determine the condensation mass transfer rate,namely the gas-side phase-boundary concentrations, and the temperature at the phase bound-ary. Therefore, in chapter 4 an introduction to phase equilibrium thermodynamics is given,using cubic equations of state. It is shown how flash models can be constructed, which areuseful in situations where thermodynamic equilibrium can be assumed between a liquid andgas phase.Radial and axial temperature profiles are discussed in chapter 5. It will be shown that at thegiven conditions, the temperature difference between bulk gas and wall is small, given thatthe condensate film is very thin.

Where the film model provides an equation with which mass transfer can be modelled, its as-sumption of a binary mixture of condensable and noncondensable gases can not be applied assuch to a natural gas at high pressure. In these conditions, even low volatile components likemethane can solve to a certain degree in the condensate and can not be considered completelynoncondensable. Phase equilibria are useful in static situations, but are not sufficient to de-scribe situations where there is no thermodynamic equilibrium, as is the case with a bulk gasflowing over a condensate film, with a finite mass transfer between the two phases. Therefore,in chapter 6 a combination model is proposed. Here the mass transfer between condensateand bulk gas is modelled using film theory, but the condensation itself is calculated in a smallcontrol volume on the pipe wall, where flash calculations using phase equilibria theory areapplied to calculate the amount and composition of condensate.

It is time-consuming to program flash calculations for a large number components. Therefore,a multiphase computer program, Aspen Dynamics, was used to implement the model. Chap-ter 7 gives the results of the numerical simulations. First, results are given for the typical useof a pipeline with a 30 component natural gas at conditions of inlet temperature, pressure, etcthat are constant in time. This is compared to results that would be obtained if the standardtwo-phase calculation method of Aspen Dynamics is used, which uses only flash calculations.A few parameter studies are done, to show the influence of inlet pressure and of seasonalambient temperature. The condensation rate of individual components is discussed.

Finally, chapter 8 summarizes the results. Uncertainties due to restrictions of the model arediscussed. Recommendations for further development of the model is given, together withpossible parameter studies.

9

Page 11: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 2

Phenomena of condensation

In this chapter phenomena of condensation are discussed that are relevant to pipelines. Con-densation of gases in a pipe can principally occur in two ways: condensation on the wall andfog formation.

2.1 Wall condensation

If a gas flows over a cold wall, condensation occurs if locally the dew point of the gas,depending on both temperature and pressure, is reached. If the condensate forms a continuousfilm it is called film condensation. The condensate film can be quiescent, or be in laminaror turbulent flow. Instead of a film the condensate can also exist in the form of droplets, asshown in fig 4.2. This type of condensation is called drop condensation. Whether film or dropcondensation is present depends on whether the wall is completely or incompletely wetted.The decisive factor for this are the forces acting on a liquid droplet, which are illustrated inFigure 2.1. The interfacial tensions at the edge of a droplet are shown, σSW is the tension ofthe liquid against its own vapour, σSW is the tension of the wall against the liquid and σSW

the tension of the wall of the vapour. The contact angle is thus found by [1]

σWG − σWL = σLG cosβ0 (2.1)

Finite values of this contact angle imply incomplete wetting and droplet formation. If on theother hand β = 0 the droplet will spread out over the entire surface and form a continuousfilm. To determine the contact angle for, at least the the composition of the liquid and thewall have to be known.If the gas has components that are immiscible in the liquid phase, a combination of bothtypes can be observed. In the following, it will be assumed that wall condensation is filmwise.

2.2 fog formation

When condensation starts in the gas itself, fog is formed. The main criterion for the occurrenceof fog formation is the rate of supersaturation in the gas. By definition it is the ratio of partialto saturation pressure

S =pi

psat,i(2.2)

10

Page 12: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

SGσ

LGσ

WLσ

Figure 2.1: Interfacial tension at a condensate droplet’s edge. The indices W, L, G denotethe wall, liquid and gas, the contact angle is β0

If there are sufficient alien particles in the gas, low degrees of supersaturation suffice forcondensation to occur on those particles, leading to heterogenic nucleation, minimum neededvalues of 1.02 are often given. Much higher values of the supersaturation are needed for ho-mogeneous nucleation, when no, or few particles are present, usually a range of about 5 to 10is given [9]. The rate of supersaturation is dependent on the speed at which temperature andpressure drops. As we will see later on, axial pipeline profiles show very slow temperatureand pressure drops. Among others, Brouwers [2] and Schaber [17] investigated the possibilityof fog formation in the film flowing over a condensate layer. During condensation towards aliquid film, a velocity is induced. Gas flowing towards the film can be cooled quickly, leadingto fog formation. A criterion is that temperature difference between wall and gas is relativelyhigh. As will be shown later, this is not the case for the pipe under study.

Since the composition of the condensate is not known beforehand, an evaluation on theoccurrence of either type of wall condensation can not be made yet. Due to too manyuncertainties, in the modelling of the fog formation (e.g. number of particles), the assumptionis made that condensation occurs in a purely filmwise manner.

11

Page 13: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 3

Film theory

When filmwise condensation occurs in a pipe, molecules of the condensing component aretransported from the bulk gas to the wall. The rate of condensation is limited by the diffusivemass transfer through the bulk gas. Multiple approaches are possible to model this masstransfer. The general approach is solving the coupled concentration, momentum and energyequations for multiple components. For simple geometries like pipes, theories that are basedon a dimensional analysis, using experimentally validated characteristic numbers, providean accurate alternative. Examples of these are are film theory, boundary layer theory andpenetration and surface renewal theory [1]. All of these assume the mass transfer to take placein a small film lying on the surface to which is diffused to. In the film theory the concentrationof the diffusing component and the velocity only vary in the direction, normal to the surface.The boundary layer theory additionally considers the direction in which the bulk gas flows.Penetration and surface renewal theories take non-steady flow into account as well. The axialvariation in the pipe of temperature and pressure and consequently density and velocity arevery small. This is shown in chapter 5 where typical measured axial pressure and temperatureprofiles of the pipe are given , together with calculated axial velocity profiles. Variations intime can be considered small as well, changes occur in the time span of minimally a few hours.It is therefore assumed that of the simplified theories, the film theory suffices to describe themass transfer. In this chapter, the assumptions and derivations of the film theory will begiven.

3.1 Physical model

In the following derivations, a local cartesian coordinate system is used, where x denotes axialcoordinate in the pipe, and y is the coordinate perpendicular to the wall. The coordinatesystem is located on the phase boundary, i.e. y = 0 corresponds with the condensate filmsurface.

-6

xy

The derivations are made for a steady state, one-dimensional process. The assumptions forthe film theory are [6]:

• The profiles for pressure, velocity and temperature are only dependent on the y-coordinateand become constant at their respective boundary layer thicknesses.

12

Page 14: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

• The boundary layer thicknesses are constant and independent of the mass transfer rate

• The flow is laminar

• The property data viscosity, diffusion coefficient and thermal conductivity are constant

• There are no chemical reactions in the gas. Viscid dissipation and radiation energy areneglected

3.2 Derivations

3.2.1 Mass transfer

In the film model, boundary layers near the surface for velocity temperature and mass transferare defined. The resistance against heat and mass transfer for the condensation process isdominant in the gas phase, and the resistance in the liquid phase can often be neglected.Brouwers [2] made his derivation for a mixture of inert gases (index n) and condensablevapours (index v). The derivation starts with the three-dimensional “full Fickian diffusionequation”, as is derived in appendix A as (A.9), with no chemical reactions, assuming aconstant diffusion coefficient, written in mass fractions ci:

ρ

(∂ci

∂t+ u

∂ci

∂x+ v

∂ci

∂y+ w

∂ci

∂z

)= ρD

(∂2ci

∂x2+

∂2ci

∂y2+

∂2ci

∂2z

)(3.1)

Neglecting the time dependent term and assuming the variations to be small in the axial andtangential directions gives:

ρv∂ci

∂y= ρD

∂2ci

∂y2(3.2)

The bulk velocity v is a convective flow, induced by the diffusion of vapour through the totalmixture. An expression for this velocity is now derived.For every component, a steady state mass balance can be written in the y direction, givingfor vapour and inert components respectively:

∂(ρvvv)∂y

= 0,∂(ρnvn)

∂y= 0 (3.3)

Since no inert gases disappear at the phase boundary due to condensation, it holds thatvn(y = 0) = 0. Applying to (3.3) and integrating gives vn(y) = 0, meaning that the inertgases do not move in y direction. Inserting this in the general expression for the bulk velocitygives:

v =1ρ

n∑

i=1

ρivi =1ρ(ρvvv + ρnvn) =

1ρ(ρvvv) = cvvv (3.4)

Fick’s first law states that diffusive molar flux is equal to its mass density gradient multipliedwith the diffusion constant. In appendix A, it is shown that for a constant ρ mixture, theequation can be written in mass fraction c too. Another definition of diffusive mass flux isthe velocity of a component, relative to its bulk velocity, see (A.6). Combining for the vapourgives:

13

Page 15: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

ρv(vv − v) = −ρD∂cv

∂y(3.5)

Combining (3.5), (3.4) and (3.3) gives the expression for the bulk flow, induced by diffusionof vapour:

v = − 11− cv

D∂cv

∂y(3.6)

This is often called “Stefan flow”. Substitution of (3.6) in (3.2) gives the diffusion equationsfrom which the radial profile of cv can be found:

ρD∂2 ln(1− cv)

∂y2= 0 (3.7)

With the boundary conditions

cv(y = 0) = cv,0 and cv(y = δ) = cv,∞ (3.8)

this gives as a concentration profile:

cv(y) = 1− (1− cv,0)eyδ

ln

(1−cv,∞1−cv,0

)

(3.9)

The mass transfer in the film is the bulk flow at the phase boundary multiplied with the totalmass density:

m = −ρv(y = 0) = ρD1

1− cv

∂cv

∂y

∣∣∣∣y=0

(3.10)

Taking the first spatial derivative of (3.9) with respect to y, setting y = 0 and substituting in(3.10) gives:

m = −ρDδ

ln(

1− cv,∞1− cv,0

)(3.11)

This expression for the mass transfer in a film is the original result of Stefan (1873). Thefraction D/δ is commonly replaced with β and is called the mass transfer coefficient, withunit [m/s].

3.2.2 Selection of variables

The above derived equation for the mass transfer in the film model can be made for differentvariables: mass density ρ [kg/m3], molar density ρ [kmol/m3], mass fractions c [kg/kg] andmolar fractions y [kmol/kmol]. For the last two, the implicit assumption is made that the ratioof mass density to molecular weight is constant in the flow. The validity of this assumptionwill be derived here. Consider the Navier-Stokes equation for an incompressible inviscid flow:

∂~v

∂t+ (~v · ~∇)~v = −~∇p + ~g (3.12)

Neglecting gravity and the derivative with respect to time and selecting the y-direction gives:

ρu∂v

∂x+ ρv

∂v

∂y= −∂p

∂y(3.13)

14

Page 16: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

In the film model the so-called boundary layer approximation is taken, velocity variationsin axial x-direction are assumed negligible: ∂u

∂x = 0 and ∂v∂x = 0. If the flow is sufficiently

subsonic, the gas flow can be considered incompressible, giving for the continuity equation~∇ · ~v = 0. This gives ∂v

∂y = 0. Then it follows from (3.13) that the pressure is constant in the

y-direction: ∂p∂y = 0. The general form of the equation of state for gases gives:

ρ

M=

p

ZRT(3.14)

The compressibility factor Z is only dependent on temperature and pressure. If the tempera-ture variations in y-direction are small and ∂Z

∂T is small1, Z does not vary in y-direction either.It follows that ρ/M is constant. As molar fraction and partial density are related with:

yi =(

M

ρMi

)ρi (3.15)

it follows that the mass transfer equations in terms of mass density ρi can be rewritten interms of molar fraction yi without the production of additional terms.

The mass transfer equation (3.11) in terms of molar fractions thus becomes:

n = −ρβ ln(

1− yv,∞1− yv,0

)(3.16)

3.2.3 Correction factor for mass transport

The general film model mass transfer equation (3.11) can be simplified by linearization2:

m = ρDδ

cv,∞ − cv,0

1− cv,0(3.17)

This means that the induced flow at the phase boundary is neglected. This can be seen ifv = 0 is substituted in (3.2) and applying boundary conditions (3.8), which produces thesame result. Comparing (3.11) with (3.17) and taking the ratio between the mass flow withand without induced flow gives the Stefan correction factor :

Θm =−φm

e−φm − 1with φm =

ρD(3.18)

It is important to note that m is calculated with the uncorrected mass transfer expression(3.11). Baehr [1] gives for the correction factor:

Θm =φm

eφm − 1with φm =

n

cβ(3.19)

It easy to see that it is equal to (3.18) because Baehr defines the mass transfer as negativefor condensation n = −m/ρ and the definition of the mass transfer coefficient is:

1For a temperature and pressure range of 30–120 bars and 250–350 K, ∂Z∂T

has typical values of 0–0.0045for pure methane, as shown in figure 4.2

2in (3.17) the first order Taylor approximation of (3.11) is used: ln(

cv,0−cv,∞1−cv,0

+ 1)∼ cv,0−cv,∞

1−cv,0, valid if

cv,0−cv,∞1−cv,0

≈ 0

15

Page 17: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

β =Dδ

(3.20)

The form of (3.17) can be further simplified if it is assumed that cv,0 is very small. Numrich[13] does this in a form for molar fractions, that rewritten for mass fractions is:

m = ρβ(cv,∞ − cv,0) (3.21)

The resulting Stefan correction factor now becomes:

Θm =1

1− cv,0

−φm

e−φm − 1with φm =

ρD(3.22)

The question arises why the the correction factor for mass transfer is introduced in thefirst place. The first argument is historical, as the logarithmic expression of (3.11) wasconsidered time-consuming to calculate. The second argument is qualitative as the masstransfer equation, especially in the form of (3.21) has similarity with the one for heat transfer.The mass transfer is made proportional to a concentration gradient times a mass transfercoefficient. Compare this to the well known equation for convective heat flux:

q = α(Thot − Tcold) (3.23)

which is known as Newton’s law of cooling, with α the overal heat transfer coefficient [m2/s].Forcing the mass transfer problem into a form that is similar to the heat transfer problem isattractive, because it provides an analogy between heat and mass transfer. Nevertheless, ifthe induced flow at the phase boundary is significant, it is easier to simply use the form of(3.11) instead of applying corrections.

3.2.4 Correction factor for heat transport

Analogously to the way the correction factor for induced flow on the mass transport, a cor-rection of this mass flow on the heat transfer can be derived. This will not be shown here,but the result for the correction factor is [2]:

ΘT =φT

eφT − 1with φT =

mcp,v

α(3.24)

This is called the Ackermann correction factor. By definition it is the ratio of the heat fluxwith induced velocity and the heat flux without. Note that, again the mass transfer m iscalculated with (3.11).

3.2.5 Heat and mass transfer coefficients

It is not possible to use (3.11) directly to calculate mass transfer rates, as the boundary layerthickness δm is unknown. A mass transfer coefficient has to be calculated, for which theSherwood number has to be known:

β =ShD

d

The following equation for Nusselt and Sherwood numbers for turbulent flow in circular pipesis used, Gnielinski [8], recommended by [1]:

16

Page 18: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Nu =(ζ/8)(Re− 1000)Pr

1 + 12.7√

ζ/8(Pr2/3 − 1)

[1 +

(d

L

)2/3]

(3.25)

Sh =(ζ/8)(Re− 1000)Sc

1 + 12.7√

ζ/8(Sc2/3 − 1)

[1 +

(d

L

)2/3]

(3.26)

With resistance factor:

ζ =1

(0.79 ln Re− 1.64)2(3.27)

Valid in the region:

2300 ≤ Re ≤ 5 · 106, 0.5 ≤ Pr ≤ 2000 and L/d > 1

This equation is chosen because it is valid over a wide range of Reynolds numbers. The term(d/L)2/3 in (3.25) and (3.26) can be neglected if d ¿ L, as is the case for very long pipes. Aperfectly smooth pipe is assumed, as the resistance factor ζ does not depend on the frictionfactor of the pipe wall.

17

Page 19: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 4

Phase Equilibria

In the following chapter, phase equilibria for natural gases are discussed.

4.1 Phase diagram of a natural gas

The phase diagram of a multicomponent mixture like natural gas differs from that of a purecomponent. Figure 4.1 shows a typical (p,T) phase diagram for a natural gas at fixed com-position.

Figure 4.1: phase diagram for a natural gas mixture, from Voulgaris [18]

At point E, the mixture is in the gas phase. When temperature is decreased at constantpressure from point E to D, the dew line is reached at point X and the two phase region is

18

Page 20: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

entered. Lowering the temperature further from the dew point will not cause the mixture tocondense completely, but in increasing amounts of liquid up to 100% when the bubble pointis reached. Where a pure component can only have two phases in equilibrium on the dew line,a multicomponent mixture has a region of possible (p,T) combinations where two phases arepresent. Now consider a pressure change at a constant temperature above the critical point(denoted by C). If pressure is increased from A, the two-phase region is entered on the dewline on point Z. Interestingly, a maximum of liquid fraction is reached at point R. Increasingpressure further will cause the liquid to vaporize again until at the dew line at point W, onlypure gas is present. This phenomenon is known as “retrograde condensation”. It is typical fornatural gases at high pressures. Summarizing, two main differences appear when comparingthe phase diagram of a multicomponent mixture, with that of a pure component:

• A multicomponent mixture can be in a two phase region in the (p,T) diagram. For apure component, this is only possible on the saturation line for a fixed set of pressure-temperature combinations.

• For a multicomponent mixture at high pressure it is possible to enter and leave the twophase region at a constant temperature by changing the pressure only.

Whether condensation will occur in a natural gas is therefore dependent on whether the dewline is crossed, the amount of possible condensation is dependent on how much it is crossed.This emphasizes the importance of both temperature and pressure in the modelling of thecondensation process. In chapter 7, dew lines are shown in a phase diagram that is constructedfor the natural gas under study.

4.2 Equations of state

The relation of pressure, temperature and volume of a gas can generally be written as

pv = ZRT (4.1)

where v is the molar volume, Z is the compressibility factor and R is the universal gas con-stant. By definition, if the limit for infinite volume, or equivalently zero pressure is taken,the compressibility factor Z = 1 and the ideal gas law is found. At high pressures and lowtemperatures real gas PVT behaviour deviates strongly from that of an ideal gas. Therefore,more accurate equations are needed to describe natural gases. Equations of state are a sciencein its own right, as they can be used to qualitatively an quantitatively describe many ther-modynamical and chemical variables. Thermodynamic quantities as compressibility factor,Joule-Thompson coefficient as well as phase equilibria can be determined with equations ofstate. A good summary of the possible equations is given by Wei and Sadus [19]. In the fol-lowing, the assumption is made that the equation of Peng-Robinson is accurate at describingnatural gases. In a pressure formulation the equation is written as

P =RT

v − b− aα

v(v + b) + b(v − b)(4.2)

where the parameters a and b are given by

19

Page 21: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

a = 0.45724R2T 2

c

pc[1+S(1−T 0.5

r )]2, b = 0.07780RTc

pc, S = 0.37464+1.5422ω−0.26992ω2,

(4.3)For a pure component, the equation is completely set if only three parameters are known:reduced pressure pr = p/pc, reduced temperature Tr = T/Tc and the acentric factor ω.The pressure form of (4.2) can be rewritten to obtain an expression for the compressibilityfactor

Z3 + f1(a, b)Z2 + f2(a, b)Z + f3(a, b) = 0 (4.4)

The complete form of (4.4) is given in appendix B. This form of Peng-Robinson showswhy this is called a cubic equation of state. Other cubic equations of state are the van derWaals and Soave-Redlich-Kwong equation. Interestingly, even if for a pure component, theseequations can demonstrate two phase behaviour. If (4.4) is solved for Z at fixed pressureand temperature three solutions are possible. For a thermodynamically supercritical tem-perature, the one non-complex solution gives the real gas factor for the sole possible phase.For subcritical temperatures, two real solutions are possible. For coexisting vapour and liquidphases in thermodynamic equilibrium, the maximum value of Z will correspond to the vapourphase and the minimum to the liquid phase. Cubic equations of state are therefore capableof predicting the density of both liquid and gas phases.In Figure 4.2, values for the compressibility factor as calculated with Peng-Robinson for puremethane are given in a temperature and pressure range, typical for natural gas pipelines. Thederivative of the compressibility factor with respect to temperature is also given.

4.3 Phase equilibria with Equations of State

A phase equilibrium of coexisting phases is defined by the equality of pressure, temperatureand chemical potential in the phases:

p = pL = pV (4.5)T = TL = T V (4.6)µi = µL

i = µVi (4.7)

An equivalent of the equality of chemical potential is the equality of fugacity in both phases

fLi = fV

i (4.8)

Equations of state can be used to calculate phase equilibria. To understand how manyindependent properties are needed to do so, consider the following. Gibbs’ phase rule predictsthe degree of freedom F , in a system consisting of π phases and N components:

F = 2 + N − π (4.9)

If only liquid and gas phases are considered, the degree of freedom is equal to the number ofcomponents. In the case of a two-phase, pure component system, there is one degree of free-dom and setting one intensive property (for example temperature or pressure) fixes all other

20

Page 22: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

250 260 270 280 290 300 310 320 330 340 350

0.7

0.75

0.8

0.85

0.9

0.95

T [K]

Z [−

]

p=30 barp=60 barp=90 barp=120 bar

250 260 270 280 290 300 310 320 330 340 3500

1

2

3

4

5x 10

−3

T [K]

dZ/d

T [K

−1 ]

Figure 4.2: Temperature dependent Z and ∂Z/∂T , with the Peng-Robinson equation of statefor pure methane

properties for the liquid-vapour saturation state. For a two-phase multicomponent system,there are a number of possible combinations of properties. For example, setting one intensiveproperty like pressure or temperature leaves N − 1 properties to be chosen. These can be allthe molar fractions in a single phase1. Fixing the composition of one phase, and fixing oneintensive property of the system thus completely fixes the composition of the other phase,as well as all the other intensive properties. Possible combinations of unknown variables andvariables to be found are summarized in the table below, together with the name the problemis commonly given.

Known variables Variables to be found Namep, x T , y Bubble point Tp, y T , x Dew-Point TT , x p,y Bubble-Point pT , y p,x Dew-Point pp, T , z x,y, Lf flash

As will be discussed, the combination of interest is the flash problem2. Here the temperature,1This requires choosing only N − 1 molar fractions, since

∑yi = 1, and

∑xi = 1

2The validity of the phase rule for the flash problem is explained in reversed order. If N − 1 zi’s are fixedin the N equations of (4.10),the number of unknowns is N − 1 for yi, N − 1 for xi, and 1 for Vf , giving 2N − 1unknowns. This makes the system under specified with degree N − 1. Since only N − 1 zi’s have to be fixed

21

Page 23: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

pressure and overal molar fraction z are known and the molar fractions of liquid and vapourphase are to be found as well as the molar liquid fraction Lf (unit [kmol/kmol]). The relationbetween x, y, z and Lf is per component:

zi = Lf xi + (1− Lf )yi (4.10)

The first 4 methods, given in the table are mainly useful in constructing phase diagrams formulticomponent mixtures. One of the variables to be found is always pressure or temperature.This only tells at which point the saturation state is reached, but not how much condensationwill occur. Solving the flash problem has a more practical purpose. For an input feed of totalcomposition zi, not only the composition zi of both liquid and gas phases can be predicted,but also the amount of condensate with the liquid fraction.

To solve any of the problems given in the table, a relation between molar liquid and gas molarfraction has to be known. The fugacity factor Φi relates molar fraction of liquid and molarphases to the fugacities in both phases,

ΦVi =

fVi

yipΦL

i =fL

i

xip(4.11)

so that the iso-fugacity condition of (4.8) gives for the ratio of molar liquid to gas fraction

yi

xi=

ΦLi

ΦVi

(4.12)

Equations of state provide expressions for the fugacity factors, see appendix B for the fullexpression for Peng-Robinson. With the combination of (4.10)with (4.12), flash algorithmscan be written. An example of such an algorithm is given in appendix B.2.

and the total amount of degrees of freedom is N , this leaves 2 properties to be chosen freely, temperature andpressure

22

Page 24: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 5

Inner pipe wall temperature

5.1 Introduction

As explained in chapter 3, the driving force for condensation or evaporation in the film modelis the concentration gradient between bulk gas and the gas at the interface. For this, thegas-side molar fractions of the condensate layer is needed. In chapter 6, a model will bepresented that calculates this gradient using phase equilibrium theory. The temperature atthe phase boundary is an important input variable. In this chapter it will be discussed howthis temperature can be calculated. In a first approach, the interface temperature can be setequal to the inner pipe wall temperature, as condensate film thicknesses are generally verysmall, and its heat resistance can often be neglected. Measurements of an axial temperatureand pressure profile in the pipe is available, see Figure 5.1. In this chapter, local innerpipe wall temperature will be calculated using these profiles. The goal is to evaluate if thewall temperature differs much from the known bulk gas temperature, so that it should beconsidered in the modelling of the condensation.

5.2 Governing equations

The following conservation laws will be used in the following.

Continuity equation:∂ρ

∂t+ ~∇ · (ρ~v) = 0 (5.1)

Energy equation in enthalpy [5]:

ρ∂h

∂t+ ρ~v · ~∇h =

∂p

∂t+ ~v · ~∇p + τ : (~∇~v)︸ ︷︷ ︸

viscid dissipation

+ ~∇ · ~qR︸ ︷︷ ︸radiation

− ~∇ ·~jq︸ ︷︷ ︸conduction

+ ρ~n · ~g︸ ︷︷ ︸gravity

(5.2)

5.2.1 Conductive heat loss

An expression is sought for the heat loss due to conduction through the pipe wall over everypoint along the pipe length, using the p, T profiles of Figure 5.1. First consider the energyequation (5.2). When written in a cylindrical coordinate system, the radial velocity vr iszero, which is correct for very small condensation rates. Due to axial symmetry, the angular

23

Page 25: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

0 50 100 150 200 250 300 35060

65

70

75

80

85

90

p [b

ar]

pipe length [km]

0 50 100 150 200 250 300 3505

10

15

20

25

30

T [K

]

pipe length [km]

Figure 5.1: measured axial pressure and temperature profile in the bulk gas over the pipelinelength

velocity vθ is set zero as well. The situation is considered in steady-state, which eliminatesthe time term on the left hand side. On the right hand side, there are 4 possible heat losseffects for the general case. At the highly turbulent conditions, viscid dissipation can besignificant, but it acts only inside the pipe and cannot cause heat loss through the pipe wall.It is therefore discounted for in the measured pressure and temperature profiles. Radiationcan be fully neglected at the low temperatures of the pipe and its surroundings. The gravityterm is not considered as the measurements are for a purely horizontal pipe. The only termthat is considered is therefore heat loss trough conduction. Axial conduction can be neglectedcompared to axial convection. This leads to the following energy balance:

ρvz∂h

∂z= vz

∂p

∂z− 1

r

∂(rqr)∂r

(5.3)

First, the following cross-sectional averages are introduced:

u =4

πd2p

∫ 2π

0

∫ d/2

0vz(r) r dφ dr, ρ =

4πd2

p

∫ 2π

0

∫ d/2

0ρ(r) r dφ dr,

h =4

πd2p

∫ 2π

0

∫ d/2

0h(r) r dφ dr, T =

4πd2

p

∫ 2π

0

∫ d/2

0T (r) r dφ dr (5.4)

Here, u is the averaged axial velocity, ρ is the averaged mass density, h the averaged enthalpyand T the averaged temperature. Pressure needs not to be averaged, as it can be shown with

24

Page 26: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

the Navier-Stokes equation that it is constant in radial direction, see section 3.2.2. Now bothsides of (5.3) can be easily integrated over the cross-sectional area to obtain:

πd2

4ρ u

∂h

∂z=

πd2

4u

∂p

∂z− π d qr|r=d/2 (5.5)

Gas enthalpy is defined as ∂h = cp ∂T , the zero value is taken at h(T = 0K) = 0. Nowthe energy equation can be rewritten in terms of temperature, density and pressure only.Rearranging (5.5) gives the following expression for the heat loss trough the pipe wall:

qr(z) =d

4u(z)

(∂p

∂z− ρ cp

∂T

∂z

)(5.6)

With this expression the inner pipe wall temperature can be calculated in the following way.With Newton’s law of cooling,

qr = α(TG − TW ), (5.7)

an effective heat transfer coefficient α is defined that is found from an empirical Nusseltequation. The Gnielinski equation (3.25) is used. The inner pipe wall temperature is thusfound with

TW (z) = TG(z)− qr(z)α

, (5.8)

where qr(z) is calculated with (5.6).

5.2.2 Axial velocity

The Reynolds number is used in the calculation of the heat transfer coefficient with the Nusseltnumber. Therefore, an expression for the axial velocity is needed. This is obtained with thecontinuity equation (5.1). Neglecting the time term and radial and tangential velocities vr

and vθ, it reads:

ρ∂vz

∂z+ vz

∂ρ

∂z= 0 (5.9)

Again, this is integrated over the cross-sectional pipe area and written with the definitions of(5.4) to obtain:

ρ∂u

∂z+ u

∂ρ

∂z= 0 (5.10)

With the boundary condition u(z = 0) = u0 this gives for the axial velocity profile:

u(z) = u0 e− 1

ρ∂ρ∂z

z (5.11)

The last unknown is appropriate inlet velocities u0. Typical volumetric flow rates of the pipeare known and vary between 0.5 – 2.5 ·106 m3/h at standard conditions (Tstd = 273.15 K,pstd = 1 atm). It is assumed that at other conditions differing from standard, equal mass flowrates m = V ρ are present. This implies,

(V ρ

)p,T

=(V ρ

)pstd,Tstd

(5.12)

25

Page 27: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

u0πd2

4ρ0 = Vstdρstd (5.13)

The inlet velocity can thus be calculated with:

u0 = Vstd4

πd2

ρstd

ρ0

(5.14)

5.2.3 Density and property data

Mass density and its axial gradient are needed in (5.5) and (5.11). The density is calculatedwith the Peng-Robinson equation of state. As pure methane is considered, the temperatureis always well above its critical value of 190.6 K and finding the roots of the compressibilityfactor is straightforward. The real gas factor is discussed in chapter 4. As the naturalgas is extremely high in methane content, all the physical data as heat capacity, thermalconductivity, dynamic and static viscosity were taken for pure methane. The used correlationsfor the heat capacity and the viscosity are given in appendix D.

5.3 Results

For volume flows at standard conditions ranging from 1.0 · 106m3/hr to 3.0 · 106m3/hr theaxial velocity profile is given in Figure 5.2. The (p, T ) profiles of Figure 5.1 were used.

0 50 100 150 200 250 300 3502

4

6

8

10

12

14

z [km]

u [m

/s]

Vst

=1.0e6 m3/hrV

st=1.5e6 m3/hr

Vst

=2.0e6 m3/hrV

st=2.5e6 m3/hr

Vst

=3.0e6 m3/hr

Figure 5.2: Axial gas velocity for a set of volume flows at standard condition

26

Page 28: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

The resulting axial temperature profile for the inner pipe wall is given in Figure 5.3, togetherwith the value in the bulk gas. The volume flow is 2.5 · 106m3/hr

0 50 100 150 200 250 300 350280

285

290

295

300

305

z [km]

T [K

]

bulk gaswall

Figure 5.3: Axial temperature profile for bulk gas and inner pipe wall

It can be seen that the difference between bulk gas and wall temperature is extremely small,lying in the order of a few Kelvin. It is interesting to see that at a certain point, the bulktemperature goes under the wall temperature. This can only be explained with the Joule-Thompson effect. This effect causes real gases to cool down or warm up during an expansionprocess at constant enthalpy. The definition of the Joule-Thompson coefficient is

µJT =(

∂T

∂p

)

H

(5.15)

The value of µJT is strongly dependent on temperature and pressure. For pure methane ina temperature range of 200 to 700 K and a pressure range of 0 to 600 bar this coefficient isalways positive [3]. Natural gas with a high methane fraction is thus cooled during adiabaticexpansion in this p, T range. This is clarified in Figure 5.4, where the radial heat loss fluxis given separately for the pressure and the conduction term in (5.6). The conduction termdecreases over the pipe length but it is always positive. The pressure term is negative overthe whole range due to Joule Thompson expansion. At a certain point the sum of the twoterms becomes zero, causing the temperature difference between bulk and wall to change insign.

27

Page 29: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

0 50 100 150 200 250 300 350−40

−20

0

20

40

60

80

z [km]

q r [W/m

2 ]

pressure termconduction termtotal

Figure 5.4: Radial heat loss flux over pipe length

28

Page 30: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 6

Combination model

In this chapter, a model will be proposed that combines the film theory with phase equilibriatheory to obtain a method that is able to calculate condensation rates for a multicomponentmixture at high pressure.

6.1 Introduction

As shown in chapter 3, to predict mass flow with the film model, concentrations (or equiv-alently molar fractions) of each component have to be known in both the bulk gas as onthe gas-side of the phase boundary between gas and condensate. The axial concentration inthe bulk gas is relatively easy to calculate if locally the mass transfer flow is known. Thechallenge is to predict the concentrations on the phase boundary. If there would be a theorythat would be able to predict these concentrations perfectly, the condensation rate that thefilm model predicts are accurate. For simple mixtures at standard pressure and temperatureconditions, this is trivial. Take for example the case of an air-water vapour mixture flowingtrough a cold pipe. Air can be considered incondensable at room pressure and temperature.This leaves water as the only condensable component. At the gas-side of the phase boundary,water vapour is in thermodynamic equilibrium with its liquid and is saturated in the gasphase. Since for ideal gases the molar fraction is equal to the ratio of partial to total pressure,the molar fraction of water vapour at the phase boundary is given directly by

yv =psat(T )

p(6.1)

As indicated, the saturation pressure is only a function of temperature and an empiricalequation like Antoine can be used.For multicomponent mixtures with multiple condensable components, the molar fractions ina saturated gas mixture do not only depend on temperature and pressure, but also on thecomposition of the liquid phase. At low pressures, Raoult’s law gives a relation between molarfraction in gas and in liquid per component,

yi = γixpsat(T )

p(6.2)

where γi is the activity coefficient. At high pressures, the real gas behaviour must be accountedfor in the equilibrium of the vapour-liquid mixture. Not only does the gas molar fraction

29

Page 31: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

depend on the liquid molar fractions, it is also strongly dependent on pressure. As shownin chapter 4, the condition of iso-fugacity in the phases leads to an expression in fugacityfactors:

yi = xiΦL

i

ΦVi

(6.3)

Equations of state provide expressions for the fugacity factors.

Problems arise when it is tried to apply the expressions (6.1) and (6.2) to the situation understudy. To predict the concentrations y on the gas-side of the phase boundary with theseexpressions, the composition of the condensate x has to be known. If there are no measure-ment data available, it is not possible to predict the composition based on temperature only.Estimation methods, like a flash calculation can be used. For the low pressure case wherephase equilibria are not strongly influenced by pressure, this is a possibility.

If the pressure is high, calculations are more difficult. It is not possible to choose temperatureand pressure, and additionally choose the composition of one phase. If temperature andpressure are known, only a set of combinations of both phases will be possible. The simplerelation given in (6.2) is therefore not combinable with mass transfer.

6.2 Construction of control volumes

The basis of the combined model is the construction of two separate control volumes. Thepipe’s cross section is divided in a large control volume lying in the center of the pipe rep-resenting the bulk gas, and a small control volume on the pipe wall wherein the condensatein the form of a film is located, see Figure 6.1. To model the diffusive mass transfer betweenthe volumes the film theory is applied. The amount and composition however is calculatedwith flash calculations. As the model will be implemented in Aspen Dynamics later on, somebalancing equations are not necessary. Axial heat and impuls transport are not modelled,giving known pressure and temperature profiles. The model takes the following assumptions:

• At t = 0, only gas is present in the control volume on the wall, with the same compositionas in the bulk

• Condensation occurs purely filmwise. Film thickness is thin and covers the wall uni-formly in a pipe increment

In the following, equations that relate to the control volume on the pipe wall will have indexcv, the control volume in the bulk will have no index.

6.2.1 Bulk volume equations

The mass conservation in the bulk gas will be derived here. For a pipe element of length dx,diameter dp and volume dV , the total inside the volume (unit [kmol]) is given by

M = ρ dV

With the bulk molar fraction in the volume given by yi,∞, the mass per component is

30

Page 32: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

in&

1j− j

Control volume bulk

Control volume wall

0,iy~

0,ix~

∞,iy~

Condensate film f

Molar mass transport

Figure 6.1: control volumes for the combined model

Mi = y∞,i M

When the molar transport between the two volumes is given by ni, the mass conservation forthis volume is

∂Mi

∂t+ dV

(ρi u)∂x

− ni π dp dx (6.4)

where u is the cross-sectional averaged bulk velocity. Note that ni is defined negative forcondensation and positive for evaporation.

6.2.2 Wall control volume equations

Since axial transport of condensation is not considered, the mass balance of the wall controlvolume is simply

∂Mcv,i

∂t= ni π dp dx (6.5)

As mass flows in or out of the control volume, the composition changes in time. The overalmolar fraction zcv,i in the control volume at any time is given by:

zcv,i = Mcv,i/n∑

i=1

Mcv,i (6.6)

Pressure is constant radially and the value of the bulk gas is taken. Since it is assumed thatthe film thicknesses are thin, the condensate surface temperature is set equal to the inner walltemperature. It is found with the expression derived in chapter 5,

31

Page 33: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

TW = TG − d

4u

(∂p

∂z− ρ cp

∂T

∂z

)/α with α = f(Nu) (6.7)

The most important part of the model is the manner in which phase equilibria are coupledwith mass transfer. As mentioned before, to use any form of diffusive mass transfer model,vapour concentrations have to be known at the location were condensation takes place. Themethod proposed here is to perform flash calculations on the control volume at the wall. Att = 0 the control volume is filled with the bulk gas everywhere along the pipe length. A flashis then applied to the gas with composition zcv at the local temperature and pressure

(ycv,i, ycv,i, Lf ) = flash(zcv, p, T ) (6.8)

giving the molar fractions ycv,i and xcv,i of gas and liquid phases, and the liquid fraction Lf .If locally the dew line is crossed, this is expressed by a positive liquid fraction Lf > 0. Thefilm thickness at that point is found by

f = LfMcv

ρL π dp dx(6.9)

Inside this volume, there is equilibrium between gas and liquid phases. Where no condensateis present, the liquid and vapour molar fractions are equal to the bulk gas molar fraction, sothat no concentration gradient appears: y∞,i− ycv,i = 0. If condensate is present however, thevapour molar fraction of the lower volatile components will decrease in the control volume.A mass flow from bulk to wall causes those components to flow into the control volume. Atthe next time step, again a flash is applied to the control volume. Due to the higher overalconcentration of heavy components, the liquid fraction increases, resulting in growth of thefilm thickness.

It should be mentioned that the wall control volume is a virtual volume. It does not occupyspace, nor is the mass that is present at t = 0 subtracted from the total mass inside a pipeincrement. Its only purpose is to provide a space where the condensation that occurs can becalculated with phase equilibria in a simple manner.

6.2.3 Mass transfer term

So far the mass transfer term was not discussed. The rate at which mass is transferred to thewall, and therefore the condensation rate, is diffusion controlled and is modelled with filmtheory. The original derivation is done for a binary mixture. Where the original equation wasderived for a mixture with one condensable component, small adaptations can be made toapply it to a multicomponent mixture. The form of (3.11) can be written for n components,

ni = ρβi ln(

1− yi,∞1− yi,0

)(6.10)

The mass transfer coefficients βi are then obtained from n Sherwood relations of the form(3.26) with:

βi =ShiDi,m

dp(6.11)

32

Page 34: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

The Schmidt numbers are defined as:

Sci =µi

ρDi,m(6.12)

The term Di,m in (6.11) and (6.12) is the so called effective diffusion coefficient. This adap-tation enables to use diffusion coefficients that are defined for binary mixtures for multicom-ponent systems. Its definition is [13]:

Di,m = (1− yi)/n∑

j=1,i6=j

yj

Di,j(6.13)

The derivation of the effective diffusion coefficient assumes that when one component diffusestrough the mixture, the others are at rest.

Mi = Lf x Mtot + (1− Lf ) y Mtot (6.14)

33

Page 35: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 7

Numerical results

In this chapter, the numerical results are given that are obtained with the implementation ofthe combination model of chapter 6 in Aspen Dynamics for a natural gas of 32 components,see appendix C for the composition.

7.1 Temperature and pressure profiles

First, axial temperature and pressure profiles obtained with Aspen Dynamics are given inFigure 7.1, for a set of different inlet temperatures. The soil temperature is set at 275K,representing a winter situation. The volume flow at standard conditions is 2.5 · 106m3/hr.The heat transfer coefficient between the bulk gas and the ambient soil temperature is set at aconstant value of 4.1W/mK in all simulations, as it has been proven in industrial practice thatthis value provides results that are close to the profiles that are obtained with measurements.Clearly visible is the fact that at end of the pipe, the bulk gas temperature goes under thesoil temperature. This is due to the Joule-Thompson effect as mentioned in chapter 5. Itnot shown here, but it is also the location where the difference between bulk gas and walltemperature change in sign, from that point on, the wall is colder than the bulk gas. Thesimulations that follow all give the same (p,T) profiles. Running the program with and withoutthe condensation model did not change the results significantly, which can be explained bythe small rate of condensation, which will be shown later on. As can be seen, the pressureprofile does not depend strongly on the inlet temperature.

7.2 Phase diagram

Phase diagrams for natural gases were discussed in chapter 4. It was pointed out that crossingthe dew line from a pure gas phase into the two-phase region is the criterion on whether or notcondensation occurs. Dew lines for the gas under study are given in Figure 7.2. As indicatedin appendix C, the concentration of the low volatile component is not exactly known. Thedew lines are given for a molar fraction of 5.5 ·10−7 and 5 ·10−6. As can be seen, the additionof a few ppm of this component drastically changes the form of the phase diagram. On thephase diagram, the pressure and temperature combinations of the axial profiles of Figure 7.1are drawn over the dew lines. For both gas compositions, the (p,T) profiles cross the dewlines. For the gas composition with the lower concentration of the low volatile component, theline is crossed somewhere along the pipe, the location being further downstream as the inlet

34

Page 36: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

0 50 100 150 200 250 300 35050

60

70

80

90

100

pipe length [km]

pres

sure

[bar

]

Tin

=304 KT

in=312 K

Tin

=333 K

0 50 100 150 200 250 300 350270

280

290

300

310

320

330

340

pipe length [km]

Tem

pera

ture

[K]

Tin

=304 KT

in=312 K

Tin

=333 K

Figure 7.1: Axial temperature and pressure profile for a set of inlet temperatures. The soiltemperature is 275 K

temperature is higher. For the other gas composition, the start of condensation is furtherupstream.

270 280 290 300 310 320 330 340 3500

20

40

60

80

100

120

140

Temperature [K]

pres

sure

[bar

]

Tin

=312 K Tin

=322 K Tin

=333 K

molar fraction LVC=5.5e−7molar fraction LVC=5e−6

Figure 7.2: Dew lines of the natural gas for two gas compositions, calculated with the Peng-Robinson equation of state in Aspen Plus. The axial (p,T) profiles of Figure 7.1 are added.

35

Page 37: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

7.3 Flash calculation

As no experimental data are available, first the results of a standard calculation method areshown. Multiphase programs often provide some means of calculating the liquid fraction ina pipe. Aspen Dynamics provides a two-phase calculation where molar liquid and vapourfraction can be calculated. It is important to note that in this calculation, the assumptionis made that the condensate flows at the same speed as the bulk gas. Since there is novelocity difference between the two phases, thermodynamic equilibrium can be assumed insidea volume element flowing trough the pipe. This implies that the composition and liquidfraction are only dependent on the pressure and temperature that are locally present. Aflash calculation can be applied to the volume of a pipe increment to obtain composition ofliquid and gas phases, and the vapour and liquid fraction. In Figure 7.3, results for thesecalculations are given.

0 50 100 150 200 250 300 3500

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

pipe length [km]

film

thic

knes

s [µ

m]

Tin

=304 KT

in=312 K

Tin

=333 K

Figure 7.3: film thickness over pipe length with flash calculation. The molar fraction of thelow volatile component is 5.5 · 10−7

The parameter used used here to indicate the amount of condensate is film thickness, whichis calculated from the liquid volume in a pipe increment as follows

f =VL

π dp dx

with f the film thickness, VL the liquid volume in an pipe increment, ρL the liquid massdensity, dp the pipe diameter and dx the length of a pipe increment. The film thicknessesthus obtained are extremely small, being in the order of few µm. Up to 220 km, only a smallliquid fraction is found, due to the deposit of components that have a high dew point. Onlyfurther downstream, the dew point of other components is reached that condense in largerquantities. The maximum of the film thickness is reached at the end of the pipe, where thepressure and temperature combination is such that the mixture is at the maximum liquidfraction in the two phase region. As it shows, the inlet temperature does not have an effect

36

Page 38: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

on the location of the film thickness maximum, but only on the amount of condensate. Whencomparing Figure 7.3 to 7.2, one would expect the condensation to start further downstreamfor higher inlet temperatures. This can be observed. At about 50 km, the condensation startsfor the lowest inlet temperature. For the lower temperatures, condensation does start moredownstream, but the amount is too little to see much difference.

7.4 Time dependent film thickness profile

With the combination model implemented in Aspen Dynamics, dynamic runs can be made.In Figure 7.4, the growth of the condensate film thickness is shown at 4 time intervals up to atime of 107 hours. The inlet temperature is 312 K, the soil temperature is 275 K and the molarfraction of the low volatile component is 5.5 · 10−7. The combination model, as explained,uses flash calculations in a control volume on the pipe wall to determine the amount andcomposition of condensate. The mass transfer to the control volume is diffusion controlled.At the first time step, the control volume is filled with a gas that has the same composition asthe bulk gas. The line at t=1 hour lies closely to this start value and shows a profile that istypical for the result obtained with a flash procedure only, like in Figure 7.3: the maximum offilm thickness lies towards the end of the pipeline. For longer running times, the effect of thediffusive mass transfer is visible. The condensation of the first components starts at about 50km, meaning that the dew point is locally reached. This location is in agreement with Figure7.3. Downstream from that point, those components leave the bulk gas, resulting in a lowerconcentration in the bulk gas. The concentration gradient between bulk and wall decreases,resulting in decreasing film thicknesses downstream. Further downstream, at a 100 km, thesame is observed for the components with a lower dew point. It can be seen that a maximumof the film is reached at about 150 km.

0 50 100 150 200 250 300 3500

10

20

30

40

50

60

70

80

pipe length [km]

film

thic

knes

s [µ

m]

t=1 hrt=50 hrst=80 hrst=107 hrs

Inlet temperature= 312 Kmolar fraction low volatile component (LVC), inlet = 1e−6 Soil temperature = 275 K

Figure 7.4: Growth of film thickness in time with the combined model

37

Page 39: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

7.5 Film thickness growth rate

As the interest of this study lies in the long term accumulation of condensate, the growth ofthe film thickness in time is important. Although the simulation time in Figure 7.4 is only107 hours, it proves that the rate of growth of the film thickness at a certain location in thepipe is perfectly linear if the conditions for pressure, temperature and composition are setconstant, even if the simulation is run for months. In Figure 7.5 and 7.6, the film thicknessgrowth rate in the pipe is given for a winter and summer situation respectively. The unitused is [mm/year]. The growth rate is considerable, locally reaching maxima of 4.5 mmper year in summer and 6.5 mm per year in winter. The location of the maximum growthrate is influenced by inlet temperature. Lower inlet temperatures influence the location of themaximum of the growth rate, showing a more downstream location as the inlet temperature ishigher. The effect is very weak however. An influence on the maximum itself is not observedat all.

0 50 100 150 200 250 300 350−1

0

1

2

3

4

5

6

7

film

thic

knes

s gr

owth

rat

e [m

m/y

ear]

pipe length [km]

TSoil

=275 K

Tin

=312 KT

in=322 K

Tin

=333 K

Figure 7.5: Film thickness growth rate in mm per year for 3 inlet temperatures. The soiltemperature is 275 K, representing winter. The molar fraction of the low volatile component(LVC) is 5.5 · 10−7

7.6 Condensation rate of individual components

The film thickness does not reveal how the individual components condense. A better indica-tion is the amount of condensed kmoles per component per pipe element. Like film thickness,the rate of change proved to be perfectly linear, allowing to show the results in a rate formu-lation. In Figure 7.7 to 7.10, the rate of change of the condensed kmoles per meter is givenfor 9 components of the natural gas. The used unit is kmol/(myear). All figures are for awinter situation, with a soil temperature of 273 K. Figure 7.7 shows the rate of condensationfor a molar fraction of the low volatile component of 5.5 · 10−7. It can be seen that the lowvolatile component is the first to condense at 50 km. Its condensation rate then decreases,

38

Page 40: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

0 50 100 150 200 250 300 350−1

0

1

2

3

4

5

film

thic

knes

s gr

owth

rat

e [m

m/y

ear]

pipe length [km]

TSoil

=283 K

Tin

=312 KT

in=322 K

Tin

=333 K

Figure 7.6: Film thickness growth rate in mm per year for 3 inlet temperatures. The soiltemperature is 283 K, representing summer. The molar fraction of the low volatile componentis 5.5 · 10−7

until the other components start to condense at 100 km. Clearly, tri-decane, tetra-decaneand penta-decane have the highest condensation rates. Both the more volatile componentsdecane, undecane and do-decane, and the less volatile components hexa-decane and C20 con-dense at a lower rate. The same conditions as in Figure 7.7 are taken in Figure 7.8, exceptthat the low volatile component is not added to the gas this time. The condensation ratefor the other components proves to be somewhat lower, and the maximum of condensation ismore downstream in the pipeline.Figure 7.7 shows the same graph for a higher molar fraction of the low volatile component,5.5 · 10−7. The condensation maximum is clearly at a more upstream location in the pipe.An influence on the rate of condensation of the other components is not observed, not on therate itself, nor on the location of the maximum. The last example is given in Figure 7.10,where the molar fraction of the low volatile component is 5.5 · 10−7.

39

Page 41: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

0 50 100 150 200 250 300 350−0.005

0

0.005

0.01

0.015

0.02

0.025

rate

of c

onde

nsat

ion

per

unit

leng

th [k

mol

/m y

ear]

pipe length [km]

C10C11C12C13C14C15C16C20LVC

Inlet temperature= 312 KInlet pressure = 90 barsmolar fraction low volatile component (LVC), inlet = 5.5e−7 Soil temperature = 275 K

Figure 7.7: Rate of condensation in kmol per meter per year for 9 natural gas components.The molar fraction of the low volatile component (LVC) is 5.5 · 10−7

0 50 100 150 200 250 300 350−0.005

0

0.005

0.01

0.015

0.02

0.025

rate

of c

onde

nsat

ion

per

unit

leng

th [k

mol

/m y

ear]

pipe length [km]

C10C11C12C13C14C15C16C20

Inlet temperature= 312 KInlet pressure = 90 barsmolar fraction low volatile component (LVC)=0 Soil temperature = 275 K

Figure 7.8: Rate of condensation in kmol per meter per year for 9 natural gas components.The low volatile component is not added to the mixture

40

Page 42: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

0 50 100 150 200 250 300 3500

0.005

0.01

0.015

0.02

0.025

rate

of c

onde

nsat

ion

per

unit

leng

th [k

mol

/m y

ear]

pipe length [km]

C10C11C12C13C14C15C16C20LVC

Inlet temperature= 312 KInlet pressure = 90 barsmolar fraction low volatile component (LVC), inlet = 1e−6 Soil temperature = 275 K

Figure 7.9: Rate of condensation in kmol per meter per year for 9 natural gas components.The molar fraction of the low volatile component (LVC) is 1 · 10−6

0 50 100 150 200 250 300 350−0.05

0

0.05

0.1

0.15

0.2

rate

of c

onde

nsat

ion

per

unit

leng

th [k

mol

/m y

ear]

pipe length [km]

C10C11C12C13C14C15C16C20LVC

Inlet temperature= 312 KInlet pressure = 90 barsmolar fraction low volatile component (LVC), inlet = 5e−6 Soil temperature = 275 K

Figure 7.10: Rate of condensation in kmol per meter per year for 9 natural gas components.The molar fraction of the low volatile component is (LVC) 5 · 10−6

41

Page 43: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Chapter 8

Conclusions and recommendations

8.1 Conclusions

The objective of this study, as posed in the introduction was to develop a model to predictthe condensation rate in time and place in the pipeline.

There are a number of possible condensation phenomena in a natural gas pipeline: fog for-mation and dropwise and filmwise wall condensation. The main criterion for the occurrenceof fog formation is the rate of supersaturation. Wall condensation occurs if the dew point ofthe gas is reached at the temperature and pressure that are present at the pipe wall. Thecriterium for whether dropwise or filmwise condensation occurs is determined by the contactangle between condensate and pipe wall, which depends on the composition of the conden-sate. Due to too many uncertainties in the modelling of the fog formation, and the unknowncontact angles between wall and condensate the assumption is made that condensation occursin a purely filmwise manner.

Radial temperature profiles are investigated to calculate inner pipe wall temperatures basedon known axial (T,p) profiles. At the high gas velocities inside the pipe, high Nusselt num-bers and heat transfer coefficient from bulk to pipe wall cause the difference between bulkgas temperature and inner wall temperature to be very small, reaching maximum values of afew Kelvin.

A model is proposed to predict filmwise wall condensation in the natural gas pipe in timeand place. The diffusive mass transfer rates are modelled with the classical film theory.The amount and composition of condensate is calculated with flash calculations, using phaseequilibria theory. The proposed model is implemented in an existing pipe model of AspenDynamics to predict the condensation behaviour of a 32 component Russian natural gas. Thefollowing results are obtained:

The location of where the first condensate starts to deposit is in accordance with the locationas calculated with standard two-phase flash calculations. The axial film thickness profile,however, is not. The flash calculations predict a large region in the middle of the pipe (atthe used conditions for temperature, pressure etc) where condensate is present, but the filmthicknesses are very small. This region contains mainly the low volatile component. At the

42

Page 44: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

end of the pipe the film thicknesses suddenly step to a high point, to reach maximum valuesat the end of the pipe. Overal, the film thickness is in the order of a few µm. The combinationmodel does not show sudden changes in the film thickness profile. Due to accumulation ofcondensate over time, large film thicknesses are obtained, also in the region where only thelow volatile component condenses. Maxima of the film thickness are observed more upstreamin the pipe.

For constant conditions of temperature, pressure, the growth rate of the film thickness provesto be constant in time. The growth rate that is observed is considerable, ranging from max-imum values of 4.5 to 6 mm/year, depending on soil temperature. Variation of the inlettemperature does not prove a big influence on the location nor the value of the maximumgrowth.

The condensation rate of individual components is examined. Indeed, the low volatile com-ponent reaches an early maximum along the length of the pipe. Other components start tocondense more downstream, all at the same location. It proves that the rate of condensationof octane up to hexa-decane is the largest, with the highest rate for tri- and tetra-decane.Typical condensation rates for these two components reach maxima of about 0.02 kmol /(myear). The presence of the low volatile component in the gas increases the condensation ratesof the other components somewhat.

8.2 Recommendations for further research

As mentioned before, the main goal of the study was to predict condensation in time andplace. A number of assumptions was made to be able to set up a working model, with thepossibility of extending at a later stage. Some assumptions proved to be false when the numer-ical results presented in chapter 7 are examined. The condensation rates and film thicknessgrowth rate proved to be much higher than expected. This is mainly due to the condensationof components, other than the low-volatile component. With the calculated local maxima offilm thickness of about 6 mm over the course of a year, an axi-symmetrical distribution of thecondensate can not be assumed anymore. At these quantities, axial transport of condensatecan become important, as well as the heat resistance of the condensate layer. A parameterthat was not considered at all was pipe inclination. If condensate layers would be thin, thisparameter would only have a minute influence on the axial pressure and temperature profiles.With the amount of liquid observed, condensate can flow to local terrain height minima andwill decrease the effective pipe cross section area, causing considerable losses of pressure. Itis therefore recommended to include axial transport of condensate in future extensions of themodel at the least, with pipe inclination as an extra possibility.

Other assumptions could not be evaluated. It is not investigated how large the effect of fogformation is. As the composition of the condensate is calculated with the model, contact an-gle measurements are now possible to evaluate the occurrence of dropwise instead of filmwisecondensation.

Only a number of parameter studies was done with the proposed model. Possible extraparameter studies are to investigate the effect of water content in the natural gas. As the low

43

Page 45: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

volatile component is able to absorb large quantities of water, condensate containing the lowvolatile component could grow additionally, even if the water concentration in the bulk gasis minute.A last point of concern is the chosen equation of state. As indicated, the calculated dewpoint for a mixture at fixed composition depends on how accurate the equation of stateis. This largely depends on the fact if the binary interaction parameters of the equationof state are experimentally tested for the specific natural gas. To give an indication, mostproperty calculation software like Aspen Properties does not have values for a number ofthose parameters at all, for example for the interaction of the low volatile component with allother relevant components. Research to adapt the Peng-Robinson equation of state for thegas under study is currently done.

44

Page 46: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Bibliography

[1] Baehr, H.D. and Stephan, K.: Heat and Mass Transfer, Springer-Verlag, 1998

[2] Brouwers, H.J.H.: film models for transport phenomena with fog formation, dr. thesisTechnische Universiteit Eindhoven, 1990

[3] Colina, C.M., Turrens, L.F., Gubbins, K.E., Olivera–Fuentes, C. and Vega, L.F.: Pre-dictions of the Joule–Thompson Inversion Curve for the n-Alkane Series and CarbonDioxide from the Soft-SAFT Equation of State, Ind. Eng. Chem. Res., 41, 1069–1075,2002

[4] Dohrn, R. Berechnung von Phasengleichgewichten; Vieweg Verlag, Braunschweig / Wies-baden, Germany, 1994.

[5] Goey, L., Somers L. and Bongers, H.: Verbrandingstechnologie, Technische UniversiteitEindhoven, 2002

[6] Geld, C.W.M. van der: Meerfasenstromingen met warmte-effekten, Technische Univer-siteit Eindhoven, 2001

[7] Gersten, K., Papenfuss, H.-D., Kurschat, Th., Genillon, PH., Fernandez Perez, F., Revell,N.: Heat transfer in Gas Pipelines, Oil & Gas Journal, pp. 30–34, 2001

[8] Gnielinski, V.: New equations for heat and mass transfer in turbulent pipe and channelflow, Int. J. Chem. Eng. 16, 1976, 359–368

[9] Hinds, William C.: Aerosol Technology - Properties, Behavior, and Measurement ofAirborne Particles, Wiley and sons, 1997

[10] King, C.J.: Separation processes, 2d edition, McGraw-Hill, New York, 1980, chapter 2

[11] R. Krishna, R., Taylor: Multicomponent Mass Transfer, J. Wiley & Sons, New York 1993

[12] Lammers, J.N.J.J.: Phase behavior of glycol in gas pipeline calculated, Oil & Gas Journal,April 15, 1991

[13] Numrich, Reiner: Stoff-, Warme- und Impulsaustausch bei der Kondensation von Ein-und Mehrkomponentensystemen, dr. thesis Technische Universiat Paderborn, 1994

[14] Poling, B.E., Prausnitz, J.M. and O’Connell, J.P.: The Properties of Gases and Liquids,5th edition, McGraw-Hill, 2001

45

Page 47: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

[15] Rijkers, M.P.W.M.: Retrograde condensation of lean natural gas, Delftse UniversitairePers, 1991

[16] Schram, P., Van Heijst, G. and Van Dongen, M.: Fysische Transportverschijnselen voorW, Technische Universiteit Eindhoven, 1994

[17] Shaber, S. Aerosolbildung bei der Absorption und Partialkondensation, Chem. -Ing. -Tech.62, nr 10, 1990, 793, 804

[18] Voulgaris, Marianna E.: Prediction and Verification of Hydrocarbon Liquid Drop Out ofLean Natural Gas, Delftse Universitaire Pers, 1995

[19] Wei, Y.S. and Sadus, R.J.: Equations of state for the calculation of Fluid-Phase Equilib-ria, AIChE Journal, Vol 46 pp. 169–196, 2000

46

Page 48: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Appendix A

Derivations for mass transfer

A.1 Concentration Equation

In the following, the concentration equation that is needed in the film model is derived.The continuity equation in vector notation is:

∂ρ

∂t+ ~∇ · (ρ~v) = 0 (A.1)

This can be written as:∂ρ

∂t+

∂(ρu)∂x

+∂(ρv)∂y

+∂(ρw)

∂z= 0 (A.2)

When applying (A.2) to a multicomponent system it expands into n equations of the form:

∂ρi

∂t+

∂(ρiui)∂x

+∂(ρivi)

∂y+

∂(ρiwi)∂z

= m′′′i (A.3)

Where m′′′i is the volumetric rate of the creation of a component i with chemical reactions.

The following identities are introduced. The total mass density is:

ρ =n∑

i=1

ρi (A.4)

And the so called bulk or mass-averaged velocities are:

u =1ρ

n∑

i=1

ρiui, v =1ρ

n∑

i=1

ρivi and w =1ρ

n∑

i=1

ρiwi (A.5)

When summing all n equations of (A.3) for all components with these identities, the generalform of (A.2) found again. The term m

′′′i disappears, as in the total mixture, no mass is created

or lost. With the concept of a bulk velocity, diffusion velocity can be defined as the velocityrelative to the bulk velocity, giving three expressions for diffusion mass flux [kg/(m2s)]:

jx,i = ρi(ui − u), jy,i = ρi(vi − v) and jz,i = ρi(wi − w) (A.6)

For a binary mixture, these fluxes are given by Fick’s law:

47

Page 49: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

jx,i = −D12∂ρi

∂x, jy,i = −D12

∂ρi

∂yand jz,i = −D12

∂ρi

∂z(A.7)

Combining (A.6) and (A.7) and substituting in (A.3), gives:

∂ρi

∂t+ u

∂ρi

∂x+ v

∂ρi

∂y+ w

∂ρi

∂z+ ρi

(∂u

∂x+

∂v

∂y+

∂w

∂z

)=

∂x

(D12

∂ρi

∂x

)+

∂y

(D12

∂ρi

∂y

)+

∂z

(D12

∂ρi

∂z

)+ m

′′′i (A.8)

This can be further simplified. If the flow is incompressible, the last part of the left-hand sideof (A.8) becomes zero. This assumption is valid for gas flows that are sufficiently subsonic,[16].

∂ρi

∂t+ u

∂ρi

∂x+ v

∂ρi

∂y+ w

∂ρi

∂z=

∂x

(D12

∂ρi

∂x

)+

∂y

(D12

∂ρi

∂y

)+

∂z

(D12

∂ρi

∂z

)+ m

′′′i (A.9)

This is the so-called concentration equation, also know as Fick’s second law. It can be writtencompact in vector notation, where the indices of the diffusion coefficient are omitted:

∂ρi

∂t+ ~v · ~∇ρi = ~∇ · (D~∇ρi) + m

′′′i (A.10)

A.2 Alternative variables

In literature, different variables than mass density are often used in mass transfer equations.It is therefore useful to write the above equations in a few alternatives.Molar fractions are often used. In the notation for a gas, the relation between a component’smolar fraction yi (unit kmol/kmol) and its density ρi is:

yi =(

M

ρMi

)ρi (A.11)

With M the mixture molar mass:

M =n∑

i=1

yiMi (A.12)

A different possibility is to write the equations in molar concentrations ρi (unit kmol/m3).Its relation with the densities is:

ρi = ρi/Mi (A.13)

A final notation is mass fractions ci (unit kg/kg). Its relation with densities is:

ci = ρi/ρ (A.14)

48

Page 50: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Appendix B

Equations of state

B.1 Peng-Robinson expressions

The Peng-Robinson equation in pressure form is

P =RT

v − b− aα

v(v + b) + b(v − b)(B.1)

where the parameters a and b are given by

a = 0.45724R2T 2

c

pc[1+S(1−T 0.5

r )]2, b = 0.07780RTc

pc, S = 0.37464+1.5422ω−0.26992ω2,

(B.2)The Peng-Robinson equation in terms of the compressibility factor is:

Z3 +[

bp

RT− 1

]Z2 +

[ap

(RT )2− 2bp

RT

(bp

RT+ 1 +

b

2

)]Z +

[b2p

RT

(bp

RT+ 1

)− ap

(RT )2bp

RT

]= 0

(B.3)Expressions for the liquid and gas fugacity factors are

lnΦLi =

bi

bL(ZL − 1)− ln(ZL −BL)− AL

2√

2BL(δL

i −bi

bL) ln

[ZL + (1 +

√2)BL

ZL + (1−√2)BL

]

lnΦVi =

bi

bV(ZV − 1)− ln(ZV −BV )− AV

2√

2BV(δV

i −bi

bV) ln

[ZV + (1 +

√2)BV

ZV + (1−√2)BV

](B.4)

(B.5)

Where for ZL and ZV the liquid and vapour root of the compressibility factor have to becalculated, with the liquid and gas expression for the parameters a and b, given further on.The parameters are defined as:

AL =aLp

R2T 2AV =

aV p

R2T 2BL =

bLp

RTBV =

bV p

RT(B.6)

49

Page 51: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

For the factors aL, aV , bL and bV certain mixing rules for multicomponent mixtures areneeded. The most widely used is the van der Waals rule:

aL =N∑

i

N∑

j

xixjaij aV =N∑

i

N∑

j

yiyjaij bL =N∑

i

xibi bV =N∑

i

yibi (B.7)

For the aij term in (B.7), multiple approaches are possible. Widely used are the quadraticmixing rule with one adjustable binary parameter:

aij = (aiiajj)1/2[1− kij ] (B.8)

Where kij is the binary interaction parameter, used to fit experimental data on the EoS.Generally, this is found by minimizing F , defined as:

F =∑

data

|PEoS − PExp| (B.9)

Different researchers proved the van der Waals mixing rules to be very accurate for non-polarmixtures (containing no water, alcohols etc.) [19].

B.2 Flash algorithm

The flash algorithm tries to find the liquid fraction Lf , the molar composition in the liquidphase xi and the molar composition in the gas phase yi from pressure, temperature and overalmolar fraction zi. Summarized, this gives

(Lf , xi, yi) = flash(zi, p, T )

In numerical programming, the following iterative scheme can be used, [14]:

1. Guess the liquid fraction Lf = 0.5

2. Solve the equation of state for the liquid compressibility factor ZL and for the vapourcompressibility factor ZV .

3. Calculate the liquid and vapour fugacity factors ΦLi and ΦV

i .

4. Calculate the K factor with Ki = ΦLi /ΦV

i .

5. See if∑

i(xi − yi) = 0, with

xi =zi

Ki + Lf (1−Ki)and yi = Kixi

6. If step 5 does not give zero, adjust the liquid fraction. For this, a fast root findingalgorithm like Newton’s method can be used. A possibility with an analytical derivativefor Lf is [10]:

Lnew = Lold −∑

i

zi(Ki − 1)Ki + (1−Ki)Lf

/zi(Ki − 1)2

(Ki + (1−Ki)Lf )2

7. Go back to step 2 until∑

i(xi − yi) = 0.

A number of good alternative iterative schemes is given by Dohrn [4].

50

Page 52: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Appendix C

Gas composition

The gas considered in this study is Russian natural gas consisting of 32 components with thefollowing molar fractions. Only the composition up to decane is shown. Typical for this gasis that the methane content is very high. A range for the molar fraction of the low volatilecomponent is given1.

Component molar fractionMethane 0.975Ethane 0.0102Propane 0.00349Butane 0.000729Isobutane 0.000699Pentane 8.0e-5Isopentane 0.000109Hexane 4.8e-5Heptane 1.8e-5Octane 2.0e-5Nonane 4.8e-6Decane 3.4e-6low volatile component 1e-7–1e-5

1The molar fraction of the low volatile component is not precisely known. The values taken here are basedon a prediction of the solubility of the component in pure methane in a temperature range of 290K − 320Kand a pressure range of 20 bar – 120 bar, as calculated with the Peng-Robinson equation of state (data notpublished).

51

Page 53: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Component molar fractionRest components: 0.00874C11C12C13C14C15C16C17C18C19C20C21C22BenzeneTolueneEthyl benzeneM-xyleneMethanolHEN2COCO2O2H2

52

Page 54: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Appendix D

Property data

The following low-pressure, ideal gas, temperature correlation is used for the heat capacity,[14]:

cp/(RM) = a0 + a1T + a2T2 + a3T

3 + a4T4 (D.1)

a0 4.568 ·100

a1 -8.975 ·10−3

a2 3.631 ·10−5

a3 -3.407 ·10−8

a4 1.091 ·10−11

Viscosity with low pressure, ideal gas correlation for hard sphere model:

η = 1 · 10−7 26.69(MT )0.5

σ2Ωv(D.2)

with σ = 3.758 for methane. The collision integral is:

Ω = A(T ∗)−B + C exp(−DT ∗) + E exp(−FT ∗) (D.3)

valid for,

0.3 ≤ T ∗ ≤ 100

where,

T ∗ =kT

ε(D.4)

For methane ε/k = 148.6 for methane and A = 1.16145, B = 0.14874, C = 0.52487, D =0.77320, E = 1.6178 and F = 2.43787.

53

Page 55: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Appendix E

Numerical programming

E.1 Matlab

Below the code for the original matlab model is given. For a 3-component mixture, consist-ing of Methane, Decane and Tri Ethylene Glycol, the growth of condensate film thickness iscalculated. Given are the mother file and the used subfiles.

In the main file motherfile.m. known axial temperature and pressure profiles are imported.Then, in a double for loop (time and place) the following is calculated: gas-side compo-nent concentrations, mixture velocity, mixture density, mixture Reynolds number, componentSchmidt numbers, Nusselt number, friction factor, component Sherwood numbers, heat trans-fer coefficient, component mass transfer coefficient and molar mass flow. Then, the growthof the condensate film as well as the changed bulk gas concentration is calculated with thesemolar mass flows. A number of function subfiles is used.

In order to calculate density for real gases, the compressibility factor is calculated in realgas.m.It uses the Peng-Robinson Equation of State. Input is pressure and temperature.

Effective Diffusion coefficients are needed to apply the binary Fickian Diffusion equations toa multicomponent mixture. This is done in diff1.m, with one file for each component.

The wall temperature is calculated in walltemp.m. It takes as input the soil temperature,bulk gas temperature and heat transfer coefficient bulk gas to wall.

The phase boundary temperature is calculated in surfacetemp.m. It takes the wall temper-ature, heat transfer coefficient bulk gas to wall and film thickness as input.

The most important subfile is flash.m. It calculates the concentrations of the componentson the gas side of the phase boundary. It takes as input the phase boundary temperature,pressure and total composition of the control volume.

motherfile.mclear all, close all, clc

warning off MATLAB:divideByZero

54

Page 56: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

% Reiner Numrich kondensatieprogramma.

% "Stoff-, Waerme- und impulsaustausch bei der Kondensation von Ein- und mehrkomponentsystemen"

% simulating numrich results on page 73, for methane decane TEG

Nj = 14; % number of steps for distance

Ni = 40; % number of time steps

z_tot = 350000; % total distance [m]

dz = z_tot/(Nj+1); % distance step [m]

d = 1; % Pipe diameter [m]

v(1) = 10; % [m/s]

time_dim_less = 0.002; % dimensionless time: number of times that the gas flows through the whole pipe

t_tot = time_dim_less*z_tot/v(1);

t_tot_hours = t_tot/3600; % total process time [hours]

bias_t = 1; % distribution of timestep

dt(1) = t_tot/(bias_t*Ni); % timestep [s]

T_S = 273+10; % Soil temperature;

R = 8.3145; % universal gas constant

lambda = 0.035; % thermal conductivity of methane [W/(m*K)] at T=293 K, p=1 atm (binas, page 23)

Pr = 0.72; % Prandtl number of air [kg/(s*m)] at T=293 K, p=1 atm (Bejan, page 646)

M_methane = 16.04e-3; % molar mass of methane [kg/mol]

M_decane = 142.285e-3; % molar mass of decane [kg/mol]

M_TEG = 150e-3; % molar mass of TEG [kg/mol]

eta = 1.107e-5; % dynamic viscosity methane [kg/(s*m)]=[Pa*s] (Bejan, page 646)

rho_cond1 = 451.3; % density of methane [kg/m^3] at T=293 K, p=90 atm?????

rho_cond2 = 578.4; % density of decane [kg/m^3] at T=293 K, p=1 atm?????

rho_cond3 = 626.19; % density of TEG [kg/m^3] at T=293 K, p=1 atm????

N = 3; % number of components

% number of components

z_CH4 = 0.998;

z_C16H34= 1e-6;

z_TEG = 1-z_CH4-z_C16H34;

zi = [z_CH4, z_TEG, z_C16H34];

Tc = [190.6, 617.7, 797]; %[K]

pc = [46.0e5, 21.10e5, 33e5]; %[Pa]

omega = [0.008, 0.490, 0.514];

% start values for program

% dH_G(1,1) = 0;

t(1) = 0;

z(1) = 0;

Delta_T = 4.539999999999998e+001;

T_S = T_S;%*ones(Ni+1,Nj+2);

T_G(1,1) = T_S(1,1)+Delta_T*exp(-1.08e-5*(1)*dz);

T_W(1,1) = walltemperature(T_G,T_S); % see function wall temperature

T_O(1,1) = T_W+0.0001*Delta_T; % approximation: T_W~T_0

p(1) = 90e5;

z_meth(1) = realgasf(p(1),T_G(1,1),pc(1),Tc(1),omega(1)); % see function realgasf.m

c_G(1,1) = p(1)/(z_meth(1)*R*T_G(1,1));% molar concentration of gas [mol/m^3]

rho_G(1) = c_G(1,1)*M_methane; % density of gas [kg/m^3]

yD1_G(1,2:Nj+2) = ones(1,Nj+1)*zi(1);

yD2_G(1,2:Nj+2) = ones(1,Nj+1)*zi(2);

yD3_G(1,2:Nj+2) = ones(1,Nj+1)*zi(3);

yD1_G(1,1) = zi(1);

yD2_G(1,1) = zi(2);

yD3_G(1,1) = zi(3);

yD1_o(1,2:Nj+2) = 0;

yD2_o(1,2:Nj+2) = 0;

yD3_o(1,2:Nj+2) = 0;

yD1_o(1,1) = yD1_G(1,1);

yD2_o(1,1) = yD2_G(1,1);

yD3_o(1,1) = yD3_G(1,1);

[Li(1:Ni+1,1) xi yi] = flash(p(1),T_O(1,1),N,zi,pc,Tc,omega,1-zi(1)) % take as starting value for L0, the amount of condensable, non-methane gases

% yD1_o(1,1) = yi(1);

% yD2_o(1,1) = yi(2);

% yD3_o(1,1) = yi(3);

c_D1(1,:) = yD1_G.*c_G;

c_D2(1,:) = yD2_G.*c_G;

c_D3(1,:) = yD3_G.*c_G;

D1(1) = Dm1(yD1_o(1,1),yD2_o(1,1),yD3_o(1,1),p,T_O(1,1));

D2(1) = Dm2(yD1_o(1,1),yD2_o(1,1),yD3_o(1,1),p,T_O(1,1));

D3(1) = Dm3(yD1_o(1,1),yD2_o(1,1),yD3_o(1,1),p,T_O(1,1));

Sc1(1) = eta/(rho_G(1)*D1(1));

Sc2(1) = eta/(rho_G(1)*D2(1));

Sc3(1) = eta/(rho_G(1)*D3(1));

Re = v*d/eta;

ksi_g = (1.82*log(Re)-1.64)^-2;

Nu = (ksi_g/8)*(Re-1000)*Pr/(1+12.7*sqrt(ksi_g/8)*(Pr^(2/3)-1));

55

Page 57: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

Sh1(1) = (ksi_g/8)*(Re-1000)*Sc1(1)/(1+12.7*sqrt(ksi_g/8)*(Sc1(1)^(2/3)-1)); % sherwood relation used by numrich

Sh2(1) = (ksi_g/8)*(Re-1000)*Sc2(1)/(1+12.7*sqrt(ksi_g/8)*(Sc2(1)^(2/3)-1)); % sherwood relation used by numrich

Sh3(1) = (ksi_g/8)*(Re-1000)*Sc3(1)/(1+12.7*sqrt(ksi_g/8)*(Sc3(1)^(2/3)-1)); % sherwood relation used by numrich

alpha_G = Nu*lambda/d;

beta_1(1) = Sh1(1)*D1/d;

beta_2(1) = Sh2(1)*D2/d;

beta_3(1) = Sh3(1)*D3/d;

% Sh1(1) = 0.023*Re^0.8*Sc1(1)^(1/3);

% Sh2(1) = 0.023*Re^0.8*Sc2(1)^(1/3);

% Sh3(1) = 0.023*Re^0.8*Sc3(1)^(1/3);

% q_G(1,1) = alpha_G*(T_G(1,1)-T_W(1,1));

% q_D(1,1) = beta_G(1)*c_G(1,1)*(yD_G(1)-yD_o(1));

% q(1,1) = q_G(1)+q_D(1);

df1(1,1) = 0;

df2(1,1) = 0;

df3(1,1) = 0;

f1(1,:) = zi(1)*1e-6*ones(1,Nj+2); % Start with a certain film thickness

f2(1,:) = zi(2)*1e-6*ones(1,Nj+2);

f3(1,:) = zi(3)*1e-6*ones(1,Nj+2);

% time independent input variables:

for i=1:Ni+1

for j=1:Nj+2

T_G(i,j) = T_S(1,1)+Delta_T*exp(-1.08e-5*(j)*dz);

T_W(i,j) = walltemperature(T_G(i,j),T_S(1,1)); % see function walltemperature.m

end

end

for i=1:Ni+1

for j=1:Nj+1

z(j+1) = z(j) + dz;

% prescribed temperature and pressure profile

% if j>2

% T_W(i,1)=2*T_W(i,2)-T_W(i,3); % extra numerieke randvoorwaarde voor j=1

% end

T_O = T_W+0.0001*Delta_T;

% if j<10

p(j+1) = p(1)*(1-(j)*dz*(1/3)/z_tot);

% else

% p(j+1) = 30e5;

% end

%

zi = [yD1_G(i,j+1) yD2_G(i,j+1) yD3_G(i,j+1)];

if i==1

[Li(i,j+1) xi yi] = flash(p(j+1),T_O(i,j+1),N,zi,pc,Tc,omega,Li(i,j)); % for first time step, no information on i-1 is available

else

[Li(i,j+1) xi yi] = flash(p(j+1),T_O(i,j+1),N,zi,pc,Tc,omega,Li(i-1,j+1));

end

if Li(i,j+1)<=0

disp(’L<0, there is no liquid at film surface’)

end

z_meth(j+1) = realgasf(p(j+1),T_G(i,j+1),pc(1),Tc(1),omega(1)); % see function realgasf.m

c_G(i,j+1) = p(j+1)/(z_meth(j+1)*R*T_G(i,j+1));

rho_G(j+1) = c_G(i,j+1)*M_methane;

v(j+1) = v(j)*(z_meth(j+1)*T_G(i,j+1)/p(j+1)) / (z_meth(j)*T_G(i,j)/p(j));

% (p(j)/p(j+1))*(T_G(i,j+1)/T_G(i,j)); % declining density causes velocity to augment

Re = v(j+1)*d/eta;

D1(j+1) = Dm1(yi(1),yi(2),yi(3),p(j+1),T_O(i,j+1));

D2(j+1) = Dm2(yi(1),yi(2),yi(3),p(j+1),T_O(i,j+1));

D3(j+1) = Dm3(yi(1),yi(2),yi(3),p(j+1),T_O(i,j+1));

Sc1(j+1) = eta/(rho_G(j+1)*D1(j+1));

Sc2(j+1) = eta/(rho_G(j+1)*D2(j+1));

Sc3(j+1) = eta/(rho_G(j+1)*D3(j+1));

%Nu = 0.023*Re^0.8*Pr^(1/3);

Nu =(ksi_g/8)*(Re-1000)*Pr/(1+12.7*sqrt(ksi_g/8)*(Pr^(2/3)-1));

%Sh1(j+1) = 0.023*Re^0.8*Sc1(j+1)^(1/3); % VDI sherwood

%Sh2(j+1) = 0.023*Re^0.8*Sc2(j+1)^(1/3); % VDI sherwood

%Sh3(j+1) = 0.023*Re^0.8*Sc3(j+1)^(1/3); % VDI sherwood

% Shn(j+1) =(ksi_g/8)*(Re-1000)*Sc(j+1)/(1+12.7*sqrt(ksi_g/8)*(Sc(j+1)^(2/3)-1)); % sherwood relation used by numrich

% Shb(j+1) = (0.5*0.046*Re^-0.2)*(Re-1000)*Sc(j+1)/(1+12.7*sqrt(0.046*Re^-0.2)*(Sc(j+1)^(2/3)-1));% sherwood, bejan pg 312

56

Page 58: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

ksi_g = (1.82*log(Re)-1.64)^-2;

Sh1(j+1) = (ksi_g/8)*(Re-1000)*Sc1(j+1)/(1+12.7*sqrt(ksi_g/8)*(Sc1(j+1)^(2/3)-1)); % sherwood relation used by numrich

Sh2(j+1) = (ksi_g/8)*(Re-1000)*Sc2(j+1)/(1+12.7*sqrt(ksi_g/8)*(Sc2(j+1)^(2/3)-1)); % sherwood relation used by numrich

Sh3(j+1) = (ksi_g/8)*(Re-1000)*Sc3(j+1)/(1+12.7*sqrt(ksi_g/8)*(Sc3(j+1)^(2/3)-1)); % sherwood relation used by numrich

alpha_G = Nu*lambda/d;

beta_1(j+1) = Sh1(j+1)*D1(j+1)/d;

beta_2(j+1) = Sh2(j+1)*D2(j+1)/d;

beta_3(j+1) = Sh3(j+1)*D3(j+1)/d;

% first step is to calculate the vapour concentrations due to

% certain pressure

c_D1(i,j+1) = yD1_G(i,j+1)*c_G(i,j+1);

c_D2(i,j+1) = yD2_G(i,j+1)*c_G(i,j+1);

c_D3(i,j+1) = yD3_G(i,j+1)*c_G(i,j+1);

% then take into account velocity, and resulting movement of vapour (material derivative):

if i==1

c_D1(i,j+1) = c_D1(1,j+1); % don’t caculate concentration shift due to movement at t=0

else

c_D1(i,j+1) = c_D1(i,j+1)-dt(i)*v(j)*(c_D1(i,j+1)-c_D1(i,j))/dz;

end

if i==1

c_D2(i,j+1) = c_D2(1,j+1); % don’t caculate concentration shift due to movement at t=0

else

c_D2(i,j+1) = c_D2(i,j+1)-dt(i)*v(j)*(c_D2(i,j+1)-c_D2(i,j))/dz;

end

if i==1

c_D3(i,j+1) = c_D3(1,j+1); % don’t caculate concentration shift due to movement at t=0

else

c_D3(i,j+1) = c_D3(i,j+1)-dt(i)*v(j)*(c_D3(i,j+1)-c_D3(i,j))/dz;

end

% when there is no film, there is no vapour fraction at the film

% surface, and also not when there is not enough vapour in the gas

% flowing above it

% if f1(i,j+1)<=1e-12 & yD1_G(i,j+1)==0

% yD1_o(i,j+1) = 0;

% elseif f1(i,j+1)<=1e-12 & yD1_G(i,j+1)<=yi(1)

% yD1_o(i,j+1) = yD1_G(i,j+1);

% else

yD1_o(i,j+1) = yi(1);

% end

% %yD1_o(i,1) = yD1_o(i,2); %extra numerieke randvoorwaarde voor j=1

%

%

% if f2(i,j+1)<=1e-12 & yD2_G(i,j+1)==0

% yD2_o(i,j+1) = 0;

% elseif f2(i,j+1)<=1e-12 & yD2_G(i,j+1)<=yi(2)

% yD2_o(i,j+1) = yD2_G(i,j+1);

% else

yD2_o(i,j+1) = yi(2);

% end

% %yD2_o(i,1) = yD2_o(i,2); %extra numerieke randvoorwaarde voor j=1

%

% if f3(i,j+1)<=1e-12 & yD3_G(i,j+1)==0;%yD3_G(1,j+1)

% yD3_o(i,j+1) = 0;

% elseif f3(i,j+1)<=1e-12 & yD3_G(i,j+1)<=yi(3)

% yD3_o(i,j+1) = yD3_G(i,j+1);

% else

yD3_o(i,j+1) = yi(3);

% end

%yD3_o(i,1)=yD3_o(i,2); %extra numerieke randvoorwaarde voor j=1

% % if the flash condition says the liquid fraction is zero

% if L_criterion=~0

if f1(i,j+1)<=1e-12 & yD1_G(i,j+1)<yi(1)

n_D1(i,j+1) = 0;

else

n_D1(i,j+1) = beta_1(j+1)*c_G(i,j+1)*(yD1_G(i,j+1)-yD1_o(i,j+1));

end

n_D2(i,j+1) = beta_2(j+1)*c_G(i,j+1)*(yD2_G(i,j+1)-yD2_o(i,j+1));

n_D3(i,j+1) = beta_3(j+1)*c_G(i,j+1)*(yD3_G(i,j+1)-yD3_o(i,j+1));

% else

% n_D1(i,j+1) = 0;

% n_D2(i,j+1) = 0;

% n_D3(i,j+1) = 0;

% end

df1(i,j+1) = n_D1(i,j+1)*dt(i)*M_methane/rho_cond1;

df2(i,j+1) = n_D2(i,j+1)*dt(i)*M_decane/rho_cond2;

df3(i,j+1) = n_D3(i,j+1)*dt(i)*M_TEG/rho_cond3;

57

Page 59: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

end

yD1_o(i,1) = 2*yD1_o(i,2)-yD1_o(i,3);

yD2_o(i,1) = 2*yD2_o(i,2)-yD2_o(i,3);

yD3_o(i,1) = 2*yD3_o(i,2)-yD3_o(i,3);

n_D1(i,1) = 2*n_D1(i,2)-n_D1(i,3);

n_D2(i,1) = 2*n_D2(i,2)-n_D2(i,3);

n_D3(i,1) = 2*n_D3(i,2)-n_D3(i,3);

% n_D1(i,:) = beta_1(1:Nj+2).*c_G(i,:).*(yD1_G(i,:)-yD1_o(i,:));

% n_D2(i,:) = beta_2(1:Nj+2).*c_G(i,:).*(yD2_G(i,:)-yD2_o(i,:));

% n_D3(i,:) = beta_3(1:Nj+2).*c_G(i,:).*(yD3_G(i,:)-yD3_o(i,:));

%

% df1(i,1:Nj+2) = n_D1(i,:).*dt(i)*M_methane/rho_cond1;

% df2(i,1:Nj+2) = n_D2(i,:).*dt(i)*M_decane/rho_cond2;

% df3(i,1:Nj+2) = n_D3(i,:).*dt(i)*M_TEG/rho_cond3;

% numerical boundary condition for film thickness at first j point / stationary pressure profile resulting in stationary bulk gas concentration

df1(i,1) = 2*df1(i,2)-df1(i,3);

df2(i,1) = 2*df2(i,2)-df2(i,3);

df3(i,1) = 2*df3(i,2)-df3(i,3);

c_G(i+1,:) = c_G(i,:);

% The vapour concentration at the inlet is held constant

c_D1(i+1,1) = c_D1(1,1);

c_D2(i+1,1) = c_D2(1,1);

c_D3(i+1,1) = c_D3(1,1);

% prescribe time dependent plug flow

%c_D1(i+1,1) = c_D1(1,1)*(cos(3*pi*(2/t_tot)*t(i))+1)/2;

% integration of time derivative for concentration

c_D1(i+1,2:Nj+2) = c_D1(i,2:Nj+2)-dt(i)*(4/d)*(n_D1(i,2:Nj+2));

c_D2(i+1,2:Nj+2) = c_D2(i,2:Nj+2)-dt(i)*(4/d)*(n_D2(i,2:Nj+2));

c_D3(i+1,2:Nj+2) = c_D3(i,2:Nj+2)-dt(i)*(4/d)*(n_D3(i,2:Nj+2));

% calculate new vapour fraction with changed vapour concentration

c_G_norm(i+1,1:Nj+2) = c_D1(i+1,1:Nj+2)+c_D2(i+1,1:Nj+2)+c_D3(i+1,1:Nj+2);

yD1_G(i+1,1:Nj+2) = c_D1(i+1,1:Nj+2)./c_G_norm(i+1,1:Nj+2);%c_G(i+1,1:Nj+2);%c_G_norm(i+1,1:Nj+2);

yD2_G(i+1,1:Nj+2) = c_D2(i+1,1:Nj+2)./c_G_norm(i+1,1:Nj+2);%c_G(i+1,1:Nj+2);%c_G_norm(i+1,1:Nj+2);

yD3_G(i+1,1:Nj+2) = c_D3(i+1,1:Nj+2)./c_G_norm(i+1,1:Nj+2);%c_G(i+1,1:Nj+2);%c_G_norm(i+1,1:Nj+2);

% yD1_G(i+1,1:Nj+2) = c_D1(i+1,1:Nj+2)./c_G(i+1,1:Nj+2);

% yD2_G(i+1,1:Nj+2) = c_D2(i+1,1:Nj+2)./c_G(i+1,1:Nj+2);

% yD3_G(i+1,1:Nj+2) = c_D3(i+1,1:Nj+2)./c_G(i+1,1:Nj+2);

f1(i+1,:) = f1(i,:) + df1(i,:);

f2(i+1,:) = f2(i,:) + df2(i,:);

f3(i+1,:) = f3(i,:) + df3(i,:);

dt(i+1) = ((t_tot-(Ni-1)*dt(1))/((Ni^2-1)/2-1))*i+dt(1);

t(i+1) = t(i) + dt(i+1);

% display the progress percentage

perc_ready = num2str(100*i/(Ni+1));

disp([’progress: ’,perc_ready,’%’])

end

f = f1+f2+f3;

i_mid = round(Ni/2); % calculate an i that corresponds with half of the proces time

j_mid = round(Nj/2); % calculate a j that corresponds with half of the pipe length

time_half = num2str(t_tot_hours/2); % convert

time_tot = num2str(t_tot_hours);

distance_half= num2str(z_tot/1000); % convert

distance_tot= num2str(z_tot/1000);

zero=num2str(0);

disp(’ready!’)

% % References:

% % [Bejan] Bejan, A., Heat transfer, 1993, John Wiley & Sons

% % [Shavit] Shavit, A. and Guttfinger, G., Thermodynamics; from concepts to applications, 1995, Prentice Hall Europe

realgasf.m% calculate the compressibility factor with PR

%

% z_L = realgasf(p,T,pc,Tc,omega)

%

58

Page 60: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

% Input:

% --------------------------------------------------------

% p total pressure [Pa]

% T temperature [K]

% pc critical pressure [Pa]

% Tc critical temperature [K]

% omega acentric factor [-]

%

% Output:

% --------------------------------------------------------

% z_V gas compressibility factor

function z_V = realgasf(p,T,pc,Tc,omega)

R = 8.3145; % Ideal gas constant

% Peng-Robinson EqoS properties

a_pr = 0.45724*R^2*Tc^2/pc;

b = 0.077804*R*Tc/pc;

S_pr = 0.37464+1.54226*omega-0.26992*omega^2;

alpha_pr = (1+S_pr*(1-(T/Tc)^0.5))^2;

a = a_pr*alpha_pr;

Zroots = newton4([1, ((b*p)/(R*T)-1), (a*p/(R*T)^2-(2*b*p/(R*T))*((b*p/(R*T))+1+b/2)), ( (b^2*p/(R*T))*((b*p/(R*T))+1) - ((a*p/(R*T)^2))*(b*p/(R*T)))]);

if imag(Zroots(1))~=0 | imag(Zroots(2))~=0 | imag(Zroots(3))~=0

z_L=nan;

if imag(Zroots(1))~=0 & imag(Zroots(2))~=0

z_V=Zroots(3);

elseif imag(Zroots(1))~=0 & imag(Zroots(3))~=0

z_V=Zroots(2);

else

z_V=Zroots(1);

end

else

z_L = min(Zroots);

z_V = max(Zroots);

end

diff1.m% Effective diffusion coefficient

% Substance: 1: methane, 2: butane, 3: pentane

% Input T = temperture gas [K]

% Input P = Pressure gas [pa]

% Output D = Diffusion coefficient [m^2/s]

function Effektdiffm = Dm1(yD1_o,yD2_o,yD3_o,p,T)

P0 = 1.01325e5;

T0 = 273;

D012 = 8.773332085000368e-006;

D013 = 7.148819225479191e-006;

D023 = 1.692570655991679e-006;

D12 = D012*((T/T0)^1.75)*(P0/p);

D13 = D013*((T/T0)^1.75)*(P0/p);

D23 = D023*((T/T0)^1.75)*(P0/p);

% Literature

% Bejan, Adrian: Heat transfer, John Wiley & Sons, Inc., 1992

Effektdiffm = (1-yD1_o)/(yD2_o/D12+yD3_o/D13);

walltemp.m% wall temperature function file

function Twi = walltemperature(TG,TS)

r0 = 0.6175;

alpha_G = 5;

r_inf = 5;

RG = 1/alpha_G;

RL = 0;

RW = 0.00167;

ks = 1.05;

F = (1/ks).*r0.*(1/(RG+RL+RW)).*(log(r_inf)-log(r0));

Tw0 = (TS+TG.*F)./(1+F);

Twi = Tw0+(TG-Tw0).*RW./(RG+RL+RW);

59

Page 61: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

surfacetemp.m% Calculate the temperature at condensate film surface

% Input T_W_f = temperature gas [K]

% Input T_G_f = temperature gas [K]

% Input alhpa_L = heat transfer coefficient liquid phase

% Input alhpa_G = heat transfer coefficient gas phase

% Input massrate_f

% Input d_h_wat = enthalpy of evaporation [J/mol]

% Output T_O = temperature at condensate film surface [K]

function T_O = surfacetemp(T_W_f, T_G_f, alpha_L, alpha_G, massrate_f);

T_O_start =(T_W_f+T_G_f)/2;

T_O =fzero(@surfacetempsub, T_O_start);

function T_O_sub = surfacetempsub(x,T_W_f, T_G_f, alpha_L, alpha_G, massrate_f);

load substance_data;

load program_data;

c_p = 4200;

T_L = (x+T_W_f)/2;

dhfunctie = d_h_wat_tab(1)+x*((d_h_wat_tab(13)-d_h_wat_tab(1))/(T_sat_tab(13)-T_sat_tab(1)));

T_O_sub = -alpha_L*(x-T_W_f)+alpha_G*(T_G_f-x)+massrate_f*(dhfunctie+c_p*x)-massrate_f*c_p*T_L;

flash.m% FLASH Function that does flash calculation using Prausnitz’ scheme.

% The Peng Robinson Equation of State is used.

%

% [L, x, y] = FLASH(p,T,N,z,pc,Tc,omega)

%

% Input:

% --------------------------------------------------------

% p total pressure [Pa]

% T temperature [K]

% N number of components

% z array with total composition of mixture [-]

% pc array with critical pressures [Pa]

% Tc array with critical temperatures [K]

% omega array with acentric factors [-]

%

% Output:

% --------------------------------------------------------

% L overal liquid fraction [-]

% x array with composition of liquid phase [-]

% y array with composition of vapour phase [-]

%

% Literature:

% --------------------------------------------------------

% [Prausnitz] Prausnitz et al.: The properties of gases and liquids,

% 1995, page 8.130.

function [L, x, y] = flash(p,T,N,z,pc,Tc,omega)

format long e

%-----------------------

% A) program input

%-----------------------

% 1. variables

%----------------------------

R = 8.3145; % Ideal gas constant

% Peng-Robinson EqoS parameters

for i=1:N

a_pr(i) = 0.45724*R^2*Tc(i)^2/pc(i);

b(i) = 0.077804*R*Tc(i)/pc(i);

S_pr(i) = 0.37464+1.54226*omega(i)-0.26992*omega(i)^2;

alpha_pr(i) = (1+S_pr(i)*(1-(T/Tc(i))^0.5))^2;

a_1D(i) = a_pr(i)*alpha_pr(i);

end

% binary interaction parameters

for i=1:N

kij(i) = 0;

end

60

Page 62: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

% Expand a into matrix for interactions between dissimilar molecules with quadratic mixing rule:

for i=1:N

for j=1:N

a(i,j) = (a_1D(i)*a_1D(j))^0.5*(1-kij(j));

end

end

% 3. Start values for K and L

%--------------------------------

if z(1)<=1

L = 1-z(1); % take the amount of noncondensable gases as first estimate for L, unless this results in negative L

else

L=0.00000000;

end

for i=1:N

K(i) = exp(5.373*(1-omega(i))*(1-T/Tc(i))+log(p/pc(i))); % recommended by Dohrn, page 166/ Mehra et al.

end

%------------------------

% B) program

%----------------------------

epsilonvoorwaarde = 1e-10;

S = 0;

Sn(1) = S;

n = 1;

x = z;

y = z;

epsilon = sum(x)-S;

eps_tab(1)= epsilon;

L_tab = [L];

while abs(epsilon)>=epsilonvoorwaarde

for i=1:N

x(i) = z(i)/(K(i)+(1-K(i))*L);

y(i) = K(i)*x(i);

end

% calculating a and b for gas(V) and fluid (L) phase

a_L = x*a*x’;

a_V = y*a*y’;

b_L = x*b’;

b_V = y*b’;

Zroots_L = roots([1, ((b_L*p)/(R*T)-1), (a_L*p/(R*T)^2-(2*b_L*p/(R*T))*((b_L*p/(R*T))+1+b_L/2)), ( (b_L^2*p/(R*T))*((b_L*p/(R*T))+1)...

- ((a_L*p/(R*T)^2))*(b_L*p/(R*T)))]);

Zroots_V = roots([1, ((b_V*p)/(R*T)-1), (a_V*p/(R*T)^2-(2*b_V*p/(R*T))*((b_V*p/(R*T))+1+b_V/2)), ( (b_V^2*p/(R*T))*((b_V*p/(R*T))+1)...

- ((a_V*p/(R*T)^2))*(b_V*p/(R*T)))]);

SL = sort(Zroots_L);

SV = sort(Zroots_V);

% choose the right roots for z_L and z_V

if imag(Zroots_L(1))~=0 & imag(Zroots_L(2))~=0 & imag(Zroots_L(3))~=0

%disp(’3 imaginary roots for z_L!’)

if SL(1)>0

z_L = SL(1);

elseif SL(2)>0

z_L = SL(2);

else

z_L = SL(3);

end

%Zroots_L

%break

elseif imag(Zroots_L(1))~=0 & imag(Zroots_L(2))>0

%disp(’imaginary roots for L: 1&2’)

z_L = Zroots_L(3);

elseif imag(Zroots_L(3))~=0 & imag(Zroots_L(2))>0

%disp(’imaginary roots for L: 2&3’)

z_L = Zroots_L(1);

else

%disp(’3 real roots for L’)

z_L = min(Zroots_L);

end

z_L = min(Zroots_L);

%z_L

if imag(Zroots_V(1))~=0 & imag(Zroots_V(2))~=0 & imag(Zroots_V(3))~=0

%disp(’3 imaginary roots for z_V!’)

61

Page 63: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

%Zroots_V

%break

z_V = SV(3);

elseif imag(Zroots_V(1))~=0 & imag(Zroots_V(2))>0

%disp(’imaginary roots for V: 1&2’)

z_V = Zroots_V(3);

elseif imag(Zroots_V(3))~=0 & imag(Zroots_V(2))>0

%disp(’imaginary roots for V: 2&3’)

z_V = Zroots_V(1);

else

%disp(’3 real roots for V’)

z_V = max(Zroots_V);

% end

end

z_V = max(Zroots_V);

%z_V

% calculating fugacity coefficients and new K factor

for i = 1:N

delta_L(i) = 2*(a_1D(i)^0.5/a_L)*(a_1D.^0.5.*(1-kij))*x’;

delta_V(i) = 2*(a_1D(i)^0.5/a_V)*(a_1D.^0.5.*(1-kij))*y’;

A_L = a_L*p/(R^2*T^2);

A_V = a_V*p/(R^2*T^2);

B_L = b_L*p/(R*T);

B_V = b_V*p/(R*T);

phi_L(i) = exp((b(i)/b_L)*(z_L-1)-log(z_L-B_L)-(A_L/(8^0.5*B_L))*(delta_L(i)-b(i)/b_L)*log((z_L+(1+2^0.5)*B_L)/(z_L+(1-2^0.5)*B_L)));

phi_V(i) = exp((b(i)/b_V)*(z_V-1)-log(z_V-B_V)-(A_V/(8^0.5*B_V))*(delta_V(i)-b(i)/b_V)*log((z_V+(1+2^0.5)*B_V)/(z_V+(1-2^0.5)*B_V)));

K(i) = phi_L(i)/phi_V(i);

DeltaL_teller(i) = (z(i)*(K(i)-1)/(K(i)+(1-K(i))*L));

DeltaL_noemer(i) = (z(i)*(K(i)-1)^2/(K(i)+(1-K(i))*L)^2);

end

S = K*x’;

Sn = [Sn;S];

DeltaL = sum(DeltaL_teller)/sum(DeltaL_noemer);

epsilon = sum(x)-S;

L = L -DeltaL;

L_tab = [L_tab;L];

eps_tab = [eps_tab; epsilon];

n = n+1;

end

E.2 Aspen Dynamics

Given below is the code with which time dependent film condensation is modelled insideAspen Dynamics. This is the code of Aspens model ”pipe int2”, that is used in aspen tointegrate the mass, momentum and energy balance of a pipe in time. The code that is addedto this to implement the model of chapter 7 is inserted between long ///// lines.Model Pipe_int2

/*

Aspen Dynamics (TM) 12.1 Library

Copyright, 1997-2003 Aspen Technology, Inc. All rights reserved.

This copyright statement must not be deleted and must be

included in any modification or adaptation of this Model.

*/

// Change GlobalTimeScaler on the Simulation Globals form if the time units in your models are not hours

GlobalTimeScaler as global TimeScalerParameter;

TimeScaler as TimeScalerParameter;

TimeScaler: GlobalTimeScaler;

// parameter definitions

PARAMETER MomMethods USES Stringparameter

valid as stringset (["Homogeneous", "Separated"]);

value : "Homogeneous";

END

PARAMETER MomTypes USES Stringparameter

valid as stringset (["Instantaneous", "Dynamic"]);

value : "Instantaneous";

END

PARAMETER InitMethods USES Stringparameter

valid as stringset (["Stage1", "Stage2", "Stage3", "No"]);

value : "No";

END

62

Page 64: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

PARAMETER FlowRevBasisParam USES Stringparameter

valid as stringset (["Local-Flow","InletOutlet-Flow"]);

value : "Local-Flow";

END

// global parameters

delta_t as global realparameter; // approach to T_max/T_min before ramping

eps as global realparameter;

GlobalPDriven as global logicalparameter; // pressure driven switch

GlobalRFlow as global logicalparameter; // reverse flow switch

LARGE as global realparameter;

ONE as global realparameter;

P_max as global realparameter; // maximum pressure limit

Pi as global realparameter; // ( = 3.14159 ...)

T_max as global realparameter; // maximum temperature

T_min as global realparameter; // minimum temperature

UEC1 as global realparameter; // g

UCF1 as global realparameter; // hr -> s

UCF3 as global realparameter; // bar -> Pa

UCF5 as global realparameter; // J -> GJ

UCF6 as global realparameter; // kW -> GJ/hr

UCF12 as global realparameter; // C -> K

UCF13 as global realparameter; // bar m3 -> GJ

UCF15 as global realparameter; // kW -> W

UCF18 as global realparameter; // GJ -> kJ

ZERO as global realparameter;

// local parameters

EqHeatCap as YesNo (Description:"Model equipment heat capacity");

FitCalc as hidden YesNo;

FricTyp as FrictionType (Description:"Friction correlation");

HFlux as YesNo (Description:"Include fixed heat flux");

HldTyp as HoldupType (Description:"Holdup correlation");

HtOpt as PipHtOption (Description:"Thermal specification type");

HtSpec as YesNo (Description:"Include ambient heat transfer");

Initialize as hidden InitMethods;

MomCalc as hidden MomMethods;

MomType as hidden MomTypes;

FlowRevBasis as hidden FlowRevBasisParam;

PDriven as logicalparameter (Description:"Model is pressure driven", GlobalPDriven);

PropUser_LiqVisc as YesNo (Description:"User expression for liquid viscosity", "No");

PropUser_VapVisc as YesNo (Description:"User expression for vapor viscosity", "No");

Npts as integerparameter (Description:"Number of profile intervals", 10);

UOM as hidden integerparameter (1); // hard-wired UOM

ValidPhases as ValidFWPhaseType (Description:"Valid phases");

// sets

npoints as integerset ([1:Npts-1]);

nrange as integerset ([0:Npts]);

// variables

angle as angle (Description:"Pipe angle of inclination");

area_ (nrange) as area (Description:"Cross sectional area of element");

beta_ (nrange) as fraction (Description:"Moles liquid 1/ total moles liquid");

cero_vel as constant (Description:"Erosion velocity constant");

Diam as length (Description:"Pipe inlet internal diameter");

Diam_ (nrange) as length (Description:"Pipe internal diameter");

Diam_out as length (Description:"Pipe outlet internal diameter");

DPin as hidden press_diff (fixed, 0.0);

DP_const_ (nrange) as hidden notype; // friction coefficient

DP_const_torn_ (nrange) as hidden notype; // torn friction coefficient

dpAcc as press_diff (Description:"Acceleration pressure drop");

dpElv as press_diff (Description:"Elevation pressure drop");

dpFrc as press_diff (Description:"Frictional pressure drop");

dpTot as press_diff (Description:"Total pressure drop");

dp_acc_ (nrange) as press_diff (Description:"Incremental acceleration pressure drop");

dp_elv_ (nrange) as press_diff (Description:"Incremental elevation pressure drop");

dp_fr_ (nrange) as press_diff (Description:"Incremental friction pressure drop");

dv_ (npoints) as hidden volume; // element volume

dx as hidden length; // element length

dxl as hidden length; // element equivalent length

E_(npoints) as holdup_heat (Description:"Internal energy holdup", spec:RateInitial, 0.0);

eff as fraction (Description:"Pipe efficiency");

EquipCp as cp_mass (Description:"Specific heat capacity of pipe wall");

EquipMass as mass (Description:"Mass of pipe wall");

ero_vel_ (npoints) as velocity (Description:"Erosion velocity");

F_ (nrange) as flow_mol_rev (Description:"Mixture molar flow rate");

F_Max as hidden flow_mol_rev; // Maximum of inlet/outlet flow

Fl_ (nrange) as flow_mol_liq_rev (Description:"Liquid molar flow rate");

Fm_ (nrange) as flow_mass_rev (Description:"Mixture mass flow rate");

Fv_ (nrange) as flow_mol_vap_rev (Description:"Vapor molar flow rate");

h_ (nrange) as enth_mol (Description:"Mixture molar enthalpy");

hl_ (nrange) as enth_mol_liq (Description:"Liquid molar enthalpy");

hl1_ (nrange) as enth_mol_liq (Description:"Liquid 1 molar enthalpy");

hl2_ (nrange) as enth_mol_liq (Description:"Liquid 2 molar enthalpy");

hv_ (nrange) as enth_mol_vap (Description:"Vapor molar enthalpy");

L as length (Description:"Pipe length");

L_eqv as hidden length;

L_prof (nrange) as length; // length array for profile plots

lambda (nrange) as fraction (Description:"Liquid volumetric flow fraction");

63

Page 65: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

lf_ (nrange) as fraction (Description:"Liquid phase molar fraction");

lf1_ (nrange) as fraction (Description:"Liquid 1 phase molar fraction");

lf2_ (nrange) as fraction (Description:"Liquid 2 phase molar fraction");

lfvol_ (nrange) as fraction (Description:"Liquid volume fraction");

M_(npoints) as holdup_mol (Description:"Total molar holdup");

Ml_(npoints) as holdup_mol (Description:"Liquid molar holdup");

Ml1_(npoints) as holdup_mol (Description:"Liquid 1 molar holdup");

Ml2_(npoints) as holdup_mol (Description:"Liquid 2 molar holdup");

Mv_(npoints) as holdup_mol (Description:"Vapor molar holdup");

Mc_ (npoints, componentList) as holdup_mol (Description:"Component molar holdup", spec:RateInitial, 0.0);

Ml_fac1_ (nrange) as fraction (Description:"Liquid volume fraction");

Mom_ (npoints) as momentum (Description:"Mixture momentum", spec:RateInitial);

Mw_ (nrange) as molweight (Description:"Mixture molar weight");

Mwl_ (nrange) as molweight (Description:"Liquid molar weight");

Mwl1_ (nrange) as molweight (Description:"Liquid 1 molar weight");

Mwl2_ (nrange) as molweight (Description:"Liquid 2 molar weight");

Mwv_ (nrange) as molweight (Description:"Vapor molar weight");

P_ (nrange) as pressure (Description:"Pressure", record:true);

P_drop_ (nrange) as press_diff (Description:"Pressure drop");

Q_ (nrange) as enthflow (Description:"Actual duty", 0.0);

QEnv_(nrange) as enthflow (Description:"Rate of heat transfer from vessel wall to environment", 0.0);

Qr_ (nrange) as enthflow (Description:"Required duty", 0.0);

QAD as heat_flux_lin (Description:"Heat flux");

relruf_ (nrange) as notype (Description:"Relative roughness");

reyno_ (nrange) as notype (Description:"Reynolds number");

rho_ (nrange) as dens_mol (Description:"Mixture molar density");

rhol_ (nrange) as dens_mol_liq (Description:"Liquid molar density");

rhol1_ (nrange) as dens_mol_liq (Description:"Liquid 1 molar density");

rhol2_ (nrange) as dens_mol_liq (Description:"Liquid 2 molar density");

rhom_ (nrange) as hidden dens_mass (Description:"Mixture mass density");

rhoml_ (nrange) as dens_mass_liq (Description:"Liquid mass density");

rhoml1_ (nrange) as dens_mass_liq (Description:"Liquid 1 mass density");

rhoml2_ (nrange) as dens_mass_liq (Description:"Liquid 2 mass density");

rhomv_ (nrange) as dens_mass_vap (Description:"Vapor mass density");

rhov_( nrange) as dens_mol_vap (Description:"Vapor molar density");

ruff as length (Description:"Pipe roughness");

sigma1_ (nrange) as hidden surf_tens; // surface tension

slip_ (nrange) as pos_large (Description:"Slip ratio", lower:0.0, upper:1e6);

sonic_vel_in as velocity (Description:"Sonic velocity at inlet conditions");

sonic_vel_out as velocity (Description:"Sonic velocity at outlet conditions");

T_ (nrange) as temperature (Description:"Temperature", record:true);

Tamb_in as temperature (Description:"Ambient temperature at pipe inlet");

Tamb_out as temperature (Description:"Ambient temperature at pipie outlet");

TWall_ (nrange) as temperature (Description:"Wall temperature", initial);

U as heat_trans_coeff (Description:"Overall heat transfer coefficient");

UEnv as heat_trans_coeff (Description:"Heat transfer coefficient for heat transfer to environment", 0.0005);

UWall as heat_trans_coeff (Description:"Heat transfer coefficient for heat transfer to wall", 0.0005);

V_ (npoints) as volume (Description:"Total volume");

Vl_ (npoints) as volume (Description:"Liquid volume");

Vl1_ (npoints) as volume (Description:"Liquid 1 volume");

Vl2_ (npoints) as volume (Description:"Liquid 2 volume");

Vv_ (npoints) as volume (Description:"Vapor volume");

vapvisc as visc_vap (Description:"Fixed vapor viscosity", spec:fixed);

Vel_ (nrange) as velocity_rev (Description:"Mixture velocity", record:true);

VelFracIn as hidden fractionPosNeg; // vel_(0)/sonic_vel_in

VelFracOut as hidden fractionPosNeg; // vel_(Npts)/sonic_vel_out

Vell_ (nrange) as velocity_rev (Description:"Liquid velocity");

Velv_ (nrange) as velocity_rev (Description:"Vapor velocity");

vf_ (nrange) as fraction (Description:"Vapor phase molar fraction");

viscA as notype (Description:"Viscosity fitting constant", spec:fixed);

viscB as notype (Description:"Viscosity fitting constant", spec:fixed);

visl_ (nrange) as visc_liq (Description:"Liquid viscosity");

vismx_ (nrange) as hidden visc_liq; // viscosity

visg_ (nrange) as visc_vap (Description:"Vapor viscosity");

x_ (nrange, componentList) as molefraction (Description:"Liquid mole fraction", 1.0/size(componentList));

x1_ (nrange, componentList) as molefraction (Description:"Liquid 1 mole fraction", 1.0/size(componentList));

x2_ (nrange, componentList) as molefraction (Description:"Liquid 2 mole fraction", 1.0/size(componentList));

xdot_ (nrange) as fraction (Description:"Vapor mass flow fraction");

y_ (nrange, componentList) as molefraction (Description:"Vapor mole fraction", 1.0/size(componentList));

z_ (nrange, componentList) as molefraction (Description:"Mixture mole fraction", 1.0/size(componentList));

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// New defined variables

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Conversion factors

UF_v as hidden realparameter(1e-3); // to calculate from cP to Pa s

// property data

cp_vap(npoints) as cp_mol;

conduc(npoints) as conductivity;

Diffusioncoeff(npoints, componentlist) as diffusivity;

dens_liq(npoints) as dens_mol_liq (Description:"liquid density");

dens_vap(npoints) as dens_mol_liq (Description:"vapour density");

// parameters for flash on bulk gas

flashx_bulk(nrange,componentlist) as molefraction;

flashy_bulk(nrange,componentlist) as molefraction;

flashvf_bulk(nrange) as vapfraction;

flashhv_bulk(nrange) as enth_mol_vap;

64

Page 66: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

flashhl_bulk(nrange) as enth_mol_liq;

// Dimensionless numbers

Pr(nrange) as notype (Description:"Prandtl number");

Nu(nrange) as notype (Description:"Nusselt number");

Sc(nrange, componentList) as notype (Description:"Schmidt number");

Sh(nrange, componentList) as notype (Description:"Sherwood number");

winbeta(npoints, componentList) as mass_trans_coeff (Description:"Mass transfer coefficient");

winalpha(npoints) as heat_trans_coeff (Description:"heat transfer coefficient");

zeta(nrange) as notype (Description:"Friction factor");

// control volume variables

x_cv(npoints, componentlist) as molefraction (Description: "liquid composion in control volume");

y_cv(npoints, componentlist) as molefraction (Description: "gas in control volume");

z_cv(npoints, componentlist) as molefraction (Description: "liquid in control volume");

height_cv(npoints) as length (Description: "height of control volume");

vf_cv(npoints) as vapfraction;

hv_cv(npoints) as enth_mol_vap;

hl_cv(npoints) as enth_mol_liq;

M_cv(npoints, componentlist) as holdup_mol;

M_cv_total(npoints) as holdup_mol;

n_dot(npoints, componentList) as flux_mol (Description:"Film model condensation mole flow");

n_dot_tot(npoints) as flux_mol (Description:"Film model condensation mole flow, total");

film(npoints) as length;

boundary_T(npoints) as length (Description:"temperature boundary layer");

kmoles_meter(npoints,componentlist) as notype (Description:"liquid moles per meter");

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ’property equations’

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// flash on bulk gas

for I in npoints do

call(flashy_bulk(I),flashx_bulk(I),flashvf_bulk(I),flashhv_bulk(I),flashhl_bulk(I)) = pflash(T_(I),p_(I),z_(I));

endfor

// flash on control volume

for I in npoints do

call(y_cv(I),x_cv(I),vf_cv(I),hv_cv(I),hl_cv(I)) = pflash(T_(I),p_(I),z_cv(I));

endfor

// liquid and vapour density in control volume

for I in npoints do

call(dens_liq(I)) = pDens_Mol_Liq(T_(I), P_(I), x_cv(I));

call(dens_vap(I)) = pDens_Mol_Vap(T_(I), P_(I), y_cv(I));

endfor

// conductivity and specific heat

for I in npoints do

call(cp_vap(I)) = pCp_Mol_Vap(T_(I), P_(I), z_(I));

call(conduc(I)) = pCond_Vap(T_(I), P_(I), z_(I));

endfor

// ’effective’ diffusion coefficients (diffusion coefficients of components in a mixture)

for I in npoints do

call(Diffusioncoeff(I)) = pDiffus_Vap(T_(I), P_(I), z_(I));

endfor

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Film model

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

for I in npoints do

zeta(I) = (1.82*loge(reyno_(I))-1.64)^-2; // Resistance factor with Gnielinski (hydraulic smooth pipe)

Pr(I) = UF_v*visg_(I)*(UCF15*cp_vap(I)/Mw_(I))/conduc(I);// multiply with UF_v to change [centipoise] in [Pa S]. Divide by Molar mass

to set in Cp in [kmol] Multiply with UCF15 to change [KJ] in [J]

Nu(I) = ( (zeta(I)/8) *(reyno_(I)-1000)*Pr(I))/(1+12.7*sqrt(zeta(I)/8)*(Pr(I)^(2/3)-1)); // Gnielinski equation

winalpha(I)/UF_v = Nu(I)*conduc(I)/Diam_(I); // the variable type heat_trans_coeff (used for winalpha) is in KW/m2/K. Correct with UF_v to

set in W/m2/K

endfor

FOR I IN npoints DO

65

Page 67: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

FOR comp IN componentList DO

Sc(I,comp) = 10*visg_(I)/(rhom_(I)*Diffusioncoeff(I,comp)); // viscosity unit (cP), diffusivity in cm2/s, the result is 10*Sc.

Sh(I,comp) = ( (zeta(I)/8) *(reyno_(I)-1000)*Sc(I,comp))/(1+12.7*sqrt(zeta(I)/8)*(Sc(I,comp)^(2/3)-1)); // Gnielinski equation

winbeta(I,comp)*10000 = Sh(I,comp)*Diffusioncoeff(I,comp)/Diam_(I);

ENDFOR

ENDFOR

FOR I IN npoints DO

For comp in componentlist do

if z_cv(I,comp) < 4e-9 and y_cv(I,comp)>z_(I,comp) then

n_dot(I,comp) = 0;

else

n_dot(I,comp) = rho_(I)*winbeta(I,comp)*loge((1-y_cv(I,comp))/(1-z_(I,comp)));

endif

endfor

n_dot_tot(I) = sigma(n_dot(I));

endfor

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// control volume equations

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// temperature boundary layer thickness

for I in npoints do

boundary_T(I)=Diam_(I)/Nu(I);

endfor

// definition of total composion in control volume

for I in npoints do

for comp in componentlist do

z_cv(I,comp)=M_cv(I,comp)/M_cv_total(I);

endfor

endfor

// set height of control volume equal to a fraction of the temperature boundary layer

//for I in npoints do

//M_cv_total(I)*( (1-vf_cv(I))/(pi*Diam_(I)*dx*dens_liq(I)) + vf_cv(I)/(pi*Diam_(I)*dx*dens_vap(I)) )=boundary_T(I)/10;

//endfor

// total amount of moles in control volume

for I in npoints do

M_cv_total(I) = sigma(M_cv(I));

endfor

// film thickness

for I in npoints do

film(I)=M_cv_total(I)*(1-vf_cv(I))/(pi*Diam_(I)*dx*dens_liq(I));

endfor

// height control volume

For I in npoints do

height_cv(I)=M_cv_total(I)*(1-vf_cv(I))/(pi*Diam_(I)*dx*dens_liq(I)) + M_cv_total(I)*(vf_cv(I))/(pi*Diam_(I)*dx*dens_vap(I));

endfor

// growth of control volume

For I in npoints do

for comp in componentlist do

M_cv(I, comp).spec: initial;

$M_cv(I,comp)*(3600/TimeScaler) = (n_dot(I,comp)-n_dot_tot(I)*z_cv(I,comp)/vf_cv(I))*0.5*pi*dx*Diam_(I);

endfor

endfor

For I in npoints do

for comp in componentlist do

kmoles_meter(I,comp)=(1-vf_cv(I))*M_cv_total(I)*x_cv(I,comp)/dx;

endfor

endfor

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// "ports"

In_F_F as hidden flow_mol_rev;

In_F_P as hidden pressure;

In_F_T as hidden temperature;

In_F_z(componentList) as hidden molefraction (1.0/size(componentList));

In_F_h as hidden enth_mol;

In_F_Av as hidden fraction (1.0);

In_F_slip as hidden notype (1.0);

In_F_Trev as hidden temperature;

In_F_hrev as hidden enth_mol;

In_F_zrev(componentList) as hidden molefraction (1.0/size(componentList));

66

Page 68: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

In_F_Avrev as hidden fraction (1.0);

Out_P_F as hidden flow_mol_rev;

Out_P_P as hidden pressure;

Out_P_T as hidden temperature;

Out_P_z(componentList) as hidden molefraction (1.0/size(componentList));

Out_P_h as hidden enth_mol;

Out_P_Av as hidden fraction (1.0);

Out_P_V as hidden vol_mol;

Out_P_slip as hidden notype (1.0);

Out_P_Trev as hidden temperature;

Out_P_hrev as hidden enth_mol;

Out_P_zrev(componentList) as hidden molefraction (1.0/size(componentList));

Out_P_Avrev as hidden fraction (1.0);

// properties

pvap_ ([0:(2*(ValidPhases=="Vapor-Only")-1)*Npts]) as props_vapor;

pliq_ ([0:(2*(ValidPhases=="Liquid-Only")-1)*Npts]) as props_liquid;

pliqw_ ([0:(2*(ValidPhases=="Liquid-FreeWater")-1)*Npts]) as props_lwe;

pflash2_ ([0:(2*(ValidPhases=="Vapor-Liquid")-1)*Npts]) as props_flash2;

pflash2w_ ([0:(2*(ValidPhases=="Vapor-Liquid-FreeWater")-1)*Npts]) as props_flash2w;

pflash3_ ([0:(2*(ValidPhases=="Vapor-Liquid-Liquid")-1)*Npts]) as props_flash3;

// forward flow lower bounds

IF NOT (GlobalRFlow AND PDriven) THEN

FOR I IN nrange DO

F_(I).lower : 0.0;

Fl_(I).lower : 0.0;

Fm_(I).lower : 0.0;

Fv_(I).lower : 0.0;

Vel_(I).lower : 0.0;

Vell_(I).lower : 0.0;

Velv_(I).lower : 0.0;

ENDFOR

In_F_F.lower : 0.0;

Out_P_F.lower : 0.0;

ENDIF

// geometry

dx = L/Npts;

IF (FitCalc=="No") THEN

dxl = dx;

ELSE

dxl = L_eqv/Npts;

ENDIF

FOR i IN nrange DO

Diam_(I) = Diam + I*(Diam_out - Diam)/Npts;

ENDFOR

area_(0) = 0.25*Pi*Diam^2;

area_(Npts) = 0.25*Pi*Diam_out^2;

FOR I in npoints DO

area_(I) = 0.25*Pi*(Diam + I*(Diam_out-Diam)/(Npts-1))^2;

dv_(I) = area_(I)*L/(Npts-1);

ENDFOR

// Get max of inlet/outlet flow

IF (GlobalRFlow AND PDriven) THEN

F_Max = MAX(F_(0), F_(npts));

ENDIF

// total pressure drop

dpTot = (In_F_P - Out_P_P) - DPin;

// element [0]

// forward flow inlet conditions / reverse flow outlet conditions

IF (GlobalRFlow AND PDriven) THEN

In_F_F = F_(0);

// inlet reverse enthalpy and composition

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

In_F_zrev = z_(0);

In_F_hrev = h_(0);

ELSE

In_F_zrev = (ABS(Fv_(0))*y_(0) + ABS(Fl_(0))*x_(0))/(ABS(F_(0)+eps));

In_F_hrev = (ABS(Fv_(0))*hv_(0) + ABS(Fl_(0))*hl_(0))/(ABS(F_(0)+eps));

ENDIF

// inlet reverse temperature

In_F_Trev = T_(0);

IF ((FlowRevbasis == "Local-Flow" AND F_(1) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

z_(0) = In_F_z;

h_(0) = In_F_h;

67

Page 69: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

// momentum balance - special case (forward discretize convective term to avoid use of ficticious grid points)

IF (Initialize<>"Stage1") THEN

0 = 1e-3*( (F_(0)*Mw_(0)*Vel_(0) - F_(1)*Mw_(1)*Vel_(1))/(area_(0)*UCF3*UCF1)

+ P_drop_(0)

- dp_elv_(0)

- dp_fr_(0) );

ENDIF

ELSE

z_(0) = z_(1);

h_(1) - h_(0) = Q_(0)/(F_(0)-eps);

// balance runtime IF

IF (Initialize<>"Stage1") THEN

Fm_(0) = Fm_(1);

ENDIF

ENDIF

ELSE

CALL (In_F_F) = plimit (F_(0), ZERO, LARGE);

z_(0) = In_F_z;

h_(0) = In_F_h;

// momentum balance - special case (forward discretize convective term to avoid use of ficticious grid points)

IF (Initialize<>"Stage1") THEN

0 = 1e-3*( (F_(0)+eps)*(Mw_(0)*Vel_(0) - Mw_(1)*Vel_(1))/(area_(0)*UCF3*UCF1)

+ P_drop_(0)

- dp_elv_(0)

- dp_fr_(0) );

ENDIF

ENDIF

// pressure drop

P_drop_(0) = P_(0) - P_(1);

// initialize model

IF (Initialize=="Stage1" OR Initialize=="Stage2") THEN

Out_P_F = In_F_F;

FOR i IN npoints DO

IF (Initialize=="Stage1") THEN

P_(I) = In_F_P;

H_(I) = In_F_H;

ENDIF

z_(I) = In_F_z;

F_(I) = In_F_F;

ENDFOR

ENDIF

// interior elements [1:(Npts-1)]

// mass balance

FOR I IN npoints DO

FOR comp IN componentList DO

IF (Initialize=="No" OR Initialize=="Stage3") THEN

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

IF (GlobalRFlow AND PDriven) THEN

// switch differencing scheme on flow reversal

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Comp_bal_hom_fwd:

$Mc_(I, comp)*(3600/TimeScaler) = F_(I-1)*z_(I-1, comp) - F_(I)*z_(I, comp);

ELSE

Comp_bal_hom_rev:

$Mc_(I, comp)*(3600/TimeScaler) = F_(I)*z_(I, comp) - F_(I+1)*z_(I+1, comp);

ENDIF

ELSE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// adapted mass balance in bulk gas

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Comp_bal_hom:

$Mc_(I, comp)*(3600/TimeScaler) = (F_(I-1)+eps)*z_(I-1, comp) - (F_(I)+eps)*z_(I,

comp)-(UCF1)*pi*Diam_(I)*dx*(n_dot(I,comp)-n_dot_tot(I)*z_cv(I,comp)/vf_cv(I));

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

ENDIF

Mc_(I, comp).spec : RateInitial;

ELSE

IF (GlobalRFlow AND PDriven) THEN

// switch differencing scheme on flow reversal

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Com_bal_2p_fwd:

$Mc_(I, comp)*(3600/TimeScaler) = Fv_(I-1)*y_(I-1, comp) - Fv_(I)*y_(I, comp)

68

Page 70: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

+ Fl_(I-1)*x_(I-1, comp) - Fl_(I)*x_(I, comp);

ELSE

Com_bal_2p_rev:

$Mc_(I, comp)*(3600/TimeScaler) = Fv_(I)*y_(I, comp) - Fv_(I+1)*y_(I+1, comp)

+ Fl_(I)*x_(I, comp) - Fl_(I+1)*x_(I+1, comp);

ENDIF

ELSE

Com_bal_2p:

$Mc_(I, comp)*(3600/TimeScaler) = (Fv_(I-1)+eps)*y_(I-1, comp) - (Fv_(I)+eps)*y_(I, comp)

+ (Fl_(I-1)+eps)*x_(I-1, comp) - (Fl_(I)+eps)*x_(I, comp);

ENDIF

Mc_(I, comp).spec : RateInitial;

ENDIF

ELSE // initialize (Stage1&2)

Mc_(I, comp).spec : Free;

ENDIF

ENDFOR

ENDFOR

FOR I IN npoints DO

IF (Initialize=="No" OR Initialize=="Stage3") THEN

IF (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

SIGMA(z_(I, componentList)) = 1.0;

ELSE

M_(I) = SIGMA(Mc_(I, componentList));

ENDIF

ENDIF

ENDFOR

// component holdups

FOR I IN npoints DO

FOR comp IN componentList DO

Mc_(I, comp) = M_(I)*z_(I, comp);

ENDFOR

ENDFOR

// volume constraint

FOR I IN npoints DO

IF (ValidPhases=="Vapor-Only") THEN

M_(I) = rhov_(I)*V_(I);

V_(I) = dv_(I);

ELSEIF (ValidPhases=="Liquid-Only") THEN

M_(I) = rhol_(I)*V_(I);

IF (GlobalRFlow AND PDriven) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

F_(I) = F_(I-1)*(1.0 + 1000*(V_(I) - dv_(I))/dv_(I));

ELSE

F_(I) = F_(I+1)*(1.0 + 1000*(V_(I) - dv_(I))/dv_(I));

ENDIF

ELSE

F_(I) = F_(I-1)*(1.0 + 1000*(V_(I)-dv_(I))/dv_(I));

ENDIF

ELSEIF (ValidPhases == "Liquid-FreeWater") THEN

//Ml_(I) = rhol_(I)*V_(I);

Ml1_(I) = rhol1_(I)*Vl1_(I);

Ml2_(I) = rhol2_(I)*Vl2_(I);

Ml1_(I) = lf1_(I)*M_(I);

Ml2_(I) = lf2_(I)*M_(I);

IF (GlobalRFlow AND PDriven) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

F_(I) = F_(I-1)*(1.0 + 1000*(V_(I) - dv_(I))/dv_(I));

ELSE

F_(I) = F_(I+1)*(1.0 + 1000*(V_(I) - dv_(I))/dv_(I));

ENDIF

ELSE

F_(I) = F_(I-1)*(1.0 + 1000*(V_(I)-dv_(I))/dv_(I));

ENDIF

V_(I) = Vl1_(I) + Vl2_(I);

ELSEIF (ValidPhases=="Vapor-Liquid") THEN

Ml_(I) = rhol_(I)*Vl_(I);

Mv_(I) = rhov_(I)*Vv_(I);

Ml_(I) = lf_(I)*M_(I);

Mv_(I) = vf_(I)*M_(I);

IF (lf_(I) < 1.0) THEN

V_(I) = dv_(I);

ELSE

IF (GlobalRFlow AND PDriven) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

P_(I) = P_(I+1)*(1.0 + 100*(V_(I) - dv_(I))/dv_(I));

ELSE

P_(I) = P_(I-1)*(1.0 + 100*(V_(I) - dv_(I))/dv_(I));

ENDIF

ELSE

P_(I) = P_(I+1)*(1.0 + 100*(V_(I) - dv_(I))/dv_(I));

ENDIF

69

Page 71: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

ENDIF

V_(I) = Vl_(I) + Vv_(I);

ELSEIF (ValidPhases=="Vapor-Liquid-Liquid") OR (ValidPhases == "Vapor-Liquid-FreeWater") THEN

Ml_(I) = rhol_(I)*Vl_(I);

Ml1_(I) = rhol1_(I)*Vl1_(I);

Ml2_(I) = rhol2_(I)*Vl2_(I);

Mv_(I) = rhov_(I)*Vv_(I);

Ml_(I) = lf_(I)*M_(I);

Ml1_(I) = lf1_(I)*M_(I);

Ml2_(I) = lf2_(I)*M_(I);

Mv_(I) = vf_(I)*M_(I);

V_(I) = dv_(I);

V_(I) = Vl_(I) + Vv_(I);

ENDIF

ENDFOR

// energy balance

FOR I IN npoints DO

IF (Initialize=="No" OR Initialize=="Stage3") THEN

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

IF (GlobalRFlow AND PDriven) THEN

// switch differencing scheme on flow reversal

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Energy_bal_hom_fwd:

$E_(I)*(3600/TimeScaler) = F_(I-1)*h_(I-1) - F_(I)*h_(I) + Q_(I);

ELSE

Energy_bal_hom_rev:

$E_(I)*(3600/TimeScaler) = F_(I)*h_(I) - F_(I+1)*h_(I+1) + Q_(I);

ENDIF

ELSE

Energy_bal_hom:

$E_(I)*(3600/TimeScaler) = (F_(I-1)+eps)*h_(I-1) - (F_(I)+eps)*h_(I) + Q_(I);

ENDIF

E_(I).spec : RateInitial;

ELSE

IF (GlobalRFlow AND PDriven) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Energy_bal_2p_fwd:

$E_(I)*(3600/TimeScaler) = Fv_(I-1)*hv_(I-1) - Fv_(I)*hv_(I)

+ Fl_(I-1)*hl_(I-1) - Fl_(I)*hl_(I)

+ Q_(I);

ELSE

Energy_bal_2p_rev:

$E_(I)*(3600/TimeScaler) = Fv_(I)*hv_(I) - Fv_(I+1)*hv_(I+1)

+ Fl_(I)*hl_(I) - Fl_(I+1)*hl_(I+1)

+ Q_(I);

ENDIF

ELSE

Energy_bal_2p:

$E_(I)*(3600/TimeScaler) = (Fv_(I-1)+eps)*hv_(I-1) - (Fv_(I)+eps)*hv_(I)

+ (Fl_(I-1)+eps)*hl_(I-1) - (Fl_(I)+eps)*hl_(I)

+ Q_(I);

ENDIF

E_(I).spec : RateInitial;

ENDIF

ELSE // initialize (Stage1&2)

IF (Initialize=="Stage2") THEN

0 = h_(I-1) - h_(I) + Q_(I)/(F_(I)+eps);

ENDIF

E_(I).spec : Free;

ENDIF

ENDFOR

// internal energy

FOR I IN npoints DO

IF (EqHeatCap=="No") THEN

E_(I) = M_(I)*h_(I) - UCF13*P_(I)*V_(I);

ELSE

IF (HtOpt=="Thermal") AND (HtSpec=="Yes") THEN

E_(I) = M_(I)*h_(I) - UCF13*P_(I)*V_(I);

ELSE

// EquipMass only approximate if diameter varying - exact calculation would require wall thickness

E_(I) = M_(I)*h_(I) - UCF13*P_(I)*V_(I) + EquipMass/(Npts-1)*EquipCp*T_(I)/UCF18;

ENDIF

ENDIF

ENDFOR

FOR I IN nrange DO

IF (EqHeatCap=="Yes") AND (HtOpt=="Thermal") AND (HtSpec=="Yes") THEN

// initialize wall temperature to process temperature

TWall_(I).value: T_(I);

// Dynamic energy balance for the vessel wall

$TWall_(I)*(3600/TimeScaler)*EquipMass/(Npts-1)*EquipCp/UCF18 = QEnv_(I) - Q_(I);

70

Page 72: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

QEnv_(I) = UCF6*UEnv*Pi*Diam_(I)*dx*(Tamb_in + (I/Npts*(Tamb_out-Tamb_in)) - TWall_(I));

ELSE

QEnv_(I) = 0;

ENDIF

ENDFOR

// heat transfer - NB: Q_(0) unused in forward flow

// Q_(Npts) unused in reverse flow

FOR I IN nrange DO

IF (HtOpt=="Adiabatic") THEN

Qr_(I) = 0.0;

ELSEIF (HtOpt=="Thermal") AND (HtSpec=="Yes") AND (HFlux=="Yes") THEN

IF (EqHeatCap == "No") THEN

Qr_(I) = UCF6*U*Pi*Diam_(I)*dx*(Tamb_in + (I/Npts*(Tamb_out-Tamb_in)) - T_(I))

+ UCF6*QAD/UCF15*dx;

ELSE

Qr_(I) = UCF6*UWall*Pi*Diam_(I)*dx*(TWall_(I) - T_(I))

+ UCF6*QAD/UCF15*dx;

ENDIF

Qr_(I).spec : free;

ELSEIF (HtOpt=="Thermal") AND (HtSpec=="Yes") THEN

IF (EqHeatCap=="No") THEN

Qr_(I) = UCF6*U*Pi*Diam_(I)*dx*(Tamb_in + (I/Npts*(Tamb_out-Tamb_in)) - T_(I));

ELSE

Qr_(I) = UCF6*UWall*Pi*Diam_(I)*dx*(TWall_(I) - T_(I));

ENDIF

Qr_(I).spec : free;

ELSEIF (HtOpt=="Thermal") AND (HFlux=="Yes") THEN

Qr_(I) = UCF6*QAD/UCF15*dx;

Qr_(I).spec : free;

ELSE

Qr_(I).spec : fixed;

ENDIF

CALL (Q_(I)) = pQSpec (Qr_(I), T_(I), T_min, T_max, delta_T);

ENDFOR

// momentum balance

FOR I IN npoints DO

IF (Initialize=="No" OR Initialize=="Stage3") THEN

IF (MomType=="Dynamic") THEN

// full momentum balance with interia

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

IF (GlobalRFlow AND PDriven) THEN

// switch differencing scheme on flow reversal

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Mom_bal_hom_dyn_fwd:

$Mom_(I)/UCF1*(3600/TimeScaler) = 1e-3*( (F_(I-1)*Mw_(I-1)*Vel_(I-1) - F_(I)*Mw_(I)*Vel_(I))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ELSE

Mom_bal_hom_dyn_rev:

$Mom_(I)/UCF1*(3600/TimeScaler) = 1e-3*( (F_(I)*Mw_(I)*Vel_(I) - F_(I+1)*Mw_(I+1)*Vel_(I+1))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

ELSE

Mom_bal_hom_dyn:

$Mom_(I)/UCF1*(3600/TimeScaler) = 1e-3*( ((F_(I-1)+eps)*Mw_(I-1)*Vel_(I-1) - (F_(I)+eps)*Mw_(I)*Vel_(I))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

Mom_(I).spec : RateInitial;

ELSE

IF (GlobalRFlow AND PDriven) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Mom_bal_sep_dyn_fwd:

$Mom_(I)/UCF1*(3600/TimeScaler) = 1e-3*( (Fl_(I-1)*Mwl_(I-1)*Vell_(I-1) - Fl_(I)*Mwl_(I)*Vell_(I))/UCF1

+ (Fv_(I-1)*Mwv_(I-1)*Velv_(I-1) - Fv_(I)*Mwv_(I)*Velv_(I))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ELSE

Mom_bal_sep_dyn_rev:

$Mom_(I)/UCF1*(3600/TimeScaler) = 1e-3*( (Fl_(I)*Mwl_(I)*Vell_(I) - Fl_(I+1)*Mwl_(I+1)*Vell_(I+1))/UCF1

+ (Fv_(I)*Mwv_(I)*Velv_(I) - Fv_(I+1)*Mwv_(I+1)*Velv_(I+1))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

ELSE

Mom_bal_sep_dyn:

71

Page 73: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

$Mom_(I)/UCF1*(3600/TimeScaler) = 1e-3*( ((Fl_(I-1)+eps)*Mwl_(I-1)*Vell_(I-1) - (Fl_(I)+eps)*Mwl_(I)*Vell_(I))/UCF1

+ ((Fv_(I-1)+eps)*Mwv_(I-1)*Velv_(I-1) - (Fv_(I)+eps)*Mwv_(I)*Velv_(I))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

Mom_(I).spec : RateInitial;

ENDIF

ELSE

// instantaneous (pseudo-steady state) momentum balance, reduces to force balance

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

IF (GlobalRFlow AND PDriven) THEN

// switch differencing scheme on flow reversal

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Mom_bal_hom_ss_fwd:

0 = 1e-3*( (F_(I-1)*Mw_(I-1)*Vel_(I-1) - F_(I)*Mw_(I)*Vel_(I) )/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ELSE

Mom_bal_hom_ss_rev:

0 = 1e-3*( (F_(I)*Mw_(I)*Vel_(I) - F_(I+1)*Mw_(I+1)*Vel_(I+1) )/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

ELSE

Mom_bal_hom_ss:

0 = 1e-3*( ( (F_(I-1)+eps)*Mw_(I-1)*Vel_(I-1) - (F_(I)+eps)*Mw_(I)*Vel_(I) )/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

Mom_(I).spec : free;

ELSE

IF (GlobalRFlow AND PDriven) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

Mom_bal_sep_ss_fwd:

0 = 1e-3*( (Fl_(I-1)*Mwl_(I-1)*Vell_(I-1) - Fl_(I)*Mwl_(I)*Vell_(I))/UCF1

+ (Fv_(I-1)*Mwv_(I-1)*Velv_(I-1) - Fv_(I)*Mwv_(I)*Velv_(I))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ELSE

Mom_bal_sep_ss_rev:

0 = 1e-3*( (Fl_(I)*Mwl_(I)*Vell_(I) - Fl_(I+1)*Mwl_(I+1)*Vell_(I+1))/UCF1

+ (Fv_(I)*Mwv_(I)*Velv_(I) - Fv_(I+1)*Mwv_(I+1)*Velv_(I+1))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

ELSE

Mom_bal_sep_ss:

0 = 1e-3*( ((Fl_(I-1)+eps)*Mwl_(I-1)*Vell_(I-1) - (Fl_(I)+eps)*Mwl_(I)*Vell_(I))/UCF1

+ ((Fv_(I-1)+eps)*Mwv_(I-1)*Velv_(I-1) - (Fv_(I)+eps)*Mwv_(I)*Velv_(I))/UCF1

+ area_(I)*(UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I)) );

ENDIF

Mom_(I).spec : free;

ENDIF

ENDIF

ELSE // initialize (stage1&2)

mom_(I).spec : Free;

IF (Initialize=="Stage2") THEN

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

Mom_balance_stage2_1:

0 = 1e-3*( ((F_(I-1)+eps)*Mw_(I-1)*Vel_(I-1) - (F_(I)+eps)*Mw_(I)*Vel_(I))/UCF1

+ area_(I)*( UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I) ) );

ELSE

Mom_balance_stage2_2:

0 = 1e-3*( ((Fl_(I-1)+eps)*Mwl_(I-1)*Vell_(I-1) - (Fl_(I)+eps)*Mwl_(I)*Vell_(I))/UCF1

+((Fv_(I-1)+eps)*Mwv_(I-1)*Velv_(I-1) - (Fv_(I)+eps)*Mwv_(I)*Velv_(I))/UCF1

+ area_(I)*( UCF3*P_drop_(I)

- rhom_(I)*UEC1*dx*SIN(angle)

- UCF3*dp_fr_(I) ) );

ENDIF

ENDIF

ENDIF

ENDFOR

72

Page 74: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

// pressure drop

FOR I IN npoints DO

IF (GlobalRFlow AND PDriven) THEN

// switch differencing scheme on flow reversal - NB: pressure gradient changes sign

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

P_drop_(I) = P_(I) - P_(I+1);

ELSE

P_drop_(I) = P_(I-1) - P_(I);

ENDIF

ELSE

P_drop_(I) = P_(I) - P_(I+1);

ENDIF

ENDFOR

// momentum

FOR I IN npoints DO

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

Mom_(I) = 1e-3*M_(I)*Mw_(I)*Vel_(I);

ELSE

Mom_(I) = 1e-3*( (Ml_(I)*Mwl_(I)*Vell_(I) + Mv_(I)*Mwv_(I)*Velv_(I)));

ENDIF

ENDFOR

// mass flow

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

Fm_ = F_*Mw_;

IF (ValidPhases=="Vapor-Only") THEN

lambda = 0.0;

ELSEIF (ValidPhases=="Liquid-Only") OR (ValidPhases=="Liquid-FreeWater") THEN

lambda = 1.0;

ELSE

lambda = lf_*rho_/rhol_;

ENDIF

ELSE

Fm_ = Fl_*Mwl_ + Fv_*Mwv_;

lambda = ABS(Fl_)/rhol_ / (ABS(Fl_)/rhol_ + ABS(Fv_)/Rhov_ + eps);

ENDIF

// relative roughness

FOR I IN nrange DO

relruf_(I) = ruff/Diam_(I);

ENDFOR

// friction factors and holdup fractions

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

FOR I IN nrange DO

Call (Ml_fac1_(I), DP_const_(I)) = pPipMom (Diam_(I), dxl, eff, angle, relruf_(I), Vel_(I), Fm_(I), xdot_(I),

P_(I), lambda(I), rhoml_(I), rhomv_(I), sigma1_(I), visl_(I), visg_(I),

HldTyp, FricTyp) TEAR;

ENDFOR

ELSE

FOR I IN nrange DO

Call (Ml_fac1_(I), DP_const_(I)) = pPipMom (Diam_(I), dxl, eff, angle, relruf_(I), Vel_(I), Fm_(I), xdot_(I),

P_(I), lambda(I), rhoml_(I), rhomv_(I), sigma1_(I), visl_(I), visg_(I),

HldTyp, FricTyp);

Call (DP_const_torn_(I)) = pcopy1 (DP_const_(I)) TEAR;

ENDFOR

ENDIF

// overall pressure drops

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

// frictional and elevation pressure drop

IF (GlobalRFlow AND PDriven) THEN

FOR I IN nrange DO

dp_fr_(I) = DP_const_(I)*Vel_(I)*(ABS(Vel_(I))+eps);

dp_elv_(I) = rhom_(I)*UEC1*dx*SIN(angle)/UCF3;

ENDFOR

ELSE

// end point pressure drop components not used sp don’t calculate

FOR I IN [0:(Npts-1)] DO

dp_fr_(I) = DP_const_(I)*Vel_(I)*(ABS(Vel_(I))+eps);

dp_elv_(I) = rhom_(I)*UEC1*dx*SIN(angle)/UCF3;

ENDFOR

ENDIF

// accelerational pressure drop

IF (GlobalRFlow AND PDriven) THEN

// end elements not flow direction dependent since instanced based on direction

dp_acc_(0) = -(F_(0)+eps)*(Mw_(0)*Vel_(0) - Mw_(1)*Vel_(1))/(area_(0)*UCF3*UCF1);

dp_acc_(Npts) = -(F_(Npts-1)*Mw_(Npts-1)*Vel_(Npts-1) - F_(Npts)*Mw_(Npts)*Vel_(Npts))/(area_(Npts)*UCF3*UCF1);

FOR I in npoints DO

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

dp_acc_(I) = -( F_(I-1)*Mw_(I-1)*Vel_(I-1) - F_(I)*Mw_(I)*Vel_(I) )/(area_(I)*UCF3*UCF1);

ELSE

73

Page 75: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

dp_acc_(I) = -( F_(I)*Mw_(I)*Vel_(I) - F_(I+1)*Mw_(I+1)*Vel_(I+1) )/(area_(I)*UCF3*UCF1);

ENDIF

ENDFOR

ELSE

dp_acc_(0) = -(F_(0)+eps)*(Mw_(0)*Vel_(0) - Mw_(1)*Vel_(1))/(area_(0)*UCF3*UCF1);

FOR I in npoints DO

dp_acc_(I) = -( F_(I-1)*Mw_(I-1)*Vel_(I-1) - F_(I)*Mw_(I)*Vel_(I) )/(area_(I)*UCF3*UCF1);

ENDFOR

ENDIF

ELSE

// frictional and elevation pressure drop

IF (GlobalRFlow AND PDriven) THEN

FOR I IN nrange DO

dp_fr_(I) = DP_const_(I)*Vel_(I)*(ABS(Vel_(I))+eps);

dp_elv_(I) = rhom_(I)*UEC1*dx*SIN(angle)/UCF3;

ENDFOR

ELSE

// end point pressure drop components not used sp don’t calculate

FOR I IN [0:(Npts-1)] DO

dp_fr_(I) = DP_const_(I)*Vel_(I)*(ABS(Vel_(I))+eps);

dp_elv_(I) = rhom_(I)*UEC1*dx*SIN(angle)/UCF3;

ENDFOR

ENDIF

// accelerational pressure drop

IF (GlobalRFlow AND PDriven) THEN

// end elements not flow direction dependent since instanced based on direction

dp_acc_(0) = -(F_(0)+eps)*(Mw_(0)*Vel_(0) - Mw_(1)*Vel_(1))/(area_(0)*UCF3*UCF1);

dp_acc_(Npts) = -(F_(Npts-1)*Mw_(Npts-1)*Vel_(Npts-1) - F_(Npts)*Mw_(Npts)*Vel_(Npts))/(area_(Npts)*UCF3*UCF1);

FOR I in npoints DO

IF ((FlowRevbasis == "Local-Flow" AND F_(I) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

dp_acc_(I) = -(Fl_(I-1)*Mwl_(I-1)*Vell_(I-1) - Fl_(I)*Mwl_(I)*Vell_(I)

+Fv_(I-1)*Mwv_(I-1)*Velv_(I-1) - Fv_(I)*Mwv_(I)*Velv_(I))/(area_(I)*UCF3*UCF1);

ELSE

dp_acc_(I) = -(Fl_(I)*Mwl_(I)*Vell_(I) - Fl_(I+1)*Mwl_(I+1)*Vell_(I+1)

+ Fv_(I)*Mwv_(I)*Velv_(I) - Fv_(I+1)*Mwv_(I+1)*Velv_(I+1))/(area_(I)*UCF3*UCF1);

ENDIF

ENDFOR

ELSE

dp_acc_(0) = -(F_(0)+eps)*(Mw_(0)*Vel_(0) - Mw_(1)*Vel_(1))/(area_(0)*UCF3*UCF1);

FOR I in npoints DO

dp_acc_(I) = -(Fl_(I-1)*Mwl_(I-1)*Vell_(I-1) - Fl_(I)*Mwl_(I)*Vell_(I)

+Fv_(I-1)*Mwv_(I-1)*Velv_(I-1) - Fv_(I)*Mwv_(I)*Velv_(I))/(area_(I)*UCF3*UCF1);

ENDFOR

ENDIF

ENDIF

IF (GlobalRFlow AND PDriven) THEN

// overall pressure drops depend on flow direction

IF ((FlowRevbasis == "Local-Flow" AND F_(0) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

IF ((FlowRevbasis == "Local-Flow" AND F_(Npts) >= 0) OR // forward flow in last element

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

dpAcc = Sigma(ForEach (I in [0:Npts-1]) dp_acc_(I));

dpFrc = Sigma(ForEach (I in [0:Npts-1]) dp_fr_(I));

dpElv = Sigma(ForEach (I in [0:Npts-1]) dp_elv_(I));

ELSE // reverse flow in last element

dpAcc = Sigma(ForEach (I in [0:Npts]) dp_acc_(I));

dpFrc = Sigma(ForEach (I in [0:Npts]) dp_fr_(I));

dpElv = Sigma(ForEach (I in [0:Npts]) dp_elv_(I));

ENDIF

ELSE // reverse flow in first element

IF ((FlowRevbasis == "Local-Flow" AND F_(Npts) >= 0) OR // forward flow in last element

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

dpAcc = Sigma(ForEach (I in [1:Npts-1]) dp_acc_(I));

dpFrc = Sigma(ForEach (I in [1:Npts-1]) dp_fr_(I));

dpElv = Sigma(ForEach (I in [1:Npts-1]) dp_elv_(I));

ELSE // reverse flow in last element

dpAcc = Sigma(ForEach (I in [1:Npts]) dp_acc_(I));

dpFrc = Sigma(ForEach (I in [1:Npts]) dp_fr_(I));

dpElv = Sigma(ForEach (I in [1:Npts]) dp_elv_(I));

ENDIF

ENDIF

ELSE

dpAcc = Sigma(ForEach (I in [0:Npts-1]) dp_acc_(I));

dpFrc = Sigma(ForEach (I in [0:Npts-1]) dp_fr_(I));

dpElv = Sigma(ForEach (I in [0:Npts-1]) dp_elv_(I));

ENDIF

// erosion velocities

FOR I IN npoints DO

ero_vel_(I)*SQRT(rhom_(I)) = cero_vel;

ENDFOR

// choking - prevent flow exceeding choked flow at the pipe inlet (reverse flow) or exit (forward flow)

IF (GlobalRFlow AND PDriven) THEN

74

Page 76: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

// inlet and outlet pressure

IF (Initialize=="No" OR Initialize=="Stage3") THEN

// sonic velocity at inlet and outlet

call (sonic_vel_in) = ppsonich(h_(0), P_(0), z_(0,componentlist), Mw_(0), UOM) TEAR;

call (sonic_vel_out) = ppsonich(h_(Npts), P_(Npts), z_(Npts,componentlist), Mw_(Npts), UOM) TEAR;

// velocity fractions

VelFracIn = -Vel_(0)/sonic_vel_in; // velocity -ve in reverse flow

VelFracOut = Vel_(Npts)/sonic_vel_out;

P_(Npts) = Out_P_P + 100*(MAX(VelFracOut, 0.99) - 0.99)*P_max;

P_(0) = In_F_P + 100*(MAX(VelFracIn, 0.99) - 0.99)*P_max - DPin;

ELSE // initialize (Stage1&2)

P_(Npts) = Out_P_P;

P_(0) = In_F_P - DPin;

ENDIF

ELSE // forward flow simulation

// P_(Npts) - as flow approaches choked at outlet, increase P_(Npts) to avoid exceeding choking velocity

IF (Initialize=="No" OR Initialize=="Stage3") THEN

// sonic velocity at outlet

call (sonic_vel_out) = ppsonich(h_(Npts), P_(Npts), z_(Npts,componentlist), Mw_(Npts), UOM) TEAR;

// velocity fraction

VelFracOut = Vel_(Npts)/sonic_vel_out;

P_(Npts) = Out_P_P + 100*(MAX(VelFracOut, 0.99) - 0.99)*P_max;

ELSE // initialize (Stage1&2)

P_(Npts) = Out_P_P;

ENDIF

// inlet pressure

P_(0) = In_F_P - DPin;

ENDIF

IF PDriven THEN

DPin.spec : fixed;

ELSE // fix outlet pressure and back calculate inlet pressure - DPin allows for differences with A+ results

DPin.spec : free;

Out_P_P.spec : fixed;

ENDIF

// liquid volume fraction

IF (ValidPhases=="Vapor-Only") THEN

lfvol_ = 0.0;

vf_ = 1.0;

ELSEIF (ValidPhases=="Liquid-Only") OR (ValidPhases=="Liquid-FreeWater") THEN

lfvol_ = 1.0;

vf_ = 0.0;

ELSE

lfvol_*Rhol_ = lf_*Rho_;

ENDIF

// slip and velocity/flow relations

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

FOR I IN nrange DO

// vapor mass flow fraction (xdot_)

IF (ValidPhases=="Liquid-Only") OR (ValidPhases=="Liquid-FreeWater") THEN

xdot_(I) = 0.0;

ELSE

xdot_(I) = vf_(I)*Mwv_(I)/Mw_(I);

ENDIF

// velocities and phase flow rates

F_(I)/UCF1 = Vel_(I)*area_(I)*rho_(I);

IF (ValidPhases IN ["Vapor-Liquid", "Vapor-Liquid-Liquid", "Vapor-Liquid-FreeWater"]) THEN

Fl_(I) = lf_(I)*F_(I);

Fv_(I) = vf_(I)*F_(I);

Vell_(I) = Vel_(I);

Velv_(I) = Vel_(I);

ENDIF

ENDFOR

ELSE

FOR I IN nrange DO

// determine vapor mass flow fraction (xdot_)

xdot_(I) = ABS(Fv_(I))*mwv_(I) / (ABS(Fm_(I))+eps);

// relate slip to phase velocities

velv_(I) = slip_(I) * vell_(I);

// calculate velocities and phase flow rates

vel_(I) = vell_(I)*lfvol_(I) + velv_(I)*(1-lfvol_(I));

F_(I) = Fv_(I) + Fl_(I);

IF (lfvol_(I)<1E-5) THEN

Fl_(I) = (1e-5 - lfvol_(I))/1e-5 * F_(I) * lf_(I)

+ lfvol_(I)/1e-5 * ucf1 * vell_(I) * area_(I) * Rhol_(I) * lfvol_(I);

ELSE

Fl_(I) = ucf1 * vell_(I) * area_(I) * Rhol_(I) * lfvol_(I);

ENDIF

75

Page 77: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

IF (lfvol_(I) > 0.99999) THEN

Fv_(I) = (lfvol_(I)-0.99999)/1e-5 * F_(I) * vf_(I)

+ (1-lfvol_(I))/1e-5 * ucf1 * velv_(I) * area_(I) * Rhov_(I) * (1-lfvol_(I));

ELSE

Fv_(I) = ucf1 * velv_(I) * area_(I) * Rhov_(I) * (1-lfvol_(I));

ENDIF

slip_(I) = MAX(0, 1 + 10000*(Ml_fac1_(I) - lfvol_(I)));

ENDFOR

ENDIF

// phase equilibrium

IF (ValidPhases=="Vapor-Only") THEN

FOR I IN nrange DO

pvap_(I).T = T_(I);

pvap_(I).P = P_(I);

pvap_(I).h = h_(I);

pvap_(I).rho = rhov_(I);

pvap_(I).Mw = Mwv_(I);

pvap_(I).y(componentlist) = z_(I, componentlist);

ENDFOR

ELSEIF (ValidPhases=="Liquid-Only") THEN

FOR I IN nrange DO

pliq_(I).T = T_(I);

pliq_(I).P = P_(I);

pliq_(I).h = h_(I);

pliq_(I).rho = rhol_(I);

pliq_(I).Mw = Mwl_(I);

pliq_(I).x(componentlist) = z_(I, componentlist);

ENDFOR

ELSEIF (ValidPhases=="Liquid-FreeWater") THEN

FOR I IN nrange DO

pliqw_(I).T = T_(I);

pliqw_(I).P = P_(I);

pliqw_(I).hl1 = hl1_(I);

pliqw_(I).hl2 = hl2_(I);

pliqw_(I).h = h_(I);

pliqw_(I).lf1 = lf1_(I);

pliqw_(I).lf2 = lf2_(I);

pliqw_(I).rhol1 = rhol1_(I);

pliqw_(I).rhol2 = rhol2_(I);

pliqw_(I).Mwl1 = Mwl1_(I);

pliqw_(I).Mwl2 = Mwl2_(I);

pliqw_(I).z(componentlist) = z_(I, componentlist);

pliqw_(I).x1(componentlist) = x1_(I, componentlist);

pliqw_(I).x2(componentlist) = x2_(I, componentlist);

ENDFOR

ELSEIF (ValidPhases=="Vapor-Liquid") THEN

FOR I IN nrange DO

pflash2_(I).T = T_(I);

pflash2_(I).P = P_(I);

pflash2_(I).lf = lf_(I);

pflash2_(I).vf = vf_(I);

pflash2_(I).h = h_(I);

pflash2_(I).hl = hl_(I);

pflash2_(I).hv = hv_(I);

pflash2_(I).rhol = rhol_(I);

pflash2_(I).rhov = rhov_(I);

pflash2_(I).Mwl = Mwl_(I);

pflash2_(I).Mwv = Mwv_(I);

pflash2_(I).z(componentlist) = z_(I, componentlist);

pflash2_(I).x(componentlist) = x_(I, componentlist);

pflash2_(I).y(componentlist) = y_(I, componentlist);

ENDFOR

ELSEIF (ValidPhases=="Vapor-Liquid-Liquid") THEN

FOR I IN nrange DO

pflash3_(I).T = T_(I);

pflash3_(I).P = P_(I);

pflash3_(I).lf1 = lf1_(I);

pflash3_(I).lf2 = lf2_(I);

pflash3_(I).vf = vf_(I);

pflash3_(I).h = h_(I);

pflash3_(I).hl1 = hl1_(I);

pflash3_(I).hl2 = hl2_(I);

pflash3_(I).hv = hv_(I);

pflash3_(I).rhol1 = rhol1_(I);

pflash3_(I).rhol2 = rhol2_(I);

pflash3_(I).rhov = rhov_(I);

pflash3_(I).Mwl1 = Mwl1_(I);

pflash3_(I).Mwl2 = Mwl2_(I);

pflash3_(I).Mwv = Mwv_(I);

pflash3_(I).z(componentlist) = z_(I, componentlist);

pflash3_(I).x1(componentlist) = x1_(I, componentlist);

pflash3_(I).x2(componentlist) = x2_(I, componentlist);

pflash3_(I).y(componentlist) = y_(I, componentlist);

ENDFOR

ELSEIF (ValidPhases=="Vapor-Liquid-FreeWater") THEN

FOR I IN nrange DO

pflash2w_(I).T = T_(I);

pflash2w_(I).P = P_(I);

76

Page 78: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

pflash2w_(I).lf1 = lf1_(I);

pflash2w_(I).lf2 = lf2_(I);

pflash2w_(I).vf = vf_(I);

pflash2w_(I).h = h_(I);

pflash2w_(I).hl1 = hl1_(I);

pflash2w_(I).hl2 = hl2_(I);

pflash2w_(I).hv = hv_(I);

pflash2w_(I).rhol1 = rhol1_(I);

pflash2w_(I).rhol2 = rhol2_(I);

pflash2w_(I).rhov = rhov_(I);

pflash2w_(I).Mwl1 = Mwl1_(I);

pflash2w_(I).Mwl2 = Mwl2_(I);

pflash2w_(I).Mwv = Mwv_(I);

pflash2w_(I).z(componentlist) = z_(I, componentlist);

pflash2w_(I).x1(componentlist) = x1_(I, componentlist);

pflash2w_(I).x2(componentlist) = x2_(I, componentlist);

pflash2w_(I).y(componentlist) = y_(I, componentlist);

ENDFOR

ENDIF

// mixture properties

FOR I IN nrange DO

IF (ValidPhases=="Vapor-Only") THEN

rhoml_(I).upper : 1000;

Mw_(I) = Mwv_(I);

rho_(I)= rhov_(I);

rhomv_(I) = rho_(I)*Mw_(I);

rhoml_(I) = rhomv_(I);

rhom_(I) = rhomv_(I);

IF (PropUser_VapVisc=="No") THEN

CALL (visg_(I)) = pvisc_vap(T_(I), P_(I), z_(I, componentlist)) TEAR;

ELSE

visg_(I) = vapvisc;

ENDIF

vismx_(I) = visg_(I);

visl_(I) = visg_(I);

ELSEIF (ValidPhases=="Liquid-Only") THEN

rhomv_(I).upper : 5e5;

Mw_(I) = Mwl_(I);

rho_(I) = rhol_(I);

rhoml_(I) = rhol_(I)*Mwl_(I);

rhomv_(I) = rhoml_(I);

rhom_(I) = rhoml_(I);

IF (PropUser_LiqVisc=="No") THEN

CALL (visl_(I)) = pvisc_liq(T_(I), P_(I), z_(I, componentlist)) TEAR;

ELSE

visl_(I) = EXP(viscA + viscB/(T_(I) + UCF12));

ENDIF

vismx_(I) = visl_(I);

visg_(I) = visl_(I);

ELSEIF (ValidPhases=="Liquid-FreeWater") THEN

rhomv_(I).upper : 5e5;

Mwl_(I) = beta_(I)* Mwl1_(I) + (1 - beta_(I))*Mwl2_(I);

Mw_(I) = Mwl_(I);

rhoml_(I) = rhol_(I)*Mwl_(I);

rhoml1_(I) = rhol1_(I)*Mwl1_(I);

rhoml2_(I) = rhol2_(I)*Mwl2_(I);

rhomv_(I) = rhoml_(I);

rho_(I) = rhol_(I);

1.0 = rhol_(I)*(beta_(I)/rhol1_(I) + (1 - beta_(I))/rhol2_(I));

rhom_(I) = rho_(I)* Mw_(I);

beta_(I) = lf1_(I);

IF (PropUser_LiqVisc=="No") THEN

CALL (visl_(I)) = pvisc_liq(T_(I), P_(I), z_(I, componentlist)) TEAR;

ELSE

visl_(I) = exp(viscA + viscB/(T_(I) + UCF12));

ENDIF

vismx_(I) = visl_(I);

visg_(I) = visl_(I);

ELSEIF (ValidPhases=="Vapor-Liquid") THEN

rhoml_(I) = rhol_(I)*Mwl_(I);

rhomv_(I) = rhov_(I)*Mwv_(I);

Mw_(I) = lf_(I)*Mwl_(I) + vf_(I)*Mwv_(I);

1.0 = rho_(I)*(lf_(I)/rhol_(I) + vf_(I)/rhov_(I));

rhom_(I) = rho_(I)*Mw_(I);

IF (PropUser_LiqVisc=="No") THEN

77

Page 79: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

CALL (visl_(I)) = pvisc_liq(T_(I), P_(I), x_(I, componentlist)) TEAR;

ELSE

visl_(I) = EXP(viscA + viscB/(T_(I) + UCF12));

ENDIF

IF (PropUser_VapVisc=="No") THEN

CALL (visg_(I)) = pvisc_vap(T_(I), P_(I), y_(I, componentlist)) TEAR;

ELSE

visg_(I) = vapvisc;

ENDIF

vismx_(I) = lfvol_(I)*visl_(I) + (1.0 - lfvol_(I))*visg_(I);

ELSEIF (ValidPhases=="Vapor-Liquid-Liquid") OR (ValidPhases=="Vapor-Liquid-FreeWater") THEN

Mwl_(I) = beta_(I)* Mwl1_(I) + (1 - beta_(I))*Mwl2_(I);

Mw_(I) = lf_(I)* Mwl_(I) + vf_(I)*Mwv_(I) ;

rhoml_(I) = rhol_(I)*Mwl_(I);

rhoml1_(I) = rhol1_(I)*Mwl1_(I);

rhoml2_(I) = rhol2_(I)*Mwl2_(I);

rhomv_(I) = rhov_(I)* Mwv_(I);

1.0 = rho_(I)*(lf_(I)/rhol_(I) + vf_(I)/rhov_(I));

1.0 = rhol_(I)*(beta_(I)/rhol1_(I) + (1 - beta_(I))/rhol2_(I));

rhom_(I) = rho_(I)* Mw_(I);

CALL (beta_(I)) = pdivide(lf1_(I), lf_(I));

x_(I, componentlist) = beta_(I)*x1_(I, componentlist) + (1 - beta_(I))*x2_(I, componentlist);

hl_(I) = beta_(I)*hl1_(I) + (1 - beta_(I))*hl2_(I);

lf_(I) = lf1_(I) + lf2_(I);

IF (PropUser_LiqVisc=="No") THEN

CALL (visl_(I)) = pvisc_liq(T_(I), P_(I), x_(I, componentlist)) TEAR;

ELSE

visl_(I) = exp(viscA + viscB/(T_(I) + UCF12));

ENDIF

IF (PropUser_VapVisc=="No") THEN

CALL (visg_(I)) = pvisc_vap(T_(I), P_(I), y_(I, componentlist)) TEAR;

ELSE

visg_(I) = vapvisc;

ENDIF

vismx_(I) = lfvol_(I)*visl_(I) + (1.0 - lfvol_(I))*visg_(I);

ENDIF

ENDFOR

// surface tension

FOR I IN nrange DO

IF (ValidPhases=="Vapor-Only") THEN

sigma1_(I) = 0.05; // dummy value for vapor

ELSEIF (ValidPhases=="Liquid-Only") OR (ValidPhases == "Liquid-FreeWater") THEN

CALL (sigma1_(I)) = psurf_tens (T_(I), P_(I), z_(I, componentList)) TEAR;

ELSE

CALL (sigma1_(I)) = psurf_tens (T_(I), P_(I), x_(I, componentList)) TEAR;

ENDIF

ENDFOR

// Reynolds number (for reporting in results)

FOR I IN nrange DO

reyno_(I)*vismx_(I)/999.89 = rhom_(I)*Vel_(I)*Diam_(I);

ENDFOR

// element [Npts]

// forward flow outlet conditions / reverse flow inlet conditions

IF (GlobalRFlow AND PDriven) THEN

IF (Initialize=="No" OR Initialize=="Stage3") THEN

Out_P_F = F_(Npts);

ENDIF

IF ((FlowRevbasis == "Local-Flow" AND F_(Npts-1) >= 0) OR

(FlowRevBasis == "InletOutlet-Flow" AND F_max >= -eps)) THEN

z_(Npts-1) = z_(Npts);

h_(Npts) - h_(Npts-1) = Q_(Npts)/(F_(Npts)+eps);

Fm_(Npts-1) = Fm_(Npts);

ELSE

z_(Npts) = Out_P_zrev;

h_(Npts) = Out_P_hrev;

// momentum balance - special case (backward discretize convective term to avoid use of ficticious grid points)

0 =1e-3*( (F_(Npts-1)*Mw_(Npts-1)*Vel_(Npts-1) - F_(Npts)*Mw_(Npts)*Vel_(Npts))/(area_(Npts)*UCF3*UCF1)

+ P_drop_(Npts)

- dp_elv_(Npts)

- dp_fr_(Npts) );

ENDIF

ELSE

IF (Initialize=="No" OR Initialize=="Stage3") THEN

CALL (Out_P_F) = plimit (F_(Npts), ZERO, LARGE);

ENDIF

Fm_(Npts-1) = Fm_(Npts);

z_(Npts-1) = z_(Npts);

h_(Npts) - h_(Npts-1) = Q_(Npts)/(F_(Npts)+eps);

ENDIF

78

Page 80: Condensation of low volatile components in lean …Condensation of low volatile components in lean natural gas transmission pipelines S.T.A.M. de Wispelaere Report number WPC 2006.07

// outlet enthalpy and composition

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

Out_P_z = z_(Npts);

Out_P_h = h_(Npts);

ELSE

Out_P_z = (ABS(Fv_(Npts))*y_(Npts) + ABS(Fl_(Npts))*x_(Npts))/(ABS(F_(Npts)+eps));

Out_P_h = (ABS(Fv_(Npts))*hv_(Npts) + ABS(Fl_(Npts))*hl_(Npts))/(ABS(F_(Npts)+eps));

ENDIF

// outlet temperature

Out_P_T = T_(Npts);

IF (Initialize=="Stage1") THEN

P_(Npts) = In_F_P;

ENDIF

// pressure drop

IF (GlobalRFlow AND PDriven) THEN

// NB: pressure gradient changes sign on flow reversal

P_drop_(Npts) = P_(Npts-1) - P_(Npts);

ENDIF

// availability

In_F_Av = Out_P_Av;

IF (GlobalRFlow AND PDriven) THEN

In_F_Avrev = Out_P_Avrev;

ENDIF

// outlet molar volume

1.0 = Out_P_V*Rho_(Npts);

// slip

IF (MomCalc=="Homogeneous") OR (ValidPhases IN ["Vapor-Only","Liquid-Only","Liquid-FreeWater"]) THEN

Out_P_slip = 1.0;

ELSE

Out_P_slip = Slip_(Npts);

ENDIF

// length profile (for profile plots)

FOR I IN nrange DO

L_prof(I) = dx*I;

ENDFOR

End

79