You are on page 1of 9

ARTICLE IN PRESS

Engineering Applications of Articial Intelligence 18 (2005) 663671


www.elsevier.com/locate/engappai

Application of articial intelligence CFD based on neural network in


vaporwater two-phase ow
Zhi Shanga,b,
a
Department of Nuclear Science and System Engineering, School of Mechanical and Power Engineering,
Shanghai Jiaotong University of China, No. 1954, Shanghai 200030, China
b
Department of Thermal Engineering, Tsinghua University, Beijing 100084, China
Received 29 December 2004; accepted 31 January 2005
Available online 8 March 2005

Abstract

A new numerical calculation method has been developed based on the nonlinear analysis characteristics of articial neural
network (ANN). This method is a novel algorithm for computational uid dynamics (CFD) using the concept of the articial
intelligence. It is completely different from prior traditional numerical methods. It does not generate mesh in the calculation domain
except for some random points, even does not solve the algebraic equations. This method has been applied to compute the
vaporwater two-phase ows in a tube with uniform and nonuniform heating. Through the comparison of the calculated results
between this method and theoretical analysis (the nite difference method), the validity of this meshfree method based on the ANN
is conrmed.
r 2005 Elsevier Ltd. All rights reserved.

Keywords: Articial neural network; Articial intelligence CFD (AICFD); Vaporwater two-phase ow; Meshfree method

1. Introduction processing, calculating for complex computation and


self-learning. In the area of uid ow, the applications
In recent years, articial neural network (ANN) has of the ANN include the simulation of uid ow and
been universally utilized in science and engineering. transport (Jahangir and Jagath, 1998), the calculation of
ANN has the solid ability of self-learning and self- coefcients of heat transfer in uid-particle systems
organization. It can employ the prior acquired knowl- (Shyam, 2001), the prediction of ow eld using a
edge to respond to the new information rapidly and hybrid scheme of ANN (Bening et al., 2001), the
automatically. In these situations, especially when the dynamics simulation of a steam generator of nuclear
traditional methods are difcult to be carried out or reactor (Masini et al., 1999) and the computation of the
sometimes the specic models of mathematical physics friction factor in pipeline ow (Walid and Shyam, 1998).
will not be existing thoroughly, the neural network will However, these above applications of neural networks
be considered as a very good tool to tackle these time- have to be based on the training data from the
consuming and complex nonlinear relations, for neural experiment or the numerical calculation by the tradi-
network has the excellent characteristics of parallel tional methods. When the training process is nished,
the neural networks will be employed to deal with these
Corresponding author. Department of Nuclear Science and System
questions that will be answered. In the literature (He
et al., 2000), a class partial differential equation was
Engineering, School of Mechanical and Power Engineering, Shanghai
Jiaotong University of China, No. 1954, Shanghai 200030, China. Tel.:
converted to a feedback system that would be simulated
+86 21 629 33075; fax: +86 21 629 32270. by a neural network using the BP algorithm. Although
E-mail address: shangzhi@tsinghua.org.cn. this method is successful to solve a partial differential

0952-1976/$ - see front matter r 2005 Elsevier Ltd. All rights reserved.
doi:10.1016/j.engappai.2005.01.007
ARTICLE IN PRESS
664 Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671

Nomenclature x input data of neural network


y output data of neural network
A cross-section area, m2 z coordinate along tube, m
De diameter of tube, m z0 length of tube, m
f frictional coefcient a void fraction of gas
g gravitational acceleration, m/s2 f2tp two-phase multiplier
h enthalpy, kJ/kg r density, kg/m3
p pressure, MPa tf frictional stress, N
ql heating ux, kW/m
s training set of neural network Subscripts
U circumference of tube, m
V uid velocity, m/s f uid (water)
w weights of neural network g gas (vapor)
W mass ux, kg/s

equation, it is not a direct method to solve a differential where


