// w0015pde.java airfoil in wind tunnel, non uniform grid // data read from w0015a22.grid produced by w0015grid.java // edit ndel=10 e.g. order=5 e.g // airfoil has a chord of 1 meter, import java.awt.*; import java.awt.event.*; import java.io.*; // needs invert.java nuderiv.java simeq_newton5.java read_grid.java // and a data file w0015a22.grid public class w0015pde extends Frame { double xmin = -1.0; double xmax = 2.0; double xoff = 340.0; double yoff = 500.0; double ymin = -1.25; double ymax = 1.15; double scale = 320.0; // for plotting double xminw; // from data read double xmaxw; double yminw; double ymaxw; double xadj = -0.5; // approx center for output double grid = 0.01; // grid spacing, may be computed int width = 1000; int height = 1000; // upper part for title String fname; // .grid file has the folloairfoil int ixbound[] = new int[100]; // output boundary int jybound[] = new int[100]; double xg[] = new double[100]; // output grid double yg[] = new double[100]; int nxg; int nyg; int nbound; int ndel = 4; // grids outside airfoil double angle_deg = 22.0; // may be read in String angle_ch = "22"; int nDOF; // number of degrees of freedom, u,v,p independent variable each int neqn; // number of equations 3*nDOF = number of variables int nlin; // number of nonlinear terms u_i*v_j for some i,j, some uii, vjj int ntot; // independent plus product variables neqn+ntot int order = 5; // 5 fifth order nonuniform solution, some code depends double cx[]; // for nuderiv double cxx[]; // computed by discrete double cy[]; double cyy[]; double xx[]; double yy[]; int iu[]; // x index is u position int jv[]; // y index+nDOF is v position int eqn = 0; // equation being built int var1[]; // variable number for non linear equations int var2[]; // variable number for non linear equations int var3[]; // variable number for non linear equations int vari1[]; // variable number for non linear equations int vari2[]; // variable number for non linear equations double Y[]; // RHS right hand side of equations double X[]; // initial guess and solution of non linear equations double A[][]; // A Y = X system of non linear equations int nl; // available non linear term in var1, var2 // v is offset, nDOF+j double u0 = 88.0; // u velocity, uniform at input, output, top, bottom double v0 = 0.0; // v velocity is zero at these boundaries double rho = 1.223; // density double mu = 182.0E-6; // viscosity double p0 = 0.100; // pressure at input and output, Pa about 14.5 psi simeq_newton5 SN = new simeq_newton5(); // may change parameters w0015pde(String gname, int tndel, int torder) { System.out.println("w0015pde.java running"); fname = gname; ndel = tndel; order = torder; System.out.println("using "+fname+", ndel="+ndel+", order="+order); cx = new double[order]; // for nuderiv cxx = new double[order]; // computed by discrete cy = new double[order]; cyy = new double[order]; xx = new double[order]; yy = new double[order]; iu = new int[order]; // x index is u position jv = new int[order]; // y index+nDOF is v position build_vert(); build_equations(); setTitle(fname+" "); // ndel, order to String setSize(width,height); setBackground(Color.white); setForeground(Color.black); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setVisible(true); this.addMouseListener (new mousePressHandler()); } // end constructor w0015pde void build_vert() { double x, y; // read in a airfoil System.out.println("about to read airfoil grid from file "+fname); read_grid G = new read_grid(fname); nxg = G.read_xgrid(xg); nyg = G.read_ygrid(yg); nbound = G.read_bound(ixbound, jybound); for(int k=0; k=0) { X[k] = X[var1[k]]*X[var2[k]]; } } // solve nonlinear equations, use results u, v, p SN.simeq(neqn, ntot-neqn, A, Y, var1, var2, var3, vari1, vari2, X); //print results from X System.out.println(" ix jy u v p"); for(int i=0; i0) gname = args[0]; int tndel = 4; // minimum number of points from airfoil to boundary if(args.length>1) tndel = Integer.parseInt(args[1]); int torder = 5; // discretion order if(args.length>2) torder = Integer.parseInt(args[2]); if(torder>tndel+1) torder = tndel+1; new w0015pde(gname, tndel, torder); System.out.println("w0015pde.java ends"); } // end main } // end class w0015pde