// abc.java User problem definitions for a specific PDE to be solved // this includes the user choice of degree and discretization // // The problem must be well posed and the solution must be // continuous and continuously differentiable // // The general PDE to be solved is: // a1(x,y)*uxx(x,y) + b1(x,y)*uxy(x,y) + c1(x,y)*uyy(x,y) + // d1(x,y)*ux(x,y) + e1(x,y)*uy(x,y) + f1(x,y)*u(x,y) = c(x,y) // class abc { // number of points for descretization, must be odd and > 1 int nd = 5; // Define the region for the solution: // xmin <= x <= xmax, ymin <= y <= ymax using nx by ny points double xmin = -1.0; double xmax = 1.0; double ymin = -1.0; double ymax = 1.0; int nx = 7; int ny = 7; int ifcheck = 5; // the user must provide all functions, even if only return 0.0; // the functions are implemented here // A specific set of test functions is covered in abc.txt abc() // nothing to do, just providing functions { } double a1(double x, double y) { return Math.exp(x/2.0)*Math.exp(y)/2.0; } double b1(double x, double y) { return 0.7/(x*x*y*y+0.5); } double c1(double x, double y) { return (4.0 - Math.exp(x) - Math.exp(y/2.0))*2.0; } double d1(double x, double y) { return x*x+y; } double e1(double x, double y) { return x*y*y; } double f1(double x, double y) { return 3.0*x + 2.0*y; } // must compute boundary. // If solution for checking, then compute all values // and set ifcheck = 1 to 5, else ifcheck = 0 double u(double x, double y) { return x*x*x + 2.0*y*y*y + 3.0*x*x*y + 4.0*x*y*y + 5.0*x*y + 6.0*x + 7.0*y + 8.0; } // RHS, this becomes defined by u and a1 ... f1 double c(double x, double y) { return 0.5*Math.exp(x/2.0)*Math.exp(y)*(6.0*x+6.0*y) + 0.7*(6.0*x + 8.0*y + 5.0)/(x*x*y*y+0.5) + (8.0 - 2.0*Math.exp(x) - 2.0*Math.exp(y/2.0))*(12.0*y + 8.0*x) + (x*x+y)*(3.0*x*x + 6.0*x*y + 4.0*y*y + 5.0*y + 6.0) + x*y*y*(6.0*y*y + 3.0*x*x + 8.0*x*y + 5.0*x +7.0) + (3.0*x + 2.0*y)*(x*x*x + 2.0*y*y*y + 3.0*x*x*y + 4.0*x*y*y + 5.0*x*y + 6.0*x + 7.0*y + 8.0); } } // end class abc