-
NUMERICAL ANALYSIS of PROCESSES
NAP6Partial differential equations (PDE), classification to
hyperbolic, parabolic and eliptic equationsHyperbolic PDE
(oscillation of trusses, beams, water hammer)MOC-method of
characteristics (compressible flow)Rudolf itn, stav procesn a
zpracovatelsk techniky VUT FS 2010
-
NAP6PDE partial differential equationsL.Wagner
-
NAP6PDE partial differential equationsWhen a system is described
by a greater number of independent variables (spatial coordinates
and time) we have to deal with partial differential equations
(PDEs). Most PDE are differential equations with maximum second
derivatives of the dependent variable (except eg. biharmonic
equation deformation of membranes with the fourth
derivative):Hyperbolic equation (oscillations and waves, supersonic
flow. Characterised by finite velocity of pressure waves)
Parabolic equation (evolution problems, e.g. time evolution of a
temperature or concentration profile, but also for example
evolution of a boundary layer from inlet.)
Eliptic equation (steady problems of distribution temperatures,
deformations,)
Example: Poissons equationExample: Fourier eqauation of heat
transferExample: vibration of an elastic beam, water hammer
-
NAP6PDE partial differential equationsTyp of PDE is determined
by coefficients of second derivatives (in case of the second order
PDE)where a,b,c,f are arbitrary functions of x,y, solution and its
first derivatives. Coefficients a,b,c determine characteristics
y(x), satisfying equation
b2-4ac>0 hyperbolic equation (two real roots, therefore two
characteristics)b2-4ac=0 parabolic equation (one root, one
characteristic)b2-4ac
-
NAP6PDE Hyperbolic PDEWherever the effect of inertia forces and
compressibility is important, the problem is described by
hyperbolic partial differential equations, characterized by real
characteristics (whose properties are sometimes used in the
solution of hyperbolic PDE method of characteristics).
-
Nj as a base functionNAP6PDE vibration of trussThe equation
describing the vibration truss is obtained by adding the
accelerating force to the balance of forcesWeighted residual method
using approximation Per partes integrationStiffness matrix[[K]]Mass
matrix [[M]]Excitation Forces [[b]]Ni as a weight
-
NAP6PDE vibration of trussFree oscillation of frames without
excitationis described by ordinary differential equations of the
second order. The equations have constant coefficients therefore
analytical solution existsSubstituting this solution to previous
equation results to systm of algebraic equations for
amplitudesBecause the systm is homogeneous a nontrivial solution
exists only for singular matrix of the system, therefore ifMatrices
[[K]] and [[M]] have N rows (rank N). Determinant is in fact a
polynomial of the N-th degree in variable 2 and the algebraic
equation has N-roots, N-eigenfrequencies. These frequencies
together with the vectors of amplitudes are solution of
eigenproblemThe eigenvalue problem is solved in MATLAB by function
[u,omega]=eig(m\k)
-
NAP6PDE vibration of trussLinear base functionsresults to
stiffness matrixand mass martixMass matrix is often substituted by
diagonalised matrix, corresponding to uniform distribution of mass
to nodes of elementDiagonalised matrix is easily inverted.Sum of
matrix elements is the mass of element
-
NAP6PDE vibration of truss MATLABExample: The system of steel
trusses (only one element for test)function
[kl,ml,ig]=kloc(ie,x,con,a)E=200e9;R=7000;ae=a(ie);i1=con(ie,1);i2=con(ie,2);ig=[i1
i2];le=abs(x(i1)-x(i2));kl=E*ae/le*[1 -1;-1 1];ml=R*ae*le/6*[2 1;1
2];x=[0 1];con=[1
2];a=[1e-4];nu=length(x);ne=length(a);n=nu;k=zeros(n,n);m=zeros(n,n);for
e=1:ne[kl,ml,ig]=kloc(e,x,con,a);k(ig(1:2),ig(1:2))=k(ig(1:2),ig(1:2))+kl(1:2,1:2);m(ig(1:2),ig(1:2))=m(ig(1:2),ig(1:2))+ml(1:2,1:2);end[u,omega]=eig(m\k);
In this case, we can easily check the result(for diagonalised
mass matrix is the lower eigenfrequency lower )
-
Stiffness matrix [[K]]Mass matrix [[M]]NAP6PDE vibration of
beamsPerhaps more important is the case of transverse vibration of
beams, e.g. the coil supported on several locations on the ends of
baffles and stuck into the tube sheet. Use the results of the
previous lecture, where continuous lateral load beam to replace the
inertia forcesBeyond that is the same as the truss, using only
previously defined matrix stiffness and mass derived for the beam
element.And you need not worry with the right side, because the
beam support and restraint in their heads are strong boundary
conditions.
-
NAP6PDE Water hammerUnsteady flow of compressible fluids in pipe
networks, the cardiovascular circulation in elastic blood vessels,
or supersonic flow around bodies, are typical examples of
hyperbolic equations. Special case is a hydraulic hammer
phenomenon, which occurs after the sudden closure of the valve in
the pipeline ... resulting sudden increase in pressure (shock wave)
propagates at the speed of sound in the fluid and in the pipe wall.
Do you know how to calculate the speed? Do you know what the
maximum pressure may arise?M. Rohani, M.H. Afshar Simulation of
transient flow caused by pump failure: Point-Implicit Method of
CharacteristicsAnnals of Nuclear Energy, Volume 37, Issue 12,
December 2010, Pages 1742-1750 Barbara Wagner
-
NAP6PDE water hammerFormulation of problem:Pipe with a variable
cross-section A (t, x), compressible fluid velocity v(t, x). The
relationship between density and pressure is characterized by a
volume compressibility modulus K [Pa]Aim of solution is the same as
in the previously analysed case of incompressible fluids:
calculation of pressure and velocity profiles along pipelines. This
time the pressure and velocity depend also upon time p(t,x),
v(t,x). These quantities are described by two equations, by
continuity equation and by momentum balance (Bernoullis equation).
In a simplified formBernoullis equationSpeed of sound aContinuity
equation, for explanation see next slideThis is how to express
flexibility of tube (cross section as a function of pressure)
-
NAP6PDE water hammer1D continuity equation for the case, when
the cross section A(t,x) of an elastic pipe is inflated by action
of inner pressureIflow in-outaccumulationj(the same equation
written in material derivative)This term is neglected in the
previous equation (usual assumption, see Khamlichi, Wave motion
1995)Mass balance of element dxVariable density, cross-section and
velocityDensity - pressure
-
NAP6PDE water hammerElimination of velocity (continuity equation
derived with respect time, Bernoulli equation wiith respect x and
subtracted). Resulting equation for pressure p(t,x) or velocity
v(t,x)Speed of soundare the same as equation describing oscillating
truss. A small technical problem appears because of possible mix of
different boundary conditions (pressure-velocity), for example
waveform of the flow at one end and a pressure waveform at a second
end. In case of water hammer effect in pipes it is represented by
an abrupt change of flow at one end (valve closing), and a constant
pressure at the second end (container). The method of weighted
residuals is therefore necessary to solve the system of two
PDE.
-
NAP6PDEFor hyperbolic equations, however, a different method
that uses a specific feature of hyperbolic equations that is the
existence of two real characteristics is often used.It is called
method of characteristic (MOC).ZbranskRecommended reading Wylie,
Streeter: Fluid Transients. McGraw Hill, 1978
-
Problem that will be solved
Compressible fluid flow in a stiff pipe or the incompressible
fluid in an elastic tube (which may be "inflated" by pressure
increase) - resulting compression effect is exactly the same. There
are two factors determining the flow: the inertia of the fluid and
the pressure exerted by the compression. The objective is to
determine the mean velocity (hence the flow rate q) and a pressure
p, both these values (v, p) varies in time and along the length of
the tube. We will consider various boundary conditions at the tube
ends: either specified (and time-varying) flow, or specified (and
time-varying) pressure.
Method of characteristic MOCNAP6
-
Let us return back to the continuity and Bernoulli equationand
adding up these two equations (the first is multiplied by arbitrary
constant )Select a curve in the plane t-x (parameter of the curve x
() can be directly time t). The full differential pressure and
velocity along the curve areIf the curve x(t=) satisfy the
equations (simultaneously)Method of characteristic MOCNAP6It is
assumed that the velocity of floww is much less than the speed of
sound-The following final equations expressed in term of total
differentials along the curve x(t=) will be obtained(this curve is
called CHARACTERISTIC of differential equation)
-
For exa,pme.The equation has two rootsNAP6Method of
characteristic MOCand the two characteristics with differential
equations that should be integratedIntegration in the direction of
characteristics results to system of two algebraic equations for
unknown pressure and velocity pC, vCFriction losses expressed in
terms of Fanning friction factor fThe only inaccuracy is neglection
of variability of friction losses
-
NAP6Solution of these algebraic equationscan be immediately
applied for calculation of velocities and pressures at a time level
C, given values at points A,B at an old time level.Method of
characteristic MOC
-
NAP6Method of characteristic MOCAn alternative (and perhaps
illuminating) formulation is analogous procedure that we used in
solving a system of differential equations of heat exchangers, see
Whitham: Linear and nonlinear waves, Wiley, 1974. The system of two
differential equations for pressure and velocity can be written in
matrix formApplication of suitable transformation (eigenvalue
problem) results to system of separated equations[[Q]] matrix of
eigenvectors [[A]] is diagonal matrixFor our specific case the
eigen problem (eigenvectors of [[A]] ) can be solved
analyticallyfunction Z1 by integration of equationalong
characteristic dx/dt=-aalong characteristic dx/dt=afunction Z2 by
integration of equation
-
NAP6The following example illustrates solutions to the problem
of compressible flow in the pipe, where the input is the specified
pressure (e.g. constant p0) and the output waveform of the
specified flow rate, e.g. rapidly decreasing flow, a situation
corresponding to the rapid closing the valve. The question is
primarily what pressure increase causes the valve closing (water
hammer in pipes).MOC water hammer MATLAB
- NAP6Let us return back to final algebraic equation of MOCthat
describe velocities and pressures in inner nodes of mesh. Only one
characteristic aims to the boundary nodes, therefore the second
equation representing boundary condition is necessary (waveform of
pressure at inlet and velocity at outlet, for example zero velocity
after closing the valve)Function describing a continuous closing of
valve function vrel=valve(t) if t
-
NAP6MOC water hammer
MATLABl=1;d=0.01;rho=1000;f=0.1;a=1;p0=2e3;v0=(p0*2*d/(l*rho*f))^0.5n=101;h=l/(n-1);v(1:n)=v0;p(1)=p0;for
i=2:n
p(i)=p(i-1)-f*rho*v0^2*h/(2*d);enddt=h/a;tmax=3;itmax=tmax/dt;fhr=f*h/(2*a*d);
for it=1:itmax t=it*dt; for i=2:n-1
pa=p(i-1);pb=p(i+1);va=v(i-1);vb=v(i+1);
pc(i)=a/2*((pa+pb)/a+rho*(va-vb)+fhr*(vb*abs(vb)-va*abs(va)));
vc(i)=0.5*((pa-pb)/(rho*a)+va+vb-fhr*(vb*abs(vb)+va*abs(va))); end
pc(1)=p0; vb=v(2);pb=p(2);
vc(1)=vb+(pc(1)-pb)/(a*rho)-fhr*vb*abs(vb); vc(n)=v0*valve(t);
va=v(n-1);pa=p(n-1);
pc(n)=pa-rho*a*(vc(n)-va)+f*h*rho/(2*d)*va*abs(va);
vres(it,1:n)=vc(1:n); pres(it,1:n)=pc(1:n);
p=pc;v=vc;endpmax=max(max(pres))/p0x=linspace(0,1,n);time=linspace(0,tmax,itmax);contourf(x,time,pres,30)Tube
L=1m, D=0.01 m, speed of sound a=1 m/s, steady forward velocity
v=0.6325 m/s.At t=1.1 backpressure returns to in letAt t=0.1 the
valve at outlet is closing }gradually)
-
NAP6MOC water hammer MATLABtime (up to 6 s)Rate of closing the
valve to maximum overpressure (not to big)vrel=exp(-10*(t-.1));
fast closing approx. 0.1 svrel=exp(-50*(t-.1)); very fast
closingn=101v0 =0.6325 m/s a=1 m/s =1000 kg/m2pmax =2180
PaApproximate analysis of maximum pressure: kinetic energy of
liquid moving at speed v is transformed into deformation energy
after a collisionLvFor this case pmax=632 Pa, that is only about
30% of the actual value. This analysis is not very accurate because
the cylinder is not compressed uniformlySpeed of
soundvrel=exp(-0.1*(t-.1)); slow closing approx. 10sukovsky
equation see next slide
-
NAP6MOC water hammer MATLABThe relationship between the speed of
sound, velocity v and pressure of the liquid column p expresses
centuries old water hammer equations (Young 1808, the modern form
of the equation see ukovsky 1898 for the water hammer in the
elastic tube)The formula is so well known that only seldom its
derivation is presented: dv piston velocitya the speed of the front
shock wavesConstant velocity up to the shock Prerequisite step down
density and pressure in the shock wave zoneThe derivation is based
on the mass and momentum balance of control volume that moves at a
constant speed to the rightvp,Substituting momentum balance results
to the water hammer equationfluid velocity relative to the
interface, which moves at the speed of sound aMomentum flux is
velocity times densitycontrol volume moving at speed of sound to
the rightMass balanceMomentum balance
- NAP6MOC water hammer MATLABThese black pages, you can safely
skip. They are just an example of how to make a numerical model
more realistic (calculating realistic friction coefficient) and
also demonstrate that MATLAB is very slow (because it is only an
interpret)The following program was rewritten to FORTRAN (MATLAB
loops for i=2:n-1, are replaced by do i=2,n-1, and commands if
re
- NAP6MOC water hammer
MATLABp0=1e3;l=1;d=0.01;rho=1000;mju=0.001;a=4;vlam=p0*d^2/(32*mju*l);re=vlam*d*rho/mjuif
re
-
NAP6MOC water hammer MATLABVelocityPressureWater, a=4 m/s, L=1m,
D=0.01 m, p0=1 kPa, v0=1.14 m/s, Re=31000Pressure at closing
valveAccelerated pulsation is caused by a higher speed of sound
(stiffer elastic tube), a = 4 m / s. Time of flight of pressure
waves is reduced to 0.25 s.
-
NAP6MOC water hammer MATLABThe case with oscillating flowrate at
inlet (displecement pump) and constant pressure at outlet (e.g.
zero pressure)v(t) function vrel=pump(t) vrel=0.5*sin(3*t);
p=0vc(1)=pump(it*dt);vb=v(2);pb=p(2);pc(1)=pb+rho*a*(vc(1)-vb)+f*h*rho/(2*d)*vb*abs(vb);
va=v(n-1);pa=p(n-1);
pc(n)=0;vc(n)=va-(pc(n)-pa)/(rho*a)-fhr*va*abs(va);BA
-
NAP6
I am not sure, the solution may be wrongMOC elastic and rigid
pipe
-
NAP6MOC elastic and rigid pipev(t)pe(t)LLeElastic pipe. Speed of
sound a is determined by elasticity of pipeRigid tube. Infinite
speed of sound.Consider the case of an incompressible fluid flow
elastic tube (e.g. blood vessel) which is connected to the tube
(perhaps the same diameter), but perfectly rigid. This seemingly
innocuous combination of boundary conditions poses a problem for
numerics. The rigid tube and the incompressible fluid speed of
sound is infinite, the characteristics are parallel to the axis of
the tube and the corresponding time step is infinitesimaly
shortabrupt change in impedance (resistance) causes reflection of
waves that interfere with the waves that are moving towards the
right end (in the direction of flow)
-
NAP6MOC elastic and rigid pipeIncorrect (?) boundary condition
at end (this condition includes 1st derivative)ACeBernoulli
rovnici, should be valid at outlet of elastic tubeSubtraction of
Bernoulli equation for rigid pipe D
-
NAP6Program
MATLABle=0.001;de=0.1;pe=0;l=1;d=0.01;rho=1000;f=0.1;a=1;p0=0;v0=0;n=401;h=l/(n-1);v(1:n)=v0;p(1)=p0;for
i=2:n
p(i)=p(i-1)-f*rho*v0^2*h/(2*d);enddt=h/a;tmax=3;itmax=tmax/dt;fhr=f*h/(2*a*d);
for it=1:itmax t=it*dt; for i=2:n-1
pa=p(i-1);pb=p(i+1);va=v(i-1);vb=v(i+1);
pc(i)=a/2*((pa+pb)/a+rho*(va-vb)+fhr*(vb*abs(vb)-va*abs(va)));
vc(i)=0.5*((pa-pb)/(rho*a)+va+vb-fhr*(vb*abs(vb)+va*abs(va))); end
vc(1)=pump(it*dt);vb=v(2);pb=p(2);
pc(1)=pb+rho*a*(vc(1)-vb)+f*h*rho/(2*d)*vb*abs(vb);
va=v(n-1);vb=v(n);pa=p(n-1);
pc(n)=(pc(n-1)/h+pe/le-f*rho*vb*abs(vb)/(2*d*de)*(de-d))/(1/h+1/le);
vc(n)=va+1/(rho*a)*(pa-pc(n)-f*h*rho/(2*d)*va*abs(va));
vres(it,1:n)=vc(1:n); pres(it,1:n)=pc(1:n);
p=pc;v=vc;endpmax=max(max(pres))x=linspace(0,1,n);time=linspace(0,tmax,itmax);contourf(x,time,pres,30)MOC
elastic and rigid pipe
-
NAP6MOC elastic and rigid pipePressure profiles in elastic tube
(a=1 m/s, L=1 m, D=De=0.01 m)
-
NAP6MOC elastic and rigid pipeExperiments conducted in our
laboratory did not operate with a harmonic flow, but only with the
temporary (transient) increase. Also, the actual speed of sound is
higher. This also increases problems with numerical solutions.
-
NAP6The elastic tube (aortic pulse wave propagation velocity = 8
m / s) and connected rigid tube (plexiglass). Puls flow at the
input generates an electronically controlled SuperPump (Varimex).
Output to stilling tank.MOC elastic and rigid pipeExample of
experiments from our laboratory (pulse wave causes deformation of
the aorta, and this is monitored by a pair of high-speed cameras,
DIC = Digital Image Correlation). Finite differences Lax Wendroff
and Muscle (Monotone Upstream Scheme for Conservation Laws) methods
are used. The problem is that these methods do not work when a
perfectly rigid tube is connected to an elastic tube (the rigid
tube has to be modeled as a flexible tube of a high rigidity).
Mathematicians say that in this hyperbolic equation can not be used
a boundary condition with the derivative. If they are right, the
following solution is wrong ...
- NAP6MOC elastic and rigid pipeLinear change of flowrate at
inlet (ramp function). Laminar and turbulent
regime.le=0.1;de=0.015;pe=0;mju=0.001;l=.18;d=0.015;rho=1000;a=8;v0=pump(0);ve=v0*(d/de)^2;f=frict(v0,d,rho,mju);fe=frict(ve,de,rho,mju);re=v0*d*rho/mjudpe=0.5*fe*le/de*rho*ve^2;dp=0.5*f*l/d*rho*v0^2;n=401;h=l/(n-1);v(1:n)=v0;p(1)=pe+dp+dpe;for
i=2:n
p(i)=p(i-1)-f*rho*v0^2*h/(2*d);enddt=h/a;tmax=3;itmax=tmax/dt; for
it=1:itmax t=it*dt; for i=2:n-1
pa=p(i-1);pb=p(i+1);va=v(i-1);vb=v(i+1);
fa=frict(va,d,rho,mju);fb=frict(vb,d,rho,mju);
ea=fa*h/(2*a*d)*va*abs(va); eb=fb*h/(2*a*d)*vb*abs(vb);
pc(i)=a/2*((pa+pb)/a+rho*(va-vb)+eb-ea);
vc(i)=0.5*((pa-pb)/(rho*a)+va+vb-eb-ea); end
vc(1)=pump(it*dt);vb=v(2);pb=p(2); fb=frict(vb,d,rho,mju);
pc(1)=pb+rho*a*(vc(1)-vb)+fb*h*rho/(2*d)*vb*abs(vb);
va=v(n-1);vb=v(n);pa=p(n-1); fb=frict(vb,d,rho,mju);
fa=frict(va,d,rho,mju);
pc(n)=(pc(n-1)/h+pe/le-fb*rho*vb*abs(vb)/(2*d*de)*(de-d))/(1/h+1/le);
vc(n)=va+1/(rho*a)*(pa-pc(n)-fa*h*rho/(2*d)*va*abs(va));
vres(it,1:n)=vc(1:n); pres(it,1:n)=pc(1:n); p=pc;v=vc;endfunction
vrel=pump(t)if t
-
NAP6MOC elastic and rigid pipeLinear increase of flowrate at
inlet (ramp). Laminar and turbulent regime.0.1810.180.1
-
NAP6MOC elastic and rigid pipeVelocity and pressure at the end
of the elastic tube. Reduction of frequency seems logical to me,
because increased inertial mass and unchanged elasticity (L=0.18,
Le=0.01, pmax=2946 Pa) (L=0.18, Le=0.1, pmax=3843
Pa).0.180.10.180.01
-
NAP6The lecture was devoted to the classification of partial
differential equations of second order, with special attention to
the hyberbolic type. Remember at least what is the next slideWhat
is important
- NAP6What is importantType of equation is determined by
coefficients at the highest (second) derivativesCharacteristics are
real if b2-4ac>0 (hyperbolic equation)One characteristic if
b2-4ac=0 (parabolic equation)Real characteristics do not exist if
b2-4ac