equation like the idea of traditional numerical methods, W Aarg V g 1  arf V f , (4)
because this method (He et al., 2000) requires the system
of a differential equation that is similar to the system of , !
0 1  x2 x2
dynamics evolvement of ANN in both of structure and r 1 , (5)
function. rf 1  a rg a
There is a puzzle if an ANN can solve the differential Z
equations, especially, the stable differential equations in fW jW jf2tp
tf dl (6)
practical engineering as the traditional numerical U 2De rA2
methods employed to solve them. In this paper, the
in which
numerical method of ANN will be studied. The
characteristics of neural networks are employed to r 1  arf arg , (7)
realize a new numerical method for solving differential where A is the cross-sectional area of the ow channel, x
equations (Shang, 2000). the quality and f the coefcient of wall shear stress
(Shang, 2000). The void faction can be calculated by
ZuberFindlay formula (Shang, 2000). The two-phase
2. Hydrodynamic equations of two-phase ow multiplier of f2tp can be gotten from the formula of
Chisholm (Chisholm, 1973).
Considering a stable ow in a tube, the governing
equations of the vaporwater two-phase ow are used in
the literature (Shang, 2000). Although the change of 3. Numerical algorithm
uid is always existent in vaporwater two-phase ow
because of the exchange of material and energy on the 3.1. Work of neural network
interface between vapor and water, the time-average
parameters in the ow will be unchangeable. The Neuron is the basic unit of a neural network. Usually,
conservation equations about the stable ow of vapor it is a nonlinear node with multi-input ports and one
water two-phase ow are built as follows (Shang, 2000). output port. Fig. 1 shows the structure of the single
Mass conversion equation neuron.
  In Fig. 1, w0i is the threshold value; w1i ; . . . ; wni are the
q W
0. (1) weights of linking prior neurons to the present neuron;
qz A
x1 ; . . . ; xn are the input data; yi is the output value. The
Energy conversion equation working process of this neuron can be presented by
  Eq. (8) mathematically. Many neurons, working with
q Wh q
l. (2) this way described in Eq. (8) are assembled for a
qz A A neural network. This neural network is able to tackle
Momentum conversion equation quite complex nonlinear problems of approximating
Z   complex functions that are difcult to model mathema-
qp q W2 tically or evaluate numerically (Jahangir and Jagath,
A  tf dl  rgA  , (3)
qz U qz r0 A 1998; Shyam, 2001; Bening et al., 2001; Masini et al.,
ARTICLE IN PRESS
Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671 665

x1 output y

W1i

W2i-1 W2i W2i+1


W2i yi
x2 W0i
W0i-1 W0i W0i+1
f f f

Wni

W1i-1 W1i
W1i+1
xn

Fig. 1. Structure of single neuron.

input x
1999; Walid and Shyam, 1998; He et al., 2000): Fig. 2. Boundary network.
!
Xn
yi f wji xj  w0i , (8)
output y
j1

where f x 1=1 expx is the nonlinear expression


function of the neuron (Hecht, 1989; Johansson et al.,
1992).
W2i-1 W2i W2i+1

3.2. Structures of neural networks for solving


hydrodynamic equations W0i-1 W0i W0i+1
f' f' f'
ANN can perform many complex calculations.
Generally, from the angle of mathematical operators,
the numerically solving process of differential equations
is only a kind of mapping relationship. Actually, the W1i-1 W1i
traditional numerical method is an example for this W1i+1
relationship. When the traditional numerical methods
solve a differential equation, rst the differential
equation is discretized, and then the differential
equation is translated to the algebraic equations, next
through solving the algebraic equations the whole input x
numerical solving process will be performed. In this Fig. 3. Function network.
paper, upon the mapping theory, two kinds of neural
networks with three layers are constituted for realizing
the numerical calculation of differential equations.
These structure types of neural networks are showed In these structure gures, the nodes of input and
in Figs. 2 and 3. One of them which is used to tackle the output layer are linear nodes with thresholds 0. The
boundary situation of the vaporwater two-phase ow is weights between the input layer and the hidden-layer
called as boundary network, the another one which is to nodes are the w1,i, and the w2,i which are the weights
solve the hydrodynamic equations is called as function between the hidden-layer and output layer nodes. The
network. Actually, these two neural networks are same thresholds in the hidden-layer nodes are the w0,i. In
as one. The only difference is that the nonlinear the boundary network, the nonlinear function of the
expression function of the neuron. It is f x in the hidden-layer nodes is adopted as f x 1=1 ex
boundary network and f 0 x in the function network. (Hecht, 1989; Johansson et al., 1992). However, the
ARTICLE IN PRESS
666 Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671

