Sie sind auf Seite 1von 4

CE 30125

Project 1

Oct-30-2012

PROJECT: CALCULATION OF FLOW THROUGH A POROUS MEDIUM Step-by-step process to solving for H: 1. Draw out a grid, by hand, and number using both the double index notation that we have used in our formulae and a single node number notation that you will need to use to load the matrix and right hand side vector of your system of simultaneous equations. It should end up looking something like this (each vertex is a node): ny = 5 4

1 1 2 3 4 5 nx = 6 i Note that I did not start the numbering with 0 since many programming languages dont allow for the index 0. In double index notation, the numbering for the above grid will look like this for the (i,j) pairs 1,5 1,4 1,3 1,2 1,1 2,5 2,4 2,3 2,2 2,1 3,5 3,4 3,3 3,2 3,1 i Now number the nodes using a single index global node number. In the above example you have 30 nodes, so you need to assign 30 node numbers. You can assign them in any order you want, but a random numbering will make your job of programming the equations more difficult and will affect the structure of the matrix (e.g. to what degree it is banded and to what degree the structure is regular). I suggest that you number from the bottom left corner up to top left, and continue from next bottom node. Page 1 of 4 4,5 4,4 4,3 4,2 4,1 5,5 5,4 5,3 5,2 5,1 6,5 6,4 6,3 6,2 6,1

CE 30125

Project 1 For example the single node numbers n will be, 5 4 3 2 1 10 9 8 7 6 15 14 13 12 11 20 19 18 17 16 25 24 23 22 21

Oct-30-2012

30 29 28 27 26

Numbering from left to right (or vice-versa) will lead to a larger bandwidth in your matrix. It is, however, feasible to do if you so desire. Now you need to write an equation that will convert your double index notation to the global single index notation. For the numbering system that I have used the conversions would be as follows: Double to single: n = (i - 1) * ny + j and the inverse transformation (single to double) i = 1 + int (n/ny) j = n ( i - 1) * ny Where the int function converts a real number to an integer.

2.

Now you need to count the total number of unknowns and load the matrix with one algebraic equation for each unknown. You will do this by: a. Defining a discrete algebraic approximation to the partial differential equation for each interior node. Note that the equation number (i.e. the row number) in the matrix corresponds to the global single node number. b. Defining a discrete algebraic approximation to the boundary condition for each node that is on the boundary. Note that the equation number (i.e. the row number) in the matrix corresponds to the global single node number. You will load the discrete equations for the interior (part 2a) nodes by looping over the double indexed nodes. do i=2,nx-1 do j=2,ny-1 .. .. enddo enddo Use dx=dy. That will simplify your equation. In this case the discrete from of the p.d.e. for each interior node is: 1 * H i-1,j + 1 * H i+1,j + 1 * H i,j+1 + 1 * H i,j-1 - 4 * H i,j = 0

3.

Page 2 of 4

CE 30125

Project 1 In single index notation this would read 1 * H nl + 1 * H nr + 1 * H na + 1 * H nb - 4 * H n = 0

Oct-30-2012

Where n = node number for which the node is being loaded nl = node number to the left of the node that is being loaded nr = node number to the right of the node that is being loaded na = node number above the node that is being loaded nb = node number below the node that is being loaded It is this equation that needs to be loaded into the global system: A*H=B Where H is the vector of single indexed piezometric head values that we are computing. Thus we compute the global node number n and each surrounding node and enter the corresponding coefficients into the matrix and right hand side vector. 1 * H nl + 1 * H nr + 1 * H na + 1 * H nb - 4 * H n = 0 do i=2,nx-1 do j=2,ny-1 ccompute double to single index n = (i - 1) * ny + j nl = (i - 2) * ny + j nr = i * ny + j na = (i - 1) * ny + ( j+1) nb = (i - 1) * ny + (j-1) c...load the terms to the matrix A(n,nl)=1.0 A(n,nr)=1.0 A(n,na)=1.0 A(n,nb)=1.0 A(n,n)= -4.0 cload the right hand side vector B(n)= 0.0 enddo enddo

4.

Apply all boundary conditions along the boundaries (part 2b). For example, the bottom boundary would be applied along i=1,nx; j=1 In this case the double indexed equation for each node would be

Page 3 of 4

CE 30125

Project 1 -1 * H i,3 + 4 * H i,2 - 3 * H i,1 = 0 In single index notation, this would read -1 * H n2la + 4 * H na - 3 * H n = 0

Oct-30-2012

Where n = node number for which the boundary node is being loaded na = node number above the boundary node that is being loaded n2la = node number two layers above the boundary node that is being loaded Thus we compute the global node number n and each surrounding node and enter the corresponding coefficients into the matrix and right hand side vector. do i=1,nx ccompute double to single index n = (i - 1) * ny + 1 na = (i - 1) * ny + 2 nb = (i - 1) * ny + 3 c...load the terms to the matrix A(n,n2la)=-1.0 A(n,na)=4.0 A(n,n)=-3.0 cload the right hand side vector B(n)= 0.0 enddo 5. Now just load the rest of the b.c.s in a similar way. Note that you can only apply one boundary condition per node; thus you will have to choose at corners and at the intersection of the levee with the porous media. Solve the system A H = B, where H is the piezometric head for each node. Map H at each node back to your physical coordinate system in order to conveniently plot. Thus map H(n) into HPLOT(x,y,H(n)) and call the 2D plotting routine for HPLOT. INTERIM DEADLINE: Nov 15, 2012 Solve for H The piezometric head. FINAL DUE DATE Dec 6, 2012 for entire project

6.

Page 4 of 4

Das könnte Ihnen auch gefallen