// pde_blivet.java reads blivet.inp // to get geometry and Dirichlet boundary values // // uses pde_read_ucd.java lsfit.java nuderiv3d.java // // The PDE to solve is Uxx(x,y,z)+Uyy(x,y,z)+Uzz(x,y,z)+(3/25)U(x,y,z)=0 // the known solution for testing, is U(x,y,z)=sin((x+y+z)/5) // the solution is to be computed at: 14 points, 17 DOF // (0.5, 0.5, 0.5) (2.5, 0.5, 0.5) (4.5, 0.5, 0.5) // (0.5, 1.5, 0.5) (2.5, 1.5, 0.5) (4.5, 1.5, 0.5) // (0.5, 2.5, 0.5) (2.5, 2.5, 0.5) (4.5, 2.5, 0.5) // (0.5, 3.5, 0.5) (2.5, 3.5, 0.5) (4.5, 3.5, 0.5) // (1.5, 4.5, 0.5) (3.5, 4.5, 0.5) refinement is allowed, if needed // for each x +/- 0.25, and for each y +/- 0.25, and for each z +/- 0.25 // creating 14 + 28*28*28 = 21,966 DOF, 14 points above plus // 21,952 points (0.25, 0.25, 0.25) to (4.75, 3.75, 0.75) // // fortunately, our algorithm solves for one DOF at a time, // rather than the typical solving of simultaneous equations. // Given n boundary vertices, at DOF p, compute cxx[n+1] such that // Uxx = cxx[p]*U[p] + sum{i!=p, cxx[i]*Ubound[i]} // similarly for Uyy and Uzz for this PDE // Accumulate A = cxx[p]+cyy[p]+czz[p]+3/25 these are times the unknown U[p] // Accumulate Y = sum{i!=p, cxx[i]*Ubound[ip[i]]} + // sum{i!=p, cyy[i]*Ubound[ip[i]]} + // sum{i!=p, czz[i]*Ubound[ip[i]]} + // Now A*U[p] + Y = 0 we have just summed the terms of the PDE // U[p] = -Y/A then repeat for all p in DOF // uses pde_read_ucd.java the class defines all variables and arrays // all subscripts start with 1 // vert struct {double x; double y; double z;} // cell struct {int i; int matl; int ctyp; int v[9];} class pde_blivet { pde_blivet(String file_name) { int k, m; boolean last = false; boolean debug = true; int order = 2; int npwr; double u, ue, err, maxerr; int ctypn[] = { 0, 1, 2, 3, 4, 4, 5, 6, 8}; // UCD constants int ndof = 14; // could be dynamically changed double unk[][] = { {0.5, 0.5, 0.5}, {2.5, 0.5, 0.5}, {4.5, 0.5, 0.5}, {0.5, 1.5, 0.5}, {2.5, 1.5, 0.5}, {4.5, 1.5, 0.5}, {0.5, 2.5, 0.5}, {2.5, 2.5, 0.5}, {4.5, 2.5, 0.5}, {0.5, 3.5, 0.5}, {2.5, 3.5, 0.5}, {4.5, 3.5, 0.5}, {1.5, 4.5, 0.5}, {3.5, 4.5, 0.5}}; double xg[]; // allocated later when size is known double yg[]; double zg[]; double A; // later solve for U, A*U=Y double Y; double U[] = new double[14]; // DOF that must be computed double ub[]; // boundaries zero based double cxx[], cyy[], czz[]; // discrete derivatives coefficients int ip[]; System.out.println("pde_blivet.java running"); pde_read_ucd B = new pde_read_ucd(file_name); System.out.println("pde_read_ucd returned:"); if(debug) System.out.println("1 based indexing"); System.out.println("n_vertices (boundary)= "+B.n_vertices); System.out.println("n_cells (boundary faces)= "+B.n_cells); System.out.println("n_ndata (Dirichlet at vertices)= "+B.n_ndata); System.out.println(" "); ub = new double[B.n_vertices]; for(int i=0; i0) file_name = args[0]; System.out.println("input UCD file_name is "+file_name); new pde_blivet(file_name); } } // end class pde_blivet