This is a solution of Engineering Computations For Civil Engineers in which we discuss Civil Engineers.
Engineering Computations
For Civil Engineers
Objectives
Engineering Computations For Civil Engineers has been designed with three specific goals:
- •To give you practical experience implementing most of the numerical techniques that you will be learning about this semester.
- •To instruct you in the writing, testing and use of a reasonably complex computer program.
- •To give you practice in applying numerical methods to practical engineering science systems.
The specific task that needs to be completed requires you to write your own computer program that is capable of predicting the environmental impact of sewage discharges into a river.
A conceptual diagram of the D spatial domain relevant to the problem is shown in Figure 1 (along with the 2 boundary conditions). A pollutant is discharged into the river at the initial
C = 0
|
U
|
@2C
|
= 0
| ||||||
2
| |||||||||
@x
| |||||||||
i = 1
|
i =
|
mx
| |||||||
0
|
x
| ||||||||
i 1 i i + 1
|
L
|
Figure 1: Schematic of the Problem
time (t = 0) at a location Xs to be specified. The pollutant is advected by the river which has a flow velocity U in the x-directionand also diffused in the x direction at a rate proportional to the diffusivity coefficient D. The banks of the river are considered impermeable.
For the purposes of Engineering Computations For Civil Engineers assignment, the river will be assumed to be one dimensional of length L. The river has a constant velocity U and A diffusivity coefficient D.
Governing Equation
This problem can be represented by the advection-diffusion equation for the sewage concentra- tion C(x; t):
@C
|
@C
|
@2C
|
(1)
| ||
+ U
|
=D
| ||||
@x2
| |||||
@t
|
@x
|
This governing equation is effectively a statement of mass conservation of the effluent. The two processes represented by this equation are
- •Advection of the pollutant by the river flow
- •And spreading or dispersion of the pollutant by turbulence & velocity gradients (even though we will adopt a constant flow velocity U throughout).
Method
As we shall see during the course of this semester, every numerical model must include the following components:
3.1 Discretisation
The region of interest (the so-called domain or solution domain) must be discretised – that is broken down into a set of representative points. Finite differences require that these points be located on line with spacings between mesh points of x. The xdirection will have mx discrete points, numbered from 1 to mx. Time will also be discretised into equally spaced timesteps t.
3.2 A finite difference representation of the governing equation
We will adopt finite difference expressions for the partial derivatives that are accurate to second order accuracy in space and first order in time. The finite difference form of each partial derivative can be written, using n as the time index, and i as the space index. By convention (and to help readability), the time index n is written as a superscript n and the space index i as subscript i. In the equations which follow, you will see that we have not yet specified the time levels of the concentrations in the spatial derivatives.
@C
|
'
|
Cn+1 Cn
|
+
|
O
|
( t)
|
(2)
| |||||||
@t
|
t
| ||||||||||||
@C
|
'
|
Ci+1 Ci 1
|
+
|
O
|
( x2)
|
(3)
| |||||||
@x
| |||||||||||||
2 x
| |||||||||||||
@2C
|
'
|
Ci+1 2Ci
|
+ Ci 1
|
+
|
O
|
( x2)
|
(4)
| ||||||
@x2
|
x2
|
In this assignment, you are required to implement two (2) versions of the finite differences equations: one called explicit, and the other one called implicit.
3.2.1 Explicit finite difference scheme
In the explicit finite difference model, we choose to use the known concentrations at the old time level n in the spatial derivatives in eq (3) and (4). Equation (1) becomes:
Cin+1 Cin
|
+ U
|
Cin+1 Cin 1
|
=D
|
Cin+1 2Cin + Cin 1
|
(5)
|
t
|
2 x
|
x2
|
All concentrations Cin are known at the old time level n and eq (5) is reorganised to compute Cin+1, moving the unknown (at the new level n + 1) to the left hand side, and what is known (at time level n) to the right hand side:
Cn+1
|
Cn
|
U t
|
Cin+1 Cin 1
|
+
|
D t
|
Cin+1 2Cin + Cin 1
|
(6)
| ||||||||||
i
|
= i
|
2 x
|
x2
| ||||||||||||||
D t U t
|
D t
|
U t
|
D t
| ||||||||||||||
Cin+1
|
=
|
+
|
Cin 1 +
|
Cin+1
|
+ 2
|
+ 1 Cin
|
(7)
| ||||||||||
x2
|
2 x
|
x2
|
2 x
|
x2
|
How we can incorporate the boundary conditions is considered in Section 3.3.
3.2.2 Implicit finite difference scheme
In the implicit finite difference model, we now choose to use the unknown at the new time level n + 1 in the spatial derivative in equations (3) and (4). Equation (1) becomes:
Cin+1 Cin
|
+ U
|
Cin+1+1 Cin+11
|
=D
|
Cin+1+1 2Cin+1 + Cin+11
|
(8)
|
t
|
2 x
|
x2
|
All concentrations Cin are known at the old time level n and eq (8) is reorganised to compute Cin+1, moving the unknowns (at the time level n + 1) to the left hand side and what is known (at the time level n) on the right hand side:
n+1
|
Cin+1+1 Cin+11
|
Cin+1+1 2Cin+1 + Cin+11
|
n
|
(9)
| ||||||||||||||
Ci
|
+ U t
|
2 x
|
D t
|
x2
|
=Ci
| |||||||||||||
D t U t
|
Cin+11 +
|
D t
|
U t
|
Cin+1+1 + 2
|
D t
|
+ 1 Cin+1 =Cin
|
(10)
| |||||||||||
+
| ||||||||||||||||||
x2
|
2 x
|
x2
|
2 x
|
x2
|
3.3 Boundary conditions
The domain must be bounded and at each boundary there are potential effects of the boundary on the interior concentrations in the domain. The finite difference mesh must be constructed so that all boundary points coincide with the boundary of the mesh. An equation (i.e boundary condition) must be specified at every boundary point.
3.3.1Boundary conditions in the explicit scheme
• At the western inflow boundary, the inflow concentration Ci at these points is 0 at all times.
C1 =0
|
(11)
|
• At the eastern outflow boundary, the boundary condition is complex. As a close approx- imation, we will assume the second spatial derivative of the concentration is zero normal
to the boundary
|
@2C
|
= 0 and combine this (using eq (4)) with the governing equation
| ||||||||
@x2
| ||||||||||
(eq (7)) to yield:
| ||||||||||
Cmn+1x =
|
U t
|
Cmnx 1
|
+
|
U t
|
+ 1 Cmnx
|
(12)
| ||||
x
|
x
|
3.3.2 Boundary conditions in the implicit scheme
• At the western inflow boundary, the inflow concentration Ci is 0 at all times.
C1 =0
|
(13)
|
• At the eastern outflow boundary, the boundary condition is complex. As a close approx- imation, we will assume the second spatial derivative of the concentration is zero normal
to the boundary
|
@2C
|
= 0 and combine this (using eq (4)) with the governing equation
| ||||||||||
@x2
| ||||||||||||
(eq (10)) to yield:
| ||||||||||||
U t
|
Cmn+x 1
|
+
|
U t
|
+ 1 Cmn+x
|
1 = Cmn x
|
(14)
| ||||||
1
| ||||||||||||
x
|
x
|
3.4 Initial conditions
The river is considered unpolluted at the initial time t = 0, so
| |
C0 =0
|
(15)
|
i
| |
except at one location xs where the sewage is released by accident:
| |
C (t = 0; x = xs) =S0
|
(16)
|
The discrete location of this accidental release is located at the discrete point which is the closest to (xs)
3.5 A solution method for the numerical representation
The solution method to be adopted here is to write a Matlab program which assembles the full set of linear equations that incorporates an equation for each boundary and each internal point. (Note that if the inflow and outflow boundaries are used, you can reduce the number of equations).
3.5.1 Advancing the solution by one time step from a known concentration Cn to the new unknown concentration Cn+1
Explicit scheme An explicit finite difference scheme is by definition "explicit". When all the equations are combined (eq (7), (12) and (11)) the expression for Cin+1 depends only on all Cin, which are all known. The solution process requires the program to sweep through every node of the mesh and apply the previous relevant equations and boundary conditions.
Implicit scheme In this case, solution of the unknown concentrations at time level (n + 1) requires the solution of a set of simultaneous equations.
A linear problem can always be written as a matrix-vector product of the kind:
AC =B
|
(17)
|
where A is a coefficient matrix, C the vector of unknown concentrations at the new time level, and B the known RHS vector.
In the problem we want to solve in this assignment, the domain is a line domain, containing mx points in the x direction. Because the sewage concentration is to be computed at each discrete point i, the number of unknowns is mx. They need to be organised into a vector of unknown C which will contain mx rows.
To form the product AC, the matrix A will need to have mx columns.
And finally, to be able to solve the system to obtain a unique solution, we need as many equations as unknowns, so the matrix Awill have mx rows and B will also have mx rows.
A is consequently a square matrix of mx rows and mx columns.
To find a solution, the matrix equation defined in eq (17) is to be solved where A is the coefficient matrix as seen above, C is our (unknown) column vector of the sewage concentration values at each grid point, and B is a column vector containing the values from the previous concentrations corresponding to each grid point at the time level n.
Specifically, row i of tion for the point xi that corresponds to
A will contain the concentration coefficients from the corresponding equa- = i x. Almost all of the values in row i will be zero except for each column a point included in our finite difference equation.
The process then becomes one of forming the (large) matrix in Matlab and then asking Matlab to compute the solution value at each mesh point. For the purposes of this assignment, you just compute A 1B to obtain C.
3.5.2 Example
As an example, let us assume that we have U = 1, D = 0:5, L = 100, mx = 6 and t = 1. Therefore x = 20. A will be a6 by 6 matrix. C and B will both have 6 rows. The initial condition is:
0 1
0
B1C
B C
B1C
B = B C
B1C
B C @0A
0
The first row in A will correspond to the point i = 1, which is on the western end. In matrix- vector equation, the first line will be of the form 1 C1 = 0.(programming)
All entries in the first row of A will be zero, except for column 1 which will contain the value 1. The corresponding value in row 1of B will be zero.
If the first time step is computed, from t = 0 to t = t, then
- •The point i = 6 is the eastern end. Therefore, all entries in the last row of A will be zero except for columns 5 and 6 which will contain the values 0:05 and 1:05. The corresponding value in the 6th row of B will be 0.
- •The point i = 3 is buried in the interior of the mesh. Therefore, all entries in the 3rd row of A will be zero except for columns2; 3; 4, which will contain the values 0:0263; 1:0025; 0:0238 respectively. The corresponding value in the 3rdrow of B will be 1.
3.5.3 Computing the concentrations at all the time levels from C0 (initial condi- tion) to the unknown Cfinal
There are stability conditions associated with these numerical schemes on both t and x.
• Explicit Scheme:
U t
|
1
|
(18)
| |||||
2D
| |||||||
and
|
D t
|
1
|
(19)
| ||||
x2
|
2
|
• Implicit scheme: unconditionally stable, but remember, errors are proportional to ( t; x2).
A time stepping loop will need to be written in your code to solve consecutively each new set
of unknown concentrations at each time level until the final time t = t final, using at each stage, the method detailed in the Section 3.5.1
4 Presenting The Results
Once your scripts have been written, you should consider presenting your results showing:
- •4-6 line plots of the concentration in time between t0 and t final
- •C:U at a position to compute the sewage concentration flux per unit area (kg:s 1:m 2) as a function of time. You can also study the mass conservation in time of the sewage by
- computing Mass(t) = Rwestern end C(t; x)dx and plot it. eastern end
- • use your imagination!
5 Some hints for undertaking the assignment
1.Completing this assignment will require solid work over the next weeks. Leav- ing it until the last moment will result in disaster.
2.The problem can be broken down into the following components:
- •Sorting out the geometry.
- •For the implicit model, assembling the coefficient matrix and RHS vector.
- •Inverting the coefficient matrix & multiplying it with the RHS to obtain the concen- tration values at each time step.
- •Plotting the initial concentration values.
- •Showing the time evolution by plotting concentration values at several other times.
- •Briefly discuss the advantages ans disadvantages of finite difference explicit and im- plicit models.
- •Space-time contour or 3D plots of the concentration.
3.The beauty of Matlab is that each step can be done interactively and checked without actually doing any programming. The program just follows the set of steps that you take to solve the problem interactively.
4.Each one of the steps above can be checked out by using dummy data to ensure that you understand what each command does.
Assignment presentation
For the assignment presentation, you must prepare a brief engineering report including:
- 1.Introduction
- 2.Numerical methods
- 3.Results and Discussion
- 4.Conclusions
References
Matlab includes some neat plotting packages including contouring which should give you a neat colour contour diagram of your concentration values within the solution domain. Calls to these packages should be made from your program to make the results figures in your report pop up automatically on the screen. You should suitably illustrate your report.
You are also required to e-mail a copy of your m file to x.barthelemy@unsw.edu.au and this code will be used to verify that it produces the outputs and for automatic comparison with other student programs to ensure that it is your own work.
Marking criteria
The assignments will be marked in 6 categories: figures, introduction, methodology, results, conclusions, and references.
7.1 Report figures
•Sketch of the problem [2 marks]
Definition sketches can be very simple to create, and they give the reader an instant appreciation of the problem. There is already a sketch provided in the assignment problem sheet.
- •Conventional plots of concentration and fluxes [2 marks]
- Marks will be awarded for the plots regardless of their accuracy.
- •Innovative plots to make results particularly clear [1 mark]
Marks will be mostly awarded to 1D plots or 2D space-time, provided they actually made the results clearer.
7.2 Introduction
• Clear Specification Of The Problem [2 marks]
Marks will be awarded for introductions that actually mention the specifics of the problem, e.g. contamination problems.
7.3 Methodology [3 marks]
- •Discretisation
- •Boundary conditions
- •Numerical representation
- •Solution method
Marks will be awarded to students who explained the general procedure of applying the numerical solution method, rather than simply describing matrix operations in Matlab®.
7.4 Results and discussion
• Correct results [7 marks]
Marks will be awarded for correctly plotting contours showing the distribution of concen- trations.
•Discussion of maximum resolution achievable [2 marks]
Marks will be awarded for discussing the computational limitations of their program, e.g. how fine could the mesh be made before running out of memory?
•Discussion on the significance of the results [4 marks]
Students will be awarded marks for identifying the consequences of releasing sewage in the environment. Comments of the results and their significance are more important than precise location and/or value.
7.5 Conclusion and recommendations
•Resolution adequacy [2 marks]
Marks will be awarded for discussion on mesh resolution, and the trade-off between ac- curacy and computation time.
•Sensitivity [2 marks]
Marks will be awarded for computing the problem using different mesh resolutions and comparing the results.
•Other sensible remarks or recommendations [1 mark]
Marks will be awarded for insightful comments describing the practical implications of the problem.
7.6 References
•References other than supplied reading material and websites [2 marks]
Marks will be only awarded when students referenced at least one book or journal article.
- –Journals (for details on specific research)
- –Textbooks (for background information)
7.7 Comments
Some students will not manage to build a program successfully. Figures which are produced with another student’s program will not be awarded any marks. This is a challenging assignment, but take note of the clear warning that it will take a significant amount of time to complete.
Assignment Help Australia provide best quality assignment writing service in affordable prices and we are providing most flexible assignment writing according to Students need, so book your Assignment with us,;-Order Now
No comments:
Post a Comment