derived function of the nonlinear function in the network, which is


boundary network is regarded as the nonlinear descrip- ex
tion function of the hidden-layer nodes in the function f 0 x .
1 ex 2
Generally, the nonlinear description function of a
neural network only considers the direct functional
Two Phase Flow relation between the input and the output. However, in
this paper, the differential equations will be solved by
the neural network. The derivative relations between the
input and the output have to be involved. According to
the operator theory, the neural network will execute a
role of series approximation. Therefore, the derivative
relations between the input and the output can be
q performed by the derivative of the nonlinear description
function of the neural network.

3.3. Performance of the numerical algorithm of artificial


neural networks

When using ANN to perform the calculation, the key


is to get the right weights among the nodes. The
Single Phase Flow algorithm of back-propagation (BP) is a good tool to get
the right weights. In the calculation process BP
Fig. 4. Structure and heating of vaporwater two-phase ow along the algorithm is able to continually revise these weights
tube. and thresholds following the training process of the

Start

Randomly set the weight of the Solve the mass conservation equation using Solve the energy conservation equation Solve the mass conservation equation using
boundary network and positions the function network using the function network the function network
inside the calculation domain

1.keep the position inside the calculation 1.keep the position inside the calculation 1.keep the position inside the calculation
domain and compute the right side of the domain and compute the right side of the domain and compute the right side of the
Solve the boundary network using mass conservation equation at these conservation equation at these position as momentum conservation equation at these
the inlet position and pressure as position as the training samples the training samples position as the training samples
the training sample 2.copy the trained weights from the bound 2.copy the trained weights from the bound 2.copy the trained weights from the energy
-ary file as the weights of the function -ary file as the weights of the function file as the weights of the function
network network network

Train the boundary network using


BP algorithm

Train the function network using BP algorithm Train the function network using BP algorithm Train the function network using BP algorithm

no
Convergent?
no no no
Convergent? Convergent? Convergent?
yes
yes yes yes
Save the weights of the boundary
network to the boundary file Save the weights of the function Save the weights of the function
Save the weights of the function
network to the mass file network to the mass file
network to the energy file

Copy the weight from


the momentum file as no
(pn pn1)/pn 10-3
the weight of the
boundary network

yes

Copy the weights from these weights' files


(the energy file and the momentum file) to
the boundary network respectively

Input a position inside the domain to the


boundary network to get the final relative
physical value (enthalpy and pressure) at
this position

End

Fig. 5. Diagram for solving the vaporwater two-phase ow.


ARTICLE IN PRESS
Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671 667

neural network (Hecht, 1989; Johansson et al. 1992). where k 0; 1; 2: Adopting an iterative gradient-des-
Supposing the input data of a neural network are cend procedure to Eq. (10) we get the weights with the
fxjxk ; k 1; 2; . . . ; ng (the input of learning examples), following mathematical equation (Johansson et al.,
output data are fyjyl ; l 1; 2; . . . ; mg and the objective 1992):
data are fsjsl ; l 1; 2; . . . ; mg; the training process will 
be performed with the following mathematical compu- p p1 qey; s
wki wki  l (11)
tational procedure. qwki wki wp1
ki
The errors between the output data and the
objective data can be calculated by the following in which l is the step-size, superscript p indicates the
equation: order number of iteration.
In this paper, the boundary network is mainly to deal
1X m
with boundary conditions. This means that the bound-
ey; s y  sl 2 , (9)
m l1 l ary conditions will be adopted as the learning data to
train the boundary network. However, differential
where m is delegated as the numbers of output data, equations as the learning examples will train the
yl is the output set of the boundary or function net- function network. The solving procedure will be
work and sl is set of the objective data (the output performed as the following steps:
of learning examples). Applying the least mean
squares (LMS) (Shang et al., 2002) algorithm into
Eq. (9) gives 1. Randomly choose the initial weights between 0 and 1
for the boundary network.
qey; s 2. The boundary conditions are treated as the learn-
0, (10)
qwki ing examples to train the boundary network.

Fig. 6. Enthalpy changing curve and convergent curve of neural networks: (a) curve of enthalpy along the tube, (b) convergent curve of enthalpy of
boundary network and (c) convergent curve of enthalpy of function network.
ARTICLE IN PRESS
668 Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671

