Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Rochester Institute of TechnologyRIT Scholar Works
Theses Thesis/Dissertation Collections
5-1-1985
An analysis of stroke fluid flow in a convergingchannel using a penalty function finite elementformulationKeith A. Honkala
Follow this and additional works at: http://scholarworks.rit.edu/theses
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusionin Theses by an authorized administrator of RIT Scholar Works. For more information, please contact [email protected].
Recommended CitationHonkala, Keith A., "An analysis of stroke fluid flow in a converging channel using a penalty function finite element formulation"(1985). Thesis. Rochester Institute of Technology. Accessed from
AN ANALYSIS OP STOKES PLUID PLOW IN A
CONVERGING CHANNEL USING A PENALTY PUNCTION
PINITE ELEMENT PORMULATION
by
Keith A. Honkala
A Thesis Submitted in
Partial Fulfillment of the
Requirements for the Degree of
MASTER OF SCIENCE
in Mechanical Engineering
Approved by:Prof. Name Illegible
(Thesis Advisor)
Requirements for the Degree of
MASTER OF SCIENCE
in Mechanical Engineering
Name Illegible(Thesis Advisor)
Prof • ---,--:-.:.=..:..:.:..;:...:...:..:..::.~~-__:_---
Approved by:
Name IllegibleProf • .-;.,;:.;;;.;...;.~~=:.:.;;;,. _
Name IllegibleProf • ---.:....;:..::..:...:..:...=...:..:..:...=.;z;.;:.:...:..=.. _
Name Illegible(Department Head)
Prof •---..,.~--__:_----=--=:..:..:...=...:..:..:...===-----
DEPARTMENT OF MECHANICAL ENGINEERING
T Kpith A. Honkala
I Keith A. Honkala prefer to be
contacted each time a request for reproduction is made. I can be
reached ·at the following address.
Date -' 7 Mfti 8r
ABSTRACT
A penalty function finite element program is developed to study
two dimensional creeping flow in a converging channel. The finite
element solution is compared to the analytical solution of purely
radial flow. The analysis reveals that the assumption of purely radial
flow is valid for small apex angles, but is inappropriate for larger
angles .
TABLE OF CONTENTS
List of Tables v
List of Figures vi
List of Symbols vii
Introduction 1
Literature Review 5
Analytical Solution to Converging Flow 8
Problem Statement 8
Solution to Converging Flow 9
Finite Element Formulation 13
Problem Statement 13
Extremization of the Functional 14
Variational Form of the Equations 17
Finite Element Equations 19
Evaluation of the Integrals 22
Choice of the Penalty Parameter 26
Mesh for the Finite Element Formulation 29
Results and Discussion 31
Sensitivity Analysis 31
Program Verification 33
Error Analysis 34
Conclusions 37
References 38
Appendices 40
A. Equations Governing Fluid Motion 40
Continuity Equation 4 0
Navier-Stokes Equation 4 0
B. Finite Element Program STOKES 42
Flow Diagram of Computer Program STOKES 4 3
Description of COMMON Block Variables 43
STOKES Data Input 4 5
Listing of STOKES 47
LIST OF TABLES
Page v
Table 1. Nominal Problem Parameters
Table 2. Mesh Variation in X-Direction
Table 3. Mesh Variation in Y-Direction
Table 4. Variation of Penalty Parameter
Table 5. Comparison of Finite Element and
Analytical Solutions
31
32
32
33
35
Page vi
LIST OF FIGURES
Figure 1. Typical Multi-Cavity Molding Machine 2
Figure 2. Visualization of Typical Converging Flow 4
Figure 3. Purely Converging Flow Idealization 4
Figure 4. Purely Converging Flow Geometry 8
Figure 5. Domain of Solution in Rectangular Coordinates 14
Figure 6. Domain of Integrals and Coordinate
Transformation 23
Figure 7. Extrapolation of Penalty Parameter 28
Figure 8. Mesh for Converging Channel Flow 30
Figure 9. Error in Neglecting Transverse Velocity 36
Page vii
LIST OF SYMBOLS
A area of integration ( cm )
Al,A2,A3 constants of integration
Bl ,B2 ,B3,B4 ,B5 constants of integration
C path on boundary of region
e element number
F a generic function
f a function; external force ( dyne)
{F} load vector ( dyne )
G a generic function
g acceleration due to gravity (cm/sec^
)
I a functional; an integral
i index of summation
unit vector in x direction
j index of summation
j unit vector in y direction
[j] Jacobian matrix
[K] stiffness matrix
L linear operator of differential equation
1 distance on boundary ( cm )
M order of Gauss integration
n unit vector normal to boundary
n number of nodes in element e
p pressure ( dyne/cirr )
p. pressure at inner radius (dyne/cm2
)
Page viii
2AP average pressure drop ( dyne/cm )
A-Panal analytically evaluated pressure drop( dyne/cm )
APj-e finite element pressure drop ( dyne/cm )
Q volumetric flow rate ( cnr/sec )
R residual of linear operator
R^ inner radius of channel ( cm )
RQ outer radius of channel ( cm )
r polar radial coordinate
S-^,S2,S3 complex constants of integration
t time ( sec )
t x component of surface traction ( dyne/cm )
ty y component of surface traction ( dyne/cm^)
{U} velocity solution vector ( cm/sec )
u x component of velocity ( cm/sec )
u approximation to velocity u ( cm/sec )
u.j. nodal approximation to u ( cm/sec )
urr component of velocity ( cm/sec )
Uqtransverse component of velocity ( cm/sec )
u_ z component of velocity ( cm/sec )
v y component of velocity ( cm/sec )
v approximation to velocity v ( cm/sec )
v.: nodal approximation to v ( cm/sec )
w z component of velocity ( cm/sec )
x rectangular coordinate
x. x coordinate of global node ( cm )
Page ix
y rectangular coordinate
Yi y coordinate of global node ( cm )
oC apex half-angle of converging channel ( rad )
If penalty parameter
rectangular coordinate
6 transverse polar coordinate
JH viscosity ( g/(cm sec) )
rectangular coordinate
mass density (gm/cm3
)
(f normal stress ( dyne/cm )
shear stress (dyne/cm2
)
0 kernel of functional
W weight function, shape function
f
Page 1
INTRODUCTION
Computer simulations of polymeric flows is becoming an increas
ingly important tool that the analyst can use to bridge the gap be
tween theoretical and empirical work. The method of finite elements
plays an important role in this analysis since it can model complex
geometries and boundary conditions. It is the intent of this study to
analyze some common assumptions made by analysts who endeavor to
simplify the mathematical problem substantially.
A typical injection molding setup is illustrated in Figure 1. In
the general case, there are almost an unlimited number of parameters
to consider in seeking an analytical solution covering the entire
system. For instance, parameters on the machine itself are flow
capacity, operation pressure and temperature, heat transfer character
istics, dimensions of runners, gates, sprues, etc.
The fluid itself could be Non-Newtonian, thus its properties could
depend on temperature, pressure, chemical reactions, and time. In
addition, the governing equations are extremely complex (see Appendix
A), so an analytical solution to the complete problem is virtually
impossible .
In an effort to understand some general aspects of the fluid
behavior, the analyst often implements assumptions and approximations
to make the mathematical problem solvable. A typical example of this
approach is the idealization of the actual flow in Figure 2 to purely
converging flow in Figure 3.
The configuration shown in Figure 2 is typical of many applica
tions in polymer processing equipment. It involves fluid travelling
through a contraction to another area of the mold, such as a conver
gent gate. The general flow illustrated here is not amenable to
Page 2
Plunger for
Pressurization
-j
i i
i '
Figure 1. Typical Multi-Cavity Molding Machine
Page 3
analytical solution [1]*. However, a number of assumptions can be
utilized to solve the purely converging flow problem of Figure 3.
Among these assumptions are that the fluid is incompressible and
Newtonian, and that the flow is steady and isothermal. The simplicity
of the resulting equations is a valuable aid in determining trends and
general behavior of flow in converging channels. However, the purely
converging flow solution becomes less applicable as a description to
the flow in Figure 2 as the apex angle (06) is increased.
It is the aim of this study to analyze the two flow problems of
Figures 2 and 3 by means of finite elements and to draw some conclu
sions about the appropriateness of the purely converging flow assump
tion. A penalty function finite element computer program STOKES is
developed in its entirety to aid the analysis. It should be noted
that finite elements is a numerical technique for solving problems,
therefore it can not exactly solve the problem. But it can model the
geometry fairly well and provide some insight into certain aspects of
the exact solution. Any comparisons in this report between analytical
and finite element solutions are made on a relative basis, as the
actual solution is not known. Experimentation is the only sure way of
truly verifying the finite element analysis.
A key parameter in this analysis will be /\P, the average pressure
drop between entrance and exit regions. This particular parameter is
important in its own right since pressure drops need to be determined
throughout a polymer molding machine to properly set and monitor
process controls, particularly in designing a"balanced"
mold [2].
However, it is also an extremely convenient parameter to use since
this one parameter sufficiently characterizes the entire solution.
* Numbers in brackets refer to citations in the Reference section.
Page 4
^ t L L L / / / i
jL < / < {/
"7 7 7 7 7 7 7
7 7 7 / / /
Figure 2. Visualization of Typical Converging Flow
Figure 3. Purely Converging Flow Idealization
Page 5
LITERATURE REVIEW
The problem of purely converging flow was solved by Hamel in 1 9 1 6
in terms of elliptic integrals. His solution was sufficiently general
that it even accounted for inertial effects in the completeNavier-
Stokes Equation. The only assumption he used was that the flow is
purely radial. His derivation is detailed in Batchelor [3], and the
problem is commonly known as"Hamel flow.
"
Morton Denn [4] includes an excellent chapter in his book covering
the various aspects of converging flow. He breaks down Hamel 's solu
tion into three cases: (1) creeping flow, for which Reynolds number
is very small and inertial effects are neglected (also known as
"Stokes flow"); (2) the lubrication approximation, which ignores the
transverse pressure gradient for small apex angles; and ( 3) the bound
ary layer approximation, useful when the inertial effects dominate at
high Reynolds numbers. These three approximations are used to effect
uncomplicated solutions and equations. While they are merely simpli
fications of the general Hamel flow problem, they are popular among
analysts and eradicate the awkward elliptic integrals. However, these
assumptions are also widely abused and misapplied, so Denn highlights
the differences of each with almost painstaking effort.
Zienkiewicz and Cheung are accredited with being the first ones to
apply finite elements to fluid problems (1965) [5], Since then numer
ous other investigators have been at the forefront of research to
apply finite elements to fluid problems: Oden, Taylor, Hood, Baker,
Olson, Strang, Fix, and Reddy, to name a few. A history of progress
Page 6
to date is included in ref. [6]. Interestingly, Zienkiewicz states
there that finite elements now dominate the field of numerical solu
tion methods for problems involving Stokes flow. This is largely due
to the fact that solving a fluid flow problem with a continuity con
straint is equivalent to solving a solids problem with a poisson ratio
near 0.5. Thus the codes existing then were modified slightly and
immediately applied to solving Stokes flow problems.
One of the first formulations to be used in fluids was the pres
sure-velocity method, where Galerkin finite elements are applied di
rectly to the governing equations. This method has drawbacks, though,
since it requires tedious assembly techniques and results in singular
matrices [7].
Another common method is the stream function formulation where the
governing equations are combined into one equation by means of stream
functions. However, this method is not extendable to three dimension
ed problems and special boundary conditions are impractical to imple
ment. The stream function-vorticity formulation suffers a similar
fate [8].
The penalty function finite element formulation is the most recent
to be applied to solving Stokes flow. It does not experience the
problems of the other formulations, but it has some numerical diffi
culties to overcome. Reddy 's book An Introduction to the Finite Ele
ment Method [9] clearly presents the penalty function method, lists a
general purpose two dimensional finite element program, and includes
example problems along with their computer output. Reddy 's book is
the basis for many of the concepts presented in this paper.
Page 7
Much research is being carried on currently to try to address the
numerical instability of the penalty method for large scale problems.
However, it has already gained wide acceptance in the solution of
Stokes fluid flow problems. Hughes et al. [10] wrote a survey paper
summarizing progress to date in using the penalty function formula
tion. The penalty method is comparatively new, and it is expected to
remain an area of active research for quite some time.
Page 8
ANALYTICAL SOLUTION TO CONVERGING FLOW
Problem Statement
The equations for purely converging flow between two inclined
plates will be developed here. Consider the flow in a converging
channel as shown in Figure 4.
Figure 4. Purely Converging Flow Geometry
The flow input is assumed to be strictly radial and inward at the
outer radius RQ. For this flow the velocities may be assumed to be ur
= u (r,6), uQ= 0, and u_ = 0 for a two dimensional problem. Equa
tions (A. 2) and (A. 6) through (A. 8) are the applicable governing
equations. Assuming that viscous terms dominate the inertial terms,
the fluid is incompressible, body forces are negligible, and the flow
Page 9
is steady, the equations governing purely converging radial flow are:
Assumed Velocities u^(r,6) Uq= 0 ( 1 )
( 2 )
( 3 )
( 4 )
( 5 )
( 6 )
( 7 )
Volumetric Flow Rate Q =
J u_ rde ( 8 )
-d
Donain of Solution Ri<r<RQ-
oi< 6 <oC
Note that Q must be stated as a negative quantity since the flow
is radially inward.
Solution to Converging Flow
The analytical solution to the system of governing equations is
straightforward. Integrating (2) gives:
ru-. = f (6) ( 9 )
Substituting this relationship into the equilibrium equations ( 3 )
Continuity Equation
1A
--2.(1^.)= 0
r "^r
b?_H hS
Equilibrium brr2 ^e2
Equations <=>P
b* r de
Boundary Conditions u_.(r,oO = 0
u_.(r,-^)= 0
P(Rif0) =
Pi
Page 10
and ( 4) produces:
2r r
^P 2/4=
0f (e)
aer2
f'(6)
df
=, etc.
de
Differentiating the first equation with respect to 6 and the
second with respect to r and equating them results in an ordinary
differential equation, along with appropriate boundary conditions.
f '"(6) + 4f '(6) = 0
f(oO = 0
f(-rf) = 0
Q =
j f (6) de
This is easily solved by substituting f^(e) = A^e j into the
above differential equation, where A^ and S^ are complex constants to
3J J
be determined, and f(e) = I f-;(e). This results in Si=0, S,=H-2i,3=1 3
S^=-2i, ( i = V _1 )' so that:'3
f (6) =
Aj_ +A2e2ie
+A3e~2ie
Utilizing Euler's formula [11] ( & = cose + i sine ), produces a
solution with constants to be determined from the boundary conditions:
f (e) =
B-l + B2cos(2e) + B3sin(2e)
Page 11
The two boundary conditions on the velocities at the wall, the
volumetric flow rate equation, and the Pythagorean Theorem ( sin2e +
2cos e = 1 ) are sufficient to solve for f(e) in the following form:
sin2o<;-
sin2e
f(6) = Q _ = r ll.
sin^cos^-
o( + 2o(sin2o(
All that remains at this point is to calculate the pressure dis
tribution by integrating the equilibrium equation (3).
0P C ii "2Q cos(26)
P(r,e) = I _ dr = il drJ}r J r2
r sin c* cos <*-
d + 2^sin2^
jHQ cos(2e)
p(r,e)= + B4(e)r^
sinc^cos^-pi + 2o<sisr0(
Differentiating this expression for pressure with respect to e and
equating to Equation (4) yields B^(e) = 0 or B4(e) = Br, a constant.
This constant is determined from the boundary condition in Equation
(7). Thus the complete solution to purely radial, creeping flow in a
converging channel is:
Q sin c^-
sin2e
u_.(r,e)= ( 10 )r
sin&cos**-
^ + 2oisrrpt
Uq= 0 ( 11 )
uQ (cos2e)(R?/r2) - 1
P(r,6)=Pi+
TT (12)
R| (sintfcostf-^ +2ttsinZQC)
Page 12
Recall that Q is negative for flow that is radially inward.
Now that an analytic expression for the pressure has been derived,
the average pressure drop /\P can be computed.
/j(R0,e)R0 de ^(R^ejRj de
f\ de f\ de
Ap = _______:,. .: .. ._ .
-
Thus, the final expression for the average pressure drop between
the entrance and exit of the nozzle is:
/^Q R
/\P =
5(-^
~ 1 ) sin(2o6) ( 13 )
2 R? o^ ( sin cd cos<*-<* + 2odsin2a_) rJ
Page 13
FINITE ET.FMENT FORMULATION
Problem Statement
The statement of the differential equations describing fluid flow
in rectangular coordinates is included in the appendix. The equations
are simplified substantially with the assumptions of steady, creeping
flow (ie. Stokes flow), negligible body forces, and a Newtonian,
incompressible fluid. The basic problem is to solve the equilibrium
equations and the continuity equation subjected to certain boundary
conditions, which can be specified surface tractions and/or specified
velocities. Here are the appropriate equations with the above assump
tions incorporated:
( 14 )A{ff __) + _!( a ( _ + _ ) ) -_
= o
Equilibrium ^x ^x by 2>Y ^x ^x
by by *>x ^y ^x by
bu <3V
Continuity + =0 ( 16 )
bx ^y
t-, = (-P + 2yW )n*i +^ ( + )n'j ( 17 )
Surface ^x ^y ^x
Tractions ^v >u -*v
t= (-P + 2a)n-j + U ( + )n-i^ rby
r
bY 1*
( 18 )
The domain of the solution and surface tractions are shown in
Figure 5. The surface tractions are developed by Reddy [12].
Page 14
V
<T*
dy
/
dl\<
dx \i
t,y-
i
ryx 1
Figure 5. Domain of Solution in Rectangular Coordinates
Extremization of the Functional
Numerous methods of solution are available for solving the Stoke 's
flow problem. The approach here will be to convert the basic problem
into a variational, penalty method form to which finite elements can
be conveniently applied. The advantages and disadvantages of this
particular approach are expounded upon later.
To recast the differential equations into a variational problem,
one must"guess
"the appropriate functional which, upon extremization,
yields the basic differential equations, (14) through (18).
To accomplish this, Zienkiewicz [13] proposed a functional of the
following form, where u.,=
, u^=
, etc.
3X bY
Page 15
rf i}u )t v i 3u >v
I(ux'VVx'V =jJAU()2
+ ()2
+ ( +)2
] dA
A ^x ^y 2 by 2*
-J (t^ u +
ty v) dl + -I J/ ( _ + _)2
dA ( 19 )C 2 A ^x ^y
The idea here is to modify a standard functional by adding the
continuity equation into the functional as a constraint in the least-
square sense. Gamma (6) is referred to as the penalty parameter, and
the larger the penalty parameter, the greater the constraint of the
continuity equation is enforced. The continuity equation can only be
enforced exactly when t-*vo. However, for most problems, all that
is required is ^~0( 10 ). More is mentioned later about the selection
of a suitable penalty parameter.
In general, a functional attains an extreme value when the Euler-
Lagrange equations are satisfied [14]. To verify that the proposed
functional is indeed the proper functional for this problem, the
Euler-Lagrange equations are used to extract the original differential
equations. For a functional of the form I ( u,v,ux,vl,,v ,v ) =JJ0 dA
where u=u(x,y), v=v(x,y), and 0 = 0(u,v,ux,Uy,vx,v ,x,y), the Euler-
Lagrange equations are [15]:
- A{ _ ) - A{ ) = o
^u ^x ^ dy ^Uy
-
-2-( ) - M ) = 0
dv ^x 2vx <5y vy
Applying these equations to the functional of Equation (19) one
Page 16
obtains two differential equations, rearranged in this useful form:
[{2a^) + y t_ ] + __L[/U_ +^ )] =0 ( 20 )^x <)x ^y dy by 3x
>. ^ v ^u v auAv
A[(2A+nd-+ )f -]+ i-[A<< + )] =0 ( 21 )
^y dy 3x ^x ^y ^x
A comparison of these two equations to the original equilibrium
equations (14) and (15) reveals that they are identical only if the
following relationship holds:
^u :yv
P = -#( + ) ( 22 )d-x. by
where P = 0 at its itu\nimum value.
The continuity equation (16) is almost perfectly satisfied when ft
is large, so the divergence of velocity, (ux + v ), will be very
small; and pressure can be post computed from Equation (22) once the
velocities are known. Thus, velocities are the primary unknowns, and
pressure is a secondary unknown.
What has been accomplished here is the transformation of the basic
three equations (14) through (16) into two new equations (20) and (21)
which include the penalty parameter %. This was accomplished by
extremizing the functional in Equation (19). However, once this step
is completed, one need not be concerned with the functional any fur
ther. The functional is merely a means to an end, the"end"
here
Page 17
being two new differential equations. From now on the concentration
will be on the readying of the two new differential equations (20) and
(21) for a finite element solution.
Variational Form of the Equations
At this point it is appropriate to modify the newly developed
differential equations into a variational form which will lend itself
to a finite element solution. The weighted residual method [16] will
be utilized to effect the variational form of the differential equa
tions.
Let the differential equation (20) be represented by L(u,v) =
f(x,y). If u is an approximation to u and v is an approximation to v,
one can expect the residual, R = L(u,v)-
f(x,y), to be approximately
zero. However, R can not actually be zero at every point in the
region unless u=u and v=v exactly. For most purposes, it suffices to
require that the approximate solution u and v render the residual R
approximately zero in some sense.
There are several ways of implementing this requirement. The
weighted residual method multiplies the residual by a weight function
IjJ ( x,y) and integrates this product over the region of interest. It is
then required that, for a specified weight function IjJ , the integral
is equal to zero. A note about the proper form of U will be made in
the next section, but for now, it is merely a continuous function of x
and y with continuous first derivatives.
The residual of Equation (20) is ( with f (x,y) = 0 ):
Page 18
R = L(u,v) - 0 =-fl-[(2yH +Y) _ + fr _ ] + ^.[^ (_ + !_ )]dx rjx y ^y <)y x
Imposing the condition thatjj UR dA = 0 results in:
JJ { ljJ-i-[(2^+S) _ + _]+;,, A[U( + ) ] }dA = 0
A'ax d* dY
l
3y;
?3y &x
Now it is desirable to integrate by parts to reduce the order of
the derivatives of u and v. The Green-Gauss Theorem in two dimensions
is the corresponding analogy to integration by parts in one dimension.
It states [17] that, for two functions F(x,y) and G(x,y) on the region
of integration as illustrated in Figure 5:
JJ F dA = - JJ G dA +J FG n'i dl
A ^x A^x C
| F dA =
-JJ G dA +J FG n'j dl
JJA }y A^y C
Applying the Green-Gauss Theorem to the integral of the weighted
residual one gets:
JJ{.Tl(2+^+x_!1-V- + ->>*
a ^x 3x by by 2>y ^x
/-\fl ^VZ1 Ml ^V
\a[(2iA + V ) + % ] n'i dl +JWyW(_ + ) n'j dl
= 0CT
3x }y C <)y ax
Utilizing the expression for the surface tractions in Equation
(17) and recalling the fact that P = - )f( ux+vy ), a useful varia
tional form of the differential equation is obtained:
Page 19
Jfa(2^n^+^]+^+^)}dA-/utxdl = 0 (23)a>>x
'Jx ay by by ax
cT^
A similar procedure can be applied to the second differential
equation in (21):
R = L(u,v)- 0 =-E-[/t/((_ + e_) ] +A[-$_Z+ (2W + K )_ ]
ax by ax ^y ax ay
Imposing the condition that JJ UR dA = 0 results in
CC SV dv 3U >U ya pyv /,
JJ i[(2L( + ^ )+)( ] +^IA( + ) } dA -
J Wt, dl= 0 ( 24 )
a^ ay ^x ^x 5y ^x c y
Thus the variational form of the parti al differentia] equations
has been secured. The application of finite elements immediately
follows.
Finite Element Equations
At this point the finite element approximation enters into the
solution. In finite elements, the region of interest is geometrically
divided up into a number of elements, each element containing a number
of nodes at which the approximate solution will be obtained. An
approximate solution on each element is suggested, with the under
standing that thisapproximation must satisfy the variational forms of
the differential equations obtained in the previous section. The
approximate solutions to u and v on element e are:
Page 20
n.e
ue= I Ipj(x,y)
Uj
?e
where ne is the number of nodes per element, and u^and
v^are the
approximate solutions at the nodal points, ultimately to be found.
The variational form in Equation (23) becomes the following, on
element e:
A_ ^x 3=1 l* 3=1 ^Y
for each i=l , 2 , . . . ,n_
Changing the order of sumnatians :
j=i A-, d x a x a y c y
tW^_it,-i-! , ax* , Vj-/y^ai . o
j-1V Jy !>x Jx Jyce'
for each i=l , 2 , . . . fne
Similarly, for the variationalform in Equation (24):
j=i a-/ ax ^y <^y^x
+ f^*^ 4- <Y+t^& ) dx ay ] Vj -/Yity
j=i a.r
ax ^x r3y ^y cej=i Ae
This represents a system of equations, and can conveniently be
for each i=l , 2 , . . . ,n.
Page 21
expressed in matrix form. The terms in the matrices [K11], [K12],
[K22], and vectors {F1} and {F2} are:
4J.jy(2/+,_-:_ftfc* + J,//__:_fiJx Jx
Ae ay ay
dx dy
Ag dy ^xAg ^x 3y
Ae^xax a-,'
ay^y
1-*
Fx=
itxdl
F2
=JV
^dl
Element
Equation:
[K1*]
[K12]T
[K12]
[K22]
{F1}
{F2}
\
V ( 25 )
JIt should be recalled that this system of equations applies only
to the particular element under consideration. One could continue
constructing stiffness matrices and load vectors for each and every
element in the finite element mesh. The element stiffness matrices
are then added (or assembled) to a global stiffness matrix in such a
way that the stiffness associated with each elemental node contributes
to the stiffness associated with each corresponding global node. Thus
one obtains a global system of equations in the form [K]{U}={F}, where
{U} represents the approximate solution at the nodal points,contain-
Page 22
ing both u^ and v^. Imposing the known essential boundary conditions
on {u} allows the solution of the system of equations for {U} [18].
The explicit form of the weight function W ( x,y) was not stated in
the previous section. Ideally, it would be continuous and smooth on
each element, capable of satisfying the boundary conditions, and allow
the calculation of a reasonably good approximation to the exact solu
tion. In addition, it should constitute a"complete"
set of functions
so a solution can be obtained which converges to the correct solution.
The shape functions Ij^, i=l,2,...ne on each element satisfy: ^= 0 at
node j ^ i or ^ x l at node j = i; j=l,2,...ne. A set of shape
functions from the Lagrange family are used in the computer program
STOKES, which is listed in the Appendix.
To recapitulate what has been done so far: the problem defined by
the system of differential equations (14) through (18) has been trans
formed into a matrix system of equations [K]{U} = {F}, where the
matrices are an assemblage of the element equations in (25). The
solution {U} of this system of equations will give an approximate
solution to the velocities at the nodes. The pressure can be post
computed from Equation (2 2) once the nodal velocities are determined.
Evaluation of the Integrals
In theory, the integralsdefined by Equations (25) can be evaluated
analytically once the shape functions IjJ are specified. However, this
is not the best way tointegrate on a computer, especially when the
elemental region of integration is irregularly shaped. A better
method involves a transformation from x,y coordinates to the set of
Page 23
master coordinates (f ,71), where the integration is carried out on a
simple square region. To be more precise, we desire to find the
transformation from (x,y) to ( < ,77 ) coordinates that will allow the
evaluation of the following three integrals on the domain illustrated
in Figure 6 (note that the function F is a generic function):
JjF{xry)dx^ , i/ _(x,y)dAx^ , and JJ (x,y)dAx^^xy
VX V*y
-1
+1
-1
-i
+1
f
Figure 6. Domain of Integrals and Coordinate Transformation
The coordinates x and y are transformed by a typical finite ele
ment approach utilizing the elemental shape functions IjJ and the geo
metric coordinates of the nodes.
n^
= I lfi(xfy) x
( 26 )
Bey= i Yi^y) y
Page 24
The partial derivatives are transformed into ( < ,V ) coordinates
through the Jacobian matrix [19]. Note that the hat (") is used to
reference a function in the ( f , * ) coordinates.
V^
= [J]s
^7
ax
aF
^y
where [J]=
ax ay
ax
Therefore,^B1aF
^F
2*
i= [jr1;ap >
V.n
)
}y
Li? *U
( 27 )
The Jacobian matrix [J] can be evaluated using the coordinate
transformations of Equation (2 6). Thus the Jacobian matrix looks like
this:
[J] =
Be* ft\ 7T
Xi1=1 *$
Ji ^x
i=i a?Yl
i=i a7Yl
( 28 )
The only remaining transformation concerns the incremental areas
dA and dA^ . Again the Jacobian matrix is useful for this purpose
[20]:
det [J] = Ijl ^dA
Page 25
( 29 )
n
At this point all transformations can be effected, and the inte
grals with which we started take on a new appearance:
1 />! -
JJ F(x,y) dA = J f f(^) | J| dff dr,
Av,, -1-1L
^
1 )F '
y-i -i
V
* jr |J| d| d^aF
7 c
As these expressions stand, they still look quite formidable.
However, Gauss-Legendre integration allows rapid evaluation of the
integrals in (^ ,^ ). The idea is to approximate the integral by
evaluating the function at several well-chosen quadrature points. In
two dimensions, Gauss-Legendre integration looks like this [21]:
i a1- MM.
:/_{F(H)d5d| ^ij F( ^i' h
M M
j=
where:
I is the integral to be evaluated on the square illustrated in
Figure 6.
W- is the" weight"
assigned to each quadrature point.
f ,Jare pre-determined points at which the function is to be
1
"'evaluated, also known as"Gauss points.
"
M is the degree of integration. The larger M is the more
accurate the approximation will be to the exact value of the
integral .
Page 26
The ease of implementation and numerical efficiency makes this
method of integration very attractive in finite element work. The
weight functions and Gauss points for several degrees of integration
are listed in the computer program STOKES in the appendix.
Choice of the Penalty Parameter
At the very heart of the penalty method formulation is the penalty
parameter y, which appears in the matrix equations (2 5). As discuss
ed in the previous section, the penalty parameter measures the extent
that the continuity equation is enforced. However, some attention
must be paid to its selection or a meaningless or trivial solution can
result.
"$"
must be sufficiently large to enforce the continuity equation.
Ideally, one would like o~*^. However, this is impractical since com
puter storage (i.e. word length) has limits. In fact, when the matrix
equations are expressed in a slightly different form, it reveals how
dangerously possible a trivial solution is.
If [K]{U} = {F} is the system of equations to be solved for the
velocities {U}, the stiffness matrix [K] can be broken up into viscous
terms and penalty parameter terms (see Equations (25)) [/<[K# ] +
Y[Kv] ] {U} = {F}. Thus, in dividing by * and taking the limit:
lam [ -L[K u] + [Kv ] {U} ] = lim -1{F}= {0}
Since lim [ -[K a] {U} ] = {0} one is faced with a trivial
y-*fl> * r
solution if the matrix [Ky
] is non-singular.
Page 27
To circumvent this, Zienkiewicz [22] suggested making [Kv] singu
lar so that it is singular for any finite # . This is accomplished by
using"
reduced integration"
on the terms in [K] which depend on the
penalty parameter. For instance, if nine Gauss points are used to
evaluate [K^ ], then four Gauss points are used to evaluate [K v ].
The stiffness integrals are intentionally miscalculated so that a
singular [Kx ] matrix results. In this way lim [_L[k]{U}] = {0} while
N*
{U} {0} [23].
It is apparent that this procedure enforces the continuity con
straint only at the reduced Gauss points. Thus one would expect that
( u"x+ v ) = 0 only at these reduced Gauss points, and that its
magnitude would be greater than zero elsewhere. This has two implica
tions: ( 1 ) that a mesh with sufficient element discretization must be
made to establish the continuity condition adequately over the entire
region; and (2) that only the reduced Gauss points should be used to
post compute the pressure by Equation (22) [24].
In practice, the value of *rj need only exceed the value of the
viscosity /A, by several orders of magnitude in order to dominate the
Equations (2 5). Hughes et al. [25] has suggested the following value
for Y:
JULxlO6
<^< JJLX1012
For most problems, y ~ 1 0 is sufficient. However, this magnitude
for the penalty parameter most assuredly requires double-precision
computer storage for almost all real variables, or else the [K^]
terms will be destroyed. This storage is very costly and time con-
Page 2 8
suming. This has prompted suggesting a possible variation utilizing
extrapolation which could relax the double-precision storage require
ment.
The method utilizes the concept of "extrapolation to zero "[2 6].
Typically, a problem is solved n times, each time using a different
penalty parameter 0^, i=l,2,...,n. The values of ^ are chosen in
increasing magnitude, but kept small enough so as not to annihilate
the [K u ] terms stored in single precision. For example, one could
choose t^ = 1q1' ^2 = lo2' ^n = lon- The idea ^ to extrapolate
to 0"OO. While this can not actually be done, one can extrapolate
->0 as illustrated in Figure 7. F is the generic parameter to be
estimated accurately; it could be velocity, pressure drop, stress,
etc. F^ is the extrapolated value of F which corresponds to o-*<>0.
F' i
Fl
F2"
3
F3"
F^> ^ L
1
0 h
h
'i
h1^y
Figure 7. Extrapolation of Penalty Parameter
Page 29
Thus, one estimates the parameter F with relatively small values
of ft using single precision storage. This kind of extrapolation is
commonplace and has been successful in estimating an almost exact
solution without the benefit of an infinite mesh discretization [27].
While this method has been verified to work for medium-sized
problems ( -0(400 equations) ), single precision storage produces
dominant truncation errors in solving an extremely large system of
equations [28]. In this case the problem becomes the subject of a
trade-off study among computer run cost, amount of available computer
storage, desired accuracy of solution, sophistication of the equation
solver, and so forth.
Mesh for the Finite Element Formulation
The geometry and boundary conditions for flow in a converging
channel are illustrated in Figure 8. The symmetry in the transverse
direction enables one to cut the problem size in half.
The essential boundary conditions are as specified. Notice that
no boundary conditions are specified at the right-most edge of the
exit region. This is a region of "free-flow", and the velocity there
is not pre-determined but is resolved from the finite element solu
tion. It is also a singular point of the solution.
The flow in the entrance region is assumed to be "fully developed
flow"[2 9], and as a consequence the velocity profile there is quad
ratic with respect to y. Hence, the velocity enters in to the region
as a specified boundary condition. If the entrance region is very
Page 30
u = a quadratic function of y'v = 0
ENTRANCE
REGION
CHANNEL REGION EXIT
REGION
Figure 8. Mesh for Converging Channel Flow
long, a uniform velocity distribution matures into fully developed
flow downstream [30]. But for the sake of reducing the mesh size, the
flow is considered to be fully developed at some ndnimal distance
upstream from the converging channel.
The mesh in the channel region is uniform and is concentrated the
most there. A fairly long exit length is required, not to recover
flow that is fully developed, but to pad the wave of error emanating
from the singularity at the right exit. More will be said about this
subsequently.
Page 31
RESULTS AND DISCUSSION
Sensitivity Analysis
The limits on computer run time and storage capabilities preclude
the possibility of using an infinite penalty parameter and infinitely
discretized mesh. And neither is it necessary to do so. The extrapo
lation method described previously allows one to estimate an accurate
solution based on a series of relatively inaccurate solutions. The
method is employed in this section to determine the sensitivity of the
solution on the mesh parameters. To reiterate: these parameters have
nothing to do with the theory and/or formulation of the problem. They
are merely consequences of the approximations induced by the finite
element mesh.
The basic parameters for the reference problem are listed in Table
1. The appropriate parameters are then varied to see how sensitive
the solution is to variations in their values. In these cases, the
average pressure drop across the converging channel, Ap, is consid
ered to be the appropriate solution parameter to check sensitivity.
Table 1. Nominal Values of Problem Parameters
Kind of Elements: 9 noded quadrilaterals
Dimensions of Converging Channel:
Length L = 16 (cm)
Exit Diameter H = 2 (cm)
Apex Half-Angle oL = 45 ( ]Volumetric Flow Rate Q = 1 (air/sec)
Viscosity Constant jtL= 1 (g/(an sec))
# of Elements in x-direction = 17
# of Elements in y-direction = 5
From the very geometry of the problem one would guess that the
Page 32
discretization in the x-direction would dwarf the importance of dis
cretization in the y-direction. Indeed, this turns out to be the
case. Table 2 demonstrates how Z\P varies for various mesh schemes in
the x-direction. The extrapolation used here is similar to that
illustrated in Figure 7.
Table 2. Mesh Variation in X-Direction
NUMBER OF ELEMENTS
IN X-DIRECTION
ELEMENT LENGTH
IN X-DIRECTION
2.6667
1.6000
1.0000
PRESSURE DROP
AP
11
17
26
1.2297
1.0410
0.9353
<*> ~0. 0.7585 (extrapolated)
Since the solution parameter is extremely sensitive to variations
in the x-direction mesh, extrapolation must always be used to procure
an accurate value of /\P.
The solution parameter A.p turns out to be fairly insensitive to
variations in the y^mesh, as illustrated in Table 3.
Table 3. Mesh Variation in Y-Direction
NUMBER OF ELEMENTS ELEMENT LENGTH PRESSURE DROP
IN Y-DIRECTION IN Y-DIRECTION AP
4 0.1963 1.0424
5 0.1571 1.0410
6 0.1309 1.0402
ffQ ~0. 1.0358 (extrapolated)
Page 33
Since the increased mesh size in the y-direction is extremely
costly and Z\P is fairly insensitive to these variations, it was
decided to use a mesh with 5 elements in the y-direction for all
subsequent computer runs, and tolerate the small error introduced in
this way.
As illustrated in Table 4, there is hardly any variation in AP
for large values of the penalty parameter ^ . Hence ^= 108was
chosen with double-precision storage as sufficient for all subsequent
computer runs.
Table 4. Variation of Penalty Parameter
PENALTY PARAMETER ( t ) PRESSURE DROP ( AP)
10^ 1.040810
1.0410109
1.0410
00 1.0410 (extrapolated)
Program Verification
STOKES was run with several model problems to test the overall
accuracy and code integrity.Two problems came from Reddy 's An Intro
duction to the Finite Element Method [31]. One problem involved fluid
squeezed between two parallel plates, and the other involved the
hydrodynamic slider bearing. In both cases, the output of STOKES
compares precisely with the author's stated results.
The program STOKES was also tested with a purely converging chan
nel problem with the excellent results. However, one trend is worth
noting: the singularity atthe exit causes a wave of error to propa-
Page 34
gate upstream with further mesh discretization. Thus, the similarity
between the finite element and analytical solutions becomes progres
sively worse as one proceeds downstream [32]. In fact, if the mesh is
too fine, the error can destroy the entire solution!
One avoids this issue when solving the converging channel problem
illustrated in Figure 8. In this case the exit region engulfs the
error wave, leaving the entrance and converging channel solutions
relatively unaffected.
Error Analysis
The entrance-converging channel-exit problem of Figure 2 was
solved for various angles {cC ) using two techniques. One involved the
analytical solution of purely converging flow, i.e. ue= 0. The
second solution was obtained from a penalty function finite element
analysis on the mesh in Figure 8 . Since the assumption that Mq= 0 is
obviously in error for large oi, the finite element solution is taken
to be the accepted solution to which the analytical solution is com
pared. At this point is should be reemphasized that the finite ele
ment solution is not the exact solution to the problem. It is used on
a comparison basis with the analytical solution, and the calculated
error is a relative comparison between the two solutions.
Table 5 and Figure 9 summarize the error involved in neglecting
the transverse velocity component. Equation ( 3 0 ) is used to compute
the error, where Apanal ^ the Pressure droP in Equation (13).
Apff i*3 t^ie difference between the mean pressure at the entrance and
Page 35
mean pressure at the exit of the converging channel evaluated by the
finite element program STOKES. The mean pressures are computed by
averaging the pressures at the adjacent Gauss points.
APanai-
A^% Error = x 100% ( 30 )
APFE
Table 5. Comparison of Finite Element and Analytical Solutions
AngleK )
Element
X-Length
*1A^nal APFE
ApFeiextrapolated
*4
% Error
*5
5
2.6667
1.6000
1.0000
7.0630
7.1196
7.0977
7.0896
7.0702 -0.10
15
2.6667
1.6000
1.0000
2.6444
2.8383
2.7689
2.7395
2.6769 -1.21
25
2.6667
1.6000
1.0000
1.5034
1.8411
1.7249
1.6700
1.5638 -3.86
35
2.6667
1.6000
1.0000
0.9605
1.4358
1.2791
1.1979
1.0528 -8.76
45
2.6667
1.6000
1.0000
0.6324
1.2297
1.0410
0.9353
0.7585 -16.62
*1 Table 2
*2 Equation (13)
*3 Computer run of STOKES for problem in Figure 8
*4 Table 1
*5 Equation (30)
Faf-e 36
!-l
OU
c0)
os-l
30"
28-
26-
24.
22.
20-
15-
16-
14-
12-
'ZcL
1
r
5 10 15 20 25 30 35 40 50 55 ou
HALF -APEX ANGLE OF CONVERGING CHANNEL <# )
Figure 9. Error in Neglecting Transverse Velocity
Page 3 7
CONCLUSIONS
The pressure drop across a converging channel has been evaluated
in two ways: (1) analytically using the assumption of purely radial
flow; and (2) using the finite element program STOKES, modelling the
converging channel with entrance and exit regions. The comparison
between solutions indicates that the purely radial flow assumption is
quite valid for small apex angles, but is inappropriate for larger
angles .
The penalty function finite element formulation has been verified
to be a useful tool in solving Stokes fluid flow problems. By elimi
nating pressure terms from the stiffness matrix, the size of the
resulting system of equations is minimal. The boundary conditions are
easily implemented. Attention must be paid to the value of the penal
ty parameter and the mesh discretization employed, since changes in
these can cause the solution to vary considerably. Extrapolation
schemes are useful in aiming for the exact solution.
In using the penalty function finite element method, considerable
error is introduced at a free surface. To compensate for this, one
must keep the free surface far enough away from the region of interest
so as to leave it quite unaffected.
As with any finite element analysis, caution should be excercised
in using theseresults for design purposes. Being a numerical method,
it does not give an exact solution. Its real practicality lies in its
ability to guide experimental procedures for complex problems. Any
finite element analysis should be followed up by a good test program.
Page 38
REFERENCES
[1] Morton M. Denn, Process Fluid Mechanics (Englewcod Cliffs, N.J.:
Prentice-Hall, 1980), p. 211.
[ 2 ] StanleyMiddleman, Fundamentals of Polymer Processing ( NewYork:
McGraw-Hill, 1977), p. 264.
[3] G. K. Batchelor, An Introduction to Fluid Dynamics (New York:
Cambridge University, 1 9 6 7 ), pp. 2 1 7-2 1 9, 2 9 4-3 0 2 .
[4] Denn, chapter 10.
[5] 0. C. Zienkiewicz & Y. K. Cheung, "Finite Elements in the Solu
tion of Field Problems"
, The Engineer (1965), pp. 507-510.
[6] 0. C. Zienkiewicz, et al., editors, Finite Elements in Fluids,vol. 5 (New York: Wiley, 1984), pp. 1-5.
[7] J. N. Reddy, An Introduction to the Finite Element Method (New
York: McGraw-Hill, 1984), pp. 281-28 3.
[8] C. Taylor and P. Hood, "A Numerical Solution of the Navier-
Stokes Equations Using the Finite Element Technique"
, Computers
& Fluids (London: Pergamon, 1973), pp. 81-85.
[9] ,An Introduction to the Finite Element Method, pp. 283-292,358-374.
[10] T. R. Hughes, W. K. Liu, A. Brooks, "Review of Finite Element
Analysis of Incompressible Viscous Flows by the Penalty FunctionFormulation,"
Journal of Computational Physics (1979), vol. 30,
no. 1, pp. 1-60.
[11] J. D. Paliouras, Complex Variables for Scientists and Engineers
(New York: Macmillan, 1975), p. 82.
[12] , An Introduction to the Finite Element Method, pp. 267,
281.
[13] 0. C. Zienkiewicz & P. N. Godpole, "Viscous, Incompressible Flow
with Special Reference to Non-Newtonian ( Plastic) Fluids"
, Fi
nite Elements in Fluids, vol. 1 (New York: Wiley, 1978), p. 37.
[14] J.N.Reddv.Energy and Variational Methods in Applied Mechanics
(New York: Wiley, 1984), p. 108.
[15] I. M. Gelfand & S. V. Fomin, Calculus of Variations (Englewood
Cliffs, N.J.: Prentice-Hall, 1963), p. 181.
Page 39
t16] ,Energy and Variational Methods in Applied Mechanics,p.212.
~ " ^
[17] S. S. Rao, The Finite Element Method in Engineering (New York:
Pergamon, 1982), pp. 618, 619.
[18J , An Introduction to the Finite Element Method, pp. 66-79.
[19] H. F. Davis & A. D. Snider, Introduction to Vector Analysis, 4thed. (Boston: Allyn and Bacon, 1979), p. 266.
[20] Ibid, p. 271.
[21] R. L. Burden, J. D. Faires, A. C. Reynolds, Numerical Analysis,2nd ed. (Boston: Prindle, Weber & Schmidt, 1981), pp. 167-170.
[22] 0. C. Zienkiewicz, The Finite Element Method, 3rd. ed. (London:
McGraw-Hill, 1977), pp. 287-2 94.
[23] , An Introduction to the Finite Element Method, p. 284.
[24] Ibid., p. 285.
[25] T. R. Hughes, et al., pp. 13,18.
[26] , The Finite Element Method, pp. 34-35.
[27] Ibid.
[28] R. L. Burden, et al., pp. 398-402.
[ 29 ] Robert Fox &Alan McDonald, Introduction to Fluid Mechanics ( New
York: Wiley, 1978), p. 330.
[30] Denn, p. 211.
[31] , An Introduction to the Finite Element Method, pp. 35 8-
367.
[32] Graham F. Carey & J. Tinsley Oden, Finite Elements, vol. 3
(Englewood Cliffs, N. J.: Prentice-Hall, 1984) pp. 37-4 0.
Page 4 0
APPENDIX A. EQUATIONS GOVERNING FLUID MOTION
The governing equations describing fluid flow are presented here
in an effort to provide a complete document. All of the equations are
taken from Principles of Polymer Processing, Tadmor and Gogos (New
York: Wiley, 1979), pages 108 and 118.
Continuity Equation
The continuity equation expresses the concept that the flow field
is a continuous function with no holes or gaps in the solution. That
is, at every point in the flow field no mass is created or destroyed;
it is merely transported from one region to another.
RECTANGULAR COORDINATES (x,y,z):
_^-+_(/>u) +-i-(pv) +-i-(/)w) = 0 (A.l)
dt d* I &Y ' bz '
CYLINDRICAL COORDINATES (r ,0 , z ) :
^. + __^.(prur) +-(DUq) +-^-(pu_) = 0 (A.2)
dt r dr I r^e ' d* '
Navier-Stokes Equation
This equation is the marriage of two somewhat independent con
cepts: ( 1) the conservation of momentum, usually expressed in terms of
a force balance among the stresses; and (2) that there exists a rela
tionship between fluid stresses and velocities involving certain mate
rial constants.
Page 41
RECTANGULAR COORDINATES (x,y,z):
du du bu bu b? ^2u A A0( +u + v_ +w ) = -
_ + U ( +0
+0
j + (A>3)' &t dx y Jz ^x
^ ^x2 by2 *z2 I
^v ^v ^v &p fr & \*
p(_ +u + v- +w ) = -
_ + y< +6
+ ) +p g*t ^x y ^z aY
d*2
V^z2 '
(A. 4)
>w >w :*w "?iw 7)? ?fa & "&
9{L + xL + j_ + ^)=-__+A(i^
+ 1^ + 1.) + /)gz (A.5)
^t $x }y ^z ^z^x2 ly2 ?z2 f
CYLINDRICAL COORDINATES (r,6,z):
f^t dr r ^0 br dz (A.6)
^P, . r
a,1
a, t
xa2%
2 ape a2ur
^
+ in[(-(nv)) + i^__-_^_ + __ ] +/)g^rr^r
^r2
^62 r2 2e 2
z2 '
+ U^+ + + U_. )
d t dr r ^6 r ^z (A-7)
r^eA^r r )r
r2 de2 r2 be hz2 \
duz ^uz "6 duzu ^Uz,
p(^_ + u- + + uz-
I t 3r r ^6 5 z (A.8)
Jz^
r^r 3rr2 ^62 ^z2
"
Page 42
APPENDIX B. FINITE ELEMENT PROGRAM STOKES
STOKES is a general purpose penalty function finite element prog
ram to solve two dimensional Stokes fluid flow. It is sufficiently
general as it allows complex geometries and boundary conditions. The
program is written completely in modular form, as extensive use is
made of subroutines and structured programming. Brief comments are
provided inside the program to aid the reader's perception of what is
taking place. The flow of STOKES is similar to Reddy [ref. 9], while
the variable names and subroutine structure follow Carey & Oden [ ref.
32, vol. 1 ].
To take advantage of the similar geometries involved in solving
converging flow problems, several mesh generation schemes are in
cluded. The description of the data input and program structure are
provided in the next few pages.
Flow Diagram of Computer Program STOKES
NOTE: All subroutines return to their calling program once completed.
Flow of main program:
Page 4 3
Flow of subroutines:
PREP-MESHGEN
PROC -SHAPE JACOBI
POST
-SHAPE 'JACOBI
PERROR
Description of COMMON Block Variables
vXMMDN/CCON/
TITLE
NNODE
NELEM
NBC
NPT
Control parameters
Problem title
Total number of nodes
Total number of elements
Number of essential boundary conditions
Number of point loads
CCMMON/CNODE/
GX( )
GY( )
Global node data
X-coordinates of nodes
Y-coordinates of nodes
Page 44
CX3MM0N/CELEM/KHJD( )
NODES( , )
FX
FY
CQMMON/CMATRX/HBAND
GU( )
GK( , )
GF( )
EK( , )
EF( )
CQMMON/CMAT/MU
GAMMA
COMMON/CINT/NINT
XIQ( , )
WT( , )
CCMMON/CBC/
NCDEBC( )
DIRBC( )
VALBC( )
CCMMON/CPT/
NODEPT( )
DIRPT( )
VALPT( )
COMMON/CPRINr/
PRT( )
CCMMON/CALT/
ALT
L
H
Q
ALPHA
EX
EY
Element data
Number of nodes per element
Connectivity matrix between element and
global nodes
Body force in X direction
Body force in Y direction
Matrices
Half bandwidth of global stiffness matrix
Solution vector containing velocitiesGlobal stiffness matrix (half band form)Global load vector
Element stiffness matrix
Element load vector
Material parameters
Viscosity coefficient
Penalty parameter
Gauss integration parameters
Order of integration
Location of Gauss points
Integration weights
Essential boundary condition data
Global node of boundary condition
Direction of boundary condition
Magnitude of boundary condition
Point load data
Global node of point load
Direction of point load
Magnitude of point load
Printout control parameters
Printer control parameters
Specific problem description parameters
Signifies which error routine to use
Length of nozzle
Half-height of nozzle exit
Volumetric flow rate
Half angle of nozzle
Number of elements in X direction
Number of elements in Y direction
STOKES Data Input
Page 4 5
DATA CARDS
TITLE
PRT(1),PRT(2),...,PRT(10)
DESCRIPTION
NNODE,NELEM,NBC,NPT,MESH,KIND( 1 )
MU,GAMMA
Problem description, 80 characters
Printer controlparameters (1=Y,0=N)
l=print element stiffness matrix [EK]2=start at elem
3=end at elem
4=print global stiffness matrix [GK] ;
5=start at equation
6=end at equation
7^?rint problem data?
8=print nodal solution (velocities)?
Control parameters:
NNODE=number of global nodes
NELEM=number of elements
NBC==number of specified BC's
NPT=3iumber of specified forces
MESH=^nesh generation parameter:
0=no mesh generation
l=mesh generation for radial flow in
Nozzle with 4-node quadrilaterals
2=mesh generation for radial flow in
Nozzle with 9-node quadrilaterals
3=mesh generation for Nozzle/Pipe
with 9-node quadrilaterals
KIND=degree of quadrilateral
4=four node bilinear quadrilateral
8=eight node"serendipity"
quad.
9=^iine node isoparametric quad.
Material parameters:
MU=viscosity constant
GAMMA=penalty parameter; note that
GAMMA=MU*1.E8, approximately
WITHOUT MESH OTJERATCON
GX(1),GY(1)
GX(2),GY(2)
GX(NNODE) ,GY(NNODE)
FX,FY
Gecmetric coordinates of global nodes
Body forces, assumed uniform
Page 46
N0DES(1,1) ,N0DES(1,2) .. .
N0DES(2,1) ,NODES(2,2) . . .
NODES (NELEM, 1 ) ,NODES (NELEM, 2 ) . ,
NODES (ELEM, . . . )=Connectivity matrix
containing global nodes of element
NODEBC ( 1 ) ,DLRBC ( 1 ) ,VALBC ( 1 )
NODEBC(2) ,DIRBC(2) ,VALBC(2)
NODEBOglobal node of B.C.
DIRBC=direction of action of B.C.
1=X direction
NQDEEC(NBC),DIRBC(NBC),VALBC(NBC) 2=Y direction
.VAIiBC=nagnitude of B.C.
WITH MESH GENERATION
EX ,EY ,ALT ,L ,H ,Q ,ALPHA
FX,FY
Specific problem parameters:
EX==number of elements in X-direction
Note that EX=11,14,17, . . .when MESH=3
EY=number of elements in Y-direction
ALT indicates if known solution exists
0=solution is unknown
l=solution for radial flow in nozzle
2=solution for flow in nozzle/pipe
I>length of nozzle
H=height of nozzle exit
Q=volumetric flow rate
ALPHA=half-angle of channel, in deg.
Body forces, assumed uniform
NODEPT ( 1 ) ,DIRPT ( 1 ) ,VALPT ( 1 )
NODEPT ( 2 ) ,DIRPT ( 2 ) ,VALPT ( 2 )
NODEPT(NPT) ,DIRPT(NPT) ,VALPT(NPT)
-999
NODEPT=global node of point load
DIRPT=direction of action of load
1=X direction
2=Y direction
Signifies the end to the data
NOTES:
1. Any problem can be input by knowing nodal coordinates, connectiv
ity matrix, etc. by using MESH=0 in data deck. However, to take
advantage of symmetry and known solutions for large problems,
mesh generation and error routines should be utilized. The main
program must be modified in the case of general problems for
MESHGEN and PERROR subroutines. However, as the program stands
there are three different mesh generators to cover the Nozzle and
Nozzle/Pipe problems. Specifying ALT=1,2,... calls the error
subroutine PERROR.
2. The input data is completely free-format. However, some input
variables sit on the same line, as indicated in the left-hand
column above.
PROGRAM STOKES
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA* PROGRAM STOKES K. HONKALA JAN '85
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
C FINITE ELEMENT PROGRAM TO SOLVE 2-DIM STOKES FLUID FLOW. ISOPARAMETRIC
C RECTANGULAR ELEMENTS ARE USED.
CHARACTER*80 TITLE
INTEGER NNODE, NELEM,KIND,NODES,NINT,NBC,NODEBCDIRBC,EX,EY,+ NODEPT,DIRPT,NPT,HBAND,PRT,ALTREAL*B GX,GY,GK,GF,GU,EK,EF,MU, GAMMA,XIQ,WT,FX,FY,VALBCVALPT,
+ L,H,Q,ALPHA
COMMON /CCON/TITLE ,NNODE , NELEM , NBC ,NPT
COMMON/CNODE/GX( 700 ) ,GY( 700 )
COMMON/CELEM/KIND(400),NODES(400,9),FX,FYCOMMON/CMATRX/HBAND,GU(1400) ,GK(1400,90) ,GFU400) ,EK( 18,18) ,EF(18)
COMMON/CMAT/MU, GAMMA
C0MM0N/CINT/NINT,XIQ(5,5) ,WT(5,5)
COMMON/CBC/NODEBC(200),DIRBC(200),VALBC(200)
COMMON /CPT/NODEPT( 50 ) ,DIRPT( 50 ) ,VALPT( 50 )
COMMON /CPR INT/PRT (10)
COMMON/CALT/ALT,L,H,Q,ALPHA,EX,EY
C
C CONSTRUCT FINITE ELEMENT MESHGEOMETRY ONLY
C NOTE THAT *PREP* CALLS SUBS RDATA,MESHGEN,PDATA,SETINT
CALL PREP
C COMPUTE ELEMENT MATRICES AND SOLVE EQUATIONS
C NOTE THAT *PROC* CALLS SUBS ELEMENT, SHAPE, JACOBI,ASSEMB,APLYBC,GAUSSEL
CALL PROC
G POSTPROCESS TO OUTPUT RESULTS
C NOTE THAT *POST* CALLS SUBS PNODE,PELEM, SHAPE, JACOBI,PERROR
CALL POST
C
ENDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SUBROUTINE PREPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:
C PREPROCCESSOR SUBPROGRAM WHICH CALLS INPUT/DATA SUBROUTINES
INTEGER TEST
C
C READ IN DATA FOR PROBLEM DESCRIPTION:
CALL RDATA
C
C TEST TO INSURE ALL THE DATA HAS BEEN ENTERED:
READ(5,*) TEST
IF (TEST .NE. -999) THEN
WRITE(6,*>'
ERROR IN DATAINPUT'
STOP
END IF
C
C OUTPUT DATA FOR PROBLEM DESCRIPTION:
CALL PDATA
C
C SET POINTS AND WEIGHTS FOR GAUSS INTEGRATION:
CALL SETINT
C
RETURN
END
aa^AAAAAAAAAAAAAAAAAA************************************************************
SUBROUTINE RDATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
C INPUT DATA FOR PROBLEM DESCRIPTIONCHARACTER*80 TITLE
INTEGER NNODE,NELEM,KIND,NODES,NBC,NODEBCDIRBC,NODEPT,DIRPT,+ NPT,PRT,NODE,ELEM, BC,POINT,MESHREAL*8 GX,GY,MU,GAMMA,FX,FY,VALBCVALPT
COMMON/CCON/TITLE,NNODE,NELEM,NBC,NPTCOMMON /CNODE/GX( 700 ) ,GY( 700 )
COMMON/CELEM/KIND( 400 ) ,NODES (400,9) ,FX,FYCOMMON /CMAT /MU , GAMMA
COMMON/CBC/NODEBC<200) ,DIRBC(200) ,VALBC(200)COMMON/CPT/NODEPT(50),DIRPT(50) ,VALPT(50)COMMON /CPRINT/PRT (10)
C PRT(I)=PRINTER CONTROL PARAMETERS: I=1:ELEMENT PRINTOUT (1Y,0=N> 2:STARTC AT ELEMENT # 3:END AT ELEMENT # 4.-GL0BAL PRINTOUT (1=Y,0=N) 5:START
C AT EQUATION # 6:END AT EQUATION # 7 .-PRINT OUT DATA (1=Y,0=N)
C 8:VELOCITY SOLUTION PRINTOUT (1=Y,0=N)C
C READ IN CONTROL AND PRINT OUT PARAMETERS:
READ(5,20) TITLE
20 FORMAT(A80)READ(5,*) (PRT(I),I=1,10)
READ(5,*) NNODE,NELEM,NBC,NPT,MESH,KIND(l)READ(5,*) MU,GAMMA
C
IF (MESH .EQ. 0) THEN
C INPUT GLOBAL GEOMETRIC COORDINATES OF GLOBAL NODES:
DO N0DE=1,NNODE
READ(5,*> GX ( NODE ),GY(NODE)
END DO
C INPUT ELEMENT DATA:
READ(5,*) FX,FY
DO ELEM=1,NELEM
KIND(ELEM)=KIND(1)
READ(5,*) (NODES (ELEM,NODE) ,N0DE=1,KIND(ELEM) )
END DO
C INPUT ESSENTIAL BOUNDARY CONDITIONS:
DO BC=1,NBC
READ(5,*) NODEBC(BC),DIRBC(BC),VALBC(BC)
END DO
ELSE
IF (MESH .EQ. 1) CALL MESH4
IF (MESH .EQ. 2) CALL MESH9
IF (MESH .EQ. 3) CALL MESHNOZ
END IF
C
C INPUT POINT LOADS:
DO POINT=l,NPT
READ! 5,*) NODEPT(POINT),DIRPT(POINT),VALPT(POINT)
END DO
C
RETURN
ENDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SUBROUTINE PDATA
AAAAAAAAAAAAAAAA AA*************************************** ************************
C OUTPUT DATA OF PROBLEM DESCRIPTION
CHARACTER* 80 TITLE
INTEGER NNODE,NELEM,KIND,NODES,NBC,NODEBCDIRBC,NODEPT,DIRPT,
+NPT,NODE,ELEM,BC,POINT,PRT,POS
REAL*B GX,GY,MU,GAMMA,FX,FY,VALBC,VALPT
COMMON/CCON/TITLE, NNODE,NELEM,NBC,NPTCOMMON /CNODE/GX( 700 ) ,GY( 700 )
COMMON/CELEM/KIND(400) ,NODES(400,9) ,FX,FYCOMMON /CMAT/MU , GAMMA
COMMON /CBC/NODEBC ( 200 ) ,DIRBC ( 200 ) ,VALBC ( 200 )
COMMON/CPT/NODEPT( 50 ) ,DIRPT( 50 ) ,VALPT( 50 )
COMMON/CPRINT/PRT( 10 )
C
WRITE(6,*) ( -A************** PROGRAM STOKES TO SOLVE 2-DIM
+STOKES FLOW aaaa**aaaaaaaaa)
WRITE(6,10)
10 F0RMAT('0'
,'********** CONTROL PARAMETER OUTPUT **********)
WRITE(6,20)TITLE
20 FORMATCO', 'TITLE: *,A70)
WRITE(6,*)'
TOTAL NUMBER OF NODES IN MESH'
,NNODEWRITE(6,*)'
TOTAL NUMBER OF ELEMENTS IN MESH'
,NELEMWRITE(6,*)'
NUMBER OF SPECIFIED B.C.S'
,NBC
WRITE(6,*)'
NUMBER OF SPECIFIED BOUND. FORCES'
,NPT
WRITE<6,*)'
VISCOSITY CONSTANT (MU)'
,MU
WRITE(6,*)'
PENALTY PARAMETER ',GAMMA
C
IF (PRT(7) .EQ. 0) RETURN
WRITE(6,25)
25 FORMATCO','********** NODAL DATA OUTPUT aaaaaaaaaa')
WRITE(6,2B)
28 FORMAT ('
0'
, 2 (*
NODE X-COOR Y-COOR'
) )
DO N0DE=l,(NN0DE+l)/2
POS=NODE+(NNODE+l ) /2
WRITE(6,30)N0DE,GX(N0DE) ,GY(NODE) ,POS,GX(POS) ,GY(POS)
30 F0RMAT(1X,2(I4,4X,E12.5,4X,E12.5,7X))
END DO
C
WRITE(6,80)
80 FORMAT*'0',**********ELEMENT DATA OUTPUT **********')
WRITE(6,82) FX,FY
82 FORMATt'0'
, 'BODY FORCES FX,FY:'
,2(4X,E12.5) )
WRITE(6,85)
85 FORMAT('0'
, 'ELEMENT GLOBAL NODES'
)
DO ELEM=1,NELEM
WRITE(6,90) ELEM, (NODES(ELEM,NODE) ,N0DE=1,KIND(ELEM) )
90F0RMAT(1X,I4,8X,<KIND(ELEM)XI3,'
'))
END DO
C
WRITE(6 100)
100 FORMATt'0','**********BOUNDARY CONDITION DATA **********)
WRITE(6,110)
110 F0RMAT('0',2C NODE DIRECTION VALUE *))
DO BC=l,(NBC+l)/2
POS=BC+(NBC+l)/2
WRITE(6,120) NODEBC(BC) ,DIRBC(BC) ,VALBC(BC) ,NODEBC(POS) ,
+ DIRBC ( POS ) ,VALBC ( POS )
120 F0RMAT(1X,2(I4,5X,I2,5X,E12.5,12X))
END DO
C
RETURN
ENDAA*AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*AAAAAAAAAAAAAAAAAAA
SUBROUTINE SETINT
AAAAA****************************AA*A****''t,','''A'''',t'''''','''''******,',**''tA******''''''***A*******
C SETS VALUES OF THE INTEGRATION PARAMETERS USED IN GAUSSIAN INTEGRATION
INTEGER NINT
REAL*8 XIQ,WT
C0MM0N/CINT/NINT,XIQ(5,5),WT(5,5)C ONE POINT QUADRATURE
XIQ(1,1)=0.0
WT(1,1)=2.0
C TWO POINT QUADRATURE
XIQ(2,1)=-1.0/SQRT(3.0)
XIQ(2,2)=-XIQ(2,1)
WT(2,1)=1.0
WT(2,2)=WT(2,1)
C THREE POINT QUADRATURE
XIQO,1)=-SQRT<3.0/5.0)XIQ(3,2)=0.0
XIQO,3)=-XIQO,l)
WTO, 1)=5. 0/9.0
WTO, 2)=8. 0/9.0
WT(3,3)=WT(3,1)
C
RETURN
ENDA*****AA*******AAAA****A****AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAii
SUBROUTINE MESH4AAAAAAAAAAAAAAAAAAAAAAAAA********************************************************
C GENERATE A MESH OF 4-NODED ELEMENTS. MESH IS GENERATED ON A POLAR
C REGION.
INTEGER KIND,NODES,NODEBCDIRBC,NX,NY, I,J,K,NODE,TOP,B0T,ALT
REAL*8 FX,FY,GX,GY,VALBC,L,H,Q,ALPHA,RO,THETA,XA,YA,XB,YB,VAV+ A,B,DELA,DELB,AREA,X,F
COMMON/CELEM/KIND(400) ,NODES(400,9) ,FX,FY
COMMON/CNODE/GX(700),GY(700)
COMMON/CBC/NODEBC(200),DIRBC(200),VALBC(200)
COMMON/CALT/ALT,L,H,Q,ALPHA
F(X)=(l.-(X/ALPHA)**2)*3.*VAV/2.
C
C GENERATE GEOMETRIC COORDINATES OF GLOBAL NODES:
READ(5,*) NX,NY,ALT,L,H,Q,ALPHA
ALPHA=ALPHA*3. 141592654/180.
RO=H/SIN(ALPHA)
DO J=1,NY+1THETA^ALPHA* ( 1 .
* ( J-l ) /NY )
XA=(L+R0)*(l.-COS(THETA) )
YA= ( L+RO ) *SIN ( THETA )
XB=(L+R0)-R0*COS( THETA)
YB=R0*S IN (THETA)
K=0
DO I=J,NX*(NY+1)+J,NY+1
GX( I ) =XA+ (XB-XA) * ( 1 . *K/NX)
GY(I)=YA+(YB-YA)*(1.*K/NX)
K=K+1
END DO
END DO
C
C GENERATE A MESH OF ELEMENTS AND CONNECTIVITY MATRIX:
READ(5,*) FX,FY
DO J=1,NX
T0P=J*(NY+1)+1
BOT=(J-D*(NY+l)+l
DO I=0,NY-1
ELEM=(J-D*NY+I+1
NODES ( ELEM , 1 ) =BOT+I
NODES ( ELEM , 2 ) =TOP+INODES ( ELEM , 3 ) =TOP+I+l
NODES ( ELEM , 4 ) =BOT+I+l
KIND(ELEM)=4
END DO
END DO
C
C SET BOUNDARY CONDITIONS ON ENTRANCE SIDE ACCORDING TO A PARABOLICC RADIAL VELOCITY DISTRIBUTION:
VAV=Q / ( (L+RO ) * 2 . *ALPHA )
A=0.
B=ALPHA*(1./NY)AREA=(B-A-(B*A3 + A**3) / (3.XAT.PHA**2) )*3.*VAV/2.
NODEBC(l)=l
DIRBC(1)=1
VALBC ( 1 ) =F (A ) +DELA
NODEBC(2)=l
DIRBC(2)=2
VALBC(2)=0.
DO J=1,NYTHETA=ALPHA* ( 1 .
*J/NY )
A=ALPHA* ( 1 .* ( J-l ) /NY )
AREA=((B-A) - (B**3 - A**3) /(3.*ALPHA**2) )*3.*VAV/2.
DELB=2*AREA/(B-A) -(F(A) + F(B)) - DELA
NODEBC(2*J+l)=J+l
DIRBC(2*J+1)=1
VALBC ( 2*J+l ) = ( F( B ) +DELB ) *COS ( THETA )
N0DEBC(2*J+2)=J+1
DIRBC(2*J+2)=2
VALBC ( 2*J+2 )-(F ( B ) +DELB ) *S IN ( THETA )
DELA=DELB
END DO
VALBC (2*NY+1)=0.
VALBC(2*NY+2)=0.
N0DE=NY+2
DO J=2,NX+1
BC=2*(NY+1) - 1 + J
NODEBC(BC)=NODE
DIRBC(BC)=2
VALBC (BC)=0.
NODE=NODE+NY+l
END DO
BC=2*(NY+1) + NX + 1
N0DE=2* ( NY+1 )
DO J=1,NX
NODEBC(BC)=NODE
NODEBC ( BC+1 ) =NODE
DIRBC(BC)=1
DIRBC(BC+1)=2
VALBC(BC)=0.
VALBC(BC)=0.
BC=BC+2
N0DE=N0DE+NY+1
END DO
C
RETURN
END
A*AA*AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAr
SUBROUTINE MESH9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*
C GENERATE A MESH OF 9-NODED ELEMENTS. MESH IS GENERATED ON A POLAR
C REGION.
INTEGER KIND,NODES,NODEBC,DIRBC,EX,EY,NX,NY,I,J,NODE,BC,ALT
REAL*8 FX,FY,GX,GY,VALBC,L,H,Q,ALPHA,R0,THETA,XA,YA,XB,YB,X,
+ F, CONST
COMMON /CELEM/KIND( 400 ) ,NODES (400,9 ) ,FX,FY
C0MM0N/CN0DE/GX(700),GY(700)
COMMON/ CBC /NODEBC (2 00 ),DIRBC( 200),VALBC (200)
COMMON/CALT/ALT,L ,H,Q ,ALPHA
F(X)=(l.-(SIN(X)/SIN(ALPHA))**2)*Q*SIN(ALPHA)**2./((L+R0)*CONST)
C
C GENERATE GEOMETRIC COORDINATES OF GLOBAL NODES:
READ(5,*) EX,EY,ALT,L,H,Q,ALPHA
NX=2*EX+1
NY=2*EY+1
ALPHA=ALPHA*3. 141592654/180.
R0=H/SIN(ALPHA)
CONST=SIN(ALPHA)*COS(ALPHA) - ALPHA + 2*ALPHA*SIN(ALPHA)**2.
DO J=0,NY-1THETA=ALPHA* ( 1 .
*J / ( NY-1 ) )
XA= ( L+RO )*( 1 . -COS (THETA ) )
YA= ( L+RO ) *SIN ( THETA )
XB= (L+RO ) -R0*COS (THETA)
YB=R0*SIN( THETA)
DO I=0,NX-1GX(J+1+I*NY)=XA+(XB-XA)*(1.*I/(NX-1)>
GY(J+1+I*NY)=YA+(YB-YA)*(1.*I/(NX-D)
END DO
END DO
C
C GENERATE A MESH OF ELEMENTS AND CONNECTIVITY MATRIX:
READ(5,*> FX,FY
DO 1=1,EX
DO J=1,EY
ELEM=(I-1)*EY + J
N0DE=(I-D*(2*NY) + 1 + 2*(J-1)
NODES ( ELEM , 1 ) =N0DE
NODES (ELEM, 2 )=N0DE
NODES ( ELEM , 3 ) =N0DE
NODES ( ELEM, 4 ) =N0DE
NODES (ELEM, 5 )=N0DE
NODES ( ELEM , 6 ) =N0DE
NODES ( ELEM , 7 ) =N0DE
NODES ( ELEM, 8 )=N0DE
NODES ( ELEM , 9 ) =N0DE
KIND (ELEM)* 9
END DO
END DO
r pttt BOUNDARY CONDITIONS ON ENTRANCE SIDE ACCORDING TO A PARABOLIC
C RADIAL VELOCITY DISTRIBUTION:
BC=1
DO J=0,NY-1
THETA=ALPHA* ( 1 . *J/ (NY-1 ) )
NODEBC (BC)=J+1
DIRBC(BC)=1
VALBC ( BC ) -F (THETA ) *COS ( THETA )
+ 2*NY
+ 2*NY +
+ 2
+ NY
+ 2*NY +
+ NY + 2
+ 1
+ NY + 1
NODEBC ( BC+1 ) *J+l
DIRBC(BC+1)=2VALBC ( BC+1 )= -F ( THETA ) *S IN ( THETA )
BC=BC+2END DO
DO J=2,NX
NODEBC ( BC )=( J - 1 ) *NY+1
DIRBC(BC)=2
VALBC(BC)=0.
BC=BC+1
END DO
DO J=2,NX
NODEBC (BC)=J*NY
NODEBC ( BC+1 )=J*NY
DIRBC(BC)=1
DIRBC(BC+1)=2
VALBC(BC)=0.
VALBC ( BC+1 )*0.
BC=BC+2
END DO
C
RETURN
ENDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAr
SUBROUTINE MESHN02 *
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAr
C GENERATE A MESH OF 9-NODED ELEMENTS. MESH IS GENERATED ON A POLAR
C REGION. EX=11,14,17,20,... ONLY.
INTEGER KIND,NODES,NODEBC,DIRBC,EX,EY,NX,NY,I,J,NODE,MESH,+ BC,ALT,EN02
REAL*8 FX,FY,GX,GY,VALBC,L,H,Q,ALPHA,RO,THETA,XA,YA,XB,YB,VAV
C0MM0N/CELEM/KIND(400) ,NODES(400,9) ,FX,FY
COMMON/CNODE/GX(700),GY(700)
COMMON /CBC /NODEBC ( 200 ) ,DIRBC( 200 ) ,VALBC ( 200 )
COMMON/CALT/ALT ,L ,H , Q ,ALPHA ,EX ,EY
C
C GENERATE GEOMETRIC COORDINATES OF GLOBAL NODES:
READ(5,*> EX,EY,ALT,L,H,Q,ALPHA
NX=2*EX+1
NY=2*EY+1
EN0Z=2*(EX-2)/3
ALPHA=ALPHA*3. 141592654/180.
R0=H/SIN (ALPHA)
DO J=0,NY-1
THETA=ALPHA* ( 1 .*J / ( NY-1 ) )
XA= ( L+RO ) * ( 1 . -COS (THETA) )
YA= ( L+RO ) *SIN (THETA )
XB= (L+RO ) -R0*COS( THETA)
YB=RO*SIN(THETA)
DO 1=0,1GX(I*NY+J+l)=(XA-L/4.) + ( (L/4. )-L/EN0Z)*I/2.
GY(I*NY+J+1)=YA
END DO
DO 1=2,3
GX(J+1+I*NY)=XA- 2.*L*(l.-I/4.)/EN02
GY(J+1+I*NY)=YA
END DO
DO I=4,2*EN0Z+4
GX(J+1+I*NY)=XA + (XB-XA)*(l.*(I-4)/(2.*EN0Z))
GY(J+1+I*NY)=YA + (YB-YA)*(l.*(I-4)/(2.*EN0Z))
END DO
DO I=2*EN0Z+5,NX-1
GX(J+1+I*NY)=XB + L*(I-2.*EN0Z-L/4.)/(2.*EN0Z)
GY(J+1+I*NY)=YBEND DO
END DO
C
C GENERATE A MESH OF ELEMENTS AND CONNECTIVITY MATRIX:
READ(5,*) FX,FYDO 1=1,EX
DO J=1,EY
ELEM=(I-1)*EY + J
NODE=(I-l)*(2*NY) + 1 + 2*(J-1)
NODES ( ELEM , 1 ) =NODE
NODES (ELEM, 2 )=NODE + 2*NY
NODES (ELEM, 3 )=NODE + 2*NY + 2
NODES (ELEM, 4 )=N0DE + 2
NODES (ELEM, 5 )=NODE + NY
NODES (ELEM, 6 )=NODE + 2*NY + 1
NODES (ELEM, 7 )=NODE + NY + 2
NODES (ELEM, 8 )=N0DE + 1
NODES (ELEM, 9 )=NODE + NY + 1
KIND(ELEM)=9
END DO
END DO
C
C SET BOUNDARY CONDITIONS ON ENTRANCE SIDE ACCORDING TO A PARABOLIC,
C VELOCITY DISTRIBUTION:
VAV=Q/(2.*GY(5*NY))
BC=1
DO J=0,NY-1THETA=ALPHA* ( 1 . *J/ (NY-1 ) )
NODEBC (BCW+1
DIRBC ( BC ) = 1
VALBC(BC)=(l.-(GY(J+l)/GY(5*NY))**2.)*3.*VAV/2.
NODEBC ( BC+1 )=J+1
DIRBC (BC+1) =2
VALBC ( BC+1 )=0.
BC=BC+2
END DO
DO J=2,NX
NODEBC ( BC )=( J- 1 ) *NY+1
DIRBC (BC) =2
VALBC(BC)=0.
BC=BC+1
END DO
DO J=2,NX
NODEBC (BC)=J*NY
NODEBC ( BC+1 )=J*NY
DIRBC(BC)=1
DIRBC BC+1) =2
VALBC(BC)=0.
VALBC ( BC+1 )=0.
BC=BC+2
END DO
CRETURN
END*AAAAAAAAAAAAAAAAAAAAAAAAAAA******************************************************
SUBROUTINE PROC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA**AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC PROCESSOR SUBROUTINE. CALLS SUBROUTINES WHICH ASSEMBLE ELEMENT ANDC GLOBAL STIFFNESS MATRICES, APPLIES BOUNDARY CONDITIONS, SOLVES EQUATIONS.
CHARACTER*80 TITLE
INTEGER NNODE,NELEM,NBC,NPT,KIND,NODES ,HBAND,ELEM, I,J,NW,PRTREAL*B FX,FY,GK,GF,GU,EK,EFCOMMON /CCON /TITLE ,NNODE , NELEM ,NBC,NPTCOMMON/CELEM/KIND( 400 ) ,NODES ( 400 , 9 ) ,FX,FY
COMMON/CMATRX/HBAND,GU(1400),GK(1400,90),GF(1400),EK(1B,18),EF(18)COMMON/CPRINT/PRTdO)
C
C CALCULATE HALF-BANDWIDTH HBAND. FORMULA IS HBAND=(MAX DIF BETWEEN GLOBALC NODE NUMS. ON AN ELEMENT + 1)*(NUM. OF D.O.F. PER NODE)
HBAND=0
DO ELEM=1,NELEMDO I=1,KIND(ELEM)
DO J=1.KIND(ELEM)NW= ( IABS (NODES ( ELEM , I ) -NODES ( ELEM , J )) +1 ) *2
IF (NW .GT. HBAND) HBAND=NWEND DO
END DOEND DO
C
C INITIALIZE MATRICES:DO I=l,2*NNODE
GF(I)=0.
DO J=l,HBAND
GK(I,J)=0.
END DO
END DO
C
C CONSTRUCT ELEMENT AND GLOBAL MATRICES:
DO ELEM=1,NELEM
CALL ELEMENT ( ELEM,KIND( ELEM ) )
IF (PRT(l).EQ.l .AND. PRT(2) .LE.ELEM .AND. ELEM.LE.
+. PRTOJ) CALL SPILL (ELEM,KIND ( ELEM ),1)
. CALL ASSEMB(ELEM,KIND(ELEM))
END DO
C
IF (PRT(4) .EQ. 1) CALL SPILL(1,1,2)
CALL APLYBC
CALL GAUSSEL
C
RETURN
END
AAAAAAAAAAAAAAAAAAAAAAAAAAAA*AAA*AAAA***AA*****AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SUBROUTINE ELEMENT ( ELEM,N)
AAAAAAAAAAAAAAAAAAAAAAAAAAAA********************AAA*AAAAAAAAAAAAAAAAAAAAAAAAAAAAA^
C ASSEMBLES THE ELEMENT STIFFNESS MATRIX.
INTEGER KIND,NODES,NINT,HBAND,ELEM, I,J,N,LXI,LNA
REAL*8 XI,NA,A,B,CPSI(9),DPSDX(9),DPSDY(9),DETJ,INTC,GU,+ FX,FY,MU,GAMMA,XIQ,WT,GK,GF,EK,EF
COMMON/CELEM/KIND( 400 ),NODES (400,9) ,FX,FY
C0MM0N/CINT/NINT,XIQ(5,5) ,WT(5,5)
COMM0N/CMATRX/HBAND,GU(1400),GK(14O0,90),GF(1400),EK(18,18),EF(18)
COMMON/CMAT/MU , GAMMA
C
C INITIALIZE ELEMENT MATRICES:
DO 1=1, 2*N
EF(I)=0.
DO J=1,2*N
EK(I,J)=0.
END DO
END DO
C
C SET DEGREE OF GAUSS INTEGRATION. LINEAR QUADS USE 2X2 POINTS,
IF (KIND(ELEM) .EQ. 4) NINT=2IF (KIND(ELEM) .NE. 4) NINT=3
C
C APPLY FULL INTEGRATION TO THE NON-PENALTY FUNCTION TERMS:
DO LXI=1,NINT
DO LNA=1,NINT
XI*XIQ(NINT,LXI)
NA=XIQ(NINT,LNA)
CALL SHAPE(ELEM,N,XI,NA,PSI,DPSDX,DPSDY,DETJ)
INTC=WT ( NINT ,LXI ) *WT (NINT , LNA ) *DETJ
DO 1=1,N
EF( I ) =EF( I )+FX*PSI ( I ) *INTC
EF( I+N ) =EF( I+N) +FY*PSI ( I ) *INTC
DO J=1,N
A=DPSDX ( I ) *DPSDX ( J ) * INTC
B=DPSDX ( J ) *DPSDY ( I ) *INTC
C=DPSDY(I)*DPSDY(J)*INTC
EK(I,J)=EK(I,J )+ 2.0*MU*A + MU*C
EK(I,J+N)=EK(I,J+N) + MU*B
EK(I+N,J+N)=EK(I+N,J+N) + MU*A + 2.*MU*C
END DO
END DO
END DO
END DO
C
C USE REDUCED INTEGRATION TO PENALTY FUNCTION TERMS:
DO LXI=1,NINT-1
DO LNA=1,NINT-1
XI=XIQ(NINT-1,LXI)
NA=XIQ(NINT-1,LNA)
CALL SHAPE(ELEM,N,XI,NA,PSI,DPSDX,DPSDY,DETJ)
INTC=WT(NINT-1 ,LXI ) *WT(NINT-1 ,LNA) *DETJ
DO 1=1,N
DO J-l-H
A=DPSDX ( I ) *DPSDX ( J ) * INTC
B=DPSDX ( I ) *DPSDY ( J ) *INTC
C=DPSDY ( I ) *DPSDY ( J ) *INTC
EK(I,J)=EK(I,J) + GAMMA*A
EK(I,J+N)=EK(I,J+N) + GAMMA*B
EK(I+N,J+N)=EK(I+N,J+N) + GAMMA*C
END DO
END DO
END DO
END DO
C
C CALCULATE LOWER LEFT TRANSPOSE PART OF CEK3 MATRIX:
DO 1=1,N
DO J=N+1,2*N
EK(J,I)=EK(I,J)
END DO
END DO
C
RETURN
END
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SUBROUTINE SHAPE! ELEM,N,XI ,NA,PSI,DPSDX,DPSDY,DETJ)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*AAAAAAAAAAAA*AAAAAAAAAAAAAAAAAAAAAA
C AT GIVEN INTEGRATION POINTS IN LOCAL COORDINATES XI,NA , CALCULATE VALUE
C OF SHAPE FUNCTIONS, PARTIAL DERIVATIVES, AND TRANSFORM BACK INTO GLOBAL.
INTEGER N,ELEM
REAL*8 XI ,NA,PSI ( 9 ) ,DPSIDXI ( 9 ) ,DPSIDNA( 9 ) ,DPSDX( 9 ) ,DPSDY( 9 ) ,+ DETJ,JACI(2,2)
C
C CALCULATE VALUE OF SHAPE FUNCTIONS AND THEIR DERIVATIVES IN XI,NA COORDINAT
IF (N .EQ. 4) THEN
C FOUR NODE QUADRILATERAL: 4. . 2
PSI(1)*.25*(1-XI)*(1-NA)PSI ( 2 ) = .
25* ( 1+XI ) * ( 1-NA)
PSI(3)=.25*(1+XI)*(1+NA) 1. . <
PSI(4)=.25*(1-XI)*(1+NA)
DPSIDXI(1)=-.25*(1-NA)
DPSIDXI(2)=.25*(1-NA)
DPSIDXI(3)=.25*(1+NA)
DPSIDXI(4)=-.25*(1+NA)
DPSIDNA(1)=-.25*(1-XI)
DPSIDNA(2)=-.25*(1+XI)
DPSIDNA( 3 ) .25* ( 1+XI )
DPSIDNA(4)=.25*(1-XI)
ELSE IF (N .EQ. 8) THEN
C EIGHT NODE (SERENDIPITY) QUADRILATERAL:
PSI(1)=0.25*(1.-XI)*(1.-NA)*(-1.-XI-NA) 4. 7 I
PSI(2)=0.25*(1.+XI)*(1.-NA)*(-1.+XI-NA)
PSIO)=0.25*(1.+XI)*(1.+NA)*(-1.+XI+NA) 8 (
PSI ( 4 ) =0 .25* ( 1 . -XI ) * ( 1 . +NA) * ( -1 . -XI+NA)
PSI(5)=0.5*(1.-XI**2)*(1.-NA) 1. 5 .
PSI(6)=0.5*(1.+XI)*(1.-NA**2)
PSI(7)=0.5*(1.-XI**2)*(1.+NA)
PSI ( 8 ) =0 .5* ( 1 . -XI ) * ( 1 . -NA**2 )
DPSIDXI(1)=0.25*(1.-NA)*((-1.)*(-1.-XI-NA)+(1.-XI)*(-1.))
DPSIDXI ( 2 ) =0 .25* ( 1 . -NA) * ( ( 1 . ) * ( -1 . +XI-NA ) + ( 1 . +XI ) * ( 1 . ) )
DPSIDXI(3)=0.25*(1.+NA)*((1.)*(-1.+XI+NA)+(1.+XI)*(1.)>
DPSIDXI ( 4 ) =0. 25* ( 1 . +NA) * ( ( -1 . ) * ( -1 . -XI+NA)+( 1 . -XI ) * ( -1 . ) )
DPSIDXI ( 5 )XI* ( 1 . -NA)
DPSIDXI(6)=0.5*(1.-NA**2)
DPSIDXI ( 7 )XI* ( 1 . +NA)
DPSIDXI(B)=-0.5*(1.-NA**2)
DPSIDNA(1)=0.25*(1.-XI)*((-1.)*(-1.-XI-NA)+(1.-NA)*(-1.))
DPSIDNA(2)=0.25*(1.+XI)*((-1.)*(-1.+XI-NA)+(1.-NA)*(-1.))
DPSIDNA(3)=0.25*(1.+XI)*((1.)*(-1.+XI+NA)+(1.+NA)*(1.))
DPSIDNA(4)=0.25*(1.-XI)*((1.)*(-1.-XI+NA)+(1.+NA)*(1.))
DPSIDNA<5>0.5*(1.-XI**2)
DPSIDNA(6)=-(1.+XI)*NA
DPSIDNA(7)=0.5*(1.-XI**2)
DPSIDNA( 8 ) =- ( 1 . -XI ) *NA
ELSE IF (N .EQ. 9) THEN
C NINE NODE ISOPARAMETRIC QUADRILATERAL:
PSI(1)=0.25*(XI*XI-XI)*(NA*NA-NA) 4. 7 3
PSI ( 2) =0. 25* (XI*XI+XI )* (NA*NA-NA)
PSI(3)=0.25*(XI*XI+XI)*(NA*NA+NA) 8 9*
PSI(4)=0.25*(XI*XI-XI)*(NA*NA+NA)
PSI(5)=0.5*(1.-XI*XI)*(NA*NA-NA) 1 5 ;
PSI ( 6 ) =0 .5* (XI*XI+XI ) * ( 1 . -NA*NA )
PSI ( 7 ) =0 .5* ( 1 . -XI*XI ) * ( NA*NA+NA )
PSI(8)=0.5*(XI*XI-XI)*(1.-NA*NA)
PSI(9)=(1.-XI*XI)*(1.-NA*NA)
DPSIDXI(1)=0.25*(2.*XI-1.)*(NA*NA-NA)DPSIDXI ( 2 ) =0 .
25* ( 2 . *XI+1 . ) * (NA*NA-NA)
DPSIDXI(3)=0.25*(2.*XI+1.)*(NA*NA+NA)DPSIDXI(4)=0.25*(2.*XI-1.)*(NA*NA+NA)DPS IDXI ( 5 ) = -XI* (NA*NA-NA )
DPSIDXI(6)=0.5*(2.*XI+1)*(1.-NA*NA)DPSIDXI ( 7 ) =-XI* (NA*NA+NA)DPSIDXI ( 8 ) =0 .
5* ( 2 . *XI-1 . ) * ( 1 . -NA*NA~)
DPSIDXI ( 9 ) =-2 . *XI* ( 1 . -NA*NA)
DPSIDNA(1)=0.25*(XI*XI-XI)*(2.*NA-1.)
DPSIDNA(2)=0.25*(XI*XI+XI)*(2.*NA-1.)
DPSIDNAO)=0.25*(XI*XI+XI)*(2.*NA+1.)
DPSIDNA(4)=0.25*(XI*XI-XI)*(2.*NA+1.)DPSIDNA(5)=0.5*(1.-XI*XI)*(2.*NA-1.)DPSIDNA( 6) =- (XI*XI+XI ) *NA
DPS IDNA ( 7 ) = 0 .5* ( 1 . -XI*XI ) * ( 2 . *NA+1 . )
DPSIDNAt 8 ) =- (XI*XI-XI ) *NA
DPSIDNA(9)=-2.*(1.-XI*XI)*NAEND IF
C
C CALCULATE JACOBIAN TO TRANSFER PARTIAL DERIVATIVES FROM LOCAL TO GLOBAL:
CALL JACOBI (ELEM,N,DPSIDXI,DPS IDNA,DETJ,JACI)C CALCULATE PARTIAL DERIVATIVES OF SHAPE FUNCTIONS WITH RESPECT TO GLOBAL X,Y:
DO 1=1,N
DPSDX(I)=JACI(1,1)*DPSIDXI(I) + JACI(1,2)*DPSIDNA(I)
DPSDY(I)=JACI(2,1)*DPSIDXI(I) + JACI(2,2)*DPSIDNA(I)
END DO
C
RETURN
ENDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAt
SUBROUTINE JACOBI (ELEM,N,DPSIDXI,DPSIDNA,DETJ,JACI)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAr
C CALCULATE JACOBIAN MATRIX TO TRANSFORM FROM XI,NA TO X,Y.
INTEGER KIND,NODES, I,N,ELEM
REAL*8 DPSIDXI(9),DPSIDNA(9),DETJ,JACT(2,2),JACI(2,2),FX,FY,
+ GX,GY
COMMON/CNODE/GX( 700) ,GY(700)
COMMON/CELEM/KIND(400) ,N0DES(400,9) ,FX,FY
C
JACT(1,1)=0.
JACT(1,2)=0.
JACT(2,1)=0.
JACT(2,2)=0.
DO 1=1,NJACT(1,1)=JACT(1,1) + DPSIDXI(I)*GX(NODES(ELEM,D)
JACT(1,2)=JACT(1,2) + DPSIDXI ( I )*GY (NODES (ELEM, I ) )
JACT(2,1)=JACT(2,1) + DPSIDNA(I)*GX(NODES(ELEM,I) )
JACT(2,2)=JACT(2,2) + DPSIDNAt I ) *GY(NODES (ELEM, I ) )
END DO
C CALCULATE THE JACOBIAN DETERMINANT OF CJACT3:
DETJ=JACT(1,1)*JACT(2,2)- JACT(2,1)*JACT( 1,2)
IF (DETJ .LE. 0.0) THENWRITE(6,*)'
BAD JACOBIAN IN SUBROUTINE *JACOBI* '
STOP
END IF
C CALCULATE INVERSE OF CJACTD
JACI ( 1 , 1 ) =JACT( 2 , 2 ) /DETJ
JACI (1,2) =-JACT( 1,2) /DETJ
JACI (2,1) =-JACT( 2,1) /DETJ
JACI (2,2) =JACT( 1,1) /DETJC
RETURN
END
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
SUBROUTINE ASSEMB(ELEM,N)***********************AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAj
C ASSEMBLE GLOBAL MATRICES CGKD AND CGF3 FROM ELEMENTAL MATRICES CEKJ AND CEF
INTEGER KIND,NODES,HBAND, ELEM,N, I, J,UI,UJ,VI ,VJREAL*8 FX,FY,GK,GF,EK,EF,GUCOMMON/CELEM/KIND( 400 ) ,NODES (400,9) ,FX,FYCOMMON/CMATRX/HBAND,GU( 1400) ,GK(1400,90) ,GF(1400) ,EK(18,18) ,EF(18)
C THE FOLLOWING FOUR VARIABLES MARK THE POSITION IN GLOBAL MATRICES:
C UI=VERTICAL POSITION OF U VELOCITY
C VI=VERTICAL POSITION OF V VELOCITYC UJ=HORIZONTAL POSITION OF U VELOCITYC VJ=HORIZONTAL POSITION OF V VELOCITY
C ONLY SAVE UPPER TRIANGULAR PORTION OF CGKD. ENTRY GK(I,J) IS STORED
C IN BAND MATRIX AT POSITION GK(I,J-I+1).
DO 1=1,N
UI=NODES(ELEM,I)*2 - 1
VI=UI+1
GF(UI)=EF(I)
GF(VI)=EF(I+N)DO J=1,N
UJ=N0DES(ELEM,J)*2 - 1
VJ=UJ+1
GK(UI,UJ-UI+1)=GK(UI,UJ-UI+1)+EK(I,J)'
GK (UI ,VJ-UI+1 ) =GK (UI ,VJ-UI+1 ) +EK ( I , J+N)
GK(VI,UJ-VI+1)=GK(VI,UJ-VI+1)+EK(I+N,J)
GK(VI ,VJ-VI+1 ) =GK(VI ,VJ-VI+1 )+EK( I+N, J+N)
RETURN
ENDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA**AAAAAAAAAAAAAAAA*
SUBROUTINE APLYBC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAr
C APPLY BOUNDARY CONDITIONS AND POINT LOADS TO GLOBAL MATRICESCHARACTER*80 TITLE
INTEGER NNODE,NELEM,NBCNPT,NODEBCDIRBC,HBAND,NODEPT,DIRPT,BC,+ POS,POINT
REAL*8 BIG,VALBC,GK,GF,EK,EF,VALPT,GU
COMMON/CCON/TITLE,NNODE,NELEM,NBC,NPT
COMMON/CMATRX/HBAND,GU( 1400 ) ,GK( 1400, 90) ,GF( 1400) ,EK(18,18) ,EF(18)COMMON/CBC/N0DEBC(200),DIRBC(200),VALBC(200)
COMMON/CPT/NODEPT( 50 ) ,DIRPT( 50 ) ,VALPT( 50 )
C
C APPLY ESSENTIAL BOUNDARY CONDITION BY PENALTY METHOD:
DO BC=1,NBC
P0S=N0DEBC(BC)*2 - 2 + DIRBC (BC)
BIG=GK(P0S,1)*1.E10
GK(POS,l)=BIG
GF ( POS ) =BIG*VALBC ( BC )
END DO
C
C APPLY POINT LOADS:
DO POINT=l,NPT
IF (UI.LE.UJ)
IF (UI.LE.VJ)
IF (VI.LE.UJ)
IF (VI.LE.VJ)
END DO
END DO
P0S=N0DEPT(P0INT)*2 -2 + DIRPT(POINT)
GF(POS)=GF(POS) + VALPT(POINT)END DO
C
RETURN
END
*AAAAAAAAAAAAAAAAAAAAAAAA**AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SUBROUTINE GAUSSEL******************* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*A******AAAAAAAAAAAA A
C SOLVE SYSTEM OF EQUATIONS OF THE FORM CGK3CGU3=CGF1 FOR CGU} USING
C GAUSS ELIMINATION. MATRIX CGKD IS STORED IN HALF-BAND FORM.
CHARACTER*80 TITLE
INTEGER NNODE,NELEM,NBC,NPT,HBAND,N,ROW,R,C,CMAX,J, JMAX
REAL*8 GK,GF,EK,EF,SUM,GU
COMMON /CCON /TITLE ,NNODE ,NELEM , NBC ,NPT
COMMON/CMATRX/HBAND,GU(1400) ,GK(1400,90) ,GF(1400) ,EK(18,18) ,EF(18)C
N=2*NNODE
C USE GAUSSIAN ELIMINATION TO GET AN UPPER TRIANGULAR MATRIX:
DO ROW=2,N
IF (ABS(GK(ROW-l,D) .LT. l.E-20) THENWRITE(6,*)'
GAUSS REDUCTION FAILED DUE TO SMALLPIVOT'
STOP
END IF
CMAX=MIN0 (HBAND- 1 ,N-ROW+l )
DO C=1,CMAX
SUM=0.
JMAX=MIN0 ( ROW-1 ,HBAND-C )
DO J=1,JMAX
SUM=SUM+GK(ROW-J,J+l)*GK(ROW-J,C+J)/GK(ROW-J,l)
END DO
GK(ROW,C)=GK(ROW,C)-SUM
END DO
END DO
C
C PERFORM FORWARD SUBSTITUTION OF CGF3:
DO R0W=2,N+1'
SUM=0.
JMAX=MIN0 (HBAND-1 ,ROW-l )
DO J=1,JMAX
SUM=SUM+GK(ROW-J,J+l)/GK(ROW-J,l)*GF(ROW-J)
END DO
GF(ROW) =GF(ROW) -SUM
END DO
C
C BACK SUBSTITUTE FOR CGU}:
GU(N)=GF(N)/GK(N,1)
DO R=2,N
ROW=N+l-R
CMAX=MIN0 (N,ROW+HBAND-l )
SUM=0.
DO C=ROW+l,CMAX
SUM=SUM + GU(C)*GK(ROW,C-ROW+l)
END DO
GU(ROW) = (GF(ROW)-SUM)/GK(ROW,1)
END DO
C
RETURN
END
AA*A*A*A***************************************************************AAAAAAAA
SUBROUTINE SPILL (ELEM,N, PRNT)*****************A******AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA>C SENDS MATRICES FOR OUTPUT (OR MODIFY TO OUTPUT TO A DATA FILE).
CHARACTER*80 TITLE
INTEGER NNODE,NELEM,NBC,NPT,HBAND,ELEM, PRNT, I,J,N,PRTREAL*8 GK,GF,EK,EF,GUCOMMON /CCON /TITLE ,NNODE , NELEM ,NBC,NPT
COMMON/CMATRX/HBAND,GU(1400),GK(1400,90),GF(1400),EK(18,18),EF(1B)COMMON /CPRINT /PRT ( 10 )
C PRNT=1 TO PRINT ELEMENT MATRIX; PRNT=2 TO PRINT GLOBAL MATRIX.C
IF (PRNT .EQ. 1) THEN
WRITE(6,20) ELEM
20 FORMATCO','
OUTPUT OF ELEMENT#',14,'
STIFFNESS MATRIX:')DO 1=1,N*2
WRITE(6,40) I40 FORMATC ', 'MATRIX ROW # ',14)
WRITE(6,60) (EK(I,J),J=1,N*2)60 F0RMAT(3(1X,6(E12.5,1X),/))
END DOWRITE(6,*)'
OUTPUT OF ELEMENT MATRIXCOMPLETED'
ELSE IF (PRNT .EQ. 2) THEN
WRITE(6,80)
80 F0RMAT('0'
, 'OUTPUT HALF-BAND GLOBAL STIFFNESS MATRIX:'
)DO I=PRT(5),PRT(6)
WRITE(6,100) I
100 FORMAT* IX, 'EQUATION # ',14)
WRITE(6,120) (GK(I,J),J=1,HBAND)
-120 FORMAT(30(1X,6(E12.5,1X),/))
END DOWRITE(6,*)'
OUTPUT OF GLOBAL MATRIXCOMPLETED'
END IF
C
RETURN
ENDAAAAAA AAAAAAAA****AA*A***A**AAA*AAAA*AA*AAAAAAAAA*A*A**AAAAAAAAAAAAAAAAAA AAAAAAAAA
SUBROUTINE POSTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
INTEGER PRT
COMMON/CPRINT/PRTdO)
C OUTPUT FINAL NODAL SOLUTION:
IF (PRT(8) .EQ. 1) CALL PNODE
C CALCULATE PRESSURES AND OUTPUT FINAL ELEMENT SOLUTION:
CALL PELEM
WRITE(6,*) *********** END OF FINAL SOLUTION OUTPUT***********
C
RETURN
ENDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAy
SUBROUTINE PNODE
A***A**************AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
C PRINT NODAL COORDINATES AND VELOCITY SOLUTIONS
CHARACTER*80 TITLE
INTEGER NNODE,NELEM,NBC,NPT,NODE,POS,HBAND
REAL*8 GX,GY,GU,GK,GF,EK,EF
COMMON/CCON/TITLE ,NNODE,NELEM ,NBC,NPT
COMMON/CNODE/GX( 700 ) ,GY( 700 )
COMMON/CMATRX/HBAND,GU( 1400) ,GK(1400,90) ,GF(1400) ,EK(18,18) ,EF(18)
CWRITE(6,20)
20 FORMAT('0','**********FINAL NODAL SOLUTION OUTPUT ***********
'
)
WRITE(6,30)
30FORMATCO','
NODE X-COOR Y-COOR U-VELOCITY
+ V-VELOCITY'
)
DO N0DE=1,NNODEP0S=2*N0DE - 1
WRITE(6,40) NODE,GX(NODE) ,GY(NODE) ,GU(POS) ,GU(P0S+1)
40 F0RMAT(1X,I4,5X,4(E12.5,4X))END DO
C
RETURN
END*A*A*AAAAAAAAAAAAA**AAAAAA***AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
SUBROUTINE PELEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA***************************
C OUTPUT ELEMENT SOLUTION. PRESSURE IS COMPUTED AT GAUSS POINTS.
CHARACTER*80 TITLE
INTEGER NNODE,NELEM,NBC,NPT,KIND,NODES,NINT,ELEM,MAXITER,
+ LXI,LNA,I,POS,ALT,HBAND
REAL*8 FX,FY,GX,GY,XIQ,WT,MU,GAMMA,GU,GK,GF,EK,EF,XI,NA,PSI(9) ,+ DPSDX( 9 ) ,DPSDY( 9 ) ,DETJ ,X,Y,PRES ,PDROP ,R1 ,R2 ,L
COMMON /CCON /TITLE ,NNODE ,NELEM ,NBC,NPT
COMMON/CELEM/KIND(400) ,NODES(400,9) ,FX,FY
COMMON/CNODE/GX(700) ,GY(700)
C0MM0N/CINT/NINT,XIQ(5,5),WT(5,5)
COMMON/CMAT/MU,GAMMA
COMMON/CMATRX/HBAND,GU(1400),GK(1400,90),GF(1400),EK(18,1B),EF(18)
COMMON /CALT/ALT ,LC-
WRITE(6,20)
20 FORMAT('0'
,********** OUTPUT FINAL ELEMENT SOLUTION **********')
WRITE(6,30)
30 FORMAT('0'
, 'ELEMENT X-COOR Y-COOR PRESSURE')
PDROP=0.
R1 =0.
R2 =0.
DO ELEM=1,NELEM
IF (KIND(ELEM).EQ.4) NINT=2
IF (KIND(ELEM).GT.4) NINT=3
DO LXI=1,NINT-1
DO LNA=1,NINT-1
XI=XIQ(NINT-1,LXI)
NA=XIQ(NINT-1,LNA)
CALL SHAPE(ELEM,KIND(ELEM) ,XI,NA,PSI,DPSDX,
+ DPSDY,DETJ)
X=0.
Y=0.
PRES=0.
DO I=1,KIND(ELEM)
X=X+PS I ( I ) *GX ( NODES ( ELEM , I ) )
Y=Y+PSI ( I ) *GY (NODES ( ELEM , I ) )
POS=NODES (ELEM, I )*2-l
PRES=PRES+DPSDX ( I ) *GU ( POS ) +DPSDY ( I ) *GU ( POS+1 )
END DO
PRES = -GAMMA*PRES
IF (ALT .EQ. 2)
+CALL PERR0R(ELEM,LXI,PRES,PDR0P,X,Y,R1,R2)
WRITE(6,50) ELEM,X,Y,PRES
50F0RMAT(1X,I4,4X,3(E11.5,4X))
END DO
END DO
END DO
IF(ALT.EQ.2)WRITE(6,*) 'PRESSURE DROPIS'
,PDR0P*(R1-R2) /L
C
RETURN
END
*A**A**AAAAAAAAAAAAAAAAAAAAAAAA***AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA***
SUBROUTINE PERROR(ELEM,LXI,PRES,PDROP,X,Y,Rl,R2)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
C COMPUTES PRESSURE DROP FOR NOZZLE PROBLEM WITH ENTRANCE AND EXIT.
INTEGER ELEM,LXI,EX,EY,ALT,ENOZREAL*8 PRES,PDR0P,X,Y,R,R0,R1,R2,L,H,Q,ALPHA
COMMON/CALT/ALT,L,H,Q,ALPHA,EX,EYC
EN0Z=2*(EX-2)/3
RO=H/SIN(ALPHA)
R=SQRT( (L+R0-X)**2. +Y**2.)
IF(ELEM.GE.EY+1.AND.ELEM.LE.2*EY.AND.LXI.EQ.2) THEN
PDROP=PDROP + PRES/(4.*EY)
R1=R1 + R/(4.*EY)END IF
IF(ELEM.GE.2*EY+1.AND. ELEM. LE.3*EY.AND.LXI.EQ.l) THEN
PDROP=PDROP + PRES/(4.*EY)
R1=R1 + R/(4.*EY)
END IF
IF(ELEM.GE.(EN0Z+1)*EY+1.AND.ELEM.LE.(EN0Z+2)*EY.AND.LXI.EQ.2)THEN
PDROP=PDROP - PRES/(4.*EY)
R2=R2 + R/(4.*EY)
END IF
IF(ELEM.GE. (ENOZ+2 ) *EY+1 .AND. ELEM. LE. (ENOZ+3 ) *EY.AND. LXI .EQ. 1 )THEN
PDROP=PDROP - PRES/(4.*EY)
R2=R2 + R/(4.*EY)
END IF
C
RETURN
END