public void HW9() { double Pinitial = 3000; double Cm = -5.2; double Sm = 1; double Wm = 1; double Nm = 1; double Em = 1; double rm = -1.2; double well = 887.53 * 100 * 2 * 1 / (50 * 78); int Nx = 5; int Ny = 3; const double deltat = 10; int timesteps = Convert.ToInt32(500 / deltat); double[,] P = new double[timesteps + 1, 15]; double[] Pn = new double[15]; double[,] mymatrix = new double[15, 15]; double[] RHS = new double[15]; for (int i = 0; i < mymatrix.GetLength(0); i++) { Pn[i] = Pinitial; P[0, i] = Pinitial; } double[,] testmatrix = new double[3, 3] { { 4, 0, 1 }, { 0, 3, 2 }, { 1, 2, 4 } }; double[] b = new double[3] { 2, 1, 3 }; double[,] A1 = new double[3, 3]; double[] b1 = new double[3]; double[] initial = new double[3] { 0, 0, 0 }; b.CopyTo(b1, 0); double[] x1 = new double[3]; x1 = GSSolve(testmatrix, b1, 0, 10); mymatrix = CreateMatrix(Nx, Ny, Nm, Sm, Wm, Em, Cm); for (int n = 0; n < timesteps; n++) { RHS = RHS_Create(3, 2, Nx, Ny, Pn, rm, well); Pn = GSSolve(mymatrix, RHS, 3000, 10); for (int i = 0; i < mymatrix.GetLength(0); i++) { P[n + 1, i] = Pn[i]; } } CreateExcelDoc excellApp = new CreateExcelDoc(); SaveExcel(excellApp, P, 0); }
private void button3_Click(object sender, EventArgs e) { CreateExcelDoc excellApp = new CreateExcelDoc(); SaveExcel(excellApp, _P, 0); SaveExcel(excellApp, Qw, 1); SaveExcel(excellApp, Pwf, 2); MessageBox.Show(@"Export to Excel is complete", @"Important Message"); }
private void SaveExcel(CreateExcelDoc myWB, double[,] x, int sheet) { for (int i = 0; i < x.GetLength(0); i++) { for (int j = 0; j < x.GetLength(1); j++) { myWB.addData(i + 1, j + 1, x[i, j], sheet); } } }