1741094

Download as pdf or txt
Download as pdf or txt
You are on page 1of 285

LBL—22663

DE87 006140

PROCESS STUDIES FOR A NEW METHOD OF REMOVING

H„S FROM INDUSTRIAL GAS STREAMS

by

Dan W. Neumann and Scott Lynn

July 1986

Applied Science Division


Lawrence Berkeley Laboratory
University of California
Berkeley, California 94720

This work was supported by the Morgantown Energy Technology Center, Assis­
tant Secretary for Fossil Energy, Office of Coal Utilization, Advanced Research
and Technology Development, Division of Surface Coal Gasification through the
U.S. Department of Energy under contract number DE-ACO3-76SFOO098.

niRTrMPirn;vi I-I
MASTER
DISCLAIMER

This report was prepared as an account of work sponsored by an agency of the United States
Government. Neither the United States Government nor any agency thereof, nor any of their
employees, makes any warranty, express or implied, or assumes any legal liability or responsi­
bility for the accuracy, completeness, or usefulness of any information, apparatus, product, or
prccess disclosed, or represents that its use would not infringe privately owned rights. Refer­
ence herein to any specific commercial product, process, or service by trade name, trademark,
manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recom­
mendation, or favoring by the United Slates Government or any agency thereof. The views
and opinions of authors expressed herein do not necessarily state or reflect those of the
United States Government or any agency thereof.
1

Process Studies for a New Method of Removing H S from Industrial


2

Gas Streams
Dan Neumann
Abstract

A process for the removal of hydrogen sulfide from coal-derived gas streams
has been developed. The basis for the process is the absorption of H S into a polar
2

organic solvent where it is reacted with dissolved sulfur dioxide to form elemental
sulfur. After sulfur is crystallized from solution the solvent is stripped to remove
dissolved gases and water formed by the reaction. The S 0 is generated by
2

burning a portion of the sulfur in a furnace where the heat of combustion is used
to generate high pressure steam. The S 0 is absorbed into part of the lean solvent
2

to form the solution necessary for the first step.

The kinetics of the reaction between H S and SOj dissolved in mixtures of


2

N.N-Dimethylaniline (DMA)/ Diethylene Glycol Monomethyl Ether and


DMA/Triethylene Glycol Dimethyl Ether was studied by following the
temperature rise in an adiabatic calorimeter. This irreversible reaction was found
to be first-order in both H S and S0 , with an approximate heat of reaction of 28
2 2

kcal/mole of S 0 . The sole products of the reaction appear to be elemental sulfur


2

and water. The presence of DMA increases the value of the second-order rate
constant by ad order of magnitude over that obtained in the glycol ethers alone.
Addition of other tertiary aromatic amines enhances the observed kinetics;
heterocyclic amines (e.g. pyridine derivatives) havir been found to be 10 to 100
times more effective as catalysts when compared to DMA.

The reaction provides a foundation for the development cf a process for


removing H S from a fuel gas made by gasifying high-sulfur coal. A computer
2

simulation was written to permit rapid analysis of potential process alternatives.


Calculations in the simulation were performed in unit sequential fashion with
2
convergence accelerated using Wegstein's method. Modifications were made to
standard engineering unit models to account for the presence of the reaction
between H S and SOj. A flowsheet ar.ij detailed heat and material balances for a
2

process for the reduction of the H*S content of a gasified coal stream from 60,000
to I ppm are presented.
Acknowledgements

Berkeley is a wonderful, often bizarre place, with many opportunities for


learning, both within and outside of the University of California. This atmosphere
is created by many factors, the most important of which is people. My stay here
has been enhanced by a number of interesting and helpful individuals and
organizations.
First and foremost, I wish to thank Professor Scott Lynn, who has guided my
thesis work with intelligence, patience, and good humor.
Thanks also to my lab mates over the years, particularly Tom Colson, who
performed some of the kinetics experiments, and Steve Sciamanna, a good friend
who has taught me much engineering.
Bravo and a tip of the hat to Kay Ekman, Ellen Borrow man, Ruth Cooper,
and Gege Muse of the Graduate Office, who facilitate dealing with the University
and are friendly even in difficult times.
I am very grateful for the support, entertainment, and computer hardware
(especially a fast 287 processor) provided by Len Ott and CompuPro.
A special thanks to R.S. Zarbaugh and I.M. Jenkins, who, though conspicuously
non-existent, provided endless entertainment.
Thanks to the Shell Companies Foundation and to Texaco for their generous
contributions to the livelihood of the author.
This work was •supported in part by the Morgantown Energy Technology
Center, Assistant Secretary for Fossil Energy, Office of Coal Utilization,
Advanced Research and Technology Development, Division of Surface Coal
Gasification, through the Department of Energy under Contract DE-AC03-
76SF00098.
ii

TABLE OF CONTENTS

Abstract

Acknowledgements

I. Introduction

A. Need for HjS Removal Technology

B. HjS Removal Technology

C. University of California Sulfur Recovery Process (UCBSRP) 3

D. Scope of Thesis Work 4

II. Kinetics of the Reaction Between H S and S 0 In Organic Solvents


2 2 5

A Background 5

B. Experimental Methods 5

C. Methods of Analysis 7

1. Acid-Base Experiments 7

2. Kinetics 9

3. Heat of Reaction 11

D. Results and Discussion 12

1. Results for the Reaction of H^S and SOj in Triglyme/DMA/H 0


2 12

2. Results for the Reaction in DMA/DCM/Water 14

3. Results for the Reaction in DMA/Triglyme/Methanol 16

4. Heat of Reaction 20

5. Summary of DMA Results 20

E. Catalyst Survey 21

1. Catalyst Structure 21

2. Parametric Studies of the Reaction using 3PC in DCM and Triglyme 24

3. Water Effect 27

F. Selection of Catalyst 27
Table of Contents (Continued)

III. Process Development 31

A. Background 31

B. Simulation 31

1. Main Program 31

2. Unit Operations 34

C. Process Description 38

1. Process Specification 38

2. Processing Steps 38

3. Summary 46

References 52

List of Variables 55

Appendix 56

A-l. Simulation Programs 56

A. Main Program - BERKSULF.F77 56

B. Tray Absorber/Strlpper/Distillatlon Routine 58

C. Heat Exchanger Subroutine 61

D. Thermodynamics Subroutine 63

A-2. Simulation Usage 64

A-3. Simulation Code 67

A-4. Simulation Data Entry Programs 228


1

I. Introduction
A. Need for H S Removal Technology
2

Hydrogen sulfide, found in a number of industrial process streams, poses a


significant toxicity and odor problem. Recent concern for the environment has
induced industry to intensify efforts to achieve high levels of removal of H S 2

from gaseous waste streams. In many cases essentially complete removal of


sulfurous compounds is necessary. Because the requisite processes are costly in
terms of capital expenditures and eneigy usage, improvements in technology are
the subject of ongoing research.

Investigations are currently being conducted into the removal of hydrogen


sulfide from natural gas, refinery gas and gasified coal. The extent to which these
streams are contaminated and the amount of H S that must be removed varies
2

with the application. For instance, when coal is gasified most of the organic
sulfur is converted to H S that ranges in concentration from several ppm to a few
2

percent depending on the source of the coal. Before the gas can be used, the H S 2

content will generally need to be reduced to the ppm level, although reduction to
the ppb range may be required in some applications.

B. H S Removal Technology
2

Since its development in the late 19th century and through subsequent
refinements, the principle method of H S removal has been the Claus process. This
2

operation involves the following steps:


1. An absorption-stripping cycle applied to the H S-Iaden gas stream, typically
2

using ethanola mines as absorbents.


2. Oxidation of 1/3 of the H S to S0 .
2 2

3. Heterogeneous catalytic reaction between the H S and S 0 2 2 at high


temperature to produce sulfur and water -- i.e.
SOj + H S --> 3/x S + 2H 0
2 x 2
2

4. Condensation of the sulfur by indirect heat exchange or countercurrent


scrubbing with liquid sulfur.
The Claus process is an economic sulfur producer that is capable of handling
large quantities of contaminated s?s. The major drawback is that the process is
equilibrium-limited to 95-97% conversion in 2 to 4 stages at the temperatures
required to prevent condensation of sulfur in the reactors. This would result in a
stack gas that contained, after combustion of the H S, more than 3000 ppm S 0
2 2

(Ferguson, 1975, pg. 1). In general, further processing must be provided to reduce
the concentration of sulfurous compounds in the effluent to environmentally
acceptable levels.

A great number and variety of processes have been developed to treat the exit
gas from a Claus plant. Generally, in the first step of any 'tail gas" process, the
sulfur in the gas is converted to a single form, either by reduction of excess S 0 2

to H S or by oxidation of H S to S0 . The sulfurous material is then concentrated


2 2 2

and recycled to the beginning of the Claus plant or converted to a product which
can be sold or disposed. A detailed discussion cf these 'tail gas' clean-uo units is
beyond the scope of the present work. The interested reader is referred to several
excellent reviews (for example Ferguson (1975); Kohl and Riesenfeld (1979)) for
descriptions of these processes. In order to illustrate the general approach taken
and some of the problems encountered in recovering residual hydrogen sulfide, an
example of a commercially successful process, the Beavon Sulfur Removal Process,
is given below.

In the Beavon Sulfur Removal Process, S 0 in the Claus plant exit gas is first
2

reduced to H S over a cobalt-molybdenum catalyst. This stream is then fed to a


2

Stretford absorber where the H S is absorbed into an aqueous sodium bicarbonate


2

solution as bisulfide. The bisulfide is oxidized by vanadium (as vanadate ion) to


sulfur, which is removed by filtration. Vanadium is reoxidized by anthraquinone
disulfonic acid (ADA), which is regenerated by air or oxygen.
The Beavon/Stretford process has excellent sulfur removal capability; exit
concentrations of H S in the ppm range can be achieved. However, the
2

consumption of valuable fuel in the reduction step and the large circulation rates
needed due to the low absorption capacity of the solution (- 1 g sulfur/lit) reduce
the attractiveness of the process. Furthermore, the sulfur formed by the reaction is
of low quality and often difficult to remove from solution. Because of the high
pumping requirements and the net energy consumption, the Beavon/Stretford
process is limited to the treatment of gases containing no more than 10 tons/day
of sulfur (Kohl and Riesenfeld, 1979).

C. University of California Berkeley Sulfur Recovery Process (UCBSRP)


The process discussed in this thesis and currently under development in the
Lawrence Berkeley Laboratory at the University of California is an attempt to
overcome some of the limitations and problems of current technology. In the
UCBSRP hydrogen sulfide is absorbed into a polar organic solvent where it is
reacted with dissolved sulfur dioxide to form sulfur. After sulfur is recovered
from the solvest by crystallization, the solvent is stripped to remove dissolved
gases and water formed in the reaction. SC<2 is generated by burning a portion of
the sulfur in a furnace, where the heat of combustion is used to generate high
pressure steam. The SO2 is absorbed into the lean solvent to form the solution
necessary for the first step.

Conceptually the UCBSRP is analogous to the Claus process carried out in the
liquid phase. However, unlike the gas-phase Claus reaction, the reaction between
H S and S 0 dissolved in organic liquids can be performed at temperatures below
2 2

1S0°C where the reaction is irreversible and goes essentially to completion. With
judicious use of this added driving force, the hydrogen sulfide level in the outlet
gas can be reduced to less than 1 ppm without the addition of a costly tail gas
4

unit.

Several potential advantages of this process over conventional approaches are:

1. Reduced capital and energy costs.

2. Efficient removal of I^S -- reduce effluent to less than 1 ppm hydrogen

sulfide.

3. Applicability to a wide range of gas streams, varying both in H S content


2

and in conditions (e.g. composition, pressure, etc.).

D. Scope of Thesis Work

The present study is part of the ongoing development of the UCBSRP. One

aim is elucidation of the kinetics of the reaction between hydrogen sulfide and

sulfur dioxide in organic solvents. A variety of compounds have been investigated

as potential solvents and catalysts for the reaction between hydrogen sulfide and

sulfur dioxide. The reaction in these systems and those features of the kinetics

important to the process are discussed.

In order to better evaluate the process and to aid in its development, a

computer simulation was created. The simulation provides a means of identifying

key process constraints and simplifies the task of performing calculations on a

variety of flow configurations. Details of the computational algorithms found in

the simulation and directions for its use are given.

Finally a flowsheet for the removal of H S from gasified coal is presented.


2

This demonstrates several novel facets of the process as well as indicating the

feasibility of applying it to the desulfurization of an industrially important gas

stream.
II. Kinetics of the Reaction Between H S and S 0 in Organic Solvents
2 2

A. Background
When the reaction between H S and S 0 is carried out in organic liquids at
2 2

temperatures below 150°C, it is irreversible and goes essentially to completion. The


equilibrium limitation encountered in the gas-phase reaction at temperatures
above the dew point of sulfur is thereby overcome. This shift in the equilibrium
state is caused both by the lower temperature and by the reduced activity of the
reaction products when in solution. In many organic solvents, such as triethylene
glycol dimethyl ether (Triglyme) and diethylene glycol methyl ether (DGM), the
reaction is impracticaily slow. Moreover, at room temperature the sulfur formed is
too finely divided to be readily separated. Urban (1961) found that the presence
of N,N-dimethyl aniline (DMA) increased the crystal size of the precipitated
sulfur. Furthermore, DMA and other Urtiary amines accelerate the reaction to the
extent that 994% removal of H S is possible with careful selection of the solvent
2

mixture.

The present work was undertaken to study the reaction between H S and S 0
2 2

in mixtures of tertiary amines with Trigiyme and with DGM. Experiments


performed by monitoring the temperature rise of this exothermic reaction in an
adiabatic calorimeter show the effects of various solvent compositions on the
kinetics of the reaction. A knowledge of these effects can be applied to the
selection of suitable solvents for processing H S-laden gas streams.
2

B. Experimental Methods
All rate measurements were made in a SO-ml Erlenmeyer flask that contained
a magnetic stir bar and was sealed by a septum cap (see Fig. II-1). Insulation was
provided by a styrofoam block with a hole drilled out for the reactor. Reaction
progress was monitored by recording the temperature rise as indicated by the
change in the millivolt-level potential produced by a bare, type T thermocouple
Figure ll-l
Experimental Apparatus

Syringe
£ SO.Solutlon

50 ml Erlenmeyer Copper — Constantan Thermocouple


with Septum Cap

To

Chart
Styrofoam
hLS Solution
Insulation Recorder

Stir Bar

Bottom
connected to a chart recorder. A measured quantity of a solution of one reactant
was first placed in the reaction vessel. The reaction was initiated when a
measured quantity of a solution of the second reactant at the same temperature
was injected quickly by syringe into the stirred vessel.
The range of initial reactant concentrations was limited to 0.05 to 0.2S M S 0 2

and 0.1 to 0.5 M HjS. These compositions were high enough to produce sufficient
reaction to permit accurate measurement of the temperature rise without
exceeding an arbitrarily selected maximum temperature increase of 5 °C. Since the
temperature coefficient of the reaction rate constant was found to be relatively
low (see below), the rate constants obtained from these adiabatic experiments are
very nearly equal to those for the reaction carried out under isothermal conditions
- i.e. at the average temperature of a run.
C. Methods of Analysis

1. Acid-Base Experiments
Reactions between NaOH and HCI were carried out in the calorimeter to
determine the rate of mixing, the thermal mass of the apparatus, and the rate of
heat loss from the system. The experimental method was that used in the H S-S02 2

reactions and the quantities and concentrations of reactants were chosen to give
similar temperature rises and thermal masses. Siuse the acid-base reaction is
practically instantaneous, the time necessary for complete reaction is the mixing
time. A heat balance applied to the apparatus and solution allows calculation of
the thermal mass of the reactor. Furthermore, by measuring the decrease in
temperature with time after the initial rise, the rate of heat loss from the system
can be determined.

A chart recorder trace of thermocouple potential (i.e., temperature) versus time


for an acid-base reaction is shown in Fig. II-2. The average value of t m i x was
approximately 0.7 sec for the solution volumes of acid and base asd stirrer speeds
used in these experiments. Presumably, in cases where the reaction between H S 2
Figure 11-2
Chart Recorder Trace for Acid-Base Reaction

0 5 1 15 20

Time (sec)
and S 0 lasted longer than this period, the reaction was then occurring in a
2

homogeneous solution.
+
From the known heat of reaction for H + OH" (- -13.4 kcal/mole of H 0 2

formed) and the heat capacity of the aqueous solutions (approximated as water,
Cp » 1 cal/g °C), the thermal mass of the apparatus was determined to be 0.6
cal/ °C. Sine: in these expermiments the thermal mass of the solution for a typical
run was 12-15 cal/°C, the contribution of the apparatus to the total heat capacity
of the system was small.
The heat leakage from the reaction vessel and styrofoam block corresponds to
a rate of temperature decrease that is less than 0.002 °C/sec. Thus, there would be
a* most a temperature drop of about 0.02 °C during the ten seconds required for a
typical H S - S 0 run. Since in the majority of experiments the temperature rise
2 2

was 5 °C or less, this amounts to an uncertainty of about 0.4% in the maximum


temperature rise.

2. Kinetics
If the reaction between H S and SOj is first order in both reactants, then the
2

differential rate equation for the disappearance of S 0 (A) or H S (B) is


2 2

-dC /dt - -1/2 dCg/dt - k C C


A 2 A B (H-l)

By stoichiometry

C B - Cg - 2<C° - C ) A (II-2)

in which the superscript 0 refers to time - 0. Substituting Eq. 11-2 into Eq. II-1
and rearranging yields the following rate expression:

Jc dt - d C / [ C ( 2 C - 2 c £ + c g ) ]
2 A A A (II-3)

Integration of Eq. II-3 and simplification gives


10

k t - [1/<2CJJ-Cg)] in [ (Cg/c£) (C /C ) ]
2 A B (II-4)

If a reaction is first order with respect to both A and B, then a plot of the
integrated rate expression on the right-hand side of Eq. II-4 versus time should
lie on a straight line with a slope of k . Note that when the initial concentrations
2

of H S and SOj are stoichiometrically equivalent, Eq. 11-4 reduces to the more
2

familiar second-order relationship

2 k t - 1/C
2 A - l/c£ (II-5)

Equation 4 is in the form of concentration and time whereas the quantities


measured experimentally are temperature and time. The conversion from
temperature to concentration is based on two assumptions. First, the temperature
rise for the exothermic reaction between H S and S 0 2 2 is assumed to be
)roportional to the extent of reaction - L&. is a measure of reaction progress. This
assumption follows from the observation that there appear to be no other reactions
occurring under the conditions of these experiments. Second, it is assumed that the
maximum temperature rise corresponds to complete reaction (fraction conversion -
1.0). Thus, for any time t < t m a x the concentration of the limiting component is
related to the temperature rise by the expression

m a x
C - C° (1 - (T - T ° ) / ( T - T°)) (H-6)

From this concentration and the known stoichiometry, the concentration of the
other reactant czv be calculated. In order to minimize errors due to the. ma I losses,
only temperature rises less than 90% of the maximum value were used for
determining reaction-rate constants.
The proceeding analysis presupposes perfect mixing. Since these experiments
require the injection of one of the reactant solutions into the other, a finite
period (whose length depends on the sample volumes, solvent viscosity, and stirrer
speed) is needed for complete mixing of the components. Before mixing is
complete, local inhomogeneities exist in which one of the reactants is in large
excess. The other reactant is rapidly depleted there, effectively reducing the
reaction rate in these regions to zero. Overall, the experimentally measured rate is
lowered and the kinetics of the reaction under such conditions is of uncertain
significance. However, during this period the temperature of the solution
nevertheless rises in proportion to the reaction that does occur. Therefore, after
the solutions are thoroughly mixed, the average concentrations of the two
reactant!; (as determined from the temperature rise using Eq. II-6) become the
homogeneous concentrations in the bulk liquid and the rate is that for the
homogeneous reaction. The rate constant was determined from plots of the
integrated rate expression (Eq. II-4) versus time by considering only the portions
of the plots for which the time is greater than the mixing time.

3. Heat of Reaction
The heat of reaction for each of the experiments was calculated from the
measured temperature rise and the thermal properties of the system. An enthalpy
balance yields

H ^ . E(»c ), p + (*c )
p a p p i ( T M a x _ T O ) ( I I _ ? J

where the subscripts "app" and V refer to the apparatus and solution respectively.
The value nj_ is the number of moles of the limiting reactant.
The heat capacity of the organic solution, including all solvents and products,
was estimated by a group contribution method applied to the bulk solvent used in
a given run. Calculations for Triglyme and DGM using Missenard's group
contribution method, Reid et al. (1977), give a value of Cp - 0.50± 0.05 cal/g-°C.
12
D. Results and Discussion — DMA as Catalyst
1. Results for the Reaction of H S and S0 in Triglyme/DMA/H 0
2 2 2

Kinetic data were analyzed using equation Eq. II-4. Plots of the concentration
expression on the righthand side of Eq. II-4 versus time yield a straight line (in
the region t > t j ) with a slope of value k when the reaction follows second-
m x 2

order kinetics. Data pairs of potential/time obtained from the chart-recorder


traces were converted into concentration/time pairs and plotted in the integrated-
rate forip.
A sample plot for the reaction of H S and 8 0 in a DMA/Triglyme mixture is
2 2

shown in Fig. 11-3. Values of k were obtained from similar plots by drawing the
2

best straight line through the data for t > 1 sec. The curvature at times less than 1
second results from the finite time required for injecting the S 0 sample and
2

mixing the solution. In nearly all of the runs the time intercept, as found by
extrapolating the line drawn through the integrated rate data back to the time
axis, was about O.S to O.S seconds. These values, which approximate quite well the
mi-ing time in the HCI - NaOH experiments, showed little variation from run to
run and thereby indicate a high degree of reproducibility iv the experimental
conditions and technique. Furthermore, since this result agrees with the mixing
time obtained in the acid-base experiments, data points at longer times presumably
represent the progress of the reaction in a well-mixed solution.

Most of the experiments presented here were performed with nearly


stoichiometric equivalents of H S and S 0 . Additional experiments were carried
2 2

out with the ratio of H S to S 0 varying from ibout 2:1 to 1:2. In all cases the
2 2

second-order rate expression provided the best straight-line fit to the data in spite
of a four-fold change in S 0 concentration. Attempts to analyze the data using a
2

rate expression that is second order in H S and first order in S 0 yielded non­
2 2

linear integrated-rate plots.


Resu't:, for the reaction in Triglyme with DMA and water present are
13

Figure 11-3
Integrated Rate Plot
(10 wt% DMA, 2 wt% Water in Triglyme)

90% Compietion

Slope = k ~ 11 lit
mole~s

T = 22°C
0 £.
8 10

1
Time (sec)
' ^mix
14
summarized in Fig. II-4, where the second-order rate constant is plotted as a
function of wt% DMA for various H 0 concentrations. With pure Triglyme as the
2

solvent, plots of the integrated rate expression versus time are non-linear,
increasing in slope as time progresses. Tangents to these curves correspond *o k 2

values of 0.5 lit/mole-s or lower. The curvature, which reflects an increase of the
rate constant with time, may be due to an autocatalytic effect of water formed
during the reaction or possibly to a change in the reaction mechanism. Note that
while adding small amounts of water to Triglyme seems to speed the reaction, it is
unclear whether the same reaction pathway is followed since some of the
integrated rate plots are non-linear. Perhaps other products, such as the sulfoxy
acids that frequently form in aqueous media, are being created in these cases.
When DMA is added to Triglyme, the integrated rate plots become linear, i.e.,
there appears to be a first-order dependence on both H S and S 0 . Furthermore,
2 2

addition of only 2 wt% DMA more than doubles the reaction-rate constant over
that observed for Triglyme alone. Increasing the DMA concentration still further
continues to increase the rate constant, k , which asymptotically approaches a
2

value of 8 lit/mole-s.
The presence of water in DMA/Triglyme greatly accelerates the rate as
i
evidenced in Fig. 11-4. Addition of 4 to 5 wt% H 0 doubles the observed rate
2

constant. As the wt% water is increased in a mixture containing 10 wt% DMA or


more, the value of k attains a maximum value of about 20 to 22 lit/mole-s. Note
2

that the value of Jc for the mixed solvents exceeds the sum of those for the
2

reaction carried out with only one of the catalysts (DMA or K 0) present. This
2

suggests a synergism between the effects of the water and DMA. The mechanism
for this synergism has not been determined.
2. Results for the Reaction in DMA/DGM/Water
The kinetic behavior of the reaction in DGM alone is similar to that observed
for Triglyme. DGM has little or no catalytic effect, and plots of the integrated
Figure 11-4
Variation of Second-Order Rate Constant
with D M A and Water Content in Triglyme

OjS_
T = 20-23 (4.5 wtJS Water)

(3.1 wtJS Water)


12 -

0)
I
o

4 -

0.1 1.0 10.0 100.0


WtS DMA
(Water-Free Basle)
16
rate expression exhibit a slope that increases with time. However, values for k 2

are considerably higher when a given wt% DMA is added to DGM than for a
similar DMA/Triglyme mixture. The rate constants for the reaction of H S and 2

S 0 in DMA/DGM mixtures are shown in Fig. II-5. The DMA/DGM combination


2

seems to present a more favorable environment for the reaction than DMA alone;
when the DMA content of the mixture exceeds 4 wt% the values of k, exceed
those for pure DMA. The maximum value of k , which is approximately 20
2

lit/mole-s, is more than twice as large as that obtained in the Triglyme/DMA cases
with no water present.
The addition of water to DMA/DGM mixtures has little or no effect on the
rate, as is reflected in the data presented in Table II-1. At 10 wt% DMA the rate
constant has attained its maximum value and the addition of water does not
increase the rate constant further.
A few runs with 2.5 wt% DMA in DGM, performed in a cold box at 7 to
10 °C, yielded an average kj of 4.5 lit/mole-s. On the basis of these data and
those in Fig. II-5, the estimated activation energy for the reaction is 7.4 kcal/mole,
which corresponds to a doubling of the rate every 20 °C. The limitations of the
experimental technique prevented a more thorough investigation of the effect of
temperature on the reaction kinetics. However, the fact that the activation energy
is low tends to support the assumption that rate constants obtained from
experiments with small temperatures variations can be used to approximate the
true isothermal values at the average temperature of an experiment.

3. Results for the Reaction in DMA/Triglyme/Methanol


A reasonable hypothesis to explain the fact that both H 0 and DGM
2

accelerate the reaction between H S and S 0 in the presence of DMA is that


2 2

hydroxyl groups are responsible for the synergistic catalytic effect. In order to
substantiate this idea, a few experiments were performed in which methanol was
added to DMA/Triglyme. The data are summarized in Table II-2. As the methanol
Figure 11-5
Variation of Second-Order Rate Constant with wt% DMA
for DMA in DGM at 17-23 °C

100

Wt% DMA
Table I I I

Kate Constants for the Keactlon of H S and S 0


2 2 in

DMA/DGM with Water Added

(T - 23 °C)

Wt% H;Q Wt% DMA k ; flit/mole-O

0.S 9.8 20.4

0.5 9.8 21.6

1.4 9.7 22.8

1.6 9.7 22.1

2.4 9.6 21.3

2.5 9.6 23.5


19

Table II-2

Kate Constants Tor the Reaction of HjS and S 0 in


2

DMA/Triglyme/Methanol Mixtures

at 10 Wt% DMA

(T - 22 °C)

WT% Methanol k,dit/mole-0

3.7 16.2

8.3 23.2

45.1 23.4
20

concentration is increased, the rate constant incteases towards an asymptotic value


which is a factor of S greater than than that for the same concentration of DMA
alone in dry Triglyme. Adding methanol, a substance containing hydroxy! groups,
to the mixture enhances the reaction rate constant. Also, the maximum rate
constant is approximately equal to the maximum kj obtained for the reaction
carried out with the same wt% DMA in Triglyme with water present and to the
rate constant for the same concentration of DMA in DGM.

4. Heat of Reaction
The heat of reaction between H S and S 0 , taken as the average for a large
2 2

number of data points, is 28 to 29 kcal/mole of S 0 reacted. This value seems to


2

apply equally well to all mixtures of the solvents used in these experiments.
Evidently, effects such as heats of solution in the various solvents are small or
similar in magnitude for the range of cases considered.

5. Summary of DMA Results


From the experimental results it is readily apparent that the presence of
DMA greatly accelerates the reaction between H S and S 0 in polyglycol ethers.
2 2

The reaction appears to be first order with respect to both reactants over the
range of concentrations tested. The nitrogen of the amine, which is noted for its
ability to form complexes with sulfur dioxide (Hill and Fitzgerald, 193S), may
provide a favorable site at which the reaction can occur. This effect seems to be
dependent on both the concentration of catalytic agent and its amount relative to
the concentration of 5 0 . When the mole ratio of DMA to S 0 exceeds one, the
2 2

number of active reaction sites appears to be proportional to the S 0 2

concentration.

For the reaction in DGM an additional factor is found to be important. The


DCM appears to enhance the effect of DMA in accelerating the reaction,
producing a maximum value of the rate constant when intermediate
concentrations or both solvents are present. This enhancement seems to be related

to a catalytic effect of the OH group of the DGM that is synergistic with DMA.

Further evidence of the hydroxyl effect can be seen in the results for the reaction

in DMA/Triglyme with water present; indeed this effect may be expected for

alcohols in general since the experiments performed with

DMA/Triglyme/Methanol yielded similar results. It is possible, as suggested by

Albertson and McReynolds (1943), that the solvent promotes the reaction by

forming a hydrogen bridge compound with H2S which then falls apart to yield a

reactive hydrosulfide ion. Determination of whether the hydroxyl provides an

alternate reaction site or speeds an intermediate or parallel step or causes some

other enhancement will require further investigation.

E. Catalyst Survey

1. Catalyst Structure

At this point only the catalytic activity of DMA has been discussed. However,

other tertiary amines can also catalyze this reaction. To determine which other

compounds are good catalysts, the investigation of the reaction kinetics was

extended to a variety of amines. Rate experiments were conducted as outlined

above and the data analyzed using Eqs. II-4 and II-6. The results of these studies

are given in Table II-3. An examination of the data reveals that catalytic activity

is a strong function of certain chemical properties of the catalyst.

The most striking feature of the data is the difference in the rate constants

for the heterocyclic amines compared to those for non-heterocycles. In general a

non-heterocycle must be present in 10 to 100 times greater concentration than a

similar heterocycle to produce an equivalent rate constant. For example, compare

DMA to 3-pyridyl carbinol (3PC). As can be seen in Table II-4, a major structural

difference between the two molecules is in :he location of the nitrogen. 3-pyridyl

carbinol, which has a nitrogen in the aron ;-tic ring, produced the same level of

catalysis (i.e. rate constant) at a 30-fold lower concentration than DMA. Whether
22

Table II-3

Rate Constant Summary for the Reaction of H S and SOj in DGM


2

CATALYST *2- fL/MOLE-S> B.P. (°C)


Non-heterncvclic amines

N,N-diethyl toluamide (0.79M) 0.49 111 (1 mm)

Phenyl diethanol amine (0.44M) 0.71 228 (15 mm)

Triethyl amine (0.83M) 13.6 89

N.N-Dimethyl aniline (0.44M) 16.0 194

Heterocvclic Amines fAII at 0.07M)

Acridine Reacted with SOj 346


2,2'-Bipyridine 0.38 273

2-Phenyl pyridine 0.72 26S

Quinoline 2.80 238

3-Phenyl pyridine 3.40 270

2-Benzyl pyridine 4.80 276

4,4'-Bipyridine hydrate 6.34 305

3-Pyridyl carbinol 6.41 266

4-Benzyl pyridine 8.33 287

Pyridine 8.40 115


23

Table II-4

Effect of Heterocyclic Nitrogen on Reaction Rate Constant

Concentration of Catalyst to Achieve k - 16 L/MOLE-S


2

Catalyst rCATl fMOLE/Lm Structure

/CH

<0^
3

N,N-Dimethyl Aniline 0.440


N
CH,

3-Pyridyl Carbinol 0.015 (I ))— CH OH


©-• 2
24
this effect is due to the electronic environment of the nitrogen or to the structural
arrangement of the molecule is not known.
However, it is clear that in some cases steric effects are important in
determining how well a given catalyst performs. There are several examples of
this property in the systems studied. Among the heterocyclic compounds, the
accessibility of the nitrogen in 3- phenyl pyridine, 4,4'-bipyridine, and 4-benzyl
pyridine is unobstructed while the approach to the analogous nitrogen in 2-phenyl
pyridine, 2,2'-pipyridine, or 2-benzyl pyridine is partially hindered by a large
adjacent molecular group. The structures are detailed in Table II-S where the rate
constants obtained for the reaction in DGM are also given. When the aromatic
nitrogen is next to a carbon containing a bulky phenyl or pyridyl group the rate
constant is greatly reduced. However, if the environment of the nitrogen is
unobstructed, then the second order rate constant is increased by a factor of 5 to
20.

A further example of the effect of bulky substituents on the catalytic ability


of tertiary amines is evidenced by the order-of-magnitude difference in the rate
constant obtained for the reaction in DMA/DGM versus that in Phenyl diethanol
amine/DGM Apparently the presence of the bulky ethanol substituents reduces
the accessibility of the reactive site relative to the case where there are methyl
groups on the nitrogen.
2. Parametric Studies of the Reaction using 3PC in DGM and Triglyme
Since the properties and catalytic ability of 3PC make it a promising
candidate for use in a process for the reactive removal of H S from industrial gas
2

streams, more detailed studies of its catalytic activity were needed. In order to
determine the effect of solvent composition on the reaction rate constant, a series
of runs with varying concentrations of 3PC in DGM and Triglyme were
performed. The results for the reaction of H S and S 0
2 2 in Triglyme are
summarized in Fig. II-6, where the results obtained in DMA/DGM have also been
25

Table II-5

Steric Effects on the Reaction Rate Constant

(ICATI « 0.07 M except as noted)

Catalyst k 2
Structure

2,2'-bipyridine 0.3S
>—N N—'

4,4'-bipyridine 6.34

2-phenyl pyridine 0.72


N"

3-phenyl pyridine 3.40


OH^
2-benzyl pyridine 4.80 CH.

4-benyzl pyridine 8.33 CH ~U 2 J.N

Phenyl diethanol amine


(0.44M)
0.71
Q<£
,CH 3

N,N-Dimethyl aniline 16.0


(0.44M) ""CH,
J Figure 11-6

8 — Second Order Rate Constant vs. Concentration Catalyst


in Triglyme

7 —


•/
5
i —
Cat. = 3 - Pyridyl Carbinol

3 —
— / Cat. = N.N - Dimethylaniline /

or
1 —

1 1
0.001 0 01 [Catalyst] (mol/lit) 0.1 1.0
reproduced.
Evidently 3PC is a considerably better catalyst than DMA for the reaction
carried out in Triglyme. A concentration of DMA one to two orders of magnitude
higher than that of 3PC is required to obtain the same second-order rate constant.
Furthermore, the rate of increase of k with concentration of catalyst is greater
2

when 3PC is used.


A few data points for the reaction carried out in 3PC/DGM are given in
Table II-6. Comparing these results to those for 3PC/Triglyme, it is apparent that
at these low concentrations of catalyst the rate constants are somewhat higher and
that the increase in rate constant with concentration is faster. This is similar to
the results obtained for DMA in DGM and Triglyme where the presence of the
hydroxyl group of the monoether accelerated the rate over that obtained in the
diether.

Whether the rate constant would continue to increase monotonically as


indicated in Fig. 11-6 or reach a maximum value as in the DMA/Triglyme or
DMA/DGM runs is not clear at present. An accurate assessment of the potential
for accelerating the reaction by further addition of 3PC will require a different
experimental technique, since the present one is limited by mixing time and the
response of the chart recorder to second-order rate constants of less than 100.
However, it is apparent that rate constants of at least 100 are obtainable with
relatively low concentrations of 3PC.

3. Water Effect
When water is added to mixtures of DMA/Triglyme the reaction rate constant
was found to increase markedly. The addition of water to 3PC in Triglyme seems
to have a similar effect (see Table II-7). Water accelerates the reaction by a factor
of 4 to 5 over that obtained for the same concentration of 3PC in Triglyme alone.
F. Selection of Catalyst
Having determined the rate constants for several tertiary aromatic amines, it
28

Table II-6

Second-Order Rate Constant for the Reaction in Mixtures of


3-pyridyl carbinol (3PC) and DGM

»?PC1 ( M Q U / U k ; a/MOLE-Sl

0.0105 6.4

0.0144 17.7

0.0500 >100.0
29

Table II-7

Effect of Water oc the Reaction in Mixtures of 3-pyridyl carbinol

(3PC) and Triglyme

•3PC1 f M P U / l ) [Waterl (MQlE/t,) k 2

0.0061 0.0 1.3

0.0061 1.1 4.2

0.0150 0.0 8.5

0.0150 2.1 39.3


30
is possible to select a catalyst to use in a process for the removal of H S by 2

reaction with S 0 in glycol ethers. A suitable catalyst from a process standpoint


2

should exhibit the following characteristics:


1. It must catalyze the reaction, producing a sufficiently high rate of reaction
to permit nearly complete removal of H S in a reasonable size physical operation.
2

2. The vapor pressure of the catalyst at the temperatures likely to be present


in the process (usually T < 120 °C) should be low, thus preventing volatile loss of
the chemical.
3. Since polyglycol ethers exhibit properties which make them attractive as
bulk solvents for the process, the catalyst should be soluble in the mono and
diethers of di and higher glycol ether derivatives.
4. The catalyst must not react with any of the reactants or products. This
generally eliminates primary and secondary amines, which react with product
sulfur, and some tertiary amines which complex irreversibly with one or both of
the reactants.
5. The catalyst should be readily available at reasonable cost.
As shown above, sterically hindered amines can be eliminated from
consideration because of the relatively low reaction rate constants obtained with
their use. Additionally, acridine, which forms an insoluble adduct with S 0 , and
2

pyridine, which exhibits excellent catalytic properties but boils at a low


temperature, are rejected as possible catalysts.
Of the remaining catalysts tested, quinoline and 3PC are promising choices.
Quinoline is relatively cheap and moderately high boiling, but is only slightly
soluble in water. However, 3PC has a low vapor pressure at the temperatures of
interest and is miscible with water. This last property facilitates its recovery from
stack gases by aqueous scrubbing and reduces the possibility of a stream splitting
into separate organic and aqueous phases. Thus, 3-pyridyl carbinol is the catalyst
chosen for subsequent development of the present process for H S removal.
2
31

III. Process Development


A. Background
A major goal of the work for this thesis was to develop a process scheme
which demonstrates the feasibility of using the reaction between H S and S 0 in
2 2

organic solvents for sweetening a sour gas stream from a coal gasifiei. Since the
intended use for this gas is power generation in a gas turbine, tLj total sulfur
content of the gas must be reduced to the ppm level to protect the equipment from
corrosion as well as to meet environmental specifications.
The removal of H S from gas streams has been the subject of intense study in
2

recent years. As noted in the introduction, many methods employing a variety of


different techniques have been proposed as solutions to this problem. The process
considered here relies on the reaction between H S and S 0 carried out in the
2 2

liquid phase at moderate temperatures (< ISO °C). Under these conditions the
reaction is irreversible and with a suitable catalyst/solvent system can be made to
1
go essentially to completion in a short time. Qi ;-:itative removal of H S is 2

possible, thereby satisfying stringent environmental requirements. Although


processes of this type have been mentioned in the patent literature (e.g. Townsend,
1939; Deal et al., 1968; Renault, 1969; Tanimura, 1976), none has been successfully
commercialized in an application where an exit H S concentration of a few ppm
2

is needed.

B. Simulation
1. Main Program
Since a detailed analysis of the potential flow configurations for the process
was desired, a computer simulation capable of performing energy and material
balances was written. Such calculations permit rapid evaluation of different
arrangements of unit operations and make it possible to identify important process
requirements and constraints. An overview of the simulation is presented here; for
32
an in-depth discussion of calculational methods the reader is referred to the
Appendix.
A flowchart for the simulation main program is given in Fig. III-l. The
external framework of the simulation is fairly simple. The parameters for all
streams including composition, flow, temperature, pressure, enthalpy, and phase
are stored in a single array in the main program. This stream matrix is initially
filled with values read from a disk file which contains user-specified feeds and
initial guesses where needed. For streams with non-zero flows the program
determines the phase by calculating the bubble and dew points. Stream enthaj^ies
are also calculated. If the results from a prior run of the simulation are available,
they may be used as the initial values for the present calculations. This is
particularly advantageous when minor changes have been made to a flowsheet,
since the solution to the new problem will probably not be greatly different from
that obtained previously.

Unit operations in the flowsheet are calculated in sequence from a data file
with the stream variables and other parameters passed to the unit subprograms as
needed. The outlet streams from each operation are used to update the global
stream matrix.
After all of the unit calculations have been performed, the program tests for
convergence by comparing the current stream variables with those from the
previous iteration. If the variables are not converged, then Wegstein acceleration
(Perry, 1984, pg. 2-62) is applied to the component flows. Usually the accelerated
variables are closer to the correct solution than those obtained by simple direct
substitution. The results of the previous iteration are combined with the Wegstein-
accelerated variables whrre appropriate to form a new set of guesses for the next
iteration. The sequence of calculations is repeated until component flows and
stream temperatures are converged to one part in 1000 or until a user-specified
maximum allowable iteration count is reached.
33
Fig. Ill-l Program Flowchart

Initialize
Properties

Open
STREAMS.TMP

Read Variables
for a Stream

Set Phase from Calculate


Bubble and Stream
Dew Points Enthalpy

Determine Update
Next Unit Streams
Operation Matrix

Perform Show Errors Reset to


Unit and First
Calculation Warnings Operation

Perform
Wegsteis
Acceleration

Print
Results

Save
Streams
Information

Stop
34

2. Unit Operations
The flowsheet simulation program supports a variety of unit operations (see
Table III-l). A brief description of the function and purpose of the available
operations of the major types of units is given below.
Absorber /Stringer /Distillation
The absorber/stripper/distillation operation is used to perform stage-to-stage
column calculations. This routine has been designed to handle a number of
different process conditions including specifications for a reboiler, a condenser,
and interstage coolers. Calculations are carried out using a multivariate Newton-
Raphson algorithm modified to account for the presence of chemical reaction
between H S and S0 . The subroutine returns exit liquid and vapor streams and
2 2

the overhead condensate if one is obtained. The internal temperature, flow, and
composition profiles for the column are saved in a separate data file.

Materials Handline Routines


Several units have been provided to simulate materials handling and transfer
operations. In the compressor and pump operations the inlet stream is transferred
to the outlet at a specified pressure. The exit stream enthalpy and phase are
determined by an isenthalpic flash calculation. An estimate of the power
requirement is made by assuming ideal gas behavior in the compressor and that
the fluid being pumped are incompressible.

Mixer and splitter routines are provided for combining and separating streams
respectively. The mixer operation also performs an isenthalpic flash to determine
the exit enthalpy and phase of the mixture. A warning is issued if a mixed phase
(i.e. liquid and vapor) is formed at the exit conditions.
A make-up unit is included to deal with those places in the process where a
constant flow of a component or stream is desired. The three types of operation
supported are:
35

T»ble III-l

Maior Unit Operations In the Simulation

ABSORBER/STRIPPER/DISTILLATION

COMPRESSOR

CRYSTALLIZER

FURNACE

HEATER

HEAT EXCHANGER

MAKE-UP

MELTER/DECANTER

MIXER

PARTIAL CONDENSER

PHFLASH

PUMP

REACTOR

SPLITTER

SULFUR CENTRIFUGE

SULFUR SETTLER

Utility Subroutines

BUBBLE AND DEW POINTS


THERMODYNAMICS
SULFUR SATURATOR
36
1. Set flow of component I, other component flows unchanged.
2. Set flow of component I, other component flows scaled based on inlet
composition.
3. Set total stream flow.
Sulfur Hand line Operations
There are three major units that simulate the necessary sulfur handling
operations in the process. The crystallizer calculates the amount of sulfur that
precipitates under specified conditions and modifies the exit solid and dissolved
sulfur concentrations appropriately. The slurry from this unit is generally fed to a
sulfur settler ia which the bulk of the solvent stream is separated from an exit
slurry with a predetermined weight fraction of solid sulfur.

The operation of a centrifuge is performed by a subroutine in which a cake


of a fixed wt% sulfur is formed and subsequently washed and settled to form a
new slurry. The liquid obtained from the centrifugation and washing steps and
the exit slurry ar: available for further processing.
Reaction Vessels
In the furnace sulfur, H S, and hydrocarbons are burned to fern S 0 and
2 2

CO,. The routine determines the amount of 0 2 (air) required by assuming


complete combustion. The quantity of sulfur needed to produce the desired' S 0 2

outlet flow is calculated taking into account any H S and S 0 in the inlet The
2 2

total heat released in the furnace is recorded. \


The liquid-phase reaction between H S and S 0 is carried out in bulk in the
2 2

reactor. This unit calculates the quantities of H S and S 0 removed and sulfur
2 2

and H 0 formed given the reaction rate constant and the fraction conversion. The
2

temperature and enthalpy of the outlet stream are adjusted for heat changes
associated with externally applied cooling or the with crystallization of sulfur. A
reactor size for carrying out this second order reaction is estimated for plug-flow
operation.
il

Heat Transfer and Equilibrium Operations


The four major heat transfer and equilibrium operations are a heat exchanger,
a melter/decanter, a partial condenser (or isothermal flash), and an adiabatic or
isenthalpic flash. The heat exchanger routine calculates the exit cold and hot
stream temperatures and enthalpies given the exchanger area and heat transfer
coefficient. Phase changes, such as flashing of light gases from solution upon
heating are taken into account.
In the melter/decanter sulfur is melted and separated from the other inlet
components (usually water with small amounts of solvent and dissolved gas). The
heat required for this operation is returned by the unit.
The two flash calculations, isothermal and isenthalpic, return the exit liquid
and vapor streams obtained under specified conditions. These routines not only
provide a procedure for performing desired flash operations, but also are used by
several other unit subroutines to determine the phase(s) and enthalpy for a given
stream.
Utility Routines
A few subroutines included in the simulation perform support calculations for
the other units. For example bubble and dew point temperatures for a stream are
calculated in one subroutine. Another determines the mole fraction of sulfur in a
stream at saturation (sulfur saturator). The thermodynamics subroutine returns
values for and derivatives of enthalpies and equilibrium constants for a specified
stream input.
38

C. Process Description
1. Problem Specification
The basis of the design is the gasification of 50,000 kg/hr of Illinois #6
bituminous coal using air and steam at a pressure of 2500 kPa. This rate of fuel
use would yield about 120 MW of electric power assuming an overall thermal
efficiency of 40%. The total quantity of gas to be treated is 8,950 kmole/hr with
an HiS content of about 0.62%. A complete specification of the gas composition is
given in Table 111-2. The fuel gas is assumed to have been scrubbed with water at
45 °C to eliminate particulates and to condense excess steam ahead of the H S- 2

removal process.

The design specification for the exit concentration of H S is 1 part per


2

million. Furthermore, since the gas is to be burned in a gas turbine, it is desired to


remove HjS selectively, leaving the flows of other components and thus the
volume of the gas unchanged.
The computer simulation was used to evaluate a number of different process
configurations for this application. Figure III-2 is the current flowsheet for the
process. The component balances, temperatures, and pressures are given in Table
III-3. Tetraglyme and 3-pyridyl carbinol were chosen as the bulk solvent and
reaction catalyst respectively. Gas solubilities were obtained from Demyanovich
(1984) and Sciamanna (1986). A description of the process follows.

2. Processing Steps
r
Primary MrsQ t<;r
Sour gas is fed to the bottom of the primary absorber where the bulk of the
H S is removed by physical absorption in solvent recycled from the
2

reactor/cystallizer. The H S level in the gas is reduced to about 600 ppm in 15


2

theoretical trays (L/mV - 1.5). In the section immediately above this point
residual H->S is absorbed and reacts with a solution of SOj. The liquid fed to this
39

Table III-2

Design Basis for Process

(120 Megawatt Power Plant (Gas Turbine))

Sour Gas Characteristics

Composition: (mole fractions)


(Denn et al. 1979)

H 2 - 0.2729 H 02 - 0.00290

N 2 - 0.4130 H S2 - 0.00614

C0 2 - 0.1902 CH 4 > 0.00145

CO - 0.1133

Flow - 2.488 Itmole/s

T - 368 K

P - 2500 kPa

Prpcesi Sp'vtHt/CltHlVit

Tetraglyme/ 3-pyridyl carbinol


40

i^^rasiMM^ 2!
41

Table III-3

Stream Flows and Conditions for Process

Stream: 1 2 3 4 5 6 7

Hj kmol/hr 2444.3 2444.3 .. .. — 4.3 0.6 4.9 ..


co 1703.6 1688.7 -- -- 0.04 280.8 26.4 322.1 0.36
2
N 2 3699.2 3699.2 - -- - 5.4 0.8 6.2 0.02
CH 4 13.0 13.0 -- -- - 0.09 0.01 0.1 -
CO 1014.8 1014.8 - - — 3.1 0.4 3.5 -
H
2 S 55.0 .„ .. .. .. 8.4 0.2 5S.2 ..
so 2
~ - -- -- 2.7 -- -- - 24.3
H 0 2 26.0 17.5 36.0 13.2 1.9 887.1 0.5 952.6 17.2

S (dissolved)' — .. — 3.0 0.2 47.2 .. 58.5 2.5


S (solid or * - - - -- - - - - -
liquid)

Total kmol/hr 8955.9 8877.5 36.0 16.2 4.84 1236.39 28.91 1406.1 44.38

Solvent Flow
kmol/hr -- - •- 140.4 13.0 1823.8 - 1977.2 116.6

Pressure 2510 2500 2510 2510 2510 2510 2510 2500 2510
(kFa)

Te r UrC
S?! ?.l 95 33 40 30 30 30 54 55 30
42

Table III-3
(Continued)

Stream Flows and Conditions for Process

Stream: 10 11 12 13 14 IS 16 17 18

co 2
0.6 14.6 15.2
N, 103.4
27.5

HS2
0.05 0.95 1.00
so 2

H 0
2 5.4 125.4 25.4 145.2 14.4 287.8
S (dissolved)' 0.3 5.4 5.7 5.7
S (solid or 81.0 81.0 55.0 26.0
liquid)

Total kmol/hr 87.35 146.35 31.1 167.1 14.4 368.8 55.0 26.0 130.9

Solvent Flow
kmol/hr 11.2 258.8 270.0 270.0

Pressure 120 120 120 .10 500 100 120 120 110
(kPa)

Temperature 2 7 2 7 , J 3 1 ] 7 4 0 3 8 1 2 0 , 2 0 4 0
43

Table III-3

(Continued)

Stream Flows and Conditions for Process


Stream: 26 27
19 20 21 23 24 25
co 2
0.02 0.05 15.2 - 15.2 - 14.8 0.4
N, ~ - -- -• 103.4 -- 103.4 0.02

HS2
.. 0.01 1.00 .. .. .. .. ..
S0 2 « -- - « 27.0 - -- 27.0
H 0
2 39.5 118.5 1.5 118.3 2.5 12.2 2.7 19.2 7.2
S (dissolved)' - -- -- -- -- 2.7 -- 2.7
„ „ „ „
S (solid or ' .. .. .. ..
liquid)

Total kmol/hr 39.52 118.56 17.7 118.3 148.1 14.9 120.9 49.32 7.2

Solvent Flow
kmol/hr 0.01 0.02 - 0.02 - 129.6 - 129.6 --

Pressure 110 110 110 110 110 110 100 100 110
(kPa)

Temperature 4 0 4 0 4 2 , 0 0 , 5 0 3 0 2 0 6 ] 4 0
44
section contains about 10% of the total stoichiometric requirement of S 0 for the 2

process. A chimney tray permits the vapor to leave this section, whereas the liquid
from the section above is bypassed to the section below in order to maintain a
concentration of SO2 high enough to remove most of the remaining H S from the 2

gas in 5 stages.
Residual H S and desorbed sulfur dioxide are recovered from the gas in the
2

top section by scrubbing with lean cool solvent in 6 to 8 trays (L/mV for S 0 - 2

2). Two trays are provided at the top of the absorber for solvent recovery by a
water wash. The treated gas leaving the absorber contains less than 1 ppm H and 2

so .
2

Reactor/Crvstatlizer
The effluent liquid from the absorber is cooled and mixed with a solvent
stream containing sufficient S 0 to react with slightly less than 90% of the H S
2 2

entering the process. This mixture is forwarded to a vessel where the liquid-phase
reaction between H S and S 0 is allowed to continue nearly to completion.
2 2

Driving force for the reactin i< provided by a slight excess of H S. The sulfur
2

formed by the reaction is allow; : to settle and is removed as a slurry.


Approximately 85% of the s Went leaving the reactor is pumped back to the
absorber to provide the liquid fu. bulk absorption of H S. By recycling most of
2

the solvent required in the absorber without reducing the pressure, pumping costs
associated with solvent circulation are kept low.

Stub? and Solent Surgt Vtsstl


The sulfur slurry leaving the reactor is cooled to 35 °C and fed to the settler
and solvent surge vessel where the mixture is flashed to atmospheric pressure. The
flash gas, containing mostly C 0 2 with small amounts of H S and lighter
2

components (H , N , CO), is compressed and recycled to the bottom of the primary


2 2

absorber. A slurry of sulfur is withdrawn from the bottom of the tank and treated
to separate the sulfur from the solvent. Sufficent solvent is withdrawn from the
storage tank for use in the S 0 removal steps in the primary absorber and the S 0
2 2

absorber.
Solvent Stripper
The solvent from the settler is preheated to 120 °C and fed to a solvent
stripper operating at atmospheric pressure. In this column the liquid is reboiled to
reduce the water content of the solvent to about 1.0 wt%. The water provides a
stripping vapor for residual H S and hydrocarbon (mostly C0 ). About 5 stages
2 2

are needed in the bottom of the stripper to reduce the H S content of the solvent
2

product to less than 1 ppm. The overhead is condensed with cooling water. Part of
the condensed water is refluxed at the top of the column to minimize solvent loss.
The slightly sour water (I to 20 ppm H S) is stripped of H S and used in the
2 2

centrifuge and in the water wash sections in the absorbers. The net water of
reaction is sent to disposal.

The bottoms stream leaving the stripper is cooled in exchange with the
incoming wet solvent. This cool lean solvent is used in the S 0 absorption steps in
2

the primary and S 0 absorbers.


2

Sulfur Separation
The sulfur slurry from the settler is fed to a pusher-type centrifuge Solvent-
free water from the sour water stripper is used first to rinse the sulfur cake and
then to re-slurry the sulfur. The solvent stream and rinse water are pumped to the
solvent stripper. The sulfur-water slurry is heated above the melting point of
sulfur and the two liquids are decanted. Water from this separation is returned to
the centrifuge. The net sulfur product is pumped to a sulfur pit for storage.
S(?2 Absorber

A gas containing about 18% S 0 is formed by the combustion of part of the


2

molten sulfur and the residual H S from the solvent and sour water strippers with
2

air in a furnace. The heat generated is used to produce high pressure steam in a
waste-heat boiler. S 0 is absorbed from the gas by contacting it with cool lean
2
46

solvent in a 7- to 10-stage column operating at atmospheric pressure. The exit S 0 2

concentration in the gas is less than 1 ppm. The solvent flow in this unit is set to
provide cooling of the inlet gas stream and to remove the heat of absorption of
S0 . A water wash is provided at the top of the column to minimize solvent loss.
2

The bottom of the scrubber serves as a tank to provide an inventory of SOj


solution. Storage of S 0 solution permits partial decoupling of the rate at which
2

S 0 is generated from the rate of H S absorption.


2 2

3. Summary
An equipment list and utilities climates are shown in Tables III-4 and III-3
respectively. An economic analysis is not presented here; for a detailed comparison
of this process with conventional technology see Lynn et al. (1986). However, the
flowsheet and data presented illustrate the potential utility of the present
technology for nearly complete removal of hydrogen sulfide from a sour gas
stream.

The process is relatively simple and has modest equipment and utilities
requirements. In its present configuration it has the capacity to reduce easily the
effluent H S and S 0
2 2 to less than 1 ppm, thus meeting environmental
specifications. Furthermore, because the process is highly selective for H S, the
2

total reduction in the molar flow of the gas being treated is less than 1%, which is
of importance when the treated gas is to be burned in a combustion turbine. Of
the other components in the gas only C 0 (5.5% reduction) and H 0 (32%
2 2

reduction) are removed to any extent. This loss of water is not considered
significant because the entering gas contains only 0.29% H 0.2

The value of using the reaction between H S and S 0 in organic solvents has
2 2

been demonstrated. Bulk formation of sulfur is facilitated by the reaction and


reactive absorption permits quantitative removal of H S. This combination is put
2

to good advantage in the present process; solvent recycle for physical absorption
of most of the hydrogen sulfide is made possible by the homogeneous reaction
47

Table III-4

Equipment List

T-l Primary Absorber

T-2 SOj Absorber

T-3 Solvent Stripper

T-4 Sour Water Stripper

K-l Reactor/Crystallizer

K-2 Settler/Solvent Surge Tank

K-3 Pusher-Type Centrifuge

V-l Reflux Drum

V-2 Besanter

H-l Absorber Bottoms Cooler

H-2 Solvent Preheater

H-3 Solvent Cooler

H-4 Stripper Condenser

H-5 Solvent Stripper Reboiler

H-6 Sour Water Stripper Rrbo ei

H-7 Sulfur Melter

H-8 Furnace and Boiler

H-9 SOj Solution Cooler

H-10 Melter Preheater

H-ll Wash Water Cooler


48

Table III-4 (continued)

P-l Absorber Bypass Pump

P-2 Primary Absorber Water Wash Pump

P-3 Primary Absorber Lean Solvent Pump

P-4 Primary Absorber Solvent Recycle Pump

P-S Sulfur Slurry to Centrifuge Pump

P-6 Sulfur/Water Slurry to Decanter Pump

P-7 Solvent to Stripper Pump

P-8 Lean Solvent Pump

P-9 Condensate Pump

P-10 Waste Water Pump

P-ll S 0 Solution Pump


2

C-l Flash Gas Compressor

C-2 Air Compressor


49

Table III-5

UTILITIES USE AND COSTS

Electric Power

Flash Gas Compressor, C-l 92 kW


Air Blower, C-2 II
Lean Solvent Pump, P-3 33
Sulfur Slurry Pump, P-6 13
Solvent Forwarding Pumps; P-4, P-5, P-8, P-l 1 4
Small Pumps; P-l, P-2, P-7, P-9, P-10 1

Total 154 kW
Annual' Cost @ $0.07/kW-hr $56,000

Steam produced, 4200 kPa (615 psia)

Waste heat boiler < 4,300 > kg/hr


3
Annual* Credit @ S l l . 5 0 / 1 0 kg < $395,000 >

Steam consumed, 1150 kPa (165 psia)

Solvent Stripper Reboiler, H-5 3650 kg/hr


Sour Water Stripper Reboiler, H-6 140
Sulfur Melter, H-7 270

Total steam consumed 4060 kg/hr


3
Annual* Co«t @ S9.90/10 kg $321,500

Cooling Water **

Solvent Coolers; H-l, H-3, H-9 1440 gal/min


Water Cooler, H-ll 23
Solvent Stripper Condenser, H-4 380

Total cooling water usage 1843 gal/min


3
Annual* Cost @ SO.10/10 gal $88,500

Total Net Annual' Cost for Utilities $101,000

* Annual costs based on an operating rate of 8,000 hrs/yr.


•• Cooling Water available at 25 °C. Exit Temp. - 45 °C.
50
occurring in the reactor/cystallizer, while reactive absorption is employed to
reduce the exit concentration of sulfurous compounds to desired levels. Since most
of the liquid is recycled to the absorber without a reduction in pressure, solven:
pumping power requirements are relatively low.
The processing scheme also takes advantage of the 30-fold greater solubility of
S 0 relative to H S in tetraglyme and similar solvents. Because the exit vapor
2 2

from the reaction section of the absorber contains small amounts of desorbed SO^
and little or no H2S, the solvent flow needed for complete removal of all
sulfurous compounds is much lower than would be necessary for removal of H S 2

to a comparable level. This configuration keeps the flow of lean solvent low.
Where a sulfurous compound must be removed essentially quantitatively by
physical absorption, that compound is always SCK.
Conversely, the fact that the effluent from the reactor/crystallizer is slightly
H S-rich means that less soluble H S rather than S 0 needs to be stripped from
2 2 2

the solvent. The coupling of a low solvent flow with the presence of an easily
removed component makes it possible to keep stripping costs to a minimum.
Although an economic analysis is beyond the scope of the present
investigation, a significant reduction in utilities cost could be achieved by
lowering the power requirements of the process, represented chiefly by the lean
solvent pump (P-3) and the flash gas compressor (C-I). The flow of lean solvent to
the top of th- primary absorbrr, which is set to obtain a desired level of S 0 2

removal, could be reduced by perhaps 20 to 25% (making L/mV - 1.4 for S0 ). 2

The resultant reduction in pump size and power requirement would have to be
weighed against the increase in capital cost of the added absorption trays.
A lower power (and capital) expense would result by eliminating the
compressor and directing the flow of the flash gas to either the furnace or to the
S 0 absorber. The feasibility of this option depends in the former case on whether
2

a stable flame can be maintained in the furnace in the presence of additional


51
inerts (i.e. C0 ), and in the latter case on restrictions on the emission of CO and
2

H . Both methods yield low concentrations of H S in the exit stack gas, while
2 2

• educing power comsumption by about 30%.


52

References
Albertson, N.F. and J.P. McReynolds, J. Am. Chem. Soc, 65, 1690 (1943).

Crowe, CM., A.E. Hamielec, T.W. Hoffman, A.I. Johnson, and D.R. Woods,
"Chemical Plant Simulation, An Introduction to Computer-Aided Steady-State
Process Analysis', Prentice-Hall (1971).

Deal, C.H., and M.N. Papadopoulos, U.S. Patent 3,363,989 (1968).

Demyanovich, R.J., "The Use of Polar Organic Solvents to Control SOj Emissions:
A Study of Solubilities and Conceptual Designs*. Ph.D. Thesis in Chemical
Engineering, University of California, Berkeley (1984).

Denn. MM., W.C. Yu, and J. Wei, Ind. Eng. Chem. Fund.. 18, 286 (1979).

Edmister, W.C., Hydrocarbon Proc., 47 (9), 239 (1968).

Ferguson, P.A., "Hydrogen Sulfide Removal from Gases, Air, and Liquids", Noyes
Data Corp. (1975).

Grant Chemical, "Glymes, The Grant Family of Glycol Diethers*, Grant Chemical
Division, Ferro Corp. (1982).

Hill, A.E., and T.B. Fitzgerald, /. Am. Chem. Soe.. 57, 250 (1935).

King, C.J., "Separation Processes', McGraw-Hill Book Co., Second Edition (1980).
53
Kohl, A.L. and F.C. Riesenfeld, "Gas Purification", Gulf Publishing Company,
Third Edition (1979).

Lynn, S., D.W. Neumann, S.F. Sciamanna, and F.H. Vorhis, "A Comparision of the
UCB Sulfur Recovery Process with Conventional Sulfur Recovery Technology for
Treating Recycle Gas from a Crude Residuum Hydrotreater", Lawrence Berkeley
Laboratory, Report No. LBL-21574 (1986).

Newnwn, J.S., Ind. Eng. Chem. Fund., 7, 514 (1968).

Perry, R.H. and D. Green, Editors, "Perry's Chemical Engineers' Handbook",


McGraw-Hill Book Co., Sixth Edition (1984).

Reid, R.C., J.M. Prausnitz, T.K.. Sherwood, "The Properties of Gases and Liquids",
McGraw-Hill Book Co., Third Edition (1977).

Renault, P., U.S. Patent 3,170,766 (1969).

Sciamanna, S.F., Ph.D. Thesis in Chemical Engineering, University of California,


Berkeley (1986).

Smith, J.M. and H.C. Van Ness, "Introduction to Chemical Engineeering


Thermodynamics', McGraw-Hill Book Co., Third Edition (I97S).

Sweny, J.W., "High C0 - High H S Removal with SELEXOL Solvent", 59th Annual
2 2

GPA Convention (1980).

Tanimura, W., U.S. Patent 3,953,586 (1976).


54

Townsend, F.M, U.S. Patent 2,881,047 (1959).

Urban, P., U.S. Patent 2,987,379 (1961).

Weast, R.C., Editor, "CRC Handbook of Chemistry and Physics", CRC Press, 65th

Edition (1984).

Wilhelm, E., R. Battino, and R.J. Wilcock, Chem. Rev.. 77 (2).. 219 (1977).
55

List of Variables

Heat Exchanger Area (m )


Stoichiometric Coefficient for Reaction
-2 for H S
2

-1 for S 0 2

2 for H 0
2

3 for Sulfur
0 for all other components
3
Concentration (kmol/m )
Heat Capacity (kJ/kmol-K)
Average Molar Liquid Density (kmol/m )
Log Mean Temperature (K)
Feed Flow (kmol/j)
Liquid Enthalpy (kj/kmol)
Vapor Enthalpy (kj/kmol)
Heat of Reaction (kj/kmol S 0 )
2

Equilibrium Constant for Component i


3
Second Order Reaction Rate Constant (m /kmol-s)
Liquid Flow (kmol/s)
Flow Rate (kmol/s)
Moles of Limiting Reactant (Eqn. II-7)
Heat Added or Removed on Stage j (kj/s)
Fraction of Liquid to Sidedraw
Temperature (K)
Time (s)
2
Overall Heat Transfer Coefficient (kJ/m -s-K)
Vapor Flow (kmol/i)
3
Volume of Liquid on a Tray ( m )
Liquid Mole Fraction
Feed Mole Fraction
56

Appendix
Description of the Process Simulation Program

A-I. Simulation Programs


This appendix contains listings of the Fortran-77 and Knowledge Manager
Database code (sections A-III and A-IV respectively) for the computer simulation
used in the evaluation of the University of California Sulfur Recovery Process. A
brief explanation of how to use the simulation program to perform the
calculations for a particular process configuration is given in section A-II.
Most of the unit operations are simulated using well known chemical
engineering algorithms. A few of the routines requiring more explanation are
described below.

A. Main Program - BERKSULF.F77


The main program is actually composed of three routines, BERKRUN,
BERKSULF, and BERKSTOP. A normal run of the simulation would begin by
invoking BERKRUN, an assembly language program whose sole purpose is to
repeatedly start-up BERKSULF. Typically BERKSULF will execute for 5
iterations, terminate, and then be restarted by BERKRUN. This somewhat
awkward program chaining is necessitated by memory limitations of the Digital
Research Fortran compiler used to compile the simulation.
r
BERK .UN is aborted when BERKSULF calls BERKSTOP, another assembly
language routine, which forces the operating system to terminate execution of
BERKRUN. The stopping point is determined by convergence criteria set at
compile-time in BERKSULF.
The calculations of the simulation are directed by BERKSULF. After
initialization of internal variables, values for composition, flow, temperature,
pressure, and phase are read a disk file, either STREAMS.DAT or STREAMS.TMP,
into the array STREAMS. The file STREAMS.DAT contains the set values and
initial guesses for the streams, whereas STREAMS.TMP consists of data saved
from a previous invocation of BERKSULF. The primary purpose of
STREAMS.TMP is to pass variables between restarts of BERKSULF by
BERKRUN, although the contents can be used as a set of guesses for a new flow
configuration which does not differ greatly from a previous one.
If the data are read from STREAMS.DAT, then the enthalpy for each non­
zero stream is calculated. The bubble and dew points are also determined and a
warning is issued if the phase does not match that set in the input. Enthalpies and
phases are read (torn the data file when STREAMS.TMP serves as the source.
After STREAMS has been initialized, the program begins to perform the series
of unit operations which constitute the flow configuration of interest. The
sequence of events is as follows:
1. Read data for the next operation from the disk file STREAMIO.DAT. A
line in the file consists of the operation code number (operation to perform)
followed by the unit number and a list of the parameters needed and streams
involved in the calculation.
2. Vector to the appropriate unit set-up code. Call the indicated subroutine,
passing parameters as needed.
3. Update the STREAMS array with data returned from the unit subroutine.
Also save any unit information such as power requirement, heat duty, and
equipment size.
4. Check for and report potential error conditions. The most common errors
are non-convergence in a unit subroutine or that a calculation is not performed
due to a zero feed. Exit stream phase conditions (mixed or single) are also noted.
5. Repeat steps I through 4 until all operations have been performed. This is
indicated by a zero or negative value for the operation code.
6. The normalized values for imposition, flow and temperature for all the
58

streams are compared with those of the previous iteration. If these variables are
converged to 1 part in 100, jump to step 9.
7. Apply Wegstein acceleration to the component flows. This is performed by
extrapolation (or interpolation) using the results of several direct substitution
calculations. If x j - F(x ) is replaced by x
k + k k + ] - F(x ), where F(x) is a
k

function representing the direct substitution calculation, then the accelerated


value for x to insert in the equations on the next iteration can be obtained from
(Perry, 1984, 2-62)
X
K+1 " « x k + (1-q) X ^ +1 (A-l)
x x x 2 x + x
<J " < l U l ~ k > / ( k + l " k *-l>
where the subscript indicates the iteration number and a superscript ' refers to a
variable derived from a direct substitution calculation. The accelerated value will
generally lead to convergence when q < 0.
8. Increment the iteration counter. If the count exceeds the maximum
permissible value (either the internal count or the absolute value of a negative
operation code obtained in step 5), then jump to step 9. If the iteration count is 5
greater than when the current run of BERKSULF started, write all data to
STREAMS.TMP, stop, and wait to be restarted by BERKRUN.
9. At convergence or when the maximum number of iterations has been
reached, write all data from STREAMS to the files STREAMS.OLD and
BERKOUT.DAT. STREAMS.OLD contains data in the same form as
STREAMS.TMP Tor possible later use, while BERKOUT.DAT is the formatted
output detailing all of the stream information. A unit summary consisting of
calculated powers, heat duties, and unit sizes is also written.
10. Terminate BERKRUN and stop.

B. Tray Absorber/Strlpper/Dlstillatloa Routine


A general procedure for a staged absorber is to write material, heat, and
equilibrium equations which are linearized by the Newton-Raphson method. The
resulting set of coupled equations is in block tridiagonal form and can be solved
by Newman's method using the BAND subroutine (Newman, 1968). Updated
variables for the next itetation are obtained from the solution. Initial guesses for
the component mole fractions can be made by applying the Thomas method (King,
1980, pgs. 466-472) to an assumed temperature and flow profile based on feed
conditions. Convergence of the component mole fractions to one part in 1000 on
all stages is usually obtained in fewer than 10 iterations. For the case where
H2S is absorbed from a gas stream into a solution containing SOj, as can occur in
this process, the calculations must account for the reaction between two
simultaneously absorbing/desorbing species. Under these conditions a reaction
term is added to the energy and material balances to account for the
disappearance ot H S and S 0 and the production of H 0 and sulfur. This is
2 2 2

implemented by treating each stage as a CSTR with the reaction evaluated at


outlet conditions.

Including the reaction terms from the mass and energy balances explicitly in
the linearization of the equations yields e problem which is calculationally
unstable and often non-convergent. This difficulty is overcome by treating the
reaction terms in the equations as constants (i.e. as pseudo-sidedraws for H S and
2

S 0 and as pseudo-feeds for H 0 and Sulfur) for the solution of the general
2 2

problem at each iteration. To account explicitly for the presence of the reaction,
the mass balance equations for H S and S 0 are linearized in mole fraction only
2 2

and a converged solution for these components is obtained on all stages. These
values then are used to calculate the constant reaction terms in the general
problem. The rest of the calculations proceed as for the solution to the problem in
which no reaction is present.

The equations describing the staged column calculations for absorption,


stripping, and distillation are given in Table A-I. Stepwise, a solution to the
60

Table A-I

Equations Describing an Equilibrium Stage j

Component Mass Balances (A-2): (1 Eqn. for each component i)

v x + v k + x M
- j-i*j~i,i j-i,i < j j,i (v< - j»>*j.i -

a k v x D X D
- (F<Zi) >j + i 2 L< H2S L>< S02 L>
F

Heat Balance (A-3):


V H + V H +
~ j-l j-l j j ^ j " ^+1^+1
a k V x D X D + Q H
- (Fh )j - p £ HRXN i 2 L< H2S L>( S02 L> j
i
Equilibrium Expression (A-4):
k
I C( j.i - « * j , ± ] - °
Mole Fraction (A-5):
x
I t j,i3 " °
i
where

»l Stoicbiometric Coefficient for Reaction


-2 for H S ?

-1 for SO-,
2 for H 6 2

3 for Sulfur
0 for all other components
3
Average Molar Liquid Density (kraol/m )
F Feed Flow (kmol/s)
h Liquid Enthalpy (kJ/kmol)
H Vapor Enthalpy (kJ/kmol)
*RXN Heat of Reaction (kJ/kmol S O ) z

Equilibrium Constant for Component i


3
Second Order Reaction Rate Constant (m /kmol-s)
Liquid Flow (kmol/s)
QHj Heat Added or Removed on Stage J (kj/s)
RS Fraction of Liquid to Sidedraw
V Vapor Flow (kmol/s)
Volume of Liquid on a Tray (n ')
Liquid Mole Fraction
Feed Mole Fraction
61
problem is obtained as follows:
1. Set initial guesses for the column. The liquid and vapor flows, the
temperatures, and the compositions on all stages are estimated from the
cummulative effects of the feeds to the column.
2. Perform property calculations (equilibrium constants, derivatives, etc.).
3. Calculate xj, yj on all stages by the Thomas method.
4. Perform property calculations under the new conditions.
5. The component mass balance equations for H~S and SOj (A-2) are
V x D D
linearized in mole fraction and solved. The term ajk2 l/ H2S L^*S02 L'*
which represents the effect of the chemical reaction, is included in the
linearization. Convergence of the mole fractions on all stages to 1 part in 1000 is
generally obtained in less than 30 iterations.
6. Equations A-2, A-3, A-4, and A-S are linearized by Newton-Raphson in T,
V, L and all x and solved by Newman's method. The reaction term is treated as a
;

constant value at the conditions obtained id step S.


7. Iterate to step 4 until all Xj are converged to 1 part in 1000.

C. Heat Exchanger Subroutine


The heat exchanger subroutine simulates the operation of a single pass
countereurreot heat transfer device. Since the possibility of flashing of light
gasses from solvent upon beating exists in the process under consideration, an
algorithm was devised which correctly accounts for fluid phase changes. The
equations describing this unit are given in Table A-H. Equations A-6 and A-7,
which are linearized in the exit temperatures of the hot and cold streams, are
solved by Newton-Raphson as follows:

1. Estimate T . ; and T . j using the exact solution to the heat exchanger


c e x t h e x t

problem for the case of no phase change.


2. Perform isothermal flash calculations on the two fluids at their exit
62

Table A-II

Equations Describing a Heat Exchanger

Heat Balance Equations (A-6 and A-7):

F H U A D E L T
l - (»h-in " h-exit> * IM " °
F H H H H
2 " < h-in ~ h-exit> ~ < c-exit " c-in> " °

Exit Temperatures (No Phase Change) (A-8 and A-9):

Th-Jn^-BNPC) + Tc-inBNPe^-^NPc)
T
c-exit " ~— ~ ;
^"^PC^NPC'

T T + T T A 1 _ B
h-exit " h-in < c - i n " h-in> ( NPC< NPc) V U - A N P C B N P C )

where
1

A
ICh.iVh.i
NPC

%PC " EXP[UA(l/^ ( a , i C p . c i ) - V I <»h,iCp-h,i>3


c f

i i
A • Heat Exchanger Area (m )
C p - Heat Capacity (kJ/kmol-K)
DELT L M » Log Mean Temperature (K)
m » Flow Rate (kmol/s)
T * Temperature (K)
2
U - Overall Heat Transfer Coefficient (kJ/m -s-K)

Subscripts:
c •> cold stream
h » hot stream
in - Inlet
exit « outlet
i » component I
temperatures to obtain the correct exit enthalpies, accounting for possible phase
changes. Calculate values for F and F .
( 2

3. Calculate the derivatives of Fj and F 2 with respect to the outlet


temperatures. The derivatives are determined numerically by performing
isothermal flash calculations at incremental increases in temperature.
4. The F values and the derivatives are used to calculate new values for the
exit temperatures.
5. Repeat steps 2 through 4 until convergence is obtained.

D. Thermodynamics Subroutine
The thermodynamics subroutine supplies the enthalpies, equilibrium constants,
and derivatives of H and k with respect to temperature needed in the simulation
calculations. For the implementation covered in section A-III, the bulk solvent is
assumed to be tetraglyme. References for data used in the calculations can be
found with the source code. A brief discussion of the methods of calculation is
given below.

Vapor-phase enthalpies are calculated from heat capacity data referenced to


298 K.. To determine liquid-phase enthalpies, the he?t of vaporization is subtracted
from the vapor-phase values. Heats of solution, when available, are used in place
of the heats of vaporization when the solvent is present. The enthalpy of
formation is included in all enthalpy calculations, since a chemical reaction is
present in the process.

Equilibrium constants are estimated from temperature dependent Henry's law


constants when solvent and/or water are present, and by Raoult's law using the
Antoine equation for vapor pressure otherwise. Solvent properties are always
estimated from vapor pressure data. Mixtures of solvent and water are dealt with
by employing the empirical mixing "rule" of a volume fraction average of the
Henry's law values in the two liquids. Since the mass densities of tetraglyme and
64
water are nearly equal, the average weight fraction can be used in place of the
volume fraction. The expression describing the Henry's law constant for a
component in the mixture is
H j , ^ - DEXP [(W, LN(H + W LN ( ! ! „ ) / ( » . + W ) ]
e w w (A-10)
Note that volume rather than mole fraction is used in the analysis because it
better accounts for the difference in molecular size (see Sciamanna, 1986).
At pressures greater than 500 kPa, corrections for enthalpies and k values are
derived by assuming that the Redlich-Kwong equation of state applies. Enthalpy
departures and fugacity coefficients are calculated based on this model.

A-II. Simulation Usage


The simulation was created to permit rapid assessment of process alternatives
by calculation of material and energy balances. To evaluate a particular
configuration, a detailed flowsheet must be drawn. All units, *ven minor ones
such as mixing and splitting vessels, need to be included in the drawing. The
diagram establishes the unit operations to be performed and the interconnection
between devices.
Since processes often contain cue or more recycle streams, the ordering of unit
calculations requires intelligent use of the process arrangement. In fact the flow
of information used in calculations is sometimes different from the flow of mass.
When a downstream unit produces an output required in a particular unit, it may
be convenient to calculate the downstream unit first, even though this is not the
order in which the unit operations would normally be thought of as occurring.

Frequently the user will need to 'guess* the flow, composition, temperature,
etc. of a stream in order to provide an initial input to an operation. For example,
if an input stream to unit one is a recycle from unit two, which derives its output
from unit one, then the input to one of the units must be specified before the
first iteration is performed. Often the variables representing these streams are set
based on knowledge of the process conditions. For minor input streams such
variables often can be initialized to zero.
The process considered in the present work is sufficiently simple that ordering
of units could be performed by inspection. For more complex flow configurations
detailed procedures for determining calculation order and stream specifications,
referred to as decomposition analysis, are discussed elsewhere (see for example
Crowe et al., 1971).
Figure A-I is a presentation of the type of information needed to set up the
simulation. On this block flow diagram, which is a schematic representation of the
process of Fig. III-2, the unit numbers (below or inside a unit block) reflect the
order in which the unit calculations are to occur. Set and guessed streams have
also been indicated. Although stream numbers have been omitted to reduce clutter
in the drawing, in practice all the streams would be numbered.
The block flow diagram, which specifies the order of calculations,
interconnection of units, and the "torn" streams in the process simulation,
combined with detailed information about process units (i.e number of stages in
an absorber, set stream flows, set temperatures, etc.) and with a knowledge of
process requirements, serves as a guide to creating the simulation input. Two disk
files, STREAMS.DAT and STREAMIO.DAT, already described above, provide the
data needed to perform the process calculations.

Although these files can be produced using any text editor by applying the
specifications given in the program code (see A-III), the procedure is extremely
tedious and time consuming. To ease data entry, a set of programs, written in the
KnowledgeMan Data Base Management System, has been provided. The program
code is in section A-IV, The routines are entirely menu driven and produce the
files required to run the simulation.
Trims' Git Stick G i l
H 0 (Su)
2

H 0
2

From III)
Pump £- Splitter •3 Pump f- isn)
H S
2
Rttldml so.
Absorber SO,
To(U)t Absorber
Absorbtr
T,tt
Ttet Splitter
•*&, H h- Pump

7 To "(13) 4, u"
13 19
Storage I
10
T.
Sour G i l Guess
(Sit) — j l Mlitr

1 2 ;

Guru
rorrf
tllf
Ructor

14
L Mixer
—7F~
20
Gum
Solvent
Strlppir ^
L
Mixer

35
Guest
Ti«t Pump Tut 32 Sour
Watir
15 II 31 Strippir

Flow
Split
17
-Guetii
H u t Exch
•Guetir

30
Pump

33
V
Waste
Water
Air
(Guiss)
Furnict

Sulfur
(Guitt)
Sillier Mixer
To Sulfur

Compress. PHFIiih
21

3 Centrifuge ^ Pump
1
Pit '

Meller
Decanter

Figure A - I
23 22
l G
Gut
um ' Mixer
H Tiet
25
£
l e i l Exch

6—Guess _P
•f 29 21 26
B l o c k Flow D i a g r a m f o r Procers H 0 (Set)
2
67

A-III. Simulation Code


This section contains the computer code for the UCBSRP simulation. All of
the routines, except the assembler coded BERK.RUN and BERKSTOP were written
in Digital Research Fortran-77 Version 4.1 for Concurrent CPM. The simulation
was executed on a Compupro computer system with a 10 Mhz. 286/287 processor
and 768k of main memory. A typical run of a flow configuration of the
complexity indicated in section A-II required 5 to 8 hours to produce a converged
solution.
Numerous comments have been included in the code to make it more readable.
For detailed descriptions of the main program, the absorber/stripper/distillation
routine, the heat exchanger and the thermodynamics calculations see section A-I.
The remainder of the routines should be self explanatory. Cited literature
references can be consulted for further information on some of the algorithms.
SIMULATION DRIVER PROGRAM
CCMTilUM.tr EXECUTES KRKSULF.CMD
UHEI KMSULF DETERMINES THAT CONVERGENCE HAS OCCURRED
I? ASORTS THIS ROUTINE I I A CALL TO THE KRKSTOP
SUMOUTINE

THIS PROGRAM IS INVOKED I T :


IERKRUN
01
KROIM X
VHERE X IS AN OPTIONALLY SPECIFIED OKIVE ON UHICH
•ERKSULF CAN K FOUNO

IMITTEH FOX M l ASMB6 UNDER CONCURRENT CPU 4 . 1


LAST UPDATE: 0 4 / 2 1 / 8 6

;EOUATES
CETDRV EQU 025 ;RETURN DEFAULT DRIVE
SETPRIOX ECU HJ ;SET PRIORITY
COUTTACH sou 144 ;ATTACH CONSOLE
CHOC EOU ISO ,-SEHO CLI COMMAND

DSUF EOU 080H .-DEFAULT COMMAND TAIL DUFFER

CCPN EQU 22* ;STSTEM ENTRY

CSEG
ORG

NOV IX.OFFSET DtUF ;POINT TO DEFAULT SUFFER


CUP IYTE PTR [ I X ] , 0 .-CHECK FOR DRIVE SPECIFICATION
JZ HO TAIL
INC IX ;SKIP OVER NULLS, SPACES AMD TAIS
CHP IVTE PTR [BXJ.20H
JE START1
CHP SYTE PTR C6X1.09H
JE START 1
CMP ITTE PIN [ 1 1 1 . 0 0
JE SIMT1
HOW Al, BX) ;CET DIIVE DESIGNATION
MOV DRV.AL
JNPS SEMO CON
NO.TAtL:H0V CL.GETDRV ;GET DEFAULT DRIVE I F NONE SPECIFIEO
INI CCPM
MO AL.41H ;NAKE M I V E ASCII
MOV DRV.Al

SEMMSM:
NOV Ci.CLICND
MOV DX.OFFSET K K S U . F ;EXECUTE KRKSULF
IHT CCPM
NOV Cl.SETPRIO* ;SET PR10R1TV HI CHEN THAN SHELL
MOV 01.190 ; SO UE REGAIN CONSOLE CONTROL
INT CCPM ; AFTER K W S U . F STOPS
NOV CL.COMTTACN .•ATTACH TO CONSOLE
INT CCPM
JNPS STMT ;0O FOREVER

DSEG
ORG 100H
HERKSULF D i 0
DRV CH -A'
Of MEKSULF'.O

END

to
PROGRAM tERKSULF
O
C LAST UPDATE 6 / 2 3 / 8 6

C DESCRIPTION OF MAJOR VM1AILES:


C
C STREAK > COMPOSITION, FLOW, TEMPERATURE, PRESPJRE, AND
C ENIHALPT, PRASE FOR ALL STREAMS IN THE PROCESS. (ORIENT ITERATION)
C SIROLD > COMPOSITION, FLOU, TEMPERATURE FOR ALL STREAMS
C FROM THE PREVIOUS ITERATION
C
C UNIT • UNIT MJMKR, POWER, MEAT OUTT, AMD SIZE
C POWER IM H , HEATS IN KV/S, SIZE IN GAL.
C
C FLOU • COMPONENT f LOUS FOR THE PREVIOUS TWO AND CURRENT
C ITERATION, USED III WEGSTEIN ACCELERATION (SEE tELOU)
C
C X, T, AND HX ARE USED IN STREAM INITIALIZATION
C X > LIQUID MOLE FRACTIONS
C T • VAPOR HOLE FRACTIONS
C RX « COMPONENT ENTHALPIES
C
C FEED. ZFEED, AND 0 1 ARE USED FOR PASSING FEED CONDITIONS TO THE
C AISORRER ROUTINE
C FEED • STAGE f , FLOU, TEMPERATURE, AND ENTHALPY OF FEED
C ZFEEO * COMPOSITION
C CI MtERCOOLER STAGE M M K K ( S ) AND HEAT REMOVED
C
C MOLUT • MOLECULAR WEIGHTS FOR ALL COMPONENTS (FOR COMPONENT
C DESIGNATIONS SEE THERMODTNAMICS SURROUTINE)
C
C ALPHA < ARRAV OF STOICHIOMETRIC COEFFICIENTS FOR THE REACTION
C BETUEEN H2S AND S02 TO FORM SULFUR AND WATER
C
C ABM), MHO, ETC. ARE THE ARRATS THAT APPEAR IN THE RAND
C SUBROUTINE USED IN AISORKR CALCULATION J
t
C STRI AND STRO ARRATS ARE USED TO PASS STREAM INFOMATION TO
C AND FROM VARIOUS SUMOUTINES
C THE CONTENTS • COMPOSITION, FLOW,T,P,E«THAlPT,PHASE
C
^*MWWtWtHWWtWmt*WIMIMMHWWWttMtMWWtltW»W

C NOTES: THROUGHOUT THE SIMULATION THE FOLLOWING VALUES APPLY FOR


C THE PHASE ITPE
C 1 > LIQUID
C 2 • VAPOR
C 3 • MIXED liaUID AND VAPOR
C * • LIQUID UITH SOLID SULFUR PRESENT
C S • VAPOR WITH SOLID SULFUR PRESENT
C * • MINED LIQUID AND VAPOR UITH SOLID S U L m PRESENT
C
C FLOWS IN DOLE/*
C TEMPERATURES IN K
C PRESSURE IN KPA
C ENTHALPIES IN Xj/KHOLE
C

C DESCRIPTION OF OPCODE OPERATION MATRIX


C
C THE DRIVER INFORMATION FOR THE SIMULATION PROGRAM IS KEPT AS A
C SERIES OF DATA SETS IN THE FILE SIREAMIO.DAT
C EACH ENTRY IN THE DRIVER FILE CONSISTS OF THE FOLLOWING ENTRIES:
C OPCODE*, UNITf, DATA1, DATA2, , DATAN WHERE N CAN
C RANGE TO 30 ITEMS
C MOST OF THE DATA ITEMS ARE EITHER STREAM NUMJERS OR PROPERTY VALUES
C SUCH AS PRESSURE, ETC.

C THE PROGRAM READS THE ENTRIES SEQUENTIALLY, CARRYING OUT EACH


C OPERATION AS REQUESTED
C WHEN ALL OPERATIONS HAVE iEEH COMPLETED (OPCODE«0> THEN A
C CONVERGENCE CHECK IS PERFORMED.
C THIS CONTINUES UNTIL CONVERGENCE IS OITAINED OR A MAXIMUM
C M M K ( OP ITERATIONS MAS OCCURRED.
C NOTE THAT THIS AMOUNTS TO A DIRECT SURSTITUTION CONVERGENCE SCHEME.
10

C THE AVAILA1LE OPERATION CODES AND TNE ASSOCIATED DATA VALUES


C ARE LISTED K L O U •• NOTE THAT ALL VALUES FOR A GIVEN OPERATION
C MUST IE SUPPLIEDI
C A1UEVIATIDNS USED:

C FlOU • TOTAL STREAM FLOW (KM0LE/S)


C FLOW « FLOW OF COMPONENT I (KMOLE/S)
C FS » FRACTION OF LIQUID TO SIDE ORAM FROM CONDENSER IN
C DISTILLATION
C ICCNP • COMPONENT K1NKR
C IOFLA6 • IF EQUALS 1 USE OLD PROFILE ON FIRST ITERATION
C IF EQUALS 0 GENERATE NEW INITIAL GUESSES
C P • PRESSURE (IN UNIT OR AT OUTLET* <KPA>
C OR • NEAT REMOVED (tJ)
C ORE • NEAT ADDED TO REROILEI (CJ/S)
C Qlf • NEAT ADDED TO STAGE (KJ/S)
C QIH - NEAT ADDED (KJ)
1
C RHGH - AVERAGE HOLM LIQUID DENSITY (MOLE/M )
3
C R2CONST • SECOND ORDER RATE CONSTANT (HjS • SOj RIM) <N /KHOLE-S>
C STI • STREAM IN
C STO • STREAM OUT
C TCOUT) • TEMPERATURE (IN UNIT OR AT OUTLET) (K)
C IC • TEMPERATURE OF CONDENSER ( O
C UA • NEAT TRANSFER COEFFICIENT * AREA (U/S-K)
3
C VLIQT • VOLUME OF LIQUID ON A TRAT ( H )
OPERATION CODE* OPERATION DATA I/O (I.E. DATA IN OPCODE MATRIX)

KATE M S O R K R / UNIT, NSTACES, F, VLIOT, RHON, R2CONST, FEED1, STAGEF1, FEED2,


DISTILLATION STAGEF2,..,FEECi, STACEF5, STRO VAPOR, STRO LiBUID,
ORE, on, STAGES::, ai2, STAGESI2, re, ts, sr«o LIOUID CONDENSER,

I Of LAG
2 FSM.IT
UNIT, STRI, STR01, STR02, FLOW TO 1
3 PHFLASH
UNIT, STRI, P, STRO LIQUID, STRO VAPOR
* K A T EXCHANGER
UNIT, STRI1 (HOT), STRI2 (COLD), STR01, STR02, UA
5 REIOILER
UNIT, STRI, STRO LIOUID, STRO VAPOR, P, T
6 CONDENSE!
UNIT, STRI, STRO, P
7 MIXER
UNIT, STRI1, STRI2, STRO, P
8 SKITTER
UNIT, STRI, STR01, STR02, FRACT TO STROI
9 PUMP
UNIT, STRI, STRO, P AT OUTLET, R W M
10 REACTOR
UNIT, STRI1, SIR 12, STRO, P, 0 REMOVED, FRACT. CONVERSION, R2CONST
SULFUR SATURAIOR
UNIT, STRI SIRO, T, P
SULFUR SETTLER
UNIT, STRI, S T M T (SULFUR), STR02 (SOLVENT), WTX S IN SULFUR OUT, P
SULFUR UASHER
UNIT, STRI1 (SULFUR), STRI2 (UATER). STROI (HASH), STR02 (SULFUR), UTX S IN SULFUR, P
HELTER/DECANTER
UNIT, STRI1, STROI (UATER), STR02 (SULFUR), T, P
FURNACE UNIT, STRI1 (SULFUR), STRI2 ("JUNK"), STRI3 (AIR), SOZREQ, STROI, TOUT, POUT
(NOTE THAT THE COMPOSITION,TEMPERATURE, PRESSURE AND PHASE MUST BE SET FOR THE
AIR STREAM)

-J
16 COMPRESSOR UNIT, SI«11, STR01, POUT

if SULFUt CENTRIFUGE W I T , S U M , S I M 2 , STROI (SUIFUI SLURRT), STR02 (SOLVENT/UATER), P, UTX1, UTX2

(WHERE UTX VALUES ARE F M C I I M OF SUIFUI III SULFUR STREAMS IN EACH SETTLING STEP)

|g PARTIAL CONDENSE! UNIT, Still, PCONO, TCOND, STKO LIQUID, STIO VAPOR

19 MATE! W I T . Sill, STRO, HID

20 STOIACE UNIT, Sill, STIO, FLOW, ICXHP, TOUT

(FLOW SET, OTHER FLOUS SCALED AT S A K COMPOSITION)

21 CITSTAL UNIT, Sill, STIO

22 SULSPLIT UNIT, STII, STR01, SII02, FIACT1

23 MUCEUP UNIT, STII, STIO, FLOW, ICONP

(FLOUI SET, OTHER FLOUS UNCHANGED)

24 TSET UNIT, STII, SK3. TSET

25 HCSPLIT UNIT, STII, STR01 (HTDROCARtOKS), STI02 (OTHER)

IMPLICIT lEli-'SCAHOZ)

I E A L ' 8 SUE 1 ( 1 0 0 , 2 5 ) , STR0U>(100,23>, < M I T ( 8 0 , « ) , 0PCGDE(50>

REAL'S FLOI 100,20,3)


REAL'S FEEDCS.«>,ZFEED(5,20)
REAL'S X(20),V(20>,HX(20>
REAL'S H0LWT(20)
REAL'S STRM(25),STRI2<25),STR01(25),STR02(25),STIF(25>
REAL'S STRI3(2S),STRI4(Z5),STR03(25),STRM(2S)
REAL'S 0 1 ( 2 , 2 )
LOGICAL I NEW
•EAl'B AIH0<18,18>,§8110(18,18),CI»(18 25),DI»<18,J7> t

REAL'S GBND(18),XBND< 1 8 , 1 8 > , T 8 N 0 ( 1 8 , 1 8 )

REAL'S E I M ( 1 8 , 1 9 . 2 S >

INTEGERS AIPHA(20)

INTEGERS turn

COtOI/ALPH/ALPHA
COHMON/MX.EC/MOLWT
COmOM/mO/AiMO.MW.CiMO.tHKO.CitlO.XiMO.tWIO.II.KJ
COHHON/EEE/ESM)
COMMM/UEGS/FLOU

C SET TEMPORARY INTERNAL ITERATION U N I T


ITERMAX'10

C NUMBER OF COMPONENTS I S 20
NC'20

C SET VALUES FO* CONVERGENCE PRECISION AND ITERATION COUNT


C MAXIMUM NUMBED OF ITEMIIONS • IHAX IN MAIN, IMAXS FO* SUMOUTINES
C • ICMAX F M A SINGLE EXECUTION OF BERKSULF
C (IMDE* CONTROL OF KMOtUN)
C CONVEIIGENCE CRITERION • EPSIION IN MAIN
C « EPS F M SUMOUTINES
IMAX'SO
IMAXS40
ICMAX'S
EPSILON'1.00-2
EPS-I.D-3
C BEAD REACTION STOICHIOHETRT VALUES
0PENf2,FILE«•AlPHA.DAT•)
IEADC2,*) <ALPHA(I),M,NC)

Ul
C READ ALL MOLECULAR WE I CRT VALUES
,
OPER<3,FIlE• HOlEC.0AT•)
READ(3,*> (MOLWTCI),f>t.NC)

C TRY TO READ AN OLD STREAMS MATRIX. THIS MOULD EXIST EITHER IECAUSE
C WE RAH THE CALCULATIONS 1EFORE OR AXE SOMEWHERE IN THE MIDDLE OF A
C CALCULATION REQUIRING MULTIPLE INVOCATIONS OF THIS PROGRAM IT KRKRUN
IHEW.TRUE.
l >
OPEN(t,FILE' STRFJWS.TMP<,STATUS«>OLD ,ERR'S)
C READ OLD ITERATION COUNT AND SHOW THAT WF. FOUND THIS FILE
READ(4,«) ITER
1*1
S REA0I*,»1 C$TKAN(I,J),J-1,NC>
REA0C«.*> (STREAM(l,J),,l>KC»f,HC»S>

IF(STREAM(I,NC>1).NE.-1.0D0) THEN
• •1*1
GOTO S
ENDIF

INEU>.F«LSE.

GOTO 6

C READ ALL INITIAL STREAM VALUES. READ UNTIL f l O W - t . O


C ALSO INITIALIZE THE ITERATION COUNTER
l l
8 OPEN(4,FHE' STREAMS.DAT )
ITER-1

9 l«1
10 READCA,*) (ST«EAM(I,J>,J-MC*5>

IF(STREAM(I,NC*1).NE.-1.000) THEN
1-1*1
GOTO 10
ETOIF
6 NSTREMtS'l-1

URITE<6,«3333> NSTREAMS
A3333 FORHAKX,' NSTRE«MS*>,IS)

C ZERO ACCELERATOR MATRIX AND SHOW THAT FRESH VALUES MUST K CEHERATED
ICWEGS'1
0 0 11 M.HSTREAHS
DO 11 J>1,HC
00 11 M . J
11 FLOW(I.J,K>«O.DD

C READ OLD FLOW MATRIX FOR ACCELERATOR I F NEEDED


IFC.NOT.IIIEU) THEN
>
aPEN(9,FUE>'UEGST .ERR-U>
DO 12 M.NSTREAHS
DO 12 J-1.MC
12 READ(y,*,ERR'H.EHD>H) (FLOU<I,J,K>, M . J )
C SHOU THAT AH ACCEPTAILE OLD FlOU NATRIX HAS IEEN READ
ICUEGS'S
EHDIF

C CLOSE FILES
>
tt CL0SE(9,STATUS''DELETE )
CLOSECO
CL0SEC2)
CLOSE(J)
CL0SE(4)

C COPT 0 A M TO CONVERGENCE MATRIX


DO IS l«1,HSTREAKS
DO IS J>1,HC»3
IS 5TR0LD(I,J>>STREAN(I,J)

C OPEH OUTPUT DATA FILE


OPEHI 1,FILE" ••EHJCOUT.DAT • >
C HOW DELETE OLD DATA FILE

•J
-J
1
CLOSE( 1 .STATUS^'DELETE )

C W U OPEN IT FOR THIS RUN


0PE)n.FllE*'IERICOUT.DAT')

C CALCULATE A l l INITIAL ENTHALPIES FOR STREAMS UITN NON-ZERO FLOW


C ALSO CAICUUTE M I L E AW DEW POINTS AW MAKE SURE ENTERED PHASE
C IS CORRECT. PRINT WARNINGS FOR INCORRECT PHASES AW FOR MIXTURES
C OF LIQUID AW VAPOR
C I F THIS IS AN OLD STREAMS MATRIX (SEE AtOYE) THEN ALREADY NAVE
C ENTHALPIES, ETC.

IF(INEU) THEN
DO 20 I-1.NSTREANS
URIIE(6.199S0> I
IF(ST«EAN(I,HC»1>.EQ.0.0D0) GOTO 20
DO SO J*1,NC
X(j]>STREAH(l,J>
SO Y(j)iXCJ)
1PKASE>INT(STREAN(I,NC«S»
TFEED*STREAH(I,IK>2)
CALL HEATCO.IPHASE.NC.TFEED.STREAMd.NCtSl.X.NX.STREAHd.NCH))
CALL MMDEWCNC.STREAMCI.NC^I.X.r.TlUN.TDEW.STREANCI.NC^),
1 EPS.2]

IF(TFEED.LT.TIUI) THEN
C ALL LIOUID
IF(IPHASE.NE.I) THEN
STRE«N(I,NC*S)'1
MITEO,20010) I
MIITE(6,2O010> I
EWIF
GOTO 20
EKDIF

IF(TFEED.GT.TDEU) THEN
C ALL VAPOR
1FUPHASE.NE.2) THEN
STREAM I , N C » S W
URITEC1.20020) I
UtlTE<6,200?0) I
£NDIF
00T0 2 0
END1F

C MUST K NIXED VAPOR AND LIQUID, ISSUE A UAMING, SET PHASE TO NIXED
UtlTE(1,20O3O> I
VRITE(6,20030> I
SIREA*(l,IK>5>'J.O

20 CONTINUE
ENDIF

C OPEN OPERATION CODE FILE


0PENC2, F I L E . •SntEAM0.DAT • )

C ZERO LOCAL ITERATION COUNTER


ICOUHI'1

C MAIN PROGRAM LOOP - • CONTINUE UNTIL CONVERGED OR ITERMHAX


40 REWIND 2
NUNIT5>0

C OPERATION CODE LOOP


SO REA0(2,*> C0PC0DE(I>,M.3C>

C SUIT IF AIL OPERATIONS HAVE K E N PERFORMED


I F ( O P C O O E d ) . I E . 0 . 0 0 0 ) GOTO 15000
MMITS*HUN!TS»1

C SET CURRENT UKIV NUMBER INTO UNIT MATRIX (UNIT MJMER CAN I E FRACTIONAL)
I*1T(WMITS,1)=OPCOOE(Z>

C SHOW THAT AN OPERATION IS IN PROGRESS

-J
U3
URITEC6.2ODO0) ITER,0PC0DE(2)

00
C SEND 1 0 CORRECT U R I I OKRATIOM O
GOTO < 1 0 O , 2 W , 3 0 0 , * 0 0 , S 0 0 , 6 0 0 , 7 0 0 , 8 0 0 , 9 0 0 , 1 0 0 0 , 1 1 0 0 , 1 2 0 0 ,
1 1300.1U0.1SOO, 1600.1700,1800,1900,2000.2100,2200,2300,2*00,
2 2500) INTWCQDECll)

C I F ERROR
GOTO 10000

ptWtt»»IH»>MtttHlt»lttWWHWltlllllllMIIIMtlttWtWtttH*tt

C PERFORM K A T E AISORIER CALCULATION


C FIRST ZERO THE FEED MATRICES
100 DO 130 1-1,5
DO 120 J»1,«
120 FEEOtl,J>-O.ODO
DO 130 J'l.NC
130 ZFEED(I,J)-9.0D0

C SET RUHRER Of STAGES AW PRESSURE


NSTAGES'INT(0PCCBE<3!>
P«3PC00E(4)

C SET I I S U I D VOLUME OR A TRAT, AVERAGE MOLAR L I O . DENSITY, AMD RATE CONSTANT


VLI0T-0PC00E<5>
RN0M>OPCODE(6)
R2CONST-OPCODE(7>

C SET UP THE FEED MATRICES FOR NON-ZERO FEED STREAMS


4-2

DO 140 1-1,5
J»J*2
IF(0PC0OE(J«S).EO.G.00D) GOTO H O

C SET INDEX FOR CURRENT FEED


1COOEMHT(OPC0OHJ»8>)
c at VALUES FOR STAGER, FLOW, TEMP, AND EKTHAI.PT
FEEDU,1>*OPCODE(J*9>
FEED(I,2>>STREAM(ICCVC,IH>1)
FEED(l.3>«ST*.EAHj(!O0K,IK«2)
FEEDll,«)*STREAMICODe,NC»*>
C SET All I VALUES
DO H O t'l.NC
ZFEED(l,K)*STREAM(ICODE,K>
HO CONTINUE

C SET RESOIIEB BUTT, INTERSTAGE HEATEB/COOLER VALUES, CONDENSER TEMP


C AND FRACTION SIDEE83I lit PR5SEMT)

0R4PCODE420)
ai<1.i>*CPCODE<22>
QM1,2)>OPCODE(2l)
al(Z,1)4PC0DEC2«)
01<2,2)>OPCaOE(23>
TC-OPCOD£<Z5)
FS>a>a»E<26)

C CHECK FOB USE OF OLD PROFILE ON FIRST ITERATION


10FLAG'INT(OPCODE(28»

C CHECK FOB ALL ZERO ENTRT FLOUS


C IF NO FLOU IN GAS FEEO AND NO FLOU IN ANT LIQUID FEED THEN ABORT
C THE CALCULATION
DO K 5 1-1,5
ir(FEED(l,2>.NE.0.0D0) GOTO 1*7
HS CONTINUE
GOTO 99910

C SET NUMBER OF COMPONENTS FOR SUJROUTINE BASED ON MAX. NUMBER OF NON-ZERO


C ENTRIES FOR THE FEEO MOLE FRACTIONS
C MAX NUHBEi THAT THE SUBROUTINE CAN HANDLE IS IS
147 «CSU8=0
DO ItS 1-1.5
CD
90 1(8 I X ' I . I S
IF(ZFEED<l,IX>.K.O.ODO) THEN
IFIKCSUI.LT.IX) THE!
NCSUMIX
ENOIF
'.Wit
1(8 CONTINUE

M I T E ( t , 12(57) KSUI
,
12*57 FOtMT<X.'»"«UI« ,IJ)

C CALL THE AISOMEt MUTiNE


CALL AIS0RKKNSTA«$,IIC r,FEE0,ZFEE»,VllQT,RMM2CaiST,
>

1 M,QI,TC.FS SflH)l,STItO2,SII(O3 tmXS,IKU«.OPC00E(2>,IOFlAC ITEt)


> ) >

C SET RETUM VALUES INTO APPHMIATE MATRIX


C SET J IBEXES FOX VAPOR AW LIOUID XETIWN
IXEII'IKTCOKOKdS))
IXET2'INT(a>£0DE(19»
DO 150 1«1,MC*S
ST«E«N(IRET1,I)«STIK)1(I)
150 Sr«EAH(I«ET2,l)'SI«02(I)

C SET SIDEDMUI IF MESENT


IF(FS.NE.O.DO) THEN
>
• •ET3'IHT(0! CCDE(27)>
DO 152 !*1,NC*5
152 ST«EAN(1RET3,I)'STR03CI)
ENDIF

C JUXP TO EMO* CHECK ROUTINE


GOTO 10000
C FSM.IT - SPLIT THE IM.ET STKM MSEO 0* FIOM
C
C SET IKET STtEM
200 I«|.|»r(0fC0D€(3»

DO 210 l«l.HC»S
210 SniKI)*5TtEMI(lll1,l)

C SET FLOU TO SEW TO OUTLET SKEW 1


FLOVCMKtI>E(6)

C CHECK FOC ZE«0 FEED FLOW


i;fSItI1(IH>1).Ea.0.0M) C0TO 99910

C DO THE OKMTIOM
CALL FSM.lT(NC STtl1,STM1,STt02,FlOK»
>

C GET teruW STtEAHS


IKT1'IKICaPCDDE(4»
llt£T2*Iirf<OPCODE<5»

DO 220 I>I,K:«S
STKEMKIKET2,1 )«ST«02( I )
220 St«£AK(UET1,l)»ST«01(l)

C DO E««0» CHEOCING
GOTO 10000

C ISEDTMALPIC FUSH
C
C SET FEED STIEAN
100 l«1»INI(OpcaOE(J)>
00 510 U1.N05
310 SUF<I>=STREAH(IK1,I>

00
C CHECK F « ZEtO FEED FlUI CD
IF(S1tF<K*D.EO.0.0D0> 0010 99910

f DO I K (LASH
C U l MFUSH(«,3T«F.OFt00E<*>,tT»0l,«J*O2.E«,IF-KASE,
1 INAXS.EMOX)

C TUUSFEI NETUM VALUES TO STIEAN RATIII


IKTl«INT<OPC0DE<5»
IHT2>INrC0K0K(6»

DO 520 I'l.NOS
SUEMUIKTI.D-STKUI)
320 ST«E«t(l«ET2.l).JTt02(l)

C M EMO* CHECKING
GOTO 10000

C NEAT EICUUGEI
C
C SET INLET SMEAM VALUES
400 l«!.|KT(0«0K(3»
IN2'INT(0PCODE{t»

DO 410 I»1,NC«5
Sni1lll*STKM(INI,l)
410 ST(I2(I)«STREM«IN2,I)

C SET IM
UA-0PC0DE(7)

C CHECK FOI ZEIO FEED VALUES


C If SO THEN PASS STREAKS THROUGH WITN NO HEAT EXCHANGE
IF((Slin(NC»1).Ea.0.0D0>.O«.(STil2(NC»1).Ea.0.OD0)} THEN
IIET1'laTCOKOBE<S)>
llET2'tlT(CK0DE(6)>
DO *1S 1-1.»C»5
$IREAH(IREI1,I)*STRI1(I>
*15 SIREAM(IREI2,1)«STRI2(I)
COIO 99910
EMIF

C CALL THE SUMKUTIW


CAll XHC(HC,SIRI1,STRI2,STR01 ,SIM2,UA.EPS. INWS.ERROR)

C SAVE HTUMI VALUES III STREAM MATRIX


IRETI-IIIT(OreaDE(S»
IRET2*UtI<OPC<9E(&)>

00 * » l«1,«C»5
SIREAH<IRET1,l>>STROHI)
•20 STREAMURET2,l)>STR02tI»

C DO ERROR CHECT
GOTO 10000

C REHIIER
C
C SET VALUES FOR INLET STREAM
500 lNI'INTCOPCOOECl))

DO S10 l°1,NC«S
510 STRIMI>>STREAH(llft,l>

C SET VALUE FOR PRESSURE


P=OPC00E(6)

C SET TEMPERATURE
TRB=OPC00E<7)
c CKGX FOR ZERO FEED now
1F'.STRI1(HC«1).EO.O.CM> GOTO 99910

CAll REMIUNC.STRII.STROI.STROZ.R.TRI.SIN.IIIAXS.ERS.ERROR)

C SAVE REIURH S H E W S
IRET1>INT<0PCGDEC4»
IRETZ*IRT(OFCCOEC5»

DO 520 l - l , » C » 5
STREAM IRETZ, 1 )>STROZ< I )
5ZO STREAMURETI.IlsSTMKD

C SAVE THE HEAT REOUIREWHT


IN1T(IMIITS,3XIH

C DO E M C * CHECK
GOTO 10000

C CONOEHSEIt
C
C SET IHLET STREAM
600 IN1«INT(CH>CODC(3»

00 610 M . H O S
610 STRI1(I)'ST«EAM(IH1,I)

C SET THE PRESSURE


P>OPC0OE<5)

C CHECK FOR ZERO FEED FlOW


IFCSTSIKHCfD.EQ.O.WO) GOTO 99910

C CALL THE ROUTINE


CALL COM>ENSE<HC,F,STRI1,STRO1,S0UT,EPS,ERROR)
C SAVE K E I U H STREAM
IRETI'UKOPCODEU))

DO 4 2 0 l»1,HC»S
420 SHEAHdRETI.D'STROICI)

C SAVE MEAT REMOVAL tEOMREMEHT


UKIIIIMI1TS,3)>0QUT

C CHECK F M ERRORS

GOTO 10000

C MIXER
C
C SET INLET STREAMS
700 luuumaraoean
U2'ItfI<OPCCDE14»

DO 710 I>1,NC»5
STRI1CI)<SIREAMCUI1,I)
71!) STRI2CI)>SIREAM{III2,i;

C SET PRESSURE
P>0PC0DE<6)

C CHECK FO> I O I H STREAMS M T H ZERO FLOW


I F « S T R 1 1 ( R C H > . E a . 0 . O D O ) . A I » . ( S T R I 2 ( I K « 1 ) . E a . O . 0 D O ) ; GOTO 99910

CALL N1XER(XC,STRI1,STRI2,STR01,P.IPXASE.EPS.ERR0R)

C SAVE RETURN STREAM


IRET1«INT(0PC0DE(5»

DO 720 I'1,NC*5
720 STREAH(IRET1,l)=STR01(l>

00
C CHECK FOR E M M S
OS
GOTO 10000 00

C SPUTTER
c
C GET INLET SHEW
800 IN1>INTCOPC0DE(3))

DO 810 1-1,NOS
810 STRI1(I)'STR£AM(IN1,I)

C SET FRACTION OF FEED SENT TO OUTLET STREAM 1


FMC1*OPC0DE(6)

C CHECK FOR ZERO FEED FLOW


IF(STRI1<NC»1>.EQ.0.0D0) GOTO 99910

C CALL THE SPLITTER ROUTINE


CALL SPLIT(NC,$TRI1,STR0I,SIR02,FMC1>

C SET RETURN STREAMS


IREII'IRTCOPCCOEM))
IRET2>INTCOPC0OE(5»

DO 820 1»I,NC>5
STREAN(IRET1,I}*STR01{|>
820 STREAH(IRET2,l)*STR02<t>

C CHECH FOR ERRORS

GOTO 10000

c ......
C PUMP
c
C GET INLET STREAK
900 IN1*INT(OPC0DE(3»

DO 910 l'1,NC<5
910 STKMCI >-STREAHtlH1.1 >

C SET OUTLET PRESSURE AND LIOUIO DENSITY


MUT»OPC0OE(5)
«HOH-OPC00E(6)

C CHECK FCC ZERO FEED FlOtf


1F<STRIKNC«1).EQ.O.ODO> OOTO 99910

CALL PUNPCNCSTRII.STROI.nMT.RIKH.ROUER.IHAXS.EPS.ERROR)

C GET RETURN STREAM


IRETI'INTCOPCODECO)

DO 920 l»1,»C»5
920 STREAMIRET1,I)>STR01<1>

C SAVE POWER REQUIREMENT


UHIT(NtJNITS,2)*POUER

C CHECK FOR ERROR


GOTO 10000

C REACTOR
C
C SET INLET STREAKS
1000 IN1-1NT(0PC00E(3))
IN2*INT(OPCODE(4>>

DO 1010 M,M>5
sr»IUI)=STREAK(lll1,l)

00
to
1010 STR1 Z< I >'STREAMC EN2,1}

C SET REACTOR PRESSURE. NEAT AENOVAL, FRACTION CONVERSION, AND RATE CONSTANT O
PAEACT*0PC0DE(6)
aOUT=0PC0DE(7)
FRACT*OPC00E(8)
RK2=OPC00E(9>

C CHECK FOR ZERO FEED FLOWS


IF«STRI1(NC*1>.Ea.0.OD0).AM).CSTRI2<NC*1).Ea.O.0DO» GOTO 99910

CALL REACT0RCNC,STRI1,STRI2,PREACT,Q0UT,STRO1,FRACT,RK2,VREACT,
1 IPHASE.EPS.ERROR}

C GET EXIT STREAM VALUES


lRET1<lNt(OPC0DE<S»

DO 1020 1"1,NC»5
1020 STREAN(IRET1,l)*STROl(l)

C SAVE EXIT HEAT REMOVAL FOR THIS UNIT


UN1T(MMITS,3)*OOUT

C SAVE UNIT VOLUME


UNIT(MNHTS,*)=VREACT

C CHECK FOR ERRORS


GOTO 10000

£*#••**••••*•*••«•*•••*#••••••••*•••*•••••&*•*••••••••••••••••«»*•••*••

C SULFUR SATURATOR
C
C SET INLET STREAN
1100 1N1*INT(OPC0DE(3)>

DO 1110 1=1,HC*5
1110 ST«l1<I)=SfREAH(IH1,I)
C SET TEMPERATURE AND PRESSURE III THE UNIT
TSOL>OPC0DE(S>
PS0L«CPe0DE<6>

C CHECK FOX ZE5C FEED FlOU


I F ( S I « l 1 ( N C * 1 ) . E O . 0 . t O 0 ) GOTO 99910

C CALL THE ROUTINE


CALL SULFSOL(NC,STRM,ST«01,TSOl.PSOl,EPS,ERROR)

C GET THE RETURN STREAM


1RET1*IHT(0PC0DE<4))

DO 1120 l*1,NC»5
1120 STREAX(SRET1,I)>STR01(I)

C CHECK FOR ERRORS


GOTO 10000

CiMtw*WH»w>nrtMw«tWHiiiMimmiH**"»*w»
C SULFUR SETTLER
C
C GET INLET STREAM
1200 IN1'INT(0PC0DE(3»

DO 1210 l«1,NC*5
1210 STRIHI)«STREAN(IN1,I)

C SET VTX SULFUR IK SULFUR EFFLUENT


VTS=OPCODE<£>

C SET PRESSURE
PS=0PC00E<7)

C CHECK FOR ZERO FEED FLOW


IF<STRI1(NC*1>.EQ.O.0OO) GOTO 99910

CALL SETTLER(NC,STRI1,STR01,STR02,UTS,PS,EPS,ERROR)

C GET RETURN STREAMS


IRET1»INT(0PCKE(t»
IRET2*INT(0P0KE<5)>

0 0 1220 I-1,BC»5
STREAM(1RET1,1 )*ST*01< I >
1220 STREAM(IRETZ,I)>STR02<I>

C CHECK ERRORS
GOTO 10000

C SULFUR WASHER
C
C SET INLET SULFUR AM) WATER STREAM
1300 1N1'INT(OPCOOE(3»
1N2«!WT-0PKC5(«»

DO 1310 t>1,NC«5
STRI1(I)'SIREAM(IN1,I)
1310 STR12<I)>STREAH(1N2,I)

C SET SULFUR FRACTION IN SULFUR STREAM AND SET PRESSURE


WTS>0PC0DEC7>
PS>OPCG0E(8>

C CHECK FOR ZERO FEED FLOUS


IF((STSM(liC»1).EO.O.»0).AHO.<STRI2(IIC»1>.EO.0.000)) GOTO 99910

CALL UASHER(HC,STRI1,STRI2,STR01,STR02,PS,WIS,Ef>S,ERROR)

C GET RETURN WASH AMD SULFUR STREAMS


!RE11*INT<0PC0DE<5»
IRET2*1IIT(OPCODEC6)>

DO 1320 M , N C « S
ST»EAH(!«ET1,I>»ST»01(I>
1320 STREAM IRET2,1 )sSTR02U>

C CHECK FOR E M M S
COtO 10000

QHHH*l*aMfllHMWHHMH4«MHtn«MHiHH«4Httt«H*«

C HELTER/DECAHTER
C
C SET INLET STREAK
KOO IN1>1NT<0PC0DEC3»

DO H 1 0 l'1,IK*S
H10 STRIt(l)'$TREAM(IK1,l)

C SEt HELT TEMPERATURE A W PRESSURE


TNELT«0PC0DE(61
PHELT-0PCC0E(7)

C CHECK FOR ZEKO FLOW I* FEED


IF(SIII!1{MC*1>.EO.O.0O0) COTO 99910

CAll NELTDECCNC.STRII.niElT.PNElT.nROl.tlROZ.eiN.EN
1 .ERROR)

C GET RETURN STREAMS


IRET1*INT(Ot>CG0EU)>
1RET2«INI(0PC00E(5))

DO H 2 0 I ' l . H C ' S
STREAH(IRET1,I)<STR0KI>
KZD STREAM(IRET2 I)*STR02(I>
<
C SAVE HEAT REOUHtEMENT
UM!T(HUNITS,J) OI« I

C CHECK FOR ERRORS


GOTO 100OO

C FURNACE
C
C SET INLET STREAMS
1500 IN1'IIIT(Of>CaOEC3>>
!N2-INT(O!>C0t>E(«»
IN3*INT<OPODDE(5»

DO 1510 1 > 1 , K « S
STM1(l)*ST«EMKtN1,l!
STA12(l)'STAEAM(iN2,l)
1510 STAIKD'SiKEMidlO,!)

C SET S02 OUTLET REQUIREMENT


S02REQ>OPOXE(6)

C SET EXIT TEMPERATURE AW PRESSURE


TOUT«OPC00E(8>
POUT«OPC00E(9)

CALL FUAMACE(HC,S02IEO,STAI1,ST»!?,ST»I3,ST»01,TOUT,POUT,OOUT,
1 EPS.ERRM)

C GET RETURN VALUES (INCLUDING THE MAIN SULFUR AW A l « STREAM FLOWS)


l«Eri-INI(0PC0DE<7))

DO 1520 I-1,MC»5
STREAH(IN1,1>*STRI1U>
STREAHCIN],I)*STR13(I)
!5t_' STREAH(IRET1,l)>$TROHI>
C SAVE NEAT REMOVED
IMIT(IMIITS,3>«aOUT

C CHECK FOI ERRORS


GOTO 10000

C iiunH H n»H»H»n«m«~>H>M
l t a mH>nm«« > Hni.

C COMPRESSOR
C
C SET INLET STREAK
1600 IN1>INT(M>CODE(J»

DO 1610 M , N C * 5
1610 STM1<!)-ST«EAM(1H1,I>

C SET OUTLET PRESSURE


POUI-OPCCOE(5)

C CHECK FOR ZERO FEED FLOW

IF(STRIHNC«1>.EO.O.00O) GOTO 99910

CALL COHPRESSOIC.STRl 1 .STH01 .POUt.POUER,INUS.EPS.ERROR)

C GET RETURN VALUES


IRET1>INT(0PC00E(t)l

0 9 1620 l > 1 , K « 5
1620 STXEAN(IRET1,I)>STR01(I>

C SAVE POWER INPUT REQUIRED


tMIT(NUNITS,Z)>POUER

C CHECK FOR ERROR


GOTO 10000

C
C SULFUR CENTRIFUGE
c
C SET INLET STREAMS
1700 IN1'IHI(OPCCSEC3»
IN2'INT(OPCODEU»

DO 1710 l « 1 * C » 5
r

STRI1(I)'STREAH<IN1,I)
1710 STRI2CI)*SIREAII(IN2,I>

C SET PRESSURE
P>OPC0DE(7)

C SET SULFUR WEIGHT PERCENT* III SUIFUI RTSSAHS I I I C H i r l r U G E


SP1-0PCCDE<8>
SP2>OPC0OE<9)

C CHECK FO* STREAMS UITN ZERO FEED FLOU


IF((SIRI1(IIC»1>.EQ.0.0l>0).OR.(STRI2(IK«1).EO.0.D0» GOTO 99910

CALL SULCENTCNC.r.SIRII.STRIZ.STROI.STROZ.SPt.SK.EPS.ERROR)

C GET RETURN VALUES FOR STREAMS


IRET1'INT(OPCODE(5»
IRET2*INT(OPCODE<6»

DO 1720 I ' l . N C t S
STREAHCIRET1.1)>STR01<I)
1720 STREAH(IRET2,1)'STR02<I)

C CHECK FOR EURO* AND DO NEXT COMMAND


GOTO 10000

C PARTIAL CONDENSER
C
C SET INLET STREAK
1800 IN1>INT(OPC0DE(S)>

DO 1810 M,NC»5
UtO SI*IIU)-Sr«E/Ut(l«l,«)

C SET PRESSURE AND TEMPERATURE


PCOND*X>CCDE(*)
TCON0>OPC00E(S>

C CHECK FOR ZERO FLOW FEES


l F ( S T m l ( N C » 1 ) . E O . 0 . O 0 0 ) GOTO 99910

CALL PMCOtedtC.STHII.PCOW.rCONO.JTTOI.SIISCtf.OCItO.EPS,
1 INAXS.ERROR)

C GET RETURN STREAMS


IRET1>INT(OPCODE<6))
IRET2'INT<OPCODE(7»

DO 1820 l>1,NC»S
STREAH(lRET1,i)-STR01(t)
1820 STREAM(1RET2,I)*S1R02(I)

C SAVE NEAT REMOVAL REQUIREMENT


UNIT{MMITS,3)>OCHG

C CHECK FOR ERROR AW DO NEXT OPERATION


GOTO 10000

C HEATER
C
C
C SET INLET STREAK
1900 IH1=INT(OPCXE<3))

-J
DO 1910 l«1,NC«S
1910 STRIHI)*STREAM(IN1,I)

C SET HEAT ADDED


alH<OFCC0E(5)

C CHECK F « ZERO FLOU INLET STREAM

IF(SI*n(NC»1).Ea.0.OD0) GOTO 99910

CALL HEATERWC.STRII.STROMIN.EPS.ERRCR}

C GET RETURN STREAM


IRET1'INT(OPCODE(4»

DO 1920 l>1,NC*S
1920 STREAMIRET1,I)»STR01<I)

C DO ERROR CHECKING
GOTO 10000

Q##ft4ftvrftftAft ftftftft Aftfe Aftftft9 ftt) ft vrft ftftftftftftftftftflftftftftftftftftftft ft fiftft ArftfY#ft ftl

C HAKUP/STORAGE TANK
C FLOU OF COMPONENT I IS SET, OTHER FLOUS ARE SCALED WHILE
C MAINTAINING THE SAME COMPOSITION
C
C SET INLET STREAM
2000 IN1>INT<OPCODE(3»

DO 2010 I-1.NC45
2010 STRIKD'STREAMCNI.I)

C SET FlOU AND COMPONENT NUMBER FOR FIXED FLOW COMPONENT


FLOUIO»OPC0OE(5)
IC0NP*IHT{0PC0DE<6»
T0UT=OPCCOEi7>
MIL STMAGEUC.STRM.STROI.FLOUIO.ICOW.TOUT)

C GET RETURN STREAM


IRET1'INT(OPC0OEC«»

DO 2020 M , N C * 5
2020 STREAH(IRET1,I)*STR01(1)

C DO ERROR CHECKING
GOTO 10000

C CUTSTALLIZER
C SET INLET STREAM
2100 IN1*INT(0PC0OE<3)>

DO 2110 I>1,NC»S
2110 STRI1(I)'STREAM(IH1,I)

C CHECK FOR ZERO FLOW INLET SHEAR


IF(STRI1(NC«1).EO.O.W0> GOTO 99910

CALL CRV$TAL<NC,STRI1,STR0l,EPS,ERR0R)

C GET RETURN STREAM


IRET1>INT(0PC0DE(«»

DO 2120 M . N O S
2120 STREAH(IRET1,I)*STR0MI)

C 00 ERROR CHECKING
GOTO 10000

C SULFUR SPLITTER
C SET INLET STREAM
2200 [Ht=[Hr(OPCOOfc<3))

VO
DO 2210 l»1.HC»5
2210 STM11CI )«Sf KEM4( IH1.1» O
O
C SET FRACTION OF SOLUTION TO TRANSFER TO EXIT STREAM 1 (ALL THE SULFUR
C GOES TO EXIT STREAM 1 )

FRACT1«OPC0DE(6>

C CHECK FOR ZERO FEED FLOW

I F < S I « l 1 ( H O 1 ) . E 0 . 0 . 0 0 0 ) GOTO 99910

CALL SULSPLIT<NC,STRI1,STR01,STtt02,FRACT1)

C GET RETURN STREAMS


1RET1>INT(OPCODE(4>)
IRET2*INT(0?COOE(S))
DO 2220 M , N C « 5
STREAM(IRET2,I)*STR02(I)
2220 STREAH(IRET1,I)>STR01(I)

C DO ERROR CHECKING
GOTO 10000

C MAKEUP • WITH FIXED FLOW OF ONE COMPONENT •• OTHER FCOWS UNCHANGED


C
l SET INLET STREAM
2300 IN1'INT(OPCODE(3»

DO 2310 l-1,HC»5
2310 STRI1(I)>SIREAN(IN1,I>

C SET FLOU AND COMPONENT NUMBER FOR FIXED FLOU COMPONENT


FLOWIO*OPCODE(S>
ICOHP=INT(0PC0PE(6»
CAll KAKEUPCNC.STRII.STROI.FLOUIO.ICmP.IMMS.EPS.ERftOH

C CET RETURN STREAM


IRET1«lNT<0t>CCOE(4))

DO 2320 I»1,NC»5
2320 STREAH(IRET1,I)'STR01(I)

C DO ERROR CHECKING
GOTO 10OOO

C TSET - SET TEMPERATURE OF A STREAM AND CAICUUTE THE ENTHALPY CHANGE


C
C SET INLET STREAM
2400 IN1'INT(OPC0OE<3»

DO 2410 l « M C « S
2410 STRI1(I)'STREAN(IN1,I)

C CHECK FOR 2ERO FLOW IN FEED


IF(STRI1(NC»1).EO.O.0OO> GOTO 99910

C GET DESiRED TEMPERATURE


T-OPCOCECJ)

C DO THE OPERATION
CALL TSET<HC,STRM,STA01,T,OCHG,IKAXS,EPS,ERROR)

C GET RETURN STREAM


IRET1*INT(0PC0DE(4))

DO 2420 I»1,HC»5
2420 S T R E W ! RET 1,I)«STR01(])

C SAVE HEAT CHANGE REQUIREMENT


UN1T(MM1TS,3>>0CHG

C DO E M O * CHECKING
GOTO 10000

C HCSPLIT • SPLIT HVDROCAAIONS FROM A STREAM


C

C SET INLET STREAM


2500 IN1>INT(0PC0DE(3»

DO 2510 l ' I . N C + 5
2510 STRI1«U'STREAH(IN1,I>

C CHECK FOR ZERO INLET FLOW


IF<STRI1(NC*1).Ea.0.D0; GOTO 9 W 1 0

C PERFORM THE SPLIT


CALL HCSPLIT(NC,STRM,STR01,STR02)

C GET RETURNED STREAMS


IRET1»1KT(OPCODE«)>
l«ET2»INT(OPC0OE(S»

DO 2520 l»1,KC*S
STREAM!IRET1,I>*STR01(I>
2520 STRE*M(tRET2 l)«STR02(l)
I

C PERFORM ERROR CHECKING


GOTO 10000

CM********************************************************************
C UNIT NOT EXECUTED DUE TO ZERO FLOW IN ONE OR MORE INLET FEEDS
C FLAG THE ERROR FOR THE OPERATOR
99910 ERR0R«1O

C BOTTOM OF OPERATION CODE LOOP


C CHECK FOR AN ERROR ON THE PRESENT OPERATION
C
C CHECK FOR CONVERGENCE ERRORS

10000 IFtEMOR.EO.I) THEN


WRITE<6,20100) OPC0OE(2)
WRIT5(1,20100> 0PCODE(2)
ENDIF

C CHECK FO* NIXED VAPOR AND LIOUID STREAK


IF(ERR0R.E0.2> THEN
URITE(6,20200> 0PC0DE(2>
URITEO,20200) 0PC00E(2)
EHDIF

C CHECK FOR SINGLE PHASE STREAM RETURN FROM A FLASH CALCULATION


IKERKOft.EO.J) THEN
WRITE(6,20300) 0PC0DEC2)
URIIEd,20300) 0PCODE(2)
ENDIF

C CHECK FOR UNIT NOT EXECUTED ERROR


1F(£RROR.E0.10> THEN
UR1TE(6,2032S) 0PCODE(2>
UKITE<1,20325) OPCODE(Z)
ENDIF

C CLEAR ERROR
EBROB=0

C GO OH TO HEX1 UNIT OPERATION


MITE(6,f0000)
90000 F0RNAT(X,'NOW LEAVING ERROR CHECKER') 1-"
O
GOTO SO

C WTTCM OF MAIN PROGRAM LOO?


C CHECK FOR CONVERGENCE

15000 1TER*IIER«1
ICWEGS'lCUEGStl
ICOUNT>IC0UNT*1
MtlTE(6,25020> ITER
W I T E ( 1 , 2 5 0 2 0 ) ITER
25020 FORHATC NOW INCREMENTING THE ITERATION COUNT, I T E R " ' , 1 3 )

C CHECK CONVERGENCE ON A l l STREAMS HOLE FRACTIONS, FLOW, AND TEMPERATURE


DO 15100 l*1,NSTREANS
00 15100 J>1,NC«3
I F ( $ T « E t M ( I . J ) . L 1 . 1 . 0 D - B > GOTO 15100
IF(DABS((STREAM{l,j)-$TR0tD<l,J))/STREAH(l,J».GT.EPSILaD THEN
GOTO 15200
END IF
15100 CONTINUE

C FELL THROUGH LOOP, NUST I E CONVERGED


GOTO 15500

C NOT CONVERGED, SET UP NEXT ITERATION


C PRINT CURRENT RESULTS

C SHOU USER WHICH STREAM VAKIAILE I S NOT CONVERGED


15200 URITE<6,20515) I,J
WRITEM,20515) !,J

C PRINT CURRENT RESULTS ON FIRST ITERATION AND EVERT FIFTH THEREAFTER


IREH<ttOD(lTER,5)
IF((I*EN.E0.0).C«.(ITE«.Ea.1l) THEN

C URI!E<6,20500>
MtlTE(1,20500)
DO 15205 I'l.NSTREAMS
C URITE(t,20510> I,(STREAM!,J>,J>1,NC»5>
1920$ WR1TEO,20510) l,<STIIEAM(l,J),J>1,NC<S)

ENOIF

C SAVE AIL STREAM VARIABLES


IFCITEN.LT.INAX) THEN
DO 15210 M.NSTREANS
DO 15210 J»1,N03
15210 STROLD(l J)-STREAM(l,J>
>

C SAVE COMPONENT FLOUS FOR UECSTEIN ACCELERATION


IFUITER.EQ.2).OR.(ICUEGS.EQ.2» THEN
DO 15215 l>1,NSTREAMS
DO 15215 J>1,NC
15215 FLOU(l,J,1)'SIREAM(l,J)*St«EAK(l,NC*1)
ENDIF

IFMITER.EQ.3).OR.(ICUEGS.E0.1» THEN
00 15220 M.NSTREANS
DO 15220 J«1,NC
15220 FL0W(I,J,2)>STREAN(I,J>*STREAN(I,KC*1>
ENDIF

C AT THE END OF THE THIRD AND SUBSEQUENT ITERATIONS HECSTEiN


C ACCELERATION IS APPLIED TO ALL OF THE COMPONENT FLOUS
C THIS IS ACCOMPLISHED BY:
C VM-qfO-qllc^
C
C q • l* M • »' M*'
k M • 2\ • x^.,)

o
Ol
C WERE:
C THE SUBSCRIPT INDICATES THE ITERATION MJMER
C A SUPERSCRIPT • IHDICATES A VAIUE CHAINED FROM A DIRECT SUBSTITUTION
C CALCULATION OVER THE FLOWSHEET
C
C ACCELERATION GENERALLY PRODUCES CONVERGENCE W E N Q<0.5
C ON ENTRY TO THE ACCELERATOR ROUTINES
C FLOU(l,J,1) » xj , (VALUE OITAINED FROM THE K-1 TH ITERATION) (XPM1)

C FL0U(I.J,2) • Xg (VALUE OITAINED FROM THE K TH ITERATION) (XP1)

C FLOU(l,J,3) • X,. (INPUT VALUE TO THE K TN ITERATION) (Xt>

C ST«EAH(I,J) • X ^ , (VALUE OUTPUT FROM THE K*l TN OR CURRENT ITERATION) (XPPI)

C CONVERT STREAM MOLE FRACTIONS TO COMPONENT FLOWS (THIS SIMPLIFIES THE


C MEGSTEIN CALCULATIONS AND IS HEEDED FOR RE-NORMALIZATION AFTER ACCELERATION)
DO 15225 I«1,NSTREAMS
DO 15225 J»1,HC
15225 STREAM(l,J)<STREfN(l,J)*STREAM(i,K*n

C PERFORM ACCELERATION

IF((ITER.GE.«).OR.(ICUEGS.GE.«)) THEN
DO 15230 l-MSTREAHS
DO 15230 J'l.HC
KWLOU(l,J,J)
IF((ITER.EO.«).OR.(ICWECS.EO.«)> THEN
XWU»(I,J,2)
EHDIF
XPM1<FL0U(I,J,1)
XP1'FL0V(I,J,2)
XPPI>STREAN(1,J)
DN0miXPP1-2.D0«XP1»XPM1
IF(DNCm.LT.I.D-IO) GOTO 15235
Q>(XPP1-XP1)/DH0Ha
IFCO.CT.0.500) GOTO 15235
STREAM I, J)*0*KU( 1 .D0-Q>*KPP1
IF(STREAN(l,J).lT.O.ODO> THEN
STREAN(I,J)'STROIO(I,J)*STROIO(I,NC«I)
ENDIF
15235 FLOWU.J.IJ'XPI
FL0UCI,J,2)*XPP1
FLOU(I,j,l)'STREAN(l,J>
15230 CONTINUE

C CONVERT UECSTE1N COMPONENT FLOW UPDATES 1AOC INTO HOLE FRACTIONS


C RECALCULATE TOTAL FLOU

DO 15221 M.NSTREAMS
STREAN(I,NC*1)>0.000
DO 15221 J'l.NC
15221 STREAM(MC*1»*STREAM(I,NC»1)«$TREAIUI,J)

DO 15222 M.NSTREAHS
IFCSTREAHd.NC+D.EO.O.OO) GOTO 15222
DO 15222 J'l.NC
STREAM!, J)'STREAH(I,J)/STREAM(I,NC*1)
15222 CONTINUE

ENOIF

C CHECK FOR ITERATION COUNT STOP CODE, I.E. OKODE(1)«-N.O


15219 IF((OPC00E(1).LT.0.OD0KAND.(IASS(INT(OPCODE(1)».LE.ITER>)
1 GOTO 15500

ENDFILEd)
BACKSPACEO)

C CHECK FOR HAXIHUN ITERATION FOR THIS INVOCATION OF BERKSULF


IF((ICOUHT.CT.ICMAX).AHD.(IT6R.lT.IHAX)) THEN

O
•J
C CLOSE THE NORKAL OUTPUT FILE
CLOSE(I)
C SET E M OF FILE MARKER FOR STREAMS
STREAMNSTREMtS«1,W:*1)«-1.00
C OPEN THE TEMPORARY STORAGE FILE M O M I T E OUT THE STREAMS DATA
,
OPE«(*,FH.f ST«EAKS.tNf)
URITE(4.*> ITE«
00 15500 l«1,NSTRE*MS«1
UIITEU,20505) (STREAM(l,J),,l-1,NO
1J300 UIUTEU,20507) <ST«E«K(I,J>.J-KC»1,»C«5)
CLOS£(*)

C SAVE THE ACCELERATION AARAT


0PEN<9,FIIE«'I*GST")
oo ISIIO M.NSTREAMS
DO 153t0 J»1,NC
15110 URITE<9,*> (FLOU(l,J,r>,r-1,3)
CL0SEC9)
STOP
EWIF

IF(lTEt.lT.IHAK) GOTO 40

C SHOW THAT IT 010 NOT CONVERGE


URITE(6,2MO0)
VRITE(1,20M»)

C ALL DONE, CONVERGED ON NOT


C PRINT ALL THE RESULTS

C PRINT OUT All THE STREAKS


C ALSO SAVE DATA IN A DISK FILE
,
155O0 0PEH(3,FHE* UNI10UT.0AT')

URITE(6,20500>
W I T E d , 20500)
DO 15510 I>1,NSTREAHS
URITEC1.20510) l,(STREAH(l.J),J«t,NC»5)
15510 MUE(6,20510) 1,(STREAHC1,J),J*1,M>J)

DO 15515 M.NSTREAHS
15515 URITEd,20525) I,(STREAN(l,M>1>-STROLDU,NC«1»

URITE(1,20520) ITER
MtlTE(6,20520) ITER

C PRINT OUT THE POWER AND HEAT VALUES ASSOCIATED UITH UNIT OPERATIONS
URITE(6,206O0)
WRITE(3,206O0)
DO 15520 I>I,NUNITS
WRITE(3,Z0610) (UNi:<I,J),J»1,*>
15520 UKITE<6,20610) (UNITd.j),j>1,4>

CLOSE(I)
CLOSEU)

C WRITE OUT THE FINAL STREAMS VALUES IN CASE UE UISN TO USE THEN
C AGAIN
C ALSO OELETE THP FILE
>
OPEK(« riLE> STREAM$.THPi)
t

CLOSE(4,StATUS.'DELE1E')

C GET RID OF EXISTING FILE


1
OPENM.FILE^STREAMS.OID )
, l
CLOSEK,STATUS> DELETE )
c
OPEH(4,FILE*'STREAHS.OlD >

C SET UP PHONT ITERATION COUNT AND SAVE THE STREAMS VALUES


ITER'1
URITEC*,*) ITER
DO 15600 1*1,NSTPEAHS+1
WRITE(«,20505) (STREAH(I,J),J'1,NC)
15600 URITE(«,20507) (S!REAH(I,J),J^NC*1,HC*5)
ClOSE(t)

C AIORT KRKRUN
C A l l IEKKSTOP

STOP

C VARIOUS FORMAT STATEMENTS


19950 FORHAT(X,'NOU INITIALIZING STREAK NUMER ',12)
20000 FO»HAT(1X,'FLOWSHEET ITERATIW • ',13,' OPERATION NOU • ',
1 F5.2)
1
20010 FORHATCX,'ERROR! STREAM ',13,' SHOULD K IIOUID )
20020 FORKATCX.'ERRORI STREAM ',13,' SHOUIO IE A VAPOR')
20030 FORMAUX.'IKANIHGI STREAM ',13,' CONTAINS BOTH VAPOR AND
1 MSUIO')
20100 FORKAT(X,'ERRORI NON-CONVERGENCE ON UNIT \F10.2)
20200 FORKATCX.'UARHINGI MIXED IIOUID AND VAPOR STREAM RETURNED IT
1 UNIT >,F10.2>
20300 FORHATfX.'VARNINGI SINGLE PHASE RETURNED IT A FIASH
1 CALCULATION ON UNIT \F10.2)
2032! FORMAT(X,'UARNINGI OPERATION NOT PERFORMED DUE 10 ZERO FEED
1 ON UNIT '.F1Q.2)
20400 FORHAT(1X,'THE SIMULATION DID MOT CONVERGE')
20500 FORHATdX, 'ST*' ,X,3X, 'S01V',3X,3X, 'H20',«X,5X, 'B2S',«X,3X.'S02',
,
1 4X,3X,'SULD',3X,JX,'C02',*X,3X,'N2',5X,3X,'C1'.5S.3.V"2 ,5X 1

2 3X, 'CO',5X,3X. 'C2>,5X,3X, 'CJ',5X,3X, 'C4',5X,3X, 'C5»«,<X,


l
3 3X,'C1SH',3X,3X,'C2SN',3X,3X 'SUlP',3X 3X,>H20P' 3X 3X,'OZ ,
> ( ( >

* 5X,3X,'UNW,3X,3X,'FLOW',3X,5i(,'TEW",SX.SX.'PRES'.SX.SX.
5 'ENTH',5X,«X,'PKAS')
20505 FORNAT(1X,20(D11.6,X»
20507 FORKAT<1X,5<DZ0.10,X»
20510 FORKAH1X,13,X,23(09.4,X),015.9,X,F4.1)
20515 FOSHAKX, 'HOT CONVERGED, STREAM>',I3,' VARIAiLE*',l3)
1
20520 FORNAT(X,' ITERATION COUNT' ,13)
20525 FORMAT(X,'STREAN<>,I3,' DELTA FLOU*',D2G.10>
20600 FORHATC1X, 'UNIT', 17X,'POWER',24X, 'HEAT', 24X, 'SIZE')
20610 FORHAT(1X,F4.1,7X,D20.10,7X,D20.10,7X,D20.10)
Ill

s
;BERCSTOP

FORTRAN CALUILE SUUOUTINE TO ABORT THE PROCESS SERCRUN.CW


TNIS ROUTINE IS CALLED UHEN SERKSULF HAS CONVERGED
IT STOPS THE REPEATED INVOCATIONS IT BERKRUN

LAST UPDATE: M/2S/86

WRITTEN III DAI R « ! E 4 Vt» 1.2

EQUATES
CCPN EOU 224 ;STSTEH CALL ENTRY

P.PDADR EOU 1S6 ;GET PD ADMESS


ABORT EOU 157 .•ABORT SPECIFIED PROCESS

P CHS EOU I T I E PTR 20H .•CONSOLE MJMIER IN PD

CSEC
PUBLIC BERKSTOP

SERKSTOP:
PUSH OS
PUSH ES
NOV AK.SEG API .•POINT TO A M t T PARAMETER SLOCK
NOV DS.AX ; SEGMENT
HOY CL,P_P0tt» ;CET THE PD ADDRESS OF BERKSULF
INT CCPN
NOV SX.AX
NOV SL,ES:P_CNS(SX] .•LOOK UP CURRENT CONSOLE NUMBER
NOV CHS,11 ,-SAVE IT IN BLOCK
NOV Cl.ACORT .•ABORT BERKRUN
NOV OX,OFFSET API
INT CCPN
PC? ES
POP DS
RETF .•RETURN TO IERKSULF
DSEC
API DU 0,0 ;ABORT PARAMETER BLOCK
CHS III 0,0 .-CONSOLE FIELD
DB 'BERKRUN '

END
SUBROUTINE AISORRERCNSTAGf ,NCOMP,»,FEED,Z/EED,VL:aT,RHOM,
1 R2£ONST,QR,OI,TC,FS,STVAP,SH10,!;?llQC,INAX,HCSUI,UNIT,
2 IOFLAG,ITKEY>

C LAST UPDATE: 6/10/B6

THIS ROUTINE PERFORMS STAGE TO STAGE CALCULATIONS FOR AISORRERS


STRIPPERS, AND DISTILLATION COLUMNS

MAJOR VARIAILES:

FEED • STAGE *, FLOW, A W ENTHALPY OF THE FEEOS TO THE


COLUMN (MAX. NO. OF FEEDS • 5) FROM THE MAIN PROGRAM
{FEED • FEED COMPOSITION

VARIAILES USED IN NEVTON-AAPHSOH STAGE TO STAGE CALCULATIONS:


F • FLOU AND ENTHALPY Of FEED TO EACH STAGE
ZF • COMPOSITION OF FEED TO EACH STAGE
T • TEMPERATURE ON STAGE J
V > VAPOR FLOU FROM STAGE J
L • LIQUID FLOW FROM STAGE J
X > LIQUID PHASE COMPOSITION ON fTAGE J
Y • VAPOR PHASE COMPOSITION ON STAGE 4
K • EQUILIBRIUM CONSTANTS FOR STAGE J
HL • LIQUID MOLAR ENTHALPIES FOR STAGE J
HV • VAPOR MOLAR ENTHALPIES FOR STAGE 4
OKDT • DERIVATIVES OF K UITH RESPECT TO T
DHLDT • DERIVS. CF HL UtTH RESPECT TO T
DHVDT • DERIVS. OF HV Ulfti RESPECT TO T
R • KOLAR EXTENT OF REACTION
<*K2*CS02*CH2S AT EXIT CONDITIONS)
OH • HEAT ADDED OR REMOVED ON STAGE J
RS > SIDE DRAW ON STAGE J
XH2SRKN « EXIT H2S HOLE FRACTION ON A STAGE
XS02RXN ' EXIT S02 HOLE FRACTION ON A STAGE
(THESE LAST TWO ARE USED IN THE REACTION SOLVER)
c
c
C NOTES: ALTHOUGH THE MAIN PROGRAM SUPPORTS 20 COMPONENTS,
C THE MAXIMUM HANDLED RT THIS SUStOUTINE IS 15. IF COMPONENTS
C 16-20 M E TO CONSIDERED IN THE CALCULATIONS THIS CODE KILL
C NEED TO RE CHANGED. HOWEVER, THE NUMBER OF STAGES UILL HAVE
C TO RE REDUCED IN ORDER TO KEEP THE MAXIMUM NUMBER OF VARIABLES
C IN EIND TO 8000 (SEE RAND)
C

IMPLICIT REAL'S (A-H.O-Z)

REAL'S FEED(5,4),ZF£ED(5,20),F(23,J>,ZF(23,1S)
REAL'S T(23).V(23>,L(23),X(23,15),Y(23,1S)
REAL'S K(23,1S>,HL(2I,15),HV(23 15) I

REAL'S DKDT(23,1S),0HIDT(23,1S>
REAL'S DHVDT(23,15),R(23>
REAL'S XH2SRXN(23),XS02RXN(23)

C THE FOLLOWING ARRATS ARE USED FOR INITIALIZING ALL STAGE VARIABLES
REAL'S KEa<20>,DKEWTC20),HLIQ(20),KVAP(20>
REAL'S DHLIODTC20), DKVAP0T(20>, XTEMPC20)
REAL'S YTEHP(2C>,FLTEHP,FT(20)

C THE FOLLOWING ARE USED IN THE THOMAS CALCULATION

REAL'S U ( 2 3 > , « ( 2 3 > , a ( 2 3 ) , A B ( 2 3 , 1 5 > , B B ( 2 3 , 1 S ) , D B ( 2 3 , 1 5 >

REAL'S STVAP<25>,STLia(2S),STL!K<25)

REAL'S 0H(23),RS(23>

REAL'S 0 1 ( 2 , 2 )

REAL'S ABHD(18,18),8BH0(18,18),CBND(18,25),0BHO(18,]7>
REAL'S GBND(18),XBN0(18,1B),rBH0(18,16)
CHARACTER*11 FNAME.PNAME

MTEGER'2 ALPHA(ZO)

COMHON/ALPH/ALPHA

COMHOH/SHD/ AINO.IHn.CtNO.DBHO.GBHD.XBND.TtM),
1 NVAR.NJ

EXTERNAL SULFUR

C 5.KJU NO ERROR OB DISK 10


IOERR'0

C SET UP ADO OPEN OUTPUT FILES FOR THIS CALCULATION


C ABSORBUX.YZ IS A HUMAN READABLE PRINTOUT OF THE RESULTS OF
C THE CURRENT CALCULATION
C PROFIEUX.VZ IS A COMPRESSED FORD OF THE SANE TO BE USED AS
C A SET OF GUESSES FOR THIS UNIT ON THE NEXT ITERATION OF
C THE FLOWSHEET

I1*INT(UHIT/10.DO)
12*1NT(UNIT-I1*10.DO)
I3>INT(10.D0*(MIT-I1*10.D0-12»
I4'INT(100.DO*<UNIT-I1*10.DO-I2-FLOAT(I3)/10.CO)>
I 1
FNAME* ABSC*R'//CHAR(I1«4S>//CHAR<I2»M)//'.
t //CHAR(l3»«a)//CHAR<UHS)
PHAME»'PROFLE>//CHARU1«t9)//CHAR<l2»«)//'. I
1 //CHAR<I3»«B)//CHA«<KH8)

OPEH(10,FILE*FN«ME)
CLOSE(10,STATUS.'DELETE')

OPEN(10,FII.E*FNAME)

C SHOW ENTRY PARAMETERS


URITEC«,9345&> ITtET.NCSUB
93*56 F0RHAT(X,'IUET-',I3,' NCSUB»>,I3)

VR1TE(10,50000) RZCONST.VLIOT.RHCM
,
50000 FORKATC K 2 - ' , F 6 . t . ' V T « A Y « . F 6 . « , ' «»«.•',F5.2J

U«ITE<10,50001) GR.TC.FS
URITE<6,50001) <M,TC,FS
> > 1
50001 F0RKAT(X, OR>',D12.S, IC-'.tt.Z, FS-',F5.3>
IMAXA«100

C-INITIALIZE THE RETURN VALUE HATH ICES


DO 10 M,NCOHP»J
STVAPCD'O.ODO
SUIQ(IJ«0.ODO
10 STLIOCCD'O.OOO

C-SET UP INTERSTAGE COOLER/HEATER VALUES AND SIOEDRAU FIACTIONS


DO 15 M.NSTAGE
OH(I)*O.ODO
15 RSCD'I.OOO

C FIND INTEKSTAGE COOLERS/HEATERS IN USE AND FILL THEN IN


C THE MATRIX 01 CONTAINS STAGEf, NEAT REMOVED FOR EACH
C INTERCOOLER/HEATER IN USE

DO 20 1*1,2
ISTGE'INHOMI.I)}
C CHECK FOR ILLEGAL OR NON-EXISTENT STAGE
IF((ISTGE.Ea.0).OR.(ISTGE.GT.NSTAGE» GOTO 20
OH(ISICE)=01(I,2)
20 CONTINUE

C REBOILER
0H<1)=0R

C SIOEDRAU AT COHDENSER
RS(NSTAGE)>1.D0-FS

C SET MAXIMUM NUMBER OF COMPONENTS FOX SUBROUTINE


NC0MPOLD«NC0MP
NCOHP'NCSUI

C-SET NUMBER OF VARIABLES AND NUMBER OF INCREMENTS FOR BAND


NVAR'NCOHP+3
NJ'NSTAGE

C- NOTE THAT THIS PROGRAM DOES THE CALCULATION FROM THE BOTTOM UP
C- I.E. J>1 IS AT THE VAPOR IHLET OF THE COLUMN

C- SET FEED VALUES FOR All STAGES. USE MATRIX FEED TO DETERMINE
C- WHICH STAGES ARE TO HAVE FEEDS. IF FOR A GIVEN I THE VALUE OF
C- FEEDd.Z) IS NON-ZERO THEN THE STAGE NUMBER IS CIVEN BT FEED(I,1>.
C- THE COMPOSITION OF THE FEED IS GIVEN IN ZFEED(I.IX).
C
C- THE FORM OF THE FEED MATRIX IS FEEDI BY STAGE,FLOU.TENP,ENTHALPY
C- THE FORN OF THE ZFEEO MATRIX IS FEED! BT NCOMPONENTS
C
C- ALL THE FEEDS EXCEPT THE VAPOR ON TRAT 1 ARE ASSUMED TO IE LIOUIDS

C- ZERO THE FEED MATRICES


DO 190 l«1,NSTAGE
DO 180 J'1,3
180 F(!,J)«0.000
00 190 J'l.NCOHP
190 ZF(l,J)«0.ODd

C- FIND FEEDS ACTUALLY IN USE AND SET INTO FEED MATRICES


DO 200 J'1,5
IF (F6EO(J,2).EO.O) GOTO ZOO
C- FOUND A FEED. TRANSFER ITS CONTENTS TO THE APPROPRIATE SPOT
C- IN THE F MATRIX FOR THE COLUMN
ISTAGE»INT(FEED(J,1)>
DO 210 1-2,*
210 F(ISTAGE,t-1)>FEED(J,l)
DO 220 M . N C O H P
220 ZF(1STAGE„I)*ZFEED(J,I)

200 CONTINUE

C WRITE OUT THE CURRENT FEEDS AND LOCATIONS


DO 50010 I-1,NSTAGE
MtIIE(10,S0020) CF<I,JK).JK-1.3>
50010 MITE{6,50020) (F(l,Jlt),JI»1,J)
50020 FORHATCX,'F<FLOW)* ',012.5,• FCTEHP)> ',F6.2,
1 • F(ENTHAIPT)> ',012.5)

C- FOR FIRST TIME THROUGH THE FLOWSHEET


C- SET INITIAL GUESSES FOR All T, V, I , AND X'S
C- SET ALL T'S TO AVERAGE OF ENTERING IIOUID T'S
C- SET All V'S TO ENTERING VAPOR FEED (ARSORPTION) OR L AT MTTON (DISTILLATION)
C- SET All I'S TO ENTERING IIOUID PLUS FEEDS
C- SET All X'S TO THOSE IN THE EHTERING LIQUID CORRECTING FOR AHT SICE FEEDS

C O M SUBSEQUENT TRIPS THROUGH A FLOWSHEET USE THE PROFILE OBTAINED IN


C-THE PREVIOUS ITERATION FOR THE INITIAL GUESSES

270 CONTINUE

IFUOERR.NE.O) THEN

C- ZERO TEMPORARY FLOW VAIUES FOR EACH COMPONENT AND THE MAIN LIQUID STREAM

FLTEHP'O.ODO
DO 280 IX'I.NCOHP
280 FrCIX)=0.000

C- ITERATE FROM THE TOP DOWN


DO 300 JMSTAGE,2,-1
V(J)*F<1,I>
1(J>«FITEHP«F(J,1)
FLTEMP«l(J)
DO 300 IX'I.NCONP
C- UPDATE COMPONENT FLOUS
FT(IX)-FT(IX)»F(J,1)«ZF<J,1X>
XCJ,IX)«FTCIX)/FITENP
300 T(J,IX)'ZF(1,IX)

C-SET VALUES FOR STAGE 1 , ADD A SMLL AMOUNT OF THE VAPOR TO THE LIQUID STREAM
V<1)"F<1,1>
l(1)>L<Z)*0.U0*f(1,1)
DO 302 IX>1,NCOMP
FT(IX)«FT{IX)«0.1D0*F(1,I)*ZF(I,IX)
X(1,IX)'FT(IX)/l(1>
302 T(1,!X)>T(2,IX>

C-SET TEMPERATURE PROFILES U S E D ON FEED TEMPS {ASSUME EQUAL HEAT CAPACITIES)


T(NSTAGE)'F<*STAGE,2>
DO 301 ONSTAGE-1,1,-1
30S T(J)-a{J»1)*T<J*1)»F(J,1)«F»J,2))/<L<J«1)»KJ,1»

CMOOIFT GUESSES FOR A DISTILLATION COLUMN

C-SET AIL VAPM FLOUS -- ASSUME TOTAL REDOUER


IF(F(1,1).EO.0.D0) THEN
DO 30* J*1,NSTAGE
V(J)»L(1)
DO 3 M IX>1,NC0MP
3M T(J,IX)>X(1,1X)
ENDIF

C-SET LIQUID FLOWS AND TEMPS FOR STAGES ABOVE THE FEED
C-PROPAGATE THE FLOUS UP THE COLUMN -- ASSUME INFINITE REFLUX
IF(F(NSTAGE,1).EQ.0.D0) THEN
DO SOS J i t . N S T M E
I F ( K J ) . N E . O . D O ) GOTO 305
KJ).V(KSMGE)
DO 305 IX'I.NCOHP
X(J.IX)>T(NSTACE,IX)
JOS CONTINUE

C-FIX TEMPERATURE PROFILE


T<XSTAGE)'F(NSTAGE,2>
DO 304 ONSTAGE-1,1,-1
I F ( T ( J » l ) . E a . 0 . 0 0 0 ) THEN
T(J)>F(J,2)
ELSE
T<J)«Cl(J»1)*T(J»1)«F(J,1)«F<J 2))/<L{J«1>«FCJ,1))
c

ENDIF
306 CONTINUE
DO 307 J«2,NSTAGE
IF(T(J).ME.O.O0) GOTO 307
T(J)»T(J-1)
307 CONTINUE
EHDIF

ELSE
C-READ PROFILE FROM PREVIOUS TRIP THROUGH THE FLOWSHEET AS GUESSES
C-FOR THIS ITERATION
C-IF AN ERROR OCCURS THEN GUESSES ARE HADE AS ON THE FIRST ITERATION

IF((IOFLAG.EO.O).AND.(ITICEr.E0.1» THEN
!OERR>-1
GOTO 270
EDO I F

OPEN(11,FILE*PHAHE,IOSTAT«IC€RR,ERR>270)
DO 308 J»1,HSTAGE
READdl,70000,IOSTAT>IOERR,ERR'309,ENO*307) T(J),V(J),l(J)
REAM 11,70030,IOSTAT'1OERR,ERR*309,EM»3O9) (X(J,IX>,IX>1,NCCMP>
308 BEAD(11,70030,IOSTAT'IOERR,ERR*309,END*309> (T(J,IX),IX'1,NC0HP)
C-OELETE THE OLD PROFILE I-"
3C9 CLOSEMI.STATUS-'DELETE ) 1 ro
to
IF(IOERR.Ea.-f) GOTO 270
ENDIF

C- SET ITERATION COUNTER (MAX. OF TEN ITERATIONS)


ITER'O

C-SET CONDENSER TEMPERATURE IF SPECIFIED


IFCTC.NE.O.ODO) THEN
T<NSTAGE)'TC
ENDIF

C- MAIN OUTSIDE ITERATION LOOP

1000 CONTINUE

C- DO CALCULATION FROM TKS ROTT0M OF THE COLUMN UP


DO 320 J'l.NSTAGE

C- CALCULATE ALL VALUES FOR K,M.,HV D«DT,DHLDT,DKVDT


>

C- CALCULATE VALUES AT EACH J, USE HEAT AND KVAL SUBROUTINES


C- SEE SUBROUTINES FOR ARGUMENT USAGE. NOTE THAT HT IS THE TOTAL AVERAGE
C-HOLAR STREAM ENTHALPT.

C- SET TEHPORART MATRIX OF ALL X'S AND T'S FOR USE IN THE SURROUTINES
C- USE CURRENT K VALUES TO CALCULATE T'S. USE NORMALIZED MOLE FRACTS.

XSUM-0.000
TSUH'O.ODO
DO 310 IX*1,NC0MP
TSUH:VSUH»T(J,IX>
310 XSUH-XSUH»X(J, IX)

DO 330 IX=1,KC0HP
XIEHP(1X)'X(J,IX>/XSUN
330 TTENP(lX>*V(J.IX)/rSUN

CALL H £ A r ( 0 , l . « C O H P , T ( J ) , P , X r e W > , H l i g , H r j
CALL HEATH, 1 ,NCOHP,T(,I>,P.XTENP,OH1100T,HT>
CALL HEAT(0,2,NCOW>,T(,)),P,TTEM>,KVAP,HT)
CALL HEATC1,2,NCCMP.TC.I),P,YTEMP,0HVAPIIT,HTI

CALL KVALO,NaMP,T<J>,P XTEHP YTEM>,KEQ) ) >

CALL KVAL<1,NCOMP,TU>,P,XrEMP,YTEHP,DKE0DT)

DO 320 IX't.NCOMP
HL(J,IX>'HLlaiiX)
HVCI,tX)'KVAPCIX)
DHLDT(J,IX>>DHLlaDT(IX)
DHVDT<J,!XM>HVAPDT(IX>
K(J,!X)=XEQCIX>
320 DICDTtJ,IX)±OKEQDT(IX)

U«ITE<6,51000>
1
51000 FOftHATO!, PAST THERMO I H I f • , / >

C HCOIFT INITIAL SUESSES FOR COMPONENT BALANCES USING THE THOMAS


IFCITEN.EQ.O) THEN

DO 450 J*2,HSTAGE
DO 450 IX'I.NCOMP
AKJ.!X)«KJ-1,IX)*V(J-1)/l(J-1)
H(J,IX)>1.0DD»<K(J,1X>*VCJ»/I(j)
450 D8(J,IXWF(J,IX)«F<J,1)

DO 455 IX«1,NC0NP
DB(I,IXWF(1,IX>*F<1,1)
BB(t,U)*1.0DO*{K(1,IX>*V(1»/L(1>
455 AS(1,IX)'0.0D0

C CARRY OUT THOMAS CALCULATION FOR EACH COMPONENT


DO 490 IX'l.NCOHP
U(1)i|l(1,IX>
GCIMHHI.KI/UM)
Q(1)»-1.0/U(1)

DO 460 J*2,NSTAGE
U(J).|I(J,IX)-AB(J,IX)»0(J-1)
G<JWDKJ.IX>-»a<J,IX)'G(J-t»/U<J>
QU>-1.0AI(J)
Q(NSTAGE)>O.0DO
X(NSTAGE,IX)*G(NSTAGE1/KNSTAGE)
FL'G(NSTAGE)
DO 490 J.MSTAGE-1,1,-1
FL«G(J)-0(J)«FL
. X(J,IX)»FL/l(J)

!TER*ITER*1

GOTO 1000
ENDIF

C IF THE SECOND OROER RATE CONSTANT IS NON-ZERO


C SOLVE M S S IAIANCE EQUATIONS FOR N2S AND S02 HOLE FRACTIONS ON EVERT
C STAGE. INCLUDE EXPLICIT REACTION DEPENDENCE.

IF(RZCOHST.EO.O.DO) GOTO SOI

C SET VARIABLE COUNT AND ZERO ITERATION NUMBER


NVAR'Z
ITERRXN'O

C CALCULATE THE CONSTANT PART FOR ALL OF THE REACTION TERNS


RXNTERN=RH0H*RHOM*VLIQT*R2aMST
DO 2100 M . N S T A G E
IF<CX(l,3>.GI.0.0D0>.AX0.(X<l,O.GT.0.0D0)> THEN
IXXX-1
ENOIF

XH2SXXN(I)>X(I,3>
2100 XSOZMM(I)>X<l,«)

IF(IXXN.EQ.O) GOTO 501

C TOP OF XXX SOLVE* LOOP


11000 COM!IHUE

C ZERO THE M H O X AND T MATRICES


DO 2110 1*1.2
DO 2110 J'1,2
XBMI(l,J)*0.000
2110 TBM0(l,J)»0.000

C STEP THROUGH EQUATIONS FOX EACH STAGE


DO 2150 J>1,NSTAGE

C ZERO THE COEFFICIENT MATRICES


DO 2120 1R«1,2
GBNO(IR)*0.0O0
DO 2120 IC-1,2
ABNO(IR,IC)*O.OD0
SBNO(IR,IC)«0.090
2120 DBHO(!«,(C)«0.OO0

IF(J.EB.I) GOTO 2130

*BM0(1,1)-V(JD*K(J-1,3>
ABN0(2,2)"V<J-1)*K(J-1,4)
GBHfi(1)>V(J-1>*K(J-1,3)*XH2SRXN(J-1)
GBHD(2)>V(J-1)*K(J-1,«)*XS02CXH(J-1)
2130 aawi(i,i>>L(j|/asij)«viJ)*K{j,3>-AiPHA(3)'*xaiEncxso2iixM(j)
IIHO(1,2).-AlPH»(3)*«X«IEim*XN2«XN(J)
a
IIMD(2,2>'L(J)/>SCJ>*V(J)*K(J,«}-AlPKA(«) XXalEIIN*XH2S«Xa(J)
,
IB*)(2,1>-Al.PHA(t)*«XNTEim XS02«XII(.l)

If (J.EQ.asTAGE) C0IO 21(0

D>M>(1,1)>-L<J»1)
0IH0<2,2)-L<.M>
CSND(1>«CIM)(U«L(J»1)*XN2$tXa(J«*)
GlW>(2)»5IHDC2)*l<J»1)«XS02tXa(J»1)

2U0 CiMO(1).UKI{1)»F(4,1)*ZF(J,3>-(V(J)*«J,3)U(J)/«S(J))
1 «XH2S«XK(J)«AlPKA<3)««XI4TElm*XK2S«Xll(J)*XSCl2«X«<J)
CaNO(2>*GaaD{2)»F(J,1>*2F(J,«>-(V(J>*K<J,*)*L<J)/«S(J))
<
t •XSO2>Xa(J)«ALPKA(t> aXNIEIH*XH2S«Xa(J)*XS02iXX(J>

CALL SAKOCJ)

2150 COHTIMJE

C UPDATE VALUES

00 2160 J.1,«STAG£

iFC(XH2»xa(j)«caw(i,j».LT.o.0DO) THEI
XH2SRX«U)'XH2SIIXN(J)/2.0D0
ELSE
IF((XH2S«X«(J).C1KO(1,J)).GT.1.000) THEN
X«2S«XM(J).(XH2S«XN(J)«1.0OO)/2.O0O
ELSE
XH2S«XH(J)«XH2S«X»(J)tCBKO(1,J)
ENDIF
ENDIF

ir((XSO2RXK(J)tCBHD(2,J)).LT.O.0DO> THEN
XS02BXMIJ >=XH2SRXK( J >/2. ODO
ELSE
1F((XS02«XX(J)»C1NO(2,J)).CT.1.000) THEN
XSO2RXN(J>'(XSO2RXN(J)»1.0D0>/2.0D0
ELSE
X$02RXN(J>'XS02*XN(J>»CBND(2,J)
EHD1F
ENOif

2160 CONTINUE

C PERFORM CONVERGENCE CHECK


DO 2170 Jol.NSIACE
IF(XH2S*XN(J).EQ.O.OD0) GOTO 2165
IF<DAIS<CIN0(1,J)/>(HJSRXN(J)).GT.1.00-3) GOTO 2190
2165 1F<XSOJ«X»CJ>.EQ.O.ODD) GOTO 2170
IF(DABS(CBND<2,J)/XSO2AXN(J».G?.1.0D-3) GOTO 2190
2170 CONTINUE

C RXN LOOP CONVERGED, UPDATE MAIN LOOP VALUES

DO 2180 J'l.NSTAGE
X(J,3)*XH2SRXN(J>
2180 X(J,t)*XS02RXN(J>

C EXIT TO NAIN LOOP


GOTO 501

C UPDATE ITERATION COUNT


2190 ITERRXN'ITERRXN+1

URITE(6,94000) ITERRXN
WOW F«!HAI('»','IN RXN LOOP, ITERATI0N«\I3>

IFUTERRXN.LT.IHAXA) GOTO 11000


WRITEC6.5250)
USITE(10,5250)
1
5250 FORHATCX/ERBOBI NON-CONVERGENCE IN RXN LOOP IN ABSORBER )

M
to
C FALL THROUGH ERROR AND HOPE FOR THE REST

C SET VARIABLE COUNT BACK TO MAIN LOOP VALUE


SOt NVAR»NC0HP»3

C URITE A BLANK LINE TO HAKE OUTPUT PRETTY


URIIE(6.5260>
S260 FORNAT(X)

C SET RXN TERNS AS SIDE ORAU FOR EVERT STAGE

DO <0O J'l.HSTAGE
400 «(J)»X(J,3)*X(J,«)*RHON'«HOH*VLIOT*«2CONST

C- ZERO THE XBND AND TIND MATRICES AT THE START OF AN ITERATION.


DO 500 l*1,HC0MP*3
DO 500 J*1,RC0MP»3
XBNO(l,J)i0.OB0
500 TBND(l,J)>0.000

C- BEGIN INNER LOOP. PERFORM J CALLS TO BAND TO SOLVE THE COUPLED EQUATIONS

DO 10000 J>1,NSTAGE

C FIRST ZERO THE COEFFICIENT MATRICES


00 525 IR>1,NCOHP»3
GBNO(IR)'D.0D0
DO 525 IC>1,NC0HP*3
ABNOUR,10*0.000
BBNDUR.IO'O.OOO
525 DBNO(IR,IC)i0.CO0

C- SEE IF UE ARE AT THE BOTTOM OF THE COLUMN, IF SO A8ND IS ALL ZEROS

IF(J.EO.I) GOTO 2000


C- Fill ABNO UITH J-1 VALUES OF COEFFICIENTS
C- THE ORDER OF VARIABLES IN A GIVEN ROW IS T,V,L,All X(IC>
C- THE ORDER OF EQUATIONS IS ALL NASS IAL., HEAT M L , EOUILII., MOLE FRACT.
C- VARIABLES: IR'ROU INDEX, IC*COLUNN INDEX, IX- COMPONENT INDEX

C- DO THE MASS BALANCES


DO 530 IR'I.NCOHP
IX'IR
IC"I«»3
ABPtO<I«,1)'V(J-1)n<J-1,IX)*OICDT<J-1,IX)
ABND(IR 2)>-K<J-1,IX)*X(J-1,IX)
>

530 ABN0(1R,IC)-V(J-1)*«J-1,IX)

C- DO THE HEAT BALANCE


IR:NCONP»1
SUMOsO.ODO
SUHI'0.000
DO 540 IX'I.NCOW
Sum'SM0>X(J-1,IX)*(HV(J-1,IX)*0B>T(J-1 IX)«K(J-1,IX>*
>

I OHVDI(J-I.IX))
540 SUN1«SUN1»HV<J-1,IX>«K<J-1,IX)*X<J-1,IX)
ABN0(1R,1)»-V(J-1)'SUH0
ABNO(IR,2)'-SUM1
DO sro IX>I,NCOHP
IC«IX*3
550 ABHO(IR,IC)»V(J-1)*HV(J-1,IX)»K(J-1,IK)

C- AT J 1 THE EQUILIBRIUM AND MOLE FRACTION EONS. ARE All ZEROS

C- FILL IN THE BBNO MATRIX AT 1

C- NASS BALANCES
2000 DO 560 IR-1.NCOHP
IX=IR
IC=IR»3
BBN0(IR,1)=V(J)«X(J,IX)*DKDT(J,IX-
IBW( l«,2)«K( J. IX)*X(J, IX)
UN0(m,3)'X<J,lX>/IIS(J>
560 iBND(ia !C>'V(J)*K(J,IX>»L<J>/ltS(J>
I

C- HEAT BALANCE
IMNCCMH1
SUHO'0.000
SUHU0.OO0
suta*o.ooo
SUH3«0.0C0
DO 570 IX'I.NCOHP
a
SUNO'SUMO»X(J,IX)*(HV(J,IX)*OniTrj,IX)»K(J,IXI IIHWTCJ,IX))
SUNI'SIMUXC J, IX>«OHLOI< J, IX)
SUH2»Sl»t2tHV(J,IX)«>:(J,lX>«X(J,[X)
570 ajK5«SJW»Kl(J,IX)*X<J,IX)
IBN0(Ilt.1)*V(j)*SUH0*l(J)*SUHl/ltS(i}
BBN0(IR,2)>SU(2
BBHO(IR,3)»SUH3/IIS(J)

DO 580 IX'MCOHP
IC»IX»5
,
580 BBHO(l«,[C)-V(J)«HV(J,IX)*K(J,IX)U(J) HL(J,IX)/«S(J)

C- EQUILII. EON.

SLMO>O.ODO
00 590 !X°MCOHP
590 SUM>SUMO*X(J,IX>*DKDT(J IX) >

BBMKlk.U'SUMO

DO 600 IX«1,KC0W>
IC'IX*]
600 BBKD<I«,1C)*K(J,1X)-1.0D0

C- MOLE FRACTION
IR=I»*1
DO 610 IX>1,NCOHP
IC*IX»3
610 BBHD(IR,IC)«1.0C0

C- CHECK FOR LAST STAGE. IF SO THEN J«1 TERNS ARE AIL ZERO
IF<J.EO.NSTAGE> THEN
GOTO 3000
ENOIF

C- FILL IN THE DBNO AT J * 1

C- MASS BALANCES
DO 620 IR>1,NC0HP
IX»IR
IC-IR»3
DBMD(IR,3)*-X(J«1,IX)
620 0BHO(IR,IC)'-L(J»1)

C- HEAT BAL.
IR=NC0MP»1
SUHO=0.OD0
SUM1*0.0D0
DO 630 IX'I.NCOMP
SUM0*SUH0+X<J»1,IX>*DHlDTtJO IX>
>

630 SUH1=St*1»HL(J»1,IX>*X(JtI,IX)
0BND(IR,1»*-L(J»1>*SUM
DBND(IR,3>*-SUM1
DO M O IX'I.NCONP
IC»IX+3
MO DBND(IR,IC)-l(J»1>*HL(J«1,IX>

C- FILL IN THE RIGHT HAND SIDE OF THE EONS. (I.E. GBHO)

C- CHECK FOR J=1 CONDITION, JUMP TO ALTERNATE G8N0 CAIC IF SO


IF(J.EO.I) GOTO 3020
C- MASS MIANCES FOK 1<i<XJ
DO 645 IX'I.NCOMP
IX-1K
645 UNO(III>«F(J,1>*ZF<J,IX)<ALPHA<lX)*lt(J)
1 »V(J-1)*K(J-1,IX)*X(J-1,IX>-(V(J>*K(j,IX)»L(J>/*S(J>>*X(J,IX>
3 •KJ»1)*X<J»1,IX)

C- HEAT IAIANCE FOX 1<J<*J


U*XCON»1
SUMO'O.OOO
SUMIiO.ODO
SUMZ'D.ODO
SUW'O.000
DO 6S0 IX'I.XCOMP
a
SUHO>SJHO*XV(J-1,IX) KU-1,IX)*X(J-t,IX)
SUHl'SUH|4ilv; J, |X)*M J,IX)*X( J, IX)
SUMZ>SUHZ«HUJ, IX)*X<J,1X)
650 SUM3'SUM3«HL(J«1,IX)*X(J»1,IX>

C>W)(l«)*F(j,1)*FCJ,J)«V(J-1>*SUMO-V(J)«SUN1-l(J>*SUM2/>S(JH
a
1 l(J»1) SUH3«OH(J)

C JUW TO EQUILIIXIIM AM) HOtE FRACTION MLAIiCES


GOTO 3010

C- MASS BALANCES FOX J'NJ


3000 DO 655 llt-I.NCCHP
IX-IR
655 GIN0(l«)-F(J,I)«ZF<J,IX)»AIPXA(IX>*«(J)
1 »V(J-1>*K<J-1,IX)*X<J-1,IX)-(V(J)*K<J,IX)U(J)/*5<J))*X(J,IX)

C- HEAT IAIANCE FOX J'NJ


IR'XCOHPO
SUHO=0.000
SUHI'0.000
S 1*2=0.000
DO 660 IX'MCOHP
5UN0*SUMO*HV(J-1,IX)*IC(J-1,iX>*X(J-1,IX)
SUH1*SUM1»MV(J, I X ) * « J , IX)«X( J, IX}
660 SUM2*SUM2»Hl(J,IX>*XC.I,IX>

G(ND<llt)>F(j,l)*F(J,3)»V(j-1)*SW0-V(J>*SUN1-L(J)*SUH2/IIS(J)«
1 OH(J)

C JUMP TO E0UIL1I AXO HOLE FRACTION IAIANCES

GOTO 3010

C SAIOUIATE MASS ANO HEAT IALAKCES FOR J ' l


3.120 DO 665 Ht'T.NCOHP
1X"I»
665 GBND(llt)*F(J,1)*ZF(J,IX)tAlPXA(IX>*«(J)
t -<VCJ)««J, IX)+L(J)/«S(J))'X(J, IX)«L( J»1 )«X( J*1, IX)

C- HEAT iALANCE FOR J'NJ


l«"MCOHP»1
SUHOsO.ODO
SUM1*0.000
SUN2<0.0D0
SUM3-O.0DO
DO 670 IX«1,NC0*
SUKUSUHUHVU, IX)*X< J, IX)»X(J, IX)
SUM2*SUM2«HL(J, IX)*X(J,IX)
670 SUM3-SUM3»HL(Jt1,lX)*X(J»1,IX)

C8N0(l*)«F(J,1)*FCJ,3)-V{J)*SUM1-l(J)*SUH2/*S(J)«L<J«1>*SUM3»
1 QH(J)

C- EOUII.II. EON.
3010 IR»IR*1
SUMO=0.000
DO 675 IX»1,NWHP
675 SUH0=SUNO«X<J,IX)*<1.OO0K<J,IX>)
GBND(IR)*SUH0

C- HOLE FRACTION
IR»IR*1
SUHO'O.ODO
DO M O IX-1.NCOHP
680 SUMO-StMO*X(J,IX)
GBKKIR)-1.0OO-SLMO

C- I F A CONDENSER IS PRESENT AND THIS I S THE TOP STAGE THEN


C- THE EQUATION I S SINPIT T ( J ) ' T C
I F ( ( J . E Q . N S T A G E ) . A M M T C . X E . 0 . D 0 » THEN
IR'NC0MP»1
0 0 685 IC*1,IK0MP»3
ABNO(IR,IC)*O.DD
MKXIR.IO-O.DO
685 DBNDCIR,IC)'O.DO
•BN0(IR,1}'1.0D0
GBN0(IR)>IC-TCI>
EMOIf

C- MATRICES ARE SET, CALL 1AM)


WITE(6.53000) UNIT,IIKEY,ITE«,J
53000 FORKAT{'*','UNIT»',f5.2,' FLOWSHEET I T E R > ' , | 3 , ' ITER-',13,
1 ' STAGE » ' . 1 2 )
CALL BANO(J)

C- DO NEXT J

10000 CONTINUE

C-EQNS HAVE IEEH SOLVED, UPDATE VARIABLES, SET NEU GUESSES


C-IF A NEGATIVE VALUE IS OBTAINED THE NEU VALUE BECOMES THE
C-PREV10US VALUE AVERAGED WITH 0.
C-IF A NEU HOLE FRACTION IS GREATER THAN 1.0 THEN THE NEU VALUE
C-IS THE OLD VALUE AVERAGED UITH 1.0
VMTE(6,50500)
50500 HXHATC EONS SOLVED, NOW UPDATING VALUES')

DO 700 J*1,NSTAGE
TTEMP*T(J)tCBND(!,J)
C UNIT CHANGE IN T TO 20 PEICENT
IF(D»BS((TTE(*>-TtJ))/T(J)).GT.0,2D0) THEN
<
CBM>(1,.I)>OSIGN(0.200 TCJ>,CM>(1,J)>
ENOIF

IF((T(J)»CBNO(1,J)).lT.0.OD0) THEN
T(J)-T(J)/2.OD0
ELSE
T<J)»T(J)*CBN0(1,J)
ENOIF

VTEMP«V(J)«CBND(2,J)

IF(DABS((VTEW>-V(j)]/V(J)).GT.0.2D0) THEN
,
CBHO(2,J)4SIGH(0.2DO V(J>.CBN0(2,J»
ENDIF

IF((V(J)<CBND<2,J)).LT.0.0D0) THEN
V(J)=W(J)/2.0O0
ELSE
V(J)=V(J)*C6N0(2,J)
EHOIF

«LTEHP>l(J)»CBN0(3,J)

lF(0*BS((RLIiiM(>L(J))/L(J)).GT.0.200) THEN
CeND(3,J)sDSIGN(0.2D0*l<J),CBND(l,JJ)
ENDIF

IF((L(j)«CBH0(3,J)).lT.0.0D0) THEN
L(J)=L(J)/2.OD0
ELSE
l<J)*l(J)*CMD(3,J>
ENOIF

DO 700 IX>1,NC0M>
IC'IXO
IF((X(J,IX)»CtHOClC,J|).IT.0.000) THEN
X(J,1X)>X(J,IX)/2.0D0
ELSE
IFC(X(J.IX)»CIKO(!C,J)>.CT.1.0D0) THE*
X<J,IX)»(X<J,IX)»1.000)/2.000
ELSE
x(j,u)*x(j,ix)<ctNO(rc,j>
EMIF
END IF

C CALCULATE NEW T VALUES

Y(J,IX)*X<J,IX)*K(J,IX)

C DENOVE COMPONENT 'NOISE'


IF(X(J,IX).LT.1.00-09) THEN
XU,IX)«0.000
END1F

700 CONTINUE

WXITE(6,50600)
50600 FORIurC PENFORNING CONVENGENCE CHECK')

DO 40200 M.NSTAGE
40200 U*ITE(«,40000) T(i),V(l),l(l).XH2SltXN(l),X$02*XN(n
,
40000 FOiNAT(X,'T« ,F10.*,' V«',D10.*,' L"',D10.4,' X«H2S»',010.4,
1 ' XRSOZ«',B10.4)
C 0 0 40300 l»1,HSTAG£
C40300 MITE(6,«0100> (X{I,IX>,IX'1,NC0W>>
C40100 FOXNM<> ',UZO.IO)

C- CHECK FOX CONVERGENCE • - CONVERGE 1 1 0 . MOLE FRACTS


DO 810 J-1.NSTAGE
0 0 810 IX>1,HC0Mf>
1C«!X«3
IF(X(J,!K).EQ.O.OOO) GOTO 810
I F ( 0 A I S ( C I H O ( I C , J ) / X ( J , I X ) ) . C T . 1 . 0 D - 3 ) THEN
UtlTE(6,$40OO> I X , J , X ( J , I X )
5*000 FOMMTCX,'NOT CONVERGED ! X » M « , ' STAGE-', U , ' X-',020.10)
coro 4000
EMOIF
810 CONTINUE

C- F E U THROUGH CHECK LOOP SO MUST HAVE CONVERGED


WR1TEC10,«0810) UNIT, HEX
1 < 1
40810 FORMAUX, U N I T ' , F S . 2 , HEX-',I*,//)

URITE<10,60O01>
DO 60000 I'MSTME
60000 MIITE(T0,40010) TCI),V(I),L(I)

VRITE<10,«0520>
UR1TE(10,600SO)
ttlTE(10,«0500>
DO 60020 l«1,HSTAGE
60020 MtlTEdO.tOSIO) l,(X(l,IX),IX>1,HCtMP)

MtlTE<10,40520>
URITE(10,60060>
U»ITE(10,t0500>
DO 60090 I'l.NSTAGE
60090 WlTEdO,40510) l,(X(l,IX)*KCI,IX),IX-1,NC0MP)

URJTEdO,40520)
U>UEt10,60070)
MIITE(10,40500)
00 60100 M.NSTACE
60100 UUTEC10,40510) l,(X(j,IX)*l(l>.IX>1,NCOW>>

l*iITE(10,4D520)
MtlTE(10,600B0)
MtlTE(10,40SOO)
DO 60110 MI.NSTACE
60110 l * n E C 1 0 , t « U » I.<X(I,IX)*K(1,1X)*V(1),1X-1,IK0MP>

1 1
60001 FOHUTCX, AISOME* OUTPUT DAM )
1
60050 FORHATCX,' LIQUID COMPONENT HOLE FMCT10NS )
60060 FOUUHX,' VAPOX COMPONENT HOLE FRACTIONS')
60070 FUHAT(X,' IIOUID COMPONENT FLOUS')
60080 FORWUX,' VAPOR COMPONENT FLOWS')
40010 FORKAT(X,'T«',F10.*," V « \ 0 I 0 . * . ' L«'.D10.4)
40500 FOSHATdX.'SGf'.X.JX.'SOLV'.SX.JX.'HM'.M.SX.'HZS'.tX.SX.'SOZ',
1
1 4X.3X, 'SOLD' ,JX,3X, 'COZ ,*X,3X,»tt»,SX,3X, >C1 • ,5X,3X, 'HZ' ,5X,
Z3X,'CO'»5X,3X,'C2'.5X,3X,'C3\5X,3X.'tt',5X,JX.'CS»')
40510 F0MUI(1X.I3,X.2J(0».4,X),D15.9,X,F4.1)
40520 FORKAKX,' •)

C UR1TE THE COLUMN PKOFItE TO THE .PRO FILE


OPENCII.FILE'PNAHE)
DO 61000 j'l.NSTAGE
UR1TE(11,70000) T(J>,V<J),LU>
WITE01,70030) (X<J,1X>,IX'1,NC0HP)
61000 WHITE(11,70030) (T(J,IX),1X 1,NCOMP)
>

70000 FMHATC3DZ0.10)
70030 FORKAT(14D17.10)

GOTO 5009

C- NOT CONVERGED, DO NEXT ITERATION


4000 ITER*ITER»1
C PRETTI PRINT STATEMENT
WRITE(6,«8200)
(8200 FOHUT(X)

1F(1TER.LI.IKAXA> GOTO 1000

C CHECK TO SEE I F SUIFUI MECIPITATEO ON ANY OF THE TMTS


C I F SOUMJILITT I S EXCEEDED F U G I T IN THE OUTPUT
SON DO S010 J'l.NSIAGE
XS*SULFUR(T(J»
C MtITE<6.60200> J,<X(J,5>/XS)*100.OD0,XS
URITE(IO,60200> J,CX(J.5)/XS)«100.0D0,XS
60200 FORHAT(X,' X SULFUR SATURATION ON TRAT ' , 1 4 , ' •',020.10,
1 • <SOUUX>',020.10,')')
S010 CONTINUE

C SET VALUES FOR RETURN STREAMS


C SET COMPOSITIONS

DO 910 I'l.NCOMP
STMP<I)>X<NSTAGE.I>*«JSIAGE,I)'
STLia(l)>X(1,l>
910 STliOC(I)*X(NSTAGE,l>

C-RESET NUMBER OF COMPONENTS TO MAIN LOOP VALUE


NCOMP'NCONPOID

C SET FLOW, TEMP, PRESSURE, ENINALPT, A M PHASE

STVAP(NCOMP»1>*V(NSTAGE)
STIIQ<NC0HP*1)*L<1)
>
STLIQC(NCOHP*1>*l(NSTAGE) FS/(1.D0-FS>

U>
«3
STVM>CHCO«>»2>OOtSTK*>
$TLla(»CCW«2W(1)
$TLIOC(IKO»*2)-T<I<SUGE> £
O
STVAP(*CO»»J)»P
STL1Q(NCCHP»3)>P
STL10C<NC0HP»3)«P

HTV«O.OD0
HTL*O.OD0
MTLC'O.ODO

DO 920 I'l.NCSUI
HIVHTVtKVCNSTACE, I )»X(«SIAC£, | inc(HSTACE,')
HTl«HTl«HL(1,l)*X(1,l)
920 HILC>HUC«KI.{«STAC£,l)«X(tlSTAC£,l)

STVAP(NCOMP««)'HTV
SU!01HC0MPH).HTL
5TliaC(NC0MP«4)'HTLC

STVAP(NOCMP«S)'Z
STL10(«CO*>«5)"1
STLlOC(kCCHP»5)»1

C CLOSE OUTPUT DATA FILES


CLOSECIO)
CLOSE(II)

RETURN
END
SUBROUTINE FSPLIT<NC,STREAMI,STREAM1,STREAH2,F10W)
IMPLICIT REAL'S <A-H,0-Z>
REAL'S SrREANI(2S),STREAN1<25),STREAM2(2S)

C FlOU SPLITTER
C
C LAST UPDATE: W/21/86

C SET RETURN VALUES FOR ALL ZI.FIOU.TEMP.PRESS.ENTKAIP?.PHASE


DO 10 1»1,NC*5
STREANI(I)'STREAMKI)
10 STREAK2(I)-STREAMI(I)

C SPLIT STREAM SASED ON FlOU - FlOU I S AMOUNT WHICH GOES TO STREAN1


C IF FlOU I S GREATER THAN FEED, SEND A l l TO STREAN1
1F(FL0U.GT.STREAMI(NC»1)) THEN
STREAM!(NC»1)*STREANI(NC»1)
STREAKCNC+D'O.ODO
ELSE
STREAN1(NC*1)'FL0U
ST^EANZ(NC 1 )»STREANI (NCH)-FLOU
EDO IF

RETURN
END
SUHCUTIK PHFLASK(NCOHP,STREAMF,PFLASN,STAL,STRV,
1EPSH0H, IPHASE, IHAX.ERRU)

C ISENTHALPIC OX ADIASATIC FLASH CALCULATION


C FOX MATHEMATICAL DETAILS SEE FOX EXAMPLE XING, PGS. 81-90.
C
C LAST UPDATE: 04/21/86

IMPLICIT REALM (A-H.O-Z)


INTEGERS ERROX
INTEGERS KCOHP,IHAX,ITER
REALM STREANF(2S>,PFEED,TFEEU,F."(ZQ>,HF,PFIASH.
1 TFLASH,V,L,X<20>,T(20),EPSIIOII
REALM STRL(2S>,STRV(2S)
REALM TtUl.TDEU.VF
REALM K<20),DICDT<20)
REALM OL0F,OLDG,NEWF,NEVG.SLM0,StM1,AOD0,A001,OGCHK,NGCm(
REALM FDXEV.FDERT.GDERV.GDEXT
REALM M.(20),HV<2O>,DHL0TC2O),DfflmT(2O),HH,HTV,HT
REALM HFI(20),DHFIDT(20),HTD,HTI

C SET ERROX RETURN TO NO CONVERGENCE. SET IPHASE TO MIXED


C LIQUID AMD VAPOR
ERROX'1
IPHASE-3

C INITIALIZE ITERATION COUNT


!TER*D

C SET VALUES FOX HOLE FRACTIONS - FIRST GUESS


DO 5 I'l.XCOMP
ZF(I)'STREAMF(I>
X(I)«ZF(I)
5 T(I)=ZF(I)

C SET LOCAL STREAK VARIABLES


HF-STREAHF(NCOHPH)
PFEED»ST«EAMF<NCOKP»J>
TFEED'STHEANFCNCOMP+Z)
F>STREAHF<NCOHP*11

C CAIOH.ATE NUBIIE AW DEU POINTS


CAll NU»DEt«NCOIP,TFEED,X,Y,Ti<J»,,TDEW,PFLASH,,EPSllON,2>

C CAICUUTE ENTHALPY OF THE FEED AT THE M M I I E AND DEW POINTS


CAll HEAM0,1,NCGMP,TtlM,PFLASM,Hl,HTI>
C A l l HEAt(0,2,NC0HP,TDEU,PFlASH.X.HV,HT0)

C SEE I F FEED IS A l l SUPERHEATED VAPOR OX SU3C0C4.ED LIQUID

IF(HF.GT.HTD) THEN
DO 10 l-I.NCOMP
10 X(l)»0.0O0
V«F
I'O.ODO
IPHASE«2
GOTO 175
ENOIF

I F ( H F . l T . N T t ) THEN
DO 15 I'l.NCCMP
IS TCD'O.ODO
l»F
V'O.ODO
IPHASE'1
GOTO 175
EHDIF

c .........................................................
C HAVE MIXTURE, PERFORM FLASH CALCULATION
C MAKE F U S T GUESS FOR TFLASH AND V / F
VF«(KF-HT»)/(HT0HT1>
mASH>TBUB»VF*CTDEW-TIU»)

C CALCULATE K
CALL ICVAL(0,NCC»»,TFlAStl,PFUSH,X,T,t)

C CALCULATE HL.HV
CALL HEAT(0,1,KCOHP,TFLASM,PFLASH,K,HL,HTL)
CALL HEAT(0,2,HCOMP,TFIASH,PFIASH,Y,KV,HTV>

C CALCULATE F AMD G
OIDF.0.0
SUMO>O.WO
SUNI'O.ODO
DO 20 l»1,NC0HP
OLDF=OL0F*(ZF< I ) * « ( 1 ) • 1 . D O ) > / ( V F * « < I > • ! . D 0 ) * 1 . 0 0 0 )
SUHO=SUHO«(HV(I)«ZF(1)«IC(I))/(VF'(«I)-1.00)»1.000)
20 SUH1>SUNH(HL( I ) * Z F ( I ) / ( V F * ( K ( l ) • 1 . 0 0 ) » 1 .ODD))
OLDG>VF*SUHO»( 1.0O0VF)*SUH1 -MF

OLDG-OLDG/HF

C CALCULATE DERIVATIVES OKDT.DHLDT.DKVDT


25 CALL KVAKMCOMP, TFLASH,PFLAiH,X,Y,DH>T>
CALL HEAT(1,1,KCOMP,TFLASH,PFLASH,X,DHIOT,HT)
CALL HEAT<1,2,NCW,TFLASH,PFLASH,Y,DHVOT,HT>

C CALCULATE DF/DV,OF/DT,DG/DV,DG/DT
FDERV'O.ODO
FDERT'O.ODO
GOERV*0.000
OOERT'0.000
ADDO'O.ODO
ADDI'0.000
DO 30 M.NCOHP
FDERV=FDERV-(ZF(I)*((K(I)-1.DO)**2»/((VF*(IC(I>-1.DO)»1.000)**2)
FDE«T*FDE«T»<ZF<l)«t>ICDT<l»/«VF*(IC<IM.00>»1.OD0>"2)
COE«V=GDERV«<2F(I)«IC(I>*(HV<I)-KL(I)))/((WF*(IC(I)-1.00)
1 •1.000)"2)
ADD0>VF*K(I)*0HVDTCI)«O.n>0-VF)*DHlDT(O
ADD1«(VF*(t.tlO0-VF)*CHV(l)-Ht(«»)*OH)T(l))/{VF«(«l)-1.00>
1 •1.CO0)
AM2«ZFCI>*(ADO0+ADO1>/(VF«C«l>-1.D0)+1.OD0>
30 GDERT*G0EKT«AM>2

GOEKV-GOEHV/HF
GDE«T«a>EIIT/HF

C CALCULATE NEW TFLASH AMI V


TFl«SH»TFLASH«(F0E«V«(K.0C-0OE«V*OL0F)/(FDEIIT*GDEIIW-fDERV*0DEI<T)
VFOL0-VF
VF»VF»(CDE«T*(XOF-FOE«T«OLOO)/(FDE«I«COE»V-FOE«V*C£1E«I)

lF(VF.LT.O.DO) THEN
VF'VFOLD/2.00
EHOIF

!F(VF.GT.1.DD> THEN
VF-(VFOLD»1.D0)/2.DC
ENDIF

MtITE<6 20000) TFLASH,VF


>

I >
20000 F0F)HAT(X, TFLA5H« ,D20.10,' VF«',D3.10)

C CALCULATE NEW K,T


V=F*VF
L-F-V

DO 40 M.NCCHP
X(I)»ZF(l>«(MI)-1.00)«VF»1.00J
«0 VCI>=X<I>*KCI>

in
C CALCULATE NEW K VALUES
CALL KVAL(0,NCGW>,TFUSN,PFIASH,X,Y,K)

C CALCULATE NEW ENTHALPIES


CALL HEATCO.MRMP.TFLASH.PFLASM.HL.HTl)
CALL HEAT<0,2,NCOK*>,TFlASH,RFfASH,r,HV,HTV)

C CALCULATE NEU F AW G FUNCTIONS


NEUF*0.0
SUMzO.OOO
SUNI'O.ODO
DO SO I«1,NCOM>
NEUF>NEUF»(ZF< I )*(K( I ) • 1 .DO»/(VF*<K<l >-1.00)»1.000)
SUH0»S«tO»(HVCI)*ZF(l)*((l))/(VF«<«l)-1.O0)«1.»0)
SO SUH1>SUHl«(HL(l)*ZF(U/{VF*(K(n-1.OO)»1.000))
a
NEUG'VF'SUMKI .000-VF) S(JM1 -NF

NEWG<HEUG/HF

1TER«ITER«1

C NORMAL IZE G FOR CONVERGENCE CHECK


OGCHKiOlDG
NGCHK'NEUG

C CHECK FOR CONVERGENCE


C IF((DAIS(NEUF)«0AtS(NGCHK)).GT.(0AIS(OLDF)*0AIS(OGCm!>»
C 1 GOTO 100
IF(ITER.GT.IHAX) GOTO 100
IF((0ABS(HEUF)<0AIS(NGCHK».GT.EPSI10N) THEN
01DF>HEUF
OLDG'MEWG
GOTO 25
ELSE

C CONVERGED, SHOW CONVERGED, HAVE MIXTURE AND THEN EXIT


ERROR-2
•PHASE'S
GOIO 100
ENDIF

r—»***——»••*•••••«•—• •>«>»—•>•>>»••••••••••••••••»•—

C IF A l l IIOUIO OA ALL VAPOX ITEUTE TO DETERMINE EXIT TEMP


r«»o**—•*••*•»»****••••>•»>»••»••»•<•>••••••••••••••»«••

C SET MOLE FRACTIONS FOX USE IX THERMO SUMOUTIXES


175 DO ISO M.NCOHP
1S0 XCI>»STAEAMF(D

C SET F U S T GUESS FOX TEMPERATURE

200 TFLASK'TFEED
225 TOUT'TFIASH
CALL «E«t<0,IPKASE.HCOHP,TOUt,PMlX,X,HFl,HT)
CALL HEAT(1,IPHASE,MC0HP,TOUT,PMIX,X,OMFIOT,DHT)

C CALCULATE TOTAL ENTHALPIES AND DERIVATIVES


HT1'KT*STREAMF(NC0HP»1)
DHT>DHT*STREANF(NC0NP«1)

C CALCULATE XEU T VALUE


TFIASH>TOUT-(HTV(STREANF(XCOMP*1)*STREAMF(XCOMP«A)»/OHT

ITERMTERtl

C CHECK FOR CONVERGENCE


IF(OABSiIFI ,SH-T0UT).LE.EPSI10N) GOTO 270
C CI'EOC FOR NAXIKoH NUMBER OF ITERATIONS
IF(ITER.GT.IKAX) GOIO 100
GOTO 225

C SHOW CONVERGED CALC, BUT FLAG THE FACT THAT STREAM IS ALL IIOUID OX VAPOR
270 ERRORO
C SET RETURN SHEA* VALUES
100 DO 300 ••I.NCONP
STRl(l)*X(l)
300 STRVCI)sT(l)

C FLOW, TEMP, PRESSURE. ENTHALPY, PHASE


STRKNCM»1)*l
STRV(KCOHP»1)»V

STRL(IK»»«2WFIASH
STRV(NC0MP»2)'TFLASH

ST«L(HOT»»3)"PFIASH
SIRV(IK0HP«3>*PFIASH

IF(V.EO.O.WO) THEN
HTl*HT
MTV=0.000
EHDIF

IF(L.EO.O.DOO) THEN
HTI'0.000
HTV»HT
ENOIF

STRUHCOHP»4>»HH
SI«V(HCOMP»*)>HTV

STRL(NCGMP»5)*1
STRV(HC0MP»5)<2

RETURN
END
SUMOUTINE XCHGdK.SnEANHI.STIIEAKI.SniEANW.STKEANCO,
1 UA.EPS.IKAX.ERR)

C HEAT EXCHANGER SUMOUTIHE


C
C LAST UPDATE: 0 6 / 1 1 / 8 4

C WUMIHG: THIS ROUTINE MILL NOT CONVERGE F M VERT LMGE VAIUES


C OF UA (UA>IOOOO KU/DEG K, I . E . UNREALISTIC VALUES). THE
C HAXIMM "SAFE" VALUE I S DETERMINED I T THE STEP SIZE USED
C TO CALCULATE THE DEVIATIVES WITH RESPECT TO TEMP.

IMPLICIT REAL*S ( A - H , 0 - Z >


DEAL'S XH(20S,XC(20)
REA!*B CP(ZO)
REAL«8 ST«EAMHI(2!>,STIIEAMCI(2S)
REAL'S STREAHHO(2S>,STREAMCO(2M
REAL'S STRL(2S),STRV(2S)

IMTEGER*2 PHASEC.PKASEH
1
INTEGER ? ERR

C SET TEMPERATURE IHCREMEHT FOR DERIVATIVES


OELT*0.01D0

C SET RETURH F M HO ERRM


ERR*0

C ZERO ITERATION COURT


1TER*0

C SET MOLE FRACTIMS F M CALCULATION AND OUTLET STREAMS


DO 10 1*1,HC
XH(I)>SnEAMHI(l)
STREAMH0{1)=XH<I)
XC(I)=STREAHCKI)
10 ST«EAMCO(I)*XC(l>
C SET OUTLET FLOWS AND PRESSURES
STREAHHOCNOO'STREAHHKNCM)
SIREAHHOCIK«3)*STREAml C U M )

STREAHCO(NC»1)-STREAHCKM>1)
STREAMCO(XC«3)'STREAHCI(W>3)

C SET LOCAL VALUES FOR STREAM PIESSWES, PIUSES, TEMPERATURES, AND ENTHALPIES
PRH«STREAMHI(NC*3>
PHASEH*INI(STREAHHI(IK>S»

PRC'STREANCKNC+3)
PHASECMNUSTREMKI WC*5)>

TCI*STREANCI(IK>2>
THl*STREANHI(IK«2)

HCI>STAEAHCI(HC+f)*STREAHCI(IK>t)
NHI*STREAMHI<IK>1>*SrREMHI(NC»t)

C FOR FIRST GUESSES FOR OUTLET TEMPERATURES ASSUME NO PHASE CHANGE


C CALCULATE HEAT CAPACITIES ( I . E . DERIVATIVES)
CALL HE»T(t,PHASEC,NC,TCl,HtC,XC,CP,CPC2)
CALL HEAKI.PKASEH.NC.THI.PRH.XH.CP.CPHI)

C ESTIMATE EXIT TEMPERATURES


ALPHA'CCPHI^STREAHHICIK+ln/CCPCPSTREAHCKNC*!))
•ETA<0EXP(UA*(1.OM/(CPtt*STREAKCI(K'C*t))-1.0D0/(CPHl*
1 STREAMHI(NC»1)»)

>
TCONEU>(THI (META)«TCI*IETA*(1.0D0-AlPHA»/(1.Oa0-ALPHA*IETA>

THONEUxTHI«((TCI -TH1 )*ALPHA«<1.0O0-IETA)/<1.0D0-ALPHA*IETA»

C NOU ITERATE TO CALCULATE EXIT TEMPERATURES ALLOWING FOR POSSIILE PHASE


C CHMKE(S)

100 TCOtTCOWEV
THOMHONEV

c F L A S H T N E S M E A K S A T r«E ASSUMED c i c r r C O M H T I W S ro a m i n £»tnALP:es

CALL PTFl»SH(NC,STKEAMCI .MC.TCO, ST«L,ST«V,EPS. I M C , I MAX,Ell))


KCCNSIAKHC'I )*ST«L(«CH)»S1«V(NC»1 )*St«V<»Ct4)
CALL PTFLASH(NC,5T«EAHHI,PIPI,TH0,»T«L,SI«V,EPS,IPMM,IHAX,EIU>
KH0.ST«L(NC»n*ST«L(IIC»*)*S!«W(IH:«1)«ST»V(IIC«*>

C CALCULATE ENTHALPIES AT T • DELTA T FOR USE I I I F I M I I K OERVIATIVES


CALL PIFUSH<HC,ST«EAMCI,PI<C,TCO»©ELT,JT«l,ST«V,EPS,IPII,IIIAX,
1 E«t>
a a
HCXEL>ST«L(IK*1) STtl(NM)»ST*V(NCM> STIIV<IIC«*)
CALL PiriA5H(IIC,ST«EAHHI,WIII,TH(HBELT,STAL.ST«V,EPS,IPH,IHAX,
1 EMI
KH0OEL"STKL(IIC«1>'ST«L<IK>4)«ST«V<IIC»1)'ST«V(NC**»

C CALCULATE F I . F 2 , AND DENIVATIVES OF F 1 . F 2 UITH HESPECT TO TCO.THO


F1«FUtiCFUTKI,THO,TCI,TCO,KI<l,HHO,HCI,UA)
F2'FUNCF2(HKI ,HHO,NCI ,HC0>
DF1C-FUNCF1<THI,TMO,TCI,TCO»0£LT,HHI,,H>W,ltCJ,UA)
DF1H»FUNCF1(THI,THOtOElT,TCI,TCO HHI,HHCOEL,IICI,UA)
)

DF2C:FUNCF2(HHI,HHO,HCl,HCODEL)
DF2H>FUNCFZ(HHI,HWDEl,HCI,HCO)
0F1DTC»<DF1C-F1)/DELT
0F1DTH*<DF1H-F1)/DELT
0F2DTC««IF2C-F2>/DEIT
DF2DTH>(DF2H-F2)/DEi;

C UPDATE VALUES FOR ICO, THO


DEH0M4F1GTC*DF2DTH-DF1DTH*DF2DTC
TC0NEU'TC0*<F2*DF1DTH-F1*DF2DTH>/DEHOH
TH0NEU:THOr(FI*DF2DTC-F2*0F1DTC>/DENCN

C BOUND TEMPERATURES BY INLET VALUES


It(TCCMEU.LT.TCI) THEN
TCONEU>(TCO»TCI)/2.0D0
END IK
IF<TCGNEU.GT.THI) THEN
TCONEIKTCOMMI ) / 2 . 0 0 0
ENOIF
IF(THONEW.LT.TCI) THEN
THONEV>(IHO«TCI }/2.0D0
ENOIF
tF(THOHEU.GT.TM) THEN
THONEU<(THO«TNI >/2.000
ENOIF

C CHECK FO* CONVERGENCE OF OUTLET TEMPERATURES


IFCOAISCOCONEII-TCO)/rCO>.GT.EFS) GOTO 500
IF(0ASS(ITHONEU-TNO)/rHO>.GT.EPS> GOTO 500

C BUST NAVE CONVERGED. FINISN UP RETURN VALUES


GOTO 1000

C DID NOT CONVERGE. IF NONE ITERATIONS LEFT UPDATE VARIABLES AGAIN


C ITERATE ON POSSISLE FLASH CONDITION UNTIL CONVERGED
500 ITER«ITER«1
IF(ITER.LT.IMAX) GOTO 100

C SHOU NON-CONVERGENCE ERROR


ERR*1

C SET OUTLET CONDITIONS • T , H, AND PHASE


1000 STREAMCO(NC+2)'TCO
STREANCO(HC«*)*HCO/STREAHCO(M>1)
STREAMCO(NC«5>*IPHC

STREANHO(HC*2>'THO
STREAHHO(NC<t)'HHO/STR£AHHO(NC+1)
STRE(WHO(NC»5>*IPHH
tErun*
END

REM*8 FUNCTION rUNCF1(lKI,THO,TCI,ICO,HHI,H«0,KCI,U»)


IMPLICIT «E«t«l(*H.O-I)
OELT1-THI-TCO
0ELT2>IN0-ICI
TLN>(DELTI-DflTZ)/(DiCC(0ElT1/0ElT2»
FUNCF1*((IWI-HI»)-UA*TIN>/(IIHI«NCI)
RETURN
END

REM*a FUNCTION FUtCF2<HM,HHO,HCI,HCO)


IMPLICIT «E»L««(»-H,0-2)
FUNCF2»(HHI -HWHHCI -NCO)/(HHI«NCI)
RETURN
END
SUBROUTINE RESOILtllC.STRi.STROL.STROV.PVESS.TRI.aiN.INAX.EPS,
1 EMM)
C REIOILER SUHOUTINE
C
C IASI UPDATE: M / 2 1 / 8 6
C
IMPLICIT REAL*S(A-H,0-Z)
AEAL*8 STRI(2S),STROL<2S),STMV<25)

INTEGERS E M M

C SHOW NO ERROR
EUW'O

C FLASH THE STREAM AT THE INDICATED TEMPERATURE


CALL PTFLASH(NC,STRI,PVESS,TR1.STR0L,STROV.EPS, IPHASE, IKAX,
1 ERROR)

C CALCULATE THE HEAT INPUT REQUIRED


a
alN=STROL(HC»1)*STROL(NC«4)»$IROV(NC*1) STRaV(NC«A)-
1 SIftl(NC»1)*STRICNC»<)

RETURN
EMO
SUMOUTME CONDENSE(NCOHP,P'trAP,ST(EAIII.$T>EAMO,QaUT EPSILON, l

I E*KM>
C CONDENSE* SUMOUTINE
C
C LAST UPDATE: 0 4 / 2 1 / 8 4
C
IMPLICIT IEAL«8fA-K,0-Z)
«EAL«8 X(20>,T(?.0) HL(20) >

AEAL'B ST«EAAI(25),STItEAHO(25>

INTEGE«*2 EMOX

C SHOW W EUHM
EMKM*0

C SET UP NEU LIQUID VALUES


DO 10 M.NCOHP
T(1)>SI>EAH1(I)
10 K(II>T(I>

TVAP<STKEANI(NCOHP»2>

C CALCULATE tUMLE POINT. ASSUME THAT THE NUM1E POINT I S


C THE TEMP IN THE CONDENSE* - I . E . ASSUME TOTAL CONDENSE*
CALL •UtDEU(NC0MP,IVAP,X,«,TIUI,TDEU PVAP EPSILON,0)
> >

C CALCULATE NEU LIQUID STUEAH ENTHALPY AT THE NOBLE POINT


CALL HEAI(0,1,NCOMP,TBUB,PVAP,X,HL,HIl)

C SET ALL OUTLET STREAM VALUES


CO 20 l ' 1 , N C 0 W 4 l
20 ST«EAMOCI)*SntEWf<i)
STREAHO(NCOMP+2)*T8U3
ST«EANO(HCOHP«3)spVAP
ST*EAM0(NCOHP«4):HTL
ST»EAHO{NCOHP»5)«1
C CALOJU1E HEAT REMOVED
«UT»SI«EAHO(NC« 1 )*STItEMM(ll04 ) • STtENII (HOI )*Sl*EN" '.NCU ) M

KETlMtK
END
SUMOUTINE NIXE*(NC0HP,STREAN1,STREA>I2,STREN«,PHIX,IPKASE,
t EPSILON.ERROR)

C NIXED SUBROUTINE
C
C LAST UPDATE: 0 4 / 2 1 / 8 4

IMPLICIT DEAL'S ( A - N . O - Z )
INTEGER*: ERROR
REAL'S STREAH1<25>,STREAH2(2S),$TREAH0(23)
REAL'S STRL(2S),STRV(25)

IHAX>20

C CALCULATE EXIT FLOWS FOR MIXTURE


DO 10 l>1,NC0HJ>
10 STREAH0(l)<STREAH1(l)'STREAN1(NCONP»1)«STREAM2(l)*
1 STREAH2(HCOHP»1>

STREAM0<NCOMP»1 >>STREANUNCaHP«1 )»STREAH2(NC0™-»1)

C CALCULATE HOLE FRACTIONS FOR MIXTURE


DO 20 M,NCOM>
20 STREAN0(l)'STREAHCKI)/STREAM0(NCaMP>1>

C SET EXIT PRESSURE AND ENTHALPT


STREAM0(NC0MP»3)«PMfX
STREAN0(NCOMP<«)«(STREAN1(HCOM>*4)'STREAN1(IIC0MP»1>*
1 STREAH2(NC0HP«t)*STREAN2(NCaiP«1))/STREAMO(NC0MP«1>

C SET GUESS FOR MIXTURE TEMPERATURE FOR FLASH CALC • • USE AVERAGE
TFEED'((STREAN1(NCOMP»2)'STREAN1(NCOMP4'1»'(STREAII2(NCOMP»2>'
1 STREAH2<NCOHP«1>)>/(STREAN1<NCONP»1)*STREAN2(NCOMP+1>>
STREAH0(NC0HP»2)'TFEED

C DO A FLASH ON THE MIXTURE TO DETERMINE PHASE(S) AND COMPOSITION


CALL PHFLASHCHCOHP.STREANO.PMIX.STRL.STRV.EPSILON,
1 IPHASE.IHAX.EMOO

C SEI DEIIMM TENPEtATME AND PHASE


SHEJMCHWMP^J.SmKMCOW*!)
SHEAHO(IICOMP«S)>IPHASE

•ETUUM
Era
SUtlKVTIlE SPLIT(IIC0MP,STtEAMI,STIEAII1,STtEAN2,F»ACT1>

G SPUTTER SUMOUTIIIE
C
C U S ! UPDATE: M / 2 1 / 8 6

IMPLICIT REAL'S ( A - R , 0 - Z >


REAL'S STREAMf2S>,$TREAIIl(2S>,$rREAK2(2J)

C SET RETURN VALUES FOR ALL ZI.FLOU.TEHP.PRESS.EIITKAirT.PHASE


DO 10 l>t,RCGHP«S
STAEAN1(I)>ST«EANI(I>
10 STREAH2(1)>STREAHI(I)

C CORRECT VALUES OF FLOU FOR SPLIT


STREAH1(IIC0HP*1 )'STREAM! (MCOHPH )*FRACT1
ST*EAN2(HCONP«1 ><STREAMI («C0MP»l >«(1 - FRACT1)

RETURR
EHO
SUMOUTIHE PUHF(NC,STRE*MI,STREIW.POUT,RHM,POUER,IMAX,EPS,
1 EKROK)

C LAST UPDATE: 0 * / 1 0 / 8 4

C PUMPING SUMOUTINE. MODIFIES THE PRESSURE OF A STREAM AND RECALCULATES


C THE ENTHALPY. ASSUMES ISOTHERMAL OPERATION.
C ALSO SETS THE EXIT PHASE COMPOSITION ™ CALCULATES THE POWER REQUIREMENT.

IMPLICIT REAL*8(A-H,0-Z)
INTEGERS ERROR
DEAL'S STIEAMI(»).STREAM0C2S>
REAL'S STRL(2S),STRV<25>

C TRANSFER ALL VARIAILK FROM INLET TO OUTLET STREAM


DO 10 l"1,HC»5
10 SIREAMO(l)*STREAMI(l)

C SET NEW VALUE FOR PRESSURE


STREAM0(NC«3)'POUT

C FLASH THE STREAM TO DETERMINE ENTHAlf 1 AMD PHASE


CALL PIFlASH(NC,STREAM0,P0UT,STREAH0(NC«2),STkl,STRV,EPS,
1 IPHASE.IMAX.ERROR)

STREAH0(NC«t><($TRl(Ne«1)*STRl<NC««l«STRVCNC*1)*STRV(NC»')>/
1 STREAM0(NC4l)

STREAH3(NC<S>*IPKA$E

C CALCULATE POWER REQUIREMENT


P0UER'(P0UT-STREANI(NC«J»*STREANI(NC«1>/RHON

RETURN
END
SUNOUTIIIE REACTOR(NC0HP,STREAH1,I.TREAM2,rREACT,aaUT,STREANO,
1 FRACT,RK2,VREACT,IPHASE,EPS11C«,ERROR)

C REACTOR SUttOUTINE
C
C LAST UPDATE: 0 4 / 2 1 / 8 6

IMPLICIT REAL*1(A-N,0-Z)
INTEGER*! ERROR
INTEGERS ALPKAC20)

REAL'S STREAM1<2S),STREAM2<2S),STREAH0(25>
REAL*0 STRL(25),STRV(2S),HFK20),DHF10T<20)
«EAL«B H0LUTC20)

COMMON/ALPR/ALPHA
COMMtM/HOLEC/HOLVI

C SHOU NO ERROR TET


ERRORsO

C PERFORM MASS IALAHCE


C NIX FIRST, CALCULATE FLCUS I E FORE REACTION

DO 10 M.NCOHP
10 STREAM0(I)'STREAN1(I)*STREAN1(NCCHP«1)*
1 STREAM2<I)*STREAN2(NC0HP«1>

C DETERMINE LIMITING REACTANT - - H2S OR S02


FLOWH2S*STREAM0(3>
FlOUS02*STREAMO(t>

IF(FL0UH2S.GT.2.0D0*FLOUSO2) THEN
C S02 I S LIMITING
FL0WCHG=FRACT«FL0US02
ELSE
C H2S I S U N I T I N G
FIOUCHG*FUCT*FLOU1I2S/2.000
ENOIF

C CALCULATE COMPOSITION AFTER REACTION A W TOTAL OUTFLOU


SIR.EAMO(NCCrt»1 >-0.OD0
DO 20 l-I.NCCMP
STNEAMOCI >-ST*EAMX I )«ALPHA( I )«FlOUCttG
20 STttEAH0(NC0Hr*1)<SnEMa<liC(M>«1)«STItEAI«Xll

C CONVERT FLOWS TO K X E FRACTIONS


DO 25 I-1.NCCMP
25 ST(EAI»(l)*SIAEAMXI)/ST«AMO(IK0HP*1)

C SET EXIT PRESSURE M B ENTHALPV ACCOUNT I NO FOR tEACTION AND NEAT REMOVAL
STREAM)! NCOt»S)>PREACT
STItEAN0(NCOM>*A)'(ST(EIUIt(NC0MPH)*STIIEAM1(NC<M>*1)
1 •STREAH2<NC0HP<«>*ST(EAH2(HCONP*1)-O0UT>/
2 SIREAHO(NCONPtl)

C SET GUESS FO* MIXTURE TEMPERATURE F M FLASN CALC - • USE AVEMGE


TFEEO.(<SI«EH<1(»COHP»2)'ST«EAN1(ltCOW»1))»(STIEA«(NCOr»2)«
1 STREAN2<NC0NPH)>l/(STREAN1(IK2WO>»STREAII2(INXHP*1>>
STREAHO(NC0MP»2)'TFEEO

TFLASH'TFEEO

STREAH0CNC0MP*2WFEED

C SAVE THE TEMP, ENTHALPY VALUE AND INLET PHASE TTPE


SAVET'Sr>EAM0(HCOMP«2)
SAVENTH<STREAN0(NC0M>«O
SAVEPH"STREAHO(NCOMP«5)

C ITERATE ON SULFUR SOLUBILITY AND FLASH TO DETERMINE EXIT CONDITIONS


IHAX*20
ITEMO
SO ITER'ITER*!

IF(HEH.CT.INAX) THEN
ERROR*!
WTO 40
EHDIF

TSOl'TFLASH
CALL SULFSatNCOI^STREAMO.STREAW.TSX.PREACT.EPSILON.ERROR)

C RECOVER CORRECT TENP. ENTRAIPT ISW.FSOL RECALCS ENTHALPT FOR STREAM) AND PHASE
ST«E«W(»CCHP»2)«SAVET
STREAMO(NCOHP»*)>SAVENTN
STREANO(NCOMP<S)«SAVEPII

C DO A FIASH ON THE NIXTUIE TO DETERMINE PHASE(S) AND COMPOSITION


CALL PHFLAS«(NCOMP,SIREAMO,PREACI,STRL,STRy,EPSILON,
I lPHASE,30,ERItOR)

TFLASH»STRl(NCOHP<2>

C CHECK FOR TEMPERATURE CONVERGENCE


IF(DAIS(IFlASH-TSCO.6T.EPSIL0N> GOTO 30

C SET OUTLET VALUES FOR PHASE TTPE AND EXIT TEMPERATURE


C CHECK FOR PRESENCE OF SOLID SULFUR (COMPONENT 17)
40 IF((STREAM<17).HE.0.0D0).AND.(IPHASE.LE.I)) THEN
STREANO(NC0MP«S)>IPHASE«3
ELSE
STREAMO(NC0NP»5)*IPHASE
EHDlf

STREAHO( NC0HP»2)'TFLASH

IF(IPHASE.EO.J) THEN
EMOI'2
ELSE
EMOt'O
END1F

C CXlCUlME REACTO* VOLUME FO* PLUG flOM O K M T I O N

C INLET CONCENTMnMS OF 502 M P M2S


BEH««tS«E»«HlK0W>»1)»$T»E«ieCltC0)»»1))*lW.WM)
csoz>iooo.oo*Fiauso2/c£inH
CH2S'1000.0O*FLaM2S/DEHW

C FLOU III GAL K i t SEC


FLOV*STItEMKXIIC0HP»l)«mUn<1>/3.79

1F(CK2S.EO.Z.W'C$02> THEN
C I ' I . O O / d . O O - F M C T ) • 1.00
WEACT>FLai*aMVER/<2.0O*K2*C$O2>
ELSE
IF<CHM.CT.2.00*CSO2> THEN
<
C1«LOG((CN2S-2.00*CSO2 FUCT>/(1.O0-FR*CT»
C2>OLOG(CII2S)
V K A t U f L0U*(1 . D 0 / H 2 ) * ( l . D 0 / ( C « S - 2 . M I * C S O 2 » * ( C 1 -C2>
ELSE
C1"OL0CC<CSO2-0.5DO«CHK«FltACT)/C1.DO-mACT»
C24L0GCCS02)
VKEACT*FLaV(1.M/«K2>*(1.DC/(CSO2-0.!00*Cll2S)>*(C1-C2)
ENDIF

EWIF

NETIMN
ENO
SUUOUTINE SULFSOLINCOMP.STREAm.STREAIO.TSOl.PSOL.EPSllCN,
1 ERltOR)

C SULFUR S O L U t l l l T f ROUTINE
C
C LAST UTOATE: 0 4 / 2 1 / 8 6

IMPLICIT REAL*8fA-H,0-Z>
a
INTECE* 2 ERROR

REALM ST«EAHI(K).ST«EA»0<2S>,X(20),HU(20)

EXTERNAL SULFUR

ERR0R4)

C TRANSFER ALL INPUT VALUES TO OUTPUT

DO 10 I'l.NCOMPtS
10 STREAHOdl'STXEAHKI)

C CALCULATE SULFUR SOLUBILITY


XS*SULFUR(TSOL>

C SEE I F SOLIKILITT HAS K E N EXCEEDED. SKIP- I F NOT


IF(XS.GT.STREANKS)) GOTO !C0

C CALCULATE FLOUS OF DISSOLVED AND SOLID SULFUR

C TOTAL SULFUR FREE FLOU


FLOUNS<STREAN0(NC0NP»1)*(1.0DD-STREA*»<S)-SIREAN0(17»

C TOTAL SULFUR FLOW


SULF*CSTREAH0[S)*STREAH0(17»*STREAH0CNC0HP»1)

C CALCULATE DISSOLVED SULFUR FLOV*XS*FLOWHS/(1.00-XS)


FLOUSU=XS*FLOMS/(1.00-XS)
C SET OUTLET FRACTIONS OF DISSOLVED SULFUR AND SOLID SULFUR
ST?SAHO<S)*FlOUSU/STREAMXNa>«>M)
STtEftMD(17]'(SUlF-fLOUSU)/STREAK)(NCOMF>*1)

C SHOW S T K M COIFAIW N i l OF LIQUID M D SOLID


l f ( S T R E M l ( N a M > » 5 > . l T . i . D 0 > THEN
STREAK>(NCOI>*S)»STIEMII (NCOMf>»5)»3
ELSE
STDEM«{IK(M>»5><S!tEMII (KONP»S>
ENDIF

C SET OUTLET STREAM TEMPERATURE A M PRESSURE


100 STREM«XNC0Hr»Z)>TS0l
STRE*NO<NCat>tJ)>rSOL

C CALCULATE OUTLET STREW ENTHALPY


DO 150 1 * 1 , K O W
ISO MD'STREAMOU)

CALL KAT(0J,NaNP,TSOL,FSOl,>(,MJ,NT)

STRE*MO(VCOW»«)<lir

RETURN
END
SUBROUTINE SEIHERCNC.STRI.STRS.SIRO.IfTS.PS.EPSIUM.ERROR)

C SULFUR SETTLER SUMGUTIXE


C
C LAST UPDATE: 04/21/84

IMPLICIT REAl*a{A-N,0-Z)
INIEGER*2 ERROR
REAL'S STRK25?,STRO(2S>,STRS<2S>,XO(20),XS(20),XX<20)
REALM STRIT(ZS)
REAL'S HOLUTCZO)

COMM /NOLEC/MOLUT

C SHOU DO ERROR TET


ERROR*0

C HAKE CALL TO SULFUR CRTSTALLIZER ROUTINE TO CHECK SULFUR SATURATION


00 3 I'l.NC'S
3 SIRIT(I)'STRKI)

CALL CRTSTAL<NC,ST*IT,STRI,EFStlVI,ERROR>

C H I T TEHPORART MOLE FRACTION VALUES


DO 5 l*1,K
XO(I)«0.000
5 XS(l).0.000

C CONVERT FROM UT X TO UT FUCTION


UTS*UTS/1O0.0D0

C CALCULATE THE TOTAL MASS FlOU OF THE IHLET STREAM


UTI*O.OD0
00 10 1=1,HC
10 UTI=UmSTRI(l)*STRI(HC»1>*H0lUT(i>
C U L C U U T E MASS FlOW OF $0110 SUIFUI AND REMOVE IT FROM THE OVEMLL FLOU
WS«$T«l<17)«tt«l«tC»1)*WXUT(17)
UTI*UTI-US

C CALCULATE FRACTION OF SOLVENT STREAM 10 TRANSFER U1TN THE SULFUR


C AMD FMCTION TO REMOVE
fH-[US'C1.MUTJ)/(WT$»WTI))
FT2-1.000FT1

C MAKE SUM THAT SUFFICIENT SOLVENT EXISTS TO T I E I D THE DESTIRED Iff FMCTION
C OF SULFUR • • I F HOT ENOUGH THEN TRANSFER ALL OF THE SOLVENT STREAM TO
C THE EK1T SUIFUI STREW
m m . G J . 1 . 0 0 0 ) THEN
FTM.ODO
FI24.000
ENDIF

C SET FLOWS FOR H T N EXIT STREAMS


STHO(NC*1)<0.aM
S?RS(NC«1)<0.0D0

CO 20 I - 1 . N C
STRS(I)>FT1«STRI(I)*STRI(HC«1>
SI«S(NC»1)»ST«S«H>1)»SIRS(I)
>
STR0(I>'FT2 STRI(I)*STRI<NC*1>
20 STR0(NC«1><STR0(IK>I)*STR0(I)

C HOVE ALL OF THE SOLID SUIFUI TO THE SULFUR STREAM


STRS<17)*STRI<17)*STRI(IK>1]
STRS(NC«1;«SIRS(IK«1)»STR0(17)
STR0(HC*1>>STR0(NC*1>-STR0(17)
STRO(17)*0.OD0

C CALCULATE EXIT MOLE FRACTIONS


IF(ST«S(KC«1).E0.0.000) GOTO 30
DO 25 1=1 ,NC
si«s(i)»si«s(i)/sws(i(C»n
25 XS(I)«SKS(I)

Jo iFcsTioiK'D.Ea.o.aoo) GOTO * O
DO 35 1-1.IK
StKK I )'STItO( I )/SIKO(*C»1)
55 X9(I)'ST«0(I>

C SET EXIT TENP, MESS, WD PHASE


AD STXOtlK»2l'SI*lflK>2)
STIS(K*2)'Siai(IK*2)

SMS(NC»3)»PS
SU0(ltO5>'5T«l(IICv5)
IF(STII(K*5).LE.ll t « «
STRS(HC«S)'STItl(NC«S)<3
ELSE
ST«S(MC«5)»SI«I<IIC»5)
ENDIF

C CALCULATE EXIT STREAM EMHALPV


CALL HEAT(0,1,ltC,SmO(KC»2),PS,X0,«X,ST«O<ltC»*»
CALL H£AT(0,1,ltC,ST«S()*C«2),PS,XS,HX,IT«S(»C»*))

XETUtH
END
SUMOUTIHE IMSHERWC.STRI.SIRU.STRO^STRS.PS.WTS.EKlLai.EMO*)

C SULFUi HASHES
C
C LAST UPOAIC: 0 4 / c V 8 6

IMPLICIT REAL*BtA-H,0-2)
LOGICAL ERROR

REALM S T « I ( 2 5 ) , S T R U ( 2 5 ) , S T R O ( 2 5 ) , S I A S < 2 5 ) , S T R I N ( 2 5 >

EUW'.FALSE.

C THE UASHE* I S TREATED AS A C O M T H A T I M OF A H I K E * CIKLET «IMTER) AW)


C A SETTLE* (SULFUR/UATER I S REKWEO F K M IKE M I N LIQUID STREAK)

C CALL KIXE* ROUTINE TO H E W ) INLET S U L K * SLURRY UITH UATE* UASH

CALL MXER<HC,$TRL,SIRU,STRIH,P$,IPHASE,EPSILOM**0*>

C SEW) OUTLET OF N I X E * TO SETTLE* TO REMOVE "WASHED SULFUR*


CAIL SETTLE*(NC,STRIN,STRO,ST*S,WTS,F>S.EPSU0N,EIR0R)

RETURN
ENO
SUaROUTINE HELTOECCNC.STRI ,TMELT,PHELT,STRU,STRS,alN,EPS,l R)

C MELTER/DECAMER SUMOUTINE
C
C LAST UPDATE: 04/21/86

IMPLICIT REAL*8(A-N,0-Z)
•NTECE**2 ERROR
DEAL'S STRI(2S),STItU(25),STftS(2S),IM<20>
«E«l*8 XC20J
REAL'S STL<2S).STV(2S>

C INITIALIZE OUTPUT STREAM MOLE FMCTIONS TO Z E N


DO 10 I ' l . N C
STMKD'O.ODO
10 STRSCI)«0.OW>

C SET OUTLET FLOWS AND MOLE FRACTIONS


C ASSUME OUTLET SULFLM STREAM IS PUKE SULFUR LIQUID
STRS(NC»1)*SIRIC17)*STRI<NC»1)
STRS(17)'1.0D0

C SET EXIT WATER STREAM


C CALO&ATE COMPONENT FLOWS AND TOTAL FlOU
STRU(NC»1>«0„00
DO 20 1»1,HC
ST«U(I)»S7«1(I)«STR1(»C»1)
20 STRW(NC»1)*$TRWCNC»1)»STRU(I>

STRW(NC+1)*STRU(IIC«1)-STRI(17)*$T(I(NC«1>
STRU(17>'0.D0

C CALCULATE EXIT MOLE FRACTIONS IN WATER STREAM


IF(STRW(NC«1>.EO.0.D0) GOTO 35
00 30 I'l.NC
30 STRU(I)*STRWCI)/STRU(NC*1>
C SET CUTLET TEHP.PRESS, AM) PHASE
35 SIHU(HC*2)'TNEIT
S1KU(HC«3)«F*EIT
ST«U(HC»5>"1

STK:(NC<2)«TNELT
STRS(NC»3> PHELT
STRS(NC«5)«1

C PERFORH ISOTHERMAL FLASH CM UATE« STREAK


IHAX'20
CALL PIFlASHdK.STRW.HClT.tMElT.STL.STVjEPS.IPHASE.IHAX.ERKK)

<
SHtU(NCH)'(STL(NCH) STL{NC«1)«STV(HCU)*STV(IIC»1»/
1 SIRUCHOl)

IF<IPHASE.E0.2) THEN
STRU(HC*5>»2
ENDIF

IFUPHASE.E0.3) THEN
STRU(HC»5)»3
END IF

C CALCULATE ENTHALPY OF EXIT SULFUR STREAM


00 40 I-1.HC
40 X(I)*STRS(I>
CALL HEAT(0 1,NC,TNELT,PNELT,X,HX,ST*S(NC«(»
<

C CALCULATE INPUT HEAT REQUIRED


OIN>STRU(KC«4)*STRU(NC*1)<STRS(NC+4)*STRS(NC«1)-
1 STRI<HC«4)*STRI<HC«1>

RETURN
END
SUBROUTINE FURN»CE(»C,SO2l<E0,STSUlF,ST2,STAIR,STOUT,TOUT,POUT,
1 OOUT.EPSILON, ERROR)

C FURNACE SUBROUTINE
C
C LAST UPDATE: M/21/S6

IMPLICIT REU'BtAH.OZ)
INTEGER'2 ERROR
INTEGER'2 RET
REAL'S STSULF(25),ST2<25),STAIR<25>,STOUTa»; ,HX<20>,X(20)
REAL*0 CHAT(20,5)
C MATRIX OF COEFFICIENTS FOR COMBUSTION CALCULATIONS
DATA (CNATd, I ) , M ,5)/0.D0,O.DO,O.DO.O.0O,0.O0/
DATA (CMAT<2,l),M,5)/0.D0,0.D0,0.DO,O.DO,1.DO/
DATA <CMAT(3,l),M,S)/t.SDO,1.DO,1.DO,O.DO,0.00/
DATA <CHAT<4,1), l«1,5)/0.00,0.00,0.00,0.00,1 .DO/
DATA <CKAT(5.1),i»1,5)/0.D0,0.D0,0.00,0.00,0.00/
DATA (CMM<6,l),I.1,5)/0.D0,O.0O,0.DO,O.00,1.OO/
DATA (CKAT(7,l),IO,5)/0.D0,0.D0,0.D0,0.00,1.00/
DATA (OUT<8.I), I»1 ,S)/Z.D0,0.M,2.0O.1.00,0.00/
DATA CCKAK9,1), 1-1,5)/0.5O0,0.O0,1.00,0.00,0.00/
DATA (CNAT( 10,1), 1-1,5)/0.5O0,0.O0,0.DO,1.00,0.00/
DATA <CH»T<11,1),l«1,5>/3.500,0.00,3.00,2.00,0.00/
DATA CCHAT<12,I),I' •,5)/5.00,O.DO,«.DO,3.DO,0.DO/
DATA CCMAT<13,I),|.1,5)/6.5DO.O.O0,5.OO,*.O0,0.00/
DATA (QUICK,!>,1-1,5>/B.D0,0.DO,6.U0,5.DO,0.DO/
DATA (CHAK15,1),l«1,5)/3.D0,1.DO,2.OO,1.00.0.00/
DATA (C \[(16,l),l»1,5)/*.500,1.00,3.00,2.00,0.DO/
DATA (CHAT<17,I),M,5>/1.P4,1.D0,0.D0,0.D0,0.D0/
DATA (CKAT( 18.tl.l-1,5)/0.00,0.00,0.DO.0.00,1.00/
DATA (CHAT( 19,1), I>1,5)/0.00,0.00,0.00,0.00,0.00/
DATA (CKAT(20,1), 1-1,5>/0.00,0.DO,0.00,0.DO,0.00/

C NOTE: ON INPUT THE VALUES FOR COMPOSITION, T, P. AHO PHASE FOR


C THE AIR STREAM ARE SET. THE FLOW IS CALCULATED IT THIS ROUTINE.

CO
C IT IS ASSUMED THAT TKEIE IS NOTHING IN THE A M WHICH CAN IE
C MMHED

C UE ASSUME COMPLETE COWUSTTION OF ALL COMPONENTS WHICH N U M .


C A STOICHIOMETRIC ANOUN1 OF OXYGEN IS USED.

C THE INLET STREAMS ARE:


C STSUIF • MAIN SULFIM CONTAINING STREAM FOR S02 PRODUCTION
C ST2 • 'JUNK* STREAM CONTAINING ANYTHING WHICH WE WOULD
C LIKE TO IURH (INCLUDING SULFUR C M O S )

C ON INPUT THE TEMPERATURE, PRESSURE AND PHASE OF THE SULFUR STREAM


C SHOULD (E SET. THE FLOW OF STSUIF IS ADJUSTED TO TIEIO THE CORRECT
C AMOUNT OF S02 IN THE OUTLET (S02REQ) TAKING THE SOZ FORMED FROM THE
C '.•Wt' STREAM INTO ACCOUNT

ERROR *0

C CALCULATE THE S02 AVAILMLE FROM THE "JUNK" STREAM


S02FORH'ST2(«)*ST2(NC»1)
DO S 1-1.HC
5 S02FORM>S02FOKN«ST2< I >'STJ(lt01)*CMAT< 1 , 2 )

C ADJUST FLOW OF MAIN SULFUR STREAM TO ACCOUNT FOR S02 PRODUCED


C I T RUINING THE "JWK" STREAM
DEIS02*SOZREQ-SOZFORN
SULFSLM'STSULFCt)
DO 7 l > l , N C
7 SULFSUM'SmFSUH»STSUtF<l)*CHAT<l,2)
STSULF(NC«1)4JELS02/SULFSUH

C ZERO THE OUTPUT STREAM


DO 10 l'1,HC»S
10 STOUKD'O.OOO

O2REU=0.0O0
C DETERMINE OXTGEH REQUIREMENT
DO 20 I«1,NC
20 O2REa>O2RE0»(STSUI.F(l >*5TSUIF(IK>1)*SI2( I )*SI2(NC»1))*CHAT( 1,1)

C CALCULATE INLET All REOUIREMENT


STAIR<NC»1)>02IEQ/SIA1R(19)

C TRANSFER All IKAIS TO THE OUTLET STREAM


DO 30 I-1.MC
30 SICUT<l)«(SISULF<l)*STSULF<IK>1)«ST2ti)*ST2(IH>1)»
1 SIAIR<I>*STAIR(IK«1»*CHATCI,5)

C DETERMINE AMOUNT OF $ 0 2 , C02, AM) H20 FORMED


DO « 0 l«1,MC
STOUT(«)»STaUI(t)»<STSULF< I >'STSULF(IH>1 )»ST2( I >*ST2(NC»1»
1 *CMAT<I.2>
ST0UT(2)*ST0UT(2WST5IH.F(l)*$TSUlF(IN>11»ST2(O*ST2(IH>1))
1 •CHAT<I,3>
«0 STOUT (6>*SlaUT(6>»(STSULF( I >*STSAF (NC*1 )«ST2< I )*ST2(NC»I) )
1 •CHAKl.t)

C CALC TOTAL OUTLET FLOW AND CONVERT COMPONENT FLOWS TO HOLE FRACTIONS
DO SO I ' l . N C
SO ST0UT(M>1)*STGUTCI«>1)*ST0UT(I)

DO K l>1,NC
60 ',rOUT(l).STOUT(l)/STOUT(NC»l;

C CALCULATE AIR ENTHALPT


DO 70 l«1,NC
70 XCD'STAIRd!
CALL HEAT(0,2,NC,STAtR(M>2>,STAIR(M>3),X,ia,STAIRCNCH»

C CALCULATE SULFUR STREAM ENTHALPY


DO 7S I ' l . N C
75 X(I)=STSULF(1)
CALL HEAT<0.1.NC,STSUIF<NC«2>,STSULFCNC*3),X,I«(,STSUIF(NC*4)>
C SET H I T U S T.P.MASE
SI0UTCHC«2)'TX1
S!CUT(»C»J).MUT
SlOUT(KC-t5)'2.0O0

C CUC H I T US EXTKALPr
DO 80 M.NC
80 Xtl)'STOUT(l)
CALL MEtT<0,2,»C,SIOUT(l(C»2),STOUT<l(Ce3).»,«,JTOUT(l(C»*))

C CALCUUTE OOUT
,
«0UT<STAU(IK>1)*STMI(IK>4)»STM.FtllCM> STSULF(IKH)»
<
t ST2(NC«l>*ST2(NC«*)-SIOUT(IK»1> $IOUT(IIC«4)

IETUM
ENO
SUMOUTIHE CCWESSCMC.STREANl.STREAIB.POUT.POIM.IIIAX.EPS,
1 ERROR)

C UST UPDATE: 0 6 / 1 0 / 8 6

c COMPRESSOR s u t t o n i K . USES PRESSURE CHANCE TO CALCULATE THE OUTLET TEN


C PHASE, AK> ENTKALPT. ASSUMES ADIAIATIC OPERATION AH) IDEAL 6ASSES.
C ALSO RETURNS THE K U 1 REQUIRED.

IMPLICIT REAI*SCA-R,0-Z>
INTEGER*2 ERROR
REAL** HOLUT(20>
REALM STREAMK25).STREANO{25)
REAL'S STRL(2S),STRV(25)

COHWM/MX.EC/MOIWI

C TRANSFER ALL VARIAILES FROM INLET TO OUTLET STREAM


DO 10 l'1,NC*S
tO STREAMOCI)'STREAHICU

C SET NEW VALUE FOR PRESSURE


STRERM0(NC»3)«P0UT

C CALCULATE THE EXIT TEMPERATURE


STREAHO(NC*Z)«STREAHI(NC»2)*<(PaUT/STREAHKNC*3))**.02B)

C FLASH TNE STREAM TO DETERMINE ENIRALPT AND PHASE


CALL PIFLASH(NC,SIREAM0,P0UT,STREAH0{IH>2),STRL,STRV,EPS,
1 IPKASE.IMAX.ERROR)

a
STREAHO(NC^)-(STRL<NC»1)*STRL(NCH)*STRV(KC«1> STkL(NCU))/
1 STREAHO(N[>1)

STREAMO(NC<5)=IPHASE
C CALCULATE THE FOCI KOUIUK«T
MATI0MaUI/SIiEMICIK>3>
POCOTST-W.OWOO«ST«EM1 l»C»J)«5HE«(l (»C»1)

IFIMUTIO.ll.S.M) THEN
C SINGLE STAGE COHMtESSIM
FCUEMPOCOKS ! • ( « » ! IO"0. HDO-1.00)

ELSE
c HISH CWPIESSIW, USE 2 SIACE amESsa*

HUEI>MCaKI*Z.OO*(rUIIO»O.1«0O-1.DO)

EKOIF

IF<STIEAWXIK»S).Ea.3) THEN
Emtat'2
ELSE
EMOt«0
ENDIF
•EVUW
END
SUWMUTIIF *XXn!<IK,r,$Tltl1,tTai2,STM1,STa02,VTSl,WTSZ.
I tPSILCH.tOM)

C SUFUI CENTRIFUGE ROUTINE


c
C LAST UPDATE: O t / 2 1 / M
C
C TIE SULFUR CEITIIFUCE SIHJLATES THE ACTION Of A PUSHED TYPE
C CENTRIFUGE.
c TIE tourmt CONSISTS OF FOUR OPERATIONS:
C 1 . SETTLE INLET SULFUR SLURRT TO r O M INDICATED WTX SLUNRT
C 2 . WASH SLUMV (USUALIT WITH WATER)
C 3 . SET' .f S U M T TO NEW WTX SULFUR IN EXIT
C * . NIX IIQUIOS ONIAINEO I I STEPS 1 AW 3 TO FOIW EXIT LIQUID
C

IMPLICIT IEAI*ICA-N,0-Z>
IIIEGEI*Z EMM
REAL'S SIRIt(ZS>,STRI2(25)
REAL*B SIAOI(2S) StX02{2S)
>

C STOUCE FOX INTERMEDIATE SItEHtS


IE«l»i $miT1(25).SHINT2(2S> STIIHT3(25> tTillH(SI
> >

C DO FIRST SPLIT (CENTRIFUGATION) OF SULFUR FROM INITIAL ENTRANCE STREAM


CALL SETHER(NC,STRI1,SIRlNT3,STRINT1.WTS1,P,EPSILON,ERtaR>

C IKV NIX I N UATEI WASH


CALL NIXEROIC.STRINTS.SIRH.STRINTt.r.O.EPSIlOX.ERROR)

C K I F O M SECOND SPLIT
CALL SETILER<*C,$TRINT4,STR01 STRINT2,WTS2,P,EPSLLON,ERROR>
>

C DO FINAL NIX TO FOAM EXIT LIQUID STREAM


CALL MIXEK(NC,ST«I«n,STI<IIITJ,STRO2,P,0,EPSIlON,ERROR)

RETURN

-J
ID
180

S
witasTim ruau>(wc,stiif,Kom,tca*>,t!ti.,tiM,Kiie,[rt,
1 iNu.Eim)
t M H I A l C M K I S E I OH ISOTHERMAL FLASH
c
C LAST (MATE: H / 2 1 / U

IMPLICIT «EAL*8(»-H,0-Z)
IHEGER'2 ERROR
REAL** STRF(2S),SIRL(2S>,SIRV{2S>

C H E M PARTIAL CONDENSER U M ISOTIIEMHL FLAM CALCUUTIM


CALL mUSHtMC.STRF.KOK>.TCO)R>,STRL,STRV.Er$, IFKASe,
1 IHU.ERROR)

C CALCULATE ERTHALPT REMOVAL


0CIK;'STRl(IC+1)*:TRl<«C«4)»$TRV(IM>1)»STRV<NC«4>'
1 SI«F(HC»1)*ST«F(IK**)

RETURN
END
SUU3J7IHE KATER(NC,SIRI.STRO,g|N,EPSIlU,ERROR)

C HEATER
C
C LAST UFOATE: 04/21/84

IMPLICIT REALM (A-R,0-Z>


REAL'S STRK2S),STRO(2S),ai* EPSHON,STRL<ZS) SIRV(2S>
> >

REAL'S HX(20>,DHXDn20),X<20)
INTEGER*2 ERROR

C SET MXIMUM ITERATIONS FOR TEMPERATURE CONVERGENCE


IHAX>20

ITER«0

C ADD THE HEAT GIVEN IT OIN TO THE STREAM INLET


C FLASH THE STREAM TO SEE IF A PHASE CHANGE OCCURS

C TRANSFER INLET STREAM TO OUTLET STREAM AND SAVE HOLE FRACTIONS


DO 10 l«1,MC»5
10 SIRO(I)'STRHI)

DO 15 l»1,NC
15 X(l)<STRO(l)

C CALCULATE UPDATED ENTHALPY


>
STR0(NCH)*(STRI(NC'>4) STRI(NC*1>*alN)/SIRICNC«1)

C FLASH THE STREAM TO CHECK FOR A PHASE CHANCE, DETERMINE OUTLET TEHP
SO CALL PHFLASH<NC,STRO,STRO{KC*3>,STRL,STRV,EPSILON,IPHA$E,1MAX
1 .ERROR)

C SET 8ETURH PHASE


ST80(MC«5)=IPHASE
C SET tEtUM lEWEUTUtE
SI«0(MC«2)=SI«llHC*2>

•ETUtH
END
SUMOUTINE SIOR»G£<IIC,STAEAMI,ST«EA»«0,FICUIO,ICOHP,TOUT>

t-"
C STORAGE OR COMPONENT P!OU SET ROUTINE 00

C
C LAST UPDATE: O t / 2 1 / M

IMPLICIT REAL'S (A-H.O-Z)


REAL'S STXEAHUH),STI1EAMO(ZS),X(20) HX<20>
>

C SET RETURN VALUES FOR ALL ZI,F10U,TEHP,PRESS,ENTHAIPT,PKASE


0 0 10 I ' 1 , N C * S
,0 STREAW{l)*STREAMI(l;

c MODIFY FLOU IASES ON DESIRED FIOU OF COMPONENT I


C LEAVE COMPOSITION UNCHANGED

SIAEAHOCNOI)*FIOUIO/STREANI<ICOHP>

C MODIFY TEMPERATURE TO THAT SPECIFIED


STREAM0(NC«2)*T0UT

C RECALC ENTHALPY
DO 20 1*1,«C
20 Xr|)'SIREAMOCI)

1PHASE-INT(STREAM0(NC*S>1
PRESS«STREAM0(NC*3>

CALL HEATCO, lPHASE,NC,TOUT,PRESS,X,HX,SIREAM0(NC+«))

RETURN
END
SUM0UT1HE CRTSTAKIIC.STRI.STRO.EPSILCN.ERROR)

C SUIFUI CRYSTALLIZE*
c
C LAST UPDATE: M / 2 1 / B 6

C CALCULATES AND RETURNS THE ANGUH1 OF SUIFUI WHICH IS TRANSFERER TO


C THE SOLID PHASE IASED OH THE INLET CONDITIONS OF STRI
C USES THE SULFSOl ROUTINE

IMPLICIT REAi*8(A-H,0-Z>
INTEGERS EUOII

REAL«8 STRI<2S),STROC2S>

C SET TEMPERATURE AHO PRESSURE FOR SULFUR SATURATOR


TSOl'STRICHC«2)
PSOL<STRI(NC«3)

C CALL THE SULFUR SOLUBILITY ROUTINE


CALL SULFSOKNC.STRI.STRO.TSOL.PSOL.EKIION.ERROX)

RETURN
EBO

00
in
SUBROUTINE MAKUPMC.STREAMI,STREAMO,FLOUIO,ICOHP,IHAX.EPS.ERR)
IMPLICIT REAL'S (A-H.O-Z)
REAL'S SIAEANI(2S),STAEAMO(2S),X(ZO),UX(20)
REAL'S STRL<25),STRV(25)

INTEGER'2 E M

C LAST UPDATE: 0 6 / 1 0 / 8 6

C SET FLOW OF COMPONENT ICOMP IEAVIHC AIL OTHER FLOWS UNCHANGED

C CALCULATE ALL FLOWS


DO 10 l » l , N C
a
10 STREAHO(i:>STREAMI<l) STREANI<IK>l)

C SET FLOU OF ICOHP, CALCULATE MEW HOLE FRACTIONS


STREAMOC iCCMP)*FlOU!0
STREAHO(NC«1>*0.000

DO 20 I ' l . N C
20 STREAHO(NC»1 >*STREAM0(M>1 )»STREAM0( I )

DO 30 !«1,NC
30 STREAMO(l)iSTREAMO(l)/STREAHO(NC«1)

C SET TEMPERATURE, AND PRESSURE


STREAMO(NC»2)'STREAHI<IK>2>
STREAM0(NC«3)'STREAM(NC»3)

C SET ENTHALPT AM) PHASE i f FLASH CALCULATION


CALL PTFIASH<NC,SIREAHO,STREAMOCNC»3),3TREAMO(MC*2>,STRL,STRV,
1 EPS,IPHASE,IMAX,ERR)

C SET ENTHALPY
S T R E » H 0 ( H O 4 ) " ( S m < H O 1 >«STRL<NC«4)«STRV(NC*1 ) * S T N V ( N C « t » /
1 S7RE»HO(HC»1)
1B7

$ -
SUBROUTINE TSET(NC,5TRI.STR0,T,QCHG,IMA>,EPS,ERR)

C TEMPERATURE SETTER ROUTINE


C
C LAST UPDATE: 0 4 / 2 1 / 8 6

C CHANGE THE TEMPERATURE OF THE STREAM TO T


C RECAIC ENTHALPT AW RETURH HEAT REMOVED OR ADDED
IMPLICIT REAL*B(A-H,0-2>
REAL'S STRI(23),STRO(2S)
REAL'S STRL(2S),STRV(2S>
INTEGERS ERR

C TRANSFER MOLE FRACTIONS TO OUTLET AND TEMPORARY VECTOR


DO 10 l>1,HC
10 STRO(D'STRKI)

C SET EXIT FLOW, TEMPERATURE, PRESSURE, PHASE


STR0(NC«1)'STRI(Nt>1)
STR0(NC«2)'T
STR0(NC«3)<STR1(NC«J>
STR0(NC«5)>STRI(NC«S)

C FLASK THE EXIT STREAM

CALL PTFLASH(NC,STR0,STR0(NC»3>,T,STRL,STRV,EPS,IPH,1MAX,ERR)

C SET OUTLET STREAM ENTHALPY AND PHASE

STRO(NC»«>>(S?RL(NC«1)*STRL(NC*4>«STRV(NC«1)*STRV<NC«4»/
1 STB0(HO1)
STR0(NC«5)'IPH

C CALCULAiE ENTHALPr CHANGE


0CHG=(STR0(HC»«)-STRI(NC**»*STRI{NC»1)
189
SUBROUTINE HCSPLIT<NC,STRI,STt01,STR02)

C HYDROCARBON REMOVAL ROUTINE


C
C LAST UPDATE: 04/21/86

C ROUTINE TO SPLIT STREAMS LEAVING ALL OF THE HYDROCARBONS


C IN EXIT STREAM t.
C THIS ROUTINE IS NOT THERHOOYNAMICALLY VALIOI
C IT SHOULD ONLY IE USED IN CASES WHERE A NEA4LY COMPLETE
C SPLIT BETWEEN HTDROCARIONS AM) OTHER COMPONENTS CAN IE
C OBTAINED. AN EXAMPLE OF THIS WOULD IE A PHASE SPLIT BETWEEN
C WATER AND HYDROCARBONS. UNDER THESE CONDITIONS THE ROUTINE PERFORMS
C A USEFUL ALTHOUGH NOT STRICTLY "KOSHER" FUNCTION.
C
C IF THE SIMULATION IS EVER UPDATED TO SIMULTANEOUSLY HANDLE TWO
C SEPARATE LIQUID PHASES, THIS ROUTINE CAN BE CHANGED TO AN
C EXTRACTION SUBROUTINE

IMPLICIT REAL'S (A-H.O-Z)


REAL'S STRI(25),STR0l(2S),STRO2(2S),XI(20l X2(2O) HX(20)
I <

C INITIALIZE CUTLET STREAMS


DO 10 l»1,25
ST*OKI)*0.OD0
10 STR02(l>sO.ODD

C TRANSFER ALL HYDROCARBONS TO EXIT STREAM 1


STR01(8)*STRI(8)*STRI<HC*1)
STR01(11)*STRK11)*STRI(NC*1)
STR01C12)*SIRI(12)*STRI(NC*1)
STR01(1])*STRI(13)*STRI(NC*1>
STR01(H>iSTRI(H)«STRKNC*1>

C CALCULATE EXIT FLOW IN STREAM 1


DO IS M.NC
15 STR01 ( N 0 1 )=STR01(NC«1 )*STR01( I )
C TRANSFER OTHER COMPOWKTS TO EXIT STREAK 2
00 20 I-1.MC
20 STR02<I)-ST«ICI)*ST«I(»C»1)

C CORRECT STREAM 2 FOR HEMMED HTDROCARKMS


STR02<8>'0.000
STRO2(11>'0.0DO
STRO2(12)'0.0O0
STRO2C13)'0.0D0
STRO2(U)«0.0D0

C CALCULME EXIT FlOU I I I STREAM 2


0 0 25 M,NC
25 STR02(»C»1)»STR02(NC»1)•$-«»(i)

C CALCULATE HEU HOLE FRACTIONS


IF(STR01(NC*1).EO.O.CO) GOTO 35
00 30 1-1.NC
30 STR0I(I>'STR01(I)/ST*01(«C«1)

35 IF(SIRO2(HC»1).EQ.0.OO) GOTO 45
DO 40 1-1.NC
40 STR02(I)>STR02(I)/STR02(HC«1>

C SET EXIT TEHP, PRESSURE, AND PHASE


tS STROUNC»2)*ST«l(NC«2)
STROUKC»3).STRI(NC»3)
STR01(NC+5)-STRI<MC«5>

STR02(NC*2)sSTRI(NC»2>
SIR02(KC*3)«STRI(NC»3)
STR02(HC»5)*STRKNC«5>

C CALCULATE EXIT ENTHALPIES


DO SO I-1.KC
XHD'StlOKI) £
SO K2(I)>SIII02(I> ^

CALL HE«I(0,1,NC,ST«01<IIC*2),5I«O1(NC«J),X1,KX.Sm01(ltC»t))
CALL «EAT(P,1,XC,STR02(IIC»2>,STIt02(NC«J),X2.IIX,STIl020<O4»

KETURH
EDO
SUHHMTIUE PTFlASK(NCOHP,STREA)IF,PFLASH,TFLASH,STRL,STRV,
1EPSILON,IPHASE, IHAX.ERROR)

C ISOTHERMAL FLASH
C
C LAST UPDATE: 0 4 / 1 6 / 8 6
C
C REFERENCE: KING, 1 9 7 1 , PCS. 75-80

IMPLICIT REALM <A-H,0-Z)


INTEGERS ERROR
INTEGERS NCOMP.IHAX.ITEJt
«EAl*8 SIREAKF(K),PFEE0,TFEED,F,2F(20),HF,PFLASH,
t TFLASH,V,L,X(20},rC20),EPSIlC«
REAl«8 SIRL(25>,$TRV(25)
REAL'S TMK.TOEU.VF
REAL'S M 2 0 >
REAL'S OLDF.NEU
DEAL'S FOREV
REAL'S H I . H F K 2 0 )

C SET ERROR RETURN TO AN ERROR CONDITION, SET RETURN ENTHALPIES 10 0


ERROR'1
ITER*0
HTI'0.000
HTV'O.OOO

C SET VALUES FOR HOLE FRACTIONS • FIRST GUESS


DO 5 1>1,NCGHP
ZF(i)>STR£AHF<l)
XdWFCI)
5 T(1)»ZF(I)

C SET LOCAL STREAM VARIABLES


HF=STREANF(HCOMPH)
PFEED=STREAHF(HC0MPt3)

U3
TFEED'ST«EANF(*C0HP»2)
F>STUAMF(NaH»»1>

C CALCULATE F W F J AT V/F»0 ANO V/F«1 AM) USE THESE VALUES TO OETEIMUE


C IF NIXTUDE CAN I E FLASHED
CALL KVAl(0,HCOMF>,TFlASH F'FLASH X,r,K) < <

VF0*0.0D0
VFIsl.000
FVFO'0.000
FVF1>0.000

DO 7 l«1,NCOW>
I F < « I ) . E Q . 0 . 0 0 0 ) GOTO 7
FWFO»FVFCK(ZF(IJ"(K(1)-1.000))/(VFO*(K(1)-1.0DO)*1.0DO)
FVF1«FVF1«(ZF< | > • ( « | ) - 1 . 0 D 0 » / < V F 1 * ( K < I ) • 1.0D0>*1.000)
7 CONTINUE

C IF F(V/F> IS POSITIVE AT V / F - 1 THEN HAVE SUPERHEATED VAPON


IFCFVFI.GT.0.000) THEN
DO 10 M.HCCHP
10 «<l)=0.0OO
V*F
L>0.OD0
IPHASE-I
EM0X4
GOTO 100
END IF

C IF FCV/F) IS NEGATIVE AT V/F>0 THEN HAVE 5UB0OOLED LIOUIO


IF(FVFO.LT.O.CDO) THEN
00 IS (>1,NC0MP
15 UD'O.OOO
L»F
V*8.000
IPHASE*1
ERRORO
GOTO 100
ENDJF

C HAVE MIXTURE, PERFORM FLASH CALCULATION

C NAKE FUST GUESS FOR TFLASH AW V/F


CALL •UW>EU(NCCMP,TFEE0,X,V,TIUI,TDEU,I>FLASH,EPSIL0N,2>
VF»CTFlASH-TBU»)/<TOEU-TIUt)
VVF«F

C CALCULATE F
OLDF'0.0
DO 20 M.NCOHP
20 OIDF'OIDF«<ZF(I)*(K(I>-1»/(VF*<K(I)-1>»1.000>

C CALCULATE DF/DV
25 FDERViO.ODO
DO 30 M.NCOMP
a
50 FDERV'F0ERV-(ZF(l)*((IC(l)-1>**2»/<(VF*()[<l>-1>*1.0D0) '2)

C CALCULATE NEW WF, V


VFOL0=VF
VF'VF-OLDF/FDERV

C ROUND VF BETWEEN 9 AND 1 IT AVERAGING OLD VALUE WITN 0 ON 1


IF(VF.GT.I.DO) THEN
VF*(VFOLDt1.D0)/2.D0
ENOIF
IF(VF.LT.O.OOO) THEN
VF*VFOLD/2.D0
ENDIF
C CALCULATE NEU X,T
L»F-V vo
UKITE<6,99000> F,V,(.
1
99000 FORHATtf/F* ,020.10, • V«',D20.10,' L*',D20.10)

00 40 I't.NCOHP
X<l)c2F(l)/(«K(i)-1)*VF>»1)
40 V(l)>X(l)*K(i>

C CALCULATE NEU K VALUES


CALL KVAl(0,NCOHP,TFLASH,PFUSH,X,T,K)

C CALCULATE NEU F FUNCTION


NEUF'O.C
0 0 SO M . N C O N P
SO NEUF*HEWF+(ZFCI>*(K(I)-1))/(VF*(K(1)-1)«1.0D0)

IT6R«ITER+1

C CHECK FOR CONVERGENCE


IF(ITER.GT.IHAX) GOTO 100
IF(DA>S(NEUF).GT.EPSILOH) THEN
OLDF'NEUF
GOTO 25
ELSE

C CONVERGED, SHOW NO ERROR (EXCEPT NIXED PHASE), HAVE MIXTURE AND THEN EXIT
ERR0t<2
IPHASE-J
GOTO 100
ENOiF

C SET RETURN STREAM VALUES


C CALCULATE STREAK ENTHALPIES
100 IF(L.EO.0.000) GOTO 110
CALL HEAT(0,1,NCOMP,TFLASH,PFLASH,X,HFI,HTL)
110 If;..E0.0.000) GOTO 120
CALL HEAT(0,2,NMMP,TFLASH,PFLASH,»,HFI,HTV)

C SET EXIT STREAM COMPOSITIONS


120 0 0 300 M.NCGMP
STRKD'XCD
300 STRV(1)*Y(I)

C FLOW, TEMP, PRESSURE. ENTHALPY. PHASE


STRL(JfeOMP«l)!l
STRV(MC0MP*1).V

STRL(NC0MP»2)sTFLAS!l
STRV(NC0HP»2)>TFIASH

STRL(NCOK>«I)'PFLASH
ST«V(HCOHP>J)«PFL»SH

STRL(NCOHP«<)*HTL
STRV(NC9MP»M*HTV

STRKNC0M>»5)i1
STRV(NC0HP*S)>2

RETURN
END

-J
SUBROUTINE BUBDEUCNCOMP.TFEED.XO.YO.TM.TDEW.PVESS.EPSILOH.ICET)

C U S T UPDATE: 0 6 / 1 0 / 8 6

C THIS ROUTINE CALCUUTES TNE BUS8LE AND DEU POINTS GIVEN THE FEED
C PROPERTIES AND THE VESSEL TEMPERATURE
C IF KET'O THEN CALCULATE RUBBLE POINT
C « Y » 1 THEN CALCULAIE DEU POINT
C KEV'2 THEN CALCULATE BOTH

IMPLICIT R£AL*8 (A-H.O-Z)


REAL'S XO(20>,X<?0),YO(20>,Y<20>,«20),OICDT<20>,K1(20)
INTEGERS KET

IHAX'20

C RENORHALIZE R X E FRACTIONS FCS ANT SOLID OR DISSOLVED SULFUR


C PRESENT IN THE INLET
DO t M . N C O H P
XCI)'XO(I)
1 rci)'YO(i)

SUH0«1.0-X(17)-X<S>
SUN1«1.0-TC1?)-T(5)

C IF STREAM IS ALL SULFUR, SET BUBBLE AND DEI/ POINTS TO NORMAL SUIFUR
C BOILING POINT
IF(SUHO.EQ.O) THEN
TBUS*717.7D0
TDEU*TBUS
RETURN
EWSiF

DO 2 M.HCOHP
X(l)*X(I)/SUHO
Z T(l)>y(l)/SUM1
X(1/)=0.000
Y(17)«O.OD0
X<S;*O.ODO
T(5)«0.000

TT{NP>TFEED»100.0DO
CAtL KV«L(0,NCCMP,TFEED,rVES!i,X.T.K>
CALL KVAUO.WOMP.TTEHP.PVESS.X.T.KI)

SUWO'O.OOO
SUHBl'O.OOO
SUHOPIO.OOO

SUWI'O.ODO
DO 100 ••I.NCOHP
SUMB0'SUnS0*XCI)*K(1>
SW81 <SUHBHX( I ] * K 1 ( I >
IFCK(I).EQ.O.ODO) GOTO 100
I F ( K U I ) . E a . O . O D O ) GOTO 100
SUMO0*SUHDO»r{I)/K(l>
SUMD1>SUH01*rCI)/K1(l>
100 CONTINUE

TBUBNEU'CI .OD0/TFEEDIM1.0OO/TTEW>-1 .W0/TFEEO)*(DIOG<SUMO)/


1 (OLOG(SUHB0)-0lC<i(5UW1»)

TBUBNEtM. WO/TBUBNEU

TOEWNEll»{ 1.OD0/TFEEDW1 .ODO/TTENP-1 .ODO/Tf E E D ) * ( 0 l O G ( 5 U W 0 ) /


1 (DLOG(SUMOO)-DIOG(SUND1)»

TOEWNElM .OOO/TOEUNEU

fF(KET.EQ.I) GOTO 15

!TER=0

5 TBUB=TBUBNEU
CALL KVAICO.NCOW.TMJI.PVESS.X.Y.K) ro
CALL KVALCI.NCCMP.THJa.PVESS.X.T.DKDT) O
o
StMO-O.ODO
SUUO.OOO
DO 10 I«1,«CIWP
SUHO'SUW»K(l)*X(l)
10 SUH1*SJH1»X(J)*0KDT(I>

TtUMEW*TMN-DLOG(SUM0)/(SlM1/SUW>

jF(YBU»KEW.IT.0.000) THEN
TBUBKEU.TBUB/2.000
EH01F

ITER'ITEK*1

IFMTER.Gr.IHAX) GOTO 13

IF«0ABS(TBUB-TBUSHEU)>.CT.EPSILOH> GOTO 3

13 M)ITE(6,10000) TMM
10000 FMMAT<X,'TBUB" \F6.2)

IFdCEY.EO.O) GOTO 25
IS ITE«»0
17 TOEU'TDEUNEU

CALL KVAKO.IICONP.TDEU.PVESS.X.V.K)
CALL KVAl(1,HC0HP,T0EU,PVESS,X,V,DKDT)

SUM0=0.0O0
SUH1-0.000
DO 20 1=1,NC0HP
IFOC(l).EO.O.OOO) GOTO 20
SUHO*SUHO«V(U/K(I)
SUM1*SUM1+(V( l l / K C I )**2>*0KDr< I )
20 CONTINUE

T0EWNEU>TDEU«OLOG(SUN0)/(5UNl/SUM0)

IFOOEUKEU.LT.0.000) THEN
TDEUNEIMDEU/2.000
ENOIF

ITER>ITEK*1

I F ( I T E R . G T . I I U X ) GOTO 22

IF((OABS(TDEU-T0EUNEU)I.Cr.EP5IlOK) GOTO 17

22 WR1TEC6,10100) TOEU
10100 FORHMCX^TDEUz >,F6.2>

25 RETURN
ENO
REAL'S FUNCTION SULFJft(T)
IMPLICIT REAL*S(A-H,0-2>
O
r-0
C SULFUR SATURATION FUNCT'ON
C
C LAST UPDATE: Ot/21/86

C CALCULATE AND RETURN THE HOLE FRACTION SULFUR AT SATURATION


C SET THE VALUES OF A ANO • TO FIT THE E M . OF THE FORM
C LN(UTX SULFUR)*A*TH/T*I
C FOR THE SOLVENT OF INTEREST
C NOTE: TH • MELTING POINT OF SULFUR (112.8 C)
C THE CCNSTANTS A1.I1 APPLT FOR T<TN UHILE A2.I2 APPLY FOR T>TM

C DATA OF SCIAMANHA, 1986

REAL'S NOLUT(20)
REA'.'S HOLR

COHHON/HOLEC/MOUn

DATA »1.II.A2.B2/-10.699,12.39,-5.64,7.12/
DATA IN/385.95/

C CALCULATE WTX SULFUR, CHECK FOR TEMPERATURE RANGE


IF(T.LT.TN) THEN
UTS»0EXPCA1MH/T»I1>
ELSE
UT5«OEXP(A2*TM/T»B2)
ENOIF

C FOR TEMPERATURES LESS THEN 273.16 K, ASSUME tERO SOLUBILITY


INT.IT.273.1600) THEN
UTS'O.OOO
ENOIF
C CONVERT CALCULATED VALUE TO HOLE FRACTION FOR THIS MIXTURE
UTS*WTS/100.0

C GET M T I O OF MOLECULAR UT OF SUIFUI TO THAT OF SOLVENT


MOLR*32.0DO/1ULVT(1)

SULFUR<VTS/(VTS«MOLR*<1 -UTS))

RETURN
END

to
O
<•••••*»•«**»•••»•••»••••««*•••••••*••*•*•*•••••••*••**••*••••*••••••••*•*#
C Iheraodynasic D i l i Subroutines- Motel
c t.....................-..........••.....•••...<.....••••.................

C
C UST UVOATE: (K/21/to
C
C 1.Catling paraneters for Heat end Kvel
C HEAHTTPE,PHASE,«COHP,T,P,XEXP«,HEXP»,HT>
C CVAl(TTP£,IICOMP,I,r,X,T,KXPt)

C where

C ITPfO for calculation of enthalpies (HEXPt. Vtctor of HI, HV, r.)


C TTPE-1 for calculation of derlvatlvet (HEXPH.Vector of 0H10T, DKDr. e t c . )

C PHASE»I for liquid and 2 for vapor


C ( I f aulfur Is present the phase value etay be 4 or 5. These ro^lnes
C treat the fluid as a liquid If phase** and a vapor If phase*5 for the
C purpose of calculating the properles of the other coaponents)

C NCW'Nurfaer of Components

C T*Teeperature In degrees K

C P*Pressure In KPa

C XEXPM Vector of liquid or vapor ante fractions

C Kl-flolar average enthalpy for the streaai

C Conponenvs In the Subroutines are numbered as followed:


C 1-SOlV
C 2.HJO
C J-H2S
C 4"S02
C 5=S-JLFUR OlSSOiVEO IN SOLVENT
C 6=C02
/
C 7=N2
C S-C1
C 9*112
C IOSCO

C 11«C2
C 12«C3
C 13'C4
C H«C5*
C 15=CH3SH
C 16»C2H5SH
C 17«PURE SOLID AW LIQUID SULFUR (PHASE SET I T TEMPERATURE)
C 18*PURE LIQUID AW GASEOUS WATER
C 1942
C 20=»OT USED

C REFERENCES:
C A. ENTHALPIES
C 1. VAPOR NEAT CAPACITIES - REID ET Al. 1977
C 2. HEATS OF VAPORIZATION • REID ET AL., 1977
C 3. HEATS OF SOLUTION IN TETRASLTME
C H2S,S02.C02,C3,C4 • SCIAMANNA, 1966
C 4. ENTHALPIES OF FORMATION • CRC, 1984
C 5. ENTHALPY OF SOLID A W LIQUID SULFUR • CRC, 1984
C 6. ENTHALPY OF TETRAGLYHE • GRANT CHEMICAL, 1982
C
C I . ( VALUES
C 1. SOLUBILITIES OF CASES IN TETRAGLTHE
C H2S,S02,C02,C3,C4 - SCIAHANNA, 1986
C OTHERS • ESTIMATED FROM SELEXOL VALUES - SVEWf, I960
C 2. SOLUBILITIES OF GASES IN UATER - UILHELM ET. Al., 1977
C 3. ANTOINE EQUATION CONSTANTS • REIO ET. AL., 1977
C 4. TETRAGLTKE VAPOR PRESSURE • GRANT CHEMICAL, 1982
C
C C. ENTHALPY DEPARTURE FUNCTION AND FUGACITT COEFFICIENT.
C 1. EQUATIONS AND SOLUTION TO REDLICH-KWONG EQS. OF STATE
C EDMIS7ER, 1968
C SMITH AND VAN HESS, 1973

NJ
O
2. CRITICAL CONSTANTS • SMITH AND VAN NESS, 1975
C BEGIN THERMODYNAMICS SUBROUTINES

SURRDUIINE HEAT(TVPE,IPKASE,MCONP,T,P,K,H,HT)
IMPLICIT REAL'S (A-H,0-Z>
INTEGERS TTPE.PHASE,NCOMP
INTEGERS IHOEKI(20>
R£AL*fl X(20).H(20),HSOLN(20),I(VAP(20>
DEAL'S A(20),l(2O),C(2O),D(20),E<20)
REAL«8 H0EP,PHI(20),SOLO<23>

CCMCN/THM/HOEP.PHI, SOLD, Z

M
C XT PRESENT HV«ATHT"2«CT"3«OT **E, Hl'NV-HSOU
C FOR COMPONENT 17, SUIFUII, SIMILAR EXPRESSIONS ARE USED FOR THE
C CALCULATION OF THE LIQUID OR SOLID ENTHALPY - PHASE DETERMINED IT
C TEMPERATURE.
C

C CONSTANTS FOR EONS.

OATA A<1),t(1>,C(T>,D(1>,E(1>,HSOLN(1),HVAP<1)/397.1«D0,
1 0.OO0,0.000,0.000,-40123.200,78244.5,78244.5/

DATA A(2>,IC2>,C(2>.D(2),E(2),HSOLN(2),HVAP(2)/32.223D0,
1 0.1930-2,1.0550-5.-3.594D-9,-2.418D5,40665.9,40665.9/

DATA A(3),l(3),C(3>.D(3),E(3),HSOLN(3),HVAP(3)/31.921DD,
1 0.1430-2,2.4310-5,-11.7580-9,-0.20205,18765.5,18660.6/

DATA A(4),i(4),CC4),0(4),E(*),HSOlN<4),KVAP<4)/23.83700,
I 6.695D-2,-4.9580-5,13.2720-9,-2.94905,35650.0,2*915.7/

DATA A<5>,B(5),C(5>,D(S),E(5),HSOLN(S>,KVAP(5)/U.98D0,
1 1.3050-2,0.000,0.000,-5622.900,0.000,0.000/

DATA A(6),e<4),C(6),0<6),E(6),HSOLN(6>,HVAP(6)/19.78300,

to
O
1 7.3390-2,-5.5980-5.17.1*30-9,-3.93505.11337.8,1715*.*/
N3
DATA A(7),l(7i,C<7),D(7>,E(7>,KS0lll(7),KVAP(7>/31.13000, O
OS
1 •1.3560-2,2.6780-5,-11.67*D-9,0.<IOO,5577.3.5577.3/

DATA A(8),1(8),C(8),D(B),E(8>,HS01N(S),KVW<B)/19.23900,
t 5.2090-2,1.197D-5.-11.3100-9,-.7*805,8179.7,8179.7/

OATA A(9),1(9),C(9),0C9),E(9),HS0tN(V;,HVAP(9)/27.12600,
1 .9270-2,-1.300-5,7.6*00-9,0.000,903.7,903.7/

OATA A(10>,8(10),C(10>,D(10),E<10>,HSOUt(10),IIVAP(10>/30.850D0,
1 -1.28*0-2,2.7870-5,-1Z.707D-9,-1.10605,60*1.7,60*1.7/

DATA A(11>,l(11).C(11),D(11>,E(113,NSOt.ll(11>,MVAP(11)/5.40600,
1 17.800D-2,-6.933D-$,8.7070-9,-.B*rDS,1*706.a, 1*706.8/

DATA »(12),l(12),C(12/„D(12>,EO2>.HSOt.ll(l2),HVAP(12)/-*.222D0,
1 30.6070-2,-15.81*0-5,32.1260-9,-1.03805,10300.0,18773.6/

OATA A(13>,l(13>,C(13>,D(13>,E(13>,HSOUI(13>.HVAP<13>/9.*81D0,
1 33.11H>-2,-11.076D-5.-2.820D-9,-1.261D5,H970.0,22392.8/

DATA A(1t),l(1*),C(14l.0CU),E(U),HSOLN(1«t,tlVAP(1«)/-3.&23D0.
1 48.70*0-2,-25.7870-5,53.01*0-9.-1.46*05,25773.*,25773.*/

DATA A(l5),i(15>,C(15),0(15),E(15»,MSOU(15>,KVAH15)/13.24000,
1 U.5570-2, •8.5*00-5,20.7370-9,-0.23005,2*560.1,2*560.1/

OATA A(16),a(16),C<T6>,D(16),E(16>.HSOUI(16),MVAP<16>/1*.9120(i,
1 23.*9*D-2,-13.5530-S,31.5990-9,-0.*6105,26777.6,26777.6/

DATA A(17),t(17),C<17},D<17),E(17),HSOUIC17>,HVAP(17>/O.0D0,
1 0.000,0.000,0.000,0.000,0.000,0.000/

OATA A(18).«(18),«185,0(18),E(18),HSOIN(18),«VAP(18)/32.223DO,
1 0.1930-2,1.0550-5, -3.59*0-9, -2.*1805,*0655.9,t0655.9/
DATA AO9),l(19),C(19),D(19>,EC19>,MS0lN(19>,HW,°{19)/26.087D0,
1 -0.000370-2,1.7*50-5. -10.6UD-9,0.000,6B19.9,6S19.9/

DATA A(20>,l(20),C<20),D(20),E(20>,IISOLN(20>,HVAP(20)/0.GO0,
I 0.000,0.000,0.000,0.000,0.0)0,0.000/

C DATA FOR PURE SULFUR CALCULATION

DATA TMElTS,ASl,KL,CSl,ASS,ISS,CS$/392.000,-56Z2.9DO,H.9BDO,
1 1.3050-2,-6972.900,22.5900,1.0(0-2/

PHASE'IPHASE

IF(TTPE.Ea.O) GOTO 1000

C CALCULATE DERIVATIVES
CO 10 l*1,KC0HP
10 HI )«A( I )«2*BC1>*T»J*C< 11«T**2**«0( I > M * M

C CALCULATE ENTHALPY DERIVATIVE FOR PURE SULFUR


IF(T.CE.TNEITS) THE*
K(17)«BSL*2*CSL*t
ELSE
H(17)»BSS»2*CSS«T
ENOIF

GOTO 1600

C CALCULATE ENTHALPIES
C FIRST CALCULATE THE EXTHALPT DEPARTURE FUNCMnN
1000 CALL RKZ<P,T,X,IICGMP>

DO 20 M . N C O H P
20 H( I )=E( I )»A< I >*T»B< I )«T**2*C( I ) M " 3 * 0 < I >«T"4
C CORRECT PHASE TH>£ FOR PRESENCE OF SULFUR
IF(PHASE.GT.J) THEN
PHASE»PHASE-3
ENDIF

C CHECK FOR LIOUID PHASE


IF(PHASE.EQ.I) THEN
C IF THERE IS A SNAIL AMOUNT OF SOLVENT THEN USE HFAT OF SOLN
IF(H(1).GT.0.01DO) THEU
DO 30 M . N C O H P
30 H(l)>H(l)-HSOLN(l>
ELSE
C ELSE USE THE HEAT OF VAPORIZATION
DO 33 I-1.NC0MP
33 H(I)*H(I)-HVAP(I)
ENDIF

ELSE
C FOR VAPOR PHASE ADD DEPARTURE FUNCTION CORRECTION FOR PRESSURE
DO 35 M . N C O N P
35 «(!)»«(I)+HOEP

ENDIF

C CALCULATE SULFUR ENTHALPY


1500 IF(T.GE.THELTS) THEN
H(17)»ASL«BSL«T*CSL*T*«2
ELSE
<, ,
H(17)«ASS*8SS T«CSS T««2
ENDIF

C CALCULATE AVERAGE MOLAR STREAM ENTHAIPV OR AVERAGE DERIVATIVE


1600 HTtO.ODO
DO 40 1-1.HC0MP
a
40 HT'HT«H(l> X(l)

2000 RETURH
, ,
<QOWSlill'0Q-061611l'r6UB 0-00rL2 9l.-J.'n-m I
'£K2-5l/(8)nH'IOSH'(8)n0H'<B)inOSH'(8)0H'(9)3'<B)a'(g)» VIVO

-
/0OR-/ai8'00-l/0W0S'£ iiSS'0000S2l»'0O0V?-'0CW98S I
i
'0<EiS6-»t/(Z)nH1OSH (/)n0H'(Z)NTOSH'(i)0H'U)D'(/)a'U)» VIVO

/0aWSWil'(WZ£99£lVtfmVS66Z*9l-0-'*r£0k£ I
, - ,
0OS485 2Z/(9)n/nOSH'(9)n0H't9)IIKKH (»)0ll'(9)3'<9)C'(9)V VIVO

/oao'o'oa't'oao'o'oao'i'aao'o'oao'o I
- ,
'ooo o/(S)n»iosn {5)no»'(s)iixisH'(5)on'(s)D'(s)8'(sw viva

- , - - -
/0a66-lS0n'0a ZM*'0 0S95£'96 9lV6 S£-'S£ 20K I
'099Z'9i/(9)iMiosK'(9>noH'(*>iiiosH'(*)aH'(t>3'(«)a'(«)v viva

- - -
/oaB» /«9l'0O0 2WZS'S S9«l'W02»'90'92-'*9"e9/l I
'OMl-9l/(£)nHX)SH'<£)n0H'<£)»1OSH'(£)0H'(£)]'(£)a'(£)V VIVO

/oafo'M'i'i'&wi'K-i'a-n-'irviK i
'9£0£'«l/CZ)M1OSH'(Z>IWl'(Z>ll1OSN'(2>0H'(Z>3'tZ>a'(Z>V VIVO

/ooo'o'ooo'i'ooo'o'oao'i'oao'O I
'owo'ooo-o/(i)m-nsH'<i)noM'(i)iiiasK'(t)oii'(i)a'(t)i'(t>v viva

1K10N/3310N/W1HH03
Z'OTOS'lHd'djOH/KUHl/IIOHM

M U Z.KM3WI
<0Z>U11OH 8.1*311
(OZ)Kaa'<OZ)dK31IKd'(£2)aiOS'(OZ)lHJ'd30H 8.1V3I
(oj)«fnosn'(oe)non B . I H V
<
(0Z>N1O$K (0Z>aH'(0Z>3'(0Z>l'C0Z>V'C0ZU"(0Z)X'(0Z»l>lV3ll
(Z-0'H-V> 8.1V3H HSIIdHI
Wk'x'i'i'Moan'iMiiviiui smiroaans

0*3
DATA A(9),l(9),C(9>,H0(9),HS0(.N(9>,Hn((9),HSOlllU(9)/13.«333D0,
1 164.9000,3.1900,41250000,903.7,6867911.00,3026.5400/

OATA AC10),l<10> CC1O>,H0(10>,H5OLH(10),M0W(1C),HSOLNU(ia>/


>

1 14.368600,530.2200,-13.1500,193359.0,6041.7,5521138.00,8872.2800/

DATA A(11),I(11),C{11>,HO(11>,HSOUI(11),HOU(11),II$«.WI(11>/
1 15.6637,1511.42,-17.16,12944.6,14706.8,2747805.00,16261.100/

DATA A<12),l<12),C(12),N0(12),KSftN{12),H0WC12),«SOUIV<12>/
1 15.7260,1872.46,-25.16,2142.0,10300.0,3353518.00,19795.400/

DATA AC13>,i(13),C(13),N0{13> H5OlN(13>,H0U(13>,NSOlNU(13)/


<

1 15.6782,2154.90,-34.42, 723.0,14970.0,4086309.00,21618.200/

DATA A(14),t(14),C(14),H0(14>,HSOlli(14I,ll0U(14l,IISOlliU(14l/
1 15.8333,2477.07,-39.94,998.95,25773.4,8857999.00,18879.900/

DATA »(15),l(15),C(15),H0(15>,HSOl)((15),H0U(15),HSa.l(U(15)/
1 16.1909,23S8.38.-34.44,243.86,24560.1.10000000.00,24560.100/

DATA A(16>,l(16>,CC16),H0(16»,HSOUI[,16),l«M(16),HS0LMI(16)/
1 16.0077,2497.23,-41.77,121.93,26777.6.1000000.1)0,26777.600/

DATA A(17>,l(17),C(17),H0(17>,HSOlN(17),N0W(17t,IIS0lll<17)/
1 0.000,0.000,0.000,1.000,0.000,1.00,0.000/

DATA A(18),8(18),C(1B),H0(1B),NSOLN(18>,H0W(18>,IIS«.MI(18>/
1 18.3036,3816.44,-46.13,7.54,40665.9,1.000,0.000/

DATA A(19),i(19),C(19),H0(19>,HSOUI(19),N0U(19),HSOlMI(19>/
1 15.4075,734.55. -6.45,412500.0,6819.9,4132809.30,9686.9110/

DATA A(20>,>C20),C(20),H0(20>,HSOLK(20},H0UC20),IS5C;.IIU(20>/
1 0.000,0.000,0.000,1.000,0.000,1.00,0.60/
c
C CALCULATE K VALUES

C BOUND THE TEMPERATURE TO AVOID CALCULATION OF GARBAGE


C HENRYS LAW VALUES
IF(T.LT.IO.DO) THEN
TT»10.DO
ELSE
TT-T
ENOIF

C CALCULATE SOLVENT A W WATER WIGHT FRACTIONS IN THE MIXTURE


WTS'O.COO
00 S I'l.NCOXP
S UIS*UTS*HOtUI<l)*X(l>

UTS0L=*OLWTC 1 >«X< 1 )/MTS


WTH20*HOLVT(2)*X(2)/VTS

£•****•********»#*«***•******•*••*•••**••••••••••••••••*•••••••••»•**•
C IF THE COMBINED WEIGHT FRACTION OF WATER AND SOLVENT EXCEEDS 0.5 THEN
C THE K VALUES ARE CALCULATED AS A WEICHTED AVERAGE OF THE HENRTS LAW
C VALUES FOR THE SELECTED COMPONENT IN H20 AND SOLVENT
C OTHERWISE CALCULATE K IT RA0UIT5 LAW

IF((WTSOL*WTH20>.GT.O.SDO) THEN

C CALCULATE SOLVENT/WATER WT FRACTIONS EXCLUSIVE OF OTHER COMPONENTS


US0L<X(1)*M0LWT(1)
WH20=X(2)*HOLWT(2)
WT0T<WS0L«W»20
WS01«US0L/UT0T
WH2O*UH20/WT0T

C CALCULATE ALL CGMPOHEMTS BT HENRYS LAW


DO 100 M.NCOHP
HENRS'HO(l)*DEXP(-(HSOLNO>/8.3H)*(1.0DO/TT-O.Ot»36»
HENRV*H0U(l)*DEXP(-(HSOLIWD/8.314)*<1.0D0/TT-0.O0334»
HENRT«OEXP(WSOL*OLOG(HENRS)«WH20'OLOG(HENIIU>>
100 K(I)*HEHRT/P

£•..»•••»»**•»»•***»••«•••*••»•»»»••••«*•»•••••••»•••••••••
C RECALCULATE WATER K IT RACUITS LAW IF WEIGHT FRACTION WATER > O.t
1F(UTHM.CT.0.100) THEN

PS*A<2M(2)/<TT«C<2»

C PERFORM RANGE CHECK FOR LOU TEMPS •- I.E.


C CHECK FOR T CLOSE TO C(l) AND T LESS THAN C O )
lF«PS.LT.-10.O0>.OR.(mC(2).lE.0.000» THEN
PS*1.OD-10
ELSE
PS=OEXP(PS>
ENDIF

K(2)*0.1333*PS/P
KC1B)«K<2>

ELSE

£....•»••**•*.••..........»............».........
C CALCULATE ALL COMPONENTS I T RAOULTS LAW
200 DO 210 M.NCOHP
PS=»(I)B(1)/(TT«C(D)

C PERFORM RANGE CHECK FOR LOU TEMPS •• I.E.


C CHECK FOR T CLOSE TO C(l) AND T LESS THAN C O )
IF<(PS.LT.-10.0O0).OB.(TT*CO).LT.0.D0)) THEN
PS=1.D-10
ELSE

PS=OEXP(PS>

ENDIF

210 K(;)-0.1J33'PS/P

ENDIF

p W W H »»•••»•*•»»»»*»••>»—»•»»••»••••*>• •••*••••• •••>•••>»

C ALWAYS CALCULATE SOLVENT K (THE EON IELOU IS FOR TETRAGLVK)


C IV MOULTS LAW
K( 1)«(1 .0D0/P>*t>EXP( t5.48*DLOG(TT>-9t . M )

C ASSUME SOLID AND DISSOLVED SULFUR HAVE NO VAPOR PRESSURE


K(5)*0.0D0
K(17)=0.0O0

C CALCULATE FUGACITT COEFICIENT CORRECTION


CALL RICZ{P,TT,lf,HCOHP)

c ...................«........t.

C FOR DERIVATIVES CALC DKDT


1FOVPE.EQ.1) GOTO 1000

C CORRECT K VALUES FOR FUGACITT COEFFICIENT


DO 320 M . N C O H P
320 «I)'K(I)/PHI(1)

RETURN

C CALCULATE DERIVATIVES

to
C NOTE THAT FOR THE DERIVATIVES PHI IS ASSUMED TO IE INDEPENDENT OF T

C AGAIN MAKE CHECK OH SOLVENT AND UATER MOLE FRACTION

1000 IF«WTS0L*UTH2O).GT.0.5D0> THEN

C CALCULATE SOLVENT/WATER UT FRACTIONS EXCLUSIVE OF OTHER COMPONENTS


U$0L*X(1>*M0LWT(1)
WH20>X(2>*MOLUT(2)
WT0T<WSOL*WH2O '
USOL*USOL/VTOT
UH20=UH20/UTOT

C CALCULATE DERIVS OF HENRTS LAW VALUES


DO 1100 I'l.NCOMP
ALPHAS*H0( I )*DEXP(HSOLH( I V2477.57)
DHDTS=(ALPHAS*HSOLN(l>A8.314MT"2»*DEXP(-HSOLN(l)/<8.314MT»
ALPHAU*HOU( I )*OEXP(HSOLKU(l )/2477.57>
DH0TW(ALPHAU*HSOLIIU( I >/<8.314*TT"2»«DEXP< -HSOLNUCI)/
1 <8.314«TT»
HENRS'HOC I )*DEXP( • CHSOLNCI )/8.314)*(1.0D0/TT-0.0O336»
HEHRU=H0U(l)*DEXP(-(HSOLNU(l>/8.3H)*(1.0D0/TT-0.0O336»
HEHRr=0EKP(WSOL*DL0G(HENRS)«WH20*0lOC(HEKRU))
H0?*USOL*0HOTS/HEN«S«UH2O*0HDTW/HENRU
1100 DKDT(!)'HENRT*HDT/P

C RECALCULATE FOR UATER USING RAOULTS LAW IF UEIGHT FRACTION N2O>0.1


IF(UTH2O.GT.0.1D0> THEN
PMM7.50*P
ALPHA:B(2)/(PHH«(TT*C(2»**2)
PS=A(2)-B(2)/(TT«C(2)>
1FCPS.LT.-10.00) THEN
PS=1.0D-10
ELSE
DKDT{2)«AIPHA«0EXP(PS)
ENDIF

C PERFORM VALIDITI CHECK ON VAPOR PRESSURE CALCULATION


C IF NOI VALID (I.E. IENP TOO LOU) THEN SET K TO ARBITRARY LOU VALUE
IF((C(2)*TT).LT.0.OD0> THEN
OH>T(2)«1.0O-10
ENDIF

0n>T(18)-i)KDT(2)

ELSE

C CALCULATE OERIVS OF MOULTS LAU VALUES

C CONVERT P TO MH HG
1200 P=7.50«P

DO 1210 M . N C O H P
ALPHA=B(I)/«P*(TT»C(I»**2)
PS=A(1>-B<I)/(TT*C(I»
IFCPS.LT.-10.00) THEN
DKDKD'I.00-10
ELSE
DKDT(l)'ALPHA*OEKP(PS>
ENOIF

C PERFORM VALIDITT CHECK ON VAPOR PRESSURE CALCULATION


C IF NOT VALID (I.E. TEMP TOO LOU) THEN SET K TO ARBITRARY LOU VALUE
IF((C(U«TT).IT.O.OOO) THEN
DKDT(I)>1.0D-10
ENDIF

1210 CONTIHUE
C CONVERT PRESSURE SACK TO KPA
P-P/7.50

ENDIF

£••••••••••••**••••••«*•*•*•»*•*•***•••»*•••••••••••«•••••
C CALCULATE DERIVATIVE FOR SOLVENT (TETRAGITNE)
<
1300 DICDT(1)-C1.0DD/P)*<l;.<8/TT> DEXP<1S.«8*DlOG(TT>-9t.M>

C CORRECT DERIVATIVES FOR FUGACITY COEFFICIENT

C HOVE COEFFICIENTS AT T INTO TENPORART STORAGE


DO KOO M.NCONP
1400 PHITEHP(I)<PNI(I)

C TO GET DPNI/DT INCREKENT T

CALL R « ( P , n « I . O D 0 , T , N C O M P )

C NOU CALCULATE DERIVATIVES TO RETURN


DO 1 B O l»1,K0MP
DPH10T*PHI(I)-PKITENP(I)/1.0D0
1*50 K(l>'<PHI(l)*Dn)T(l)-K(l)*DPNIDT)/(PHI(l)*PNI(l»

RETURN
END
SUBROUTINE RKZ<P,T,V,NCOHP)
C
C LAST UPMTE: 04/21/86

C CALCULATES FUGACITT COEFFICIENTS USING THE lEOLICHtUONG EQUATION


C OF STATE. SEE NOTES FOR DETAILS
X
CREF£RENCES: SHITH AND VAN HESS, 1975. « 5 271-276
C \ EDHISTER, 1968

REAL'S »<20>,PHI(2O),HDEP,SOlO(23>
REAL*t ll<20),A1J(20,20),SU1[20>
REAL'S TC<20),VC(20>,ZC(20),PC<20)

COHMON/IHRH./HDEP,PHI ,SOL0,Z
DATA TC(1>,VC;1),ZC(1),PC<1)/705.8,0.0,0.0,0.0/
DATA TC<2>.VC(2),ZC<2),PC<2)/647.1,56.0,.230,217.6/
DATA TC(3>,»CC3),ZC(3),PC(3>/373.2,98.5,.284,88.2/
DATA TC(4),VC(4).ZC(4:>,PC<4)/430.8,122.0,.268,77.8/
DATA TC<5),VC(5),ZC<5),PC<5>/1314.0,0.0,0.0,0.0/
DATA TC(6>.VC(6),ZC<6>,PC<6>/304.2,94.0,.274,7?.B/
DATA TC<7),VC(7),ZC(7),PC<7>/126.2,89.5,.290,33.5/
DATA TC(8),WC(8),ZC(8),PC(8)/190.6,99.0, .288,45.4/
DATA TC(9),VC(9).ZC(9),PC(9)/3J.2,65.0,0.305,12.8/
DATA TC(10),VC(10),ZC<10),PC(10>/132.9,93.1,.295,J4.5/
DATA TC(11),VC(11),ZC(ir.,PC(11)/305.4,148.0,.285,48.2/
DATA TC(12),VC(12),ZC(12),PCC12)/369.8,203.0,.281,41.9/
DATA TC(13),VC(13),ZC(13),PC(1J)/425.2,255.0,.274,37.5/
DATA TC(14),VC(H),ZC(H>,PC(14)/469.6,304.0,.262,35.0/
DATA TC(15),VC(15),ZC(15),PC(15)/470.0,145.0,.268,71.4/
DATA TC{16),VC{16),ZC<16),PC{16)/499.0,207.0, .274,54.2/
DATA TC(17),VC(17),ZC(17),PC(17)/1314.0,0.0,0.0,0.0/
DATA TC(18),VC(1B).ZC(18),PCC18)/647.1,0.0,0.0,0.0/
DATA TC(19),VCC19>,ZC<19>,PCC19)/15'*.6,73.4,.288,49.8/
DATA TC(20>,VC(2O>,ZC(20),PC(20)/0.0,0.0,0.0,0.0/
C NOTE THAT THE CRITICAL TEMPS HAVE FOR PURE H20, PURE SULFUR AND
C PURE SOLVENT HAVE K E N INCLUDED TO PERMIT CALCULATION OF THE
C MIXTURE C H I T I U l TEMP. HOWEVER, THESE COMPONENTS ARE NOT INCLUDED M
ro
C IN THE CALC OF THE FUGACITY COEFFS. O

DATA ATHIHD/0.H3MBBMI3335/
DATA TU027,TW03/.074074074074,.6666M4M66*7/
DATA A2nH/.037037037037000/
DATA R/S2.05D0/
DATA RJO/8.314D0/
DATA EPSILON/1.0D-4/
DATA PI/3.K159265«00/

C CONVENT P TO ATN FROM KPA


Pl*P
PL'PL/101.32S

C CHECK TO SEE IF UE HAVE ALREADY DONE THE CALCULATION FOR THESE CONDITIONS
DO 2 I'l.NCONP
IF(SOLD(l).NE.r(l» GOTO 4
2 CONTINUE
IF(S0LD(21).NE.T) GOTO 4
IF(SOLD(22).NE.P> GOTO 4
C INPUT PARAMETERS MATCH. LEAVE VALUES UNCHANGED
GOTO 400

C MAKE ROUGH ESTIMATE OF CRITICAL TEMP OF THE MIXTURE


C INITIALIZE THE PHI VALUES AND HOEP
4 HOEP'O.ODO
TCNIX'0.000
DO I I'l.NCOMP
PHKD'I.ODO
3 TCHIX>KMIX+Y(I>*TC(I>

C IF THE MIXTURE CRITICAL TEMP IS LESS THAN 100K OR THE CALCULATION


C TEMPERATURE IS LESS THAN I50K THEN
C THIS ROUTINE SUCKS POND WATER. UNDER THESE CONDITIONS ALL PHKI1
C ME LEFT SET TO 1.000 AND HOEP'0.000

!F<(TOtlX.LT.100.0D0).0*.(T.lT.150)) GOTO 150

C IKE FUGACIIY COEFFIENT CAIC IS NOT NECESSMT IF THE PfESSURE IS '-JI'


IF(PL.IT.Z.OO) GOTO 150

DO S M.NCOHP
•KD'0.000
SUN(|)«O.WO
DO 5 J'l.NCOHP
5 «IJ<l,J)«0.000

(.=0.000
B=O.OO0

C CAICUIATE All AIJ, II

DO 10 I'l.KCOHP
1F(PC(I).EQ.0.000) GOTO 10
a
• ICI)*0.O867D0 lt*TC(U/PC(l)
•<S»T(l)*il(ll

DO 10 J'1,NCOW>
IF[PC(J).Ea.0.000) GOTO 10
M
VCIJ'{(VC(I)**ATHIIK»VC(j)»ATIIl«O>/2.0) 3.0
TCIJ«OSMT(IC(l)«TC(J))
ZCtJ>(ZCCI>«ZC(J»/2.0
l>CIJ>2Cli*R*TCIJ/VCIJ
AIJ<I,J)>(.«7800"A*A«TCIJ*«2.5)/PCIJ
ATEMP<r(J)*AIJ(l,J)
A=A»T(I)*ATENP
SUH(I)'SUN(I)«ATENP

10 CONTINUE
C MCE SUIE THAT SOMETHING USEFUL WAS III THE CAS PHASE
C IF NOT THEN SET All THE PHI TO 1.0 AM) EXIT ro
K>
Is?
IFUA.ECI.0.000).AHO.d.EO.0.000)) THEN
00 25 l«1,HCOMP
25 PHI(I)>1.000
GOTO ISO
ENOIF

, ,
A2t»V<i * T"«1.5)
•P«Cl*Pl)/(t«T>
5O«IP«(A2IIP-1.00)
S«—A2I*<«P"2>
SM'SQ-ATHMD
SH-(S0'ATHH»»5«-TU027)
SNZ*SN*SH/4.D0
SHJ«SH«SI(*SH/27.00
DIS'SH2«SN3

IF(OIS) 5000,6000,7000
5000 SGN<-1.0D0*DSIGNO.0D0,SN)
THETA<0ACOS(SGN'0SOIIT(-SN2/SMl)>
X1<2.D0*DSMT(-SH/3.00)«DCOS(TMETA/3.O0)
<
X2'2.D0*DS()llT(-SH/3.D0> DCOS(T!IEW3.D0»2.DO*PI/3.00)
< a
X3>2.O0*t)SallT(-SH/3.O0> OCOS(THETAy3.D0H.D0 PI/3.0O)
ZiOMAX1(X1,X2,X31«ATHIM>

GOTO 8000

6000 Z-1.00
UKI16(6,99000)
99000 FORNAT(X,>RKZ IS HOSED111111II •)
GOTO 8000

7000 BTEHP'-SH/2.D0*DS0RT(DIS)
BN=DSIGN(OABS(BTEHP)"ATHlltO.ITEM>)
BTEKP>-SH/2.00-DSQRT(OIS)
BN*OSlGN(DABS(BTE)IP>**ATHIItD,BTEHf>)
Z*BH«BN*ATHIRD

C CALCULATE PHI VALUES

6000 lf(Z.LT.0.500) GOTO ISO

H«{i*PL>/«***T)
T1-(Z-1.D0)/i
T2»C10GCZ-Z*H>
T3-*/C«*R*T**1-5>
T4>2.000/A
T54LOG(1.0D0»H)

00 100 M.NCOHP

C CALCULATE FUCACITT COEFFICIENTS. SET UCXNOUN COMPONENTS TO PHI'1


IF(PC(I).EO.0.OD0> THEN
PHKI)*1.0DO
ELSE
PHlCI)=0EXP<BlCI>«T1-T2*TJ*(BtC!>/B H*SUH(I))«H)
ENDIF

100 CONTINUE

C CALCULATE THE ENTKALPT DEPARTURE FUNCTION (M/OMLE)


HDEP-RJO*T'(<(3.OOO'A)/(2.OIlO*i*R'T"1.5J)*0LOG<1«H)»W)

C SAVE INPUT PARAMETERS FOR SUBSEQUENT ACCESSES


150 0 0 ZOO l«1,NC0HP
200 SOLDCD'Td)
S0LD(21)'T
SOLD(22):p

400 RETURN
END

to
to
SUBROUTINE lANO(J)

C THE EVER POPULAR IAH0 AND HATINV SUBROUTINES ho


C REF: NEUMAN, 1968.

IMPLICIT REAL*8 ( A H , 0 - 2 )
DIMENSION A<1B,1B),l<ia,1B),C(18,2S),0<1B,37),EC1S, 19,23)
DIMENSION G(18),X(ia,18),Y<1B,18>
REAL'S CAR(SOO)
COMMON /IHD/ A,I,C,D,6,X,T,N,NJ
COMHON/GARIAGE/GAR
COMHON/EEE/E
1
101 FORMATC DETERN>0 AT J " ' , 14)
NP1*N>1
IF<J-2> 1,6,8
1 DO 2 M , N
a
D(l,2 N+1>'G(l)
DO 2 L>1,N
IPN*L»N
2 OU,LPN)«K(l,L>
CALL HATINV<N,2'M»1,0ETERM,I,0)
IF (DETERH) 4,3,4
3 URITE(6,101) 4
4 DO 5 K"1,N
>
E(IC,NP1,1)'D(K,2 N»1)
DO S L-1.N
E(K,l,1)«-D(IC,l>
LPN>l»N
5 X(K,U>-B<K,LPN)
RETURN
6 DO 7 I ' l . N
DO 7 K«1,N
DO 7 1>1,N
7 D(l,K)*0(l,K)«A(l,L)*X(L,IC)
B IF (J-»J) 11,9,9
9 DO 10 l«1,H
DO 10 L=1,H
G(l)*G(l)-Y(l,l.>*E(l,m>1,J-2>
DO 10 H»1,»
10 A(l,L)>ACI,Ll»TCI,M*ECH,l,J-2>
11 DO 12 I'l.N
D(I.NP1)*-GCI>
DO 12 l»1,N
Dtl,NP1)>0(l,IIP1)**<l.l}*E<L.IIP1 J-1>
>

00 12 K'l.tt
12 IC1,K)il(i,K>»«(l,L)*E(l,IC,J-1)
CALL KATINV Ot.NPl.DETEItN.I.D)
IF (DETERN) H . 1 3 . H
13 URITE(6,10t) J
14 DO IS K'l.N
DO IS N*1,«P1
15 E(K,K,J)'-D(K,M>
IF (J-NJ) 20,16,16
16 DO IT K'l.N
17 C(K,J]°E(IC,NP1,J>
DO 18 JJ'2,NJ
H=kJJJ*1
DO IB K«1,M
C(K,H)'E(MP1,H>
DO 18 l»1,»
16 CCK,H>«C(K,H>*E(K,l,H)*CU,H»1>
DO 19 1*1,N
DO 19 K»1,»
19 C(t,1)»C(lt,1)«(K,L)*C(L,3)
20 KETUBN
END

to
Ln
SUBROUTINE HATINV(N,M,OETEIW,l,D> to
to
IMPLICIT RE«l*S(«-H,OZ) a*
OIMEIISION ID(18),1(18,18),0(18,37)
DETEKN'I.DO
DO 1 1-1,N
1 ID(I)*O.ODO
DO 18 NN'I.N
tJUX*Q.DDO
00 6 I«1,N
IF t l D ( D ) 2,2,6
2 DO 5 J»1,»
IF ( I C ( J » 3,3,5
3 IF (DABS(i(l,J»-8MJU() 5,5,4
* 8MAX*0AGS(B(I,J>)
IROW.I
JCOi»J
5 CONTINUE
6 CONTINUE
IF (BKMC) 7,7,8
7 OEIEHH=0.000
RETURN
a IO(JCOL)*I
IF (JCOl-IROU) 9,12,9
9 DO 10 J»1,N
S»VE=8<IR0U,J>
l(IROU,J)=B(JC0L,J)
10 l(JCOt,J)=S»VE
DO 11 t<1,N
SAVE=D(1R0U,K)
D(IR0U,C)4(JCOL,IC)
11 D(JCOL,K)*SAVE
12 F<1.D0/B(JCOL,JCOl>
DO 13 J=1,«
13 B(JC0L,J)=B(JCOL,J)*F
DO K K=1,H
H DCJC0L,K)=D(JCOl,l!)«F
DO IB I-1.N
IF (l-JCOL) 1S.t8.t5
15 F»l(l,JC0O
DO 16 J»1,«
16 •(l,J)«I(I,J)f*l(JKH.,J)
DO 17 K'l.H
17 D(I,K)4(I.K)-F*D(JC0L,K)
It CONTINUE
KETURN
END

W
-J
228

A-IV. Simulation Data Entry Programs


The programs listed below can be used to facilitate data entry to the
simulation. These routines have been written to enable the user to create, modify,
and examine the data files, STREAMIO.DAT and STREAMS.DAT, which provide
the unit operation, unit interconnection, and initial stream information to the
simulation program. The code is entirely menu-driven and makes extensive use of
the report generation capabilities of the Knowledge Manager Data Base
Management System Ver 1.06.
I IERKIN, MAIN DATA ENTRY PROGRAM
I INVOKE I T TYPING:
I KHAN BERKIH
I
I KHAN DATABASE NANACEHENT PROCRAM FOR USE UITH THE UCt SULFUR
I SINUIATION. THIS PROGRAM CAN IE EMPLOYED TO SETUP THE
I DATA FILES STREANIO (UNIT OPERATIONS) AND STREAMS (STREAM DATA)
I FOR USE IN THE SIMULATION.
I
I LAST UPDATE: 04/10/86, OWN

E.LSTR*80
CLEAR
OUTPUT "ONE MOMENT P L E A S E . . . '
I LOW CONTEXT FILE FO* UNIT OPERATION INPUT f f t I S
LOAD "OFORH.ICF"
CLEAR

I SET VARIOUS ENVIRONMENT VARIABLES


E.SERR'TRUE
E.SUPD'TRUE
E.l**=7
E.LSTR:BO
E.LHGO'FALSE
E.ICOH*FALSE

I FORM FOR USE WITH STREAKS DATA ENTRY

FORM STRFORN AT 1,25 PUT 'ENTER DATA FOR STREAM' "


AT 1,48 PUT REC
AT 2,2 PUT "COMPONENT MOLE FRACTION*
AT 4,2 PUT "SOLV"
AT 4,28 PUT SOLV
AT 4,28 GET SOLV
AT 5,2 PUT "H20"

to
W
UP
230

• • 1. _ _ « • •
R R IM X! M 8 * u u u x x x u o O u u u u u u u u

5 | £ 5 £a Cw iwj ,J p t t K a C S p & i i p C v J s S u p C
I UJ t- p
PUT

PUT

£ 3 £ 3 5 £ 3 n o ton n n tt <o H« «• u g a:
N IM N N IV
N N N N N N N N •»" «T tM* r>i K»* «* K? -4r* V •* »n" m" in"
m-in" •© -*? -«* •«" K* rC
«« f^
K s e « n » » »
•t < < <
< < < < <<
AT 17,28 GET »
AT 18,2 PUT "CH3SH"
AT 1 8 , 2 8 M l CH3SH
AT 18,28 GET CH3SH
AT 1 9 , 2 PUT "C2H55H"
AT 19,28 PUT C2H5SH
AT 19,28 GET C2HSSH
AT 2 0 , 2 PUT "SOLID AND LIQUID SULFUR"
AT 2 0 , 2 8 PUT SULF
AT 2 0 , 2 8 GET SULF
AT 2 1 , 2 M l "PURE UATER"
AT 2 1 , 2 8 M T HATER
AT 2 1 , 2 8 GET HATER
AT 2 2 , 2 PUT " 0 2 "
AT 2 2 , 2 8 PUT 0 2
AT 2 2 , 2 8 GET 0 2
AT 2 3 , 2 MT "FLOU>"
AT 2 3 , 7 M T FLOW
AT 2 3 , 7 GET FlOU
AT 2 3 , 2 0 MT «TEMP»"
AT 2 3 , 2 6 M T TEHP
AT 2 3 , 2 6 GET TEMP
AT 2 3 , 3 * M T "PRESSURE*"
AT 2 3 , 4 3 MT PRESS
AT 2 3 , 4 3 GET PRESS
AT 2 3 , 5 6 M T "PHASE""
AT 23,62 M T PHASE
AT 23,62 GET PHASE

FORM) OPMEHU AT 1,60 PUT "UNIT"


AT 1,65 M T UNIT
AT 2,25 M T "OPERATIONS AVAILABLE"
AT 4,1 M T • 1'ABSORBER/SIRIPPER/DISIILLATION"
AT 4,50 M T " 2«FL0W SPLITTER"
AT 5,1 M T • 3=A01ABATIC FLASH"
AT 5,50 M T » <=HEAT EXCHANGER"

to
AT 6 , 1 PUT • 5 « » E 1 0 ! U « "
AT 6.50 PUT • 6"C0NDENSE*"
AT 7,1 PUT " 7-MIXEH"
AT 7,50 PUT • "^SPLITTER"
AT 8 , 1 PUT " 9 * P I M "
11
AT 8,50 PUT •lO'DEACTOR
AT 9 , 1 PUT "11"SULFU» SATURATOA"
AT 9 , 5 0 PUT *12»SULFU» SETTLE**
AT 10,1 PUT "13'SUIFU* WASHER*
AT 10,50 PUT *U*CITER/DECANTER*
AT 11,1 PUT *15"FUIIUCE"
AT 11,50 PUT *16>COHP*ESSOR*
AT 12,1 PUT "I7.SUl.Fl* CENTRIFUGE"
AT 12,50 PUT •18'PADTIAL CONDENSER*
AT 13,1 PUT "19»HEATER"
AT 13,50 PUT -20*STORAGE UNIT"
AT H , l PUT * 2 U C * T $ T A l l l Z E R *
AT K . 5 0 PUT *22*SULFUR SPLITTER*
AT 15,1 PUT •^•MAKE-UP"
AT 15,50 PUT "24'TENPEMTUtE SET*
AT 16,1 PUT -25-HrDROCMBON SPLITTER"
AT 2 3 , 1 PUT "OPERATION CODE SELECTION'"
AT 23,40 PUT OPCODE
AT 23,40 GET OPCODE

CitOICE'O

WHILE CHOICEoll DO

CLEAR
FINISH ALL

«ERR»O=0
1
AT 1.1 OUTPUT "DATABASE CREATION PROGRAM FOR BERKELEY SULFUR PROCESS
1
AT 3.1 OUTPUT *<OU CAN:
AT 4,5 OUTPUT • 1) CREATE A NEW OPCODE MATRIX*
AT 5,5 OUTPUT • 2) ENTER DATA INTO THE OPCODE MATRIX*
AT 4,5 OUTPUT • 3) INSERT A NEU UNIT INTO AN EXISTING OPCODE MATRIX"
AT 7,5 OUTPUT • «> DELETE A UNIT FROM AN EXISTING OPCODE MATRIX"
AT 8.5 OUTPUT « 5) PRINT THE OPERATIONS SUMMARY
AT 10,5 OUTPUT • 6) CREATE A NEU STREAMS MATRIX*
AT 11.5 OUTPUT • 7) ENTER DATA INTO THE STREAMS MATRIX*
AT 12,5 OUTPUT * t) ADD A STREAM TO THE STREAKS MATRIX*
AT 14,5 OUTPUT • 9) NORMAL EXIT -• CREATE STREAMIO AND STREAMS FILES*
AT 16.5 OUTPUT *10) READ OLD STREAMIO AND STREAMS FILES INTO TAILES*
AT 18,5 OUTPUT "11> QUIT WITHOUT CREATING .DAT FILES*
AT 20.5 INPUT CHOICE USING «uu* WITH "TOUR SELECTION? "

CLEAR
TEST CHOICE

CASE 1:
SIHO=0
I SETUP NEU OPCODE MATRIX
CLEAR
USE STREANIO
ATTACH 1 TO STREANIO
I EMPTT THE DATABASE OF THE OLD VALUES
HARK ALL
COMPRESS STREAMIO

CLEAR
AT 8,1 INPUT STNO USING "**• WITH 'NUKiER OF OPERATIONS • "
CLEAR

I CREATE TABLE WITH STNO RECORDS


UCNT-1
WHILE STNOkO DO
ATTACH 1 TO STREANIO
UHIT=UCHT

to
Id
w
UCNTKICI!*!
STWhSTNO-1
ENDVHUE

I ADD EXTRA H A M RECORD WITH UNIT-99 AS END OF FILE DELIMITER


OtTAIN LAST
ATTACH 1 TO STREANIO
INIT*99

OBTAIN 0 FROM STREANIO

USE 2 :
I ENTER DATA INTO EXISTING STREANIO TAILE
CLEAR
USE STREANIO

N0«E»"T"
REC'O
OPC»0

WHILE H0RE<»r> DO
INPUT REC USING "dd.dd" UITN -ENTER DESIRED UNIT NUMER •
OBTAIN FOR UNIT'REC
IF(*F0UM» THEN
CLEAR
PUTFORN OPNENU
TALLY OPMENU
CETFORN OPMENU
OPCOPCOOE
CLEAR
AT 1,40 OUTPUT "UNIT"
AT 1,65 OUTPUT UNIT
PERFORM UNITS
CLEAR
ELSE
OUTPUT "ERRORI UNIT NOT FOUND"
OUTPUT "STRIKE M Y til TO CONTINUE*
WAIT
CLEAN
ENOIF

INPUT NODE USING "u" UITH "KORE UNITS (T/N)7 •


ENDUH1LE

OBTAIN LAST
IMIT*99
CLEAN
WEAK

CASE J:
I INSERT A NEW UNIT INTO EXISTING STREANIO MILE
UNO*0
REC=0
OPC=0
CLEAR
USE STREAMIO
INPUT UNO USING "dd.(W WITH 'NEW UNIT NUMBER-'
OBTAIN LAST
ATTACH 1 TO STREAMIO
I RESET END UNIT F U G TO NEW END OF FILE
UNIT<99
I RACK UP ONE RECORD TO NEW LAST UNIT
OBTAIN PRIM
UNIMMO
CLEAR
I PROMPT USER FOR DESIRED OPERATION
PUTFORH OPNENU
T A U T OPHENU
GETFORH OPMENU
I SET UP THE UNIT
CLEAR
UNlT=tWO
OPC*0PC0DE
AT 1,60 OUTPUT "UNIT"
AT 1,65 OUTPUT UNIT
PERFORM UNITS
CLEAR

CASE 4:
I DELETE A UNIT FROM STREAMIO
UNO-0
CLEAR
USE STREANIO
INPUT UNO USINC "dd.dd" UITH "ENTER >1*8ER OF UNIT TO REMOVE •
OBTAIN FOR U N I T * * * )
IF(KRRN0o36) THEN
REC'CURREC(STREANIO)
NARK RANGE REC.REC
COMPRESS STREANIO
CLEAR
BREAK
ELSE
OUTPUT "THAT UNIT DOES HOT EXIST!"
OUTPUT "NIT RETURN TO CONTINUE"
WIT
BREAK
ENDIF
BREAK

CASE 5:
I SEND THE ENTIRE OPERATIONS MATRIX TO THE PRINTER
CLEAR
OUTPUT "HIT RETURN WHEN THE PRINTER IS READT"
UAIT
PERFORM OPRINT
BREAK
CASE 6 :
SINO=0
i SETUP NEU STREAM MATRIX
CLEAR
USE STREAMS
ATTACH I TO STREAMS
I EMPTY THE DATABASE OF THE OLD VALUES
MARK ALL
COMPRESS STREAMS

CLEAR
AT 8,1 INPUT STNO USING " < W WITH •NUNKR » STREAMS • •
CLEAR

I CREATE STREAMS TAIIE WITH STNO RECORDS


WHILE STNO>0
ATUC-I 1 TO STREAMS
STIU*STNO-1
EHDWHILE

I APPEND 1 BLANK RECORD TO THE DATABASE AND SET END Of DATA DELIMITER
CSTAIN LAST
ATTACH 1 TO STREAMS
OBTAIN LAST
FLOW" 1.0

OBTAIN 0 FROM STREAMS

CASE 7:
I ENTER DATA INTO EXISTING STREAMS TABLE
CLEAR
USE STREAMS

M0«E="Y"
REC=0

to
•J
UHUE MORE»»Y" DO
INPUT (EC USIN6 ' d d d " U I I H "ENTER DESIRED STREAM NUMBER
OSTAIN (EC
I F « « E ( ( H O < > 5 6 ) AND <FL0Uo-1)> THEN
MOUSE RANGE REC.Rfl WITH STRFORN
CLEAR
ELSE
OUTPUT 'THAT STREAM DOES NOT EXIJTI"
OUTPUT "STRIKE ANT KEY TO CONTINUE*
WAIT
ENOIF
CLEAR
INPUT MORE USING "u" UITH "MORE STREAMS (T/Nt? •
ENDWHILE

CLEAR
•REAK

CASE 8:
I ADD A STREAM TO THE EM) OF THE STREAMS TABLE
CLEAR
USE STREAMS

I APPEND t (LANK RECORD TO THE DATAIASE


E.LHOD'TRUE
OBTAIN LAST
ATTACH 1 TO STREAMS
OSTAIN PRIOR
FLOU*0.0
REC<CURREC(STREAMS)
PUTFORN STRFORN
TALLY STRFORM
GETFORN STRFORN
E.LMOD=FALSE
IREAK

CASE 9:
I AIL DONE
I M I T E NEU STREAMIO AND STREAMS .DAT FILES
I CLOSE UP SHOP
CHOICE'11

CLEM
OUTPUT "NEW STREANIO A W STREAMS FILES ARE AtOUT TO IE CHEATED'
OUTPUT 'THIS U R L ERASE THE OLD FILES.*
INPUT OK USING "u" WITH "IS THIS UUAT YOU WANT? •

IF O K o ' T " THEN


IREAK
EHDIF

I SET UP UNIT INDEX FOR USE WITH STREANIO


USE STREAMIO
INDEX "SIR 10- FOR STREANIO IT U UNIT

FINISH ALL

USE STREAMIO WITH STRIO


USE STREAMS

I REOUEST NUMBER OF ITERATIONS USER WISHES TO PERFORM


ITNO-O
CLEAR
AT 10,1 OUTPUT 'PLEASE ENTER THE NUMER OF ITERATIONS WHICH TOU WOULD*
AT 11,1 OUTPUT 'LIKE THE PROGRAM TO PERFORM M 0 TO ITERATE TO •
AT 12,1 OUTPUT "CONVERGENCE <MAX»»>'
AT 13,1 INPUT ITNO USING "dd» WITH 'ITERATIONS''

OJTAIN LAST FROM STREAMIO


OPCODE'-ITHO

to
I UARN USER OF ZERO OPCODES IMPEDED IT STREAMIO
RECCNT'CURREC(STREAMO) -1 N3
•P-
OBTAIN 0 F > M STREAMIO O
REC'1
WHILE «ECCNT>() DO
OtTAiN REC FROM STREAHIO
IF OPCODES THEN
OUTPUT "UARNINGI ZERO OPCODE ENCOUNTERED FOR UNIT ".UNIT," IN RECORD ",REC
ENOIF
REC'REC«1
RECOU«REC«T-1
EWWHILE

I EXPORT DATA TO .DAT FILES


OUTPUT "CREATING STREANIO.DAT"
E.CF*2
CONVERT OPCODE.UNIT.PARANI ,PA*AM2,PARAN3,PARAMA,PARMt5,PARAM&,PARAM7,\
PARAHS,PARAH9,PARAM10,PARAN11,PARAM12,PARAN1J,PARANH,PARAH15,PARAM16,\
PARAM17,PARAN1S,PARAH19,PARAM20,PARAM21 PARAM22,PARAH23,PARAM2«,\
)

PARMl25,PARAM26,PA«AM2r PARAM2B FROM STREANIO TO •STREAMIO.DAT' AIL


i

OUTPUT 'CREATING STREAMS.DAT"

CONVERT S0LV.N2O,H2S,SO2,DSULF,CO2,H2 C1,N2,CO,C2,Cl,C«,CS,\


I

CH3SH,C2H5SH,SUlF,UATER,02,UNICN,fLOV,TEHP,PRESS,ENTH,PHASE FRONV
STREAMS TO "STREAMS.DAT" ALL

I SET OPCODE DELIMITER ON STREAMIO JACK TO 0


OBTAIN LAST FROM STREAHIO
OPCOOE'O

OUTPUT 'ALL DONE I TAKE A BREAKI-

FINISH ALL
WEAK

CASE 10:
I HEAD EXITING DATA FILES FOX STREAHIO AND STREAMS RACK INTO THE
I TAILES
«•" •
FRAME*" -
CLEAR
OUTPUT niARNINGI THIS OPERATION UIIL OVERWRITE EXISTING DATA*
OUTPUT "IN THE STREAMS AND STREAM 10 DATA TAILE*
INPUT OK USING "u" WITH »IS THIS WHAT YOU WANT? •

OUTPUT 'READING FRO) STAEAMI0.DAT"

IF OK»>"T" THEN
•REM
EHOIF

USE STREAHIO
NARK ALL
COHPRESS STREAHIO

ATTACH FROM "STREAHIO.DAT- TO STREANIO

FINISH ALL

OUTPUT 'READING FROM STREANS.OAT*

USE STREAKS
MARK ALL
COHPRESS STREAMS

ATTACH FROM "SIREAMS.DAT" TO STREAMS WITH SOLV,H20,H2S,SO2,0SULF,\


C02.MJ,CI,H2,CO,C2,C5,C*,C5,CH3SH,C2H5SH,SULF,WATER,02,\
UNKH,FLOW, TEMP,PRESS,EWH,PHASE

FIHtSH ALL

M
242

I I
a i
6 .- B •
SB S3 * §
I OFORN.IPF
I SUUOUTINE TO DEFINE THE FORMS FOR OATA ENTRY OF THE DESIRED
I UNIT OPERATION IN STREAHIO.ITI
I RUN TNIS PROGRAM TO CREATE TNE CONTEXT FILE (OFORN.ICF) FOR USE WITH
I THE DATA ENTRY PROGRAM IERKIN.IFP
I LAST UPDATE: 04/16/86

I ABSORIER/STRIPPER/DISTILLATION
FORM UFORN1 AT 2,20 PUT •ABS0R1ER/STRIPFER DISTILLATION UNIT'
AT 4,1 PUT "NUMBER OF STAGES*'
AT 4,50 PUT PARAM1 using •dd*
AT 4,50 GET PARANt using «dd»
AT 5,1 PUT •PRESSURE ( « * ) • •
AT 5,50 PUT PARAM2 using "ddddd.dd"
AT 5,50 GET PARAM2 using •ddddd.dd'
AT 6,1 PUT 'VOLUME OF IIOUIO ON A TRAY ( « ) - -
AT 6,50 PUT PARAN3 using •dd.dd'
AT 6,50 GET PARAH3 using "dd.dd"
AT 7,( PUT "LIQUID MOLAR DENSITY O M O L / W ) " "
AT 7,50 PUT PHRAM4 using "dd.dd"
AT 7,50 GET PARAM4 using "dd.dd"
AT 8,1 PUT "SECOKD ORDER RATE CONSTANT'"
AT 8,50 PUT PARAMS using "dddd.dd*
AT 8,50 GET PASAM5 using "dddd.dd"
AT 9,1 PU; "Freol STREAM NUMBER-"
AT 9,21 PUT PARAH6 using "dd"
AT 9,21 GET PARAM6 using "dd"
AT 9,40 PUT "FEE01 STAGE NUMBER'"
AT 9,59 PUT PARAH7 using "dd"
AT 9,59 GET PARAM7 using "dd"
AT 10,1 PUT "FEED2 STREAM NUMBER"'
AT '0,21 PUT PARAMB using "dd"
AT 10,21 GET PARAN8 using "dd"
AT 10,40 PUT "FEED2 STAGE NUMBER"'
AT 10,59 PUT PARAM9 using "dd"
AT 10,59 GET PARAN9 using "dd"

£k
AT 11,1 PUT "FEED3 STREAM M I N E R ' *
AT 11,21 PUT PAIUM10 w i n g * d d "
AT 11,21 GET PARJW10 w i n g * d d " 4>
AT 11,40 PUT "FEEDJ STAGE MMaER**
AT 11,59 PUT PARAH11 Uling " d d "
AT 1 1 , 5 7 GET PARAH11 Utlng "dd"
AT 1 2 , 1 PUT "FEED* STREAM MRMER**
AT 12,21 PUT PARAN12 utlng *dd*
AT 12,21 GET PARAX12 wing *dd*
AT 12.*0 PUT -FEED* STAGE M M E R * *
AT 12,59 PUT PARAH13 using "dd*
AT 12,59 GET PARAN13 utlng «dd*
AT 13,1 PUT 'FEEDS STREAM NUMBER**
AT 11,21 PUT PARAM14 utlng "dd"
AT 13,21 GET PARAN14 utlng "dd"
AT 13,40 PUT "FEEDS STAGE MM8ER**
AT 13,59 PUT PARAH15 using "dd"
AT 13,59 GET PARAN1S utlng "dd"
AT 15,1 PUT "EXIT VAPOR STREAK R M E R » *
AT 15,29 PUT PMAN16 Utlng add*
AT 15,29 GET PARAM16 Utlng "dd"
AT 15,43 PUT "EXIT LIQUID STIIEAN NUMER**
AT 15,70 PUT PARAM17 using "dd"
AT 15,70 GET PARAN17 Uling "dd"
AT 16,1 PUT "SEBOILER HEAT INPUT (KJ/S)**
AT 16,29 PUT PARAN1S uting "ddddd.dd"
AT 16,29 GET PAHAN1S using •ddddd.dd*
AT 16,43 PUT *CON0ENSER TEMPERATURE « ) * "
AT 16,70 PUT PARAM23 utlng "dddd.dd"
AT 16,70 GET PARAH23 Uling "dddd.dd"
AT 17,1 PUT "FRACTION OF CONDENSER LIQUID TO SIDE DRAW"*
AT 17,50 PUT PARAH24 Uting "d.ddd"
AT 17,50 GET PARAN24 Uling "d.ddd"
AT 18,1 PUT "CONDENSER EXIT LIQUID STREAM NUMBER*"
AT 18,50 PUT PARAM25 utlng *dd"
AT 18,50 GET PARAH25 utlng *dd"
AT 19,1 PUT "FIRST HEATER/INTERCOOLER ST»GE="
AT 19,33 PUT PARAH19 w i n g "dd"
AT 19,33 GET PARAM19 w i n g *dd»
AT 19,40 PUT "HEAT LOAD (KJ/S)**
AT 19,60 PUT PAKAN20 utlng "ddddd.dd"
AT 19,60 GET PARAH20 Utlng *ddddd.od"
AT 20,1 PUT 'SECOND HEATER/INTERCOOIER STAGE"
AT 20,33 PUT PARAX21 utlng "dd"
AT 20,33 GET PARAN21 utlng "dd-
AT 20,40 PUT 'HEAT LOAD K J / S ) * *
AT 20,60 PUT PARAN22 utlng -ddddd.dd"
AT 20,60 GET PAUM22 utlng «ddddd.dd*
AT 21,1 PUT "PROFILE FLAG."
AT 21,13 PUT PARAH26 Utlng "d»
AT 21,13 GET PARAH26 utlng "d"
AT 22,1 PUT "C-0 GENERATE REM INITIAL GUESSES)"
AT 23,1 PUT "C"1 USE PROFILE PRO* PREVIOUS CALCULATION)"

I FlOU SPllTTCR
FORM UF0RN2 AT 2,20 PUT "FlOU SPLITTER*
AT 4,1 PUT 'INLET STREAN NUH8ER**
AT 4,40 PUT PARAN1 using "dd"
AT 4,40 GET PARAH1 using "dd"
AT 5,1 PUT "OUTLET STREAN 1 NUMBER*"
AT 3,40 PUT PARAM2 utlng "dd"
AT 3,40 GET PARAN2 using "dd"
AT 6,1 PUT "OUTLET STREAN 2 NUMBER""
AT 6,40 PUT PARAN3 using "dd"
AT 6,40 GET PARAN3 using "dd"
AT 7,1 PUT "FLOV TO STREAN 1«*
AT 7,40 PUT PARAN4 using "dddd.dddd"
AT 7,40 GET PARAN4 using "dddd.dddd"

I ADIABATIC FLASH
FOAM UFOttU AT 2,20 MIT •ADIAIATIC FLASH"
AT 4,1 PUT "INLET STREAM HUHSER'-
AT 4,49 HIT PARANI lain) "dj" a*
AT 4,40 GET PARAMI wing "dd"
AT S.I PUT 'FLASH PRESSURE""
AT 5.40 N T PARAH2 wing "ddddd.dd"
AT 5.40 GET PARAH2 utlng "ddddd.dd"
AT 6,1 PUT "OUTLET LIQUID STREAM M M E A » «
AT 6,40 PUT PARAM3 Wing "dd"
AT 6,40 GET FARAN3 wing "dd"
AT 7,1 PUT "OUTLET VAPOR STREW) MJMKR""
AT 7.40 PUT PARAM4 wing "dd"
AT 7,40 GET PAAAN4 wing "dd"

I HEAT EXCHANGE*
FORM UFOAH4 AT 2,20 PUT 'HEAT EXCHANGER*
AT 4,1 PUT "INLET STREAM 1 (HOT) NUMER*'
AT 4,40 PUT PARAN1 wing "dd"
AT 4,40 GET PARAN1 wing "dd»
AT 5,1 PUT "INLET STREAM 2 <COL0) M M E R - "
AT 5,40 PUT PARAMZ wing "dd"
AT 5.40 GET PARAH2 wing *dd»
AT 6,1 PUT "OUTLET STREAM 1 M M K R » "
AT 6,40 PUT PARAM5 wing "dd"
AT 6.40 GET PARAMS wing "dd"
AT 7,1 PUT "OUTLET STREAM 2 NUMIEA""
AT 7,40 PUT PARAN4 wing «dd"
AT 7,40 GET PARAM4 wing "dd"
AT 8,1 PUT "UA (KJ/S-K) ••
AT 8 , 4 0 PUT PARAHS w i n g "ddddd.dd"
AT 8 , 4 0 GET PARAMS u t l n g "ddddd.dd"

I REBOILER
FORM UFORM5 AT 2,20 PUT "REI011ER"
AT 4.1 rUT "INLET STREAM MUMKR"*
AT 4.40 W T PARAM1 using » 4 f
AT 4,40 GET PARAH1 using «dd"
AT 5,1 PUT "OUTLET LIQUID STREAM KUHIER""
AT 5,40 PUT PARAN2 using " 4 f
AT 5,40 CET PARAM2 w i n g •<&•
AT 6,1 PUT "CUTLET VAPOR STREAM W i E t - *
AT 6,40 PUT PARAKJ w i n g "4J"
AT 6,40 GET FARAH3 using •dd"
AT 7.1 PUT "PRESSURE"*
AT 7,40 PUT PARAM4 using •ddddd.dd"
AT 7,40 GET PARAH4 using "ddddd.dd"
AT 8,1 PUT "TEMPERATURE""
AT 8,40 PUT PARAH5 using "dddd.dd"
AT 8,40 CET PARAHS using "dddd.dd"
EHOFORH

I CONOENSER
FORK UFCRM6 AT 2,20 PUT "CONOENSER"
AT 4,1 PUT 'INLET STREAM I
AT 4,40 PUT PAMH1 using "dd"
AT 4,40 GET PARAM1 using "dd"
AT 5,1 PUT "OUTLET STREAM WUHURa"
AT 5,40 PUT PARAH2 using "dd"
AT 5,40 GET PARAH2 using "dd"
AT 6,1 PUT -PRESSURE""
AT 6,40 PUT PARAX3 using "ddddd.dd"
AT 6,40 GET PARAH3 using "ddddd.dd"
ENOFORM

I MIXER
FORN UF0RH7 AT 2,20 PUT "MIXER"
AT 4,1 PUT "INLET STREAM 1 NUMBER""
AT 4,40 PUT PARAM1 using "dd"

~4
AT 4 , 4 0 GET PARAM1 w i n g "dtp
AT 5 , 1 PUT "INLET STREAM 2 MMBER*-
AT 5 , 4 0 PUT FARAK2 W i n g M c f
AT 5 . 4 0 GET PARAH2 w i n g "dd"
AT 6 , 1 PUT "OUTLET STREAM M M E t ' "
AT 6 , 4 0 PUT PAXAM3 w i n g "dd"
AT 6 , 4 0 GET PMUW3 w i n g «dd"
AT 7 , 1 PUT "PRESSURE*"
AT 7 , 4 0 PUT PARAH4 w i n g "ddddd.dd"
AT 7 , 4 0 GET PAUN4 w i n g •ddddd.dd*
EN0FORN

1 SPLITTER
FOJH UFORH8 AT 2,20 PUT •SPUTTER"
AT 4,1 PUT ••NLET STREAK NUMBER**
AT 4,40 PUT PARAM1 w i n g "dd"
AT 4,40 GET PARAH1 w i n g "dd"
AT 5,1 PUT •OUTLET STREAM 1 NUMBER**
AT 5,40 PUT PARAM2 w i n g "dtf"
AI 5,40 GET PARAH2 w i n g «AI*
A1 6,1 PUT •OUTLET STNEM 2 NUMBER"*
AT 6,40 PUT PARAM] w i n g "dd*
AT 6,40 GET PARAM] w i n g *dd»
AT 7,1 PUT "FNACT 10)1 OF INLET TO OUTLET STREAM 1>
AT 7,50 PUT PANAH4 w i n g "d.ddd"
AT 7,50 GET PARAM4 w i n g "d.ddd"
ENOFOIN

I PUMP
FORM UFORK* AT 2,20 PUT "PUMP"
AT 4,1 PUT "IMLET STREAM NUMBER-'
AT 4,40 PUT PARAM1 wing "dd"
AT 4,40 GET PARAM1 wing "dd"
AT 5,1 PUT "OUTLET STREAM NUMBER'*
AT 5,«0 PUT PARAMJ using "dd"
AT 5.(0 CET nam! using "<«"
AT 6 , 1 HIT "PRESSURE I N OUTLET."
m
AT 6,(0 run PARAW using <kua.<w
AT 6 , ( 0 CET M M K 3 using "ddddd.dd"
AT 7 , 1 PUT 'LIQUID MOLAR DENSIW ( O K X E / T O -
AT 7 , ( 0 PUT PARAK4 t a i n * "dd.dd"
AT 7 , ( 0 CET PARANA m i l * "dd.dd"
EN0F0M

I REACTOR
fORH UFORM10 AT 2,20 PUT "REACTOR"
AT 4,1 PUT "INLET SIREAM 1 NUMBER—
AT 4,(0 PUT PARAM1 using "dd"
AT 4,(0 GET PARAH1 w i n g " * P
AT S.I PUT -INLET STREAM 2 NUMBER""
AT 5,40 PUT PARAH2 using »dd"
AT 5,40 GET PAHAH2 using "dd"
AT 6,1 PUT "OUTLET STREAK NUMBER""
AT 6,40 PUT PARAH3 using "dd-
AT 6,(0 CET PARAH3 using "dd"
AT 7,1 PUT -PRESSURE-"
AT 7,40 PUT PAKAN4 using "ddddd.dd"
AT 7,40 CET PAHAK4 using "ddddd.dd"
AT 8,1 PUT "HEAT REMOVED (KJ/S) ••
AT 8,40 PUT PARAMS using "ddddd.dd"
AT 8,40 CET PARAW using "ddddd.dd"
AT 9,1 PUT "FRACTION CONVERSION""
AT 9,40 PUT PAIAN6 using "d.ddddd"
AT 9,40 GET PARAN6 using "d.ddddd"
1
AT 10,1 PUT "SECOND ORDER RATE CONSTANT"
AT 10,(0 PUT PARAM7 using "ddddd.dd"
AT 10,(0 GET PARAM7 using "ddddd.dd"
ENDFOBM

! SULFUR SATUBATON

*-
FORM UF0RM11 AT 2,20 PUT 'SULFUR SATURATOR'
AT 4,1 PUI 'INLET STREAM NUMER''
AT 4,40 PUT PMtAMI w i n g "dd" O
AT M O GET PARM1 w i n g "dd"
AT 5,1 PUT •OUTLET STREAM NUMtER''
a
AT 5,40 PUI PARAN2 wing •dd
AT 5,40 GET PMAM2 Wing •dd'
AT 7,1 PUI 'TEMPERATURE*'
AT 7.40 PUT PARAM3 wing -ddddd.dd"
AT 7,40 GET PARAH3 wing "ddddd.dd"
AT 8,1 PUT •PRESSURE'*
AT 8,40 PUT PAMH4 w i n g "ddddd.dd"
AT 8,40 GET PARAH4 w i n g "ddddd.dd"

I SULFUR SETTLE!
FORM UF0RH12 AT 2,20 PUT •SULFUR SETTLER-
AT 4,1 PUT 'INLET STREAM MUMRER'"
AT 4,50 PUT PARAM1 w i n g "dd"
AT 4,50 GET FARAN1 w i n g "del"
AT 5,1 PUT "OUTLET SULFUR STREAM MJMER**
AT 5,50 PUT PARAN2 wing •*!"
AT 5,50 GET PARAN2 wing -dcP
AT 6,1 PUT •OUTLET SOLVENT STREAM MM8ER*'
AT 6,50 PUT PARAN3 wing "d*»
AT 6,50 GET PARAH3 wing "dd"
AT 7,1 PUT "WTX SULFUR IN SULFUR STREAM*'
AT 7,50 PUT PARAN4 wing •ddd.dd'
AT 7,50 GET PMAM4 w i n g "ddd.dd"
AT 8,1 PUT 'PRESSURE*'
AT 8,50 PUT PMAM5 wing "ddddd.dd"
AT 8,50 GET PA3AN5 wing "ddddd.dd"

I SULFUR WASHER
FOAM UFORM13 AT 2,20 PUT - S A U K IMSKER*
AT 4,1 PUT -INLET SULFUR STAEAM NUHKR*>
AT 4,50 PUI PA1AM1 using «dd-
AT 4,50 GET PAIAHl using "ikf
AT 5,1 PUT "INLET UASH STREAM NUMSER'*
AT 5,50 PUT PARAH2 Using "dd"
AT 5,50 SET M R A H 2 m i n t »dd"
AT 6,1 PUT "OUTLET WASH STREAM NUFW«>*
AT 6,50 PUT PARAH3 using - * T
AT 6,50 GET PAAAHI using •dd-
AT 7,1 PUT •OUTLET SULFUR STREAM RUMER'*
AT 7,50 PUT PARAM using "<kf
AT 7,50 GET PARAM UAlng "dd"
AT 8,1 PUT "UTX SULFUR IN SULFUR STREAM*"
AT 8,50 PUT PARAM5 using "ddd.dd-
AT 8,50 GET PARUIS using "ddd.dd"
AT 9,1 PUT "PRESSURE-"
AT 9,50 PUT PARAM using "ddddd.dd"
AT 9,50 GET PARAM6 Using "ddddd.dd"

I MEIIER/OECAHTER
FORM UFORN14 AT 2,20 PUT "MELTER/DECANIER"
AT 4,1 PUT "INLET STREAM NUMKR'"
AT 4,50 PUT PARAN1 using "dd"
AT 4.50 GET PARAM1 using "dd"
AT 5,1 PUT "OUTLET NON-SULFUR STREAM NUMBER."
AT 5,50 PUT PARAN2 using "dd"
AT 5,50 GET PARAM using "dd"
AT 6,1 PUT "UUTLET SULFUR STREAM MMIER">
AT 6,50 PUT PARAM3 using "44"
AT 6,50 GET PARAM3 using W
AT 7,1 PUI "TEMPERATURE'"
AT 7,50 PUT PARAM4 using "ddddd.dd"
AT 7,50 GET PARAM4 using "ddddd.dd"
AT 8,1 PUT "PRESSURE*"
AT 8,50 PUT PARAH5 using "ddddd.dd"
AT 8,50 CET PARAHS w i n g "ddddd.dd- to

I FURNACE
FORM UFCCM5 AT 2,20 PUT -FURNACE*
AT 4,1 PUT •••LET SULFUR STREAK DUNK**'
AT 4,50 PUT PARAH1 using "do*
AT 4,50 GET PARAM1 w i n g *dd*
AT 5,1 PUT "INLET RES30UAL STREAM NUMBER**
AT 5,50 PUT PARAM2 using "dd"
AT 5,50 GET PARAH2 using "dd"
AT 6,1 PUT "INLET AIR STREAM NUMBER**
AT 6,50 PUT PAR/M3 using *dd*
AT 6,50 GET PARAM3 using "dd"
1
AT 7,1 PUT "FLOW OF S02 OUT OF FURNACE*
AT 7,50 PUT PARAM using "dddd.ddddd*
AT 7,50 GET PARAN4 using "dddd.ddddd"
AT 8,1 PUT -OUTLET STREAM NUMBER**
AT 8,50 PUT PARAM5 using "dd*
AT 8,50 GET PARANS using "dd"
AT 9,1 PUT "OUTLET TEMPERATURE**
AT 9,50 PUT PARAM6 using "ddddd.dd"
AT 9,50 GET PARAM using "ddddd.dd-
AT 10,1 PUT "OUTLET PRESSURE**
AT 10,50 PUT PARAM7 using "ddddd.dd"
AT 10,50 CET PARAM7 using "ddddd.dd"

I COMPRESSOR
FORM UF0RN16 AT 2 , 2 0 PUT 'COMPRESSOR*
AT * , 1 PUT "INLET ST'SAP NUMBER**
AT 4 , 5 0 PUT PARAK1 using "dd»
AT 1,50 GET PARAM1 using "dd"
AT 5 , 1 PUT "OUTLET STREAM NUMBER*"
AT S.SO PUT PARAM2 using " d f
AT 5,50 GET PARAN2 w i n g "dd"
AT 6,1 PUT •OUTLET PRESSURE""
AT 6,50 MIT PARAM] Using "ddddd.dd"
AT 6.SU GET PARAH3 using "ddddd.dd"

I SUIFUK CENTRIFUGE
FORK UF0RM17 AT 2,20 PUT •SULFUR CENTRIFUGE"
AT 4,1 PUT 'INLET STREAM NUMBER""
AT 4,50 PUT PARAM1 using "del"
AT 4.50 GET PARAM1 using "dd"
AT 5,1 PUT -INLET WASH STREAM MJMKR"'
AT S.SO PUT PARAH2 >alng "dd"
AT 3,50 GET PARAN2 using •dd"
AT 6,1 PUT ^CUTLET SULFUR SLURRY STREAM NUMBER**
AT 6,50 PUT PARAM3 Using "dd"
AT 6,50 GET PARAMJ using "dd"
AT 7,1 PUT "OUTLET 110U1D STREAM NUMBER'"
AT 7.50 PUT PARAH4 using «dd"
AT 7,50 GET PARAM using "dd"
AT 8,1 PUT "PRESSURE'"
AT 8,50 PUT PARANS usir* "oMdd.dd"
AT 8,50 SET PARAMS using "ddddd.dd"
AT 9,1 PUT "VTX SULFUR TO SLURRY IN FIRST SEPARATION""
AT 9,50 PUT PARAN6 using "ddd.dd"
AT 9,50 GET PARAM6 using "ddd.dd"
AT 10,1 PUT "UTX SULFUR TO SLURRY IN EXIT»"
AT 10,50 PUT PARAN7 using "ddd.dd"
AT 10,50 GET PARAM7 using "ddd.dd"

I PARTIAL CONDENSER
FOfiH UF0RM18 AT 2,20 PUT "PARTIAL CONDENSER"
AT 4,1 PUT "INLET STREAM NUMBER""

in
AT 4 , 5 0 PUT PARAM1 w i n g "dd"
AT 4 , 5 0 GET PAUMI using "dd"
AT 5 , 1 PUT 'PRESSURE III CONOEHSER"'
AT S.SO PUT PAKAM2 using "ddddd.dd"
AT 5 , 5 0 GET PARAM2 using "ddddd.dd"
AT 6 , 1 PUT "TEMPERATURE""
AT 6,50 PUT PARAH3 using "ddddd.dd"
AT 6.S0 GET PARAMJ using "ddddd.dd"
AT 7.1 PUT "OUTLET LIOUID STREAM NUMBER""
AT 7.50 PUT PAIIAM using "dtf=
AT 7,50 GET PARAH4 using "dd"
AT 8,1 PUT "OUTIET VAPOR STREAM HUtKR""
AT 8,50 PUT PARAH5 using "dd"
AT 8,50 GET PARAM5 using "dd"

I HEATER
FORM UF0RN19 AT 2 , 2 0 PUT 'HEATER*
AT 4 , 1 PUT "1HLET STREAM HUMER-*
AT 4 , 5 0 PUT PARAN1 using 'dd»
AT 4 , 5 0 GET PARAM1 Using "dd"
AT 5 , 1 PUT "OUTLET STREW NUMBER*'
AT S.SO PUT PARAM2 using "dd"
AT S.SO GET PARAH2 using «dd*
AT 6,1 PUT "HEAT ADOEO (IJ/S) ••
AT 6,50 PUT PARAHJ using "ddddd.dd"
AT 6,50 GET PARAH3 using •ddddd.dd"
ENDFORH

I STORAGE
FORM UFORH20 AT 2,20 PUT "STORAGE UNIT"
AT 4,1 PUT "INLET STREAM NUMBER"'
AT 4,50 PUT PARAM1 using "dd"
AT 4,50 GET PARAM1 using "dd"
AT 5.1 PUT "OUTIET STREAM DUMBER""
AT 5,50 PUT PARAH2 w i n g *dd>
AT 5,50 GET PARAW w i n g •<**•
AT 6,1 PUT -OUTIST FLOW OF COMPONENT •
AT 6,25 PUT PARAH4 w i n g "dd*
AT 6,25 GET PARAM4 W i n g *dd*
AT 6,40 PUT • (KHOIE/S) ••
AT 6 , 5 2 PUT PARAW w i n g "ddddd.dddd"
AT 6 , 5 2 GET PARAN3 w i n g •ddddd.dddd*
AT 7 , 1 PUT "OUTLET TEMPERATURE*"
AT 7 , 5 2 PUT PARAN5 w i n g "ddddd.dd"
AT 7 , 5 2 GET PARAM5 w i n g "ddddd.dd"
AT 9 , 1 PUT ' T H I S UNIT SETS THE FICV OF THE DESIRED COHPOSENT"
AT 1 0 , 1 PUT "AND SCALES THE OUTPUT FLOUS OF THE OTHER COMPONENTS*
AT 1 1 , 1 PUT "AT THE SANE COMPOSITION AS THE INLET*

I CRVSTALIIZER
FORM UF0RN21 AT 2 , 2 0 PUT "CRTSTALLUER*
AT 4 , 1 PUT "INLET STREAM WJNtER-*
AT 4 , 5 0 PUT PARAN1 w i n g "dd"
AT 4 , 5 0 GET PARAN1 w i n g «dd»
AT 5 , 1 PUT "OWLET STREAM N U M E * * "
AT 5 , 5 0 PUT PARAN2 w i n g " * T
AT 5 , 5 0 GET PARAH2 w i n g "dd*

I SULFUR SPLITTER
FORM UFORN22 A T 2,20 P U T 'SULFUR SPLITTER*
AT 4,1 PUT >INLET STREAM NUMBER**
AT 4,50 PUT PARAH1 w i n g "dd"
AT 4,50 GET PARAM1 w i n g "dd*
AT 5,1 PUT "OUTLET SULFUR STREAM NUMBER""
AT 5,50 PUT PARAM2 w i n g "dd"
AT 5,50 GET PARAM2 using "dd*

Is)
tn
m
AT 6.1 PUT "OUTLET LIMIID STREAM NUMER'"
AT 6,50 PUT PARAM3 uting "dd"
AT 6,50 GET PARAM3 uting "dd"
AT 7,1 PUT "FRACTION OF LIOUID TO SULFUR STREAM*"
AT 7,50 PUT PARAH* uting "d.dddd"
AT 7,50 GET FAKAH5 Uting "d.dddd"
EWFORM

I MAKEUP
FORM UFORM23 AT 2,20 PUT "MAKEUP UNIT*
AT *,1 PUT •INLET STREAM NUMBER-"
AT «,50 PUT PARAM1 uting "dd"
AT 4,50 GET PARAM1 uting »dd"
AT 5,1 PUT •OUTLET STREAM IMHSER""
AT 5,50 PUT PARAN2 m i n g "dd"
AT 5,50 GET PARAM2 using "dd"
AT 6,1 PUT "OUTLET FLOU OF COMPONENT •
AT 6,25 PUT PARAN4 uting "dd"
AT 6,25 GET PARAH4 uting «dd>
AT 6.40 PUT • (KttXE/S) ••
AT 6,55 PUT PARAN3 uting "ddddd.ddddd"
AT 6,55 GET PARAN3 uting -ddddd.ddddd"
AT 9,1 PUT "THIS UNIT SETS THE OUTLET FLOW OF THE DESIRED COMPONENT"
AT 10,1 PUT "WHILE PASSING THE FLOW OF THE OTHER COMPONENTS THROUGH"
AT 11,1 PUT "FROM THE INLET TO THE OUTLET"
ENOFORM

I TSET
FORM UFORM24 AT 2,20 PUT "TSET ROUTINE"
AT 4,1 PUT "INLET STREAM NUMBER""
AT 4,50 PUT PARAN1 uting »dd"
AT 4,50 GET PARAH1 uting "dd"
AT 5,1 PUT "OUTLET STREAM NUMER>"
AT 5,50 PUT PARAH2 uting "dd"
AT 5,50 GET PARAM2 uting "dd"
AT 6,1 PUT "SET TENPEftATUKE Of OUTLET-"
AT 6,50 PUT PARAH3 using "(ttddd.dd"
AT 6,50 GET PARAM3 w i n g "*kttd.<M-
EROFOm

I HTDROGUMON SPLITTER
rom [i'ttaas AT Z,» PUT •HTDKOCAMM SPLITTER*
AT 4 . 1 PUT •INLET STREAM M M K R < «
AT 4 , 5 0 PUT PARAH1 u t f n g *dd>
AT 4 , 5 0 GET PARAH1 m i f g "dd"
AT 5 , 1 PUT •OUTLET HTDIOCAMON STREAM K M E I > '
AT 5 , 5 0 PUT PARAHZ using • * » •
AT 5 , 5 0 GET PAUH2 u i n g "dd"
AT 6 , 1 PUT "OUTLET HTOItOCAtMM FAEE STREAM HUWER>
AT 6 , 5 0 PUT PARAM3 u t i n g "dd"
AT 6 , 5 0 GET PARAM3 using >d(t"
ENDFORM

SAVE TO "OFORH"

to
m
-J
I UNITS.1PF
1
I UNIT PRINTOUT SUHOUT1IIE rOA USE WITN IERKIN
I USED FOR NORNAl DATA ENTAT TO STREAMO.ITI
I SENDS THE FORN TO THE SCAEER

I LAST UPDATE: M / 1 3 / 8 6

TEST OPC

USE 1 :
PUTFORN UFOANt
T A U T UFOAN1
CETFOAN UFORNt
BREAK

CASE 2:
PUTFOAN UFOAN2
TAUT UF0RN2
SETFORN UFORH2
BREAK
CASE 3:
PUTFORN UFORNJ
TAUT UFQRH3
GETFORN UFORHJ
BREAK

PUTFORN UFORM
TALLY UFORM
CETFORN UFORM
BREAK
CASE 5:
PUTFORN UF0RH5
TALLT UFORNS
GETFORN UFORH5
BREAK
MTFOtN UFOtM
TALLY UFMN6
GETFMK UFMN6
MEAK
CASE 7 :
PUIFMN warn?
TALLY UfOmT
GETFCm UFOM7
UEU
CASE 8 :
PUTFMN U F M M
TALLY UFOMM
CETFOIM UFMN*
iHEAK
CASE 9 :
PUTFMN U F M M
TALLY UFOM9
GETFMN UFMH9
MEAK
CASE 1 0 :
PUTFMN UFMNIO
TALLY UFMNIO
GETFMN UFMNIO
««EA*
CASE 1 1 :
PUTFMN UFMN11
TALLY UFMN11
GETFMN UFMN11
IREAIC
CASE 1 2 :
PUTFMN UFMN12
TALLY UFMN12
GETFMN UFMN12
IREAC

PUTFMN UF0SH13
TALLY UFMH13
CETFWN UF0RN13
BREAK
USE H:
PUTFOR* l i ' O W H
TALLY UFORMK
GETFOtll U F O M K
BREAK
USE I S :
PUTFORN UFORN15
TALLY UF0RH15
GETFORN UF0AH15
BREAK
USE 16:
FUTFCRN UF0RN16
ULLY UFGRM16
GETFORN UF0RM6
BREAK
USE 17:
FUTFORN UFMI117
ULLY UF0RM17
CETFMN UF0RN17
BREAK
USE 18:
PUTFORN UFORN18
ULLY UF08M18
GETFORN UF0RH1B
BREAK
U S E 19:
PUTFORN UF0UI19
TALLY UF0RN19
GETFORN UF0RN19
BREAK
USE 20:
PUTFORN UFORH20
TALLY UFORN20
GETFORN UFORH20
BREAK
CASE 21:
PUTFOKH UFORH21
TAUT UFOXM2I
CETFORN UFORX2I
WEAK
CASE 2c:
•UTFOM UFORH22
TAUT UFOMU2
GEtFOM UFORH22
MIEAIC
CASE 2 3 :
PUTFOM UFCCH2I
T A U T UFORM23
GEIFORM UFORM23
MEAK
CASE 2«:
PUTFORH UFORK24
TAUT UFORH2*
GETFORH UF0RH24
MEAK
CASE 2 5 :
PUTFORM UFORH25
TAUT UF0RH25
CETFORH UFORH2S
BREAK

OTHERWISE:
OUTPUT -ERRORI IIUGAL UNIT IGNORED*
OUTPUT 'STRIKE ANT KET TO CONTINUE.*
WAIT
ENOTES!
1 OPAINT.IPF

i taurine 10 SEND THE EHTIKE OPCODE NATHIX TO THE P I I H E *


I THE OUTPUT I S IN THE SAME FORK AS THAT IMICH IS DISPUTED
I OH THE SCDEEH FOt DATA ENTIT.
I A l l EHTAIES M E DISPUTED FOUI TO A PAGE EXCEPT F «
I THE AaSOMEA/SIAIPPEI/DISTtlUTIOH IMICH OCCTIES AH EHTIIE PAGE
I
I LAST UPDATE: 03/23/06, DUN

E.PHAIM
E.PHID'M

USE S I K M I O
OITAIN MAST
UCOUHT'O

UHILE IMIT<>99

IF OPCODE.! THEN
EJECT
EHDIF

PIINT • •

PA2NT •UHIT'*,UHIT

TEST OPCODE

CASE 1:
PAINT UFOml
UCOUHT*-!
EJECT
BAEAK
CASE 2:
PRINT UF0SH2
CISC J :
N U T UFOMO
MEftI

O S 4:
mm UFOMH
UltX

CASE S :
N I D I UFOtHS
MEAK

CASE * :
M I K I UFMH6
mux
CASE 7 :
m i r ufoaxT
HEAK

CASE 8 :
PRINT UFMMS
UEAK

CASE 9:
PtlKT UFOW9
i«E«

CASE 1 0 :
PHIKT UFMN10
MFJUC

CASE 1 1 :
P81BT UF08M11
BREAK

to
W
USE 12: M
MINI UFOHI12 *•
HEM

USE 13:
H i l t UF0*M3
HEM

USE H :
MINI UFOtMH
HEW

USE 15:
MINT UFOW1S
HEM

USE 16:
MINT UF0KH16
HEM

USE 17:
MINT UFOUI17
UEM

USE 18:
MINT UF0KH18
HEM

USE 19:
MINT UFMM19
HEM

USE 20:
PRINT UFOBH20
BREAK
CASE 2 1 :
M H I UFOM21
•REAR

CASE 2 2 :
PRINT UF0RN22
1REAI

CASE 23:
PRINT UF0RH23
HEAX

CASE 2 4 :
M I N T UFOMttt
•IEAX

CASE 2 5 :
M I N I UFMH25
RREAK

ENDTEST

PRINT • »
PRINT • •
PRINT » •

UCOUNI4JCOUNT»1

IF UC0UNT*4 THEN
EJECT
UCOUNT'O
ENDIF

08TAIH NEXT

ENDUHILE

to
cr.
266

I I
KMM DMA USE H U E STRUCTURES FC* STREAHIO.ITi AND STREANS.1TI

Tefcle nee* : SIREANIO


File n a : STREANIO.ITI
Read Access : A
Write Access : A
Creattcn Date : M/10/(5
Nodi licit Ion Ditt : 04/02/86
Nu*er of Records : 32

Field : MANE LOGIC


Read Acceii : A
Writ* Acceii : A
Picture : (default)

Field : OPCODE NUN


dead Access : A
Write Access : A
Picture : " c W

Field : UNIT NUN


dead Access : A
Write Access ; A
Picture : "<tt.eW

Field : PARANt MM
Read Access : A
Write Access : A
Picture : "ddddd.ddddd"

Field : PARAN2 NUN


Read Access : A ,
U r I I * Access : A
Picture : "dottld.eaHd" K,
ON
00

Field : PMAN] KJN


(tad Access : A
U r I I * Access : A
Picture : "dtiU.Atti)"

field : PMAM NUN


lead Access : A
Writ* Accm : A ,
Picture : -ddddd.cttldd-

Flcld : PA«A« NUN


Read Access : A
Urit* Access : A
Picture : "ddddd.ottaJd"

Field . PAAANs MM
Reed Access : A
U r i l * Access : A
Picture : •ddddd.ddckM"

Field : PAKAN7 NUN


Need Access : A
Urlte Access : A
Picture : "ddddd.ddddd"

Fleld : PA«AK8 MM
Read Access : A ,
Urite Access : A
Picture : -ddddd.ddddd"

Field : PARAH7 MM
Reed Acceu : A
Urite Accesi : A ,
Picture : "ddddd.ddddd-

Field : PARAMO MM
Deed Acceu : A
Urite Access : A
Picture : •ddddd.ddddd*

Field : PARAM1 MM
Heed Access : A
Urite Access : A
Picture : "ddddd.ddddd"

Field : PARAN12 MM
Resd Access : A
Urite Acce * : A
Picture : "ddddd.ddddd"

Field : PARAH13 MM
Reed Access : A
Urite Access : A
Picture : •atttdd.ddddd*

Field : PARAMU HUM


Read Access : A
Urite Access : A
Picture : "ddddd.ddddd"

M
en
to
F i e l d : PARAH1S MM O
Reed Acceit : A
Write Acceti : A
Picture : -ddddd.ddddd-

F i e l d : PAMH16 HUM
Heed Acceti : A
Write Accctt : A
Picture : •ddddd.ddddd*

Field : PAAAH17 MM
Reed Acceit : A
Write Acceti : A
P i c t u r e : "ddddd.ddddd"

F i e l d : PAIAM18 MM
Reed Accesi : A
Write Acceit : A
P i c t u r e : *ddddd.ddddd»

F i e l d : PARAM9 MM
Reed Acceit : A
Write Accett : A
P i c t u r e : 'ddddd.ddddd*

F i e l d : PARAH20 MM
Read Accen : A
Write Acceit : A
P i c t u r e : "ddddd.ddddd"
Field : PARAMt MM
Read Access : A
Write Acceu : A
Picture : •ddttd.dddds*

Field : PMAH22 MM
Read Access : A . . .
Write Acceii : A
Picture : •ddddd.dddd*'

Field : PARAH2S HUN


Read Access : A
Write Access : A
Picture : "ddddd.ddddd"

Field : PARAM24 MM
Read Access : A
Write Access : A
Picture : Mdddd.ddddd"

Field : PARAH2S MM
Read Access : A
Write Access : A
Picture : •dddrid.dJddd"

Fleld : PARAH26 MM
lead Access : A
Write Access : A
Picture : -ddddd.ddddd*

to
•J
Field : MIAH27 HUH
•r*d AcctM -• A
Writ* Aeeeu : A
Picture : -ddddd.dddckr

f i e l d : MUN2S HUH
lead ACCHB : A
Write A c c n t : A
Picture : "ddddd.ddddd-
Tabic m : SHEWS
Fit* naae : SIAENtS.IU
tcad Access : A
write Access : A..
Creation Data : M/10/K
Modification Data : 04/02/86
Mater or Record! : 5*

field : i M M LOGIC
tead Acceaa : A
Writ* Acceta : A
Picture : (default)

Field : M2 MM
Read Accesa : A
Writ* Accesa : A
Picture : "d.ddddd"

Field : N2 MM
Read Accesa : A ,
Write Access : A
Picture : "d.ddddd*

Field : CO MM
Read Accesa : A
Write Access : A
Picture : "d.ddddd"

Field : C02 MM
Read Access : A
Write Access : A
Picture : "d.ddddd"

ro
•J
Field : C1 MM
Reed Access : A
Write Access : A
Picture : -d.ddddd-

Fleld . C2 MM
Reed Access : A
Write Accete : A
Picture : "d.ddddcT

Field : CI MM
Reed Access : A
Write Access : A ,
Picture : -d.ddddd*

Field : C* HUM
Reed Access : A ,
Write Access : A ,
Picture : "d.dckttt"

Field : C5 MM
Read Access : A
Write A C C O M : A
Picture : "d.dnddd"

Field : H2S MM
Read Access : A
Write Access : A
Picture : "d.ddddd"
Field : S02 *M
lead Access : A
Write Access : A
Picture : "d.ddddcf

Field - M O MM
Reed Access : A
Write Access : A
Picture : "d.ddddd"

Field : SM.V MM
Reed Access : A
Write Access : A
Picture : -d.ddddd"

F i e l d : DSULF MM
Reed Access : A
W r i t e Access : A
Picture : "d.ddddd"

F i e l d : CH3SH MUM
Reed Access : A
Write Access : A
Picture : "d.ddddO-

Field : C2H5SH MM
Reed Access : A
Write Access : A
Picture : "d.dddca"

to
-J
H e l d : SUir MIN
Reed Aceese : A
write Access : A
Picture : "d.ddAM"

'•eld : WATER KM
Reed Access : A
Urite Access ; A •
Picture : «d.ddddd"

field : 02 HUM
teed Accett : A
Write Accei* : A
Picture : -d.ddddd"

Field : IWKN MM
Read Access : A
Write Access : A
1
Picture : -d.ddddd

Field : FLOW MM
Reed Access : A
Write Access : A
Picture : "ddddd.ddddd"

Field : TEMP NUN


Reed Access : A
Write Access : A
Picture : -"•dddd.de?'

Field : PRESS NUH


• t t d Aectu : « . . . .
Writ* Acctsi : . . . . . .
Picture : -ddddd.dd"

M«ld : MTU Ml
• u d Accm : A
Uritt Acctti : A
Hctuft : -dddddd.dd-

field : PHASE
Read Acc«ti : A.,
Writ* Acctti : A.,
ricturt : "d-d"
This report was done with support from the
Department of Energy. Any conclusions or opinion*
expressed in this report represent solely those of the
authors) and not necessarily those of The Resents of
the University of California, the Lawrence Berkeley
Laboratory or the Department of Energy.
Reference to a company or product name does
not imply approval or recommendation of the
product by the University of California or the U.S.
Department of Energy to the exclusion of others that
may be suitable.

You might also like