Upcoming SlideShare
×

Like this presentation? Why not share!

# Computational hydraulics IIT notes

## on Mar 25, 2013

• 424 views

### Views

Total Views
424
Views on SlideShare
424
Embed Views
0

Likes
0
17
0

No embeds

### Report content

• Comment goes here.
Are you sure you want to

## Computational hydraulics IIT notesPresentation Transcript

• Computational Hydraulics Prof. M.S.Mohan Kumar Department of Civil Engineering
• Introduction to Hydraulics of Open Channels Module 1 3 lectures
• Topics to be coveredBasic ConceptsConservation LawsCritical FlowsUniform FlowsGradually Varied FlowsRapidly Varied FlowsUnsteady Flows
• Basic ConceptsOpen Channel flows deal with flow of water in open channelsPressure is atmospheric at the water surface and thepressure is equal to the depth of water at any sectionPressure head is the ratio of pressure and the specific weightof waterElevation head or the datum head is the height of thesection under consideration above a datumVelocity head (=v2/2g) is due to the average velocity of flowin that vertical section
• Basic Concepts Cont… Total head =p/γ + v2/2g + z Pressure head = p/γ Velocity head =v2/2g Datum head = z The flow of water in an open channel is mainly due to headgradient and gravity Open Channels are mainly used to transport water forirrigation, industry and domestic water supply
• Conservation LawsThe main conservation laws used in open channels are Conservation Laws Conservation of Mass Conservation of Momentum Conservation of Energy
• Conservation of MassConservation of MassIn any control volume consisting of the fluid ( water) underconsideration, the net change of mass in the control volumedue to inflow and out flow is equal to the the net rate ofchange of mass in the control volume This leads to the classical continuity equation balancing theinflow, out flow and the storage change in the controlvolume. Since we are considering only water which is treated asincompressible, the density effect can be ignored
• Conservation of Momentum and energyConservation of MomentumThis law states that the rate of change of momentum in thecontrol volume is equal to the net forces acting on thecontrol volume Since the water under consideration is moving, it is actedupon by external forces Essentially this leads to the Newton’s second lawConservation of EnergyThis law states that neither the energy can be created ordestroyed. It only changes its form.
• Conservation of Energy Mainly in open channels the energy will be in the form of potential energyand kinetic energy Potential energy is due to the elevation of the water parcel while thekinetic energy is due to its movement In the context of open channel flow the total energy due these factorsbetween any two sections is conserved This conservation of energy principle leads to the classical Bernoulli’sequationP/γ + v2/2g + z = Constant When used between two sections this equation has to account for theenergy loss between the two sections which is due to the resistance to theflow by the bed shear etc.
• Types of Open Channel FlowsDepending on the Froude number (Fr) the flow in an openchannel is classified as Sub critical flow, Super Criticalflow, and Critical flow, where Froude number can be definedas F = V r gy Open channel flow Sub-critical flow Sub- Critical flow Super critical flow Fr<1 Fr=1 Fr>1
• Types of Open Channel Flow Cont… Steady FlowFlow is said to be steady when discharge does notchange along the course of the channel flow Unsteady FlowFlow is said to be unsteady when the dischargechanges with time Uniform FlowFlow is said to be uniform when both the depth anddischarge is same at any two sections of the channel
• Types of Open Channel Cont… Gradually Varied FlowFlow is said to be gradually varied when ever thedepth changes gradually along the channel Rapidly varied flowWhenever the flow depth changes rapidly along thechannel the flow is termed rapidly varied flow Spatially varied flowWhenever the depth of flow changes gradually dueto change in discharge the flow is termed spatiallyvaried flow
• Types of Open Channel Flow cont… Unsteady FlowWhenever the discharge and depth of flow changeswith time, the flow is termed unsteady flow Types of possible flow Steady uniform flow Steady non-uniform flow Unsteady non-uniform flow kinematic wave diffusion wave dynamic wave
• DefinitionsSpecific EnergyIt is defined as the energy acquired by the water at asection due to its depth and the velocity with which itis flowing Specific Energy E is given by, E = y + v2/2gWhere y is the depth of flow at that sectionand v is the average velocity of flow Specific energy is minimum at criticalcondition
• DefinitionsSpecific ForceIt is defined as the sum of the momentum of the flow passing through the channel section per unit time per unit weight of water and the force per unit weight of water F = Q2/gA +yA The specific forces of two sections are equal provided that the external forces and the weight effect of water in the reach between the two sections can be ignored. At the critical state of flow the specific force is a minimum for the given discharge.
• Critical FlowFlow is critical when the specific energy is minimum.Also whenever the flow changes from sub critical tosuper critical or vice versa the flow has to gothrough critical condition figure is shown in next slide Sub-critical flow-the depth of flow will be higherwhereas the velocity will be lower. Super-critical flow-the depth of flow will be lowerbut the velocity will be higher Critical flow: Flow over a free over-fall
• Specific energy diagram E=yDepth of water Surface (y) E-y curve 1 Emin y1 C Alternate Depths c 2 y 45° 2 Critical Depth Specific Energy (E) y Specific Energy Curve for a given discharge
• Characteristics of Critical Flow Specific Energy (E = y+Q2/2gA2) is minimum For Specific energy to be a minimum dE/dy = 0 dE Q 2 dA = 1− 3 ⋅ dy gA dy However, dA=Tdy, where T is the width of thechannel at the water surface, then applying dE/dy =0, will result in following Q 2Tc Ac Q2 Ac VC2 =1 = 2 = gAc 3 Tc gAc Tc g
• Characteristics of Critical FlowFor a rectangular channel Ac /Tc=ycFollowing the derivation for a rectangular channel, Vc Fr = =1 gy cThe same principle is valid for trapezoidal and othercross sectionsCritical flow condition defines an unique relationshipbetween depth and discharge which is very useful in thedesign of flow measurement structures
• Uniform Flows This is one of the most important concept in open channelflows The most important equation for uniform flow is Manning’sequation given by 1 2 / 3 1/ 2 V= R S nWhere R = the hydraulic radius = A/P P = wetted perimeter = f(y, S0)Y = depth of the channel bedS0 = bed slope (same as the energy slope, Sf)n = the Manning’s dimensional empirical constant
• Uniform Flows Energy Grade Line 2V12/2g 1 1 hf Sf v22/2gy1 Control Volume y2 So 1z1 z2 Datum Steady Uniform Flow in an Open Channel
• Uniform Flow Example : Flow in an open channel This concept is used in most of the open channel flow design The uniform flow means that there is no acceleration to theflow leading to the weight component of the flow beingbalanced by the resistance offered by the bed shear In terms of discharge the Manning’s equation is given by 1 Q = AR 2 / 3 S 1/ 2 n
• Uniform Flow This is a non linear equation in y the depth of flow for whichmost of the computations will be made Derivation of uniform flow equation is given below, whereW sin θ = weight component of the fluid mass in thedirection of flow τ0 = bed shear stress P∆x = surface area of the channel
• Uniform FlowThe force balance equation can be written as W sin θ − τ 0 P∆x = 0Or γA∆x sin θ − τ 0 P∆x = 0 AOr τ 0 = γ sin θ PNow A/P is the hydraulic radius, R, and sinθ isthe slope of the channel S0
• Uniform FlowThe shear stress can be expressed as τ 0 = c f ρ (V 2 / 2)Where cf is resistance coefficient, V is the meanvelocity ρ is the mass densityTherefore the previous equation can be written as V2 2gOr cf ρ = γRS 0 V = RS 0 = C RS 0 2 cfwhere C is Chezy’s constantFor Manning’s equation 1.49 1 / 6 C= R n
• Gradually Varied FlowFlow is said to be gradually varied whenever the depth offlow changed gradually The governing equation for gradually varied flow is given by dy S 0 − S f = dx 1 − Fr 2 Where the variation of depth y with the channel distance xis shown to be a function of bed slope S0, Friction Slope Sfand the flow Froude number Fr. This is a non linear equation with the depth varying as anon linear function
• Gradually Varied Flow Energy-grade line (slope = Sf) v2/2g Water surface (slope = Sw) y Channel bottom (slope = So) z Datum Total head at a channel section
• Gradually Varied FlowDerivation of gradually varied flow is as follows… The conservation of energy at two sections of a reach of length ∆x, can be written as 2 2 V1 V2 y1 + + S 0 ∆x = y 2 + + S f ∆x 2g 2g Now, let ∆y = y − y and V2 2 V1 2 d ⎛ V 2 ⎞ 2 1 − = ⎜⎜ ⎟∆x ⎟ 2g 2g dx ⎝ 2 g ⎠Then the above equation becomes d ⎛V 2 ⎞ ∆y = S 0 ∆x − S f ∆x − ⎜ ⎜ 2 g ⎟∆x ⎟ dx ⎝ ⎠
• Gradually Varied FlowDividing through ∆x and taking the limit as ∆xapproaches zero gives us dy d ⎛ V 2 ⎞ + ⎜ ⎜ 2g ⎟ = S0 − S f ⎟ dx dx ⎝ ⎠After simplification, dy S0 − S f = ( ) dx 1 + d V 2 / 2 g / dyFurther simplification can be done in terms ofFroude number d ⎛V 2 ⎞ d ⎛ Q2 ⎞ ⎜ ⎜ 2 g ⎟ = dy ⎜ 2 gA 2 ⎟ ⎜ ⎟ ⎟ dy ⎝ ⎠ ⎝ ⎠
• Gradually Varied FlowAfter differentiating the right side of the previousequation, d ⎛ V ⎞ − 2Q dA 2 2 ⎜ 2 g ⎟ = 2 gA 3 ⋅ dy ⎜ ⎟ dy ⎝ ⎠But dA/dy=T, and A/T=D, therefore, d ⎛V 2 ⎞ − Q2 ⎜ ⎟= = − Fr 2 dy ⎜ 2 g ⎟ gA 2 D ⎝ ⎠Finally the general differential equation can bewritten as dy S 0 − S f = dx 1 − Fr 2
• Gradually Varied Flow Numerical integration of the gradually varied flow equationwill give the water surface profile along the channel Depending on the depth of flow where it lies when comparedwith the normal depth and the critical depth along with thebed slope compared with the friction slope different types ofprofiles are formed such as M (mild), C (critical), S (steep)profiles. All these have real examples. M (mild)-If the slope is so small that the normal depth(Uniform flow depth) is greater than critical depth for thegiven discharge, then the slope of the channel is mild.
• Gradually Varied FlowC (critical)-if the slope’s normal depth equals its criticaldepth, then we call it a critical slope, denoted by CS (steep)-if the channel slope is so steep that a normaldepth less than critical is produced, then the channel issteep, and water surface profile designated as S
• Rapidly Varied Flow This flow has very pronounced curvature of the streamlines It is such that pressure distribution cannot be assumed to be hydrostatic The rapid variation in flow regime often take place in short span When rapidly varied flow occurs in a sudden-transition structure, the physical characteristics of the flow are basically fixed by the boundary geometry of the structure as well as by the state of the flowExamples: Channel expansion and cannel contraction Sharp crested weirs Broad crested weirs
• Unsteady flowsWhen the flow conditions vary with respect to time, we callit unsteady flows.Some terminologies used for the analysis of unsteady flowsare defined below:Wave: it is defined as a temporal or spatial variation of flowdepth and rate of discharge.Wave length: it is the distance between two adjacent wavecrests or troughAmplitude: it is the height between the maximum waterlevel and the still water level
• Unsteady flows definitionsWave celerity (c): relative velocity of a wave with respectto fluid in which it is flowing with VAbsolute wave velocity (Vw): velocity with respect tofixed reference as given below Vw = V ± cPlus sign if the wave is traveling in the flow direction andminus for if the wave is traveling in the direction opposite toflowFor shallow water waves c = gy0 where y0=undisturbedflow depth.
• Unsteady flows examplesUnsteady flows occur due to following reasons:1. Surges in power canals or tunnels2. Surges in upstream or downstream channels produced by starting or stopping of pumps and opening and closing of control gates3. Waves in navigation channels produced by the operation of navigation locks4. Flood waves in streams, rivers, and drainage channels due to rainstorms and snowmelt5. Tides in estuaries, bays and inlets
• Unsteady flowsUnsteady flow commonly encountered in an open channelsand deals with translatory waves. Translatory waves is agravity wave that propagates in an open channel andresults in appreciable displacement of the water particles ina direction parallel to the flowFor purpose of analytical discussion, unsteady flow isclassified into two types, namely, gradually varied andrapidly varied unsteady flowIn gradually varied flow the curvature of the wave profile ismild, and the change in depth is gradualIn the rapidly varied flow the curvature of the wave profileis very large and so the surface of the profile may becomevirtually discontinuous.
• Unsteady flows cont…Continuity equation for unsteady flow in an openchannel ∂V ∂y ∂y D +V + =0 ∂x ∂x ∂tFor a rectangular channel of infinite width, may bewritten ∂q ∂y + =0 ∂x ∂tWhen the channel is to feed laterally with asupplementary discharge of q’ per unit length, forinstance, into an area that is being flooded over adike
• Unsteady flows cont…The equation ∂Q ∂A + + q = 0 ∂x ∂tThe general dynamic equation for graduallyvaried unsteady flow is given by: ∂y αV ∂V 1 ∂V + + =0 ∂x g ∂x g ∂t
• Review of Hydraulics of Pipe Flows Module2 3 lectures
• ContentsGeneral introductionEnergy equationHead loss equationsHead discharge relationshipsPipe transients flows throughpipe networksSolving pipe network problems
• General IntroductionPipe flows are mainly due to pressure difference betweentwo sectionsHere also the total head is made up of pressure head, datumhead and velocity headThe principle of continuity, energy, momentum is also usedin this type of flow.For example, to design a pipe, we use the continuity andenergy equations to obtain the required pipe diameterThen applying the momentum equation, we get the forcesacting on bends for a given discharge
• General introductionIn the design and operation of a pipeline, the mainconsiderations are head losses, forces and stressesacting on the pipe material, and discharge.Head loss for a given discharge relates to flowefficiency; i.e an optimum size of pipe will yield theleast overall cost of installation and operation forthe desired discharge.Choosing a small pipe results in low initial costs,however, subsequent costs may be excessivelylarge because of high energy cost from large headlosses
• Energy equation The design of conduit should be such that it needs least cost for a given discharge The hydraulic aspect of the problem require applying the one dimensional steady flow form of the energy equation: p1 V12 p2 2 V2 + α1 + z1 + h p = + α2 + z2 + ht + hL γ 2g γ 2gWhere p/γ =pressure head αV2/2g =velocity head z =elevation head hp=head supplied by a pump ht =head supplied to a turbine hL =head loss between 1 and 2
• Energy equation Energy Grade Line Hydraulic Grade Line z2 v2/2g p/y hp z1 z Pump z=0 DatumThe Schematic representation of the energy equation
• Energy equationVelocity head In αV2/2g, the velocity V is the mean velocity in the conduit at a given section and is obtained by V=Q/A, where Q is the discharge, and A is the cross-sectional area of the conduit. The kinetic energy correction factor is given by α, and it is defines as, where u=velocity at any point in the section 3 ∫ u dA α= A V 3A α has minimum value of unity when the velocity is uniform across the section
• Energy equation cont…Velocity head cont… α has values greater than unity depending on the degree of velocity variation across a section For laminar flow in a pipe, velocity distribution is parabolic across the section of the pipe, and α has value of 2.0 However, if the flow is turbulent, as is the usual case for water flow through the large conduits, the velocity is fairly uniform over most of the conduit section, and α has value near unity (typically: 1.04< α < 1.06). Therefore, in hydraulic engineering for ease of application in pipe flow, the value of α is usually assumed to be unity, and the velocity head is then simply V2/2g.
• Energy equation cont…Pump or turbine head The head supplied by a pump is directly related to the power supplied to the flow as given below P = Qγh p Likewise if head is supplied to turbine, the power supplied to the turbine will be P = Qγht These two equations represents the power supplied directly or power taken out directly from the flow
• Energy equation cont…Head-loss term The head loss term hL accounts for the conversion of mechanical energy to internal energy (heat), when this conversion occurs, the internal energy is not readily converted back to useful mechanical energy, therefore it is called head loss Head loss results from viscous resistance to flow (friction) at the conduit wall or from the viscous dissipation of turbulence usually occurring with separated flow, such as in bends, fittings or outlet works.
• Head loss calculationHead loss is due to friction between the fluid andthe pipe wall and turbulence within the fluidThe rate of head loss depend on roughnesselement size apart from velocity and pipe diameterFurther the head loss also depends on whether thepipe is hydraulically smooth, rough or somewherein betweenIn water distribution system , head loss is also dueto bends, valves and changes in pipe diameter
• Head loss calculationHead loss for steady flow through a straight pipe: τ 0 A w = ∆ pA r ∆p = 4Lτ 0 / D τ 0 = fρ V 2 / 8 ∆p L V2 h = = f γ D 2gThis is known as Darcy-Weisbach equationh/L=S, is slope of the hydraulic and energy gradelines for a pipe of constant diameter
• Head loss calculationHead loss in laminar flow: 32Vµ Hagen-Poiseuille equation gives S= D 2 ρg Combining above with Darcy-Weisbach equation, gives f 64 µ f = ρVD Also we can write in terms of Reynolds number 64 f = Nr This relation is valid for Nr<1000
• Head loss calculationHead loss in turbulent flow: In turbulent flow, the friction factor is a function of both Reynolds number and pipe roughness As the roughness size or the velocity increases, flow is wholly rough and f depends on the relative roughness Where graphical determination of the friction factor is acceptable, it is possible to use a Moody diagram. This diagram gives the friction factor over a wide range of Reynolds numbers for laminar flow and smooth, transition, and rough turbulent flow
• Head loss calculation The quantities shown in Moody Diagram are dimensionless so they can be used with any system of units Moody’s diagram can be followed from any reference bookMINOR LOSSES Energy losses caused by valves, bends and changes in pipe diameter This is smaller than friction losses in straight sections of pipe and for all practical purposes ignored Minor losses are significant in valves and fittings, which creates turbulence in excess of that produced in a straight pipe
• Head loss calculationMinor losses can be expressed in three ways:1. A minor loss coefficient K may be used to give head loss as a function of velocity head, V2 h=K 2g2. Minor losses may be expressed in terms of the equivalent length of straight pipe, or as pipe diameters (L/D) which produces the same head loss. 2 LV h= f D 2g
• Head loss calculation1. A flow coefficient Cv which gives a flow that will pass through the valve at a pressure drop of 1psi may be specified. Given the flow coefficient the head loss can be calculated as 18.5 × 106 D 4V 2 h= 2 Cv 2 gThe flow coefficient can be related to the minor loss coefficient by 18.5 × 106 D 2 K= 2 Cv
• Energy Equation for Flow in pipesEnergy equation for pipe flow P V12 P2 V22 z1 + 1 + = z2 + + + hL ρg 2 g ρg 2 gThe energy equation represents elevation, pressure, and velocity formsof energy. The energy equation for a fluid moving in a closed conduit iswritten between two locations at a distance (length) L apart. Energylosses for flow through ducts and pipes consist of major losses andminor losses.Minor Loss Calculations for Fluid Flow V2 hm = K 2gMinor losses are due to fittings such as valves and elbows
• Major Loss Calculation for Fluid Flow Using Darcy-Weisbach Friction Loss Equation Major losses are due to friction between the moving fluid and the inside walls of the duct. The Darcy-Weisbach method is generally considered more accurate than the Hazen-Williams method. Additionally, the Darcy-Weisbach method is valid for any liquid or gas. Moody Friction Factor Calculator
• Major Loss Calculation in pipesUsing Hazen-Williams Friction Loss EquationHazen-Williams is only valid for water at ordinarytemperatures (40 to 75oF). The Hazen-Williams method isvery popular, especially among civil engineers, since itsfriction coefficient (C) is not a function of velocity or duct(pipe) diameter. Hazen-Williams is simpler than Darcy-Weisbach for calculations where one can solve for flow-rate, velocity, or diameter
• Transient flow through long pipesIntermediate flow while changing from onesteady state to another is called transientflowThis occurs due to design or operatingerrors or equipment malfunction.This transient state pressure causes lots ofdamage to the network systemPressure rise in a close conduit caused by aninstantaneous change in flow velocity
• Transient flow through long pipesIf the flow velocity at a point does vary with time, the flowis unsteadyWhen the flow conditions are changed from one steadystate to another, the intermediate stage flow is referred toas transient flowThe terms fluid transients and hydraulic transients are usedin practiceThe different flow conditions in a piping system arediscussed as below:
• Transient flow through long pipesConsider a pipe length of length LWater is flowing from a constant level upstream reservoirto a valve at downstreamAssume valve is instantaneously closed at time t=t0 fromthe full open position to half open position.This reduces the flow velocity through the valve, therebyincreasing the pressure at the valve
• Transient flow through long pipes The increased pressure will produce a pressure wave that will travel back and forth in the pipeline until it is dissipated because of friction and flow conditions have become steady again This time when the flow conditions have become steady again, let us call it t1. So the flow regimes can be categorized into1. Steady flow for t<t02. Transient flow for t0<t<t13. Steady flow for t>t1
• Transient flow through long pipesTransient-state pressures are sometimes reduced to thevapor pressure of a liquid that results in separating theliquid column at that section; this is referred to as liquid-column separationIf the flow conditions are repeated after a fixed timeinterval, the flow is called periodic flow, and the timeinterval at which the conditions are repeated is calledperiodThe analysis of transient state conditions in closed conduitsmay be classified into two categories: lumped-systemapproach and distributed system approach
• Transient flow through long pipesIn the lumped system approach the conduit wallsare assumed rigid and the liquid in the conduit isassumed incompressible, so that it behaves like arigid mass, other way flow variables are functionsof time only.In the distributed system approach the liquid isassumed slightly compressibleTherefore flow velocity vary along the length of theconduit in addition to the variation in time
• Transient flow through long pipesFlow establishment The 1D form of momentum equation for a control volume that is fixed in space and does not change shape may be written as d 2 2 ∑F = ∫ ρ VAdx + ( ρAV ) out − ( ρ AV ) in dt If the liquid is assumed incompressible and the pipe is rigid, then at any instant the velocity along the pipe will be same, ( ρ AV 2 ) in = ( ρ AV 2 ) out
• Transient flow through long pipes Substituting for all the forces acting on the control volume d pA + γAL sin α − τ 0πDL = (V ρ AL ) dtWhere p =γ(h-V2/2g)α=pipe slopeD=pipe diameterL=pipe lengthγ =specific weight of fluidτ0=shear stress at the pipe wall
• Transient flow through long pipesFrictional force is replaced by γhfA, and H0=h+Lsin α and hffrom Darcy-weisbach friction equationThe resulting equation yields: fL V 2 V 2 L dV H0 − − = . D 2g 2g g dtWhen the flow is fully established, dV/dt=0.The final velocity V0 will be such that ⎡ fL ⎤ V0 2 H 0 = ⎢1 + ⎣ D ⎥ 2g ⎦We use the above relationship to get the time for flow toestablish 2 LD dV dt = . D + fL V02 − V 2
• Transient flow through long pipesChange in pressure due to rapid flow changes When the flow changes are rapid, the fluid compressibility is needed to taken into account Changes are not instantaneous throughout the system, rather pressure waves move back and forth in the piping system. Pipe walls to be rigid and the liquid to be slightly compressible
• Transient flows through long pipesAssume that the flow velocity at the downstreamend is changed from V to V+∆V, thereby changingthe pressure from p to p+∆pThe change in pressure will produce a pressurewave that will propagate in the upstream directionThe speed of the wave be aThe unsteady flow situation can be transformed intosteady flow by assuming the velocity referencesystem move with the pressure wave
• Transient flows through long pipesUsing momentum equation with control volume approach tosolve for ∆pThe system is now steady, the momentum equation nowyield pA − ( p + ∆p) A = (V + a + ∆V )( ρ + ∆ρ )(V + a + ∆V ) A − (V + a ) ρ (V + a ) ABy simplifying and discarding terms of higher order, thisequation becomes ( − ∆p = 2 ρV∆V + 2 ρ∆Va + ∆ρ V 2 + 2Va + a 2 )The general form of the equation for conservation of massfor one-dimensional flows may be written as x2 d 0 = ∫ ρAdx + (ρVA)out − (ρVA)in dt x1
• Transient flows through long pipesFor a steady flow first term on the right hand side is zero, then we obtain 0 = (ρ + ∆ρ )(V + a + ∆V )A − ρ (V + a )ASimplifying this equation, We have ρ∆V ∆ρ = − V +aWe may approximate (V+a) as a, because V<<a ρ∆V ∆ρ = − aSince ∆p = ρg∆H we can write as a ∆H = − ∆V gNote: change in pressure head due to an instantaneous change in flowvelocity is approximately 100 times the change in the flow velocity
• Introduction to Numerical Analysis and Its Role inComputational Hydraulics Module 3 2 lectures
• ContentsNumerical computingComputer arithmeticParallel processingExamples of problemsneeding numericaltreatment
• What is computational hydraulics?It is one of the many fields of science in which theapplication of computers gives rise to a new wayof working, which is intermediate between purelytheoretical and experimental.The hydraulics that is reformulated to suit digitalmachine processes, is called computationalhydraulicsIt is concerned with simulation of the flow ofwater, together with its consequences, usingnumerical methods on computers
• What is computational hydraulics?There is not a great deal of difference withcomputational hydrodynamics or computationalfluid dynamics, but these terms are too muchrestricted to the fluid as such.It seems to be typical of practical problems inhydraulics that they are rarely directed to the flowby itself, but rather to some consequences of it,such as forces on obstacles, transport of heat,sedimentation of a channel or decay of a pollutant.
• Why numerical computingThe higher mathematics can be treated by this methodWhen there is no analytical solution, numerical analysiscan deal such physical problemsExample: y = sin (x), has no closed form solution.The following integral gives the length of one arch of theabove curve π ∫ 0 1 + cos 2 ( x ) dxNumerical analysis can compute the length of this curve bystandard methods that apply to essentially any integrandNumerical computing helps in finding effective and efficientapproximations of functions
• Why Numerical computing?linearization of non linear equationsSolves for a large system of linear equationsDeals the ordinary differential equations of anyorder and complexityNumerical solution of Partial differentialequations are of great importance in solvingphysical world problemsSolution of initial and boundary value problemsand estimates the eigen values andeigenvectors.Fit curves to data by a variety of methods
• Computer arithmeticNumerical method is tedious and repetitive arithmetic,which is not possible to solve without the help of computer.On the other hand Numerical analysis is an approximation,which leads towards some degree of errorsThe errors caused by Numerical treatment are defined interms of following:Truncation error : the ex can be approximated throughcubic polynomial as shown below x x2 x3 p3 ( x ) = 1 + + + 1! 2! 3!ex is an infinitely long series as given below and the error isdue to the truncation of the series ∞ xn e = p3 ( x) + ∑ x n = 4 n!
• Computer arithmetic• Round-off error : digital computers always use floating point numbers of fixed word length; the true values are not expressed exactly by such representations. Such error due to this computer imperfection is round-off error.• Error in original data : any physical problem is represented through mathematical expressions which have some coefficients that are imperfectly known.• Blunders : computing machines make mistakes very infrequently, but since humans are involved in programming, operation, input preparation, and output interpretation, blunders or gross errors do occur more frequently than we like to admit.• Propagated error : propagated error is the error caused in the succeeding steps due to the occurrence of error in the earlier step, such error is in addition to the local errors. If the errors magnified continuously as the method continues, eventually they will overshadow the true value, destroying its validity, we call such a method unstable. For stable method (which is desired)– errors made at early points die out as the method continues.
• Parallel processingIt is a computing method that can only beperformed on systems containing two or moreprocessors operating simultaneously. Parallelprocessing uses several processors, all working ondifferent aspects of the same program at the sametime, in order to share the computational loadFor extremely large scale problems (short termweather forecasting, simulation to predictaerodynamics performance, image processing,artificial intelligence, multiphase flow in groundwater regime etc), this speeds up the computationadequately.
• Parallel processingMost computers have just one CPU, butsome models have several. There are evencomputers with thousands of CPUs. Withsingle-CPU computers, it is possible toperform parallel processing by connectingthe computers in a network. However, thistype of parallel processing requires verysophisticated software called distributedprocessing software.Note that parallel processing differs frommultitasking, in which a single CPU executesseveral programs at once.
• Parallel processingTypes of parallel processing job: In general there are three types of parallel computing jobs Parallel task Parametric sweep Task flowParallel taskA parallel task can take a number of forms, depending on the application and the software that supports it. For a Message Passing Interface (MPI) application, a parallel task usually consists of a single executable running concurrently on multiple processors, with communication between the processes.
• Parallel processingParametric SweepA parametric sweep consists of multiple instances of the same program, usually serial, running concurrently, with input supplied by an input file and output directed to an output file. There is no communication or interdependency among the tasks. Typically, the parallelization is performed exclusively (or almost exclusively) by the scheduler, based on the fact that all the tasks are in the same job.Task flow A task flow job is one in which a set of unlike tasks are executed in a prescribed order, usually because one task depends on the result of another task.
• Introduction to numerical analysisAny physical problem in hydraulics is representedthrough a set of differential equations.These equations describe the very fundamentallaws of conservation of mass and momentum interms of the partial derivatives of dependentvariables.For any practical purpose we need to know thevalues of these variables instead of the values oftheir derivatives.
• Introduction to numerical analysisThese variables are obtained from integrating thoseODEs/PDEs.Because of the presence of nonlinear terms a closed formsolution of these equations is not obtainable, except forsome very simplified casesTherefore they need to be analyzed numerically, for whichseveral numerical methods are availableGenerally the PDEs we deal in the computational hydraulicsis categorized as elliptic, parabolic and hyperbolic equations
• Introduction to numerical analysisThe following methods have been used for numerical integration of the ODEs Euler method Modified Euler method Runge-Kutta method Predictor-Corrector method
• Introduction to numerical analysisThe following methods have been used for numerical integration of the PDEs Characteristics method Finite difference method Finite element method Finite volume method Spectral method Boundary element method
• Problems needing numerical treatmentComputation of normal depthComputation of water-surface profilesContaminant transport in streams throughan advection-dispersion processSteady state Ground water flow systemUnsteady state ground water flow systemFlows in pipe networkComputation of kinematic and dynamicwave equations
• Solution of System ofLinear and Non Linear Equations Module 4 (4 lectures)
• ContentsSet of linear equationsMatrix notationMethod ofsolution:direct anditerativePathology of linearsystemsSolution of nonlinearsystems :Picard andNewton techniques
• Sets of linear equationsReal world problems are presented through a set ofsimultaneous equations F1 ( x1, x2 ,..., xn ) = 0 F2 ( x1, x2 ,..., xn ) = 0 . . . Fn ( x1, x2 ,..., xn ) = 0Solving a set of simultaneous linear equations needsseveral efficient techniquesWe need to represent the set of equations through matrixalgebra
• Matrix notationMatrix : a rectangular array (n x m) of numbers ⎡ a11 a12 . . . a1m ⎤ ⎢a21 a22 . . . a2 m ⎥ ⎢ . ⎥ [ ] A = aij = ⎢ . ⎢ . . ⎥ ⎥ ⎢ . . ⎥ ⎢ an1 an 2 . . . anm ⎥ ⎣ ⎦ nxmMatrix Addition:C = A+B = [aij+ bij] = [cij], where cij = aij + bijMatrix Multiplication:AB = C = [aij][bij] = [cij], where m cij = ∑ aik bkj i = 1,2,..., n, j = 1,2,..., r. k =1
• Matrix notation cont…*AB ≠ BA kA = C, where cij = kaijA general relation for Ax = b is No.ofcols. bi = ∑ aik xk , i = 1,2,..., No.ofrows k =1
• Matrix notation cont…Matrix multiplication gives set of linear equations as:a11x1+ a12x2+…+ a1nxn = b1,a21x1+ a22x2+…+ a2nxn = b2,. . .. . .. . .an1x1+ an2x2+…+ annxn = bn,In simple matrix notation we can write:Ax = b, where ⎡ a11 a12 . . . a1m ⎤ ⎡ x1 ⎤ ⎡ b1 ⎤ ⎢a21 a22 . . . a2 m ⎥ ⎢ x2 ⎥ ⎢b2 ⎥ ⎢ . ⎥ ⎢ . ⎥ ⎢.⎥ A=⎢ . ⎥, x = ⎢ ⎥, b = ⎢ ⎥, ⎢ . . ⎥ ⎢ . . ⎥ ⎢ . ⎥ ⎢.⎥ ⎢ an1 an 2 . . . anm ⎥ ⎢ . ⎥ ⎢.⎥ ⎣ ⎦ ⎢ xn ⎥ ⎣ ⎦ ⎢bn ⎥ ⎣ ⎦
• Matrix notation cont…Diagonal matrix ( only diagonal elements of asquare matrix are nonzero and all off-diagonalelements are zero)Identity matrix ( diagonal matrix with alldiagonal elements unity and all off-diagonalelements are zero)The order 4 identity matrix is shown below ⎡1 0 0 0⎤ ⎢0 1 0 0⎥ = I . ⎢0 0 1 0⎥ 4 ⎢0 ⎣ 0 0 1⎥ ⎦
• Matrix notation cont…Lower triangular matrix: ⎡a 0 0⎤if all the elements above the L = ⎢b d 0⎥ ⎢c e ⎣ f⎥ ⎦diagonal are zeroUpper triangular matrix: ⎡a b c⎤ U = ⎢0 d e⎥if all the elements below the ⎢0 0 f⎥ ⎣ ⎦diagonal are zeroTri-diagonal matrix: if ⎡a b 0 0 0⎤nonzero elements only on ⎢c d e 0 0⎥the diagonal and in the T = ⎢0 f g h 0⎥ ⎢0 0 i j k⎥position adjacent to the ⎢0 ⎣ 0 0 l m⎥ ⎦diagonal
• Matrix notation cont…Transpose of a matrix A Examples(AT): Rows are written ascolumns or vis a versa.Determinant of a square ⎡3 −1 4⎤ A = ⎢ 0 2 − 3⎥matrix A is given by: ⎢1 1 2⎥ ⎣ ⎦ ⎡a a ⎤ ⎡ 3 0 1⎤ A = ⎢ 11 12 ⎥ T ⎣a21 a22 ⎦ A = ⎢− 1 2 1⎥ ⎢ 4 − 3 2⎥ ⎣ ⎦ det( A) = a11a22 − a21a12
• Matrix notation cont…Characteristic polynomial pA(λ) and eigenvaluesλ of a matrix:Note: eigenvalues are most important in appliedmathematicsFor a square matrix A: we define pA(λ) as pA(λ) = ⏐A - λI⏐ = det(A - λI).If we set pA(λ) = 0, solve for the roots, we geteigenvalues of AIf A is n x n, then pA(λ) is polynomial of degreenEigenvector w is a nonzero vector such thatAw= λw, i.e., (A - λI)w=0
• Methods of solution of set of equationsDirect methods are those that provide the solution in a finite and pre- determinable number of operations using an algorithm that is often relatively complicated. These methods are useful in linear system of equations.Direct methods of solutionGaussian elimination method 4 x1 − 2 x 2 + x 3 = 15 − 3 x1 − x 2 + 4 x 3 = 8 x1 − x 2 + 3 x 3 = 13Step1: Using Matrix notation we can represent the set of equations as ⎡ 4 −2 1⎤ ⎢ ⎥ ⎡ x1 ⎤ ⎡15 ⎤ ⎢− 3 −1 4 ⎥ ⎢ x2 ⎥ = ⎢ 8 ⎥ ⎢ ⎥ ⎢ x 3 ⎥ ⎢13 ⎥ ⎣ 1 −1 3⎦ ⎣ ⎦ ⎣ ⎦
• Methods of solution cont…Step2: The Augmented coefficient matrix with the right-hand sidevector ⎡ 4 −2 1 M 15 ⎤ A Mb = ⎢ − 3 −1 4 M 8⎥ ⎢ 1 ⎣ −1 3 M 13⎥⎦Step3: Transform the augmented matrix into Upper triangular form ⎡ 4 −2 1 15 ⎤ ⎡ 4 −2 1 15 ⎤ ⎢− 3 −1 4 8⎥ , 3R1 + 4 R2 → ⎢ 0 − 10 19 77 ⎥ ⎢ 1 −1 3 13⎥ (−1) R1 + 4 R3 → ⎢ 0 ⎣ −2 11 37 ⎥ ⎦ ⎣ ⎦ ⎡ 4 −2 1 15⎤ ⎢ 0 − 10 19 77⎥ 2 R2 − 10 R3 → ⎢ ⎣ 0 0 − 72 − 216⎥ ⎦Step4: The array in the upper triangular matrix represents theequations which after Back-substitution gives the solution the valuesof x1,x2,x3
• Method of solution cont… During the triangularization step, if a zero isencountered on the diagonal, we can not usethat row to eliminate coefficients below thatzero element, in that case we perform theelementary row operations we begin with the previous augmentedmatrix in a large set of equations multiplicationswill give very large and unwieldy numbers tooverflow the computers register memory, wewill therefore eliminate ai1/a11 times the firstequation from the i th equation
• Method of solution cont…to guard against the zero in diagonal elements,rearrange the equations so as to put thecoefficient of largest magnitude on the diagonal ateach step. This is called Pivoting. The diagonalelements resulted are called pivot elements.Partial pivoting , which places a coefficient oflarger magnitude on the diagonal by rowinterchanges only, will guarantee a nonzero divisorif there is a solution of the set of equations.The round-off error (chopping as well as rounding)may cause large effects. In certain cases thecoefficients sensitive to round off error, are calledill-conditioned matrix.
• Method of solution cont…LU decomposition of A if the coefficient matrix A can be decomposed into lower and upper triangular matrix then we write: A=L*U, usually we get L*U=A’, where A’ is the permutation of the rows of A due to row interchange from pivoting Now we get det(L*U)= det(L)*det(U)=det(U) Then det(A)=det(U)Gauss-Jordan method In this method, the elements above the diagonal are made zero at the same time zeros are created below the diagonal
• Method of solution cont…Usually diagonal elements are made unity,at the same time reduction is performed,this transforms the coefficient matrix intoan identity matrix and the column of theright hand side transforms to solutionvectorPivoting is normally employed to preservethe arithmetic accuracy
• Method of solution cont…Example:Gauss-Jordan method Consider the augmented matrix as ⎡0 2 0 1 0 ⎤ ⎢2 2 3 2 − 2⎥ ⎢4 − 3 0 1 − 7⎥ ⎢6 1 − 6 − 5 6 ⎥ ⎣ ⎦ Step1: Interchanging rows one and four, dividing the first row by 6, and reducing the first column gives ⎡1 0.16667 − 1 − 0.83335 1 ⎤ ⎢0 1.66670 5 3.66670 − 4 ⎥ ⎢ ⎥ ⎢0 − 3.66670 4 4.33340 − 11⎥ ⎢ ⎥ ⎣ 0 2 0 1 0 ⎦
• Method of solution cont…Step2: Interchanging rows 2 and 3, dividing the2nd row by –3.6667, and reducing the secondcolumn gives ⎡1 0 − 1.5000 − 1.20001.4000 ⎤ ⎢0 1 2.9999 2.2000− 2.4000 ⎥ ⎢ ⎥ ⎢0 0 15.0000 12.4000 − 19.8000⎥ ⎢ ⎥ ⎣0 0 − 5.9998 − 3.4000 4.8000 ⎦Step3: We divide the 3rd row by 15.000 andmake the other elements in the third columninto zeros
• Method of solution cont… ⎡1 0 0 0.04000 − 0.58000⎤ ⎢0 1 0 − 0.27993 1.55990 ⎥ ⎢ ⎥ ⎢0 0 1 0.82667 − 1.32000 ⎥ ⎢ ⎥ ⎣0 0 0 1.55990 − 3.11970⎦Step4: now divide the 4th row by 1.5599 and create zerosabove the diagonal in the fourth column ⎡1 0 0 0 − 0.49999⎤ ⎢0 1 0 0 1.00010 ⎥ ⎢ ⎥ ⎢0 0 1 0 0.33326 ⎥ ⎢ ⎥ ⎣0 0 0 1 − 1.99990 ⎦
• Method of solution cont…Other direct methods of solutionCholesky reduction (Doolittle’s method) Transforms the coefficient matrix,A, into the product of two matrices, L and U, where U has ones on its main diagonal.Then LU=A can be written as⎡ l11 0 0 0 ⎤ ⎡1 u12 u13 u14 ⎤ ⎡ a11 a12 a13 a14 ⎤⎢l21 l22 0 0 ⎥ ⎢0 1 u23 u24 ⎥ ⎢a21 a22 a23 a24 ⎥⎢l ⎥ ⎢0 0 ⎥ = ⎢a a34 ⎥⎢ 31 l32 l33 0 ⎥⎢ 1 u34 ⎥ ⎢ 31 a32 a33 ⎥⎢l41 l32⎣ l43 l44 ⎥ ⎢0 0 ⎦⎣ 0 1 ⎥ ⎢a41 a42 ⎦ ⎣ a43 a44 ⎥ ⎦
• Method of solution cont…The general formula for getting theelements of L and U corresponding to thecoefficient matrix for n simultaneousequation can be written as j −1 lij = aij − ∑ lik ukj j ≤ i, i = 1,2,..., n li1 = ai1 k =1 j −1 aij − ∑ lik ukj a1 j a1 j uij = k =1 i ≤ j, j = 2,3,..., n. u1 j = = l11 a11 lii
• Method of solution cont…Iterative methods consists of repeated application of an algorithm that is usually relatively simpleIterative method of solution coefficient matrix is sparse matrix ( has many zeros), this method is rapid and preferred over direct methods, applicable to sets of nonlinear equations Reduces computer memory requirements Reduces round-off error in the solutions computed by direct methods
• Method of solution cont…Two types of iterative methods: These methods aremainly useful in nonlinear system of equations. Iterative Methods Point iterative method Block iterative method Jacobi method Gauss-Siedel Method Gauss- Successive over-relaxation method over-
• Methods of solution cont…Jacobi method Rearrange the set of equations to solve for the variable with the largest coefficientExample: 6 x1 − 2 x2 + x3 = 11, x1 + 2 x2 − 5 x3 = −1, − 2 x1 + 7 x2 + 2 x3 = 5. x1 = 1.8333 + 0.3333x2 − 0.1667 x3 x2 = 0.7143 + 0.2857 x1 − 0.2857 x3 x3 = 0.2000 + 0.2000 x1 + 0.4000 x2 Some initial guess to the values of the variables Get the new set of values of the variables
• Methods of solution cont…Jacobi method cont… The new set of values are substituted in the right hand sides of the set of equations to get the next approximation and the process is repeated till the convergence is reached Thus the set of equations can be written as x1n +1) = 1.8333 + 0.3333x2n) − 0.1667 x3n) ( ( ( x2n +1) = 0.7143 + 0.2857 x1n) − 0.2857 x3n) ( ( ( x3n +1) = 0.2000 + 0.2000 x1n) + 0.4000 x2n) ( ( (
• Methods of solution cont…Gauss-Siedel method Rearrange the equations such that each diagonal entry is larger in magnitude than the sum of the magnitudes of the other coefficients in that row (diagonally dominant) Make initial guess of all unknowns Then Solve each equation for unknown, the iteration will converge for any starting guess values Repeat the process till the convergence is reached
• Methods of solution cont…Gauss-Siedel method cont… For any equation Ax=c we can write ⎡ ⎤ 1 ⎢ n ⎥ xi = ⎢ci − ∑ aij x j ⎥, aii ⎢ i = 1,2,..., n j =1 ⎥ ⎢ ⎣ j ≠i ⎥ ⎦ In this method the latest value of the xi are used in the calculation of further xi
• Methods of solution cont…Successive over-relaxation method This method rate of convergence can be improved by providing accelerators For any equation Ax=c we can write ~ k +1 = 1 ⎡c − i −1 a x k +1 − n a x k ⎤, ⎢ i ∑ ij j xi ∑ ij j ⎥ aii ⎢ ⎣ j =1 j =i +1 ⎥ ⎦ xik +1 = xik + w( ~ik +1 − xik ) x i = 1,2,..., n
• Methods of solution cont…Successive over-relaxation method cont… Where ~ik +1 determined using standard x Gauss-Siedel algorithm k=iteration level, w=acceleration parameter (>1) Another form k +1 k w i −1 k +1 n xi = (1 − w) xi + (ci − ∑ aij x j − ∑ aij x k ) j aii j =1 j =i +1
• Methods of solution cont…Successive over-relaxation method cont..Where 1<w<2: SOR method 0<w<1: weighted average Gauss Siedel method Previous value may be needed in nonlinear problems It is difficult to estimate w
• Matrix Inversion Sometimes the problem of solving the linear algebraic system is loosely referred to as matrix inversion Matrix inversion means, given a square matrix [A] with nonzero determinant, finding a second matrix [A-1] having the property that [A-1][A]=[I], [I] is the identity matrix[A]x=cx= [A-1]c[A-1][A]=[I]=[A][A-1]
• Pathology of linear systemsAny physical problem modeled by a set of linearequationsRound-off errors give imperfect prediction ofphysical quantities, but assures the existence ofsolutionArbitrary set of equations may not assure uniquesolution, such situation termed as “pathological”Number of related equations less than the numberof unknowns, no unique solution, otherwise uniquesolution
• Pathology of linear systems cont… Redundant equations (infinity of values ofunknowns) x + y = 3, 2x + 2y = 6 Inconsistent equations (no solution) x + y = 3, 2x + 2y = 7 Singular matrix (n x n system, no unique solution) Nonsingular matrix, coefficient matrix can betriangularized without having zeros on the diagonalChecking inconsistency, redundancy and singularity ofset of equations: Rank of coefficient matrix (rank less than n givesinconsistent, redundant and singular system)
• Solution of nonlinear systems Most of the real world systems are nonlinear and the representative system of algebraic equation are also nonlinear Theoretically many efficient solution methods are available for linear equations, consequently the efforts are put to first transform any nonlinear system into linear system There are various methods available for linearizationMethod of iteration Nonlinear system, example: x 2 + y 2 = 4; e x + y = 1 Assume x=f(x,y), y=g(x,y) Initial guess for both x and y Unknowns on the left hand side are computed iteratively. Most recently computed values are used in evaluating right hand side
• Solution of nonlinear systemsSufficient condition for convergence of thisprocedure is ∂f ∂f ∂g ∂g + <1 + <1 ∂x ∂y ∂x ∂yIn an interval about the root that includes the initialguessThis method depends on the arrangement of x andy i.e how x=f(x,y), and y=g(x,y) are writtenDepending on this arrangement, the method mayconverge or diverge
• Solution of nonlinear systemsThe method of iteration can be generalized to nnonlinear equations with n unknowns. In this case,the equations are arranged as x1 = f1 ( x1, x2 ,..., xn ) x2 = f 2 ( x1, x2 ,..., xn ) . . . xn = f n ( x1, x2 ,..., xn )A sufficient condition for the iterative process toconverge is n ∂f i ∑ < 1, j =1 ∂x j
• Newton technique of linearizationLinear approximation of the function using a tangent to thecurveInitial estimate x0 not too far from the rootMove along the tangent to its intersection with x-axis, andtake that as the next approximationContinue till x-values are sufficiently close or function valueis sufficiently near to zeroNewton’s algorithm is widely used because, at least in thenear neighborhood of a root, it is more rapidly convergentthan any of the other methods.Method is quadratically convergent, error of each stepapproaches a constant K times the square of the error ofthe previous step.
• Newton technique of linearizationThe number of decimal places of accuracy doubles at eachiterationProblem with this method is that of finding of f’(x).First derivative f’(x) can be written as f ( x0 ) f ( x0 ) tan θ = f ( x) = , x1 = x0 − . x0 − x1 f ( x0 )We continue the calculation by computing f ( x1 ) x2 = x1 − . f ( x1 )In more general form, f ( xn ) xn +1 = xn − , n = 0,1,2,... f ( xn )
• Newton-Raphson methodF(x,y)=0, G(x,y)=0Expand the equation, using Taylor series about xn and yn F ( xn + h, yn + k ) = 0 = F ( xn , yn ) + Fx ( xn , yn )h + Fy ( xn , yn )k G ( x n + h, y n + k ) = 0 = G ( x n , y n ) + G x ( x n , y n ) h + G y ( x n , y n ) k h = xn +1 − xn , k = yn +1 − ynSolving for h and k GFy − FGY FG x − GFx h= ; k= FxG y − G x Fy FxG y − G x FyAssume initial guess for xn,ynCompute functions, derivatives and xn,yn, h and k, Repeat procedure
• Newton-Raphson method For n nonlinear equationFi ( x1 + ∆x1, x2 + ∆x2 + ... + xn + ∆xn ) = 0 ∂Fi ∂Fi ∂Fi= Fi ( x1, x2 ,..., xn) + ∆x1 + ∆x2 + ... + ∆xn , ∂x1 ∂x2 ∂xn i = 1,2,3,..., n∂F1 ∂F ∂F ∆x1 + 1 ∆x2 + ... + 1 ∆xn = − F1 ( x1, x2 ,..., xn)∂x1 ∂x2 ∂xn∂F2 ∂F ∂F ∆x1 + 2 ∆x2 + ... + 2 ∆xn = − F2 ( x1, x2 ,..., xn)∂x1 ∂x2 ∂xn . . .∂Fn ∂F ∂F ∆x1 + n ∆x2 + ... + n ∆xn = − Fn ( x1, x2 ,..., xn)∂x1 ∂x2 ∂xn
• Picard’s technique of linearizationNonlinear equation is linearized through: Picard’s technique of linearization Newton technique of linearization The Picards method is one of the most commonly used scheme to solve the set of nonlinear differential equations. The Picards method usually provide rapid convergence. A distinct advantage of the Picards scheme is the simplicity and less computational effort per iteration than more sophisticated methods like Newton- Raphson method.
• Picard’s technique of linearizationThe general (parabolic type) equation for flow in atwo dimensional, anisotropic non-homogeneousaquifer system is given by the following equation ∂ ⎡ ∂h ⎤ ∂ ⎡ ∂h ⎤ ∂h Tx ⎥ + ⎢ ∂x ⎢Ty ⎥ =S + Q p − Rr − Rs − Q1 ∂x ⎣ ⎦ ∂y ⎣ ∂y ⎦ ∂tUsing the finite difference approximation at atypical interior node, the above ground waterequation reduces toBi, j hi, j −1 + Di, j hi −1, j + Ei, j hi, j + Fi, j hi +1, j + H i, j hi, j +1 = Ri, j
• Picard’s technique of linearizationWhere [T yi , j + T yi , j +1 ] Bi, j = − 2∆y 2 [Txi , j + Txi −1, j ] Di, j = − 2∆x 2 [Txi , j + Txi +1, j ] Fi, j = − 2∆x 2 [T yi , j + T yi , j +1 ] H i, j = − 2∆y 2
• Picard’s technique of linearization Si , j Ei, j = −( Bi, j + Di, j + Fi, j + H i, j ) + ∆t Si, j h0i , j Ri, j = − (Q ) pi , j + ( R) ri , j + ( R ) si , j ∆tThe Picard’s linearized form of the aboveequation is given by B n +1, mi, j h n +1, m +1i, j −1 + D n +1, mi, j hi −1, j + E n +1, mi, j hi, j + F n +1, mi, j hi +1, j + H n +1, mi, j hi, j +1 = R n +1, mi, j
• Solution of Manning’s equation by Newton’s techniqueChannel flow is given by the following equation 1 1/ 2 2 / 3 Q = So AR nThere is no general analytical solution to Manning’s equationfor determining the flow depth, given the flow rate as theflow area A and hydraulic radius R may be complicatedfunctions of the flow depth itself..Newton’s technique can be iteratively used to give thenumerical solutionAssume at iteration j the flow depth yj is selected and theflow rate Qj is computed from above equation, using thearea and hydraulic radius corresponding to yj
• Manning’s equation by Newton’s techniqueThis Qj is compared with the actual flow QThe selection of y is done, so that the error f (y j) = Qj − QIs negligibly smallThe gradient of f w.r.t y is df dQ j = dy j dy jQ is a constant
• Manning’s equation by Newton’s techniqueAssuming Manning’s n constant ⎛ df ⎞ ⎜ dy ⎟ ⎝ ⎠j 1 1 d ⎜ ⎟ = So / 2 n dy ( ) A j R2 / 3 j 1 1 / 2 ⎛ 2 AR −1 / 3 dR ⎞ 2 / 3 dA ⎟ = So ⎜ +R n ⎜ 3 dy dy ⎟ ⎝ ⎠j 1 1/ 2 2 / 3 ⎛ 2 dR 1 dA ⎞ = So A j R j ⎜ ⎜ 3R dy + A dy ⎟ ⎟ n ⎝ ⎠j ⎛ 2 dR 1 dA ⎞ = Qj⎜ ⎜ 3R dy + A dy ⎟ ⎟ ⎝ ⎠jThe subscript j outside the parenthesis indicates that the contents areevaluated for y=yj
• Manning’s equation by Newton’s techniqueNow the Newton’s method is as follows ⎛ df ⎞ 0 − f ( y) j ⎜ ⎟ = ⎜ dy ⎟ ⎝ ⎠ j y j +1 − y j f (y j) y j +1 = y j − (df / dy ) jIterations are continued until there is no significant changein y, and this will happen when the error f(y) is very close tozero
• Manning’s equation by Newton’s techniqueNewton’s method equation for solving Manning’s equation: 1− Q/Qj y j +1 = y j − ⎛ 2 dR 1 dA ⎞ ⎜ ⎟ ⎜ 3R dy + A dy ⎟ ⎝ ⎠jFor a rectangular channel A=Bwy, R=Bwy/(Bw+2y) where Bwis the channel width, after the manipulation, the aboveequation can be written as 1− Q/Qj y j +1 = y j − ⎛ 5 Bw + 6 y j ⎞ ⎜ ⎟ ⎜ 3 y j ( Bw + 2 y j ) ⎟ ⎝ ⎠j
• Assignments1. Solve the following set of equations by Gauss elimination: x1 + x2 + x3 = 3 2 x1 + 3x2 + x3 = 6 x1 − x2 − x3 = −3Is row interchange necessary for the above equations?2. Solve the system 9 x + 4 y + z = −17, x − 2 y − 6 z = 14, x + 6 y = 4,a. Using the Gauss-Jacobi methodb. Using the Gauss-Siedel method. How much faster is the convergence than in part (a).?
• Assignments3. Solve the following system by Newton’s method to obtain the solution near (2.5,0.2,1.6) x2 + y2 + z 2 = 9 xyz = 1 x + y − z2 = 04. Beginning with (0,0,0), use relaxation to solve the system 6 x1 − 3 x2 + x3 = 11 2 x1 + x2 − 8 x3 = −15 x1 − 7 x2 + x3 = 10
• Assignments5. Find the roots of the equation to 4 significant digits using Newton-Raphson method x − 4x +1 = 0 36. Solve the following simultaneous nonlinear equations using Newton-Raphson method. Use starting values x0 = 2, y0 = 0. x2 + y2 = 4 xy = 1
• Numerical Differentiationand Numerical Integration Module 5 3 lectures
• ContentsDerivatives and integralsIntegration formulasTrapezoidal ruleSimpson’s ruleNewton’s Coats formulaGaussian-QuadratureMultiple integrals
• DerivativesDerivatives from difference tables We use the divided difference table to estimate values for derivatives. Interpolating polynomial of degree n that fits at points p0,p1,…,pn in terms of divided differences, f ( x) = Pn ( x) + error = f [ x0 ] + f [ x0 , x1 ]( x − x0 ) + f [ x0 , x1, x 2]( x − x0 )( x − x1 ) + ... + f [ x0 , x1,..., xn ] ∏( x − xi ) + error Now we should get a polynomial that approximates the derivative,f’(x), by differentiating it Pn ( x) = f [ x0 , x1 ] + f [ x0 , x1, x2 ][( x − x1) + ( x − x0 )] n −1 ( x − x )( x − x )...( x − x + ... + f [ x0 , x1,...xn ] ∑ 0 1 n −1 ) i =0 ( x − xi )
• Derivatives continuedTo get the error term for the above approximation, wehave to differentiate the error term for Pn(x), the error termfor Pn(x): f ( n +1) (ξ ) Error = ( x − x0 )( x − x1)...( x − xn ) . (n + 1)! ξError of the approximation to f’(x), when x=xi, is ⎡ ⎤ ⎢ n ⎥ f ( n +1) (ξ ) Error = ⎢ ∏ ( xi − x j )⎥ , ξ in [x,x0,xn]. ⎢ j =0 ⎥ (n + 1)! ⎢ j ≠i ⎣ ⎥ ⎦Error is not zero even when x is a tabulated value, in factthe error of the derivative is less at some x-values betweenthe points
• Derivatives continuedEvenly spaced data When the data are evenly spaced, we can use a table of function differences to construct the interpolating polynomial. ( x − xi ) We use in terms of: s= h s ( s − 1) 2 s ( s − 1)( s − 2) 3 Pn ( s ) = f i + s∆f i + ∆ fi + ∆ fi 2! 3! n −1 ∆n f i + ... + ∏ ( s − j ) + error ; j =0 n! ⎡ n ⎤ f ( n +1) (ξ ) Error = ⎢ ∏ ( s − j )⎥ , ⎢ j =0 ⎥ (n + 1)! ξ in [x,x0,xn]. ⎣ ⎦
• Derivatives continuedThe derivative of Pn(s) should approximate f’(x) d d ds Pn ( s ) = Pn ( s ) dx ds dx ⎡ ⎧ ⎫ ⎤ 1⎢ n ⎪ j −1 j −1 ⎪ ⎪ ∆ j fi ⎥ ⎪ = ⎢∆fi + ∑ ⎨ ∑ ∏ ( s − l )⎬ ⎥. h⎢ j = 2 ⎪k = 0 l = 0 ⎪ j! ⎥ ⎢ ⎪ ⎩ l ≠k ⎪ ⎭ ⎥ ⎣ ⎦ ds d ( x − xi ) 1Where = = dx dx h h (−1) n h n ( n +1)When x=xi, s=0 Error = f (ξ ), ξ in [x1,…, xn]. n +1
• Derivatives continuedSimpler formulasForward difference approximation For an estimate of f’(xi), we get 1 1 1 1 f ( x) = [∆f i − ∆2 f i + ∆3 fi − ... ± ∆n fi ] x = xi h 2 3 n With one term, linearly interpolating, using a polynomial of degree 1, we have (error is O(h)) 1 1 " f ( xi ) = [∆f i ] − hf (ξ ), h 2 With two terms, using a polynomial of degree 2, we have (error is O(h2)) 1⎡ 1 ⎤ 1 f ( xi ) = ∆f i − ∆2 f i ⎥ + h 2 f (3) (ξ ), h⎢ ⎣ 2 ⎦ 3
• Derivatives cont…Central difference approximation Assume we use a second degree polynomial that matches the difference table at xi,xi+1 and xi+2 but evaluate it for f’(xi+1), using s=1, then 1⎡ 1 2 ⎤ f ( xi +1) = ⎢∆fi + ∆ fi ⎥ + O(h 2 ), h⎣ 2 ⎦ Or in terms of the f - values we can write 1⎡ 1 ⎤ f ( xi +1 ) = ( f i +1 − fi ) + ( fi + 2 − 2 fi +1 + fi )⎥ + error h⎢ ⎣ 2 ⎦ 1 fi + 2 − fi = + error , h 2 1 error = − h 2 f (3) (ξ ) = O(h 2 ) 6
• Derivatives cont…Higher-Order Derivatives We can develop formulas for derivatives of higher order based on evenly spaced data Difference operator: ∆f ( xi ) = ∆f i = f i +1 − f i Stepping operator : Ef i = f i +1 Or : E n fi = fi + n Relation between E and ∆: E=1+ ∆ Differentiation operator: D( f ) = df / dx, D n ( f ) = d n / dx n ( f ) Let us start with fi + s = E s fi , where s = ( x − xi ) / h d d Dfi + s = f ( xi + s ) = ( E s fi ) dx dx 1 d 1 = ( E f i ) = (ln E ) E s f i s h ds h
• Derivatives cont… 1If s=0, we get D= ln(1 + ∆ ) hBy expanding for ln(1+∆), we get f’i and f”i 1⎛ 1 1 1 ⎞ f i = ⎜ ∆fi − ∆2 f i + ∆3 f i − ∆4 f i + ... ⎟, h⎝ 2 3 4 ⎠ 1 ⎛ 2 11 4 5 ⎞ f i" = ⎜ ∆ f i − ∆3 f i + ∆ fi − ∆5 f i + ... ⎟, 2⎝ 12 6 ⎠ hDivided differencesCentral-difference formulaExtrapolation techniquesSecond-derivative computationsRichardson extrapolations
• Integration formulas The strategy for developing integration formula is similar to that for numerical differentiation Polynomial is passed through the points defined by the function Then integrate this polynomial approximation to the function. This allows to integrate a function at known valuesNewton-Cotes integration b b ∫ f ( x)dx = ∫ Pn ( xs )dx a aThe polynomial approximation of f(x) leads to an error given as: b⎛ s ⎞ n +1 ( n +1) Error = ∫ ⎜ ⎟h f (ξ )dx ⎜ ⎟ a ⎝ n + 1⎠
• Newton-Cotes integration formulasTo develop the Newton-Cotes formulas, change thevariable of integration from x to s. Also dx = hdsFor any f(x), assume a polynomial Pn(xs) of degree 1 i.en=1 x1 x1 ∫ f ( x)dx = ∫ ( f 0 + s∆f 0 )dx x0 x0 s =1 = h ∫ ( f 0 + s∆f 0 )ds s =0 1 2⎤ s 1 = hf 0 s ]1 + h∆f 0 0 ⎥ = h( f 0 + ∆f 0 ) 2⎥ 2 ⎦0 h h = [2 f 0 + ( f1 − f 0 )] = ( f 0 + f1 ) 2 2
• Newton-Cotes integration formula cont...Error in the above integration can be given as x1 s ( s − 1) 1 s2 − s Error = ∫ h f (ξ )dx = h3 f " (ξ1 ) ∫ 2 " ds x0 2 0 2 1 ⎛ s 3 s 2 ⎞⎤ 3 " = h f (ξ1 )⎜ − ⎟⎥ = − 1 h3 f " (ξ ), ⎜ 6 1 4 ⎟⎥ 12 ⎝ ⎠⎦ 0Higher degree leads complexity
• Newton-Cotes integration formula cont...The basic Newton-Cotes formula for n=1,2,3 i.e forlinear, quadratic and cubic polynomialapproximations respectively are given below: x1 h 1 ∫ f ( x)dx = ( f 0 + f1 ) − h3 f " (ξ ) x0 2 12 x2 h 1 5 iv ∫ f ( x)dx = ( f 0 + 4 f1 + f 2 ) − h f (ξ ), x0 3 90 x3 3h 3 5 iv ∫ f ( x)dx = ( f 0 + 3 f1 + 3 f 2 + f 3 ) − h f (ξ ). x0 8 80
• Trapezoidal and Simpson’s ruleTrapezoidal rule-a composite formula Approximating f(x) on (x0,x1) by a straight lineRomberg integration Improve accuracy of trapezoidal ruleSimpson’s rule Newton-Cotes formulas based on quadratic and cubic interpolating polynomials are Simpson’s rules 1 Quadratic- Simpson’s 3 rule 3 Cubic- Simpson’s 8 rule
• Trapezoidal and Simpson’s rule cont…Trapezoidal rule-a composite formula The first of the Newton-Cotes formulas, based on approximating f(x) on (x0,x1) by a straight line, is trapezoidal rule xi +1 f ( xi ) + f ( xi +1 ) h ∫ f ( x)dx = (∆x) = ( f i + f i +1 ), xi 2 2 For [a,b] subdivided into n subintervals of size h, b n h h ∫ f ( x)dx = ∑ ( f i + f i +1 ) = ( f1 + f 2 + f 2 + f 3 + ... + f n + f n +1 ); a i =12 2 b h ∫ f ( x)dx = ( f1 + 2 f 2 + 2 f 3 + ... + 2 f n + f n +1 ). a 2
• Trapezoidal and Simpson’s rule cont… f(x) x1 = a x2 x3 x4 x5 xn+1 = b x Trapezoidal Rule
• Trapezoidal and Simpson’s rule cont…Trapezoidal rule-a composite formula cont… 1 3 " Local error =− h f (ξ1 ), x0 < ξ1 < x1 12 Global error 1 3 " = − h [ f (ξ1 ) + f " (ξ 2 ) + ... + f " (ξ n )], 12 If we assume that f”(x) is continuous on (a,b), there is some value of x in (a,b), say x=ξ, at which the value of the sum in above equation is equal to n.f”(ξ), since nh=b-a, the global error becomes Global error 1 3 " −(b − a ) 2 " = − h nf (ξ ) = h f (ξ ) = O(h 2 ). 12 12 The error is of 2nd order in this case
• Romberg IntegrationWe can improve the accuracy of trapezoidal ruleintegral by a technique that is similar toRichardson extrapolation, this technique is knownas Romberg integrationTrapezoidal method has an error of O(h2), we cancombine two estimate of the integral that have h-values in a 2:1 ratio by 1Better estimate=more accurate + (more 2n − 1accurate-less accurate)
• Trapezoidal and Simpson’s ruleSimpson’s rule The composite Newton-Cotes formulas based on quadratic and cubic interpolating polynomials are known as Simpson’s rule 1Quadratic- Simpson’s 3 rule The second degree Newton-Cotes formula integrates a quadratic over two intervals of equal width, h h f ( x)dx = [ f0 + 4 f1 + f 2 ]. 3 This formula has a local error of O(h5): 1 5 ( 4) Error = − h f (ξ ) 90
• Trapezoidal and Simpson’s ruleQuadratic- Simpson’s 1 3 rule cont… For [a,b] subdivided into n (even) subintervals of size h, h f ( x)dx = [ f (a ) + 4 f1 + 2 f 2 + 4 f 3 + 2 f 4 + ... + 4 f n −1 + f (b)]. 3 With an error of (b − a ) 4 ( 4) Error = − h f (ξ ) 180 We can see that the error is of 4 th order The denominator changes to 180, because we integrate over pairs of panels, meaning that the local rule is applied n/2 times
• Trapezoidal and Simpson’s ruleCubic- Simpson’s 3 8 rule The composite rule based on fitting four points with a cubic leads to Simpson’s 3 rule 8 For n=3 from Newton’s Cotes formula we get 3h f ( x)dx = [ f0 + 3 f1 + 3 f 2 + f3 ]. 8 3 5 ( 4) Error = − h f (ξ ) 80 The local order of error is same as 1/3 rd rule, except the coefficient is larger
• Trapezoidal and Simpson’s ruleCubic- Simpson’s 3 8 rule cont… To get the composite rule for [a,b] subdivided into n (n divisible by 3) subintervals of size h, 3h f ( x)dx = [ f (a ) + 3 f1 + 3 f 2 + 2 f 3 + 3 f 4 + 3 f 5 + 2 f 6 8 + ... + 2 f n −3 + 3 f n − 2 + 3 f n −1 + f (b)] With an error of (b − a ) 4 ( 4) Error = − h f (ξ ) 80
• Extension of Simpson’s rule to Unequally spaced points When f(x) is a constant, a straight line, or a second degree polynomial ∆x2 ∫ f ( x)dx = w1 f1 + w2 f 2 + w3 f 3 − ∆x1 The functions f(x)=1, f(x)=x, f(x)=x2, are used to establish w1, w2, w3
• Gaussian quadrature Other formulas based on predetermined evenly spaced x values Now unknowns: 3 x-values and 3 weights; total 6 unknowns For this a polynomial of degree 5 is needed to interpolate These formulas are Gaussian-quadrature formulas Applied when f(x) is explicitly known Example: a simple case of a two term formula containing four unknown parameters 1 f (t ) = af (t ) +bf (t ). ∫ −1 1 2 (b − a )t + b + a ⎛b−a⎞ x= dx = ⎜ ⎟dt If we let 2 so that ⎝ 2 ⎠ thenb 1 b − a ⎛ (b − a )t + b + a ⎞∫a f ( x)dx = ∫1 f ⎜ 2 − ⎝ 2 ⎟ ⎠
• Multiple integralsWeighted sum of certain functional values with one variableheld constantAdd the weighted sum of these sumsIf function known at the nodes of a rectangular grid, weuse these values b ⎛d ⎞ d ⎛b ⎞ ∫∫ A f ( x , y ) d A = ∫ ⎜ ∫ f ( x , y ) dy ⎟dx = ∫ ⎜ ∫ f ( x , y ) dx ⎟dy ⎜ a ⎝ c ⎟ ⎠ ⎜ c ⎝ a ⎟ ⎠Newton-Cotes formulas are a convenient m n ∫ f ( x, y )dxdy = ∑ v j ∑ wi f ij j =1 i =1 ∆y ∆x = 3 2
• Multiple integralsDouble integration by numerical meansreduces to a double summation of weightedfunction values 1 n ∫ f ( x)dx = ∑ ai f ( xi ). −1 i =1 1 1 1 n n n ∫ ∫ ∫ f ( x, y, z )dxdydz = ∑ ∑ ∑ ai a j ak f ( xi , yi , z k ). −1 −1 −1 i =1 j =1 k =1
• Assignments1. Use the Taylor series method to derive expressions for f‘(x) and f ‘‘(x) and their error terms using f-values that precede f0. ( These are called backward-difference formulas.)2. Evaluate the following integrals by(i) Gauss method with 6 points(ii) Trapezoidal rule with 20 points(iii) Simpson’s rule with 10 pointsCompare the results. Is it preferable to integrate backwards or forwards? 5 1 ∫ ∫ x 3e x −1dx 2(a) e − x dx (b) 0 0
• Assignments3. Compute the integral of f(x)=sin(x)/x between x=0 and x=1 using Simpson’s 1/3 rule with h=0.5 and then with h=0.25. from these two results, extrapolate to get a better result. What is the order of the error after the extrapolation? Compare your answer with the true answer.4. Integrate the following over the region defined by the portion of a unit circle that lies in the first quadrant. Integrate first with respect to x holding y constant, using h=0.25. subdivide the vertical lines into four panels. ∫∫ cos( x) sin(2 y)dxdya. Use the trapezoidal ruleb. Use Simpson’s 1/3 rule
• Assignments5. Integrate with varying values of ∆x and ∆y using the trapezoidal rule in both directions, and show that the error decreases about in proportion to h2: 1 1 ∫∫ 0 0 ( x 2 + y 2 )dxdy6. Since Simpson’s 1/3 rule is exact when f(x) is a cubic, evaluation of the following triple integral should be exact. Confirm by evaluating both numerically and analytically. 1 2 0 ∫∫ ∫ x 3 yz 2 dxdydz 0 0 −1
• Numerical Solution ofOrdinary Differential Equations Module 6 (6 lectures)
• ContentsTaylor series methodEuler and modified EulermethodsRungekutta method and Multi-step methodApplication to higher orderequationsExample through open channeland pipe flow problems
• IntroductionNumerical solution of ordinary differentialequations is an important tool for solving a numberof physical real world problems which aremathematically represented in terms of ordinarydifferential equations.Such as spring-mass system, bending of beams,open channel flows, pipe flows etc.The most of the scientific laws are represented interms of ordinary differential equations, so to solvesuch systems we need efficient tools
• IntroductionIf the differential equation contains derivatives ofnth order, its called nth order differential equation.The solution of any differential equation should besuch that it satisfies the differential equation alongwith certain initial conditions on the function.For the nth order equation, n independent initialconditions must be specified.
• IntroductionThese equations can be solved analytically also, butthose are limited to certain special forms ofequationsThese equations can be linear or nonlinear.When the coefficients of these equations areconstants, these are linear differential equationsWhen the coefficients itself are functions ofdependent variables, these are nonlineardifferential equations
• IntroductionNumerical methods are not limited to such standard cases,it can be used to solve any physical situations.In numerical methods we get solution as a tabulation ofvalues of the function at various values of the independentvariable and data can be fit to some functional relationship,instead of exact functional relationship as in the analyticalmethods.The disadvantage of this method is that we have to re-compute the entire table if the initial conditions arechanged
• IntroductionAn equation of the form dy/dx=f(x), with f(x) given andwith suitable initial conditions, say y(a), also given can beintegrated analytically or numerically by the methodsdiscussed in the previous section, such as Simpson’s 1/3rule. x y ( x) = y (a ) + ∫ f (t )dt aIf f(t) cannot be integrated analytically a numericalprocedure can then be employed.The more general problem is nonlinear and of the formdy/dx=f(x,y), f and y(a) given, the problem is to find y(x)for x>a
• Taylor-series method Taylor series in which we expand y about the point x=x0 is y ( x0 ) 2 y ( x0 ) y ( x) = y ( x0 ) + y ( x0 )( x − x0 ) + ( x − x0 ) + ( x − x0 )3 + ... 2! 3! If we assume x − x0 = h Since y( x0 ) is initial condition, first term is known y ( x0 ) 2 y ( x0 ) 3 y ( x) = y ( x0 ) + y ( x0 )h + h + h + ... 2! 3! Error term of the Taylor series after the h4 term can be written as (v ) y (ξ ) 5 Error = h , 5!where 0<ξ<h
• Euler and modified Euler methodsIf derivative is complicated, Taylor series is notcomfortable to use,error is difficult to determineEuler method uses first two terms of Taylor series,choosing h small enough to truncate the series after thefirst derivative term, then y" (ξ )h 2 y ( x0 + h) = y ( x0 ) + y ( x0 ) + , 2 yn +1 = yn + hy n + O (h 2 ).
• Euler and modified Euler methods cont…Problem is lack of accuracy, requiring an extremely smallstep sizeIf we use the arithmetic mean of the slopes at thebeginning and end of the interval to compute yn+1: yn + yn +1 yn +1 = yn + h . 2This assumption gives us an improved estimate for y atxn+1.y’n+1 can not be evaluated till the true value of yn+1 isknown
• Euler and modified Euler methodsModified Euler method predicts a value of yn+1 bysimple Euler relation. It then uses this value toestimate y’n+1 giving an improved estimate of yn+1We need to re-correct yn+1 value till it makes thedifference negligible yWe can find out the error in the modified Eulermethod by comparing with the Taylor series
• Euler and modified Euler methods cont… This method is called Euler predictor-corrector method 1 2 y (ξ ) 3 yn +1 = yn + y n h + y n h + h . 2 6 Approximating y” by forward difference, which has the error of O(h): ⎛ ⎡ ⎤ ⎞ ⎜ y + 1 ⎢ yn +1 − y n + O(h)⎥ h ⎟ + O(h3 ), yn +1 = yn + h⎜ n ⎜ 2⎢ ⎣ h ⎥ ⎟ ⎦ ⎠ ⎟ ⎝ ⎛ 1 1 ⎞ yn +1 = yn + h⎜ y n + y n +1 − y n ⎟ + O(h3 ), ⎝ 2 2 ⎠ ⎛ y n + y n +1 ⎞ yn +1 = yn + h⎜ ⎟ + O(h3 ). ⎜ 2 ⎟ ⎝ ⎠
• Runge-Kutta methodsFourth and fifth order Runge-Kutta methodsIncrement to the y is a weighted average of two estimatesof the increment which can be taken as k1 and k2.Thus for the equation dy/dx=f(x,y) yn +1 = yn + ak1 + bk 2 k1 = hf ( xn , yn ), k 2 = hf ( xn + αh, yn + βk1).We can think of the values k1 and k2 as estimates of thechange in y when x advances by h, because they are theproduct of the change in x and a value for the slope of thecurve, dy/dx.
• Runge-Kutta methods cont…Uses Euler estimate of the first estimate of ∆y, theother estimate is taken with x and y stepped up bythe fractions α and β of h and of the earlierestimate of ∆y, k1Our problem is to devise a scheme of choosing thefour parameters a, b,α,β. We do so by makingEquations… h2 yn +1 = yn + hf ( xn , yn ) + f ( xn , yn ) + ... 2An equivalent form, sincedf/dx=fx+fydy/dx==fx+fyf, is ⎛1 1 ⎞ yn +1 = yn + hf n + h 2 ⎜ f x + f y f ⎟ ⎝2 2 ⎠n
• Runge-Kutta methods cont…Fourth order Runge-Kutta methods are mostwidely used and are derived in similar fashionThe local error term for the 4 th order Runge-Kuttamethod is O(h5) ; the global error would be O(h4).Computationally more efficient than the modifiedEuler method, because while four evaluation of thefunction are required rather than two, the stepscan be many fold larger for the same accuracy.
• Runge-Kutta methods cont…The most commonly used set of values leads tothe algorithm 1 yn +1 = yn + (k1 + 2k 2 + 2k3 + k 4 ) 6 k1 = hf ( xn , yn ), 1 1 k 2 = hf ( xn + h, yn + k1 ), 2 2 1 1 k3 = hf ( xn + h, yn + k 2 ), 2 2 k 4 = hf ( xn + h, yn + k3 ),
• Multi-step methodsRunge-kutta type methods are called single step methodWhen only initial conditions are available, ability to performthe next step with a different step sizeUses past values of y and y’ to construct a polynomial thatapproximates the derivative function, and extrapolate thisinto the next intervalThe number of past points that are used sets the degree ofthe polynomial and is therefore responsible for thetruncation error.The order of the method is equal to the power of h in theglobal error term of the formula, which is also equal to onemore than the degree of the polynomial.
• Multi-step methodsAdams method, we write the differential equation dy/dx=f(x,y) in theform dy=f(x,y)dx, and we integrate between xn and xn+1: x n +1 x n +1 ∫ dy = yn +1 − yn = ∫ f ( x, y )dx xn xnWe approximate f(x,y) as a polynomial in x, deriving this by making itfit at several past pointsUsing 3 past points, approximate polynomial is quadratic, and for 4points the polynomial is cubicMore the past points, better the accuracy, until round-off error isnegligible
• Multi-step methods Suppose that we fit a second degree polynomial through the last three points (xn,yn),(xn-1,yn-1) and (xn-2,yn-2), we get a quadratic approximation to the derivative function: 1 2 1f ( x, y ) = h ( f n − 2 f n −1 + f n − 2 ) x 2 + h(3 f n − 4 f n −1 + f n − 2 ) x + f n 2 2 Now we integrate between xn and xn+1. The result is a formula for the increment in y h yn +1 − yn = (23 f n − 16 f n −1 + 5 f n − 2 ) 12
• Multi-step methodsWe have the formula to advance y: h yn +1 = yn + [23 f n − 16 f n −1 + 5 f n − 2 ] + O(h 4 ) 12This formula resembles the single step formulas,in that the increment to y is a weighted sum ofthe derivatives times the step size, but differs inthat past values are used rather than estimates inthe forward direction.We can reduce the error by using more pastpoints for fitting a polynomial
• Multi-step methodsIn fact, when the derivation is done for fourpoints to get a cubic approximation tof(x,y), the following is obtained hyn +1 = yn + [55 f n − 59 f n −1 + 37 f n − 2 − 9 f n −3 ] + O(h5 ) 24
• Multi-step methodsMilne’s method first predict a value for yn+1 byextrapolating the values for the derivative,Differs from Adam’s method, as it integrates over morethan one intervalThe required past values computed by Runge-Kutta orTaylor’s series method.In this method, the four equi-spaced starting values of yare known, at the points xn, xn-1, xn-2 and xn-3We may apply quadrature formula to integrate as follows
• Multi-step methodsMilne’s method dy = f ( x, y ) dx xn+1 xn+1 xn+1 ⎛ dy ⎞ ∫ ⎜ dx ⎟dx = x∫ f ( x, y)dx = x∫ P2 ( x)dx xn−3 ⎝ ⎠ n −3 n −3 4h 28 5 v yn +1 − yn −3 = (2 f n − f n−1 + 2 f n−2 ) + h y (ξ1 ) 3 90Where xn −3 < ξ1 < xn +1
• Multi-step methodsThe above predictor formula can be corrected bythe following xn+1 xn+1 xn+1 ⎛ dy ⎞ ∫ ⎜ dx ⎟dx = x∫ f ( x, y)dx = x∫ P2 ( x)dx xn−1 ⎝ ⎠ n −1 n −1 5 h h v yn +1,c − yn −1 = ( f n +1 + 4 f n + f n −1 ) − y (ξ 2 ) 3 90Where xn −1 < ξ 2 < xn +1
• Multi-step methodsAdam-Moulton Method, more stable than and asefficient as Milne method .Adam-Moulton predictor formula: h 251 5 v yn +1 = yn + [55 f n − 59 f n −1 + 37 f n − 2 − 9 f n −3 ] + h y (ξ1 ) 24 720Adam-Moulton corrector formula: h 19 5 v yn +1 = yn + [9 f n +1 + 19 f n − 5 f n −1 + f n − 2 ] − h y (ξ 2 ) 24 720The efficiency of this method is about twice thatof Runge-Kutta and Runge-kutta Fehlbergmethods
• Application to systems of equations and higher-order equationsGenerally any physical problems deals with a set of higherorder differential equations. For example, the followingequation represents a vibrating system in which a linearspring with spring constant k restores a displaced mass ofweight w against a resisting force whose resistance is btimes the velocity. The f(x,t) is an external forcing functionacting on the mass. w d 2x dx +b + kx = f ( x, t ) g dt 2 dt
• System of equations and higher-order equationsReduce to a system of simultaneous first order equationsFor a second order equations the initial value of thefunction and its derivative are known i.e the n values ofthe variables or its derivatives are known, where n is theorder of the system.When some of the conditions are specified at theboundaries of the specified interval, we call it a boundaryvalue problem
• Systems of equations and higher-order equationsBy solving for second derivative, we can normally expresssecond order equation as d 2x ⎛ dx ⎞ = f ⎜ t , x, ⎟, x(t0 ) = x0, x (t0 ) = x0 dt 2 ⎝ dt ⎠The initial value of the function x and its derivatives arespecifiedWe convert to 1st order equation as dx = y, x(t0 ) = x0, dt
• Systems of equations and higher-order equationsThen we can write dy = f (t , x , y ), y (t0 ) = x0 dtThis pair of equations is equivalent to the original 2nd order equationFor even higher orders, each of the lower derivatives is defined as anew function, giving a set of n first-order equations that correspond toan nth order differential equation.For a system of higher order equations, each is similarly converted, sothat a larger set of first order equations results.
• Systems of equations and higher-order equationsThus the nth order differential equation ( n −1) y (n) = f ( x, y, y ,..., y ), y ( x0 ) = A1 , y ( x0 ) = A2 , . . . y ( n −1) ( x0 ) = An
• Systems of equations and higher-order equationsCan be converted into a system of n first-orderdifferential equations by letting y1=y and y1 = y2 , y 2 = y3 , . . . yn −1 = yn , yn = f ( x, y1 , y2 ,..., yn );
• Systems of equations and higher-order equationsWith initial conditions y1 ( x0 ) = A1 , y2 ( x0 ) = A2 , . . . yn ( x0 ) = AnNow the Taylor-Series method, Euler Predictor-Corrector method,Runge-Kutta method, Runge-Kutta Fehlberg method, Adams-Moultonand Milne methods can be used to derive the various derivatives of thefunction
• Examples of Open Channel Problems Steady flow through open channel dVs d ρVs + ( p + γz ) = 0 ds dsWhere p = pressure intensity Steady, uniform flow through open channel d ( p + γz ) = 0 ds The equation describing the variation of the flow depth for any variation in the bottom elevation is given by dz dy = ( Fr2 − 1) dx dx
• Examples of Open Channel ProblemsFor gradually varied flow, variation of y with x dy S o − S f = dx 1 − Fr2Or Gradually varied flow can be written as dy So − S f = dx 1 − (αQ 2 B) /( gA3 )For a very wide rectangular channel, R≈y dy gB ( SoC 2 B 2 y 3 − Q 2 ) = dx C 2 ( gBy 3 − αBQ 2 )
• Examples of Pipe Flow ProblemsLaminar flow, velocity distribution r0 − r 2 2 ⎡ d ⎤ u= 4µ ⎢− ds ( p + γz )⎥ ⎣ ⎦Time for flow establishment in a pipe d pA + γAL sin α − τ 0πDL = (V ρ AL ) dtSurge tank water-level Oscillations, the dynamicequation is dQ gAt = ( − z − cQ Q ) dt L
• Assignments1. Use the simple Euler method to solve for y(0.1) from dy = x + y + xy y ( 0) = 1 dxWith h=0.01. Repeat this exercise with the modified Euler method with h=0.025. Compare the results.2. Determine y at x=0.2(0.2)0.6 by the Runge-Kutta technique, given that dy 1 = y (0) = 2 dx x + y
• Assignments3. Solve the following simultaneous differential equations by using(i) A fourth order Runge-Kutta method(ii) A fourth order Milne predictor-corrector algorithm dy dz = − x − yz, = − y − xz, y (0) = 0, z (0) = 1.0 dx dxFor 0.5 ≥ x ≥ 0.04. Express the third order equation y + ty − ty − 2 y = t , y (0) = y (0) = 0, y (0) = 1, a set of first order equations and solve at t =0.2,0.4,0.6 by the Runge-Kutta method (h=0.2).
• Assignments5. Find y at x=0.6, given that y = yy , y (0) = 1, y (0) = −1Begin the solution by the Taylor-series method, getting y(0.1),y(0.2),y(0.3). The advance to x=0.6 employing the Adams-Moulton technique with h=0.1 on the equivalent set of first-order equations.6. Solve the pair of simultaneous equations by the modified Euler method for t=0.2(0.2)0.6. Recorrect until reproduced to three decimals. dx dy = xy + t , x(0) = 0, = x − t , y (0) = 1, dt dt
• Introduction to FiniteDifference Techniques Module 7 6 lectures
• ContentsTypes of finite differencetechniquesExplicit and implicittechniquesMethods of solutionApplication of FDtechniques to steady andunsteady flows in openchannels
• Types of FD techniquesMost of the physical situation is represented bynonlinear partial differential equations for which aclosed form solution is not available except in fewsimplified casesSeveral numerical methods are available for theintegration of such systems. Among thesemethods, finite difference methods have beenutilized very extensivelyDerivative of a function can be approximated byFD quotients.
• Types of FD techniquesDifferential equation is converted into the differenceequationSolution of difference equation is an approximate solutionof the differential equation.Example: f(x) be a function of one independent variable x.assume at x0, function be f(x0) , then by using Taylorseries expansion, the function f(x0+∆x) may be written as (∆x) 2 f ( x0 + ∆x) = f ( x0 ) + ∆xf ( x0 ) + f ( x0 ) + O(∆x)3 2!
• Types of FD techniquesf’(x0)=dy/dx at x=x0O(∆x)3: terms of third order or higher order of ∆xSimilarly f(x0- ∆x) may be expressed as ( ∆ x ) 2 f ( x0 − ∆ x ) = f ( x0 ) − ∆ xf ( x0 ) + f ( x0 ) + O ( ∆ x ) 3 2!Equation may be written as f ( x0 + ∆x) = f ( x0 ) + ∆xf ( x0 ) + O(∆x) 2From this equation df f ( x0 + ∆x) − f ( x0 ) = + O(∆x) dx x = x ∆x 0i
• Types of FD techniques f(x) y=f(x) B Q A x0-∆x x0 x0+∆x x Finite Difference Approximation
• Types of FD techniquesSimilarly df f ( x0 ) − f ( x0 − ∆x) = + O(∆x) dx x = x ∆x 0iNeglecting O(∆x) terms in above equation we getForward difference formula as given below df f ( x0 + ∆x) − f ( x0 ) = dx x = x ∆x 0iBackward difference formula as shown below df f ( x0 ) − f ( x0 − ∆x) = dx x = x ∆x 0iBoth forward and backward difference approximation arefirst order accurate
• Types of FD techniques cont…Subtracting the forward Taylor series Frombackward Taylor series, rearrange theterms, and divide by ∆x df f ( x0 + ∆x) − f ( x0 − ∆x) = + O(∆x) 2 dx x = x 2∆x 0iNeglecting the last term df f ( x0 + ∆x) − f ( x0 − ∆x) = dx x = x 2∆x 0i
• Types of FD techniques cont…This approximation is referred to as central finite differenceapproximationError term is of order O(∆x)2, known as second orderaccurateCentral-difference approximations to derivates are moreaccurate than forward or backward approximations [O(h2)verses O(h)]Consider FD approximation for partial derivative
• Types of FD techniques cont…Function f(x,t) has two independent variables, xand tAssume uniform grid size of ∆x and ∆t t x k+1 k t k-1 i-1 i i+1 x Finite Difference Grid Approximation
• Explicit and implicit techniquesThere are several possibilities for approximating the partialderivativesThe spatial partial derivatives replaced in terms of thevariables at the known time level are referred to as theexplicit finite differenceThe spatial partial derivatives replaced in terms of thevariables at the unknown time level are called implicit finitedifferencek is known time level and k+1 is the unknown time level.Then FD approximation for the spatial partial derivative ,∂f/∂x, at the grid point (i,k) are as follows:
• Explicit and implicit techniquesExplicit finite differencesBackward: f ik − f ik ∂f −1 = ∂x ∆xForward: ∂f f ik − f ik = +1 ∂x ∆xCentral: ∂f f ik 1 − f ik 1 = + − ∂x 2 ∆x
• Explicit and implicit techniquesImplicit finite differences ∂f f ik +1 − f ik +1Backward: = −1 ∂x ∆xForward: ∂f f ik +1 − f ik +1 = +1 ∂x ∆x ∂f f ik +1 − f ik +1Central: = +1 −1 ∂x 2∆x
• Explicit and implicit techniquesBy the known time level we mean that thevalues of different dependent variables areknown at this timeWe want to compute their values at theunknown time levelThe known conditions may be the valuesspecified as the initial conditions or theymay have been computed during previoustime step
• Explicit finite difference schemes For the solution of hyperbolic partial differential equations, several explicit finite difference schemes have been proposed In the following section a number of typical schemes have been discussed which has its high relevance in hydraulic engineeringUnstable scheme For any unsteady situation, we can select the following finite-difference approximations:
• Explicit finite difference schemesApproximations ∂f fik 1 − f ik 1 = + − ∂x 2∆x ∂f f ik +1 − f ik = ∂t ∆tIn the above f refers to dependent variablesGenerally the finite difference scheme is inherentlyunstable; i.e., computation become unstable irrespective ofthe size of grid spacing, so the stability check is animportant part of the numerical methods.
• Explicit finite difference schemesDiffusive scheme This scheme is slightly varying than the unstable scheme This method is easier to program and yields satisfactory results for typical hydraulic engineering applications. In this method the partial derivatives and other variables are approximated as follows: ∂f f ik 1 − f ik 1 ∂f f ik +1 − f * = + − = ∂x 2 ∆x ∂t ∆t
• Explicit finite difference schemeswhere 1 k f = ( f i −1 − f ik 1 ) * + 2 These approximations are applied to the conservation and non-conservation forms of the governing equations of the physical situations.
• Explicit finite difference schemesMacCormack Scheme This method is an explicit, two-step predictor-corrector scheme that is a second order accurate both in space and time and is capable of capturing the shocks without isolating them This method has been applied for analyzing one- dimensional, unsteady, open channel flows by various hydraulic engineers The general formulation for the scheme has been discussed as
• Explicit finite difference schemesMacCormack Scheme cont… Two alternative formulations for this scheme are possible. In the first alternative, backward FD are used to approximate the spatial partial derivatives in the predictor part and forward FD are utilized in the corrector part. The values of the variables determined during the predictor part are used during the corrector part In the second alternative forward FDs are used in the predictor and backward FD are used in the corrector part
• Explicit finite difference schemesMacCormack Scheme cont… Generally it is recommended to alternate the direction of differencing from one time step to the next The FD approximations for the first alternative of this scheme is given as follows. The predictor ∂f f i* − f ik ∂f f ik − f ik −1 = = ∂t ∆t ∂x ∆x
• Explicit finite difference schemesMacCormack Scheme cont… The subscript * refers to variables computed during the predictor part The corrector ∂f f i** − f ik ∂f f i* 1 − f i* = = + ∂t ∆t ∂x ∆x the value of fi at the unknown time level k+1 is given by k +1 1 * fi = ( fi + f i** ) 2
• Explicit finite difference schemesLambda scheme In this scheme, the governing are is first transformed into λ-form and then discretize them according to the sign of the characteristic directions, thereby enforcing the correct signal direction. In an open channel flow, this allows analysis of flows having sub- and supercritical flows. This scheme was proposed by Moretti (1979) and has been used for the analysis of unsteady open channel flow by Fennema and Choudhry (1986)
• Explicit finite difference schemesLambda scheme cont… Predictor 2 f ik − 3 f ik 1 + f ik 2 − f ik 1 − f ik + fx = − − fx = + ∆x ∆x Corrector + fi* − fi* 1 − * * * − − 2 f i + 3 f i −1 − f i − 2 fx = fx = ∆x ∆x
• Explicit finite difference schemesBy using the above FD s and ∂f f i** − fik = ∂t ∆tand using the values of different variablescomputed during the predictor part, we obtain theequations for unknown variables.The values at k+1 time step may be determinedfrom the following equations: k +1 1 * fi = ( fi + fi** ) 2
• Explicit finite difference schemesGabutti scheme This is an extension of the Lambda scheme. This allows analysis of sub and super critical flows and has been used for such analysis by Fennema and Chaudhry (1987) The general formulation for this scheme is comprised of predictor and corrector parts and the predictor part is subdivided into two parts The λ-form of the equations are used the partial derivatives are replaced as follows:
• Explicit finite difference schemesGabutti scheme cont… Taking into consideration the correct signal directionPredictor:Step1: spatial derivatives are approximated as follows: + f ik − f ik 1 − f ik 1 − f ik fx = − fx = + ∆x ∆x
• Explicit finite difference schemesGabutti scheme cont… By substituting ∂f f i** − f ik = ∂t ∆t Step2: in this part of the predictor part we use the following finite-difference approximations: + 2 f ik − 3 f ik 1 + f ik 2 − − − − 2 f ik + 3 f ik 1 − f ik 2 − − fx = fx = ∆x ∆x
• Explicit finite difference schemesGabutti scheme cont…Corrector: in this part the predicted values are used and the corresponding values of coefficients and approximate the spatial derivatives by the following finite differences: + f i* − f i* 1 − − f i* 1 − f i* fx = fx = + ∆x ∆x The values at k+1 time step may be determined from the following equations: k +1 k 1 fi = fi + ∆t ( fi* + fi** ) 2
• Implicit finite difference schemesIn this scheme of implicit finite difference, the spatialpartial derivatives and/or the coefficients are replaced interms of the values at the unknown time levelThe unknown variables are implicitly expressed in thealgebraic equations, this methods are called implicitmethods.Several implicit schemes have been used for the analysis ofunsteady open channel flows. The schemes are discussedone by one.
• Implicit finite difference schemesPreissmann Scheme This method has been widely used The advantage of this method is that the variable spatial grid may be used Steep wave fronts may be properly simulated by varying the weighting coefficient This scheme also yields an exact solution of the linearized form of the governing equations for a particular value of ∆x and ∆t.
• Implicit finite difference schemesPreissmann Scheme cont… General formulation of the partial derivatives and other coefficients are approximated as follows: ∂f ( f ik +1 + f ik +1 ) − ( f ik + f ik 1 ) +1 + = ∂t 2 ∆t ∂f α ( f ik +1 − f ik +1 ) +1 (1 − α )( f ik 1 − f ik ) + = + ∂x ∆x ∆x 1 k +1 k +1 1 f = α ( fi +1 + fi ) + (1 − α )( fik 1 + fik ) + 2 2
• Implicit finite difference schemesPreissmann Scheme Where α is a weighting coefficient and f refers to unknown variables and coefficients. By selecting a suitable value for α, the scheme may be made totally explicit (α=0) or implicit (α=0) The scheme is stable if 0.55< α≤1
• Assignments1. A large flat steel plate is 2 cm thick. If the initial temperature within the plate are given, as a function of the distance from one face, by the equations u = 100 x for 0 ≤ x ≤ 1 u = 100(2 − x) for 0 ≤ x ≤ 1 Find the temperatures as a function of x and t if both faces are maintained at 0 degree centigrade. The one dimensional heat flow equation is given as follows ∂u k ∂ 2u = ∂t cρ ∂x 2Take k=0.37 cρ=0.433.
• Assignments2. Solve for the temperature at t=2.06 sec in the 2-cm thick steel slab of problem (1) if the initial temperatures are given by ⎛ πx ⎞ u ( x , 0 ) = 100 sin ⎜ ⎟ ⎝ 2 ⎠Use the explicit method with ∆x=0.25 cm. compare to the analytical solution: − 0 . 3738 t 100 e sin( π x / 2 )3. Using Crank-Nicolson method, solve the following equation ∂ 2u ∂u k − cρ = f (x) ∂x 2 ∂tSolve this when f ( x ) = x ( x − 1) subject to conditions u ( 0 , t ) = 0 , u (1 , t ) = 0 , u ( x , 0 ) = 0 .Take ∆x=0.2, k=0.37 cρ=0.433. solve for five time steps.
• Numerical Solution of Partial Differential Equations Module 8 6 lectures
• ContentsClassification of PDEsApproximation ofPDEs through Finitedifference methodSolution methods: SOR ADI CGHS
• IntroductionIn applied mathematics, partial differential equationis a subject of great significanceThese type of equations generally involves two ormore independent variables that determine thebehavior of the dependent variable.The partial differential equations are therepresentative equations in the fields of heat flow,fluid flow, electrical potential distribution,electrostatics, diffusion of matter etc.
• Classification of PDEsMany physical phenomenon are a function of morethan one independent variable and must berepresented by a partial – differential equation,usually of second or higher order.We can write any second order equation (in twoindependent variable) as: ∂ 2u ∂ 2u ∂ 2u ⎛ ∂u ∂u ⎞ A +B +C ⎜ x, y , u , , ⎟ = 0 + D⎜ ∂x 2 ∂x∂y ∂y 2 ⎝ ∂x ∂y ⎟ ⎠
• Classification of PDEs cont…The above partial differential equation can be classifieddepending on the value of B2 - 4AC, Elliptic, if B2 - 4AC<0; parabolic, if B2 - 4AC=0; hyperbolic, if B2 - 4AC>0.If A,B,C are functions of x,y,and/or u,the equation maychange from one classification to another at various pointsin the domainFor Laplace’s and Poisson’s equation, B=0, A=C=1, sothese are always elliptic PDEs ∂ 2u ∂ 2u + = 0 2 2 ∂x ∂y
• Classification of PDEs cont…1D advective-dispersive transport process isrepresented through parabolic equation, whereB=0, C=0, so B2 - 4AC=0 ∂ 2C ⎛ ∂C ∂C ⎞ Dl −⎜ +u ⎟=0 2 ⎝ ∂t ∂x ⎠ ∂x1D wave equation is represented throughhyperbolic equation, where B=0, A=1 and C=-Tg/w, so B2 - 4AC>0 ∂2 y Tg ∂ 2 y − =0 2 w ∂x 2 ∂t
• FD Approximation of PDEsOne method of solution is to replace the derivatives bydifference quotientsDifference equation is written for each node of the meshSolving these equations gives values of the function ateach node of the grid networkLet h=∆x= spacing of grid work in x-directionAssume f(x) has continuous fourth derivative w.r.t x and y.
• FD Approximation of PDEsWhen f is a function of both x and y, we get the 2ndpartial derivative w.r.t x, ∂2u/ ∂x2, by holding yconstant and evaluating the function at three pointswhere x equals xn, xn+h and xn-h. the partialderivative ∂2u/ ∂y2 is similarly computed, holding xconstant.To solve the Laplace equation on a region in the x-y plane, subdivide the region with equi-spaced linesparallel to x-y axes
• FD Approximation of PDEsTo solve Laplace equation on a xy plane, consider a regionnear (xi,yi), we approximate ∂ 2u ∂ 2u ∇ 2u = + =0 2 2 ∂x ∂yReplacing the derivatives by difference quotients thatapproximate the derivatives at the point (xi,yi), we get u ( xi +1, yi ) − 2u ( xi , yi ) + u ( xi −1, yi ) ∇ 2u ( xi , yi ) = (∆x) 2 u ( xi , yi +1 ) − 2u ( xi , yi ) + u ( xi , yi −1 ) + (∆y ) 2 =0
• FD Approximation of PDEsIt is convenient to use double subscript on u toindicate the x- and y- values: 2 ui +1, j − 2ui, j + ui −1, j ui, j +1 − 2ui, j + ui, j −1∇ ui , j = + = 0. (∆x) 2 (∆y ) 2For the sake of simplification, it is usual to take∆x= ∆y=h 2 ∇ ui , j = 1 u [ 2 i +1, j + ui −1, j + ui, j +1 + ui, j −1 − 4ui, j = 0. ] hWe can notice that five points are involved in theabove relation, known as five point star formula
• FD Approximation of PDEsLinear combination of u’s is represented symbolically asbelow 1 ⎧ 1 ⎫ 2 ⎪ ⎪ ∇ ui , j = 1 − 4 1⎬ui, j = 0. 2⎨ h ⎪⎩ 1 ⎪⎭This approximation has error of order O(h2),provided u issufficiently smooth enoughWe can also derive nine point formula for Laplace’sequation by similar methods to get 1 ⎧1 ⎪ 4 1⎫ ⎪ ∇ 2 ui , j = 4 − 20 4⎬ui, j = 0. 2 ⎨ 6h ⎪ 1 ⎩ 4 1⎪ ⎭In this case of approximation the error is of order O(h6),provided u is sufficiently smooth enough
• Methods of solution approximation through FD at a set of grid points (xi,yi), a set of simultaneous linear equations results which needs to be solved by Iterative methodsLiebmann’s Method Rearrange the FD form of Laplace’s equation to give a diagonally dominant system This system is then solved by Jacobi or Guass-Seidel iterative method The major drawback of this method is the slow convergence which is acute when there are a large system of points, because then each iteration is lengthy and more iterations are required to meet a given tolerance.
• SOR method of solutionS.O.R method – Accelerating Convergence Relaxation method of Southwell, is a way of attaining faster convergence in the iterative method. Relaxation is not adapted to computer solution of sets of equations Based on Southwell’s technique, the use of an overrelaxation factor can give significantly faster convergence Since we handle each equation in a standard and repetitive order, this method is called successive overrelaxation (S.O.R)
• SOR method of solution cont…Applying SOR method to Laplace’s equation as givenbelow: 1 ⎧ 1 ⎫ ⎪ ⎪ ∇ 2 ui , j = 1 − 4 1⎬ui, j = 0. 2⎨ h ⎪⎩ 1 ⎪⎭The above equation leads to ui(+1, j + ui(−1,1) + ui(,kj)+1 + ui(,kj+1) k) k+ −1 uijk +1) = ( j 4We now both add and subtract uij(k) on the right handside, getting ⎡ u ( k ) + u ( k +1) + u ( k ) + u ( k +1) − 4 u ( k ) ⎤ i +1, j i −1, j i , j +1 i , j −1 ij u ijk +1) = u ijk ) + ⎢ ( ( ⎥ ⎢ 4 ⎥ ⎢ ⎣ ⎥ ⎦
• SOR method of solution cont…The numerator term will be zero when final values, afterconvergence, are used, term in bracket called”residual”,which is “relaxed” to zeroWe can consider the bracketed term in the equation to bean adjustment to the old value uij(k), to give the new andimproved value uij(k+1)If instead of adding the bracketed term, we add a largervalue (thus “overrelaxing”), we get a faster convergence.We modify the above equation by including anoverrelaxation factor ω to get the new iterating relation.
• SOR method of solution cont…The new iterating relation after overrelaxation ω is as: ⎡ u ( k ) + u ( k +1) + u ( k ) + u ( k +1) − 4u ( k ) ⎤ ( k +1) uij (k ) = uij + ω ⎢ i +1, j i −1, j i, j +1 i, j −1 ij ⎥ ⎢ 4 ⎥ ⎢ ⎣ ⎥ ⎦Maximum acceleration is obtained for some optimum valueof ω which will always lie in between 1.0 to 2.0 forLaplace’s equation
• ADI method of solutionCoefficient matrix is sparse matrix, when anelliptical PDE is solved by FD methodEspecially in the 3D case, the number of nonzerocoefficients is a small fraction of the total, this iscalled sparseness The relative sparseness increases as the numberof equations increasesIterative methods are preferred for sparse matrix,until they have a tridiagonal structure
• ADI method of solutionMere elimination does not preserve the sparsenessuntil the matrix itself is tridiagonalFrequently the coefficient matrix has a bandstructureThere is a special regularity for the nonzeroelementsThe elimination does not introduce nonzero termsoutside of the limits defined by the original bands
• ADI method of solutionZeros in the gaps between the parallel linesare not preserved, though, so the tightestpossible bandedness is preferredSometimes it is possible to order the pointsso that a pentadiagonal matrix resultsThe best of the band structure is tridiagonal,with corresponding economy of storage andspeed of solution.
• ADI method of solution cont… A method for the steady state heat equation, called the alternating- direction-implicit (A.D.I) method, results in tridiagonal matrices and is of growing popularity. A.D.I is particularly useful in 3D problems, but the method is more easily explained in two dimensions. When we use A.D.I in 2D, we write Laplace’s equation as 2 u L − 2u0 + u R u A − 2u0 + u B ∇ u= + =0 2 2 (∆x) ( ∆y )Where the subscripts L,R,A, and B indicate nodes left, right, above, and below the central node 0. If ∆x= ∆y, we can rearrange to the iterative form
• ADI method of solutionIterative form is as: u Lk +1) − 2u0k +1) + u Rk +1) = −u ( k ) + 2u0k ) − u Bk ) ( ( ( A ( (Using above equation, we proceed through the nodes byrows, solving a set of equations (tri-diagonal) that considerthe values at nodes above and below as fixed quantitiesthat are put into the RHS of the equationsAfter the row-wise traverse, we then do a similar set ofcomputations but traverse the nodes column-wise: u ( k + 2) − 2u0k + 2) + u Bk + 2) = −u Lk +1) + 2u0k +1) − u Rk +1) A ( ( ( ( (
• ADI method of solution This removes the bias that would be present if we use only the row-wise traverse The name ADI comes from the fact that we alternate the direction after each traverse It is implicit, because we do not get u0 values directly but only through solving a set of equations As in other iterative methods, we can accelerate convergence. We introduce an acceleration factor, ρ, by rewriting equations u0k +1) = u0k ) + ρ ⎛ u ( k ) − 2u0k ) + u Bk ) ⎞ + ρ ⎛ u Lk +1) − 2u0k +1) + u Rk +1) ⎞ ( ( ⎜ A ( ( ⎟ ⎜ ( ( ( ⎟ ⎝ ⎠ ⎝ ⎠u0k + 2) = u0k +1) + ρ ⎛ u Lk +1) − 2u0k +1) + u Rk +1) ⎞ + ρ ⎛ u ( k + 2) − 2u0k + 2) + u Bk + 2) ⎞. ( ( ⎜ ( ( ( ⎟ ⎜ A ( ( ⎟ ⎝ ⎠ ⎝ ⎠
• ADI method of solutionRearranging further to give the tri-diagonalsystems, we get ( k +1) ⎛ 1 ⎞ ( ( ⎛1 ⎞ ( ⎜ + 2 ⎟u0k +1) − u Rk +1) = u ( k ) − ⎜ − 2 ⎟u0k ) + u Bk ) ( − uL +⎜ ⎟ A ⎜ρ ⎟ ρ⎝ ⎠ ⎝ ⎠ ( k + 2) ⎛ 1 ⎞ ( ⎛1 ⎞ ( ⎜ + 2 ⎟u0k + 2) − u Bk + 2) = u Lk +1) − ⎜ − 2 ⎟u0k +1) + u Rk +1) . ( ( (− uA +⎜ ⎟ ⎜ρ ⎟ ⎝ ρ ⎠ ⎝ ⎠
• CGHS methodThe conjugate Gradient (CG) method wasoriginally proposed by Hestens and Stiefel (1952).The gradient method solves N x N nonsingularsystem of simultaneous linear equations byiteration process. There are various forms ofconjugate gradient methodThe finite difference approximation of the groundwater flow governing equation at all the I.J nodesin a rectangular flow region (J rows and Icolumns) will lead to a set of I.J linear equationsand as many unknowns,
• CGHS methodThe I.J equations can be written in the matrixnotations as AH = YWhere A = banded coefficient matrix,H= the column vector of unknownsY= column vector of known quantitiesGiving an initial guess Hi for the solution vector H,we can write as follow H i +1 = H i + di
• CGHS methodWhere di is a direction vector, Hi is theapproximation to the solution vector H atthe i th iterative step.A CG method chooses di such that at eachiteration the B norm of the error vector isminimized, which is defined as ei +1 =< B ei +1, ei +1> 0.5 Bwhere ei +1 = H − H i +1 = ei − di
• CGHS methodIn which ei+1 is the error at the (i+1)th iteration. Inthe above equation angle bracket denotes theEuclidean inner product, which is defined as n < x, y >= ∑ xi yi i =1In the previous equation B is a symmetric positivedefinite (spd) inner product matrix. In the case ofsymmetric positive definite matrix A, such as thatarising from the finite difference approximation ofthe ground water flow equation, the usual choicefor the inner product matrix is B=A
• CGHS methodA symmetric matrix A is said to be positivedefinite if xTAx>0 whenever x≠0 where x isany column vector. So the resultingconjugate gradient method minimizes the Anorm of the error vector (i.e. ei +1 A ).The convergence of conjugate gradientmethod depend upon the distribution ofeigenvalues of matrix A and to a lesserextend upon the condition number [k(A)] ofthe matrix. The condition number of asymmetric positive definite matrix is definedas k ( A ) = λmax / λmin
• CGHS methodWhere λmax and λmin are the largest and smallesteigenvalues of A respectively. When k(A) is large,the matrix is said to be ill-conditioned, in this caseconjugate gradient method may converge slowly.The condition number may be reduced bymultiplying the system by a pre-conditioning matrixK-1. Then the system of linear equation given bythe equation… can be modified as K −1 A H = K −1Y
• CGHS methodDifferent conjugate methods are classifieddepending upon the various choices of the pre-conditioning matrix.The choice of K matrix should be such that onlyfew calculations and not much memory storageare required in each iteration to achieve this. Witha proper choice of pre-conditioning matrix, theresulting preconditioned conjugate gradientmethod can be quite efficient.A general algorithm for the conjugate gradientmethod is given as follow:
• CGHS methodInitialize H 0 = Arbitrary − initial − guess r0 = Y − A H 0 −1 s0 = K r0 p0 = s 0 i=0Do while till the stopping criteria is not satisfied
• CGHS method ai =< si , ri > / < A pi , pi >Cont… H i +1 = H i + ai pi ri +1 = ri − ai A pi si +1 = K −1ri +1 bi =< si +1, ri +1 > / < si , ri > p i +1= si +1 + bi pi i = i +1 End do
• CGHS methodWhere r0 is the initial residue vector, s0 is avector, p0 is initial conjugate directionvector, ri+1,si+1 and pi+1 are thecorresponding vectors at (i+1)th iterativestep, k-1 is the preconditioning matrix and Ais the given coefficient matrix. Thisconjugate algorithm has following twotheoretical properties:(a) the value {Hi}i>0 converges to thesolution H within n iterations(b) the CG method minimizes H i − H for allthe values of i
• CGHS methodThere are three types of operations that areperformed by the CG method: innerproducts, linear combination of vectors andmatrix vector multiplications.The computational characteristics of theseoperations have an impact on the differentconjugate gradient methods.
• Assignments1. The equation ∂ 2u ∂ 2u ∂u 2 2+ 2− =2 ∂x ∂y ∂xis an elliptic equation. Solve it on the unit square, subject to u=0 on the boundaries. Approximate the first derivative by a central- difference approximation. Investigate the effect of size of ∆x on the results, to determine at what size reducing it does not have further effect.2. Write and run a program for poisson’s equation. Use it to solve ∇ 2 u = xy ( x − 2)( y − 2)On the region 0 ≤ x ≤ 2 , 0 ≤ y ≤ 2 , with u=0 on allboundaries except for y=0, where u=1.0.
• Assignments3. Repeat the exercise 2, using A.D.I method. Provide the Poisson equation as well as the boundary conditions as given in the exercise 2.4. The system of equations given here (as an augmented matrix) can be speeded by applying over-relaxation. Make trials with varying values of the factor to find the optimum value. (In this case you will probably find this to be less than unity, meaning it is under-relaxed.) ⎡8 1 − 1 | 8 ⎤ ⎢1 − 7 2 | − 4 ⎥ ⎢ ⎥ ⎢2 1 ⎣ 9 | 12 ⎥⎦
• Computation of GraduallyVaried and Unsteady Open Channel Flows Module 9 6 lectures
• ContentsNumerical integrationmethods for solvingGradually varied flowsFinite differencemethods for SaintVenant-equationsExamples
• IntroductionFor most of the practical implications, the flowconditions in a gradually varied flow are required tocalculate.These calculations are performed to determine thewater surface elevations required for the planning,design, and operation of open channels so that theeffects of the addition of engineering works and thechannel modifications on water levels may beassessedAlso steady state flow conditions are needed tospecify proper initial conditions for the computationof unsteady flows
• IntroductionImproper initial conditions introduce falsetransients into the simulation, which may lead toincorrect resultsIt is possible to use unsteady flow algorithmsdirectly to determine the initial conditions bycomputing for long simulation timeHowever, such a procedure is computationallyinefficient and may not converge to the propersteady state solution if the finite-difference schemeis not consistent
• IntroductionVarious methods to compute gradually varied flowsare required to developMethods, which are suitable for a computersolution, are adoptedTraditionally there are two methods-direct andstandard step methodsHigher order accurate methods to numericallyintegrate the governing differential equation arerequired
• Equation of gradually varied flow Consider the profile of gradually varied flow in the elementary length dx of an open channel. The total head above the datum at the upstream section is V2 H = z + d cos θ + α 2gH= total headz = vertical distance of the channel bottom above the datumd= depth of flow sectionθ= bottom slope angleα= energy coefficientV= mean velocity of flow through the section
• Equation of gradually varied flowDifferentiating dH dz dd d ⎛V2 ⎞ ⎜ ⎟ = + cos θ +α dx dx dx dx ⎜ 2 g ⎟ ⎝ ⎠The energy slope, S f = −dH / dxThe slope of the channel bottom, S0 = sin θ = −dz / dxSubstituting these slopes in above equations andsolving for dd/dx , dd S0 − S f = dx cos θ + αd (V 2 / 2 g ) / dd
• Equation of gradually varied flowThis is the general differential equation forgradually varied flowFor small θ, cosθ≈1, d ≈ y, and dd/dx ≈ dy/dx, thus theabove equation becomes, dy S0 − S f = dx 1 + αd (V 2 / 2 g ) / dySince V=Q/A, and dA/dy=T, the velocity head term maybe expressed as d ⎛ V 2 ⎞ αQ 2 dA−2 αQ 2 dA αQ 2T α ⎜ ⎟= =− =− dy ⎜ 2 g ⎟ 2 g dy gA3 dy gA3 ⎝ ⎠
• Equation of gradually varied flowSince, Z = A3 / TThe above may be written as d ⎛V2 ⎞ αQ 2 α ⎜ ⎟=− dy ⎜ 2 g ⎟ gZ 2 ⎝ ⎠Suppose that a critical flow of discharge equal toQ occurs at the section; g Q = Zc αAfter substituting d ⎛V2 ⎞ Zc2 α ⎜ ⎟=− dy ⎜ 2 g ⎟ Z2 ⎝ ⎠
• Equation of gradually varied flowWhen the Manning’s formula is used, the energyslope is 2 2 n V Sf = 2.22 R 4 / 3When the Chezy formula is used, V2 Sf = C 2RIn general form, Q2 Sf = K2
• Computation of gradually varied flowsThe analysis of continuity, momentum, and energyequations describe the relationships among various flowvariables, such as the flow depth, discharge, and flowvelocity throughout a specified channel lengthThe channel cross section, Manning n, bottom slope, andthe rate of discharge are usually known for these steady-state-flow computations.The rate of change of flow depth in gradually varied flows isusually small, such that the assumption of hydrostaticpressure distribution is valid
• Computation of gradually varied flowsThe graphical-integration method: Used to integrate dynamic equation graphically Two channel sections are chosen at x1 and x2 with corresponding depths of flow y1 and y2, then the distance along the channel floor is x2 y 2 dx x = x2 − x1 = ∫ dx = ∫ dy x1 y1 dy Assuming several values of y, and computing the values of dx/dy A curve of y against dx/dy is constructed
• Computation of gradually varied flowsThe value of x is equal to the shaded area formed by thecurve, y-axis, and the ordinates of dx/dy corresponding toy1 and y2.This area is measured and the value of x is determined.It applies to flow in prismatic as well as non-prismaticchannels of any shape and slopeThis method is easier and straightforward to follow.
• Computation of gradually varied flowsMethod of direct integration Gradually varied flow cannot be expressed explicitly in terms of y for all types of channel cross section Few special cases has been solved by mathematical integration
• Use of numerical integration for solving gradually varied flows Total head at a channel section may be written as αV 2 H =z+ y+ 2gWhere H = elevation of energy line above datum; z =elevation of the channel bottom above the datum; y = flow depth; V = mean flow velocity, and α =velocity-head coefficient The rate of variation of flow depth, y, with respect to distance x is obtained by differentiating the above equation.
• Solution of gradually varied flowsConsider x positive in the downstream flowdirectionBy differentiating the above energy equation, weget the water surface profile as dy So − S f = dx 1 − (αQ 2 B ) /( gA3 )The above equation is of first order ordinarydifferential equation, in which x is independentvariable and y is the dependent variable.
• Solution of gradually varied flowsIn the above differential equation for gradually varied flows, the parameters are as given below:x = distance along the channel (positive in downward direction)S0 = longitudinal slope of the channel bottomSf = slope of the energy lineB = top water surface widthg = acceleration due to gravityA = flow areaQ = rate of discharge
• Solution of gradually varied flowsThe right hand of the above equation shows that itis a function of x and y, so assume this functionas f(x,y), then we can write above equation as dy = f ( x, y ) dxIn which, So − S f f ( x, y ) = 1 − (αQ 2 B) /( gA3 )We can integrate above differential equation todetermine the flow depth along a channel length ,where f(x,y) is nonlinear function. So the numericalmethods are useful for its integration.
• Solution of gradually varied flowsThese methods yields flow depth discretelyTo determine the value y2 at distance x2, weproceed as follows y2 x2 ∫ dy = ∫ f ( x, y )dx y1 x1The above integration yields.. x2 y2 = y1 + ∫ f ( x, y )dx x1
• Solution of gradually varied flowsWe the y values along the downstream if dx ispositive and upstream values if dx is negativeWe numerically evaluate the integral termSuccessive application provides the water surfaceprofile in the desired channel lengthTo determine x2 where the flow depth will be y2,we proceed as follows: dx = F ( x, y ) dy
• Solution of gradually varied flowsIn which 1 − (αQ 2 B) /( gA3 ) F ( x, y ) = So − S fIntegrating the above differential equation we get, y2 x2 = x1 + ∫ F ( x, y )dy y1To compute the water surface profile, we begin thecomputations at a location where the flow depth for thespecified discharge is knownWe start the computation at the downstream controlsection if the flow is sub-critical and proceed in theupstream direction.
• Solution of gradually varied flowsIn supercritical flows, however, we start at an upstreamcontrol section and compute the profile in the downstreamdirectionThis is due to the fact that the flow depth is known at onlycontrol section, we proceed in either the upstream ordownstream direction.In the previous sections we discussed how to compute thelocations where a specified depth will occurA systematic approach is needed to develop for thesecomputationsA procedure called direct step method is discussed below
• Solution of gradually varied flowsDirect step method Assume the properties of the channel section are known then, z = z − S (x − x ) 2 1 0 2 1 In addition, the specific energy α1V12 2 α 2V2 E1 = y1 + E2 = y 2 + 2g 2g The slope of the energy grade line is gradually varied flow may be computed with negligible error by using the corresponding formulas for friction slopes in uniform flow.
• Solution of gradually varied flowsThe following approximations have been used toselect representative value of Sf for the channellength between section 1 and 2Average friction slope 1 S f = ( S f1 + S f 2 ) 2Geometric mean friction slope Sf = S f1 S f 2 2 S f1 S f 2Harmonic mean friction slope Sf = S f1 + S f 2
• Solution of gradually varied flowsThe friction loss may be written as 1 hf = ( S f1 + S f 2 )( x2 − x1) 2From the energy equation we can write, 1 z1 + E1 = z 2 + E 2 + ( S f1 + S f 2 )( x 2 − x1 ) 2Writing in terms of bed slope E2 − E1 x2 = x1 + 1 S o − ( S f1 + S f 2 ) 2Now from the above equation, the location of section 2 isknown.
• Solution of gradually varied flowsThis is now used as the starting value for the nextstepThen by successively increasing or decreasing theflow depth and determining where these depths willoccur, the water surface profile in the desiredchannel length may be computedThe direction of computations is automatically takencare of if proper sign is used for the numerator anddenominator
• Solution of gradually varied flowsThe disadvantages of this method are1. The flow depth is not computed at predetermined locations. Therefore, interpolations may become necessary, if the flow depths are required at specified locations. Similarly, the cross-sectional information has to be estimated if such information is available only at the given locations. This may not yield accurate results2. Needs additional effort3. It is cumbersome to apply to non-prismatic channels
• Solution of gradually varied flowsStandard step method When we require to determine the depth at specified locations or when the channel cross sections are available only at some specified locations, the direct step method is not suitable enough to apply and in these cases standard step method is applied In this method the following steps are followed : Total head at section 1 α1V12 H 1 = z1 + y1 + 2g
• Solution of gradually varied flowsTotal head at section 2 H 2 = H1 − h fIncluding the expression for friction loss hf 1 H 2 = H1 − ( S f1 + S f 2 )( x 2 − x1 ) 2Substituting the total head at 2 in terms ofdifferent heads, we obtain α 2Q 2 1 1 y2 + + S f 2 ( x2 − x1 ) + z2 − H1 + S f1 ( x2 − x1 ) = 0 2 2 2 2 gA2
• Solution of gradually varied flowsIn the above equation. A2 and Sf2 are functions of y2, and allother quantities are either known or already have beencalculated at section 1.The flow depth y2 is then determined by solving thefollowing nonlinear algebraic equation: α 2Q 2 1 1F ( y2 ) = y2 + + S f 2 ( x 2 − x1 ) + z 2 − H 1 + S f1 ( x 2 − x1 ) = 0 2 2 2 2 gA2The above equation is solved for y2 by a trial and errorprocedure or by using the Newton or Bisection methods
• Solution of gradually varied flowsHere the Newton method is discussed.For this method we need an expression for dF/dy2 dF α 2Q 2 dA2 1 d ⎛ Q 2n2 ⎜ ⎞ ⎟ =1− + ( x 2 − x1 ) dy 2 3 gA2 dy 2 2 dy 2 ⎜ C o A2 R 4 / 3 ⎜ 2 2 ⎟ ⎟ ⎝ 2 ⎠The last term of the above equations can beevaluated as ⎛ Q 2n 2 ⎞ 2 2 2 2 d ⎜ ⎟ = − 2Q n dA2 − 4 Q n dR2 dy2 ⎜ 2 2 4/3 ⎟ ⎜ Co A2 R ⎟ Co A2 R 4 / 3 dy2 3 Co A2 R 7 / 3 dy2 2 2 2 2 ⎝ 2 ⎠ 2 2 − 2Q 2 n 2 dA2 4 Q 2 n 2 1 dR2 = − Co A2 R2 / 3 dy2 3 Co A2 R2 / 3 R2 dy2 2 2 4 2 2 4 ⎛ S ⎞ = −2⎜ S f B2 + 2 f 2 dR2 ⎟ ⎜ 2 A 3 R2 dy2 ⎟ ⎝ 2 ⎠
• Solution of gradually varied flowsHere dA2/dy2 is replaced by B2 in the aboveequation and substituting for this expression dF α 2 Q 2 B2 ⎛ B2 2 S f 2 dR 2 ⎞ =1− − ( x 2 − x1 )⎜ S f 2 + ⎟ dy 2 gA2 3 ⎜ A2 3 R2 dy 2 ⎟ ⎝ ⎠By using y=y1, dy/dx=f(x1,y1) , then the flow depth y* , can be computed from the equation 2 y * = y1 + f ( x1 , y1 )( x 2 − x1 ) 2During subsequent step, however may be y* 2determined by extrapolating the change in flowdepth computed during the preceding step.
• Solution of gradually varied flowsA better estimate for y2 can be computed from theequation * F ( y2 ) y2 = y* − 2 [dF / dy2 ]*If y2 − y* 2 is less than a specified tolerance, ε, then y* 2 is the flow depth y2, at section 2; otherwise,set y* = y2 2 and repeat the steps until a solutionis obtained
• Solution of gradually varied flowsIntegration of differential equation For the computation of the water surface profile by integrating the differential equation, the integration has to be done numerically, since f(x,y) is a nonlinear function Different numerical methods have been developed to solve such nonlinear system efficiently The numerical methods that are in use to evaluate the integral term can be divided into following categories:1. Single-step methods2. Predictor-corrector methods
• Solution of gradually varied flowsThe single step method is similar to direct step method andstandard step methodThe unknown depths are expressed in terms of a functionf(x,y), at a neighboring point where the flow depth is eitherinitially known or calculated during the previous stepIn the predictor-corrector method the value of the unknownis first predicted from the previous stepThis predicted value is then refined through iterative processduring the corrector part till the solution is reached by theconvergence criteria
• Solution of gradually varied flows Single-step methods Euler method Modified Euler method Improved Euler method Fourth-order Runge-Kutta method1. Euler method: In this method the rate of variation of y with respect to x at distance xi can be estimated as dy yi = = f ( xi , yi ) dx i
• Solution of gradually varied flowsThe rate of change of depth of flow in a gradually variedflow is given as below S o − S fi f ( xi , y i ) = 1 − (α Q 2 Bi ) /( gAi3 )All the variables are known in the right hand side, soderivative of y with respect to x can be obtainedAssuming that this variation is constant in the interval xi toxi+1, then the flow depth at xi+1 can be computed from theequation yi +1 = yi + f ( xi , yi )( xi +1 − xi )
• Solution of gradually varied flows cont..2. Modified Euler methodWe may also improve the accuracy of the Euler method by using the slope of the curve y = y (x) at x = x and i +1 / 2 1 y = yi +1/ 2 , in which xi+1/ 2 = (xi + xi+1 ) and yi +1/ 2 = yi + 1 yi ∆x . 2 2Let us call this slope yi +1/ 2 . Then yi +1 = yi + yi +1/ 2 ∆x or yi +1 = yi + f ( xi +1/ 2 , yi +1/ 2 )∆xThis method, called the modified Euler method, is second- order accurate.
• Solution of gradually varied flows cont..3. Improved Euler methodLet us call the flow depth at xi +1 obtained by using Eulermethod as y * i.e., i +1 * yi +1 = yi + yi ∆xBy using this value, we can compute the slope of the curve ( y = y (x) at x = xi +1 , i.e., yi +1 = f xi +1 , yi*+1 . Let us )use the average value of the slopes of the curve at xi and xi +1 . Then we can determine the value of yi +1 from theequation yi +1 = yi + 2 ( 1 ) yi + yi +1 ∆x . This equation may be yi +1 = yi + 1 [ ] f ( xi , yi ) + f ( xi +1 , yi*+1 ) ∆xwritten as 2 . This method called the improved Euler method, is second order accurate.
• Solution of gradually varied flows cont..4. Fourth-order Runge Kutta Method k1 = f ( xi , yi ) 1 1 k 2 = f ( xi + ∆x, yi + k1∆x) 2 2 1 1 k3 = f ( xi + ∆x, yi + k 2 ∆x) 2 2 k 4 = f ( xi + ∆x, yi + k3∆x) 1 yi +1 = yi + (k1 + 2k 2 + 2k3 + k 4 )∆x 6
• Solution of gradually varied flows cont..Predictor-corrector methods In this method we predict the unknown flow depth first, correct this predicted value, and then re-correct this corrected value. This iteration is continued till the desired accuracy is met. In the predictor part, let us use the Euler method to predict the value of yi+1, I.e yi(+1 = yi + f ( xi , yi )∆x 0) we may correct using the following equation 1 yi +1 = yi + [ f ( xi , yi ) + f ( xi +1, yi(+1 )]∆x (1) 0) 2
• Solution of gradually varied flows cont.. Now we may re-correct y again to obtain a better value: 1 yi(+1 = yi + 2) [ f ( xi , yi ) + f ( xi +1, yi(1) )]∆x +1 2 Thus the j th iteration is 1 j− yi(+1 = yi + j) [ f ( xi , yi ) + f ( xi +1, yi(+1 1) )]∆x 2 Iteration until j− yi(+1 − yi(+1 1) ≤ ε j) , where ε = specified tolerance
• Saint-Venant equations1D gradually varied unsteady flow in an openchannel is given by Saint-Venant equations ∂v ∂y ∂y a + vw +w =0 ∂x ∂x ∂t ∂v ∂y ∂v v +g + = g ( So − S f ) ∂x ∂x ∂tX - distance along the channel, t - time, v- averagevelocity, y - depth of flow, a- cross sectional area, w- top width, So- bed slope, Sf - friction slope
• Saint Venant equationsFriction slope n 2v 2 Sf = r4 / 3r - hydraulic radius, n-Manning’s roughnesscoefficientTwo nonlinear equations in two unknowns v and yand two dependent variables x and tThese two equations are a set of hyperbolic partialdifferential equations
• Saint-Venant equationsMultiplying 1st equation by ± g / aw and adding itto 2nd equation yields ⎡∂ ∂ ⎤ 1⎡∂ ∂⎤ ⎢ ∂t + (v ± c ) ∂x ⎥ v ± c ⎢ ∂t + (v ± c ) ∂x ⎥ y = g (S o − S f ) ⎣ ⎦ ⎣ ⎦The above equation is a pair of equations alongcharacteristics given by dx = g (S o − S f ) dv g dy =v±c ± dt dt c dtBased on the equations used, methods areclassified as characteristics methods and directmethods.
• FD methods for Saint Venant equations The governing equation in the conservation form may be written in matrix form as U t + Fx + S = 0 In which ⎛a ⎞ ⎛ va ⎞ ⎛0 ⎞ =⎜ ⎟ U ⎜ ⎟ F =⎜ 2 ⎟ S= ⎜ ⎟ ⎜ v a + gay ⎟ ⎜ − ga ( s0 − s f ) ⎟ ⎝ va ⎠ ⎝ ⎠ ⎝ ⎠ General formulation ∂f ( fin +1 + fin +1) − ( f in + fin 1 ) +1 + = ∂t ∆t
• FD methods for Saint Venant equations Continued… n +1 n +1 n n ∂f α ( f i +1 + f i ) (1 − α )( f i +1 + f i ) = + ∂x ∆x ∆x 1 1 f = α ( f in +1 + fin +1 ) + (1 − α )( f in 1 + f in ) +1 + 2 2 U in +1 + U in +1 = 2 +1 ∆t ∆x [ α ( Fin +1 − Fin +1) + (1 − α )( Fin 1 − Fin ) +1 + ] [ + ∆t α ( Sin +1 + Sin +1 ) + (1 − α )( Sin 1 + Sin ) +1 + ] = U in + U in 1 +
• FD methods for Saint Venant equations Boundary conditions: yin ++1 = yresd 1 ,j Downstream boundary: Left boundary y=yu= uniform flow depth v=vu= uniform velocity Right boundary y=yc= Critical flow depth v=vc= Critical velocity
• FD methods for Saint Venant equations Stability: unconditionally stable provided α>0.5, i.e., the flow variables are weighted toward the n+1 time level. Unconditional stability means that there is no restriction on the size of ∆x and ∆t for stability
• Solution procedureThe expansion of the equation… ain +1 + ain +1 + 2 +1 ∆t ∆x {[ ] [ α (va)i +1 − (va)i +1 + (1 − α ) (va)i +1 − (va)i n +1 n n n ]} = ain + ain 1 + (va)i +1 + (va)i +1 + 2 n n +1 ∆t ∆x {[ α (v 2 a + gay )i +1 − (v 2 a + gay )i +1 n +1 n ]} {[ − ga∆t α ( s0 − s f )i +1 + ( s0 − s f )i +1 n +1 n ]} = ga∆t {1 − α )[( s ( 0 n n − s f )i +1 + ( s0 − s f )i ]} + (va)i + (va)i +1 − (1 − α ) 2 n n ∆t 2 ∆x { (v a + gay )i +1 − (v 2 a + gay )i n n }The above set of nonlinear algebraic equationscan be solved by Newton-Raphson method
• Assignments1. Prove the following equation describes the gradually varied flow in a channel having variable cross section along its length: ( ) dy SO − S f + V / gA ∂A / ∂x = 2 dx ( ) 1 − BV 2 / ( gA)2. Develop computer programs to compute the water- surface profile in a trapezoidal channel having a free overfall at the downstream end. To compute the profile, use the following methods:(i) Euler method(ii) Modified Euler method(iii) Fourth-order Runge-Kutta method
• Assignments3. Using method of characteristics, write a computer program to solve 1D gradually varied unsteady flow in an open channel as given by Saint-Venant equations, assuming initial and boundary conditions.
• Solution of Pipe Transients and Pipe Network Problems Module 10 6 Lectures
• ContentsBasic equation oftransientsMethod ofcharacteristics for itssolutionComplex boundaryconditionPipe network problemsNode based and Loopbased modelsSolution throughNewton and Picardtechniques
• Basic equations of transients The flow and pressures in a water distribution system do not remain constant but fluctuate throughout the day Two time scales on which these fluctuations occur1. daily cycles2. transient fluctuations
• Basic equations of transientsContinuity equation: applying the law ofconservation of mass to the control volume (x1and x2) x2 ∂ ∫ ∂t ( ρA)dx +( ρAV ) x1 2 − ( ρAV )1 = 0By dividing throughout by ∆x as it approach zero,the above equation can be written as ∂ ∂ ( ρA) + ( ρAV ) = 0 ∂t ∂xExpanding and rearranging various terms, usingexpressions for total derivatives, we obtain 1 dρ 1 dA ∂V + + =0 ρ dt A dt ∂x
• Basic equations of transientsNow we define the bulk modulus of elasticity, K, ofa fluid as K= dp dρ ρThis can be written as dρ = ρ dp dt K dtArea of pipe, A = πR , where R is the radius of the 2pipe. Hence dA / dt = 2πRdR / dt. In terms of strain thismay be written as dA = 2 A dε dt dt dε D dpNow using hoop stress, we obtain = dt 2eE dt
• Basic equations of transients Following the above equations one can write, 1 dA D dp = A dt eE dt Substituting these equations into continuity equation and simplifying the equation yields ∂V 1 ⎡ 1 ⎤ dp + ⎢1 + eE / DK ⎥ dt = 0 ∂x K⎣ ⎦ K/ρ a2 = Let us define , where a is wave speed 1 + ( DK ) / eEwith which pressure waves travel back and forth. Substituting this expression we get the following continuity equation ∂p ∂p ∂V +V + ρa 2 =0 ∂t ∂x ∂x
• Method of characteristics The dynamic and continuity equations for flow through a pipe line is given by ∂Q ∂H f L1 = + gA + QQ =0 ∂t ∂x 2 DA ∂Q ∂H L2 = a 2 + gA =0 ∂x ∂tWhere Q=discharge through the pipe H=piezometric head A=area of the pipe g=acceleration due to gravity a=velocity of the wave D=diameter of the pipe x=distance along the pipe t=time
• Method of characteristicsThese equations can be written in terms of velocity 1 ∂v ∂H f L1 = + + vv = 0 g ∂t ∂x 2 Dg ∂H a 2 ∂v L2 = + =0 ∂t g ∂xWhere, k a= e[1 + (kD / ρE )]
• Method of characteristics Where k=bulk modulus of elasticity ρ=density of fluid E=Young’s modulus of elasticity of the materialTaking a linear combination of L1 and λL2, leads to ⎛ ∂Q ∂Q ⎞ ⎛ ∂H 1 ∂H ⎞ f ⎜ + λa 2 ⎟ + λgA⎜ + ⎟+ QQ =0 ⎝ ∂t ∂x ⎠ ⎝ ∂T λ ∂x ⎠ 2 DA Assume H=H(x,t);Q=Q(x,t)
• Method of characteristicsWriting total derivatives , dQ ∂Q ∂Q dx dH ∂H ∂H dx = + = + dt ∂t ∂x dt dt ∂t ∂x dtDefining the unknown multiplier λ as 1 dx 1 = = λa 2 λ=± λ dt aFinally we get dx dQ gA dH f = ±a ± + QQ =0 dt dt a dt 2 DAThe above two equations are called characteristicequations and 2nd among them is condition along thecharacteristics
• Method of characteristicsFigure… t P Negative characteristic Positive characteristic line line A C B x Characteristic lines Constant head reservoir at x=0, at x=L, valve is instantaneously closed. Pressure wave travels in the upstream direction.
• Complex boundary conditionWe may develop the boundary conditions bysolving the positive or negative characteristicequations simultaneous with the condition imposedby the boundary.This condition may be in the form of specifyinghead, discharge or a relationship between thehead and dischargeExample: head is constant in the case of aconstant level reservoir, flow is always zero at thedead end and the flow through an orifice is relatedto the head loss through the orifice.
• Complex boundary conditionConstant-level upstream reservoir In this case it is assume that the water level in the reservoir or tank remains at the same level independent of the flow conditions in the pipeline This is true for the large reservoir volume If the pipe at the upstream end of the pipeline is 1, then H P1,1 = H ru where H ru is the elevation of the water level in the reservoir above the datum. At the upstream end, we get the negative characteristic equation, QP1,1 = Cn + Ca H ru
• Complex boundary conditionConstant-level downstream reservoir In this case, the head at the last node of pipe i will always be equal to the height of the water level in the tank above the datum, Hrd: H Pi , n +1 = H rd At the downstream end, we have the positive characteristic equation linking the boundary node to the rest of the pipeline. We can write QPi, n +1 = Cp − Ca H rd
• Complex boundary conditionDead end At a dead end located at the end of pipe i, the discharge is always zero: Q Pi , n +1 = 0 At the last node of pipe i, we have the positive characteristics equation. We get Cp H Pi , n +1 = Ca
• Complex boundary conditionDownstream valve In the previous boundaries, either the head or discharge was specified, However for a valve we specify a relationship between the head losses through the valve and the discharge Denoting the steady-state values by subscript 0, the discharge through a valve is given by the following equation: Q0 = C d Av 0 2gH 0
• Complex boundary conditionWhereCd=coefficient of dischargeAv0=area of the valve openingH0=the drop in headQ0= a discharge By assuming that a similar relationship is valid for the transient state conditions, we get Q Pi , n +1 = (C d Av ) P 2 gH Pi , n +1 Where subscript P denotes values of Q and H at the end of a computational time interval
• Complex boundary conditionFrom the above two equations we can write 2 2 H Pi, n +1 QPi, n +1 = (Q0τ ) H0Where the effective valve opening is τ = (C d Av ) P /(C d Av ) 0For the last section on pipe i, we have the positivecharacteristic equation 2 QPi, n +1 + CvQPi, n +1 − C p Cv = 0
• Complex boundary conditionWhere Cv = (τQ0 ) 2 /(Ca H 0 )Solving for QPi,n+1 and neglecting the negativesign with the radical term, we get 2 Q Pi , n +1 = 0.5( −C v + C v + 4C p C v )
• Pipe network problemsThe network designing is largely empirical.The main must be laid in every street along whichthere are properties requiring a supply.Mains most frequently used for this are 100 or150mm diameterThe nodes are points of junction of mains or wherea main changes diameter.The demands along each main have to beestimated and are then apportioned to the nodes ateach end in a ratio which approximated
• Pipe network problemsThere are a number of limitations and difficulties with respect to computer analysis of network flows , which are mentioned below:1. The limitation with respect to the number of mains it is economic to analyze means that mains of 150 mm diameter and less are usually not included in the analysis of large systems, so their flow capacity is ignored2. It is excessively time consuming to work out the nodal demands for a large system
• Pipe network problems1. The nodal demands are estimates and may not represent actual demands2. Losses, which commonly range from 25% to 35% of the total supply, have to be apportioned to the nodal demands in some arbitrary fashion.3. No diversification factor can be applied to the peak hourly demands representing reduced peaking on the larger mains since the total nodal demands must equal the input to the system4. The friction coefficients have to be estimated.5. No account is taken of the influence of pressure at a node on the demand at that node, I.e under high or low pressure the demand is assumed to be constant.
• Governing Equation for Network AnalysisEvery network has to satisfy the following equations:1. Node continuity equations – the node continuity equations state that the algebraic sum of all the flows entering and leaving a node is zero. j = 1,..., NJ ∑ Q( p) + ∑ Q( p) + C ( j ) = 0, pε { j} pε { j}Where NJ is the number of nodes, Q(p) is the flow in element p (m3/s), C(j) is the consumption at node j (m3/s), pε { j} refers to the set of elements connected to node j.
• Network Analysis2. Energy conservation equations – the energy conservation equations state that the energy loss along a path equals the difference in head at the starting node and end node of the path.∑ (± )h( p) + ∑ (± )h( p) − [H (s(l )) − H (e(l ))] = 0 l = 1,..., NL + NPATH pε {l} pε {l}Where h(p) is the head loss in element p(m), s(l) is the starting node of path l, e(l) is the end of path 1, NL is the number of loops, and NPATH is the number of paths other than loops and pε {l} refers to the pipes belonging to path l. loop is a special case of path, wherein, the starting node and end node are the same, making the head loss around a loop zero, that is, ∑ (± )h( p) + ∑ (± )h( p) = 0
• Network Analysis3. Element characteristics – the equations defining the element characteristics relate the flow through the element to the head loss in the element. For a pipe element, h(p) is given by, h( p ) = R( p )Q( p ) eWhere R(p) is the resistance of pipe p and e is the exponent in the head loss equation. If Hazen-Williams equation is used, where e=1.852 10.78 L( p ) R( p) = D( p ) 4.87 CHW ( p )1.852Where L(p) is the length of pipe p(m), D(p) is the diameter of pipe p(m), and CHW (p) is the Hazen-Williams coefficient for pipe p.
• Network AnalysisFor a pump element, h(p) is negative as head is gained in the element. The characteristics of the pump element are defined by the head-discharge relation of the pump. This relationship may be expressed by a polynomial or in an alternate form. In this study, the following equation is used. ⎡ ⎡ Q( p) ⎤ C 3( m ) ⎤ h( p ) = − HR(m) ⎢C1(m) − C 2(m).⎢ ⎥ ⎢ ⎣ QR(m) ⎥ ⎦ ⎥ ⎣ ⎦Where HR(m) is the rated head of the m-th pump (m), QR(m) is the rated discharge of m-th pump (m3/s), C1(m), C2(m) and C3(m) are empirical constants for the m-th pump obtained from the pump charateristics. Here p refers to the element corresponding to the m-th pump. If the actual pump characteristics are available, the constants C1, C2, C3 may be evaluated. C1 is determined from the shutoff head as HO(m) C1(m) = HR(m)
• Network AnalysisWhere HO(m) is the shutoff head of the m-th pump. As h(p)=-HR(m) for rated flow, C1(m) − C 2(m) = 1From which C2(m)is determined. C3 (m) is obtained by fitting the equation to the actual pump characteristics.For a pipe element, (1 / e ) ⎡ h( p ) ⎤ H (i ) − H ( j ) Q( p) = ⎢ = ⎣ R( p) ⎥⎦ R( p ) (1/ e ) H (i ) − H ( j ) (1−1 / e )For Hazen-Williams equation, the above equation becomes H (i ) − H ( j ) Q( p) = 0.46 R ( p ) 0.54 H (i ) − H ( j )
• Network AnalysisSimilarly for a pump element 1 ⎡ 1 ⎡ H ( j ) − H (i ) ⎤ ⎤ C 3( m ) Q( p ) = (± )QR(m) ⎢ ⎢C1(m) ± HR(m) ⎥ ⎥ ⎣ C 2( m ) ⎣ ⎦⎦Where outside the parenthesis, + sign is used if flow istowards node j and –sign is used if flow is away from node jand, inside the parenthesis, the + sign is used, if i is thenode downstream of the pump and the – sign is used if j isthe node downstream of the pump.
• Network AnalysisThe network analysis problem reduces to one of solving a set of non-linear algebraic equations. Three types of formulation are used – thenodal, the path and the node and path formulation.Each formulation and method of analysis has its own advantages andlimitations. In general path formulation with Newton-Raphson methodgives the fastest convergence with minimum computer storagerequirements.The node formulation is conceptually simple with a very convenientdata base, but it has not been favoured earlier, because inconjunction with Newton-Raphson method, the convergence to thefinal solution was found to depend critically on the quality of the initialguess solution.The node and path formulation can have a self starting procedurewithout the need for a guess solution, but this formulation needs themaximum computer storage.
• Node based modelsThe node (H) equations The number of equations to be solved can be reduced from L+J-1 to J by combining the energy equation for each pipe with continuity equation. The head loss equation for a single pipe can be written as h = KQ n nij H i − H j = K ij Qij sgn Qij Where Hi=head at i th node, L Kij= head loss coefficient for pipe from node i to node j Qij= flow in pipe from node i to node j, L3/t nij=exponent in head loss equation for pipe from i-j
• Node based models The double subscript shows the nodes that are connect by a pipe Since the head loss is positive in the direction of flow, sgn Qij=sgn (Hi-Hj), and we solve for Q as 1 / nij Qij = sgn( H i − H j )( H i − H j / K ij ) The continuity equation at node I can be written as mi ∑ Qki = U i k =1Where Qki=flow into node i from node k, L3/TUi=consumptive use at node i, L3/Tmi=number of pipes connected to node i.
• Node based modelsCombining energy and continuity equations for each flow inthe continuity equation gives 1 / nki mi ⎛ H k − Hi ⎞ ∑ sgn( H k − H i )⎜ ⎟ = Ui k =1 ⎜ K ki ⎟ ⎝ ⎠The above is a node H equation, there is one such equationfor each node, and one unknown Hi for each equationThese equations are all nonlinearThe node (H) equations are very convenient for systemscontaining pressure controlled devices I.e. check valves,pressure reducing valves, since it is easy to fix the pressureat the downstream end of such a valve and reduce thevalue if the upstream pressure is not sufficient to maintaindownstream pressure
• Loop based modelsThe Loop (∆Q) equations One approach is to setting up looped system problems is to write the energy equations in such a way that, for an initial solution, the continuity will be satisfied Then correct the flow in each loop in such a way that the continuity equations are not violated. This is done by adding a correction to the flow to every pipe in the loop . If there is negligibly small head loss, flow is added around the loop, if there is large loss, flow is reduced Thus the problem turns into finding the correction factor ∆Q such that each loop energy equation is satisfied
• Loop based models The loop energy equations may be written ml F (∆Q) = ∑ K i [sgn(Qii + ∆Ql )] Qii + ∆Ql n = dhl (l=1,2,…,L) i =1WhereQii = initial estimate of the flow in i th pipe, L3/T∆Ql = correction to flow in l th loop, L3/Tml = number of pipes in l th loopL = number of loops
• Loop based modelsThe Qi terms are fixed for each pipe and do not changefrom one iteration to the next.The ∆Q terms refer to the loop in which the pipe fallsThe flow in a pipe is therefore Qi + ∆Q for a pipe that lies inonly one loop.For a pipe that lies in several loops (say ,a b, and c) theflow might be Qi + ∆Qa − ∆Qb + ∆Qc
• Loop based modelsThe negative sign in front of b term is includedmerely to illustrate that a given pipe may besituated in positive direction in one loop and innegative direction in another loop.When the loop approach is used, a total of Lequations are required as there are l unknowns,one for each loop
• Solution of pipe network problems through Newton-Raphson methodNewton-Raphson method is applicable for the problemsthat can be expressed as F(x)=0, where the solution is thevalue of x that will force F to be zeroThe derivative of F can be a expressed by dF F ( x + ∆x) − F ( x) = dx ∆xGiven an initial estimate of x, the solution to the problem isthe value of x+∆x that forces F to 0. Setting F(x+∆x) tozero and solving for ∆x gives F ( x) ∆x = − F ( x)
• Solution of pipe network problems through Newton-Raphson methodNew value of x+∆x becomes x for the next iteration. Thisprocess is continued until F is sufficiently close to zeroFor a pipe network problem, this method can be applied tothe N-1=k, H-equationsThe head (H) equations for each node (1 through k), it ispossible to write as: 1 / nij ⎛ H −H ⎞ [ ] mi ⎜ j i ⎟ F ( H i ) = ∑ sgn( H j − H i ) ⎜ − Ui = 0 (i = 1,2,..., K ) ⎟ j =1 ⎜ K ji ⎟ ⎝ ⎠Where mi= number of pipes connected to node I Ui= consumptive use at node i, L3/TF(i) and F(i+1) is the value of F at ith and (i+1)th iteration,then dF = F (i + 1) − F (i )
• Solution of pipe network problems through Newton-Raphson methodThis change can also be approximated by totalderivative ∂F ∂F ∂F dF = ∆H1 + ∆H 2 + ... + ∆H k ∂H1 ∂H 2 ∂H kWhere ∆H= change in H between the ith and(i+1)th iterations, LFinding the values of ∆H which forces F(i+1)=0.Setting above two equations equal, results in asystem of k linear equations with k unknowns (∆H)which can be solved by the any linear methods
• Solution of pipe network problems through Newton-Raphson method Initial guess for H Calculate partial derivatives of each F with respect to each H Solving the resulting system of linear equations to find H, and repeating until all of the F’s are sufficiently close to 0 The derivative of the terms in the previous equation is given by 1 / nij ⎛ H −H ⎞ d [ ( )] ⎜ i sgn H i − H j ⎜ j ⎟ = −1 (H i − H j )(1 / n )−1 (nij )(Kij )1 / n ij dH j K ij ⎟ ⎜ ⎟ ij ⎝ ⎠ 1 / nijand ⎛ H −H ⎞ d [ ( )] ⎜ i sgn H i − H j ⎜ j ⎟ = 1 (H i − H j )(1 / n )−1 (nij )(Kij )1 / n ij dH i K ij ⎟ ⎜ ⎟ ij ⎝ ⎠
• Solution of pipe network problems through Hardy-Cross methodThe linear theory method and the Newton-Raphsonmethod can converge to the correct solution rapidlyManual solution or solution on small computers may notbe possible with these methodsHowever, the Hardy-cross method, which dates back to1936, can be used for such calculations, in essence, theHardy-Cross method is similar to applying the Newton-Raphson method to one equation at a timeHardy cross method is applied to ∆Q equations although itcan be applied to the node equations and even the flowequations.The method, when applied to the ∆Q equations, requiresan initial solution which satisfies the continuity equation
• Solution of pipe network problems through Hardy-Cross method Nevertheless it is still widely used especially for manual solutions and small computers or hand calculators and produces adequate results for most problems For the l th loop in a pipe network the ∆Q equation can be written as follows ml F (∆Q1 ) = ∑ K i [sgn (Qii + ∆Ql )] Qii + ∆Ql n − dhl = 0 i =1Where∆Ql=correction to l th loop to achieve convergence, L3/TQii=initial estimates of flow in i th pipe (satisfies continuity),L3/Tml=number of pipes in loop l
• Solution of pipe network problems through Hardy-Cross methodApplying the Newton-Raphson method for a single equationgives ml n −1 ∑ K i (Qii + ∆Ql ) Qii + ∆Ql ∆Q(k + 1) = ∆Q − i =1 ml n −1 ∑ K i ni Qii + ∆Ql i =1Where the k+1 refers to the values of ∆Q in the (k+1) thiteration, and all other values refer to the k th iterations andare omitted from the equation for ease of readingThe above equation is equivalent to… ∆Q(k + 1) = ∆Q(k ) − F (k ) / F (k )Sign on the Qi terms depend on how that pipe is situated inthe loop under consideration.
• Assignments1. How many ∆Q equations must be set up for a network with L loops (and pseudo-loops), N nodes, and P pipes? How many H-equations must be set up?2. What are the primary differences between the Hardy- Cross and Newton-Raphson method for solving the ∆Q equations?3. For two pipes in parallel, with K1>K2, what is the relationship between K1, K2, and Ke , the K for the equivalent pipe replacing 1 and 2 (h=KQn)? a. K1>K2>Ke b. K1>Ke>K2 c. Ke>K1>K2
• Assignments4. Derive the following momentum equation by applying conservation of momentum for a control volume for transient flow through a pipe ∂V ∂V 1 ∂p fV V +V + + =0 ∂t ∂x ρ ∂x 2D5. Develop the system of equations for the following network (consists of 8 nodes and 9 elements, out of which 8 are pipe elements and the other is a pump element) to find the values of the specified unknowns. Also write a computer program to solve the system of equations.
• Assignments continued 1 28 2 1 - Node with H unknown & C known - Node with H known & C known 3 4 - Node with H known & C unknown - Node with R unknown 5 3 4 - Pump element Unknowns 6 7 H [2], H [4], H [5] R [4], R [5] C [6], C [7], C [8]7 5 6 8 9
• Contaminant Transport inOpen Channels and Pipes Module 11 5 lectures
• ContentsContaminant transportDefinition of termsIntroduction to ADEequationFew simple solutionsSolution of ADE throughFD methodsProblems associated withsolution methodsDemonstration of methodsfor open channel and pipeflows
• Contaminant transportContaminant transport modeling studies are usuallyconcerned with the movement within an aquifer system of asolute.These studies have become increasingly important with thecurrent interest on water pollution.Heat transport models are usually focused on developinggeothermal energy resources.Pollutant transport is an obvious concern relative to waterquality management and the development of waterprotection programs
• Definition of termsTerminologies related to contaminant transport Diffusion: It refers to random scattering of particles in a flow to turbulent motion Dispersion: This is the scattering of particles by combined effect of shear and transverse diffusion Advection: The advective transport system is transport by the imposed velocity system
• Introduction to ADE equationThe one dimensional formulation of conservative tracermass balance for advective-dispersive transport processis ∂C ∂C ∂ 2C +u = Dl ±R ∂t ∂x ∂x 2 ∂C u = advection of tracer with fluid ∂x ∂ 2C Dl = molecular diffusion +Hydrodynamic ∂x 2 dispersion ∂C = time rate of change of concentration ∂t at a point R = reaction term depends on reaction rate andconcentration (chemical or biological, not considered inthe present study)
• Few simple solutionsBear discussed several analytical solutions to relativelysimple, one-dimensional solute transport problems.However, even simple solutions tend to get overwhelmedwith advanced mathematics.As an example, consider the one-dimensional flow of asolute through the soil column, the boundary conditionsrepresented by the step function input are describedmathematically as: C (1,0) = 0 1≥ 0 C (0, t ) = C0 t≥0 C ( ∞, t ) = 0 t≥0
• Few simple solutionsFor these boundary conditions the solution to ADEequation for a saturated homogeneous porousmedium is: ⎡ ⎛ vl ⎞ ⎛ 1 + vt ⎞⎤ C 1⎢ (1 − v t ) = erfc + exp⎜ ⎟erfc⎜ ⎟⎥ Co 2 ⎢ ⎜D ⎟ ⎜2 Dt ⎟⎥ 2 Dl t ⎝ l ⎠ ⎝ l ⎠⎦ ⎣erfc represents the complimentary error function; lis the distance along the flow path; and v is theaverage water velocity.For conditions in which the dispersivity Dl of theporous medium is large or when 1 or t is large, thesecond term on the right-hand side of equation isnegligible.
• Few simple solutionsThis equation can be used to compute the shapes of thebreakthrough curves and concentration profilesAnalytical models represent an attractive alternative to bothphysical and numerical models in terms of decreasedcomplexity and input data requirements.Analytical models are often only feasible when based onsignificant simplifying assumptions, and these assumptionsmay not allow the model to accurately reflect the conditionsof interest.Additionally, even the simplest analytical models tend toinvolve complex mathematics
• Solution of ADE through FD methodsUsing implicit finite central difference method ⎛ ∂C ⎞ ⎛ ∂C ⎞ ⎜ Dl ⎟ − ⎜D ⎟ ⎝ ∂x ⎠i + 1 ⎝ l ∂x ⎠ 1 i− 2 2 − u Ci +1 − Ci = Ci − C0 i ∆x ∆x ∆t Ci +1 − Ci Ci − Ci −1 Ci +1 − Ci Ci − C0 ( Dl ) 1 − ( Dl ) 1 − ui = i+ ∆x 2 i− ∆x 2 ∆x ∆t 2 2 ( Dl ) 1 ⎛ ( Dl ) 1 ( Dl ) 1 ⎞ ⎛ ( Dl ) 1 ⎞ i− ⎜ i− i+ ⎟ ⎜ i+ ⎟ ui 1 ⎟ ui ⎟ C 2 C −⎜ i −1 ⎜ 2 + 2 − + Ci + ⎜ 2 − Ci +1 = − 0 ∆x 2 ∆x 2 ∆x 2 ∆x ∆t ⎟ ⎜ ∆x 2 ∆x ⎟ ∆t ⎜ ⎟ ⎜ ⎟ ⎝ ⎠ ⎝ ⎠
• Solution of ADE through FD methodsContinued… ( Dl ) 1 ⎛ ( Dl ) 1 ( Dl ) 1 ⎞ ⎛ ( Dl ) 1 ⎞ i− ⎜ i− i+ ⎟ ⎜ i+ ⎟ ⎜ ui 1 ⎟ ui ⎟ C − 2 C i −1 + ⎜ 2 + 2 − + Ci − ⎜ 2 − Ci +1 = 0 ∆x 2 ∆x 2 ∆x 2 ∆x ∆t ⎟ ⎜ ∆x 2 ∆x ⎟ ∆t ⎜ ⎟ ⎜ ⎟ ⎝ ⎠ ⎝ ⎠ The above equation can be written in matrix form as:1. For internal nodes AACi −1 + BBCi + CCCi +1 = DD
• Solution of ADE through FD methods2. For Right boundary condition:Using forward finite difference formation in the right boundary, flux can be written as follows as Ci +1 − Ci = flux ∆x Ci +1 = Ci + flux(∆x) AAC−1 + BBC + CC(Ci + flux(∆x)) = DD i i AAC−1 + (BB + CC)Ci = DD− CCflux∆x) i (
• Solution of ADE through FD methods3. For Left boundary condition: At the left boundary, initial condition and Dirichlet condition are used which is given below: C ( x,0) = Ci x > 0; C (0, t ) = C0 t > 0; Using backward finite difference formation in the right boundary, flux can be written as follows Ci − Ci −1 = flux ∆x
• Solution of ADE through FD methodsContinued Ci −1 = Ci − flux(∆x ) ( AA + BB )Ci + CCCi +1 = DD + AA( flux∆x )The above three equations are solved for Ci at all the nodes for the mesh. Thomas Algorithm can be used to solve the set of equations.
• Problems linked with solution methods The contaminant transport in open channels and pipes are solved through various computer models. Because of their increased popularity and wide availability, it is necessary to note the limitations of these models The first limitation is the requirement of significant data Some available data may not be useful The second limitation associated with computer models is their required boundary conditions
• Problems linked with solution methods Computer models can be very precise in their predictions, but these predictions are not always accurate The accuracy of the model depends on the accuracy of the input data Some models may exhibit difficulty in handling areas of dynamic flow such as they occur very near wells Another problem associated with some computer models is that they can be quite complicated from a mathematical perspective
• Problems linked with solution methods These computer modeling are also time consuming This is usually found to be true if sufficient data is not available Uncertainty relative to the model assumption and usability must be recognized The computer model has been some time misused, as for example the model has been applied to the cases where it is not even applicable.
• Demonstration of methods for open channel flowsMass transport in streams or long open channels istypically described by a one-dimensionalAdvection {dispersion equation, in which the longitudinaldispersion co-efficient is the combination of varioussection-averaged hydrodynamic mixing effects.The classical work of Taylor (1953, 1954) established thefact that the primary cause of dispersion in shear flow isthe combined action of lateral diffusion and differentiallongitudinal advection.
• Demonstration of methods for open channel flowsThe transport of solutes in streams is affected by a suite ofphysical, chemical and biological processes, with therelative importance of each depending on the geo-environmental setting and properties of the solutes.For many species, chemical and biological reactions arejust as influential as the physical processes of advectionand dispersion in controlling their movement in an aquaticsystem like a stream.
• Demonstration of methods for open channel flows Though chemical reactions and phase exchange mechanisms have now been incorporated into some applied transport models. Theoretical studies into these chemical effects on the physical transport have been very limited. There lacks, for example, a systematic understanding of the effects of sorption kinetics on the longitudinal dispersion: dispersion is conventionally considered to be affected by physical and hydrodynamic processes only.
• Demonstration of methods for pipe flowsAn important component of a water supply systems is thedistribution system which conveys water to the consumerfrom the sources.Drinking water transported through such distributionsystems can undergo a variety of water quality changes interms of physical, chemical, and biological degradation.Water quality variation during transportation in distributionsystems may be attributed to two main aspects of reasons.One is internal degradation, and the other is externalintrusion.
• Demonstration of methods for pipe flowsThe internal factors including physical, chemical, andbiological reaction with pipe wall material that degradeswater quality.Furthermore, recent evidence has demonstrated thatexternal contaminant intrusion into water distributionsystems may be more frequent and of a great importancethan previously suspected.In conventional (continuous) water distribution systems,contaminant may enter into water supply pipe throughcracks where low or negative pressure occurs due totransient event.
• Demonstration of methods for pipe flowsThe sources of contaminant intrusion into waterdistribution systems are many and various. But leaky sewerpipes, faecal water bodies, and polluted canals may be theprimary sources for water distribution systemscontamination.Both continuous and intermittent water distributionsystems might suffer from the contaminant intrusionproblem, and the intermittent systems were found morevulnerable of contaminant intrusion.
• Demonstration of methods for pipe flowsChlorination in pipe flow is required to control thebiological growth, which on the other hand results in waterquality deterioration.Pipe condition assessment component simulatescontaminant ingress potential of water pipe.Contaminant seepage will be the major component of themodel. Its objective will be to simulate the flow andtransport of contaminant in the soil from leaky sewers andother pollution sources to water distribution pipes.
• Demonstration of methods for pipe flowsThe equations to be applied to simulate contaminant flowthrough the pipes are similar to open channelcontaminant transport.The process involved during the contaminants transportincludes advection, dispersion and reaction, etc., whichresults in varying concentration of the contaminantsduring its transportation.
• Assignments1. Considering the one-dimensional flow of a solute through the soil column, write a computer program for solving the given contaminant transport equation by finite difference technique. The boundary conditions represented by the step function input are described mathematically as: C (1,0) = 0 1≥ 0 C (0, t ) = C0 t≥0 C ( ∞, t ) = 0 t≥0 Compare and discuss the results with the analytical method.2. Write the governing equation for transport of contaminant in a pipe, neglecting advection and dispersion terms, and solve to get analytical solution of the same.