Through the mathematical computational pro- input the boundary network, which has become the nal
cedure in Eq. (9)(11), the nal correct weights are working network, in fact, the numerical result of the
gotten. differential equation at this point x can be gotten.
3. Use the weights gotten by the boundary network as
the weights of the function network and use the
differential equations describing the vaporwater
two-phase ow as the learning examples to train the
function network.
4. Use the weights revised by the function network as
the new weights of the boundary network.
5. Repeat from step 2 to step 4 until the con-
vergent precision or the iterative times will be
reached.
At the third step, when the function network is
trained, the effects of boundary condition will be intro-
duced into inner solving domain directly and quickly,
because the weights of the function network are of the
boundary network. This virtue that the boundary situ-
ation can directly affect the inner domain will not be
performed by the traditional numerical methods. When
the solving process is nished, any point x is chosen to Fig. 8. Curve of temperature of vaporwater two-phase ow.

Fig. 7. Pressure changing curve and convergent curve of neural networks: (a) curve of pressure along tube, (b) convergent curve of pressure of
boundary network and (c) convergent curve of pressure of function network.
ARTICLE IN PRESS
Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671 669

4. Numerical calculation and results analysis

4.1. Case for uniform heating

A vaporwater two-phase ow in a tube with heat ux


along the wall is chosen as the computational object,
shown in Fig. 4. The heating ux is 188.5 kW/m, the
mass ux at the tube inlet is 4000 kg/(m2 s), the working
pressure is 5 MPa and the subcooling temperature of the
water is 7.13 1C. The tubes length is delegated as z0,
z0 1 m long and the diameter of the tube is 0.02 m.
In this paper, the boundary network includes one
input node of neuron, one output node of neuron and
one hidden layer containing 25 nodes of neuron. The
number of the nodes of a neural network can be decided
accordingly by ensuring the correctness of the simula-
tion and also by ensuring the redundancy for learning.
Actually, how to quantify the specic number of nodes
Fig. 9. Structure and heating of vaporwater two-phase ow along
of a neural network meets a big challenge in the
tube.
practical application. According to the test for this
vaporwater two-phase ow situation, to choose 25
nodes of neuron is enough.

Fig. 10. Enthalpy changing curve and convergent curve of neural networks; (a) curve of enthalpy along the tube, (b) convergent curve of enthalpy of
boundary network and (c) convergent curve of enthalpy of function network.
ARTICLE IN PRESS
670 Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671

The function network has the same structure as the with the analysis results. The errors of results between
boundary network. In this paper, we chose 12 random the neural networks and the nite difference method are
points, in which 10 points (from 0 to 1) are selected quite small. The computational precision of a neural
inside the tube size and two points (0 and 1) are the network is able to satisfy the requirement of practical
boundary points at the two ports of the tube, engineering, although the results are gotten without
respectively, as the input data for function network. solving any algebraic equation. Figures (b) and (c) in
The diagram for solving the ow situation is shown in Figs. 6 and 7 show the convergent curves of boundary
Fig. 5. network and function network, respectively. The con-
When the whole solving process is nished, the vergent speed of boundary network is faster than the
other 20 stochastic points in the solving domain, function network, even at the beginning of the solving
which are different from the prior learning exam- process; the boundary network has reached the con-
ples, are chosen to input the working network for vergence. Therefore, the whole calculation time will be
getting the nal numerical results. If the boundary (inlet spent at the function network.
and outlet) points are added, the total points are 22. Using the pressure gotten from neural networks, we
The computational results are shown in Figs. 6(a) can observe the temperature changing along the tube
and 7(a). In these gures, macula is delegated as the and judge if the ow has already reached the two-phase
numerical result by the neural network. The solid line ow. Generally, under the heating condition, the
gives the result by the nite difference method, which temperature of a single-phase liquid will move up along
can be considered as the analysis results. From the the tube, and the boiling of liquid happens at the
gures, we can see that the results of numerical temperature of the liquid which is the saturated
calculation by neural networks are very well congruent temperature (Shang, 2000). From this point, Fig. 8

