Unformatted text preview:

MA/CS471 Lecture 6TodayMass ConservationDerivation of Mass Conservation LawSlide 5Use the Fundamental Theorem of CalculusFinally…Advection EquationSlide 9Solution and InterpretationSpace Time DiagramRecallBuilding a Finite Volume SolverPiecewise Constant ApproximationSlide 15Upwind Treatment for Flux TermsBasic Upwind Finite Volume MethodHomeworkSlide 19Homework contHomework cont1MA/CS471Lecture 6Fall 2003Prof. Tim [email protected] we are going to derive one of the simplest possiblepartial differential equations:We will then motivate a simple numerical scheme for solvingthis equation.. (btw I was going to talk about a finite differencescheme, but instead I will discuss a finite volume scheme).0u uat x� �+ =� �3Mass Conservation• For the following we are going to consider a 1-dimensional domain which we parameterize with the variable x. • Now imagine that this line is a figurative representation of a pipe which contains fluid.• At every point on the line the fluid has a density measured in mass per meter ( with units kgm-1 )• We define a new function which is a non-negative, real valued function defined on the space-time domain. x: [0, )r � � �� �4Derivation of Mass Conservation Law•Next we consider an arbitrary section of the pipe, say [a,b]•We now assume that the fluid is not created or destroyed at any point inside the section and is traveling with velocity u (which is a function of space and time). For the moment we will assume that u is positive (i.e. the fluid is flowing in the direction of positive x)•This allows us to state the following:–The time rate of change of the total fluid inside the section [a,b] changes only due to the flux of fluid into and out of the pipe at the ends x=a and x=b.•A simple formula relating these two quantities is:( ) ( ) ( ) ( ) ( ), , , , ,badx t dx u b t b t u a t a tdtr r r=- +�Explain on board5•In detail:( ) ( ) ( ) ( ) ( ), , ,, ,bau bdx t u a tbt tdxdttar rr +-=�The time rate ofchange of total mass in the section of pipe [a,b]The flux out of the section at the right end of the section of pipe per unit timeThe flux into the section at the left end of the section of pipeper unit time6Use the Fundamental Theorem of Calculus•Look carefully at the right hand side:•Clearly we may rewrite this as:•From which we may deduce:( ) ( ) ( ) ( ) ( ), , , , ,badx t dx u b t b t u a t a tdtr r r=- +�( ) ( ) ( )( ), , ,b ba adx t dx u x t x t dxdt xr r�=-�� �( ) ( ) ( )( ), , , 0bax t u x t x t dxt xr r� �+ =� ��7Finally…•Assuming that the integrand of:is continuous and noting that this relation holds for all choices of a,b then we may deduce:•In short hand:( ) ( ) ( )( ), , , 0bax t u x t x t dxt xr r� �+ =� ��( ) ( ) ( )( ), , , 0x t u x t x tt xr r� �+ =� �( )0ut xrr��+ =� �8Advection Equation•Let’s choose a simple, constant, fluid velocity •Then the pde reduces to the advection equation:•This is a pretty easy equation to solve . Consider the change of variables:( ),u x t u=0ut xr r� �+ =� �t tx x ut== -%%9•Note that the units of each variable are consistent.•Basic calculus:•From which we obtain: t tx x ut== -%%t xut t t t x t xt xx x t x x x� � � � � � �= + = -� �� �� � �� � � � � �= + =� � � � � �%%% %% %%%%% %0 ut xu ut x xtr rr r rr� �= +� �� � �� � � �= - +� � � �� � �� � � ��=�%% %%10Solution and Interpretation•So we know:•Which we can instantly solve: where: •So an interesting property of the advection equation is the way that the profile of the solution does not change shape but it does shift in the positive x direction with constant velocity0tr�=�%( ) ( )( )00,x t xx utr rr== -%( ) ( )0: , 0x x tr r= =11Space Time Diagram•Let’s track the information:•The dashed lines are which are known as characteristics of the equation.•If we choose a point on one of these dashed lines and track back down to t=0 and we will find the value of the density which applies at all points on the dashed line xtSlope = 1ux ut const- =12Recall•Assuming that the integrand of:is continuous and noting that this relation holds for all choices of a,b then we may deduce:•Well – this does not hold if the density is discontinuous and the integral equation is the appropriate representation:( ) ( ) ( )( ), , , 0bax t u x t x t dxt xr r� �+ =� ��( ) ( ) ( )( ), , , 0x t u x t x tt xr r� �+ =� �( ) ( ) ( ) ( ) ( ), , , , ,badx t dx u b t b t u a t a tdtr r r=- +�131) Let’s consider the advection equation:2) Next we take a finite portion of the real line fromx1 to xN divided into N-1 equal length sections3) In each section we will approximate the density by a constant valueBuilding a Finite Volume Solver( ) ( ) ( ), , ,badx t dx u b t u a tdtr r r=- +�x1xN 1,..., 1ii Nr = -dx14In the n’th section the density will be approximated by theconstant: Piecewise Constant Approximationx1xNnrr15•Choosing a = xi, b=xi+1,•Is approximated (to first order in time) by:where the time axis has been divided into sections of length dt and the i’th cell average at time n*dt is represented by •Outstanding question: Now we have to figure out how to evaluate the density at the interval end points given the cell averages. ( ) ( ) ( ), , ,badx t dx u b t u a tdtr r r=- +�( )( ) ( )11, ,n ni ii idxu x t u x tdtr rr r++-=- +( )11,iixnixx t ndt dxdxr r+@ =�16Upwind Treatment for Flux Terms•Recall that the solution shifts from left to right as time increases.•Idea: use the upwind values tSlope = 1u( ) ( )1 1, ,n ni i i iu x t u x t u ur r r r+ -- + @- +17Basic Upwind Finite Volume Method111n n ni i idt dtu udx dxr r r+-� � � �= - +� � � �� � � �( )11n ni in ni idxu udtr rr r+--=- +simplifydtudxl =( ) ( )111n n ni i ir l r l r+-= - +Note: we must supply a value for the left most average at each time step:0nr18Homework•Advance notice of homework to come.•After finishing the card playing homework start on the following homework.•The first version of the code should be writtenand debugged in serial..•Due: 09/24/0319HomeworkQ1) Solve the pde analytically on the domainQ2) Solve the pde analytically.Q3) Solve the pde analytically and …


View Full Document

Rice CAAM 471 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?