package cylinder1; /** * Title: cylinder1.java * Description: This program performs a finite element analysis * on the interface of an ideal fluid spinning at a single * rotational velocity in a cylinder spinning about its axis. * The x,y coordinates of the interface are saved to a text file, * the coordinates being take with respect to x=0 along the axis of rotation * and y=0 at the bottom of the cylinder. * * * @author Rotating cylinder group, MATH 2413A, Fall 2002 * @version 1.0 */ import java.io.*; public class simulation { public simulation() { } public static void main(String[] args) { simulation simulation1 = new simulation(); //The radius of the circumference of a circle to its diameter //in Euclidean space double pi=3.141592; //unused, can be implemented to model surface tension double sigma=.15432358; //Density of water in lbm/in^2 double rho=0.036127292; //acceleration of gravity in in^2/s double g=386.08858; //angular velocity of the cylinder double omega=6.86; //radius of the cylinder in inches double r=1.909859317; //height of the water level at rest in inches double h0=3.3750; //number of times to try to optimize the interface int iterations=1000; //resolution of the simulation int res = 100; //width and length of each block of water double xscale=2.0/res; //height of each block of water double yscale=h0/res; double xs2=xscale*xscale; double ys2=yscale*yscale; //amount by which to adjust each stack of water each iteration double increment=0.01; double energy=0; double oldenergy; double penergy=-1; //the water is modeled by an array, the index being the x coordinate //of the stack of water divided by xscale, and the corresponding element //of the array being the y coordinate of the top of the stack of water //divided by yscale double [] cols = new double[res]; for (int i=0; i=0) { for (int k=1; k