// w0015grid.java wing in wind tunnel, plot, get left and right grid // wing defined by y=f(x), sequence of points around boundary // can rotate x,y about center at maximum chord to ax1,ay1 // write output file w0015a**.dat ** is angle of attack import java.awt.*; import java.awt.event.*; import java.io.*; public class w0015grid extends Frame { double xmin = 0.0; double xmax = 1.0; double xoff = 50.0; double yoff = 400.0; double scale = 500.0; // for plotting double ymin; // computed, depends on angle of attack double ymax; double xmins; double xmaxs; double xtop, ytop, xbot, ybot, xfront, yfront; // special points double xadj = -0.5; // approx center for output double grid = 0.01; // grid spacing, may be computed int written = 0; int maxwrite = 3; int width = 600; int height = 600; // upper part for title double Pi = 3.14159265358979323846; int npts = 200; double xp[] = new double[npts]; double yp[] = new double[npts]; int outpts = 100; int ixbound[] = new int[outpts]; // output boundary int jybound[] = new int[outpts]; double xgrid[] = new double[outpts]; // output grid double ygrid[] = new double[outpts]; int npts_grid; int nxg; double angle_deg = 22.0; // may be read in String angle_ch = "22"; String fname = "w0015a22.grid"; String ltr = "a"; double ndiv=11.0; // number of xg divisions int n = 0; boolean connect = false; // FILE* fout; w0015grid(String gname, String ang, String altr) { System.out.println("w0015grid.java running"); angle_ch = ang; angle_deg = (double)Integer.parseInt(angle_ch); fname = gname.substring(0,5)+altr+angle_ch+gname.substring(8,13); if(altr.equals("b")) ndiv = 5.0; if(altr.equals("c")) ndiv = 17.0; System.out.println("writing "+fname+" angle_deg="+angle_deg+" ndiv="+ndiv); build_bound(angle_deg); yminmax(); compute_grid(); write_grid(); // writes grid and boundary indices setTitle("fname"); 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 w0015grid class mousePressHandler extends MouseAdapter { public void mousePressed (MouseEvent e) { int x, y, b; x = e.getX(); y = e.getY(); b = e.getButton(); if(b==3 && n>0) { connect=true; } requestFocus(); System.out.println("at x="+x+" y="+y+" b="+b); // debug print repaint(); } // end mousePressed } // end class mousePressedHandler public void paint(Graphics g) { g.setColor(Color.black); g.drawString(fname, 20, 50); g.setColor(Color.red); for(int i=0; iygrid[j]) { t = ygrid[i]; ygrid[i] = ygrid[j]; ygrid[j] = t; for(int k=0; k0) gname = args[0]; String ang="22"; if(args.length>1) ang = args[1]; String altr = "a"; if(args.length>2) altr = args[2]; new w0015grid(gname, ang, altr); System.out.println("w0015grid.java ends "+altr+ang); } } // end class w0015grid