You are on page 1of 2

// PNG 490 data input program.

Will read data files and tabulate information such as the // total thickness, averages of resistivity, neutron, and density porosity for the target pay zone of a well log. // It will then output the average porosity and water saturation for the target formation. # include <iostream> # include <fstream> # include <iomanip> using namespace std; int main () { ifstream input; // Define input and open the file. input.open("X-34-8-16.txt"); double x=0.5, y=0, z, top, bottom, porosity, Ro, Rt, RhoF; // Declare variables double por(double, double, double); // Define function prototypes double watersat(double, double, double);

cout << "What is cin >> top; cout << "What is cin >> bottom; cout << "What is cin >> RhoF; cout << "What is cin >> Ro;

the top of the formation?\n";

// User inputs top, bottom, increment, RhoF, and Ro.

the bottom of the formation?\n"; your fluid density?\n"; your Ro value?\n";

if ( input.fail() ) // Making sure it is open, if not exit program. { cout << "Failed to open input and/or ouput file. \n"; exit(1); } double depth, gamma, rho, rhocor, npor, dpor, resist, thickness(0), tabnpor(0), tabresist(0), tabbulk(0), bulk(0); // Declaring variables. while ( !input.eof() ) // Setting program to run until end of file. { input>>depth>>gamma>>rho>>rhocor>>npor>>dpor>>resist; //Input depth, gamma ray, bulk density, corrected density, neutron porosity, density porosity, and resistivity. if (npor<1) // Checking if neutron porosity is in decimal or percent form. { npor=npor*100; } if (dpor<1) // Checking if density porosity is in decimal or percent form. { dpor=dpor*100; } if ( (gamma<=30) && (npor>15) && ((rho + rhocor)<2.61) && (depth>=top) && (depth<=bottom) ) //Criteria for target zone. { thickness=thickness+x; //Keeping track of the thickness. tabnpor=tabnpor+npor; //Summing neutron porosity. tabbulk=(rho+rhocor)+tabbulk; //Summing density porosity. tabresist=tabresist+resist; //Summing resistivity. y++; //Counter to take the averages of neutron porosity, density porosity, and resistivity. } else { input.ignore(1000,'\n'); } } bulk = (tabbulk/y); // Averaging bulk density.

z = (tabnpor/y); porosity = por(z, bulk, RhoF); Rt = (tabresist/y); input.close();

// Averaging neutron porosity. // Calling function to calculate average porosity.

cout << "\nThe thickness of the target formation is:\n" << thickness << " ft\n" << "The average porosity is:\n" << porosity << " %\n" << "The water saturation is:\n" << watersat(Ro, porosity, Rt) << " %\n\n\n" << "The average resistivity is:\n" << Rt << " ohm-m\n" << "The average bulk density is:\n" << bulk << " g/cc\n";

return 0; } double por(double neutron, double bulkrho, double RhoF) { double denpor, porosity; denpor=(2.87-bulkrho)/(2.87-RhoF); porosity=(denpor+neutron)/2; return porosity; } // Porosity function definition.

double watersat(double Ro, double porosity, double Rt) // Water saturation function definition. { double Rw,Sw; Rw=(porosity/100)*(porosity/100)*Ro; Sw=(sqrt(Rw/((porosity/100)*(porosity/100)*Rt)))*100; return Sw; }

You might also like