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
Abstract
Condensation inside natural gas transport pipelines is highly undesirable as it can lead to
corrosion and extra pressure drop. Even for very lean gases accumulation of condensate over
periods of years can lead to considerable amounts of liquid in the pipes. As it is difficult and
expensive to mechanically clean the pipes from liquid deposit, methods to avoid or decrease
condensate flow rate are sought-after. To do so, the condensation process has to be better
understood.
A theoretical and numerical study of condensation in long distance natural gas pipelines is
done. Possible condensation phenomena are discussed: filmwise or dropwise wall condensation 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 of
condensation, 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 the
difference between condensable and non-condensable gases is not clear. Phase equilibria theory 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 a
combinational model is proposed. The mass transfer rate is diffusion controlled and modeled
by film theory, the amount and composition of condensate however is determined with flash
calculations 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 highly
turbulent flow conditions, the heat resistance of the bulk gas is small, causing small difference
between bulk gas and wall temperatures.
Radial temperature profiles are investigated to calculate inner pipe wall temperatures based
on known axial (p,T) profiles. At the high gas velocities inside the pipe, high Nusselt numbers and heat transfer coefficient from bulk to pipe wall cause the difference between bulk
gas temperature and inner wall temperature to be very small, reaching maximum values of a
few Kelvin.
Numerical studies were done with the combination model for a Russian natural gas of 32 components. For constant conditions of temperature and pressure, the growth rate of the film
thickness proves to be constant in time. A considerable growth rate is observed, ranging from
maximum values of 4.5 to 6 mm/year, depending on soil temperature. Variation of the inlet temperature does not prove to influence the location nor the value of the maximum growth.
1
The condensation rate of individual components is examined. Indeed, the low volatile component reaches an early maximum along the length of the pipe. Other components start to
condense more downstream, all at the same location. It proves that the rate of condensation
of octane up to hexa-decane is the highest, showing maxima for tri- and tetra-decane. Typical
condensation 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 the
other components slightly.
2
Contents
List of symbols
5
1 Introduction
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Objectives and assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Report lay-out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
7
7
8
2 Phenomena of condensation
2.1 Wall condensation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 fog formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
10
10
3 Film theory
3.1 Physical model . . . . . . . . . . . . . . . .
3.2 Derivations . . . . . . . . . . . . . . . . . .
3.2.1 Mass transfer . . . . . . . . . . . . .
3.2.2 Selection of variables . . . . . . . . .
3.2.3 Correction factor for mass transport
3.2.4 Correction factor for heat transport
3.2.5 Heat and mass transfer coefficients .
.
.
.
.
.
.
.
12
12
13
13
14
15
16
16
4 Phase Equilibria
4.1 Phase diagram of a natural gas . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Equations of state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 Phase equilibria with Equations of State . . . . . . . . . . . . . . . . . . . . .
18
18
19
20
5 Inner pipe wall temperature
5.1 Introduction . . . . . . . . . . . . .
5.2 Governing equations . . . . . . . .
5.2.1 Conductive heat loss . . . .
5.2.2 Axial velocity . . . . . . . .
5.2.3 Density and property data .
5.3 Results . . . . . . . . . . . . . . . .
.
.
.
.
.
.
23
23
23
23
25
26
26
6 Combination model
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Construction of control volumes . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.1 Bulk volume equations . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
29
30
30
.
.
.
.
.
.
3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
6.2.2
6.2.3
Wall control volume equations . . . . . . . . . . . . . . . . . . . . . .
Mass transfer term . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7 Numerical results
7.1 Temperature and pressure profiles . . . . .
7.2 Phase diagram . . . . . . . . . . . . . . . .
7.3 Flash calculation . . . . . . . . . . . . . . .
7.4 Time dependent film thickness profile . . .
7.5 Film thickness growth rate . . . . . . . . . .
7.6 Condensation rate of individual components
31
32
.
.
.
.
.
.
34
34
34
36
37
38
38
8 Conclusions and recommendations
8.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 Recommendations for further research . . . . . . . . . . . . . . . . . . . . . .
42
42
43
Bibliography
45
A Derivations for mass transfer
A.1 Concentration Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.2 Alternative variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
47
48
B Equations of state
B.1 Peng-Robinson expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2 Flash algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
49
49
50
C Gas composition
51
D Property data
53
E Numerical programming
E.1 Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E.2 Aspen Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
54
62
4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
List of symbols
Variables
cp
c
dp
D
Di,m
~jq
k
L
Lf
LV C
M
M̃
ṁ
ṅ
p
q̇
~qR
r
R
R
t
T
u, v, w
ṽ
~v
V
Vf
x̃
ỹ
z̃
z
Z
specific heat capacity at constant pressure
mass fraction
pipe diameter
binary diffusion coefficient
effective diffusion coefficient
heat flux field due to conduction
thermal conductivity
length
molar liquid fraction
the low volatile component
molar mass
mass in control volume
mass flux
molar flux
pressure
heat flux
heat flux field due to radiation
radial coordinate
universal molar gas constant
pipe inner radius
time
temperature
bulk velocity in x, y, z-direction
molar volume
velocity vector field
volume
molar vapour fraction
molar fraction in the liquid phase
molar fraction in the gas phase
molar fraction in total mixture
axial coordinate in pipe
compressibility factor
5
[J/(kgK)]
[kg/kg]
[m]
[m2 /s]
[m2 /s]
[W/m2 ]
[W/(mK)]
[m]
[kmol/kmol]
[kg/kmol]
[kmol]
[kg/(m2 s)]
[kmol/(m2 s)]
[P a]
[W/m2 ]
[W/m2 ]
[m]
[J/(kmolK)]
[m]
[s]
[K]
[m/s]
[m3 /kmol]
[m/s]
[m3 ]
[kmol/kmol]
[kmol/kmol]
[kmol/kmol]
[kmol/kmol]
[m]
[−]
α
β
δ
ζ
η
µJT
Θ
ρ
ρ̃
τ
ω
heat transfer coefficient
mass transfer coefficient
boundary layer thickness
resistance factor
dynamic viscosity
Joule-Thompson coefficient
correction factor
mass density
molar density
tension tensor
acentric factor
[W/(m2 K)]
[m/s]
[m]
[−]
[P a s]
[K/P a]
[−]
[kg/(m3 )]
[kmol/(m3 )]
[N/(m2 )]
[−]
Subscripts
∞
0
c
cv
i, j
L
m
n
T
V
W
bulk gas
condensate film surface, pipe inlet
thermodynamically critical
control volume on pipe wall
components
liquid phase
mass
non-condensable gas
temperature
gas phase
pipe wall
Superscripts
−
L
V
pipe cross-sectional average of variable
liquid phase
gas phase
Dimensionless numbers
Nu
Pr
Re
Sc
Sh
=
=
=
=
=
α·d
k
η·cp
k
v·d·ρ
η
η
ρ·D
β·d
D
6
Chapter 1
Introduction
1.1
Background
After producing lean natural gas from a well, a number of operations are necessary to make
it suitable for further transport trough pipelines to the consumers. Apart from filtering the
gas, it is important to remove condensable components to prevent the condensation further
in the transport pipelines, which causes corrosion and extra pressure drop. At the high
pressures (typically 30–120 bars) and low temperatures (typically 270–320 K) at which the
gas is delivered, most of the heavier components are not present anymore. Before entering
the pipeline, a low volatile component (hereafter occasionally abbreviated as LVC) is added,
that absorbs the remaining water content. Although the chemical deposits with the water
before entering the pipeline, small quantities (in the order of 1 ppm) of the component remain
in the gas and can condense further in the pipeline. This is possible because the gas drops
in temperature and pressure, due to frictional pressure drop and heat loss. These can be
considerable for long distance pipelines. For a multicomponent mixture like natural gas, it is
then 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 total
system and must be taken into account. Although the gas is lean and the rate of condensation
is expected to be very small, accumulation of condensate over long periods of time (in the order
of years) can result in large amounts of liquid in the pipeline. As it is difficult and expensive
to pause gas transport for mechanical removal of condensate, it is useful to search for methods
to avoid condensation, or to evaporate existing condensate back into the gas. A number of
difficulties are present. The concentration of the low-volatile components is extremely small
and so is the expected rate of condensation. Furthermore, the conditions over a year change
significantly. 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 drop
makes water condensation more critical. The challenge is to predict the condensation process
accurately for these conditions.
1.2
Objectives and assumptions
Experimental data from existing pipelines on the subject of condensation are sparse. Some
important variables, like axial temperature and pressure profiles are well known. Measuring
7
the amount and composition of condensate is possible but time consuming. The amount
of condensate can be extremely small and difficult to detect. Accurate methods to predict
condensation 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 to
predict 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 is
not considered.
• The inlet pressure is 90 bars. Axial pressure profiles are known from measurements or
are 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 in
summer.
• The volume flow through the pipe lies between 1 and 3 million m3 /hr at standard
conditions (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 are
thin and the condensate is assumed perfectly mixed
The assumptions are set up to reflect a realistic long distance natural gas pipeline. Some
simplifications are taken here and more will be taken in the rest of this study. The main goal
is to set up a functioning model with these assumptions. Later on, other effects should be
added 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 gas
pipeline. The assumption is made that condensation occurs only on the pipe wall in a purely
filmwise manner.
To model film condensation, the film theory can be used. This is a diffusion based mass transfer model that regards condensation as the diffusion of a vapour through a non-condensable
gas. Although its derivation is based on a binary mixture of a condensable vapour and a
arbitrary number of non-condensable gases, it can be applied to a multicomponent mixture
with multiple condensable gasses as well. The derivation is given in chapter 3, leading to the
main equation with which mass transfer can be modelled.
8
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 boundary. 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 are
useful in situations where thermodynamic equilibrium can be assumed between a liquid and
gas phase.
Radial and axial temperature profiles are discussed in chapter 5. It will be shown that at the
given conditions, the temperature difference between bulk gas and wall is small, given that
the condensate film is very thin.
Where the film model provides an equation with which mass transfer can be modelled, its assumption of a binary mixture of condensable and noncondensable gases can not be applied as
such to a natural gas at high pressure. In these conditions, even low volatile components like
methane can solve to a certain degree in the condensate and can not be considered completely
noncondensable. Phase equilibria are useful in static situations, but are not sufficient to describe situations where there is no thermodynamic equilibrium, as is the case with a bulk gas
flowing 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 condensate
and bulk gas is modelled using film theory, but the condensation itself is calculated in a small
control volume on the pipe wall, where flash calculations using phase equilibria theory are
applied 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. Chapter 7 gives the results of the numerical simulations. First, results are given for the typical use
of a pipeline with a 30 component natural gas at conditions of inlet temperature, pressure, etc
that are constant in time. This is compared to results that would be obtained if the standard
two-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 seasonal
ambient temperature. The condensation rate of individual components is discussed.
Finally, chapter 8 summarizes the results. Uncertainties due to restrictions of the model are
discussed. Recommendations for further development of the model is given, together with
possible parameter studies.
9
Chapter 2
Phenomena of condensation
In this chapter phenomena of condensation are discussed that are relevant to pipelines. Condensation of gases in a pipe can principally occur in two ways: condensation on the wall and
fog 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 continuous
film it is called film condensation. The condensate film can be quiescent, or be in laminar
or turbulent flow. Instead of a film the condensate can also exist in the form of droplets, as
shown in fig 4.2. This type of condensation is called drop condensation. Whether film or drop
condensation 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 in
Figure 2.1. The interfacial tensions at the edge of a droplet are shown, σSW is the tension of
the 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]
σW G − σW L = σLG cos β0
(2.1)
Finite values of this contact angle imply incomplete wetting and droplet formation. If on the
other hand β = 0 the droplet will spread out over the entire surface and form a continuous
film. To determine the contact angle for, at least the the composition of the liquid and the
wall have to be known.
If the gas has components that are immiscible in the liquid phase, a combination of both
types 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 occurrence
of fog formation is the rate of supersaturation in the gas. By definition it is the ratio of partial
to saturation pressure
S=
pi
psat,i
10
(2.2)
σ LG
β0
σ SG
σ WL
Figure 2.1: Interfacial tension at a condensate droplet’s edge. The indices W, L, G denote
the wall, liquid and gas, the contact angle is β0
If there are sufficient alien particles in the gas, low degrees of supersaturation suffice for
condensation to occur on those particles, leading to heterogenic nucleation, minimum needed
values of 1.02 are often given. Much higher values of the supersaturation are needed for homogeneous nucleation, when no, or few particles are present, usually a range of about 5 to 10
is given [9]. The rate of supersaturation is dependent on the speed at which temperature and
pressure drops. As we will see later on, axial pipeline profiles show very slow temperature
and pressure drops. Among others, Brouwers [2] and Schaber [17] investigated the possibility
of fog formation in the film flowing over a condensate layer. During condensation towards a
liquid film, a velocity is induced. Gas flowing towards the film can be cooled quickly, leading
to fog formation. A criterion is that temperature difference between wall and gas is relatively
high. 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 the
occurrence of either type of wall condensation can not be made yet. Due to too many
uncertainties, in the modelling of the fog formation (e.g. number of particles), the assumption
is made that condensation occurs in a purely filmwise manner.
11
Chapter 3
Film theory
When filmwise condensation occurs in a pipe, molecules of the condensing component are
transported from the bulk gas to the wall. The rate of condensation is limited by the diffusive
mass transfer through the bulk gas. Multiple approaches are possible to model this mass
transfer. The general approach is solving the coupled concentration, momentum and energy
equations for multiple components. For simple geometries like pipes, theories that are based
on a dimensional analysis, using experimentally validated characteristic numbers, provide
an accurate alternative. Examples of these are are film theory, boundary layer theory and
penetration and surface renewal theory [1]. All of these assume the mass transfer to take place
in a small film lying on the surface to which is diffused to. In the film theory the concentration
of 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 axial
variation in the pipe of temperature and pressure and consequently density and velocity are
very small. This is shown in chapter 5 where typical measured axial pressure and temperature
profiles of the pipe are given , together with calculated axial velocity profiles. Variations in
time 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 the
mass transfer. In this chapter, the assumptions and derivations of the film theory will be
given.
3.1
Physical model
In the following derivations, a local cartesian coordinate system is used, where x denotes axial
coordinate in the pipe, and y is the coordinate perpendicular to the wall. The coordinate
system is located on the phase boundary, i.e. y = 0 corresponds with the condensate film
surface.
y
6
x
The derivations are made for a steady state, one-dimensional process. The assumptions for
the film theory are [6]:
• The profiles for pressure, velocity and temperature are only dependent on the y-coordinate
and become constant at their respective boundary layer thicknesses.
12
• 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 are
neglected
3.2
3.2.1
Derivations
Mass transfer
In the film model, boundary layers near the surface for velocity temperature and mass transfer
are defined. The resistance against heat and mass transfer for the condensation process is
dominant 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 condensable
vapours (index v). The derivation starts with the three-dimensional “full Fickian diffusion
equation”, as is derived in appendix A as (A.9), with no chemical reactions, assuming a
constant diffusion coefficient, written in mass fractions ci :
µ
¶
µ 2
¶
∂ci
∂ci
∂ci
∂ci
∂ ci ∂ 2 ci ∂ 2 ci
ρ
+u
+v
+w
= ρD
(3.1)
+
+ 2
∂t
∂x
∂y
∂z
∂x2
∂y 2
∂ z
Neglecting the time dependent term and assuming the variations to be small in the axial and
tangential directions gives:
ρv
∂ci
∂ 2 ci
= ρD 2
∂y
∂y
(3.2)
The bulk velocity v is a convective flow, induced by the diffusion of vapour through the total
mixture. An expression for this velocity is now derived.
For every component, a steady state mass balance can be written in the y direction, giving
for vapour and inert components respectively:
∂(ρn vn )
=0
∂y
∂(ρv vv )
= 0,
∂y
(3.3)
Since no inert gases disappear at the phase boundary due to condensation, it holds that
vn (y = 0) = 0. Applying to (3.3) and integrating gives vn (y) = 0, meaning that the inert
gases do not move in y direction. Inserting this in the general expression for the bulk velocity
gives:
n
v=
1
1
1X
ρi vi = (ρv vv + ρn vn ) = (ρv vv ) = cv vv
ρ
ρ
ρ
(3.4)
i=1
Fick’s first law states that diffusive molar flux is equal to its mass density gradient multiplied
with the diffusion constant. In appendix A, it is shown that for a constant ρ mixture, the
equation can be written in mass fraction c too. Another definition of diffusive mass flux is
the velocity of a component, relative to its bulk velocity, see (A.6). Combining for the vapour
gives:
13
ρ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 diffusion
of vapour:
v=−
1
∂cv
D
1 − cv ∂y
(3.6)
This is often called “Stefan flow”. Substitution of (3.6) in (3.2) gives the diffusion equations
from which the radial profile of cv can be found:
ρD
∂ 2 ln(1 − cv )
=0
∂y 2
(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 )e
y
δ
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 total
mass density:
¯
1
∂cv ¯¯
ṁ = −ρv(y = 0) = ρD
(3.10)
1 − cv ∂y ¯y=0
Taking the first spatial derivative of (3.9) with respect to y, setting y = 0 and substituting in
(3.10) gives:
µ
¶
1 − cv,∞
D
ṁ = −ρ ln
(3.11)
δ
1 − cv,0
This expression for the mass transfer in a film is the original result of Stefan (1873). The
fraction D/δ is commonly replaced with β and is called the mass transfer coefficient, with
unit [m/s].
3.2.2
Selection of variables
The above derived equation for the mass transfer in the film model can be made for different
variables: mass density ρ [kg/m3 ], molar density ρ̃ [kmol/m3 ], mass fractions c [kg/kg] and
molar fractions ỹ [kmol/kmol]. For the last two, the implicit assumption is made that the ratio
of mass density to molecular weight is constant in the flow. The validity of this assumption
will be derived here. Consider the Navier-Stokes equation for an incompressible inviscid flow:
∂~v
~ v = −∇p
~ + ~g
+ (~v · ∇)~
(3.12)
∂t
Neglecting gravity and the derivative with respect to time and selecting the y-direction gives:
ρu
∂v
∂v
∂p
+ ρv
=−
∂x
∂y
∂y
14
(3.13)
In the film model the so-called boundary layer approximation is taken, velocity variations
∂v
in axial x-direction are assumed negligible: ∂u
∂x = 0 and ∂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 = 0. Then it follows from (3.13) that the pressure is constant in the
∇
∂y
y-direction:
∂p
∂y
= 0. The general form of the equation of state for gases gives:
ρ
p
=
(3.14)
M
ZRT
The compressibility factor Z is only dependent on temperature and pressure. If the tempera1
ture variations in y-direction are small and ∂Z
∂T is small , Z does not vary in y-direction either.
It follows that ρ/M is constant. As molar fraction and partial density are related with:
¶
µ
M
ỹi =
(3.15)
ρi
ρMi
it follows that the mass transfer equations in terms of mass density ρi can be rewritten in
terms of molar fraction ỹi without the production of additional terms.
The mass transfer equation (3.11) in terms of molar fractions thus becomes:
µ
¶
1 − ỹv,∞
ṅ = −ρ̃β ln
1 − ỹv,0
3.2.3
(3.16)
Correction factor for mass transport
The general film model mass transfer equation (3.11) can be simplified by linearization2 :
ṁ = ρ
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 if
v = 0 is substituted in (3.2) and applying boundary conditions (3.8), which produces the
same result. Comparing (3.11) with (3.17) and taking the ratio between the mass flow with
and without induced flow gives the Stefan correction factor :
Θm =
−φm
−1
e−φm
with φm =
ṁδ
ρD
(3.18)
It is important to note that ṁ is calculated with the uncorrected mass transfer expression
(3.11). Baehr [1] gives for the correction factor:
Θm =
φm
−1
eφm
with φm =
ṅ
cβ
(3.19)
It easy to see that it is equal to (3.18) because Baehr defines the mass transfer as negative
for condensation ṅ = −ṁ/ρ and the definition of the mass transfer coefficient is:
1
For a temperature and pressure range of 30–120 bars and 250–350 K, ∂Z
has typical values of 0–0.0045
∂T
for pure methane, as shown in figure 4.2
³
´
c
−cv,∞
c
−cv,∞
2
in (3.17) the first order Taylor approximation of (3.11) is used: ln v,0
+
1
∼ v,0
, valid if
1−cv,0
1−cv,0
cv,0 −cv,∞
1−cv,0
≈0
15
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:
β=
ṁ = ρβ(cv,∞ − cv,0 )
(3.21)
The resulting Stefan correction factor now becomes:
Θm =
−φm
1
−φ
1 − cv,0 e m − 1
with φm =
ṁδ
ρD
(3.22)
The question arises why the the correction factor for mass transfer is introduced in the
first place. The first argument is historical, as the logarithmic expression of (3.11) was
considered time-consuming to calculate. The second argument is qualitative as the mass
transfer 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 transfer
coefficient. 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 is
attractive, because it provides an analogy between heat and mass transfer. Nevertheless, if
the 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 correction 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]:
ṁcp,v
φT
with φT =
(3.24)
−1
α
This is called the Ackermann correction factor. By definition it is the ratio of the heat flux
with induced velocity and the heat flux without. Note that, again the mass transfer ṁ is
calculated with (3.11).
ΘT =
3.2.5
eφT
Heat and mass transfer coefficients
It is not possible to use (3.11) directly to calculate mass transfer rates, as the boundary layer
thickness δm is unknown. A mass transfer coefficient has to be calculated, for which the
Sherwood number has to be known:
ShD
d
The following equation for Nusselt and Sherwood numbers for turbulent flow in circular pipes
is used, Gnielinski [8], recommended by [1]:
β=
16
"
µ ¶2/3 #
(ζ/8)(Re − 1000)P r
d
p
Nu =
1+
2/3
L
1 + 12.7 ζ/8(P r − 1)
"
µ ¶2/3 #
(ζ/8)(Re − 1000)Sc
d
p
Sh =
1+
2/3
L
1 + 12.7 ζ/8(Sc − 1)
(3.25)
(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 ≤ P r ≤ 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. A
perfectly smooth pipe is assumed, as the resistance factor ζ does not depend on the friction
factor of the pipe wall.
17
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 pure
component. Figure 4.1 shows a typical (p,T) phase diagram for a natural gas at fixed composition.
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 constant
pressure from point E to D, the dew line is reached at point X and the two phase region is
18
entered. Lowering the temperature further from the dew point will not cause the mixture to
condense completely, but in increasing amounts of liquid up to 100% when the bubble point
is 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 are
present. 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 dew
line on point Z. Interestingly, a maximum of liquid fraction is reached at point R. Increasing
pressure further will cause the liquid to vaporize again until at the dew line at point W, only
pure gas is present. This phenomenon is known as “retrograde condensation”. It is typical for
natural gases at high pressures. Summarizing, two main differences appear when comparing
the 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 a
pure component, this is only possible on the saturation line for a fixed set of pressuretemperature combinations.
• For a multicomponent mixture at high pressure it is possible to enter and leave the two
phase region at a constant temperature by changing the pressure only.
Whether condensation will occur in a natural gas is therefore dependent on whether the dew
line 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 the
condensation process. In chapter 7, dew lines are shown in a phase diagram that is constructed
for 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
pṽ = ZRT
(4.1)
where ṽ is the molar volume, Z is the compressibility factor and R is the universal gas constant. 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 low
temperatures 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 science
in its own right, as they can be used to qualitatively an quantitatively describe many thermodynamical and chemical variables. Thermodynamic quantities as compressibility factor,
Joule-Thompson coefficient as well as phase equilibria can be determined with equations of
state. A good summary of the possible equations is given by Wei and Sadus [19]. In the following, the assumption is made that the equation of Peng-Robinson is accurate at describing
natural gases. In a pressure formulation the equation is written as
P =
RT
aα
−
ṽ − b ṽ(ṽ + b) + b(ṽ − b)
where the parameters a and b are given by
19
(4.2)
a = 0.45724
R2 Tc2
[1 + S(1 − Tr0.5 )]2 ,
pc
b = 0.07780
RTc
,
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 compressibility
factor
Z 3 + f1 (a, b)Z 2 + 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 shows
why this is called a cubic equation of state. Other cubic equations of state are the van der
Waals and Soave-Redlich-Kwong equation. Interestingly, even if for a pure component, these
equations can demonstrate two phase behaviour. If (4.4) is solved for Z at fixed pressure
and temperature three solutions are possible. For a thermodynamically supercritical temperature, 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 liquid
phases in thermodynamic equilibrium, the maximum value of Z will correspond to the vapour
phase and the minimum to the liquid phase. Cubic equations of state are therefore capable
of predicting the density of both liquid and gas phases.
In Figure 4.2, values for the compressibility factor as calculated with Peng-Robinson for pure
methane are given in a temperature and pressure range, typical for natural gas pipelines. The
derivative 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, temperature
and chemical potential in the phases:
p = pL = pV
T
L
= T =T
µi =
µL
i
=
V
µVi
(4.5)
(4.6)
(4.7)
An equivalent of the equality of chemical potential is the equality of fugacity in both phases
fiL = fiV
(4.8)
Equations of state can be used to calculate phase equilibria. To understand how many
independent properties are needed to do so, consider the following. Gibbs’ phase rule predicts
the 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 of
components. In the case of a two-phase, pure component system, there is one degree of freedom and setting one intensive property (for example temperature or pressure) fixes all other
20
0.95
0.9
Z [−]
0.85
0.8
p=30 bar
p=60 bar
p=90 bar
p=120 bar
0.75
0.7
250
260
270
280
290
300
T [K]
310
320
330
340
350
260
270
280
290
300
T [K]
310
320
330
340
350
−3
5
x 10
dZ/dT [K−1]
4
3
2
1
0
250
Figure 4.2: Temperature dependent Z and ∂Z/∂T , with the Peng-Robinson equation of state
for 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 intensive
property like pressure or temperature leaves N − 1 properties to be chosen. These can be all
the molar fractions in a single phase1 . Fixing the composition of one phase, and fixing one
intensive 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 and
variables to be found are summarized in the table below, together with the name the problem
is commonly given.
Known variables
p, x̃
p, ỹ
T , x̃
T , ỹ
p, T , z̃
Variables to be found
T , ỹ
T , x̃
p,ỹ
p,x̃
x̃,ỹ, Lf
Name
Bubble point T
Dew-Point T
Bubble-Point p
Dew-Point p
flash
As will be discussed, the combination of interest is the flash problem2 . Here the temperature,
P
P
This requires choosing only N − 1 molar fractions, since
ỹi = 1, and
x̃i = 1
2
The validity of the phase rule for the flash problem is explained in reversed order. If N − 1 z̃i ’s are fixed
in the N equations of (4.10),the number of unknowns is N − 1 for ỹi , N − 1 for x̃i , and 1 for Vf , giving 2N − 1
unknowns. This makes the system under specified with degree N − 1. Since only N − 1 z̃i ’s have to be fixed
1
21
pressure and overal molar fraction z̃ are known and the molar fractions of liquid and vapour
phase are to be found as well as the molar liquid fraction Lf (unit [kmol/kmol]). The relation
between x̃, ỹ, z̃ and Lf is per component:
z̃i = Lf x̃i + (1 − Lf )ỹi
(4.10)
The first 4 methods, given in the table are mainly useful in constructing phase diagrams for
multicomponent 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 condensation
will occur. Solving the flash problem has a more practical purpose. For an input feed of total
composition z̃i , not only the composition z̃i 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 molar
fraction has to be known. The fugacity factor Φi relates molar fraction of liquid and molar
phases to the fugacities in both phases,
ΦVi =
fiV
ỹi p
ΦL
i =
fiL
x̃i p
(4.11)
so that the iso-fugacity condition of (4.8) gives for the ratio of molar liquid to gas fraction
yi
ΦL
= Vi
xi
Φi
(4.12)
Equations of state provide expressions for the fugacity factors, see appendix B for the full
expression for Peng-Robinson. With the combination of (4.10)with (4.12), flash algorithms
can 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 and
pressure
22
Chapter 5
Inner pipe wall temperature
5.1
Introduction
As explained in chapter 3, the driving force for condensation or evaporation in the film model
is the concentration gradient between bulk gas and the gas at the interface. For this, the
gas-side molar fractions of the condensate layer is needed. In chapter 6, a model will be
presented that calculates this gradient using phase equilibrium theory. The temperature at
the phase boundary is an important input variable. In this chapter it will be discussed how
this temperature can be calculated. In a first approach, the interface temperature can be set
equal to the inner pipe wall temperature, as condensate film thicknesses are generally very
small, and its heat resistance can often be neglected. Measurements of an axial temperature
and pressure profile in the pipe is available, see Figure 5.1. In this chapter, local inner
pipe wall temperature will be calculated using these profiles. The goal is to evaluate if the
wall temperature differs much from the known bulk gas temperature, so that it should be
considered in the modelling of the condensation.
5.2
Governing equations
The following conservation laws will be used in the following.
Continuity equation:
∂ρ ~
+ ∇ · (ρ~v ) = 0
∂t
(5.1)
Energy equation in enthalpy [5]:
ρ
∂h
~ = ∂p + ~v · ∇p
~ +
+ ρ~v · ∇h
∂t
∂t
~ v)
τ : (∇~
| {z }
viscid dissipation
5.2.1
~ · ~q − ∇
~ · ~jq + ρ ~n · ~g
+∇
| {z }
| {z R}
| {z }
radiation
conduction
(5.2)
gravity
Conductive heat loss
An expression is sought for the heat loss due to conduction through the pipe wall over every
point along the pipe length, using the p, T profiles of Figure 5.1. First consider the energy
equation (5.2). When written in a cylindrical coordinate system, the radial velocity vr is
zero, which is correct for very small condensation rates. Due to axial symmetry, the angular
23
90
85
p [bar]
80
75
70
65
60
0
50
100
150
200
pipe length [km]
250
300
350
0
50
100
150
200
pipe length [km]
250
300
350
30
T [K]
25
20
15
10
5
Figure 5.1: measured axial pressure and temperature profile in the bulk gas over the pipeline
length
velocity vθ is set zero as well. The situation is considered in steady-state, which eliminates
the time term on the left hand side. On the right hand side, there are 4 possible heat loss
effects for the general case. At the highly turbulent conditions, viscid dissipation can be
significant, 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. Radiation
can be fully neglected at the low temperatures of the pipe and its surroundings. The gravity
term is not considered as the measurements are for a purely horizontal pipe. The only term
that is considered is therefore heat loss trough conduction. Axial conduction can be neglected
compared to axial convection. This leads to the following energy balance:
∂h
∂p 1 ∂(rqr )
= vz
−
∂z
∂z r ∂r
First, the following cross-sectional averages are introduced:
ρvz
u=
4
πd2p
Z
2π
0
4
h=
πd2p
Z
Z
d/2
0
2π
vz (r) r dφ dr,
Z
ρ=
d/2
h(r) r dφ dr,
0
0
4
πd2p
Z
(5.3)
2π
Z
d/2
ρ(r) r dφ dr,
0
4
T =
πd2p
Z
0
2π
Z
d/2
T (r) r dφ dr
0
(5.4)
0
Here, u is the averaged axial velocity, ρ is the averaged mass density, h the averaged enthalpy
and T the averaged temperature. Pressure needs not to be averaged, as it can be shown with
24
the Navier-Stokes equation that it is constant in radial direction, see section 3.2.2. Now both
sides of (5.3) can be easily integrated over the cross-sectional area to obtain:
πd2
∂h
πd2 ∂p
ρu
=
u
− π d qr |r=d/2
4
∂z
4 ∂z
Gas enthalpy is defined as ∂h = cp ∂T , the zero value is taken at h(T = 0K) = 0.
the energy equation can be rewritten in terms of temperature, density and pressure
Rearranging (5.5) gives the following expression for the heat loss trough the pipe wall:
µ
¶
d
∂p
∂T
qr (z) = u(z)
− ρ cp
4
∂z
∂z
(5.5)
Now
only.
(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 Nusselt
equation. The Gnielinski equation (3.25) is used. The inner pipe wall temperature is thus
found 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 Nusselt
number. Therefore, an expression for the axial velocity is needed. This is obtained with the
continuity equation (5.1). Neglecting the time term and radial and tangential velocities vr
and vθ , it reads:
∂ρ
∂vz
+ vz
=0
(5.9)
∂z
∂z
Again, this is integrated over the cross-sectional pipe area and written with the definitions of
(5.4) to obtain:
ρ
∂u
∂ρ
+u
=0
∂z
∂z
With the boundary condition u(z = 0) = u0 this gives for the axial velocity profile:
ρ
u(z) = u0 e
− ρ1 ∂ρ
z
∂z
(5.10)
(5.11)
The last unknown is appropriate inlet velocities u0 . Typical volumetric flow rates of the pipe
are 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 flow
rates ṁ = V̇ ρ are present. This implies,
³ ´
³ ´
V̇ ρ
= V̇ ρ
(5.12)
p,T
pstd ,Tstd
25
πd2
ρ = V̇std ρstd
4 0
The inlet velocity can thus be calculated with:
u0
u0 = V̇std
5.2.3
(5.13)
4 ρstd
πd2 ρ0
(5.14)
Density and property data
Mass density and its axial gradient are needed in (5.5) and (5.11). The density is calculated
with the Peng-Robinson equation of state. As pure methane is considered, the temperature
is always well above its critical value of 190.6 K and finding the roots of the compressibility
factor is straightforward. The real gas factor is discussed in chapter 4. As the natural
gas is extremely high in methane content, all the physical data as heat capacity, thermal
conductivity, dynamic and static viscosity were taken for pure methane. The used correlations
for the heat capacity and the viscosity are given in appendix D.
5.3
Results
For volume flows at standard conditions ranging from 1.0 · 106 m3 /hr to 3.0 · 106 m3 /hr the
axial velocity profile is given in Figure 5.2. The (p, T ) profiles of Figure 5.1 were used.
14
Vst=1.0e6 m3/hr
Vst=1.5e6 m3/hr
Vst=2.0e6 m3/hr
Vst=2.5e6 m3/hr
Vst=3.0e6 m3/hr
12
u [m/s]
10
8
6
4
2
0
50
100
150
200
250
300
350
z [km]
Figure 5.2: Axial gas velocity for a set of volume flows at standard condition
26
The resulting axial temperature profile for the inner pipe wall is given in Figure 5.3, together
with the value in the bulk gas. The volume flow is 2.5 · 106 m3 /hr
305
bulk gas
wall
300
T [K]
295
290
285
280
0
50
100
150
200
250
300
350
z [km]
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 bulk
temperature goes under the wall temperature. This can only be explained with the JouleThompson effect. This effect causes real gases to cool down or warm up during an expansion
process at constant enthalpy. The definition of the Joule-Thompson coefficient is
¶
µ
∂T
µJT =
(5.15)
∂p H
The value of µJT is strongly dependent on temperature and pressure. For pure methane in
a temperature range of 200 to 700 K and a pressure range of 0 to 600 bar this coefficient is
always positive [3]. Natural gas with a high methane fraction is thus cooled during adiabatic
expansion in this p, T range. This is clarified in Figure 5.4, where the radial heat loss flux
is given separately for the pressure and the conduction term in (5.6). The conduction term
decreases over the pipe length but it is always positive. The pressure term is negative over
the whole range due to Joule Thompson expansion. At a certain point the sum of the two
terms becomes zero, causing the temperature difference between bulk and wall to change in
sign.
27
80
pressure term
conduction term
total
60
qr [W/m2]
40
20
0
−20
−40
0
50
100
150
200
250
z [km]
Figure 5.4: Radial heat loss flux over pipe length
28
300
350
Chapter 6
Combination model
In this chapter, a model will be proposed that combines the film theory with phase equilibria
theory to obtain a method that is able to calculate condensation rates for a multicomponent
mixture at high pressure.
6.1
Introduction
As shown in chapter 3, to predict mass flow with the film model, concentrations (or equivalently molar fractions) of each component have to be known in both the bulk gas as on
the gas-side of the phase boundary between gas and condensate. The axial concentration in
the bulk gas is relatively easy to calculate if locally the mass transfer flow is known. The
challenge is to predict the concentrations on the phase boundary. If there would be a theory
that would be able to predict these concentrations perfectly, the condensation rate that the
film model predicts are accurate. For simple mixtures at standard pressure and temperature
conditions, this is trivial. Take for example the case of an air-water vapour mixture flowing
trough 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 gas
phase. 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
ỹv =
psat (T )
p
(6.1)
As indicated, the saturation pressure is only a function of temperature and an empirical
equation like Antoine can be used.
For multicomponent mixtures with multiple condensable components, the molar fractions in
a saturated gas mixture do not only depend on temperature and pressure, but also on the
composition of the liquid phase. At low pressures, Raoult’s law gives a relation between molar
fraction in gas and in liquid per component,
ỹi = γi x̃
psat (T )
p
(6.2)
where γi is the activity coefficient. At high pressures, the real gas behaviour must be accounted
for in the equilibrium of the vapour-liquid mixture. Not only does the gas molar fraction
29
depend on the liquid molar fractions, it is also strongly dependent on pressure. As shown
in chapter 4, the condition of iso-fugacity in the phases leads to an expression in fugacity
factors:
ỹi = x̃i
Φ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 under
study. To predict the concentrations ỹ on the gas-side of the phase boundary with these
expressions, the composition of the condensate x̃ has to be known. If there are no measurement 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 where
phase 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 temperature
and pressure, and additionally choose the composition of one phase. If temperature and
pressure are known, only a set of combinations of both phases will be possible. The simple
relation 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. The
pipe’s cross section is divided in a large control volume lying in the center of the pipe representing the bulk gas, and a small control volume on the pipe wall wherein the condensate
in the form of a film is located, see Figure 6.1. To model the diffusive mass transfer between
the volumes the film theory is applied. The amount and composition however is calculated
with flash calculations. As the model will be implemented in Aspen Dynamics later on, some
balancing 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 composition
as in the bulk
• Condensation occurs purely filmwise. Film thickness is thin and covers the wall uniformly in a pipe increment
In the following, equations that relate to the control volume on the pipe wall will have index
cv, 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 ỹi,∞ , the mass per component is
30
~y
i ,∞
Control volume
bulk
n& i
Molar mass
transport
~y
i,0
~
x
Control volume
wall
Condensate film f
i,0
j −1
j
Figure 6.1: control volumes for the combined model
M̃i = ỹ∞,i M̃
When the molar transport between the two volumes is given by ṅi , the mass conservation for
this volume is
∂ M̃i
(ρ̃i u)
+ dV
− ṅi π dp dx
(6.4)
∂t
∂x
where u is the cross-sectional averaged bulk velocity. Note that ṅi is defined negative for
condensation 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 control
volume is simply
∂ M̃cv,i
= ṅi π dp dx
(6.5)
∂t
As mass flows in or out of the control volume, the composition changes in time. The overal
molar fraction z̃cv,i in the control volume at any time is given by:
z̃cv,i = M̃cv,i /
n
X
M̃cv,i
(6.6)
i=1
Pressure is constant radially and the value of the bulk gas is taken. Since it is assumed that
the film thicknesses are thin, the condensate surface temperature is set equal to the inner wall
temperature. It is found with the expression derived in chapter 5,
31
TW
d
= TG − u
4
µ
∂p
∂T
− ρ cp
∂z
∂z
¶
/α
with
α = f (N u)
(6.7)
The most important part of the model is the manner in which phase equilibria are coupled
with 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. The
method proposed here is to perform flash calculations on the control volume at the wall. At
t = 0 the control volume is filled with the bulk gas everywhere along the pipe length. A flash
is then applied to the gas with composition z̃cv at the local temperature and pressure
(ỹcv,i , ỹcv,i , Lf ) = flash(z̃cv , p, T )
(6.8)
giving the molar fractions ỹcv,i and x̃cv,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. The
film thickness at that point is found by
f = Lf
M̃cv
ρ̃L π dp dx
(6.9)
Inside this volume, there is equilibrium between gas and liquid phases. Where no condensate
is present, the liquid and vapour molar fractions are equal to the bulk gas molar fraction, so
that no concentration gradient appears: ỹ∞,i − ỹcv,i = 0. If condensate is present however, the
vapour 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. At
the next time step, again a flash is applied to the control volume. Due to the higher overal
concentration of heavy components, the liquid fraction increases, resulting in growth of the
film thickness.
It should be mentioned that the wall control volume is a virtual volume. It does not occupy
space, nor is the mass that is present at t = 0 subtracted from the total mass inside a pipe
increment. Its only purpose is to provide a space where the condensation that occurs can be
calculated 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 the
wall, and therefore the condensation rate, is diffusion controlled and is modelled with film
theory. The original derivation is done for a binary mixture. Where the original equation was
derived for a mixture with one condensable component, small adaptations can be made to
apply it to a multicomponent mixture. The form of (3.11) can be written for n components,
µ
¶
1 − ỹi,∞
ṅi = ρ̃βi ln
(6.10)
1 − ỹi,0
The mass transfer coefficients βi are then obtained from n Sherwood relations of the form
(3.26) with:
βi =
Shi Di,m
dp
32
(6.11)
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 adaptation enables to use diffusion coefficients that are defined for binary mixtures for multicomponent systems. Its definition is [13]:
Di,m = (1 − ỹi )/
n
X
j=1,i6=j
ỹj
Di,j
(6.13)
The derivation of the effective diffusion coefficient assumes that when one component diffuses
trough the mixture, the others are at rest.
M̃i = Lf x̃ M̃tot + (1 − Lf ) ỹ M̃tot
33
(6.14)
Chapter 7
Numerical results
In this chapter, the numerical results are given that are obtained with the implementation of
the 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 in
Figure 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 · 106 m3 /hr.
The heat transfer coefficient between the bulk gas and the ambient soil temperature is set at a
constant value of 4.1W/mK in all simulations, as it has been proven in industrial practice that
this 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 the
soil temperature. This is due to the Joule-Thompson effect as mentioned in chapter 5. It
not shown here, but it is also the location where the difference between bulk gas and wall
temperature change in sign, from that point on, the wall is colder than the bulk gas. The
simulations that follow all give the same (p,T) profiles. Running the program with and without
the condensation model did not change the results significantly, which can be explained by
the small rate of condensation, which will be shown later on. As can be seen, the pressure
profile 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 crossing
the dew line from a pure gas phase into the two-phase region is the criterion on whether or not
condensation occurs. Dew lines for the gas under study are given in Figure 7.2. As indicated
in appendix C, the concentration of the low volatile component is not exactly known. The
dew lines are given for a molar fraction of 5.5 · 10−7 and 5 · 10−6 . As can be seen, the addition
of a few ppm of this component drastically changes the form of the phase diagram. On the
phase diagram, the pressure and temperature combinations of the axial profiles of Figure 7.1
are drawn over the dew lines. For both gas compositions, the (p,T) profiles cross the dew
lines. For the gas composition with the lower concentration of the low volatile component, the
line is crossed somewhere along the pipe, the location being further downstream as the inlet
34
100
T =304 K
in
T =312 K
in
T =333 K
pressure [bar]
90
in
80
70
60
50
0
50
100
150
200
pipe length [km]
250
300
350
340
T =304 K
in
T =312 K
in
Tin=333 K
Temperature [K]
330
320
310
300
290
280
270
0
50
100
150
200
pipe length [km]
250
300
350
Figure 7.1: Axial temperature and pressure profile for a set of inlet temperatures. The soil
temperature is 275 K
temperature is higher. For the other gas composition, the start of condensation is further
upstream.
140
molar fraction LVC=5.5e−7
molar fraction LVC=5e−6
120
pressure [bar]
100
Tin=312 K
Tin=322 K
Tin=333 K
80
60
40
20
0
270
280
290
300
310
Temperature [K]
320
330
340
350
Figure 7.2: Dew lines of the natural gas for two gas compositions, calculated with the PengRobinson equation of state in Aspen Plus. The axial (p,T) profiles of Figure 7.1 are added.
35
7.3
Flash calculation
As no experimental data are available, first the results of a standard calculation method are
shown. Multiphase programs often provide some means of calculating the liquid fraction in
a pipe. Aspen Dynamics provides a two-phase calculation where molar liquid and vapour
fraction can be calculated. It is important to note that in this calculation, the assumption
is made that the condensate flows at the same speed as the bulk gas. Since there is no
velocity difference between the two phases, thermodynamic equilibrium can be assumed inside
a volume element flowing trough the pipe. This implies that the composition and liquid
fraction are only dependent on the pressure and temperature that are locally present. A
flash calculation can be applied to the volume of a pipe increment to obtain composition of
liquid and gas phases, and the vapour and liquid fraction. In Figure 7.3, results for these
calculations are given.
5
Tin=304 K
Tin=312 K
Tin=333 K
4.5
4
film thickness [µm]
3.5
3
2.5
2
1.5
1
0.5
0
0
50
100
150
200
pipe length [km]
250
300
350
Figure 7.3: film thickness over pipe length with flash calculation. The molar fraction of the
low volatile component is 5.5 · 10−7
The parameter used used here to indicate the amount of condensate is film thickness, which
is 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 mass
density, dp the pipe diameter and dx the length of a pipe increment. The film thicknesses
thus obtained are extremely small, being in the order of few µm. Up to 220 km, only a small
liquid fraction is found, due to the deposit of components that have a high dew point. Only
further downstream, the dew point of other components is reached that condense in larger
quantities. The maximum of the film thickness is reached at the end of the pipe, where the
pressure and temperature combination is such that the mixture is at the maximum liquid
fraction in the two phase region. As it shows, the inlet temperature does not have an effect
36
on the location of the film thickness maximum, but only on the amount of condensate. When
comparing Figure 7.3 to 7.2, one would expect the condensation to start further downstream
for higher inlet temperatures. This can be observed. At about 50 km, the condensation starts
for the lowest inlet temperature. For the lower temperatures, condensation does start more
downstream, 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 a
time of 107 hours. The inlet temperature is 312 K, the soil temperature is 275 K and the molar
fraction 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 and
composition 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 as
the bulk gas. The line at t=1 hour lies closely to this start value and shows a profile that is
typical for the result obtained with a flash procedure only, like in Figure 7.3: the maximum of
film thickness lies towards the end of the pipeline. For longer running times, the effect of the
diffusive mass transfer is visible. The condensation of the first components starts at about 50
km, meaning that the dew point is locally reached. This location is in agreement with Figure
7.3. Downstream from that point, those components leave the bulk gas, resulting in a lower
concentration in the bulk gas. The concentration gradient between bulk and wall decreases,
resulting in decreasing film thicknesses downstream. Further downstream, at a 100 km, the
same is observed for the components with a lower dew point. It can be seen that a maximum
of the film is reached at about 150 km.
80
t=1 hr
t=50 hrs
t=80 hrs
t=107 hrs
Inlet temperature= 312 K
molar fraction low volatile
component (LVC), inlet = 1e−6
Soil temperature = 275 K
70
film thickness [µm]
60
50
40
30
20
10
0
0
50
100
150
200
pipe length [km]
250
300
350
Figure 7.4: Growth of film thickness in time with the combined model
37
7.5
Film thickness growth rate
As the interest of this study lies in the long term accumulation of condensate, the growth of
the film thickness in time is important. Although the simulation time in Figure 7.4 is only
107 hours, it proves that the rate of growth of the film thickness at a certain location in the
pipe is perfectly linear if the conditions for pressure, temperature and composition are set
constant, even if the simulation is run for months. In Figure 7.5 and 7.6, the film thickness
growth rate in the pipe is given for a winter and summer situation respectively. The unit
used is [mm/year]. The growth rate is considerable, locally reaching maxima of 4.5 mm
per year in summer and 6.5 mm per year in winter. The location of the maximum growth
rate is influenced by inlet temperature. Lower inlet temperatures influence the location of the
maximum of the growth rate, showing a more downstream location as the inlet temperature is
higher. The effect is very weak however. An influence on the maximum itself is not observed
at all.
7
6
T
film thickness growth rate [mm/year]
5
=275 K
Soil
4
3
2
Tin=312 K
Tin=322 K
T =333 K
1
in
0
−1
0
50
100
150
200
pipe length [km]
250
300
350
Figure 7.5: Film thickness growth rate in mm per year for 3 inlet temperatures. The soil
temperature 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 indication 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 formulation. In Figure 7.7 to 7.10, the rate of change of the condensed kmoles per meter is given
for 9 components of the natural gas. The used unit is kmol/(m year). All figures are for a
winter situation, with a soil temperature of 273 K. Figure 7.7 shows the rate of condensation
for a molar fraction of the low volatile component of 5.5 · 10−7 . It can be seen that the low
volatile component is the first to condense at 50 km. Its condensation rate then decreases,
38
5
TSoil=283 K
film thickness growth rate [mm/year]
4
3
Tin=312 K
Tin=322 K
Tin=333 K
2
1
0
−1
0
50
100
150
200
pipe length [km]
250
300
350
Figure 7.6: Film thickness growth rate in mm per year for 3 inlet temperatures. The soil
temperature is 283 K, representing summer. The molar fraction of the low volatile component
is 5.5 · 10−7
until the other components start to condense at 100 km. Clearly, tri-decane, tetra-decane
and penta-decane have the highest condensation rates. Both the more volatile components
decane, undecane and do-decane, and the less volatile components hexa-decane and C20 condense at a lower rate. The same conditions as in Figure 7.7 are taken in Figure 7.8, except
that the low volatile component is not added to the gas this time. The condensation rate
for the other components proves to be somewhat lower, and the maximum of condensation is
more 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 the
rate 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
0.025
C10
C11
C12
C13
C14
C15
C16
C20
LVC
rate of condensation per unit length [kmol/m year]
0.02
Inlet temperature= 312 K
Inlet pressure = 90 bars
molar fraction low volatile
component (LVC), inlet = 5.5e−7
Soil temperature = 275 K
0.015
0.01
0.005
0
−0.005
0
50
100
150
200
pipe length [km]
250
300
350
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.025
C10
C11
C12
C13
C14
C15
C16
C20
Inlet temperature= 312 K
Inlet pressure = 90 bars
molar fraction low volatile
component (LVC)=0
Soil temperature = 275 K
rate of condensation per unit length [kmol/m year]
0.02
0.015
0.01
0.005
0
−0.005
0
50
100
150
200
pipe length [km]
250
300
350
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
rate of condensation per unit length [kmol/m year]
0.025
C10
C11
C12
C13
C14
C15
C16
C20
LVC
0.02
Inlet temperature= 312 K
Inlet pressure = 90 bars
molar fraction low volatile
component (LVC), inlet = 1e−6
Soil temperature = 275 K
0.015
0.01
0.005
0
0
50
100
150
200
pipe length [km]
250
300
350
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.2
rate of condensation per unit length [kmol/m year]
Inlet temperature= 312 K
Inlet pressure = 90 bars
molar fraction low volatile
component (LVC), inlet = 5e−6
Soil temperature = 275 K
C10
C11
C12
C13
C14
C15
C16
C20
LVC
0.15
0.1
0.05
0
−0.05
0
50
100
150
200
pipe length [km]
250
300
350
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
Chapter 8
Conclusions and recommendations
8.1
Conclusions
The objective of this study, as posed in the introduction was to develop a model to predict
the condensation rate in time and place in the pipeline.
There are a number of possible condensation phenomena in a natural gas pipeline: fog formation and dropwise and filmwise wall condensation. The main criterion for the occurrence
of fog formation is the rate of supersaturation. Wall condensation occurs if the dew point of
the gas is reached at the temperature and pressure that are present at the pipe wall. The
criterium for whether dropwise or filmwise condensation occurs is determined by the contact
angle between condensate and pipe wall, which depends on the composition of the condensate. Due to too many uncertainties in the modelling of the fog formation, and the unknown
contact angles between wall and condensate the assumption is made that condensation occurs
in a purely filmwise manner.
Radial temperature profiles are investigated to calculate inner pipe wall temperatures based
on known axial (T,p) profiles. At the high gas velocities inside the pipe, high Nusselt numbers and heat transfer coefficient from bulk to pipe wall cause the difference between bulk
gas temperature and inner wall temperature to be very small, reaching maximum values of a
few Kelvin.
A model is proposed to predict filmwise wall condensation in the natural gas pipe in time
and 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 phase
equilibria theory. The proposed model is implemented in an existing pipe model of Aspen
Dynamics to predict the condensation behaviour of a 32 component Russian natural gas. The
following results are obtained:
The location of where the first condensate starts to deposit is in accordance with the location
as 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 (at
the used conditions for temperature, pressure etc) where condensate is present, but the film
thicknesses are very small. This region contains mainly the low volatile component. At the
42
end of the pipe the film thicknesses suddenly step to a high point, to reach maximum values
at the end of the pipe. Overal, the film thickness is in the order of a few µm. The combination
model does not show sudden changes in the film thickness profile. Due to accumulation of
condensate over time, large film thicknesses are obtained, also in the region where only the
low volatile component condenses. Maxima of the film thickness are observed more upstream
in the pipe.
For constant conditions of temperature, pressure, the growth rate of the film thickness proves
to be constant in time. The growth rate that is observed is considerable, ranging from maximum values of 4.5 to 6 mm/year, depending on soil temperature. Variation of the inlet
temperature does not prove a big influence on the location nor the value of the maximum
growth.
The condensation rate of individual components is examined. Indeed, the low volatile component reaches an early maximum along the length of the pipe. Other components start to
condense more downstream, all at the same location. It proves that the rate of condensation
of 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 /(m
year). The presence of the low volatile component in the gas increases the condensation rates
of 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 and
place. A number of assumptions was made to be able to set up a working model, with the
possibility of extending at a later stage. Some assumptions proved to be false when the numerical results presented in chapter 7 are examined. The condensation rates and film thickness
growth rate proved to be much higher than expected. This is mainly due to the condensation
of components, other than the low-volatile component. With the calculated local maxima of
film thickness of about 6 mm over the course of a year, an axi-symmetrical distribution of the
condensate can not be assumed anymore. At these quantities, axial transport of condensate
can become important, as well as the heat resistance of the condensate layer. A parameter
that was not considered at all was pipe inclination. If condensate layers would be thin, this
parameter 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 and
will decrease the effective pipe cross section area, causing considerable losses of pressure. It
is therefore recommended to include axial transport of condensate in future extensions of the
model 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 fog
formation is. As the composition of the condensate is calculated with the model, contact angle measurements are now possible to evaluate the occurrence of dropwise instead of filmwise
condensation.
Only a number of parameter studies was done with the proposed model. Possible extra
parameter studies are to investigate the effect of water content in the natural gas. As the low
43
volatile component is able to absorb large quantities of water, condensate containing the low
volatile component could grow additionally, even if the water concentration in the bulk gas
is minute.
A last point of concern is the chosen equation of state. As indicated, the calculated dew
point for a mixture at fixed composition depends on how accurate the equation of state
is. This largely depends on the fact if the binary interaction parameters of the equation
of state are experimentally tested for the specific natural gas. To give an indication, most
property calculation software like Aspen Properties does not have values for a number of
those parameters at all, for example for the interaction of the low volatile component with all
other relevant components. Research to adapt the Peng-Robinson equation of state for the
gas under study is currently done.
44
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. thesis
Technische Universiteit Eindhoven, 1990
[3] Colina, C.M., Turrens, L.F., Gubbins, K.E., Olivera–Fuentes, C. and Vega, L.F.: Predictions of the Joule–Thompson Inversion Curve for the n-Alkane Series and Carbon
Dioxide from the Soft-SAFT Equation of State, Ind. Eng. Chem. Res., 41, 1069–1075,
2002
[4] Dohrn, R. Berechnung von Phasengleichgewichten; Vieweg Verlag, Braunschweig / Wiesbaden, Germany, 1994.
[5] Goey, L., Somers L. and Bongers, H.: Verbrandingstechnologie, Technische Universiteit
Eindhoven, 2002
[6] Geld, C.W.M. van der: Meerfasenstromingen met warmte-effekten, Technische Universiteit Eindhoven, 2001
[7] Gersten, K., Papenfuss, H.-D., Kurschat, Th., Genillon, PH., Fernández Pérez, 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 channel
flow, Int. J. Chem. Eng. 16, 1976, 359–368
[9] Hinds, William C.: Aerosol Technology - Properties, Behavior, and Measurement of
Airborne 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-, Wärme- und Impulsaustausch bei der Kondensation von Einund Mehrkomponentensystemen, dr. thesis Technische Universiät 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
[15] Rijkers, M.P.W.M.: Retrograde condensation of lean natural gas, Delftse Universitaire
Pers, 1991
[16] Schram, P., Van Heijst, G. and Van Dongen, M.: Fysische Transportverschijnselen voor
W, 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 of
Lean Natural Gas, Delftse Universitaire Pers, 1995
[19] Wei, Y.S. and Sadus, R.J.: Equations of state for the calculation of Fluid-Phase Equilibria, AIChE Journal, Vol 46 pp. 169–196, 2000
46
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:
This can be written as:
∂ρ ~
+ ∇ · (ρ~v ) = 0
∂t
(A.1)
∂ρ ∂(ρu) ∂(ρv) ∂(ρw)
+
+
+
=0
∂t
∂x
∂y
∂z
(A.2)
When applying (A.2) to a multicomponent system it expands into n equations of the form:
∂ρi ∂(ρi ui ) ∂(ρi vi ) ∂(ρi wi )
000
+
+
+
= ṁi
∂t
∂x
∂y
∂z
(A.3)
000
Where ṁ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
X
ρi
(A.4)
i=1
And the so called bulk or mass-averaged velocities are:
n
u=
1X
ρi ui ,
ρ
i=1
n
v=
1X
ρi vi
ρ
n
and w =
i=1
1X
ρi wi
ρ
(A.5)
i=1
When summing all n equations of (A.3) for all components with these identities, the general
000
form of (A.2) found again. The term ṁ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 velocity
relative to the bulk velocity, giving three expressions for diffusion mass flux [kg/(m2 s)]:
jx,i = ρi (ui − u),
jy,i = ρi (vi − v) and jz,i = ρi (wi − w)
For a binary mixture, these fluxes are given by Fick’s law:
47
(A.6)
jx,i = −D12
∂ρi
,
∂x
jy,i = −D12
∂ρi
∂y
and jz,i = −D12
∂ρi
∂z
Combining (A.6) and (A.7) and substituting in (A.3), gives:
µ
¶
∂ρi
∂ρi
∂ρi
∂ρi
∂u ∂v ∂w
+u
+v
+w
+ ρi
+
+
=
∂t
∂x
∂y
∂z
∂x ∂y
∂z
µ
¶
µ
¶
µ
¶
∂ρi
∂
∂ρi
∂
∂ρi
∂
000
D12
+
D12
+
D12
+ ṁi
∂x
∂x
∂y
∂y
∂z
∂z
(A.7)
(A.8)
This can be further simplified. If the flow is incompressible, the last part of the left-hand side
of (A.8) becomes zero. This assumption is valid for gas flows that are sufficiently subsonic,
[16].
∂ρi
∂ρi
∂ρi
∂ρi
∂
+u
+v
+w
=
∂t
∂x
∂y
∂z
∂x
µ
¶
µ
¶
µ
¶
∂ρi
∂
∂ρi
∂
∂ρi
000
D12
+
D12
+
D12
+ ṁi (A.9)
∂x
∂y
∂y
∂z
∂z
This is the so-called concentration equation, also know as Fick’s second law. It can be written
compact in vector notation, where the indices of the diffusion coefficient are omitted:
∂ρi
~ i=∇
~ · (D∇ρ
~ i ) + ṁ000
+ ~v · ∇ρ
i
∂t
A.2
(A.10)
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’s
molar fraction ỹi (unit kmol/kmol) and its density ρi is:
µ
¶
M
ỹi =
ρi
(A.11)
ρMi
With M the mixture molar mass:
M=
n
X
ỹi Mi
(A.12)
i=1
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 /ρ
48
(A.14)
Appendix B
Equations of state
B.1
Peng-Robinson expressions
The Peng-Robinson equation in pressure form is
RT
aα
−
ṽ − b ṽ(ṽ + b) + b(ṽ − b)
P =
(B.1)
where the parameters a and b are given by
a = 0.45724
R2 Tc2
[1 + S(1 − Tr0.5 )]2 ,
pc
b = 0.07780
RTc
,
pc
S = 0.37464 + 1.5422ω − 0.26992ω 2 ,
(B.2)
The Peng-Robinson equation in terms of the compressibility factor is:
¸
·
µ
¶¸
· 2 µ
¶
¸
ap
b
b p bp
ap bp
bp
2bp bp
2
−1 Z +
+1+
Z+
+1 −
=0
Z +
−
RT
(RT )2 RT RT
2
RT RT
(RT )2 RT
(B.3)
Expressions for the liquid and gas fugacity factors are
·
3
ln ΦL
i
=
ln ΦVi
=
"
#
√
bi L
AL
bi
Z L + (1 + 2)B L
L
L
L
√
(Z − 1) − ln(Z − B ) − √
(δi − L ) ln
bL
b
2 2B L
Z L + (1 − 2)B L
"
#
√
AV
Z V + (1 + 2)B V
bi V
bi
V
V
V
√
(Z − 1) − ln(Z − B ) − √
(B.4)
(δi − V ) ln
bV
b
2 2B V
Z V + (1 − 2)B V
(B.5)
Where for Z L and Z V the liquid and vapour root of the compressibility factor have to be
calculated, with the liquid and gas expression for the parameters a and b, given further on.
The parameters are defined as:
AL =
aL p
R2 T 2
AV =
aV p
R2 T 2
49
BL =
bL p
RT
BV =
bV p
RT
(B.6)
For the factors aL , aV , bL and bV certain mixing rules for multicomponent mixtures are
needed. The most widely used is the van der Waals rule:
L
a =
N X
N
X
i
xi xj aij
V
a =
j
N X
N
X
i
yi yj aij
L
b =
N
X
j
xi bi
V
b =
i
N
X
yi bi
(B.7)
i
For the aij term in (B.7), multiple approaches are possible. Widely used are the quadratic
mixing rule with one adjustable binary parameter:
aij = (aii ajj )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 =
X
|PEoS − PExp |
(B.9)
data
Different researchers proved the van der Waals mixing rules to be very accurate for non-polar
mixtures (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 liquid
phase x̃i and the molar composition in the gas phase ỹi from pressure, temperature and overal
molar fraction z̃i . Summarized, this gives
(Lf , x̃i , y˜i ) = flash(z˜i , 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 Z L and for the vapour
compressibility factor Z V .
V
3. Calculate the liquid and vapour fugacity factors ΦL
i and Φi .
V
4. Calculate the K factor with Ki = ΦL
i /Φi .
P
5. See if i (xi − yi ) = 0, with
zi
xi =
Ki + Lf (1 − Ki )
and yi = Ki xi
6. If step 5 does not give zero, adjust the liquid fraction. For this, a fast root finding
algorithm like Newton’s method can be used. A possibility with an analytical derivative
for Lf is [10]:
X
z̃i (Ki − 1)
z̃i (Ki − 1)2
Lnew = Lold −
/
Ki + (1 − Ki )Lf (Ki + (1 − Ki )Lf )2
i
P
7. Go back to step 2 until i (xi − yi ) = 0.
A number of good alternative iterative schemes is given by Dohrn [4].
50
Appendix C
Gas composition
The gas considered in this study is Russian natural gas consisting of 32 components with the
following molar fractions. Only the composition up to decane is shown. Typical for this gas
is that the methane content is very high. A range for the molar fraction of the low volatile
component is given1 .
Component
Methane
Ethane
Propane
Butane
Isobutane
Pentane
Isopentane
Hexane
Heptane
Octane
Nonane
Decane
low volatile component
molar fraction
0.975
0.0102
0.00349
0.000729
0.000699
8.0e-5
0.000109
4.8e-5
1.8e-5
2.0e-5
4.8e-6
3.4e-6
1e-7–1e-5
1
The molar fraction of the low volatile component is not precisely known. The values taken here are based
on a prediction of the solubility of the component in pure methane in a temperature range of 290K − 320K
and a pressure range of 20 bar – 120 bar, as calculated with the Peng-Robinson equation of state (data not
published).
51
Component
Rest components:
C11
C12
C13
C14
C15
C16
C17
C18
C19
C20
C21
C22
Benzene
Toluene
Ethyl benzene
M-xylene
Methanol
HE
N2
CO
CO2
O2
H2
molar fraction
0.00874
52
Appendix D
Property data
The following low-pressure, ideal gas, temperature correlation is used for the heat capacity,
[14]:
cp /(RM ) = a0 + a1 T + a2 T 2 + a3 T 3 + a4 T 4
(D.1)
a0
a1
a2
a3
a4
4.568 ·100
-8.975 ·10−3
3.631 ·10−5
-3.407 ·10−8
1.091 ·10−11
Viscosity with low pressure, ideal gas correlation for hard sphere model:
η = 1 · 10−7 26.69
(M T )0.5
σ 2 Ωv
(D.2)
with σ = 3.758 for methane. The collision integral is:
Ω = A(T ∗ )−B + C exp(−DT ∗ ) + E exp(−F T ∗ )
(D.3)
valid for,
0.3 ≤ T ∗ ≤ 100
where,
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.
T∗ =
53
Appendix E
Numerical programming
E.1
Matlab
Below the code for the original matlab model is given. For a 3-component mixture, consisting of Methane, Decane and Tri Ethylene Glycol, the growth of condensate film thickness is
calculated. 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 component concentrations, mixture velocity, mixture density, mixture Reynolds number, component
Schmidt numbers, Nusselt number, friction factor, component Sherwood numbers, heat transfer coefficient, component mass transfer coefficient and molar mass flow. Then, the growth
of the condensate film as well as the changed bulk gas concentration is calculated with these
molar 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 to
a 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 temperature, 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 components
on the gas side of the phase boundary. It takes as input the phase boundary temperature,
pressure and total composition of the control volume.
motherfile.m
clear all, close all, clc
warning off MATLAB:divideByZero
54
% 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
Ni
z_tot
dz
d
v(1)
time_dim_less
t_tot
t_tot_hours
bias_t
dt(1)
=
=
=
=
=
=
=
=
=
=
=
14;
% number of steps for distance
40;
% number of time steps
350000;
% total distance [m]
z_tot/(Nj+1);
% distance step [m]
1;
% Pipe diameter [m]
10;
% [m/s]
0.002;
% dimensionless time: number of times that the gas flows through the whole pipe
time_dim_less*z_tot/v(1);
t_tot/3600;
% total process time [hours]
1;
% distribution of timestep
t_tot/(bias_t*Ni); % timestep [s]
T_S
R
lambda
Pr
M_methane
M_decane
M_TEG
eta
rho_cond1
rho_cond2
rho_cond3
=
=
=
=
=
=
=
=
=
=
=
273+10;
8.3145;
0.035;
0.72;
16.04e-3;
142.285e-3;
150e-3;
1.107e-5;
451.3;
578.4;
626.19;
%
%
%
%
%
%
%
%
%
%
%
Soil temperature;
universal gas constant
thermal conductivity of methane [W/(m*K)] at T=293 K, p=1 atm (binas, page 23)
Prandtl number of air [kg/(s*m)] at T=293 K, p=1 atm (Bejan, page 646)
molar mass of methane [kg/mol]
molar mass of decane [kg/mol]
molar mass of TEG [kg/mol]
dynamic viscosity methane [kg/(s*m)]=[Pa*s] (Bejan, page 646)
density of methane [kg/m^3] at T=293 K, p=90 atm?????
density of decane [kg/m^3] at T=293 K, p=1 atm?????
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_G(1,1)
T_W(1,1)
T_O(1,1)
p(1)
=
=
=
=
=
z_meth(1)
c_G(1,1)
rho_G(1)
= realgasf(p(1),T_G(1,1),pc(1),Tc(1),omega(1)); % see function realgasf.m
= p(1)/(z_meth(1)*R*T_G(1,1));% molar concentration of gas [mol/m^3]
= c_G(1,1)*M_methane;
% density of gas [kg/m^3]
yD1_G(1,2:Nj+2)
yD2_G(1,2:Nj+2)
yD3_G(1,2:Nj+2)
yD1_G(1,1)
yD2_G(1,1)
yD3_G(1,1)
T_S;%*ones(Ni+1,Nj+2);
T_S(1,1)+Delta_T*exp(-1.08e-5*(1)*dz);
walltemperature(T_G,T_S);
T_W+0.0001*Delta_T;
90e5;
=
=
=
=
=
=
% see function wall temperature
% approximation: T_W~T_0
ones(1,Nj+1)*zi(1);
ones(1,Nj+1)*zi(2);
ones(1,Nj+1)*zi(3);
zi(1);
zi(2);
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)
yD2_o(1,1)
yD3_o(1,1)
= yD1_G(1,1);
= yD2_G(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))
% yD1_o(1,1)
= yi(1);
% yD2_o(1,1)
= yi(2);
% yD3_o(1,1)
= yi(3);
c_D1(1,:)
c_D2(1,:)
c_D3(1,:)
% take as starting value for L0, the amount of condensable, non-methane gases
= yD1_G.*c_G;
= yD2_G.*c_G;
= yD3_G.*c_G;
D1(1)
D2(1)
D3(1)
Sc1(1)
Sc2(1)
Sc3(1)
=
=
=
=
=
=
Dm1(yD1_o(1,1),yD2_o(1,1),yD3_o(1,1),p,T_O(1,1));
Dm2(yD1_o(1,1),yD2_o(1,1),yD3_o(1,1),p,T_O(1,1));
Dm3(yD1_o(1,1),yD2_o(1,1),yD3_o(1,1),p,T_O(1,1));
eta/(rho_G(1)*D1(1));
eta/(rho_G(1)*D2(1));
eta/(rho_G(1)*D3(1));
Re
ksi_g
Nu
= v*d/eta;
= (1.82*log(Re)-1.64)^-2;
= (ksi_g/8)*(Re-1000)*Pr/(1+12.7*sqrt(ksi_g/8)*(Pr^(2/3)-1));
55
Sh1(1)
Sh2(1)
Sh3(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
= (ksi_g/8)*(Re-1000)*Sc2(1)/(1+12.7*sqrt(ksi_g/8)*(Sc2(1)^(2/3)-1)); % sherwood relation used by numrich
= (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
beta_1(1)
beta_2(1)
beta_3(1)
=
=
=
=
% Sh1(1)
% Sh2(1)
% Sh3(1)
Nu*lambda/d;
Sh1(1)*D1/d;
Sh2(1)*D2/d;
Sh3(1)*D3/d;
= 0.023*Re^0.8*Sc1(1)^(1/3);
= 0.023*Re^0.8*Sc2(1)^(1/3);
= 0.023*Re^0.8*Sc3(1)^(1/3);
% q_G(1,1)
% q_D(1,1)
% q(1,1)
df1(1,1)
df2(1,1)
df3(1,1)
f1(1,:)
f2(1,:)
f3(1,:)
= alpha_G*(T_G(1,1)-T_W(1,1));
= beta_G(1)*c_G(1,1)*(yD_G(1)-yD_o(1));
= q_G(1)+q_D(1);
= 0;
= 0;
= 0;
= zi(1)*1e-6*ones(1,Nj+2);
% Start with a certain film thickness
= zi(2)*1e-6*ones(1,Nj+2);
= 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;
%
p(j+1)
%
%
%
%
if j<10
= p(1)*(1-(j)*dz*(1/3)/z_tot);
else
p(j+1)
end
zi
= 30e5;
= [yD1_G(i,j+1) yD2_G(i,j+1) yD3_G(i,j+1)];
if i==1
[Li(i,j+1) xi yi]
else
[Li(i,j+1) xi yi]
end
= 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
= flash(p(j+1),T_O(i,j+1),N,zi,pc,Tc,omega,Li(i-1,j+1));
if Li(i,j+1)<=0
disp(’L<0, there is no liquid at film surface’)
end
z_meth(j+1)
c_G(i,j+1)
rho_G(j+1)
v(j+1)
%
Re
D1(j+1)
D2(j+1)
D3(j+1)
= realgasf(p(j+1),T_G(i,j+1),pc(1),Tc(1),omega(1)); % see function realgasf.m
= p(j+1)/(z_meth(j+1)*R*T_G(i,j+1));
= c_G(i,j+1)*M_methane;
= 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
= v(j+1)*d/eta;
= Dm1(yi(1),yi(2),yi(3),p(j+1),T_O(i,j+1));
= Dm2(yi(1),yi(2),yi(3),p(j+1),T_O(i,j+1));
= Dm3(yi(1),yi(2),yi(3),p(j+1),T_O(i,j+1));
Sc1(j+1)
Sc2(j+1)
Sc3(j+1)
= eta/(rho_G(j+1)*D1(j+1));
= eta/(rho_G(j+1)*D2(j+1));
= eta/(rho_G(j+1)*D3(j+1));
%Nu
Nu
%Sh1(j+1)
%Sh2(j+1)
%Sh3(j+1)
= 0.023*Re^0.8*Pr^(1/3);
=(ksi_g/8)*(Re-1000)*Pr/(1+12.7*sqrt(ksi_g/8)*(Pr^(2/3)-1));
= 0.023*Re^0.8*Sc1(j+1)^(1/3); % VDI sherwood
= 0.023*Re^0.8*Sc2(j+1)^(1/3); % VDI sherwood
= 0.023*Re^0.8*Sc3(j+1)^(1/3); % VDI sherwood
%
%
Shn(j+1)
Shb(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
= (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
ksi_g
Sh1(j+1)
Sh2(j+1)
Sh3(j+1)
=
=
=
=
(1.82*log(Re)-1.64)^-2;
(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
(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
(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
beta_1(j+1)
beta_2(j+1)
beta_3(j+1)
=
=
=
=
Nu*lambda/d;
Sh1(j+1)*D1(j+1)/d;
Sh2(j+1)*D2(j+1)/d;
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)
df2(i,j+1)
df3(i,j+1)
= n_D1(i,j+1)*dt(i)*M_methane/rho_cond1;
= n_D2(i,j+1)*dt(i)*M_decane/rho_cond2;
= n_D3(i,j+1)*dt(i)*M_TEG/rho_cond3;
57
end
%
%
%
%
%
%
%
yD1_o(i,1)
yD2_o(i,1)
yD3_o(i,1)
n_D1(i,1)
n_D2(i,1)
n_D3(i,1)
n_D1(i,:)
n_D2(i,:)
n_D3(i,:)
=
=
=
=
=
=
2*yD1_o(i,2)-yD1_o(i,3);
2*yD2_o(i,2)-yD2_o(i,3);
2*yD3_o(i,2)-yD3_o(i,3);
2*n_D1(i,2)-n_D1(i,3);
2*n_D2(i,2)-n_D2(i,3);
2*n_D3(i,2)-n_D3(i,3);
= beta_1(1:Nj+2).*c_G(i,:).*(yD1_G(i,:)-yD1_o(i,:));
= beta_2(1:Nj+2).*c_G(i,:).*(yD2_G(i,:)-yD2_o(i,:));
= beta_3(1:Nj+2).*c_G(i,:).*(yD3_G(i,:)-yD3_o(i,:));
df1(i,1:Nj+2)
df2(i,1:Nj+2)
df3(i,1:Nj+2)
= n_D1(i,:).*dt(i)*M_methane/rho_cond1;
= n_D2(i,:).*dt(i)*M_decane/rho_cond2;
= n_D3(i,:).*dt(i)*M_TEG/rho_cond3;
% numerical boundary condition for film thickness at first j point /
df1(i,1)
df2(i,1)
df3(i,1)
c_G(i+1,:)
=
=
=
=
stationary pressure profile resulting in stationary bulk gas concentration
2*df1(i,2)-df1(i,3);
2*df2(i,2)-df2(i,3);
2*df3(i,2)-df3(i,3);
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
c_G_norm(i+1,1:Nj+2) =
yD1_G(i+1,1:Nj+2)
=
yD2_G(i+1,1:Nj+2)
=
yD3_G(i+1,1:Nj+2)
=
%
%
%
yD1_G(i+1,1:Nj+2)
yD2_G(i+1,1:Nj+2)
yD3_G(i+1,1:Nj+2)
f1(i+1,:)
f2(i+1,:)
f3(i+1,:)
dt(i+1)
t(i+1)
fraction with changed vapour concentration
c_D1(i+1,1:Nj+2)+c_D2(i+1,1:Nj+2)+c_D3(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);
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);
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);
= c_D1(i+1,1:Nj+2)./c_G(i+1,1:Nj+2);
= c_D2(i+1,1:Nj+2)./c_G(i+1,1:Nj+2);
= c_D3(i+1,1:Nj+2)./c_G(i+1,1:Nj+2);
= f1(i,:) + df1(i,:);
= f2(i,:) + df2(i,:);
= f3(i,:) + df3(i,:);
= ((t_tot-(Ni-1)*dt(1))/((Ni^2-1)/2-1))*i+dt(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);
j_mid
= round(Nj/2);
time_half
= num2str(t_tot_hours/2);
time_tot
= num2str(t_tot_hours);
distance_half= num2str(z_tot/1000);
%
distance_tot= num2str(z_tot/1000);
zero=num2str(0);
% calculate an i that corresponds with half of the proces time
% calculate a j that corresponds with half of the pipe length
% convert
convert
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
%
%
%
%
%
%
%
%
%
%
%
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
T0
= 1.01325e5;
= 273;
D012 = 8.773332085000368e-006;
D013 = 7.148819225479191e-006;
D023 = 1.692570655991679e-006;
D12
D13
D23
= D012*((T/T0)^1.75)*(P0/p);
= D013*((T/T0)^1.75)*(P0/p);
= 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
Tw0
Twi
= (1/ks).*r0.*(1/(RG+RL+RW)).*(log(r_inf)-log(r0));
= (TS+TG.*F)./(1+F);
= Tw0+(TG-Tw0).*RW./(RG+RL+RW);
59
surfacetemp.m
%
%
%
%
%
%
%
Calculate
Input
Input
Input
Input
Input
Input
% Output
the temperature at condensate film surface
T_W_f
= temperature gas [K]
T_G_f
= temperature gas [K]
alhpa_L = heat transfer coefficient liquid phase
alhpa_G = heat transfer coefficient gas phase
massrate_f
d_h_wat = enthalpy of evaporation [J/mol]
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_O
=(T_W_f+T_G_f)/2;
=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
% 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)
end
= exp(5.373*(1-omega(i))*(1-T/Tc(i))+log(p/pc(i))); % recommended by Dohrn, page 166/ Mehra et al.
%-----------------------% 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_L
=
a_V
=
b_L
=
b_V
=
a and b for gas(V) and fluid (L) phase
x*a*x’;
y*a*y’;
x*b’;
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
SV
= sort(Zroots_L);
= 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
%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)
DeltaL_noemer(i)
= (z(i)*(K(i)-1)/(K(i)+(1-K(i))*L));
= (z(i)*(K(i)-1)^2/(K(i)+(1-K(i))*L)^2);
end
S
Sn
= K*x’;
= [Sn;S];
DeltaL
= sum(DeltaL_teller)/sum(DeltaL_noemer);
epsilon
L
L_tab
eps_tab
n
=
=
=
=
=
sum(x)-S;
L -DeltaL;
[L_tab;L];
[eps_tab; epsilon];
n+1;
end
E.2
Aspen Dynamics
Given below is the code with which time dependent film condensation is modelled inside
Aspen Dynamics. This is the code of Aspens model ”pipe int2”, that is used in aspen to
integrate the mass, momentum and energy balance of a pipe in time. The code that is added
to 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
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
FitCalc
FricTyp
HFlux
HldTyp
HtOpt
HtSpec
Initialize
MomCalc
MomType
FlowRevBasis
PDriven
PropUser_LiqVisc
PropUser_VapVisc
Npts
UOM
ValidPhases
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
// sets
npoints
nrange
as integerset ([1:Npts-1]);
as integerset ([0:Npts]);
YesNo
(Description:"Model equipment heat capacity");
hidden YesNo;
FrictionType
(Description:"Friction correlation");
YesNo
(Description:"Include fixed heat flux");
HoldupType
(Description:"Holdup correlation");
PipHtOption
(Description:"Thermal specification type");
YesNo
(Description:"Include ambient heat transfer");
hidden InitMethods;
hidden MomMethods;
hidden MomTypes;
hidden FlowRevBasisParam;
logicalparameter
(Description:"Model is pressure driven", GlobalPDriven);
YesNo
(Description:"User expression for liquid viscosity", "No");
YesNo
(Description:"User expression for vapor viscosity", "No");
integerparameter
(Description:"Number of profile intervals", 10);
hidden integerparameter (1); // hard-wired UOM
ValidFWPhaseType
(Description:"Valid phases");
// variables
angle
area_ (nrange)
beta_ (nrange)
cero_vel
Diam
Diam_ (nrange)
Diam_out
DPin
DP_const_ (nrange)
DP_const_torn_ (nrange)
dpAcc
dpElv
dpFrc
dpTot
dp_acc_ (nrange)
dp_elv_ (nrange)
dp_fr_ (nrange)
dv_ (npoints)
dx
dxl
E_(npoints)
eff
EquipCp
EquipMass
ero_vel_ (npoints)
F_ (nrange)
F_Max
Fl_ (nrange)
Fm_ (nrange)
Fv_ (nrange)
h_ (nrange)
hl_ (nrange)
hl1_ (nrange)
hl2_ (nrange)
hv_ (nrange)
L
L_eqv
L_prof (nrange)
lambda (nrange)
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
angle
(Description:"Pipe angle of inclination");
area
(Description:"Cross sectional area of element");
fraction
(Description:"Moles liquid 1/ total moles liquid");
constant
(Description:"Erosion velocity constant");
length
(Description:"Pipe inlet internal diameter");
length
(Description:"Pipe internal diameter");
length
(Description:"Pipe outlet internal diameter");
hidden press_diff (fixed, 0.0);
hidden notype;
// friction coefficient
hidden notype;
// torn friction coefficient
press_diff
(Description:"Acceleration pressure drop");
press_diff
(Description:"Elevation pressure drop");
press_diff
(Description:"Frictional pressure drop");
press_diff
(Description:"Total pressure drop");
press_diff
(Description:"Incremental acceleration pressure drop");
press_diff
(Description:"Incremental elevation pressure drop");
press_diff
(Description:"Incremental friction pressure drop");
hidden volume;
// element volume
hidden length;
// element length
hidden length;
// element equivalent length
holdup_heat
(Description:"Internal energy holdup", spec:RateInitial, 0.0);
fraction
(Description:"Pipe efficiency");
cp_mass
(Description:"Specific heat capacity of pipe wall");
mass
(Description:"Mass of pipe wall");
velocity
(Description:"Erosion velocity");
flow_mol_rev
(Description:"Mixture molar flow rate");
hidden flow_mol_rev; // Maximum of inlet/outlet flow
flow_mol_liq_rev (Description:"Liquid molar flow rate");
flow_mass_rev
(Description:"Mixture mass flow rate");
flow_mol_vap_rev (Description:"Vapor molar flow rate");
enth_mol
(Description:"Mixture molar enthalpy");
enth_mol_liq
(Description:"Liquid molar enthalpy");
enth_mol_liq
(Description:"Liquid 1 molar enthalpy");
enth_mol_liq
(Description:"Liquid 2 molar enthalpy");
enth_mol_vap
(Description:"Vapor molar enthalpy");
length
(Description:"Pipe length");
hidden length;
length;
// length array for profile plots
fraction
(Description:"Liquid volumetric flow fraction");
63
lf_ (nrange)
lf1_ (nrange)
lf2_ (nrange)
lfvol_ (nrange)
M_(npoints)
Ml_(npoints)
Ml1_(npoints)
Ml2_(npoints)
Mv_(npoints)
Mc_ (npoints, componentList)
Ml_fac1_ (nrange)
Mom_ (npoints)
Mw_ (nrange)
Mwl_ (nrange)
Mwl1_ (nrange)
Mwl2_ (nrange)
Mwv_ (nrange)
P_ (nrange)
P_drop_ (nrange)
Q_ (nrange)
QEnv_(nrange)
Qr_ (nrange)
QAD
relruf_ (nrange)
reyno_ (nrange)
rho_ (nrange)
rhol_ (nrange)
rhol1_ (nrange)
rhol2_ (nrange)
rhom_ (nrange)
rhoml_ (nrange)
rhoml1_ (nrange)
rhoml2_ (nrange)
rhomv_ (nrange)
rhov_( nrange)
ruff
sigma1_ (nrange)
slip_ (nrange)
sonic_vel_in
sonic_vel_out
T_ (nrange)
Tamb_in
Tamb_out
TWall_ (nrange)
U
UEnv
UWall
V_ (npoints)
Vl_ (npoints)
Vl1_ (npoints)
Vl2_ (npoints)
Vv_ (npoints)
vapvisc
Vel_ (nrange)
VelFracIn
VelFracOut
Vell_ (nrange)
Velv_ (nrange)
vf_ (nrange)
viscA
viscB
visl_ (nrange)
vismx_ (nrange)
visg_ (nrange)
x_ (nrange, componentList)
x1_ (nrange, componentList)
x2_ (nrange, componentList)
xdot_ (nrange)
y_ (nrange, componentList)
z_ (nrange, componentList)
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
as
fraction
(Description:"Liquid phase molar fraction");
fraction
(Description:"Liquid 1 phase molar fraction");
fraction
(Description:"Liquid 2 phase molar fraction");
fraction
(Description:"Liquid volume fraction");
holdup_mol
(Description:"Total molar holdup");
holdup_mol
(Description:"Liquid molar holdup");
holdup_mol
(Description:"Liquid 1 molar holdup");
holdup_mol
(Description:"Liquid 2 molar holdup");
holdup_mol
(Description:"Vapor molar holdup");
holdup_mol
(Description:"Component molar holdup", spec:RateInitial, 0.0);
fraction
(Description:"Liquid volume fraction");
momentum
(Description:"Mixture momentum", spec:RateInitial);
molweight
(Description:"Mixture molar weight");
molweight
(Description:"Liquid molar weight");
molweight
(Description:"Liquid 1 molar weight");
molweight
(Description:"Liquid 2 molar weight");
molweight
(Description:"Vapor molar weight");
pressure
(Description:"Pressure", record:true);
press_diff
(Description:"Pressure drop");
enthflow
(Description:"Actual duty", 0.0);
enthflow
(Description:"Rate of heat transfer from vessel wall to environment", 0.0);
enthflow
(Description:"Required duty", 0.0);
heat_flux_lin
(Description:"Heat flux");
notype
(Description:"Relative roughness");
notype
(Description:"Reynolds number");
dens_mol
(Description:"Mixture molar density");
dens_mol_liq
(Description:"Liquid molar density");
dens_mol_liq
(Description:"Liquid 1 molar density");
dens_mol_liq
(Description:"Liquid 2 molar density");
hidden dens_mass (Description:"Mixture mass density");
dens_mass_liq
(Description:"Liquid mass density");
dens_mass_liq
(Description:"Liquid 1 mass density");
dens_mass_liq
(Description:"Liquid 2 mass density");
dens_mass_vap
(Description:"Vapor mass density");
dens_mol_vap
(Description:"Vapor molar density");
length
(Description:"Pipe roughness");
hidden surf_tens; // surface tension
pos_large
(Description:"Slip ratio", lower:0.0, upper:1e6);
velocity
(Description:"Sonic velocity at inlet conditions");
velocity
(Description:"Sonic velocity at outlet conditions");
temperature
(Description:"Temperature", record:true);
temperature
(Description:"Ambient temperature at pipe inlet");
temperature
(Description:"Ambient temperature at pipie outlet");
temperature
(Description:"Wall temperature", initial);
heat_trans_coeff (Description:"Overall heat transfer coefficient");
heat_trans_coeff (Description:"Heat transfer coefficient for heat transfer to environment", 0.0005);
heat_trans_coeff (Description:"Heat transfer coefficient for heat transfer to wall", 0.0005);
volume
(Description:"Total volume");
volume
(Description:"Liquid volume");
volume
(Description:"Liquid 1 volume");
volume
(Description:"Liquid 2 volume");
volume
(Description:"Vapor volume");
visc_vap
(Description:"Fixed vapor viscosity", spec:fixed);
velocity_rev
(Description:"Mixture velocity", record:true);
hidden fractionPosNeg; // vel_(0)/sonic_vel_in
hidden fractionPosNeg; // vel_(Npts)/sonic_vel_out
velocity_rev
(Description:"Liquid velocity");
velocity_rev
(Description:"Vapor velocity");
fraction
(Description:"Vapor phase molar fraction");
notype
(Description:"Viscosity fitting constant", spec:fixed);
notype
(Description:"Viscosity fitting constant", spec:fixed);
visc_liq
(Description:"Liquid viscosity");
hidden visc_liq; // viscosity
visc_vap
(Description:"Vapor viscosity");
molefraction
(Description:"Liquid mole fraction", 1.0/size(componentList));
molefraction
(Description:"Liquid 1 mole fraction", 1.0/size(componentList));
molefraction
(Description:"Liquid 2 mole fraction", 1.0/size(componentList));
fraction
(Description:"Vapor mass flow fraction");
molefraction
(Description:"Vapor mole fraction", 1.0/size(componentList));
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
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))
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))
endfor
= pflash(T_(I),p_(I),z_(I));
= pflash(T_(I),p_(I),z_cv(I));
// 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));
winalpha(I)/UF_v
= Nu(I)*conduc(I)/Diam_(I);
// Gnielinski equation
// 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
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)
endif
endfor
n_dot_tot(I)
endfor
= rho_(I)*winbeta(I,comp)*loge((1-y_cv(I,comp))/(1-z_(I,comp)));
= sigma(n_dot(I));
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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))
//endfor
)=boundary_T(I)/10;
// 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))
endfor
+
M_cv_total(I)*(vf_cv(I))/(pi*Diam_(I)*dx*dens_vap(I));
// 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
In_F_P
In_F_T
In_F_z(componentList)
In_F_h
In_F_Av
In_F_slip
In_F_Trev
In_F_hrev
In_F_zrev(componentList)
as
as
as
as
as
as
as
as
as
as
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
flow_mol_rev;
pressure;
temperature;
molefraction (1.0/size(componentList));
enth_mol;
fraction (1.0);
notype (1.0);
temperature;
enth_mol;
molefraction (1.0/size(componentList));
66
In_F_Avrev
Out_P_F
Out_P_P
Out_P_T
Out_P_z(componentList)
Out_P_h
Out_P_Av
Out_P_V
Out_P_slip
Out_P_Trev
Out_P_hrev
Out_P_zrev(componentList)
Out_P_Avrev
as
as
as
as
as
as
as
as
as
as
as
as
as
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
hidden
fraction (1.0);
flow_mol_rev;
pressure;
temperature;
molefraction (1.0/size(componentList));
enth_mol;
fraction (1.0);
vol_mol;
notype (1.0);
temperature;
enth_mol;
molefraction (1.0/size(componentList));
fraction (1.0);
// properties
pvap_
([0:(2*(ValidPhases=="Vapor-Only")-1)*Npts])
pliq_
([0:(2*(ValidPhases=="Liquid-Only")-1)*Npts])
pliqw_
([0:(2*(ValidPhases=="Liquid-FreeWater")-1)*Npts])
pflash2_ ([0:(2*(ValidPhases=="Vapor-Liquid")-1)*Npts])
pflash2w_ ([0:(2*(ValidPhases=="Vapor-Liquid-FreeWater")-1)*Npts])
pflash3_ ([0:(2*(ValidPhases=="Vapor-Liquid-Liquid")-1)*Npts])
as
as
as
as
as
as
props_vapor;
props_liquid;
props_lwe;
props_flash2;
props_flash2w;
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
// 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
+ 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"])
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
THEN
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
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
$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
// 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
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
// 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;
VelFracOut = Vel_(Npts)/sonic_vel_out;
// velocity -ve in reverse flow
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
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
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
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
// 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
© Copyright 2026 Paperzz