Fig. 11. Pressure changing curve and convergent curve of neural networks: (a) curve of pressure along the tube, (b) convergent curve of pressure of
boundary network and (c) convergent curve of pressure of function network.
ARTICLE IN PRESS
Z. Shang / Engineering Applications of Artificial Intelligence 18 (2005) 663671 671

However, from the theory of operator, this relationship


of algebraic equation is not a necessary existence always.
Based on this idea, in this paper, a numerical operator
without solving any algebraic equation using neural
network is created. The two types of neural networks
tackle the boundary condition and conversion equa-
tions, respectively. The information communication
between the two types of neural networks is carried
out through the exchange of the weights of the neural
networks. Via a specic calculation about vaporwater
two-phase ow in a tube, the correctness of this
numerical method is conrmed. Besides, without solving
an algebraic equation, the virtue of this method is that
when the whole solving process is performed the effects
of boundary can be introduced into the inner domain
directly and completely through the weights of the
Fig. 12. Curve of temperature of vaporwater two-phase ow. boundary network. This will be important for some
practical situations of engineering.
shows the change of water temperature along the tube.
In this gure, macula is delegated as the numerical result
by neural network. The solid line gives the change of
temperature under system pressure, which will be References
constant when the water is boiling, for the systems
Bening, R.M., Becker, T.M., Delgado, A., 2001. Initial studies of
pressure is stable. However, in the real ow situation,
predicting ow elds with an ANN hybrid. Advances in Engineer-
the pressure of water will be changeable along the tube ing Software 32, 895901.
because of the frictional pressure gradient, gravitational Chisholm, D., 1973. Pressure gradients due to friction during the ow
pressure gradient and accelerational pressure gradient. of evaporating two-phase mixtures in smooth tubes and channels.
Therefore, the temperature is not a constant under International Journal of Heat Mass Transfer 16, 347358.
boiling condition. However, the temperature will not He, S., Reif, K., Unbehauen, R., 2000. Multilayer neural networks for
solving a class of partial differential equations. Neural Networks
bias the saturated temperature too much under the ow 13, 385396.
regime in this paper. From Figs. 7 and 8, we can see that Hecht, N.R., 1989. Theory of the backpropagation neural net works,
the new numerical method of neural network can be vol. 1(1). Int: International Joint Conference on Neural Networks,
employed to calculate vaporwater two-phase ow San Diego, USA, pp. 593605.
thoroughly and correctly. Jahangir, M., Jagath, J.K., 1998. Application of articial neural
network and genetic algorithm in ow and transport simulations.
Advances in Water Resources 22 (2), 145158.
4.2. Case for nonuniform heating Johansson, E.M., Dowla, F.U., Goodman, D.M., 1992. Back-
propagation learning for multi-layer feed-forward neural networks
The vaporwater two-phase ow in a tube is shown in using the conjugate gradient method. International Journal of
Neural Systems 2 (4), 291301.
Fig. 9. The heating ux is 188:5 sinzp=z0 kW=m; the
Masini, R., Padovani, E., Ricotti, M.E., Zio, E., 1999. Dynamic
mass ux at tube inlet is 4000 kg=m2 s; the working simulation of a steam generator by neural networks. Nuclear
pressure is 10 MPa and the subcooled temperature of Engineering and Design 187, 197213.
water is 3.02 1C. The tubes length is delegated as z0, Shang, Y., Wu, S.J., Xiang, H.G., 2002. Parallel pipelined least-mean-
z0 1 m long and the diameter of the tube is 0.02 m. square algorithm and its performance analysis. Progress in Natural
The same solving methods are employed like in the Science 12 (1), 6972.
Shang, Z., 2000. Application research of wavelet analysis and arti-
uniform heating case. The solved results are shown in cial neural networks in thermal analysis of gas-liquid two-phase
Figs. 1012. ow. Ph. D. Dissertation, Xian Jiaotong University, Xian, China,
pp. 145169.
Shyam, S.S., 2001. A neural network approach for non-iterative
calculation of heat transfer coefcient in uid-particle systems.
5. Conclusion
Chemical Engineering and Processing 40, 363369.
Walid, H.S., Shyam, S.S., 1998. An articial neural network for non-
In the traditional numerical methods, the nal solving iterative calculation of the friction factor in pipeline ow.
step will come down to solving an algebraic equation. Computers and Electronics in Agriculture 21, 219228.

You might also like