- Details
- Parent Category: Programming Assignments' Solutions
We Helped With This MATLAB Programming Assignment: Have A Similar One?

Category | Programming |
---|---|
Subject | MATLAB |
Difficulty | Undergraduate |
Status | Solved |
More Info | Matlab Homework Help In Usa |
Assignment Description
Computational Project, Due December 11th
This is a group project. You are expected to work as a team, but you MAY NOT collaborate with other groups or other students outside the class. Your instructor and TAs, however, would be happy to help if you have difficulty.
Pore-scale network models are often used in the oil industry to determine rock properties (like permeability) in porous media. These models approximate the porous medium by viewing the void space as “pores” or “nodes” and the resistances connecting them as “throats” or “pipes”. Early models were 2D regular lattices (like this project), but many of your faculty have pioneered ways of creating accurate 3D models that can predict permeability, etc. without having to run experiments in the lab.
Consider the simple network model shown below on a 2D lattice. The nine interior pores are labeled accordingly.
Q=0
P=PinP=Pout
Q=0
The general idea is that flow enters and leaves from connecting throats and the flow “in”
4
equals the flow “out” of every pore,qij 0, where qij is the flowrate into pore “i” from
k1
pore “j”. That flow rate is proportional to the pressure drop between those pores:
4 gij
P Pi j 0 (1)
k1
which is the equation we write for every single interior pore. Since pore pressures depend on connecting pore pressures, you get a system of linear simultaneous equations (AP=b), where your unknown vector, P, is the interior pore pressures, the matrix A contains the known conductivities (gij’s), and the vector, b, contains boundary conditions.
Boundary pores are treated somewhat special. If the pore is connected to a constantpressure boundary (like pore #4), that connecting pressure is a known value and is substituted into equation (1). If the pore is connected to a no-flow boundary (like pore #2), the conductivity is zero (the pressure on the boundary would then be equal to that pore).
1. For the 3x3 (9-pore) system shown in the figure,
a. write the 9 conservation equations (equation 1) using appropriate subscripts and without the summation sign
b. re-write them but in a familiar form (AP=b) and show explicitly what A and b are. Comment on the matrix properties (is it symmetric, diagonally dominant?)
c. Using Pin=2 and Pout=1, = 1, and all g’s =1, set up and solve the system of equations. Does the answer make sense?
2. Consider the attached data file for a network with 100 pores (10 in the x-direction and 10 in the y-direction). The file includes the conductivities for throat connected to that pore (left, right, top, bottom). You can use a pressure drop of Pin=100 psi and Pout =0 psi, =1 cp, and the g’s listed are in units of m3. The length of the network in both directions is 1 mm. The cross-sectional area is 1 mm2. Write a MATLAB program that does each of the following:
a. Reads in the data file and create a matrix of the data.
b. Create the matrix, A, and the vector, b.
c. Solve the system of equations to compute all 100 pore pressures
d. Compute the permeability of the network using Darcy’s law
e. Make a 3D plot (surface or contour) of the pressure field
Advice for project
1. Problem #1 is intended to help you think about how to set up the problem in up in MATLAB. Spend some time thinking about how you should organize the program before writing it. The more you write it out and think about it, the better off you will be. If it helps, you might also want to test the code with the 3x3 system before testing the big system.
2. Your main program will be a script file, but you should implement a few function files (2-3) as well to make it a better-organized program. Make sure to choose your function files that make sense as stand-alone .m files.
3. The boundary conditions are probably the trickiest portion of the program because the edge pores are treated differently. You might use “if” statements in these places or just calculate them outside the loop. You’ll want to have a reasonable about of “if” statements though; the code becomes difficult to read and debug otherwise.
Pores on the bottom and top are “no-flow” and have zero conductivity. Pores on the left and right are connected to constant-pressure boundaries – those values end up on the right-hand-side of the equations. You can figure out if a pore is on the left or right using clever techniques, such as the “floor” and “ceil” command.
Pores on the corner are attached to two boundaries.